org.apache.servicemix.jbi.framework
Class ServiceAssemblyLifeCycle

java.lang.Object
  extended by org.apache.servicemix.jbi.framework.ServiceAssemblyLifeCycle
All Implemented Interfaces:
ServiceAssemblyMBean, MBeanInfoProvider

public class ServiceAssemblyLifeCycle
extends Object
implements ServiceAssemblyMBean, MBeanInfoProvider

ComponentConnector is used internally for message routing

Version:
$Revision: 3705 $

Field Summary
 
Fields inherited from interface org.apache.servicemix.jbi.framework.ServiceAssemblyMBean
SHUTDOWN, STARTED, STOPPED
 
Constructor Summary
ServiceAssemblyLifeCycle(ServiceAssembly sa, ServiceAssemblyEnvironment env, Registry registry)
          Construct a LifeCycle
 
Method Summary
protected  void fireEvent(int type)
           
protected  void firePropertyChanged(String name, Object oldValue, Object newValue)
           
 MBeanAttributeInfo[] getAttributeInfos()
          Get an array of MBeanAttributeInfo
protected  Element getComponentFailure(Exception exception, String task, String component)
           
 String getCurrentState()
           
 ServiceUnitLifeCycle[] getDeployedSUs()
           
 String getDescription()
          Get the Description of the item
 String getDescriptor()
           
protected  Element getElement(Document doc, String name)
           
 ServiceAssemblyEnvironment getEnvironment()
           
protected  String getLinkType(QName svc, String ep)
           
 String getName()
          Get the name of the item
 Object getObjectToManage()
          Get the Object to Manage
 MBeanOperationInfo[] getOperationInfos()
          Get an array of MBeanOperationInfo
 ServiceAssembly getServiceAssembly()
           
 ObjectName[] getServiceUnits()
           
 String getSubType()
          Get the type of this mbean
 String getType()
          Get the type of this mbean
 String init()
          Initialize all SUs in Service Assembly.
protected  Document parse(String result)
           
 void restore()
          Restore this service assembly to its state at shutdown.
 void restore(boolean forceInit)
          Restore this service assembly to its state at shutdown.
 void setPropertyChangeListener(PropertyChangeListener l)
          Register for propertyChange events
protected  void setServiceUnits(ServiceUnitLifeCycle[] serviceUnits)
           
 String shutDown()
          Shutdown the service assembly and puts it in SHUTDOWN state.
 String shutDown(boolean writeState)
           
 String start()
          Start a Service Assembly and put it in the STARTED state.
 String start(boolean writeState)
           
protected  void startConnections()
           
 String stop()
          Stops the service assembly and puts it in STOPPED state.
 String stop(boolean writeState, boolean forceInit)
           
protected  void stopConnections()
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ServiceAssemblyLifeCycle

public ServiceAssemblyLifeCycle(ServiceAssembly sa,
                                ServiceAssemblyEnvironment env,
                                Registry registry)
Construct a LifeCycle

Parameters:
sa -
stateFile -
Method Detail

setServiceUnits

protected void setServiceUnits(ServiceUnitLifeCycle[] serviceUnits)

init

public String init()
            throws Exception
Initialize all SUs in Service Assembly.

Returns:
Result/Status of this operation
Throws:
Exception

start

public String start()
             throws Exception
Start a Service Assembly and put it in the STARTED state.

Specified by:
start in interface ServiceAssemblyMBean
Returns:
Result/Status of this operation.
Throws:
Exception

start

public String start(boolean writeState)
             throws Exception
Throws:
Exception

stop

public String stop()
            throws Exception
Stops the service assembly and puts it in STOPPED state.

Specified by:
stop in interface ServiceAssemblyMBean
Returns:
Result/Status of this operation.
Throws:
Exception

stop

public String stop(boolean writeState,
                   boolean forceInit)
            throws Exception
Throws:
Exception

shutDown

public String shutDown()
                throws Exception
Shutdown the service assembly and puts it in SHUTDOWN state.

