net.walend.director
Class GenericDirector

java.lang.Object
  |
  +--net.walend.director.GenericDirector
All Implemented Interfaces:
FancyDirector

public class GenericDirector
extends java.lang.Object
implements FancyDirector

This class implemetns a simple FancyDirector driven off of the director.properties file. The system property, propertysource.class, sets the class of the initial PropertySource that the GenericDirector uses for everything.

Since:
20001125
Author:
David Walend

Field Summary
protected  Map rolesToClasses
          Maps roles (as Strings) to classes.
protected  MutableMap rolesToSingletons
          Maps roles (as classes) to objects.
private  java.lang.Object singletonGuard
          Any access to rolesToSingletons should happen within the bounds of this guard.
 
Fields inherited from interface net.walend.director.FancyDirector
DIRECTOR
 
Constructor Summary
GenericDirector()
           
 
Method Summary
 java.lang.Class getClassForRole(java.lang.String role)
          Return the concrete class to use for this particular interface.
 java.lang.Object getObjectForRole(java.lang.String role)
          Return an instance of an Object that can fulfil the role.
 PropertySource getPropertySource()
          Return the PropertySource.
 java.lang.Object getSingletonForRole(java.lang.String role)
          Return an instance of an Object that can fulfil the role.
private  java.lang.Object getSingletonGuard()
          Use this method to access the singeltonGuard.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

rolesToClasses

protected Map rolesToClasses
Maps roles (as Strings) to classes. Initialized in the constructor


rolesToSingletons

protected MutableMap rolesToSingletons
Maps roles (as classes) to objects. Initialized JIT.


singletonGuard

private final java.lang.Object singletonGuard
Any access to rolesToSingletons should happen within the bounds of this guard. Use the getSingletonGuard() to access the object.

Constructor Detail

GenericDirector

public GenericDirector()
Throws:
<{PropertyException}>
Method Detail

getSingletonGuard

private java.lang.Object getSingletonGuard()
Use this method to access the singeltonGuard.


getClassForRole

public java.lang.Class getClassForRole(java.lang.String role)
Description copied from interface: FancyDirector
Return the concrete class to use for this particular interface.

Specified by:
getClassForRole in interface FancyDirector
Following copied from interface: net.walend.director.FancyDirector
Parameters:
role - The name of a defined role. It should normally match a director. property from the PropertiesSource.

getObjectForRole

public java.lang.Object getObjectForRole(java.lang.String role)
Description copied from interface: FancyDirector
Return an instance of an Object that can fulfil the role.

Specified by:
getObjectForRole in interface FancyDirector
Following copied from interface: net.walend.director.FancyDirector
Parameters:
role - The name of a defined role. It should normally match a director. property from the PropertiesSource.

getSingletonForRole

public java.lang.Object getSingletonForRole(java.lang.String role)
Description copied from interface: FancyDirector
Return an instance of an Object that can fulfil the role.

Specified by:
getSingletonForRole in interface FancyDirector
Following copied from interface: net.walend.director.FancyDirector
Parameters:
role - The name of a defined role. It should normally match a director. property from the PropertiesSource.

getPropertySource

public PropertySource getPropertySource()
Description copied from interface: FancyDirector
Return the PropertySource.

Specified by:
getPropertySource in interface FancyDirector


Copyright (c) 2000, 2001, David Walend