org.apache.servicemix.common
Interface ServiceUnit

All Known Implementing Classes:
DefaultServiceUnit, EndpointTracker.OsgiServiceUnit, XBeanServiceUnit

public interface ServiceUnit

This interface defines the lifecycle and needed methods to a collection of endpoints grouped into a service unit.


Method Summary
 void addEndpoint(Endpoint ep)
          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.
 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 ep)
          Removes an endpoint from this service unit.
 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.
 

Method Detail

getName

java.lang.String getName()
Retrieves the name of this service unit.

Returns:

getRootPath

java.lang.String getRootPath()
Retrieves the root path of this service unit.

Returns:

getComponent

ServiceMixComponent getComponent()
Retrieves the component where this SU is deployed.

Returns:

getEndpoints

java.util.Collection<Endpoint> getEndpoints()
Retrieves the list of deployed endpoints.

Returns:

getConfigurationClassLoader

java.lang.ClassLoader getConfigurationClassLoader()
Retrieve this service unit specific classloader.

Returns:

getCurrentState

java.lang.String getCurrentState()
Retrieve the state of this service unit. States can be: STOPPED, STARTED or SHUTDOWN

Returns:

init

void init()
          throws java.lang.Exception
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.

Throws:
java.lang.Exception
See Also:
Endpoint.start()

start

void start()
           throws java.lang.Exception
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.

Throws:
java.lang.Exception
See Also:
Endpoint.start()

stop

void stop()
          throws java.lang.Exception
Transition this service unit to a STOPPED state. This call is only valid if the service unit is in a STARTED state.

Throws:
java.lang.Exception
See Also:
Endpoint.stop()

shutDown

void shutDown()
              throws java.lang.Exception
Transition this service unit into the SHUTDOWN state. This call is only valid if the service unit is in a STOPPED state.

Throws:
java.lang.Exception
See Also:
Endpoint.deactivate()

addEndpoint

void addEndpoint(Endpoint ep)
                 throws javax.jbi.management.DeploymentException
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.

Parameters:
ep -
Throws:
javax.jbi.management.DeploymentException

removeEndpoint

void removeEndpoint(Endpoint ep)
                    throws javax.jbi.management.DeploymentException
Removes an endpoint from this service unit. Removing an endpoint will transition it into the SHUTDOWN state.

Parameters:
ep -
Throws:
javax.jbi.management.DeploymentException


Copyright © 2005-2012 FuseSource. All Rights Reserved.