org.mule
Class MuleManager

java.lang.Object
  extended byorg.mule.MuleManager
All Implemented Interfaces:
Disposable, Lifecycle, Startable, Stoppable, UMOManager

public class MuleManager
extends Object
implements UMOManager

MuleManager maintains and provides services for a Mule instance.


Method Summary
 void addProperties(Map props)
           
 void dispose()
          Destroys the MuleManager and all resources it maintains
protected  void disposeAgents()
          {@inheritDoc}
 void fireNotification(UMOServerNotification notification)
          Fires a server notification to all registered CustomNotificationListener notificationManager.
protected  void fireSystemEvent(UMOServerNotification e)
          Fires a mule 'system' event.
static MuleConfiguration getConfiguration()
           
 Map getConnectors()
          Gets an unmodifiable collection of Connectors registered with the UMOManager
 UMOContainerContext getContainerContext()
          associates a Dependency Injector container with Mule.
 Map getEndpointIdentifiers()
          Deprecated. endpoint-identifiers have been deprecated in favor of global-endpoints
 Map getEndpoints()
          Gets an unmodifiable collection of endpoints registered with the UMOManager
 String getId()
          Gets the unique Id for this Manager instance.
static UMOManager getInstance()
          Getter method for the current singleton MuleManager
 Map getModels()
          The model used for managing components for this server
 Map getProperties()
          Gets all properties associated with the UMOManager
 Object getProperty(Object key)
          Getter for the envionment parameters declared in the mule-config.xml
 QueueManager getQueueManager()
          Gets the queue manager used by mule for queuing events.
 UMOSecurityManager getSecurityManager()
          Gets the security manager used by this Mule instance to authenticate and authorise incoming and outgoing event traffic and service invocations
 long getStartDate()
          Returns the long date when the server was started
 AllStatistics getStatistics()
          Gets all statisitcs for this instance
 TransactionManager getTransactionManager()
          Returns the Jta transaction manager used by this Mule server instance. or null if a transaction manager has not been set
 Map getTransformers()
          Gets an unmodifiable collection of transformers registered with the UMOManager
 UMOWorkManager getWorkManager()
          Obtains a workManager instance that can be used to schedule work in a thread pool.
 void initialise()
          {@inheritDoc}
protected  void initialiseAgents()
          Initialises all registered agents
protected  void initialiseEndpoints()
           
 boolean isInitialised()
          Determines if the server has been initialised
 boolean isInitialising()
          Determines if the server is currently initialising
static boolean isInstanciated()
          A static method to determine if there is an instance of the MuleManager.
 boolean isStarted()
          Determines if the server has been started
 boolean isStopping()
          Determines in the manager is in the process of stopping.
 UMOAgent lookupAgent(String name)
          Will find a registered agent using its name, which is unique for all registered agents
 UMOConnector lookupConnector(String name)
          
 UMOEndpoint lookupEndpoint(String logicalName)
          Getter for a global endpoint. Any endpoints returned from this method can be modified, as they are clones of the registered endpoints.
 UMOEndpoint lookupEndpointByAddress(String address)
          {@inheritDoc}
 String lookupEndpointIdentifier(String logicalName, String defaultName)
          Deprecated. endpoint-identifiers have been deprecated in favor of global-endpoints
 UMOInterceptorStack lookupInterceptorStack(String name)
          Retrieves a configured interceptor stack.
 UMOModel lookupModel(String name)
          The model used for managing components for this server
 UMOTransformer lookupTransformer(String name)
          Getter method for a Transformer.
protected  void registerAdminAgent()
           
 void registerAgent(UMOAgent agent)
          Will register an agent object on this model. Agents can be server plugins such as Jms support
 void registerConnector(UMOConnector connector)
          Registers a UMOConnector with the MuleManager.
 void registerEndpoint(UMOEndpoint endpoint)
          Registers a shared/global endpoint with the MuleManager.
 void registerEndpointIdentifier(String logicalName, String endpoint)
          Deprecated. endpoint-identifiers have been deprecated in favor of global-endpoints
 void registerInterceptorStack(String name, UMOInterceptorStack stack)
          registers a interceptor stack list that can be referenced by other components
 void registerListener(UMOServerNotificationListener l)
          Registers an intenal server event listener. The listener will be notified when a particular event happens within the server. Typically this is not an event in the same sense as an UMOEvent (although there is nothing stopping the implementation of this class triggering listeners when a UMOEvent is received). The types of notifications fired is entirely defined by the implementation of this class
 void registerListener(UMOServerNotificationListener l, String resourceIdentifier)
          Registers an intenal server event listener.
 void registerModel(UMOModel model)
           
