dbXML API

## com.dbxml.db.server
Interface Service

All Known Implementing Classes:
  SimpleService

public interface Service

Services are implemented to provide a daemon process for various purposes. The most general implementation of a Service is to provide a Socket based service, but Services can be written to function in just about any capacity.

See Also:
  `ServiceManager`

Field Summary
`static int` `RESULT_BUSY`
`static int` `RESULT_FAILED`
`static int` `RESULT_INVALID`
`static int` `RESULT_OK`
`static int` `STATE_STARTED`
`static int` `STATE_STOPPED`
`static int` `STATE_SUSPENDED`

Method Summary
`void` `dispose()` dispose prepares the Service for garbage collection.
`java.lang.String` `getName()` getName returns the name of this Service.
`int` `initialize()` initialize will initialize the Service based on its current configuration.
`int` `resume()` resume resumes exection of a suspended Service.
`void` `setServerInstance(Server server)` setServerInstance sets the Server instance for this Service.
`int` `start()` start will attempt to start the Service.
`int` `status()` status returns the current operational status of this Service.
`java.lang.String` `statusMessage()` statusMessage returns a textual message about the Service's operational state.
`int` `stop()` stop will attempt to stop the Service.
`int` `suspend()` suspend suspends execution of the Service.
`int` `uninitialize()` uninitialize will uninitialize the Service based on its current configuration and will clean up any existing resources for that configuration.

Field Detail

### STATE_STOPPED

    public static final int STATE_STOPPED

See Also:
  Constant Field Values

### STATE_STARTED

    public static final int STATE_STARTED

See Also:
  Constant Field Values

### STATE_SUSPENDED

    public static final int STATE_SUSPENDED

See Also:
  Constant Field Values

### RESULT_OK

    public static final int RESULT_OK

See Also:
  Constant Field Values

### RESULT_BUSY

    public static final int RESULT_BUSY

See Also:
  Constant Field Values

### RESULT_FAILED

    public static final int RESULT_FAILED

See Also:
  Constant Field Values

### RESULT_INVALID

    public static final int RESULT_INVALID

See Also:
  Constant Field Values

Method Detail

### getName

    public java.lang.String getName()

  getName returns the name of this Service.

  Returns:
    The Service name

### setServerInstance

    public void setServerInstance(Server server)

  setServerInstance sets the Server instance for this Service.

  Parameters:
    `server` - The Server instance

### status

    public int status()

  status returns the current operational status of this Service. This value can either be STATE_STOPPED, STATE_STARTED, or STATE_SUSPENDED.

  Returns:
    The Service's status

### statusMessage

    public java.lang.String statusMessage()

  statusMessage returns a textual message about the Service's operational state.

  Returns:
    The Service's status as a text message

### initialize

    public int initialize()

  initialize will initialize the Service based on its current configuration. RESULT_INVALID will be returned if the Service's configuration is invalid.

  Returns:
    The initialization status

### start

    public int start()

  start will attempt to start the Service. Depending on whether the Service was happy about being started or not, a value of RESULT_OK should be returned.

  Returns:
    The result of the start attempt

### stop

    public int stop()

  stop will attempt to stop the Service. Depending on whether the Service was happy about being stopped or not, a value of RESULT_OK should be returned.

  Returns:
    The result of the stop attempt

### suspend

    public int suspend()

  suspend suspends execution of the Service. It basically puts it into a paused state until it is resumed or started again. Depending on whether the Service was happy about being suspended or not, a value of RESULT_OK should be returned.

  Returns:
    The result of the suspend attempt

### resume

    public int resume()

  resume resumes exection of a suspended Service. It will also start a stopped Service. Depending on whether the Service was happy about being resumed or not, a value of RESULT_OK should be returned.

  Returns:
    The result of the resume attempt

### uninitialize

    public int uninitialize()

  uninitialize will uninitialize the Service based on its current configuration and will clean up any existing resources for that configuration. RESULT_INVALID will be returned if the Service's configuration is invalid.

  Returns:
    The uninitialization status

### dispose

    public void dispose()

  dispose prepares the Service for garbage collection. Any references that the object might be maintaining should be cleared when this method is called.

dbXML API

Copyright (c) 2004 The dbXML Group