Service Instances in WSO2 SOA Enablement Server can be in one of a number of states. Some transitions between states are automatic and some are caused by explicit calls to ServiceInstance. This section describes the states and the transitions. For more information about the possible states of a service instance, see the section on Web service Life Cycle in the WS Components and Lifecycle chapter. The life cycle diagram from this chapter is reproduced below:
The state of a Web service is given in the org.systinet.wasp.webservice.ServiceState class.
public static java.lang.String stringValue(int value)
Takes integer representing the service state of this service instance and returns the human-readable name.
The state is changed through the methods in org.systinet.wasp.webservice.ServiceInstance
public abstract void enable() throws InvalidStateTransitionException;
Performs transition from the Disabled or Offline state to the Enabled state, thus allowing the service to process requests.
public abstract void disable() throws InvalidStateTransitionException;
Performs transition to the Disabled service state, by way of the Destroying state. For persistently deployed services, Disabled continues after the server re-starts.
public abstract void kill() throws InvalidStateTransitionException;
The kill() method forces the service to go directly to the Disabled state without first going into Destroying and processing the requests in the queue.
public abstract void waitForState(int states) throws InterruptedException;
Waits for the service instance to enter a given state. This method returns when the service instance enters that state. This method will wait indefinitely, unlike the following:
public abstract boolean waitForState(int states, long time-out) throws InterruptedException;
Waits a specified amount of time for the service instance to enter a given state. This method returns when the service instance enters that state or when the time limit is reached.
public abstract String getResource(String path);
Returns the resource with the given name or null if the resource could not be found. The name of a resource is a "/"-separated path name that identifies the resource. If "/" is used as the path name, the method returns the location of the server-side service directory. Note that "/" returns valid data only for persistently deployed services.
public abstract InputStream getResourceAsStream(String path) throws IOException;
As getResource(String path) above, except returns the input stream of the resource rather than the resource itself.
public abstract void log(java.lang.String msg);
Logs a message.
public abstract void log(java.lang.String message, java.lang.Throwable throwable);
Logs a message and exception.
A service instance can be notified when it should be initialized (usually when it makes the transition from off-line state to enabled state) or destroyed if it implements the interface org.systinet.wasp.webservice.Initializable.
![]() | Note |
---|---|
Under the current WSO2 SOA Enablement Server implementation, it is not possible for two services to bind each other (or get each other's WSDL file) in both of their init(...) methods. This would cause undesirable behavior. |
Because these interfaces affect service instances and not service endpoints, only the appropriate org.systinet.wasp.webservice.ServiceInstanceContext is accessible in the init method.