protected static void registerSystemModel(String type)
           
 void registerTransformer(UMOTransformer transformer)
          Registers a transformer with the MuleManager.
static void setConfiguration(MuleConfiguration config)
          Deprecated. this will go away soon.
 void setContainerContext(UMOContainerContext container)
          associates a Dependency Injector container or Jndi container with Mule.
 void setId(String id)
          Sets the unique Id for this Manager instance.
static void setInstance(UMOManager manager)
          Deprecated. this will go away soon.
 void setProperty(Object key, Object value)
          Sets an Mule environment parameter in the MuleManager.
 void setQueueManager(QueueManager queueManager)
          Sets the queue manager used by mule for queuing events.
 void setSecurityManager(UMOSecurityManager securityManager)
          Sets the security manager used by this Mule instance to authenticate and authorise incoming and outgoing event traffic and service invocations
 void setStatistics(AllStatistics stat)
          Sets statistics on this instance
 void setTransactionManager(TransactionManager newManager)
          Sets the Jta Transaction Manager to use with this Mule server instance
 void setWorkManager(UMOWorkManager workManager)
          Obtains a workManager instance that can be used to schedule work in a thread pool.
 void shutdown(Throwable e, boolean aggressive)
          Shuts down the whole server tring to shut down all resources cleanly on the way
 void start()
          Start the MuleManager.
 void start(String serverUrl)
          Start the MuleManager.
protected  void startAgents()
          {@inheritDoc}
 void stop()
          Stops the MuleManager which stops all sessions and connectors
protected  void stopAgents()
          {@inheritDoc}
 UMOAgent unregisterAgent(String name)
          Removes and destroys a registered agent
 void unregisterConnector(String connectorName)
          UnRegisters a UMOConnector with the MuleManager.
 void unregisterEndpoint(String endpointName)
          unregisters a shared/global endpoint with the MuleManager.
 void unregisterEndpointIdentifier(String logicalName)
          Deprecated. endpoint-identifiers have been deprecated in favor of global-endpoints
 void unregisterListener(UMOServerNotificationListener l)
          Unregisters a previously registered listener. If the listener has not already been registered, this method should return without exception
 void unregisterModel(String name)
           
 void unregisterTransformer(String transformerName)
          UnRegisters a transformer with the MuleManager.
protected  void validateEncoding()
           
protected  void validateOSEncoding()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static UMOManager getInstance()
Getter method for the current singleton MuleManager

Returns:
the current singleton MuleManager

isInstanciated

public static boolean isInstanciated()
A static method to determine if there is an instance of the MuleManager. This should be used instead of if(MuleManager.getInstance()!=null) because getInstance never returns a null. If an istance is not available one is created. This method queries the instance directly.

Returns:
true if the manager is instanciated

setInstance

public static void setInstance(UMOManager manager)
Deprecated. this will go away soon.

Sets the current singleton MuleManager


getStatistics

public AllStatistics getStatistics()
Gets all statisitcs for this instance

Returns:
all statisitcs for this instance

setStatistics

public void setStatistics(AllStatistics stat)
Sets statistics on this instance

Parameters:
stat -

getConfiguration

public static MuleConfiguration getConfiguration()
Returns:
the MuleConfiguration for this MuleManager. This object is immutable once the manager has initialised.

setConfiguration

public static void setConfiguration(MuleConfiguration config)
                             throws UMOException
Deprecated. this will go away soon.

Sets the configuration for the MuleManager.

Parameters:
config - the configuration object
Throws:
IllegalAccessError - if the MuleManager has already been initialised.
UMOException

registerSystemModel

protected static void registerSystemModel(String type)
                                   throws UMOException
Throws:
UMOException

dispose

