|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.mule.registry.AbstractRegistry
org.mule.module.guice.GuiceRegistry
public class GuiceRegistry
The internal Mule interface for retreiving objects from a Guice injector. This registry is read-only since all
objects should be configured by Module
objects. The lifecycle of objects will be
managed by Mule since Guice does not provide lifecycle support.
AbstractMuleGuiceModule
since it provides hooks and helpers for
working with Mule configuration. Any modules independent of Mule can just extend the Guice AbstractModule
as normal.
Mule will discover modules on the classpath, if you need to configure a module before passing it to the Guice injector you
need to implement a GuiceModuleFactory
for your module.
AbstractMuleGuiceModule
,
GuiceModuleFactory
Field Summary |
---|
Fields inherited from class org.mule.registry.AbstractRegistry |
---|
lifecycleManager, logger, muleContext |
Fields inherited from interface org.mule.api.lifecycle.Initialisable |
---|
PHASE_NAME |
Fields inherited from interface org.mule.api.lifecycle.Disposable |
---|
PHASE_NAME |
Constructor Summary | |
---|---|
GuiceRegistry(MuleContext muleContext)
|
Method Summary | ||
---|---|---|
protected void |
doDispose()
|
|
protected void |
doInitialise()
|
|
boolean |
isReadOnly()
|
|
boolean |
isRemote()
|
|
|
lookupByType(Class<T> type)
|
|
|
lookupObject(Class<T> type)
Look up a single object by type. |
|
|
lookupObject(String key)
Look up a single object by name. |
|
|
lookupObjects(Class<T> type)
Look up all objects of a given type. |
|
void |
registerObject(String key,
Object value)
Registers an object in the registry with a key. |
|
void |
registerObject(String key,
Object value,
Object metadata)
Registers an object in the registry with a key. |
|
void |
registerObjects(Map objects)
Registers a Map of objects into the registry |
|
void |
unregisterObject(String key)
Will remove an object by name from the registry. |
|
void |
unregisterObject(String key,
Object metadata)
Will remove an object by name from the registry. |
Methods inherited from class org.mule.registry.AbstractRegistry |
---|
createLifecycleManager, dispose, fireLifecycle, get, getLifecycleManager, getRegistryId, initialise, lookupObjectsForLifecycle |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public GuiceRegistry(MuleContext muleContext)
Method Detail |
---|
protected void doInitialise() throws InitialisationException
doInitialise
in class AbstractRegistry
InitialisationException
protected void doDispose()
doDispose
in class AbstractRegistry
public <T> T lookupObject(String key)
Registry
public <T> T lookupObject(Class<T> type) throws RegistrationException
Registry
lookupObject
in interface Registry
lookupObject
in class AbstractRegistry
RegistrationException
- if more than one object is found.public <T> Map<String,T> lookupByType(Class<T> type)
public <T> Collection<T> lookupObjects(Class<T> type)
Registry
public void registerObject(String key, Object value) throws RegistrationException
Registry
key
- the key to store the value against. This is a non-null valuevalue
- the object to store in the registry. This is a non-null value
RegistrationException
- if an object with the same key already existspublic void registerObject(String key, Object value, Object metadata) throws RegistrationException
Registry
key
- the key to store the value against. This is a non-null valuevalue
- the object to store in the registry. This is a non-null valuemetadata
- an implementation specific argument that can be passed into the method
RegistrationException
- if an object with the same key already existspublic void registerObjects(Map objects) throws RegistrationException
Registry
objects
- a map of key value pairs, each will individually be registered in the registry
RegistrationException
- if an object with the same key already existspublic void unregisterObject(String key) throws RegistrationException
Registry
key
- the name or key of the object to remove from the registry
RegistrationException
- if there is a problem unregistering the object. Typically this will be because
the object's lifecycle threw an exceptionpublic void unregisterObject(String key, Object metadata) throws RegistrationException
Registry
key
- the name or key of the object to remove from the registrymetadata
- an implementation specific argument that can be passed into the method
RegistrationException
- if there is a problem unregistering the object. Typically this will be because
the object's lifecycle threw an exceptionpublic boolean isReadOnly()
public boolean isRemote()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |