|
![]() |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.openpermis.editor.policy.configuration.BasicComponentFactory
public class BasicComponentFactory
Basic implementation of a pico container based component factory.
Constructor Summary | |
---|---|
BasicComponentFactory(ClassSettings settings,
ConfigurationReader reader)
Creates a new component factory for the specified configuration URL. |
|
BasicComponentFactory(org.picocontainer.MutablePicoContainer contextContainer,
org.picocontainer.MutablePicoContainer factoryContainer)
Creates a new component factory for the specified context and factory container. |
Method Summary | ||
---|---|---|
void |
addFactoryAdapter(org.picocontainer.ComponentAdapter<?> componentAdapter)
Adds a component adapter to the factory container. |
|
void |
addFactoryComponent(Object implOrInstance)
Adds a component implementation or instance to the factory container. |
|
void |
addFactoryComponent(Object componentKey,
Object implOrInstance)
Adds a component implementation or instance to the factory container with a key. |
|
boolean |
canCreate(TypeKey typeKey)
Check if this factory can create components of the given type. |
|
|
create(Class<?> type,
State... context)
Creates a component. |
|
|
create(TypeKey typeKey,
State... context)
Creates a typed component. |
|
protected
|
getComponent(Object key,
State... context)
|
|
|
instances(Class<T> type)
Returns a list of all instances of a specific type stored at the factory. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public BasicComponentFactory(ClassSettings settings, ConfigurationReader reader) throws ConfigurationException
settings
- the object to store configuration settings to.reader
- the reader for the configuration.
ConfigurationException
- passed on, see
ConfigurationReader.configure(org.openpermis.editor.policy.configuration.ClassSettings, org.picocontainer.MutablePicoContainer)
.public BasicComponentFactory(org.picocontainer.MutablePicoContainer contextContainer, org.picocontainer.MutablePicoContainer factoryContainer)
The context has to be a parent container of the factory container (not checked).
The factory becomes the new owner of the two containers passed in!
contextContainer
- the context container that is modified during construction time
to add optional state to.factoryContainer
- the readonly factory container that contains the implementation
classes or keys.Method Detail |
---|
public void addFactoryComponent(Object implOrInstance)
Implementation classes will be added without caching.
implOrInstance
- the component implementation or instance add.public void addFactoryComponent(Object componentKey, Object implOrInstance)
Implementation classes will be added without caching.
componentKey
- the component key to use.implOrInstance
- the component implementation or instance add.public void addFactoryAdapter(org.picocontainer.ComponentAdapter<?> componentAdapter)
componentAdapter
- the component adapter to add.protected <T> T getComponent(Object key, State... context)
public <T> T create(Class<?> type, State... context)
ComponentFactory
The context state supplied is used to fill in missing parameters that are not available as default instances or implementations at the factory.
create
in interface ComponentFactory
T
- the component type, has to correspond to the scope of the type key.type
- the class for which to create the component.context
- additional state to inject to the component created.
public <T> T create(TypeKey typeKey, State... context)
ComponentFactory
The context state supplied is used to fill in missing parameters that are not available as default instances or implementations at the factory.
create
in interface ComponentFactory
T
- the component type, has to correspond to the scope of the type key.typeKey
- the type key for which to create the component.context
- additional state to inject to the component created.
public boolean canCreate(TypeKey typeKey)
ComponentFactory
canCreate
in interface ComponentFactory
typeKey
- the type key for which to check if the factory can create an instance.
true
if the factory can provide an instance, false
otherwise.public <T> List<T> instances(Class<T> type)
ComponentFactory
Take care to use this method only to retrieve cached instances otherwise this factory will create an instance for each of the registered implementation types that are assignable to the type specified.
instances
in interface ComponentFactory
T
- the instance type to retrieve.type
- the class of the instance type to retrieve.
null
but may be empty.
|
![]() |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
OpenPermis Role Based Access Control 0.9.0 (Build 16)
2009/08/13 07:17:21
Copyright (c) 2002-2007 Ergon Informatik AG