public abstract class AbstractRegistry extends Object implements Registry
Modifier and Type | Field and Description |
---|---|
protected RegistryLifecycleManager |
lifecycleManager |
protected Logger |
logger |
protected MuleContext |
muleContext |
PHASE_NAME
PHASE_NAME
Modifier | Constructor and Description |
---|---|
protected |
AbstractRegistry(String id,
MuleContext muleContext) |
Modifier and Type | Method and Description |
---|---|
protected RegistryLifecycleManager |
createLifecycleManager() |
void |
dispose()
A lifecycle method where implementor should free up any resources.
|
protected abstract void |
doDispose() |
protected abstract void |
doInitialise() |
protected abstract Object |
doUnregisterObject(String key)
Template method for the logic to actually unregister the key without applying any lifecycle to it.
|
void |
fireLifecycle(String phase) |
<T> T |
get(String key)
Alias method performing the lookup, here to simplify syntax when called from dynamic languages.
|
RegistryLifecycleManager |
getLifecycleManager() |
String |
getRegistryId() |
void |
initialise()
Method used to perform any initialisation work.
|
protected boolean |
isInitialised() |
<T> T |
lookupObject(Class<T> type)
Look up a single object by type.
|
<T> Collection<T> |
lookupObjectsForLifecycle(Class<T> type)
Look up all objects of a given type that lifecycle should be applied to.
|
Object |
unregisterObject(String key)
Will remove an object by name from the registry.
|
Object |
unregisterObject(String key,
Object metadata)
Deprecated.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
isReadOnly, isRemote, lookupByType, lookupLocalObjects, lookupObject, lookupObjects, registerObject, registerObject, registerObjects
protected transient Logger logger
protected MuleContext muleContext
protected RegistryLifecycleManager lifecycleManager
protected AbstractRegistry(String id, MuleContext muleContext)
public final void dispose()
Disposable
dispose
in interface Disposable
protected RegistryLifecycleManager createLifecycleManager()
protected abstract void doInitialise() throws InitialisationException
InitialisationException
protected abstract void doDispose()
public final 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 fromprotected boolean isInitialised()
public RegistryLifecycleManager getLifecycleManager()
public void fireLifecycle(String phase) throws LifecycleException
fireLifecycle
in interface Registry
LifecycleException
public <T> T get(String key)
Registry
public final Object unregisterObject(String key) throws RegistrationException
Registry
unregisterObject
in interface Registry
key
- the name or key of the object to remove from the registrynull
if no object was registered under that keyRegistrationException
- if there is a problem unregistering the object. Typically this will be because
the object's lifecycle threw an exception@Deprecated public final Object unregisterObject(String key, Object metadata) throws RegistrationException
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 exceptionprotected abstract Object doUnregisterObject(String key) throws RegistrationException
unregisterObject(String)
key
- the key of the object to be unregistered objectkey
RegistrationException
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> 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 final String getRegistryId()
getRegistryId
in interface Registry
Copyright © 2003–2015 MuleSoft, Inc.. All rights reserved.