org.mule
Class MuleManager

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

public class MuleManager
extends java.lang.Object
implements UMOManager

MuleManager maintains and provides services for a Mule instance.

Version:
$Revision: 1.5 $
Author:
Ross Mason

Method Summary
protected static UMOManager createInstance()
          ObjectFactory method to create the singleton MuleManager instance
 void dispose()
          Destroys the MuleManager and all resources it maintains
protected  void disposeAgents()
          {@inheritDoc}
 void fireEvent(UMOServerEvent event)
          Fires a server event to all registered CustomEventListener listeners.
protected  void fireSystemEvent(UMOServerEvent e)
          Fires a mule 'system' event.
static MuleConfiguration getConfiguration()
           
 java.util.Map getConnectors()
          Gets an unmodifiable collection of Connectors registered with the UMOManager
 UMOContainerContext getContainerContext()
          associates a Dependency Injector container with Mule.
protected  java.io.Reader getContainerContextConfiguration()
          The ContainerContextConfiguration is an inline configuration for a container, sent unparsed to the container for configuration.
 java.util.Map getEndpointIdentifiers()
          Gets an unmodifiable collection of endpoints registered with the UMOManager
 java.util.Map getEndpoints()
          Gets an unmodifiable collection of endpoints registered with the UMOManager
 java.lang.String getId()
          Gets the unique Id for this Manager instance.
static UMOManager getInstance()
          Getter method for the current singleton MuleManager
 UMOModel getModel()
          The model used for managing components for this server
 java.util.Map getProperties()
          Gets all properties associated with the UMOManager
 java.lang.Object getProperty(java.lang.Object key)
          Getter for the envionment parameters declared in the nule-config.xml
 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
protected  java.lang.String getStartSplash()
          Returns a formatted string that is a summary of the configuration of the server.
 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
 java.util.Map getTransformers()
          Gets an unmodifiable collection of transformers registered with the UMOManager
protected  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
 UMOConnector lookupConnector(java.lang.String name)
          
 UMOEndpoint lookupEndpoint(java.lang.String logicalName)
          Getter for a global endpoint. Any endpoints returned from this method will be read-only as they may be shared by other components. To change any details on the endpoint you must clone it first calling it's clone() method
 java.lang.String lookupEndpointIdentifier(java.lang.String logicalName, java.lang.String defaultName)
          
 java.util.List lookupInterceptorStack(java.lang.String name)
          Retrieves a configured interceptor stack.
 UMOTransformer lookupTransformer(java.lang.String name)
          Getter method for a Transformer.
 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(java.lang.String logicalName, java.lang.String endpoint)
          Registers an endpointUri with a logical name
 void registerInterceptorStack(java.lang.String name, java.util.List stack)
          registers a interceptor stack list that can be referenced by other components
 void registerListener(UMOServerEventListener 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 events fired is entirely defined by the implementation of this class
 void registerTransformer(UMOTransformer transformer)
          Registers a transformer with the MuleManager.
 UMOAgent removeAgent(java.lang.String name)
          Removes and destroys a registered agent
static void setConfiguration(MuleConfiguration config)
          Sets the configuration for the MuleManager.
 void setContainerContext(UMOContainerContext context)
          associates a Dependency Injector container with Mule.
 void setContainerContextConfiguration(org.w3c.dom.DocumentFragment containerContextConfiguration)
           
 void setId(java.lang.String id)
          Sets the unique Id for this Manager instance.
static void setInstance(UMOManager manager)
          Sets the current singleton MuleManager
 void setModel(UMOModel model)
          The model used for managing components for this server
 void setProperty(java.lang.Object key, java.lang.Object value)
          Sets an Mule environment parameter in the MuleManager.
 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 shutdown(java.lang.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(java.lang.String serverUrl)
          Start the MuleManager.
protected  void startAgents()
          {@inheritDoc}
 void stop()
          Stops the MuleManager which stops all sessions and connectors
protected  void stopAgents()
          {@inheritDoc}
 void unregisterConnector(java.lang.String connectorName)
          UnRegisters a UMOConnector with the MuleManager.
 void unregisterEndpoint(java.lang.String endpointName)
          unregisters a shared/global endpoint with the MuleManager.
 void unregisterEndpointIdentifier(java.lang.String logicalName)
          unregisters an endpointUri with a logical name
 void unregisterListener(UMOServerEventListener l)
          Unregisters a previously registered listener. If the listener has not already been registered, this method should return without exception
 void unregisterTransformer(java.lang.String transformerName)
          UnRegisters a transformer with the MuleManager.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

createInstance

protected static UMOManager createInstance()
                                    throws MuleRuntimeException
ObjectFactory method to create the singleton MuleManager instance

Throws:
MuleRuntimeException

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)
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)
Sets the configuration for the MuleManager.

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

