Package com.sas.services

# Class AbstractService

java.lang.Object
com.sas.services.AbstractRemoteService
com.sas.services.AbstractService

All Implemented Interfaces:
  `com.sas.entities.EntityKeyInterface`, `ServiceNotificationBroadcasterInterface`, `RemoteServiceInterface`, `Remote`

Direct Known Subclasses:
  `AbstractDiscoveryService`

public abstract class AbstractService extends AbstractRemoteService
Abstract implementation of a service. A service may extend this implementation if it is only used within a local JVM process.

This class extends `com.sas.services.AbstractRemoteService` which provides a version that may be used used in a distributed environment where the service needs to be made available to remote clients.

Methods specified in this local version do not throw `RemoteException`.

Since:
  1.0
See Also:
  - `ServiceConfigurationInterface`

- ## Field Summary

  ### Fields inherited from interface com.sas.services.RemoteServiceInterface

  `CLASS_IDENTIFIER, CLASS_IDENTIFIER_1_1, CLASS_IDENTIFIER_1_2, CLASS_IDENTIFIER_SERVICE_TYPE, CLASS_IDENTIFIER_SERVICE_TYPE_1_1, CLASS_IDENTIFIER_SERVICE_TYPE_1_2`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `AbstractService(DiscoveryServiceInterface discoveryService)`
  Constructs a service.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `configure(ServiceConfigurationInterface serviceConfiguration)`
  Configures the service.
  `void`
  `destroy()`
  Destroys the service.
  `String`
  `getEntityKey()`
  Gets the service's entity key.

  ### Methods inherited from class com.sas.services.AbstractRemoteService

  `addServiceObserver, bindToDiscoveryService, getCreationTime, getDetails, getDiscoveryService, getEnvironment, getServiceConfiguration, getServiceConfiguration, getServiceProxy, getServiceState, handleJVMShutdown, isAccessibleToRemoteClients, isExported, isHandlingJVMShutdown, notifyServiceObservers, reconfigure, removeAllServiceObservers, removeServiceObserver, sameEntity, setDiscoveryService, setEntityKey, setRemoteableExporter, setServiceState, toString, unbindFromDiscoveryService`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- ## Constructor Details

  - ### AbstractService

    public AbstractService(DiscoveryServiceInterface discoveryService)
    Constructs a service.
    Parameters:
      `discoveryService` - A discovery service which may be used to locate other services and to which a service must bind in order to be discoverable by other services.

- ## Method Details

  - ### configure

    public void configure(ServiceConfigurationInterface serviceConfiguration) throws InitializationException, ServiceException
    Configures the service.
    Specified by:
      `configure` in interface `RemoteServiceInterface`
    Overrides:
      `configure` in class `AbstractRemoteService`
    Parameters:
      `serviceConfiguration` - Service's configuration.
    Throws:
      `InitializationException` - in unable to configure the service.
      `ServiceException` - if a service exception is encountered.

  - ### getEntityKey

    public String getEntityKey()
    Gets the service's entity key. The only purpose of this method is to catch the RemoteException that may be thrown by the superclass.
    Specified by:
      `getEntityKey` in interface `com.sas.entities.EntityKeyInterface`
    Overrides:
      `getEntityKey` in class `AbstractRemoteService`
    Returns:
      The service's entity key or `null` if unable to determine the entity key.
    Throws:
      `IllegalStateException` - if the service has been destroyed.
    See Also:
      - `AbstractRemoteService.getEntityKey()`

  - ### destroy

    public void destroy() throws ServiceException
    Destroys the service.
    Specified by:
      `destroy` in interface `RemoteServiceInterface`
    Overrides:
      `destroy` in class `AbstractRemoteService`
    Throws:
      `ServiceException` - if unable to cleanly destroy the service.