public abstract class AbstractRegistryBroker extends Object implements RegistryBroker
Modifier and Type | Field and Description |
---|---|
protected RegistryBrokerLifecycleManager |
lifecycleManager |
PHASE_NAME
PHASE_NAME
Constructor and Description |
---|
AbstractRegistryBroker(MuleContext muleContext) |
Modifier and Type | Method and Description |
---|---|
void |
dispose()
A lifecycle method where implementor should free up any resources.
|
void |
fireLifecycle(String phase) |
<T> T |
get(String key)
Alias method performing the lookup, here to simplify syntax when called from dynamic languages.
|
protected abstract Collection<Registry> |
getRegistries() |
String |
getRegistryId() |
void |
initialise()
Method used to perform any initialisation work.
|
boolean |
isReadOnly() |
boolean |
isRemote() |
<T> Map<String,T> |
lookupByType(Class<T> type) |
<T> Collection<T> |
lookupLocalObjects(Class<T> type)
Look up all objects of a given type within the local registry.
|
<T> T |
lookupObject(Class<T> type)
Look up a single object by type.
|
<T> T |
lookupObject(String key)
Look up a single object by name.
|
<T> Collection<T> |
lookupObjects(Class<T> type)
Look up all objects of a given type.
|
<T> Collection<T> |
lookupObjectsForLifecycle(Class<T> type)
Look up all objects of a given type that lifecycle should be applied to.
|
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.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
addRegistry, removeRegistry
protected RegistryBrokerLifecycleManager lifecycleManager
public AbstractRegistryBroker(MuleContext muleContext)
public void initialise() throws InitialisationException
Initialisable
InitialisationException
should be thrown,
causing the Mule instance to shutdown. If the error is recoverable, say by
retrying to connect, a RecoverableException
should be thrown.
There is no guarantee that by throwing a Recoverable exception that the Mule
instance will not shut down.initialise
in interface Initialisable
InitialisationException
- if a fatal error occurs causing the Mule instance to shutdownRecoverableException
- if an error occurs that can be recovered frompublic void dispose()
Disposable
dispose
in interface Disposable
public void fireLifecycle(String phase) throws LifecycleException
fireLifecycle
in interface Registry
LifecycleException
public String getRegistryId()
getRegistryId
in interface Registry
public boolean isReadOnly()
isReadOnly
in interface Registry
protected abstract Collection<Registry> getRegistries()
public <T> T get(String key)
Registry
public <T> T lookupObject(String key)
Registry
lookupObject
in interface Registry
public <T> T lookupObject(Class<T> type) throws RegistrationException
Registry
lookupObject
in interface Registry
RegistrationException
- if more than one object is found.public <T> Collection<T> lookupObjects(Class<T> type)
Registry
lookupObjects
in interface Registry
public <T> Collection<T> lookupLocalObjects(Class<T> type)
Registry
lookupLocalObjects
in interface Registry
public <T> Map<String,T> lookupByType(Class<T> type)
lookupByType
in interface Registry
public <T> Collection<T> lookupObjectsForLifecycle(Class<T> type)
Registry
Registry.lookupObjects(Class)
in that it allows
implementations to provide an alternative implementation of lookup for
lifecycle. For example only returning pre-existing objects and not creating
new ones on the fly.lookupObjectsForLifecycle
in interface Registry
public void registerObject(String key, Object value) throws RegistrationException
Registry
registerObject
in interface 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 valueRegistrationException
- if an object with the same key already existspublic void registerObject(String key, Object value, Object metadata) throws RegistrationException
Registry
registerObject
in interface 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 methodRegistrationException
- if an object with the same key already existspublic void registerObjects(Map objects) throws RegistrationException
Registry
registerObjects
in interface Registry
objects
- a map of key value pairs, each will individually be registered in the registryRegistrationException
- if an object with the same key already existspublic void unregisterObject(String key) throws RegistrationException
Registry
unregisterObject
in interface Registry
key
- the name or key of the object to remove from the registryRegistrationException
- 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
unregisterObject
in interface Registry
key
- the name or key of the object to remove from the registrymetadata
- an implementation specific argument that can be passed into the methodRegistrationException
- if there is a problem unregistering the object. Typically this will be because
the object's lifecycle threw an exceptionCopyright © 2003–2015 MuleSoft, Inc.. All rights reserved.