org.mule.impl
Class MuleModel

java.lang.Object
  extended byorg.mule.impl.MuleModel
All Implemented Interfaces:
Disposable, Initialisable, Lifecycle, Startable, Stoppable, UMOModel

public class MuleModel
extends java.lang.Object
implements UMOModel

MuleModel is the default implementation of the UMOModel. The model encapsulates and manages the runtime behaviour of a Mule Server instance. It is responsible for maintaining the UMOs instances and their configuration.

Version:
$Revision: 1.6 $
Author:
Ross Mason

Field Summary
protected  ConcurrentHashMap descriptors
          Collection for mule descriptors registered in this Manager
 
Constructor Summary
MuleModel()
          Default constructor
 
Method Summary
 void dispose()
          Destroys any current components

//* @throws UMOException if the components don't destroy gracefully

 UMOComponentFactory getComponentFactory()
          Returns the factory used to create component wrappers that are registered on the Model
 java.util.Iterator getComponentNames()
          Gets an iterator of all component names registered in the model
 UMOSession getComponentSession(java.lang.String muleName)
          Returns a valid component for the given Mule name
 UMODescriptor getDescriptor(java.lang.String name)
          Returns a descriptor for the given component name
 UMOEntryPointResolver getEntryPointResolver()
          The entry point resolver is used to determine the method to be called on a component when an event is received for it.
 java.beans.ExceptionListener getExceptionListener()
          The exception strategy to use by components managed by the model.
 UMOLifecycleAdapterFactory getLifecycleAdapterFactory()
          The lifecycle adapter is used by the model to translate Mule lifecycle event to events that UMO components registered with the model understand.
 java.lang.String getName()
          The model's name.
 void initialise()
          Method used to perform any initialisation work.
 boolean isComponentRegistered(java.lang.String name)
          Determines if a UMO component descriptor by the given name is regestered with the model
 void pauseComponent(java.lang.String name)
          Pauses event processing for a single Mule Component.
 UMOComponent registerComponent(UMODescriptor descriptor)
          Registers a UMODescriptor with the MuleManager.
protected  void registerListeners(UMOComponent component)
           
 void resumeComponent(java.lang.String name)
          Resumes a single Mule Component that has been paused.
 void setComponentFactory(UMOComponentFactory factory)
          Sets the factory used to create component wrappers that are registered on the Model
 void setComponents(java.util.List descriptors)
          A convenience method to set a list of components on the model.
 void setEntryPointResolver(UMOEntryPointResolver entryPointResolver)
          This will be used to build entry points on the components registered with the model.
 void setExceptionListener(java.beans.ExceptionListener exceptionListener)
          The exception strategy to use by components managed by the model.
 void setLifecycleAdapterFactory(UMOLifecycleAdapterFactory lifecycleAdapterFactory)
          Sets the lifecycleAdapterFactory on the model.
 void setListeners(ServerEventManager listeners)
           
 void setName(java.lang.String name)
          Sets the model's name.
 void start()
          Starts all registered components
 void startComponent(java.lang.String name)
          Starts a single Mule Component.
 void stop()
          Stops any registered components
 void stopComponent(java.lang.String name)
          Stops a single Mule Component.
 void unregisterComponent(UMODescriptor descriptor)
          Unregisters a component From the model
protected  void unregisterListeners(UMOComponent component)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

descriptors

protected ConcurrentHashMap descriptors
Collection for mule descriptors registered in this Manager

Constructor Detail

MuleModel

public MuleModel()
Default constructor

Method Detail

getName

public java.lang.String getName()
Description copied from interface: UMOModel
The model's name. It is poosible to configure more than one model in a config file. The name can then be used to reference the Model use when starting the server

Specified by:
getName in interface UMOModel
Returns:
the model's name

setName

public void setName(java.lang.String name)
Description copied from interface: UMOModel
Sets the model's name. It is poosible to configure more than one model in a config file. The name can then be used to reference the Model use when starting the server

Specified by:
setName in interface UMOModel
Parameters:
name - the model's name

getEntryPointResolver