Specified by:
shutDown in interface ServiceAssemblyMBean
Returns:
Result/Status of this operation.
Throws:
Exception

shutDown

public String shutDown(boolean writeState)
                throws Exception
Throws:
Exception

getCurrentState

public String getCurrentState()
Specified by:
getCurrentState in interface ServiceAssemblyMBean
Returns:
the currentState as a String

getName

public String getName()
Description copied from interface: MBeanInfoProvider
Get the name of the item

Specified by:
getName in interface ServiceAssemblyMBean
Specified by:
getName in interface MBeanInfoProvider
Returns:
the name of the ServiceAssembly

getDescription

public String getDescription()
Description copied from interface: MBeanInfoProvider
Get the Description of the item

Specified by:
getDescription in interface ServiceAssemblyMBean
Specified by:
getDescription in interface MBeanInfoProvider
Returns:
the description of the ServiceAssembly

getServiceAssembly

public ServiceAssembly getServiceAssembly()
Returns:
the ServiceAssembly

getDescriptor

public String getDescriptor()
Specified by:
getDescriptor in interface ServiceAssemblyMBean

toString

public String toString()
Overrides:
toString in class Object
Returns:
string representation of this

restore

public void restore()
             throws Exception
Restore this service assembly to its state at shutdown.

Throws:
Exception

restore

public void restore(boolean forceInit)
             throws Exception
Restore this service assembly to its state at shutdown.

Parameters:
forceInit -
Throws:
Exception

getDeployedSUs

public ServiceUnitLifeCycle[] getDeployedSUs()

startConnections

protected void startConnections()
                         throws javax.jbi.JBIException
Throws:
javax.jbi.JBIException

getLinkType

protected String getLinkType(QName svc,
                             String ep)

stopConnections

protected void stopConnections()

getComponentFailure

protected Element getComponentFailure(Exception exception,
                                      String task,
                                      String component)

parse

protected Document parse(String result)
                  throws ParserConfigurationException,
                         SAXException,
                         IOException
Throws:
ParserConfigurationException
SAXException
IOException

getElement

protected Element getElement(Document doc,
                             String name)

getAttributeInfos

public MBeanAttributeInfo[] getAttributeInfos()
                                       throws JMException
Description copied from interface: MBeanInfoProvider
Get an array of MBeanAttributeInfo

Specified by:
getAttributeInfos in interface MBeanInfoProvider
Returns:
array of AttributeInfos
Throws:
JMException

getOperationInfos

public MBeanOperationInfo[] getOperationInfos()
                                       throws JMException
Description copied from interface: MBeanInfoProvider
Get an array of MBeanOperationInfo

Specified by:
getOperationInfos in interface MBeanInfoProvider
Returns:
array of OperationInfos
Throws:
JMException

getObjectToManage

public Object getObjectToManage()
Description copied from interface: MBeanInfoProvider
Get the Object to Manage

Specified by:
getObjectToManage in interface MBeanInfoProvider
Returns:
the Object to Manage

getType

public String getType()
Description copied from interface: MBeanInfoProvider
Get the type of this mbean

Specified by:
getType in interface MBeanInfoProvider
Returns:
the type

getSubType

public String getSubType()
Description copied from interface: MBeanInfoProvider
Get the type of this mbean

Specified by:
getSubType in interface MBeanInfoProvider
Returns:
the type

setPropertyChangeListener

public void setPropertyChangeListener(PropertyChangeListener l)
Description copied from interface: MBeanInfoProvider
Register for propertyChange events

Specified by:
setPropertyChangeListener in interface MBeanInfoProvider

firePropertyChanged

protected void firePropertyChanged(String name,
                                   Object oldValue,
                                   Object newValue)

getServiceUnits

public ObjectName[] getServiceUnits()
Specified by:
getServiceUnits in interface ServiceAssemblyMBean

getEnvironment

public ServiceAssemblyEnvironment getEnvironment()

fireEvent

protected void fireEvent(int type)


Copyright © 2005-2010 The Apache Software Foundation. All Rights Reserved.