public void dispose()
Destroys the MuleManager and all resources it maintains

Specified by:
dispose in interface Disposable

getProperty

public Object getProperty(Object key)
Getter for the envionment parameters declared in the mule-config.xml

Specified by:
getProperty in interface UMOManager
Parameters:
key - the propery name
Returns:
the property value

getProperties

public Map getProperties()
Gets all properties associated with the UMOManager

Specified by:
getProperties in interface UMOManager
Returns:
a map of properties on the Manager

getTransactionManager

public TransactionManager getTransactionManager()
Returns the Jta transaction manager used by this Mule server instance. or null if a transaction manager has not been set

Specified by:
getTransactionManager in interface UMOManager
Returns:
the Jta transaction manager used by this Mule server instance. or null if a transaction manager has not been set

lookupConnector

public UMOConnector lookupConnector(String name)

Specified by:
lookupConnector in interface UMOManager
Parameters:
name - the name of the endpoint to retrieve
Returns:
the endpoint instnace if it exists

lookupEndpointIdentifier

public String lookupEndpointIdentifier(String logicalName,
                                       String defaultName)
Deprecated. endpoint-identifiers have been deprecated in favor of global-endpoints

Specified by:
lookupEndpointIdentifier in interface UMOManager
Parameters:
logicalName - the logical mapping name for an endpointUri i.e. rather than specifing an endpointUri to be someone@my.com you can supply a more descriptive name such as The System Administrator
defaultName -
Returns:
the actual endpointUri value or null if it is not found

lookupEndpoint

public UMOEndpoint lookupEndpoint(String logicalName)
Getter for a global endpoint. Any endpoints returned from this method can be modified, as they are clones of the registered endpoints.

Specified by:
lookupEndpoint in interface UMOManager
Parameters:
logicalName - the name of the endpoint
Returns:
the UMOEndpoint or null if it doesn't exist

lookupEndpointByAddress

public UMOEndpoint lookupEndpointByAddress(String address)
{@inheritDoc}


lookupTransformer

public UMOTransformer lookupTransformer(String name)
Getter method for a Transformer.

Specified by:
lookupTransformer in interface UMOManager
Parameters:
name - the name of the transformer
Returns:
the Transformer instance if found, otherwise null

registerConnector

public void registerConnector(UMOConnector connector)
                       throws UMOException
Registers a UMOConnector with the MuleManager.

Specified by:
registerConnector in interface UMOManager
Parameters:
connector - the UMOConnector to register
Throws:
UMOException

unregisterConnector

public void unregisterConnector(String connectorName)
                         throws UMOException
UnRegisters a UMOConnector with the MuleManager.

Specified by:
unregisterConnector in interface UMOManager
Parameters:
connectorName - the name of the UMOConnector to unregister
Throws:
UMOException

registerEndpointIdentifier

public void registerEndpointIdentifier(String logicalName,
                                       String endpoint)
Deprecated. endpoint-identifiers have been deprecated in favor of global-endpoints

Registers an endpointUri with a logical name

Specified by:
registerEndpointIdentifier in interface UMOManager
Parameters:
logicalName - the name of the endpointUri
endpoint - the physical endpointUri value

unregisterEndpointIdentifier

public void unregisterEndpointIdentifier(String logicalName)
Deprecated. endpoint-identifiers have been deprecated in favor of global-endpoints

unregisters an endpointUri with a logical name

Specified by:
unregisterEndpointIdentifier in interface UMOManager
Parameters:
logicalName - the name of the endpointUri

registerEndpoint

public void registerEndpoint(UMOEndpoint endpoint)
Registers a shared/global endpoint with the MuleManager.

Specified by:
registerEndpoint in interface UMOManager
Parameters:
endpoint - the UMOEndpoint to register.

unregisterEndpoint

public void unregisterEndpoint(String endpointName)
unregisters a shared/global endpoint with the MuleManager.

Specified by:
unregisterEndpoint in interface UMOManager
Parameters:
endpointName - the UMOEndpoint name to unregister.

registerTransformer

public void registerTransformer(UMOTransformer transformer)
                         throws InitialisationException
Registers a transformer with the MuleManager.

