|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.mule.registry.MuleRegistryHelper
public class MuleRegistryHelper
Adds lookup/register/unregister methods for Mule-specific entities to the standard Registry interface.
| Field Summary | |
|---|---|
protected edu.emory.mathcs.backport.java.util.concurrent.ConcurrentHashMap |
exactTransformerCache
We cache transformer searches so that we only search once |
protected Log |
logger
|
protected edu.emory.mathcs.backport.java.util.concurrent.ConcurrentHashMap |
transformerListCache
|
| Fields inherited from interface org.mule.api.registry.MuleRegistry |
|---|
INJECT_PROCESSORS_BYPASS_FLAG, LIFECYCLE_BYPASS_FLAG, PRE_INIT_PROCESSORS_BYPASS_FLAG |
| Fields inherited from interface org.mule.api.lifecycle.Initialisable |
|---|
PHASE_NAME |
| Fields inherited from interface org.mule.api.lifecycle.Disposable |
|---|
PHASE_NAME |
| Constructor Summary | |
|---|---|
MuleRegistryHelper(DefaultRegistryBroker registry,
MuleContext muleContext)
|
|
| Method Summary | ||
|---|---|---|
Object |
applyLifecycle(Object object)
Will execute any lifecycle phases on an object without actually registering the object in the registry. |
|
Object |
applyLifecycle(Object object,
String phase)
|
|
Object |
applyProcessors(Object object)
Will execute any processors on an object without actually registering the object in the registry. |
|
Object |
applyProcessors(Object object,
int flags)
Will execute any processors on an object without actually registering the object in the registry. |
|
Object |
applyProcessorsAndLifecycle(Object object)
Will execute any processors on an object and fire any lifecycle methods according to the current lifecycle without actually registering the object in the registry. |
|
protected ServiceDescriptor |
createServiceDescriptor(ServiceType type,
String name,
Properties overrides)
|
|
void |
dispose()
A lifecycle method where implementor should free up any resources. |
|
void |
fireLifecycle(String phase)
|
|
|
get(String key)
Alias method performing the lookup, here to simplify syntax when called from dynamic languages. |
|
Collection<Agent> |
getAgents()
|
|
Collection<Connector> |
getConnectors()
|
|
Collection<ImmutableEndpoint> |
getEndpoints()
|
|
Collection<Model> |
getModels()
|
|
protected String |
getName(Object obj)
Returns the name for the object passed in. |
|
String |
getRegistryId()
|
|
Collection<Transformer> |
getTransformers()
|
|
void |
initialise()
Method used to perform any initialisation work. |
|
boolean |
isReadOnly()
|
|
boolean |
isRemote()
|
|
Agent |
lookupAgent(String name)
|
|
|
lookupByType(Class<T> type)
|
|
Connector |
lookupConnector(String name)
|
|
EndpointBuilder |
lookupEndpointBuilder(String name)
Looks-up endpoint builders which can be used to repeatably create endpoints with the same configuration. |
|
EndpointFactory |
lookupEndpointFactory()
|
|
FlowConstruct |
lookupFlowConstruct(String name)
|
|
Collection<FlowConstruct> |
lookupFlowConstructs()
|
|
Model |
lookupModel(String name)
|
|
|
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. |
|
|
lookupObjectsForLifecycle(Class<T> type)
Look up all objects of a given type that lifecycle should be applied to. |
|
Service |
lookupService(String name)
|
|
ServiceDescriptor |
lookupServiceDescriptor(ServiceType type,
String name,
Properties overrides)
Looks up the service descriptor from a singleton cache and creates a new one if not found. |
|
Collection<Service> |
lookupServices()
|
|
Collection<Service> |
lookupServices(String model)
|
|
Model |
lookupSystemModel()
|
|
Transformer |
lookupTransformer(Class inputType,
Class outputType)
Deprecated. use lookupTransformer(org.mule.api.transformer.DataType, org.mule.api.transformer.DataType) instead. This
method should only be used internally to discover transformers, typically a user does not need ot do this
directly |
|
Transformer |
lookupTransformer(DataType source,
DataType result)
Will find a transformer that is the closest match to the desired input and output. |
|
Transformer |
lookupTransformer(String name)
|
|
List<Transformer> |
lookupTransformers(Class input,
Class output)
Deprecated. use lookupTransformer(org.mule.api.transformer.DataType, org.mule.api.transformer.DataType) instead. This
method should only be used internally to discover transformers, typically a user does not need ot do this
directly |
|
List<Transformer> |
lookupTransformers(DataType source,
DataType result)
This method will return a list of Transformer objects that accept the given
input and return the given output type of object |
|
protected void |
notifyTransformerResolvers(Transformer t,
TransformerResolver.RegistryAction action)
|
|
void |
registerAgent(Agent agent)
|
|
void |
registerConnector(Connector connector)
|
|
void |
registerEndpoint(ImmutableEndpoint endpoint)
|
|
void |
registerEndpointBuilder(String name,
EndpointBuilder builder)
|
|
void |
registerFlowConstruct(FlowConstruct flowConstruct)
|
|
void |
registerModel(Model model)
|
|
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 |
registerService(Service service)
|
|
void |
registerTransformer(Transformer transformer)
|
|
protected Transformer |
resolveTransformer(DataType source,
DataType result)
|
|
void |
unregisterAgent(String agentName)
|
|
void |
unregisterConnector(String connectorName)
|
|
void |
unregisterEndpoint(String endpointName)
|
|
void |
unregisterFlowConstruct(String flowConstructName)
|
|
void |
unregisterModel(String modelName)
|
|
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. |
|
void |
unregisterService(String serviceName)
|
|
void |
unregisterTransformer(String transformerName)
|
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected transient Log logger
protected edu.emory.mathcs.backport.java.util.concurrent.ConcurrentHashMap exactTransformerCache
protected edu.emory.mathcs.backport.java.util.concurrent.ConcurrentHashMap transformerListCache
| Constructor Detail |
|---|
public MuleRegistryHelper(DefaultRegistryBroker registry,
MuleContext muleContext)
| Method Detail |
|---|
public void initialise()
throws InitialisationException
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 InitialisableInitialisationException - if a fatal error occurs causing the Mule instance to shutdown
RecoverableException - if an error occurs that can be recovered frompublic void dispose()
dispose in interface Disposable
public void fireLifecycle(String phase)
throws LifecycleException
fireLifecycle in interface RegistryLifecycleExceptionpublic Connector lookupConnector(String name)
lookupConnector in interface MuleRegistrypublic EndpointBuilder lookupEndpointBuilder(String name)
lookupEndpointBuilder in interface MuleRegistryname - the name of the endpointBuilder to find
public EndpointFactory lookupEndpointFactory()
lookupEndpointFactory in interface MuleRegistrypublic Transformer lookupTransformer(String name)
lookupTransformer in interface MuleRegistry
@Deprecated
public Transformer lookupTransformer(Class inputType,
Class outputType)
throws TransformerException
lookupTransformer(org.mule.api.transformer.DataType, org.mule.api.transformer.DataType) instead. This
method should only be used internally to discover transformers, typically a user does not need ot do this
directly
lookupTransformer in interface MuleRegistryinputType - The desiered input type for the transformeroutputType - the desired output type for the transformer
TransformerException - will be thrown if there is more than one match
@Deprecated
public List<Transformer> lookupTransformers(Class input,
Class output)
lookupTransformer(org.mule.api.transformer.DataType, org.mule.api.transformer.DataType) instead. This
method should only be used internally to discover transformers, typically a user does not need ot do this
directly
Transformer objects that accept the given
input and return the given output type of object
lookupTransformers in interface MuleRegistryinput - The desiered input type for the transformeroutput - the desired output type for the transformer
public Transformer lookupTransformer(DataType source,
DataType result)
throws TransformerException
lookupTransformer in interface MuleRegistrysource - The desiered input type for the transformerresult - the desired output type for the transformer
TransformerException - will be thrown if there is more than one match
protected Transformer resolveTransformer(DataType source,
DataType result)
throws TransformerException
TransformerException
public List<Transformer> lookupTransformers(DataType source,
DataType result)
Transformer objects that accept the given
input and return the given output type of object
lookupTransformers in interface MuleRegistrysource - The desired input type for the transformerresult - the desired output type for the transformer
public Model lookupModel(String name)
lookupModel in interface MuleRegistrypublic Model lookupSystemModel()
lookupSystemModel in interface MuleRegistrypublic Collection<Model> getModels()
getModels in interface MuleRegistrypublic Collection<Connector> getConnectors()
getConnectors in interface MuleRegistrypublic Collection<Agent> getAgents()
getAgents in interface MuleRegistrypublic Collection<ImmutableEndpoint> getEndpoints()
getEndpoints in interface MuleRegistrypublic Collection<Transformer> getTransformers()
getTransformers in interface MuleRegistrypublic Agent lookupAgent(String name)
lookupAgent in interface MuleRegistrypublic Service lookupService(String name)
lookupService in interface MuleRegistrypublic Collection<Service> lookupServices()
lookupServices in interface MuleRegistrypublic Collection<Service> lookupServices(String model)
lookupServices in interface MuleRegistrypublic FlowConstruct lookupFlowConstruct(String name)
lookupFlowConstruct in interface MuleRegistrypublic Collection<FlowConstruct> lookupFlowConstructs()
lookupFlowConstructs in interface MuleRegistry
public final void registerTransformer(Transformer transformer)
throws MuleException
registerTransformer in interface MuleRegistryMuleException
protected void notifyTransformerResolvers(Transformer t,
TransformerResolver.RegistryAction action)
public ServiceDescriptor lookupServiceDescriptor(ServiceType type,
String name,
Properties overrides)
throws ServiceException
lookupServiceDescriptor in interface MuleRegistryServiceException
protected ServiceDescriptor createServiceDescriptor(ServiceType type,
String name,
Properties overrides)
throws ServiceException
ServiceException
public void registerAgent(Agent agent)
throws MuleException
registerAgent in interface MuleRegistryMuleException
public void registerConnector(Connector connector)
throws MuleException
registerConnector in interface MuleRegistryMuleException
public void registerEndpoint(ImmutableEndpoint endpoint)
throws MuleException
registerEndpoint in interface MuleRegistryMuleException
public void registerEndpointBuilder(String name,
EndpointBuilder builder)
throws MuleException
registerEndpointBuilder in interface MuleRegistryMuleException
public void registerModel(Model model)
throws MuleException
registerModel in interface MuleRegistryMuleException
public void registerService(Service service)
throws MuleException
registerService in interface MuleRegistryMuleException
public void unregisterService(String serviceName)
throws MuleException
unregisterService in interface MuleRegistryMuleException
public void registerFlowConstruct(FlowConstruct flowConstruct)
throws MuleException
registerFlowConstruct in interface MuleRegistryMuleException
public void unregisterFlowConstruct(String flowConstructName)
throws MuleException
unregisterFlowConstruct in interface MuleRegistryMuleException
public void unregisterAgent(String agentName)
throws MuleException
unregisterAgent in interface MuleRegistryMuleException
public void unregisterConnector(String connectorName)
throws MuleException
unregisterConnector in interface MuleRegistryMuleException
public void unregisterEndpoint(String endpointName)
throws MuleException
unregisterEndpoint in interface MuleRegistryMuleException
public void unregisterModel(String modelName)
throws MuleException
unregisterModel in interface MuleRegistryMuleException
public void unregisterTransformer(String transformerName)
throws MuleException
unregisterTransformer in interface MuleRegistryMuleException
public Object applyProcessorsAndLifecycle(Object object)
throws MuleException
applyProcessorsAndLifecycle in interface MuleRegistryobject - the object to process
MuleException - if the registry fails to perform the lifecycle change or process object processors for the object.
public Object applyProcessors(Object object)
throws MuleException
applyProcessors in interface MuleRegistryobject - the object to process
MuleException - if the registry fails to process object processors for the object.
public Object applyProcessors(Object object,
int flags)
throws MuleException
applyProcessors in interface MuleRegistryobject - the object to processflags - MuleRegistry flags which control which injectors will be applied
MuleException - if the registry fails to process object processors for the object.
public Object applyLifecycle(Object object)
throws MuleException
applyLifecycle in interface MuleRegistryobject - the object to apply the current lifecycle state to
MuleException - if the registry fails to execute a lifecycle method.
b
public Object applyLifecycle(Object object,
String phase)
throws MuleException
applyLifecycle in interface MuleRegistryMuleException
public <T> T lookupObject(Class<T> type)
throws RegistrationException
lookupObject in interface RegistryRegistrationException - if more than one object is found.public <T> T lookupObject(String key)
Registry
lookupObject in interface Registrypublic <T> Collection<T> lookupObjects(Class<T> type)
lookupObjects in interface Registrypublic <T> Collection<T> lookupObjectsForLifecycle(Class<T> type)
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 Registrypublic <T> T get(String key)
Registry
get in interface Registrypublic <T> Map<String,T> lookupByType(Class<T> type)
lookupByType in interface Registry
public void registerObject(String key,
Object value,
Object metadata)
throws RegistrationException
registerObject in interface Registrykey - 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 exists
public void registerObject(String key,
Object value)
throws RegistrationException
registerObject in interface Registrykey - 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 exists
public void registerObjects(Map objects)
throws RegistrationException
registerObjects in interface Registryobjects - a map of key value pairs, each will individually be registered in the registry
RegistrationException - if an object with the same key already exists
public void unregisterObject(String key,
Object metadata)
throws RegistrationException
unregisterObject in interface Registrykey - 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 exception
public void unregisterObject(String key)
throws RegistrationException
unregisterObject in interface Registrykey - 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 exceptionprotected String getName(Object obj)
NamedObject, then
NamedObject.getName() will be returned, otherwise a name is generated using the class name
and a generated UUID.
obj - the object to inspect
public String getRegistryId()
getRegistryId in interface Registrypublic boolean isReadOnly()
isReadOnly in interface Registrypublic boolean isRemote()
isRemote in interface Registry
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||