public UMOEntryPointResolver getEntryPointResolver()
Description copied from interface: UMOModel
The entry point resolver is used to determine the method to be called on a component when an event is received for it.

Specified by:
getEntryPointResolver in interface UMOModel
Returns:
Returns the entryPointResolver.

setEntryPointResolver

public void setEntryPointResolver(UMOEntryPointResolver entryPointResolver)
Description copied from interface: UMOModel
This will be used to build entry points on the components registered with the model.

Specified by:
setEntryPointResolver in interface UMOModel
Parameters:
entryPointResolver - The entryPointResolver to set. This will be used to build entry points on the components registered with the model.

isComponentRegistered

public boolean isComponentRegistered(java.lang.String name)
Description copied from interface: UMOModel
Determines if a UMO component descriptor by the given name is regestered with the model

Specified by:
isComponentRegistered in interface UMOModel
Parameters:
name - the name of the UMO
Returns:
true if the UMO's descriptor has benn registered with the model
See Also:
UMODescriptor

registerComponent

public UMOComponent registerComponent(UMODescriptor descriptor)
                               throws UMOException
Description copied from interface: UMOModel
Registers a UMODescriptor with the MuleManager. The manager will take care of creating the Mule UMO and, it's component and proxies.

Specified by:
registerComponent in interface UMOModel
Parameters:
descriptor - the UMODescriptor to register
Throws:
UMOException

unregisterComponent

public void unregisterComponent(UMODescriptor descriptor)
                         throws UMOException
Description copied from interface: UMOModel
Unregisters a component From the model

Specified by:
unregisterComponent in interface UMOModel
Parameters:
descriptor - the descriptor of the componnt to remove
Throws:
UMOException - if the compoennt is not registered or it failed to be disposing or the descriptor is null

registerListeners

protected void registerListeners(UMOComponent component)
                          throws UMOException
Throws:
UMOException

unregisterListeners

protected void unregisterListeners(UMOComponent component)
                            throws UMOException
Throws:
UMOException

getLifecycleAdapterFactory

public UMOLifecycleAdapterFactory getLifecycleAdapterFactory()
Description copied from interface: UMOModel
The lifecycle adapter is used by the model to translate Mule lifecycle event to events that UMO components registered with the model understand. The UMOLifecycleAdapterFactory is used by the model to instanciate LifecycleAdapters.

Specified by:
getLifecycleAdapterFactory in interface UMOModel
Returns:
Returns the lifecycleAdapterFactory used by this Model.
See Also:
@UMOLifecycleAdapter

setLifecycleAdapterFactory

public void setLifecycleAdapterFactory(UMOLifecycleAdapterFactory lifecycleAdapterFactory)
Description copied from interface: UMOModel
Sets the lifecycleAdapterFactory on the model.

Specified by:
setLifecycleAdapterFactory in interface UMOModel
Parameters:
lifecycleAdapterFactory - The lifecycleAdapterFactory to set on this model.
See Also:
UMOLifecycleAdapterFactory, UMOLifecycleAdapter

dispose

public void dispose()
Destroys any current components

//* @throws UMOException if the components don't destroy gracefully

Specified by:
dispose in interface Disposable

getComponentSession

public UMOSession getComponentSession(java.lang.String muleName)
Returns a valid component for the given Mule name

Specified by:
getComponentSession in interface UMOModel
Parameters:
muleName - the Name of the Mule for which the component is required
Returns:
a component for the specified name

stop

public void stop()
          throws UMOException
Stops any registered components

Specified by:
stop in interface Stoppable
Throws:
UMOException - if a Component fails tcomponent

start

public void start()
           throws UMOException
Starts all registered components

Specified by:
start in interface Startable
Throws:
UMOException - if any of the components fail to start

stopComponent

public void stopComponent(java.lang.String name)
                   throws UMOException
Stops a single Mule Component. This can be useful when stopping and starting some Mule UMOs while letting others continue.

Specified by:
stopComponent in interface UMOModel
Parameters:
name - the name of the Mule UMO to stop
Throws:
UMOException - if the MuleUMO is not registered

