org.objectweb.kilim.model.instanciation
Class DefaultInstanciationStrategy

java.lang.Object
  extended byorg.objectweb.kilim.model.instanciation.DefaultInstanciationStrategy
All Implemented Interfaces:
InstanciationStrategy

public class DefaultInstanciationStrategy
extends java.lang.Object
implements InstanciationStrategy

This class is a simple container dedicated to the definition of instanciation strategies. It is used by the component factory to find the instanciation manager to be associated to each application component. It is possible to redefine a default instanciation manager, and to define per template managers and per instance managers. The factory uses the following look up strategy. The search is stopped as soon as a manager is found. the component factory first looks for a manager explicitely associated to the component. If none can be found, it then looks for a manager explicitely associated to the component template. If none can be found, it recursively looks for a manager explicitely associated to super templates. If none can be found it looks for a default manager. No null value can be returned, since this class defines a NAryPreInstanciationMger as default instanciation manager and no null value is accepted by the setDefaultMger().

Author:
horn

Field Summary
private  InstanciationMger defaultMger
           
private  java.util.HashMap perInstanceMger
           
private  java.util.HashMap perTemplateMger
           
 
Constructor Summary
DefaultInstanciationStrategy()
           
DefaultInstanciationStrategy(InstanciationMger aMger)
          Method InstanciationStrategy.
 
Method Summary
 InstanciationMger getDefaultMger()
          Method getDefaultMger returns the default manager.
 InstanciationMger getPerInstanceMger(java.lang.String aName)
          Method getPerInstanceMger.
 InstanciationMger getPerTemplateMger(java.lang.String aName)
          Method getPerTemplateMger
 void setDefaultMger(InstanciationMger aMger)
          Method setDefaultMger.
 void setPerInstanceMger(java.lang.String aName, InstanciationMger aManager)
          Method setPerInstanceMger sets the manager to be used for a given instance.
 void setPerTemplateMger(java.lang.String aName, InstanciationMger aManager)
          Method setPerTemplateMger sets the manager to be used when the component is an instance of a template or one of its subtemplates.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

defaultMger

private InstanciationMger defaultMger

perTemplateMger

private java.util.HashMap perTemplateMger

perInstanceMger

private java.util.HashMap perInstanceMger
Constructor Detail

DefaultInstanciationStrategy

public DefaultInstanciationStrategy()
                             throws KilimException
See Also:
Object.Object()

DefaultInstanciationStrategy

public DefaultInstanciationStrategy(InstanciationMger aMger)
                             throws KilimException
Method InstanciationStrategy.

Parameters:
aMger - : a default instanciation manager (this ctor just contains a call to setDefaultManager(aMger)
Throws:
KilimException - : generated if the reference is null. A NullInstanciationMger should be indicated if no action should be performed at instanciation time.
Method Detail

setDefaultMger

public void setDefaultMger(InstanciationMger aMger)
                    throws KilimException
Description copied from interface: InstanciationStrategy
Method setDefaultMger.

Specified by:
setDefaultMger in interface InstanciationStrategy
Parameters:
aMger - : a default instanciation manager (this ctor just contains a call to setDefaultManager(aMger). This value cannot be null. A NullInstanciationMger should be indicated if no action should be performed at instanciation time.
Throws:
KilimException - : generated if the reference is null.
See Also:
org.objectweb.kilim.model.services.InstanciationStrategy#setDefaultMger(InstanciationMger)

getDefaultMger

public InstanciationMger getDefaultMger()
Description copied from interface: InstanciationStrategy
Method getDefaultMger returns the default manager.

Specified by:
getDefaultMger in interface InstanciationStrategy
Returns:
InstanciationMger
See Also:
org.objectweb.kilim.model.services.InstanciationStrategy#getDefaultMger()

setPerTemplateMger

public void setPerTemplateMger(java.lang.String aName,
                               InstanciationMger aManager)
                        throws KilimException
Description copied from interface: InstanciationStrategy
Method setPerTemplateMger sets the manager to be used when the component is an instance of a template or one of its subtemplates.

Specified by:
setPerTemplateMger in interface InstanciationStrategy
Parameters:
aName - is name of the template.
aManager - is the manager to be used.
Throws:
KilimException - : generated when aName is null.
See Also:
org.objectweb.kilim.model.services.InstanciationStrategy#setPerTemplateMger(String, InstanciationMger)

getPerTemplateMger

public InstanciationMger getPerTemplateMger(java.lang.String aName)
                                     throws KilimException
Description copied from interface: InstanciationStrategy
Method getPerTemplateMger

Specified by:
getPerTemplateMger in interface InstanciationStrategy
Parameters:
aName - : the name of the template.
Returns:
InstanciationMger
Throws:
KilimException - : generated when aName is null
See Also:
org.objectweb.kilim.model.services.InstanciationStrategy#getPerTemplateMger(String)

setPerInstanceMger

public void setPerInstanceMger(java.lang.String aName,
                               InstanciationMger aManager)
                        throws KilimException
Description copied from interface: InstanciationStrategy
Method setPerInstanceMger sets the manager to be used for a given instance.

Specified by:
setPerInstanceMger in interface InstanciationStrategy
Parameters:
aName - : the name of the component.
aManager - : the manager to be used
Throws:
KilimException - : generated when aName is null.
See Also:
org.objectweb.kilim.model.services.InstanciationStrategy#setPerInstanceMger(String, InstanciationMger)

getPerInstanceMger

public InstanciationMger getPerInstanceMger(java.lang.String aName)
                                     throws KilimException
Description copied from interface: InstanciationStrategy
Method getPerInstanceMger.

Specified by:
getPerInstanceMger in interface InstanciationStrategy
Parameters:
aName - : the name of the component
Returns:
InstanciationMger :
Throws:
KilimException - : generated when aName is null.
See Also:
org.objectweb.kilim.model.services.InstanciationStrategy#getPerInstanceMger(String)