org.mule.api.registry
Interface Registry

All Superinterfaces:
Disposable, Initialisable
All Known Subinterfaces:
MuleRegistry, RegistryBroker
All Known Implementing Classes:
AbstractRegistry, AbstractRegistryBroker, DefaultRegistryBroker, GuiceRegistry, MuleRegistryHelper, SpringRegistry, TransientRegistry

public interface Registry
extends Initialisable, Disposable


Field Summary
 
Fields inherited from interface org.mule.api.lifecycle.Initialisable
PHASE_NAME
 
Fields inherited from interface org.mule.api.lifecycle.Disposable
PHASE_NAME
 
Method Summary
 void fireLifecycle(String phase)
           
<T> T
get(String key)
          Alias method performing the lookup, here to simplify syntax when called from dynamic languages.
 String getRegistryId()
           
 boolean isReadOnly()
           
 boolean isRemote()
           
<T> Map<String,T>
lookupByType(Class<T> type)
           
<T> T
lookupObject(Class<T> clazz)
          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<String,Object> 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 interface org.mule.api.lifecycle.Initialisable
initialise
 
Methods inherited from interface org.mule.api.lifecycle.Disposable
dispose
 

Method Detail

get

<T> T get(String key)
Alias method performing the lookup, here to simplify syntax when called from dynamic languages.


lookupObject

<T> T lookupObject(String key)
Look up a single object by name.

Returns:
object or null if not found

lookupObjects

<T> Collection<T> lookupObjects(Class<T> type)
Look up all objects of a given type.

Returns:
collection of objects or empty collection if none found

lookupObjectsForLifecycle

<T> Collection<T> lookupObjectsForLifecycle(Class<T> type)
Look up all objects of a given type that lifecycle should be applied to. This method differs from 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.

Returns:
collection of objects or empty collection if none found

lookupObject

<T> T lookupObject(Class<T> clazz)
               throws RegistrationException
Look up a single object by type.

Returns:
object or null if not found
Throws:
RegistrationException - if more than one object is found.

lookupByType

<T> Map<String,T> lookupByType(Class<T> type)
Returns:
key/object pairs

registerObject

void registerObject(String key,
                    Object value)
                    throws RegistrationException
Registers an object in the registry with a key.

Parameters:
key - the key to store the value against. This is a non-null value
value - the object to store in the registry. This is a non-null value
Throws:
RegistrationException - if an object with the same key already exists

registerObject

void registerObject(String key,
                    Object value,
                    Object metadata)
                    throws RegistrationException
Registers an object in the registry with a key.

Parameters:
key - the key to store the value against. This is a non-null value
value - the object to store in the registry. This is a non-null value
metadata - an implementation specific argument that can be passed into the method
Throws:
RegistrationException - if an object with the same key already exists

registerObjects

void registerObjects(Map<String,Object> objects)
                     throws RegistrationException
Registers a Map of objects into the registry

Parameters:
objects - a map of key value pairs, each will individually be registered in the registry
Throws:
RegistrationException - if an object with the same key already exists

unregisterObject

void unregisterObject(String key)
                      throws RegistrationException
Will remove an object by name from the registry. By default the registry must apply all remaining lifecycle phases to the object when it is removed.

Parameters:
key - the name or key of the object to remove from the registry
Throws:
RegistrationException - if there is a problem unregistering the object. Typically this will be because the object's lifecycle threw an exception

unregisterObject

void unregisterObject(String key,
                      Object metadata)
                      throws RegistrationException
Will remove an object by name from the registry. By default the registry must apply all remaining lifecycle phases to the object when it is removed.

Parameters:
key - the name or key of the object to remove from the registry
metadata - an implementation specific argument that can be passed into the method
Throws:
RegistrationException - if there is a problem unregistering the object. Typically this will be because the object's lifecycle threw an exception

getRegistryId

String getRegistryId()

fireLifecycle

void fireLifecycle(String phase)
                   throws LifecycleException
Throws:
LifecycleException

isReadOnly

boolean isReadOnly()

isRemote

boolean isRemote()


Copyright © 2003-2012 MuleSoft, Inc.. All Rights Reserved.