Specified by:
registerTransformer in interface UMOManager
Parameters:
transformer - the UMOTransformer to register.
Throws:
InitialisationException

unregisterTransformer

public void unregisterTransformer(String transformerName)
UnRegisters a transformer with the MuleManager.

Specified by:
unregisterTransformer in interface UMOManager
Parameters:
transformerName - the UMOTransformer name to register.

setProperty

public void setProperty(Object key,
                        Object value)
Sets an Mule environment parameter in the MuleManager.

Specified by:
setProperty in interface UMOManager
Parameters:
key - the parameter name
value - the parameter value

addProperties

public void addProperties(Map props)

setTransactionManager

public void setTransactionManager(TransactionManager newManager)
                           throws UMOException
Sets the Jta Transaction Manager to use with this Mule server instance

Specified by:
setTransactionManager in interface UMOManager
Parameters:
newManager - the manager to use
Throws:
UMOException

initialise

public void initialise()
                throws UMOException
{@inheritDoc}

Throws:
UMOException

validateEncoding

protected void validateEncoding()
                         throws FatalException
Throws:
FatalException

validateOSEncoding

protected void validateOSEncoding()
                           throws FatalException
Throws:
FatalException

registerAdminAgent

protected void registerAdminAgent()
                           throws UMOException
Throws:
UMOException

initialiseEndpoints

protected void initialiseEndpoints()
                            throws InitialisationException
Throws:
InitialisationException

start

public void start()
           throws UMOException
Start the MuleManager. This will start the connectors and sessions.

Specified by:
start in interface Startable
Throws:
UMOException - if the the connectors or components fail to start

start

public void start(String serverUrl)
           throws UMOException
Start the MuleManager. This will start the connectors and sessions.

Parameters:
serverUrl - the server Url for this instance
Throws:
UMOException - if the the connectors or components fail to start

stop

public void stop()
          throws UMOException
Stops the MuleManager which stops all sessions and connectors

Specified by:
stop in interface Stoppable
Throws:
UMOException - if either any of the sessions or connectors fail to stop

shutdown

public void shutdown(Throwable e,
                     boolean aggressive)
Shuts down the whole server tring to shut down all resources cleanly on the way

Parameters:
e - an exception that caused the shutdown() method to be called. If e is null the shutdown message will just display a time when the server was shutdown. Otherwise the exception information will also be displayed.

lookupModel

public UMOModel lookupModel(String name)
Description copied from interface: UMOManager
The model used for managing components for this server

Specified by:
lookupModel in interface UMOManager
Returns:
The model used for managing components for this server

registerModel

public void registerModel(UMOModel model)
                   throws UMOException
Specified by:
registerModel in interface UMOManager
Throws:
UMOException

unregisterModel

public void unregisterModel(String name)
Specified by:
unregisterModel in interface UMOManager

getModels

public Map getModels()
Description copied from interface: UMOManager
The model used for managing components for this server

Specified by:
getModels in interface UMOManager
Returns:
The models set on this manager instance

registerInterceptorStack

public void registerInterceptorStack(String name,
                                     UMOInterceptorStack stack)
registers a interceptor stack list that can be referenced by other components

Specified by:
registerInterceptorStack in interface UMOManager
Parameters:
name - the referenceable name for this stack
stack - a List of interceptors
See Also:
UMOInterceptor

lookupInterceptorStack

public UMOInterceptorStack lookupInterceptorStack(String name)
Retrieves a configured interceptor stack.

Specified by:
lookupInterceptorStack in interface UMOManager
Parameters:
name - the name of the stack
Returns:
the interceptor stack requested or null if there wasn't one configured for the given name

getConnectors

public Map getConnectors()
Gets an unmodifiable collection of Connectors registered with the UMOManager

Specified by:
getConnectors in interface UMOManager
Returns:
All connectors registered on the Manager
See Also:
UMOConnector

getEndpointIdentifiers

public Map getEndpointIdentifiers()
Deprecated. endpoint-identifiers have been deprecated in favor of global-endpoints

Gets an unmodifiable collection of endpoints registered with the UMOManager

Specified by:
getEndpointIdentifiers in interface UMOManager
Returns:
All endpoints registered on the Manager

getEndpoints

public Map getEndpoints()
Gets an unmodifiable collection of endpoints registered with the UMOManager

Specified by:
getEndpoints in interface UMOManager
Returns:
All endpoints registered on the Manager
See Also:
UMOEndpoint

getTransformers

public Map getTransformers()
Gets an unmodifiable collection of transformers registered with the UMOManager

Specified by:
getTransformers in interface UMOManager
Returns:
All transformers registered on the Manager
See Also:
UMOTransformer

isStarted

public boolean isStarted()
Determines if the server has been started

Specified by:
isStarted in interface UMOManager
Returns:
true if the server has been started

isInitialised

public boolean isInitialised()
Determines if the server has been initialised

Specified by:
isInitialised in interface UMOManager
Returns:
true if the server has been initialised

isInitialising

public boolean isInitialising()
Determines if the server is currently initialising

Returns:
true if if the server is currently initialising, false otherwise

isStopping

public boolean isStopping()
Determines in the manager is in the process of stopping.


getStartDate

public long getStartDate()
Returns the long date when the server was started

Specified by:
getStartDate in interface UMOManager
Returns:
the long date when the server was started

registerAgent

public void registerAgent(UMOAgent agent)
                   throws UMOException
Will register an agent object on this model. Agents can be server plugins such as Jms support

Specified by:
registerAgent in interface UMOManager
Parameters:
agent -
Throws:
UMOException

lookupAgent

public UMOAgent lookupAgent(String name)
Description copied from interface: UMOManager
Will find a registered agent using its name, which is unique for all registered agents

Specified by:
lookupAgent in interface UMOManager
Parameters:
name - the name of the Agent to find
Returns:
the Agent or null if there is not agent registered with the given name

unregisterAgent

public UMOAgent unregisterAgent(String name)
                         throws UMOException
Removes and destroys a registered agent

Specified by:
unregisterAgent in interface UMOManager
Parameters:
name - the agent name
Returns:
the destroyed agent or null if the agent doesn't exist
Throws:
UMOException

initialiseAgents

protected void initialiseAgents()
                         throws InitialisationException
Initialises all registered agents

Throws:
InitialisationException

startAgents

protected void startAgents()
                    throws UMOException
{@inheritDoc}

Throws:
UMOException

stopAgents

protected void stopAgents()
                   throws UMOException
{@inheritDoc}

Throws:
UMOException

disposeAgents

protected void disposeAgents()
{@inheritDoc}


setContainerContext

public void setContainerContext(UMOContainerContext container)
                         throws UMOException
associates a Dependency Injector container or Jndi container with Mule. This can be used to integrate container managed resources with Mule resources

Specified by:
setContainerContext in interface UMOManager
Parameters:
container - a Container context to use. By default, there is a default Mule container MuleContainerContext that will assume that the reference key for an oblect is a classname and will try to instanciate it.
Throws:
UMOException

getContainerContext

public UMOContainerContext getContainerContext()
associates a Dependency Injector container with Mule. This can be used to integrate container managed resources with Mule resources

Specified by:
getContainerContext in interface UMOManager
Returns:
the container associated with the Manager

registerListener

public void registerListener(UMOServerNotificationListener l)
                      throws NotificationException
Registers an intenal server event listener. The listener will be notified when a particular event happens within the server. Typically this is not an event in the same sense as an UMOEvent (although there is nothing stopping the implementation of this class triggering listeners when a UMOEvent is received). The types of notifications fired is entirely defined by the implementation of this class

Specified by:
registerListener in interface UMOManager
Parameters:
l - the listener to register
Throws:
NotificationException

registerListener

public void registerListener(UMOServerNotificationListener l,
                             String resourceIdentifier)
                      throws NotificationException
Description copied from interface: UMOManager
Registers an intenal server event listener. The listener will be notified when a particular event happens within the server. Typically this is not an event in the same sense as an UMOEvent (although there is nothing stopping the implementation of this class triggering listeners when a UMOEvent is received). The types of notifications fired is entirely defined by the implementation of this class

Specified by:
registerListener in interface UMOManager
Parameters:
l - the listener to register
resourceIdentifier - a particular resource name for the given type of listener For example, the resourceName could be the name of a component if the listener was a ComponentNotificationListener
Throws:
NotificationException