dispose

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

Specified by:
dispose in interface Disposable
Throws:
UMOException

getProperty

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

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

getProperties

public java.util.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(java.lang.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 java.lang.String lookupEndpointIdentifier(java.lang.String logicalName,
                                                 java.lang.String defaultName)

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(java.lang.String logicalName)
Getter for a global endpoint. Any endpoints returned from this method will be read-only as they may be shared by other components. To change any details on the endpoint you must clone it first calling it's clone() method

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

lookupTransformer

public UMOTransformer lookupTransformer(java.lang.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(java.lang.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(java.lang.String logicalName,
                                       java.lang.String endpoint)
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(java.lang.String logicalName)
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(java.lang.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(java.lang.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(java.lang.Object key,
                        java.lang.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

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

protected void initialise()
                   throws UMOException
{@inheritDoc}

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(java.lang.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(java.lang.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.

getModel

public UMOModel getModel()
The model used for managing components for this server

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

setModel

public void setModel(UMOModel model)
The model used for managing components for this server

Specified by:
setModel in interface UMOManager
Parameters:
model - The model used for managing components for this server

registerInterceptorStack

public void registerInterceptorStack(java.lang.String name,
                                     java.util.List 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 java.util.List lookupInterceptorStack(java.lang.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 java.util.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 java.util.Map getEndpointIdentifiers()
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 java.util.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 java.util.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

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

getStartSplash

protected java.lang.String getStartSplash()
Returns a formatted string that is a summary of the configuration of the server. This is the brock of information that gets displayed when the server starts

Returns:
a string summary of the server information

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

removeAgent

public UMOAgent removeAgent(java.lang.String name)
                     throws UMOException
Removes and destroys a registered agent

Specified by:
removeAgent 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()
                      throws UMOException
{@inheritDoc}

Throws:
UMOException

setContainerContext

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

Specified by:
setContainerContext in interface UMOManager
Parameters:
context - 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.

getContainerContext

public UMOContainerContext getContainerContext()
                                        throws ComponentResolverException
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
Throws:
ComponentResolverException

setContainerContextConfiguration

public void setContainerContextConfiguration(org.w3c.dom.DocumentFragment containerContextConfiguration)

registerListener

public void registerListener(UMOServerEventListener 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 events fired is entirely defined by the implementation of this class

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

unregisterListener

public void unregisterListener(UMOServerEventListener 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(UMOServerEvent e)
Fires a mule 'system' event. These are events 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

fireEvent

public void fireEvent(UMOServerEvent event)
Fires a server event to all registered CustomEventListener listeners.

Specified by:
fireEvent in interface UMOManager
Parameters:
event - the event to fire. This must be of type CustomEvent otherwise an exception will be thrown.
Throws:
java.lang.UnsupportedOperationException - if the event fired is not a CustomEvent

getContainerContextConfiguration

protected java.io.Reader getContainerContextConfiguration()
                                                   throws ConfigurationException
The ContainerContextConfiguration is an inline configuration for a container, sent unparsed to the container for configuration.

Returns:
Reader container configuration embedded within mule config
Throws:
ConfigurationException

setId

public void setId(java.lang.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 java.lang.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


Copyright © 2003-2005 SymphonySoft Limited. All Rights Reserved.