startComponent

public void startComponent(java.lang.String name)
                    throws UMOException
Starts a single Mule Component. This can be useful when stopping and starting some Mule UMOs while letting others continue

Specified by:
startComponent in interface UMOModel
Parameters:
name - the name of the Mule UMO to start
Throws:
UMOException - if the MuleUMO is not registered or the component failed to start

pauseComponent

public void pauseComponent(java.lang.String name)
                    throws UMOException
Pauses event processing for a single Mule Component. Unlike stopComponent(), a paused component will still consume messages from the underlying transport, but those messages will be queued until the component is resumed.

In order to persist these queued messages you can set the 'recoverableMode' property on the Muleconfiguration to true. this causes all internal queues to store their state.

Specified by:
pauseComponent in interface UMOModel
Parameters:
name - the name of the Mule UMO to stop
Throws:
UMOException - if the MuleUMO is not registered or the component failed to pause.
See Also:
MuleConfiguration

resumeComponent

public void resumeComponent(java.lang.String name)
                     throws UMOException
Resumes a single Mule Component that has been paused. If the component is not paused nothing is executed.

Specified by:
resumeComponent in interface UMOModel
Parameters:
name - the name of the Mule UMO to resume
Throws:
UMOException - if the MuleUMO is not registered or the component failed to resume

setComponents

public void setComponents(java.util.List descriptors)
                   throws UMOException
Description copied from interface: UMOModel
A convenience method to set a list of components on the model. This method will most likely be used when the model is being constructed from an IoC container

Specified by:
setComponents in interface UMOModel
Parameters:
descriptors -
Throws:
UMOException

initialise

public void initialise()
                throws InitialisationException,
                       RecoverableException
Description copied from interface: Initialisable
Method used to perform any initialisation work. If a fatal error occurs during initialisation an 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.

Specified by:
initialise in interface Initialisable
Throws:
InitialisationException - if a fatal error occurs causing the Mule instance to shutdown
RecoverableException - if an error occurs that can be recovered from

getExceptionListener

public java.beans.ExceptionListener getExceptionListener()
Description copied from interface: UMOModel
The exception strategy to use by components managed by the model. The exception strategy is used when an exception occurs while processing the current event for a component. A component can define it's own exception strategy, but if it doesn't this implmentation will be used.

Specified by:
getExceptionListener in interface UMOModel
Returns:
the default exception strategy for this model.
See Also:
ExceptionListener

setExceptionListener

public void setExceptionListener(java.beans.ExceptionListener exceptionListener)
Description copied from interface: UMOModel
The exception strategy to use by components managed by the model. The exception strategy is used when an exception occurs while processing the current event for a component. A component can define it's own exception strategy, but if it doesn't this implmentation will be used.

Specified by:
setExceptionListener in interface UMOModel
Parameters:
exceptionListener - the default exception strategy for this model.
See Also:
ExceptionListener

getDescriptor

public UMODescriptor getDescriptor(java.lang.String name)
Description copied from interface: UMOModel
Returns a descriptor for the given component name

Specified by:
getDescriptor in interface UMOModel
Parameters:
name - the name of the component
Returns:
a descriptor for the given component name or null if there is no component registered by that name
See Also:
UMODescriptor

getComponentNames

public java.util.Iterator getComponentNames()
Gets an iterator of all component names registered in the model

Specified by:
getComponentNames in interface UMOModel
Returns:
an iterator of all component names

setListeners

public void setListeners(ServerEventManager listeners)

setComponentFactory

public void setComponentFactory(UMOComponentFactory factory)
Description copied from interface: UMOModel
Sets the factory used to create component wrappers that are registered on the Model

Specified by:
setComponentFactory in interface UMOModel
Parameters:
factory - the factory used to create component wrappers that are registered on the Model

getComponentFactory

public UMOComponentFactory getComponentFactory()
Description copied from interface: UMOModel
Returns the factory used to create component wrappers that are registered on the Model

Specified by:
getComponentFactory in interface UMOModel
Returns:
the factory used to create component wrappers that are registered on the Model


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