unregisterListener

public void unregisterListener(UMOServerNotificationListener l)
Unregisters a previously registered listener. If the listener has not already been registered, this method should return without exception

Specified by:
unregisterListener in interface UMOManager
Parameters:
l - the listener to unregister

fireSystemEvent

protected void fireSystemEvent(UMOServerNotification e)
Fires a mule 'system' event. These are notifications that are fired because something within the Mule instance happened such as the Model started or the server is being disposed.

Parameters:
e - the event that occurred

fireNotification

public void fireNotification(UMOServerNotification notification)
Fires a server notification to all registered CustomNotificationListener notificationManager. TODO RM: This method now duplicates #fireSystemEvent() completely

Specified by:
fireNotification in interface UMOManager
Parameters:
notification - the notification to fire. This must be of type CustomNotification otherwise an exception will be thrown.
Throws:
UnsupportedOperationException - if the notification fired is not a CustomNotification

setId

public void setId(String id)
Description copied from interface: UMOManager
Sets the unique Id for this Manager instance. this id can be used to assign an identy to the manager so it can be identified in a network of Mule nodes

Specified by:
setId in interface UMOManager
Parameters:
id - the unique Id for this manager in the network

getId

public String getId()
Description copied from interface: UMOManager
Gets the unique Id for this Manager instance. this id can be used to assign an identy to the manager so it can be identified in a network of Mule nodes

Specified by:
getId in interface UMOManager
Returns:
the unique Id for this manager in the network

setSecurityManager

public void setSecurityManager(UMOSecurityManager securityManager)
                        throws InitialisationException
Sets the security manager used by this Mule instance to authenticate and authorise incoming and outgoing event traffic and service invocations

Specified by:
setSecurityManager in interface UMOManager
Parameters:
securityManager - the security manager used by this Mule instance to authenticate and authorise incoming and outgoing event traffic and service invocations
Throws:
InitialisationException

getSecurityManager

public UMOSecurityManager getSecurityManager()
Gets the security manager used by this Mule instance to authenticate and authorise incoming and outgoing event traffic and service invocations

Specified by:
getSecurityManager in interface UMOManager
Returns:
he security manager used by this Mule instance to authenticate and authorise incoming and outgoing event traffic and service invocations

getWorkManager

public UMOWorkManager getWorkManager()
Obtains a workManager instance that can be used to schedule work in a thread pool. This will be used primarially by UMOAgents wanting to schedule work. This work Manager must never be used by provider implementations as they have their own workManager accessible on the connector. If a workManager has not been set by the time the initialise() method has been called a default MuleWorkManager will be created using the DefaultThreadingProfile on the MuleConfiguration object.

Specified by:
getWorkManager in interface UMOManager
Returns:
a workManager instance used by the current MuleManager
See Also:
ThreadingProfile, MuleConfiguration

setWorkManager

public void setWorkManager(UMOWorkManager workManager)
Obtains a workManager instance that can be used to schedule work in a thread pool. This will be used primarially by UMOAgents wanting to schedule work. This work Manager must never be used by provider implementations as they have their own workManager accible on the connector. If a workManager has not been set by the time the initialise() method has been called a default MuleWorkManager will be created using the DefaultThreadingProfile on the MuleConfiguration object.

Specified by:
setWorkManager in interface UMOManager
Parameters:
workManager - the workManager instance used by the current MuleManager
Throws:
IllegalStateException - if the workManager has already been set.
See Also:
ThreadingProfile, MuleConfiguration, MuleWorkManager

getQueueManager

public QueueManager getQueueManager()
Description copied from interface: UMOManager
Gets the queue manager used by mule for queuing events. This is used by both components and vm provider.

Specified by:
getQueueManager in interface UMOManager
Returns:

setQueueManager

public void setQueueManager(QueueManager queueManager)
Description copied from interface: UMOManager
Sets the queue manager used by mule for queuing events. This is used by both components and vm provider.

Specified by:
setQueueManager in interface UMOManager
Parameters:
queueManager -


Copyright © 2003-2008 MuleSource, Inc.. All Rights Reserved.