|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.mchaplin.commons.WmindObject
net.mchaplin.ioc.DefaultContainer
public class DefaultContainer
Default, ready-to-use ContainerI implementation Provides Component registration & management services.
Field Summary | |
---|---|
static int |
HERE
reference this container |
static int |
PARENT
reference this container parent |
static int |
SONS
reference this container sons |
static int |
SONS_DEFAULT_LENTGH
default lentgh for sons array |
int |
sonsCount
registered sons count |
Fields inherited from class net.mchaplin.commons.WmindObject |
---|
EX_CAUSE, EX_STACK, log, METHOD_CALL, propertyHelper, STACK_PREFIX |
Fields inherited from interface net.mchaplin.ioc.component.ComponentI |
---|
CMP_I |
Constructor Summary | |
---|---|
DefaultContainer(ContainerI parent,
java.lang.String name)
Instanciate & register this container as child of another container |
|
DefaultContainer(java.lang.String name)
Instanciate a container. |
Method Summary | |
---|---|
void |
addSon(ContainerI container)
|
ContainerI |
getContainer()
Provide component dependencies lookup facility |
java.util.List<ContainerI> |
getContainers()
|
java.lang.String |
getInstanceName()
|
ContainerI |
getParent()
|
java.util.Map<java.lang.String,java.util.List<ComponentI>> |
getRegisteredTypes()
|
ContainerI[] |
getSons()
|
java.lang.String |
getState()
Return the current state of a Container instance, as formatted text. |
java.lang.String |
lookupComponent(java.lang.Class classType)
Lookup for to see if a given component is currently registered in this Container, its parent or sons. |
java.lang.String |
lookupComponent(java.lang.Class classType,
int where)
Lookup for to see if a given component is currently registered. |
void |
makeComponentAvailable()
Gives back a Component when you stop using it. |
void |
registerComponentImplementation(java.lang.Class component)
Register a Component into the Container |
void |
registerComponentImplementation(java.lang.Class component,
java.lang.Class factory)
Custom component registration. |
void |
registerComponentImplementation(java.lang.Class component,
java.lang.Class factory,
java.lang.String type)
Custom component registration. |
void |
registerComponentImplementation(java.lang.Class component,
java.lang.String type)
Component registration. |
void |
registerComponentInstance(ComponentI instance)
|
void |
registerComponentInstance(ComponentI instance,
java.lang.String key)
|
void |
registerFactoryImplementation(java.lang.Class factory)
Register a Factory for later use. |
void |
reset()
Provide facility for runtime component redeployment |
ComponentI |
retrieveComponentInstance(java.lang.Class classType)
Retrieve the first instance in List of given type. |
ComponentI |
retrieveComponentInstance(java.lang.String key)
Retrieve the first instance in List of given type. |
ComponentI |
retrieveComponentInstance(java.lang.String key,
java.lang.String location)
Retrieve the first instance in List of given type. |
void |
retrieveComponentInstances()
Retrieve a list of all registered components |
java.util.List |
retrieveComponentInstances(java.lang.String key)
Retrieve a list of registered components for the given key |
ComponentFactoryI |
retrieveFactoryInstance(java.lang.Class classType)
Retrieve the first instance in List of given type. |
ComponentFactoryI |
retrieveFactoryInstance(java.lang.String key)
Retrieve the first instance in List of given type. |
void |
setContainer(ContainerI container)
Dependency injection setter |
void |
setContainers(java.util.List<ContainerI> containers)
|
void |
setInstanceName(java.lang.String instanceName)
|
void |
setParent(ContainerI aParent)
|
void |
unregisterComponentInstance(ComponentI instance)
|
Methods inherited from class net.mchaplin.commons.WmindObject |
---|
printInheritance |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int HERE
public static final int PARENT
public static final int SONS
public transient int sonsCount
public static final int SONS_DEFAULT_LENTGH
Constructor Detail |
---|
public DefaultContainer(java.lang.String name)
public DefaultContainer(ContainerI parent, java.lang.String name)
parent
- Method Detail |
---|
public void registerComponentImplementation(java.lang.Class component)
registerComponentImplementation
in interface ContainerI
component
- the component to registerpublic void registerFactoryImplementation(java.lang.Class factory)
registerFactoryImplementation
in interface ContainerI
factory
- the factory to registerpublic void registerComponentImplementation(java.lang.Class component, java.lang.String type)
registerComponentImplementation
in interface ContainerI
component
- the component Class to registertype
- optional, the type to register this instance as. If set, the
Component will be registered under its fully qualified class
namepublic void registerComponentImplementation(java.lang.Class component, java.lang.Class factory) throws ContainerException
registerComponentImplementation
in interface ContainerI
component
- the component to registerfactory
- the factory to register
ContainerException
ContainerI.registerComponentImplementation(java.lang.Class,
java.lang.Class)
public void registerComponentImplementation(java.lang.Class component, java.lang.Class factory, java.lang.String type) throws ContainerException
registerComponentImplementation
in interface ContainerI
component
- the component to registerfactory
- the factory to registertype
- the type to register this instance as. If set, the
Component will be registered under its fully qualified class
name
ContainerException
ContainerI.registerComponentImplementation(java.lang.Class,
java.lang.Class)
public void registerComponentInstance(ComponentI instance)
registerComponentInstance
in interface ContainerI
public void registerComponentInstance(ComponentI instance, java.lang.String key)
registerComponentInstance
in interface ContainerI
public ComponentI retrieveComponentInstance(java.lang.Class classType)
retrieveComponentInstance
in interface ContainerI
classType
- the Class type to retrieve an instance of.
public ComponentI retrieveComponentInstance(java.lang.String key)
retrieveComponentInstance
in interface ContainerI
key
- the component type to retrieve an instance of
public ComponentI retrieveComponentInstance(java.lang.String key, java.lang.String location)
retrieveComponentInstance
in interface ContainerI
key
- the component type to retrieve an instance oflocation
- the location of the container where the component
should be retrieved from.
public ComponentFactoryI retrieveFactoryInstance(java.lang.Class classType)
retrieveFactoryInstance
in interface ContainerI
classType
- the Class type to retrieve an instance of.
public ComponentFactoryI retrieveFactoryInstance(java.lang.String key)
retrieveFactoryInstance
in interface ContainerI
key
- the key to retrieve associated Factory instance.
public java.util.List retrieveComponentInstances(java.lang.String key)
retrieveComponentInstances
in interface ContainerI
public void retrieveComponentInstances()
retrieveComponentInstances
in interface ContainerI
public void makeComponentAvailable()
makeComponentAvailable
in interface ContainerI
public void unregisterComponentInstance(ComponentI instance)
unregisterComponentInstance
in interface ContainerI
public ContainerI getContainer()
ComponentI
getContainer
in interface ComponentI
getContainer
in interface ContainerI
net.mchaplin.ioc.ComponentI#getContainer()
public java.lang.String lookupComponent(java.lang.Class classType)
lookupComponent
in interface ContainerI
classType
- the Class type to lookup for.
public java.lang.String lookupComponent(java.lang.Class classType, int where)
lookupComponent
in interface ContainerI
classType
- the Class type to lookup for.where
- where to lookup the component : here, parent or sons
public java.util.List<ContainerI> getContainers()
public void setContainers(java.util.List<ContainerI> containers)
containers
- The containers to set.public java.lang.String getInstanceName()
getInstanceName
in interface ContainerI
public void setInstanceName(java.lang.String instanceName)
setInstanceName
in interface ContainerI
instanceName
- The instanceName to set.public ContainerI getParent()
getParent
in interface ContainerI
ContainerI.getParent()
public final void setParent(ContainerI aParent)
setParent
in interface ContainerI
ContainerI.setParent(net.mchaplin.ioc.ContainerI)
public java.util.Map<java.lang.String,java.util.List<ComponentI>> getRegisteredTypes()
getRegisteredTypes
in interface ContainerI
public ContainerI[] getSons()
getSons
in interface ContainerI
public java.lang.String getState()
getState
in interface ContainerI
public void addSon(ContainerI container)
addSon
in interface ContainerI
public void setContainer(ContainerI container)
ComponentI
setContainer
in interface ComponentI
ComponentI.setContainer(net.mchaplin.ioc.ContainerI)
public void reset()
ComponentI
reset
in interface ComponentI
reset
in interface ContainerI
net.mchaplin.ioc.ComponentI#reset()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |