org.apache.servicemix.common
Class DefaultServiceUnit

java.lang.Object
  extended by org.apache.servicemix.common.DefaultServiceUnit
All Implemented Interfaces:
ServiceUnit
Direct Known Subclasses:
EndpointTracker.OsgiServiceUnit, XBeanServiceUnit

public class DefaultServiceUnit
extends java.lang.Object
implements ServiceUnit


Field Summary
protected  ServiceMixComponent component
           
protected  java.util.Map<java.lang.String,Endpoint> endpoints
           
protected  java.lang.String name
           
protected  java.lang.String rootPath
           
protected  java.lang.String status
           
 
Constructor Summary
DefaultServiceUnit()
           
DefaultServiceUnit(ServiceMixComponent component)
           
 
Method Summary
 void addEndpoint(Endpoint endpoint)
          Adds an endpoint to this service unit.
 ServiceMixComponent getComponent()
          Retrieves the component where this SU is deployed.
 java.lang.ClassLoader getConfigurationClassLoader()
          Retrieve this service unit specific classloader.
 java.lang.String getCurrentState()
          Retrieve the state of this service unit.
 Endpoint getEndpoint(java.lang.String key)
           
 java.util.Collection<Endpoint> getEndpoints()
          Retrieves the list of deployed endpoints.
 java.lang.String getName()
          Retrieves the name of this service unit.
 java.lang.String getRootPath()
          Retrieves the root path of this service unit.
 void init()
          Puts the SU in a STOPPED state.
 void removeEndpoint(Endpoint endpoint)
          Removes an endpoint from this service unit.
 void setComponent(ServiceMixComponent component)
           
 void setName(java.lang.String name)
           
 void setRootPath(java.lang.String rootPath)
           
 void shutDown()
          Transition this service unit into the SHUTDOWN state.
 void start()
          Transition this service unit into the STARTED state.
 void stop()
          Transition this service unit to a STOPPED state.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

component

protected ServiceMixComponent component

name

protected java.lang.String name

rootPath

protected java.lang.String rootPath

status

protected java.lang.String status

endpoints

protected java.util.Map<java.lang.String,Endpoint> endpoints
Constructor Detail

DefaultServiceUnit

public DefaultServiceUnit()

DefaultServiceUnit

public DefaultServiceUnit(ServiceMixComponent component)
Method Detail

init

public void init()
          throws java.lang.Exception
Description copied from interface: ServiceUnit
Puts the SU in a STOPPED state. This call is only valid if the service unit is in a SHUTDOWN state. It means it is able to process incoming exchange but will not initiate new exchanges. The process of initializing a service unit should activate all endpoints, but not start them.

Specified by:
init in interface ServiceUnit
Throws:
java.lang.Exception
See Also:
Endpoint.start()

start

public void start()
           throws java.lang.Exception
Description copied from interface: ServiceUnit
Transition this service unit into the STARTED state. This call is only valid if the service unit is in a STOPPED state. Start consumption of external requests by starting all the endpoints.

Specified by:
start in interface ServiceUnit
Throws:
java.lang.Exception
See Also:
Endpoint.start()

stop

public void stop()
          throws java.lang.Exception
Description copied from interface: ServiceUnit
Transition this service unit to a STOPPED state. This call is only valid if the service unit is in a STARTED state.

Specified by:
stop in interface ServiceUnit
Throws:
java.lang.Exception
See Also:
Endpoint.stop()

shutDown

public void shutDown()
              throws java.lang.Exception
Description copied from interface: ServiceUnit
Transition this service unit into the SHUTDOWN state. This call is only valid if the service unit is in a STOPPED state.

Specified by:
shutDown in interface ServiceUnit
Throws:
java.lang.Exception
See Also:
Endpoint.deactivate()

getCurrentState

public java.lang.String getCurrentState()
Description copied from interface: ServiceUnit
Retrieve the state of this service unit. States can be: STOPPED, STARTED or SHUTDOWN

Specified by:
getCurrentState in interface ServiceUnit
Returns:

getName

public java.lang.String getName()
Description copied from interface: ServiceUnit
Retrieves the name of this service unit.

Specified by:
getName in interface ServiceUnit
Returns:

setName

public void setName(java.lang.String name)

getRootPath

public java.lang.String getRootPath()
Description copied from interface: ServiceUnit
Retrieves the root path of this service unit.

Specified by:
getRootPath in interface ServiceUnit
Returns:

setRootPath

public void setRootPath(java.lang.String rootPath)

getComponent

public ServiceMixComponent getComponent()
Description copied from interface: ServiceUnit
Retrieves the component where this SU is deployed.

Specified by:
getComponent in interface ServiceUnit
Returns:
Returns the component.

setComponent

public void setComponent(ServiceMixComponent component)
Parameters:
component - The component to set.

getEndpoints

public java.util.Collection<Endpoint> getEndpoints()
Description copied from interface: ServiceUnit
Retrieves the list of deployed endpoints.

Specified by:
getEndpoints in interface ServiceUnit
Returns:

addEndpoint

public void addEndpoint(Endpoint endpoint)
                 throws javax.jbi.management.DeploymentException
Description copied from interface: ServiceUnit
Adds an endpoint to this service unit. Adding an endpoint will transition this endpoint into a state which is consistent with this service unit state.

Specified by:
addEndpoint in interface ServiceUnit
Throws:
javax.jbi.management.DeploymentException

removeEndpoint

public void removeEndpoint(Endpoint endpoint)
                    throws javax.jbi.management.DeploymentException
Description copied from interface: ServiceUnit
Removes an endpoint from this service unit. Removing an endpoint will transition it into the SHUTDOWN state.

Specified by:
removeEndpoint in interface ServiceUnit
Throws:
javax.jbi.management.DeploymentException

getEndpoint

public Endpoint getEndpoint(java.lang.String key)

getConfigurationClassLoader

public java.lang.ClassLoader getConfigurationClassLoader()
Description copied from interface: ServiceUnit
Retrieve this service unit specific classloader.

Specified by:
getConfigurationClassLoader in interface ServiceUnit
Returns:


Copyright © 2005-2012 FuseSource. All Rights Reserved.