com.sas.services
Interface ServiceInterface

All Superinterfaces:
com.sas.entities.EntityKeyInterface, java.rmi.Remote, RemoteServiceInterface, ServiceNotificationBroadcasterInterface

public interface ServiceInterface
extends RemoteServiceInterface

Interface used to designate a service that is only available within the local JVM.

While this interface extends com.sas.services.RemoteServiceInterface, note that this interface does not throw RemoteException, thereby facilitating a service interface that may be used locally within a JVM process.

Since:
1.0

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
 
Method Summary
 void configure(ServiceConfigurationInterface serviceConfiguration)
          Configures the service.
 void destroy()
          Destroys the service.
 long getCreationTime()
          Gets the time at which this configuration was created.
 ServiceConfigurationInterface getServiceConfiguration()
          Gets the service's configuration.
 RemoteServiceInterface getServiceProxy()
          Gets the service proxy.
 short getServiceState()
          Gets the current state of the service.
 boolean isAccessibleToRemoteClients()
          Determines whether or not the service is accessible to remote clients.
 boolean isExported()
          Determines whether or not the service has been exported to the RMI system.
 void setServiceState(ServiceState serviceState)
          Sets the state of the service.
 
Methods inherited from interface com.sas.services.RemoteServiceInterface
getServiceConfiguration, reconfigure
 
Methods inherited from interface com.sas.services.mgmt.ServiceNotificationBroadcasterInterface
addServiceObserver, notifyServiceObservers, removeAllServiceObservers, removeServiceObserver
 

Method Detail

destroy

void destroy()
             throws ServiceException
Destroys the service. This method should only be invoked after a service has been configured. It is suggested that the service invoke the destory method if a configuration request fails and the service is not in a stable state.

The service should release any resources it holds in preparation for termination of use of this service.

Specified by:
destroy in interface RemoteServiceInterface
Throws:
ServiceException - if the service is unable to prepare itself for destruction.

getServiceConfiguration

ServiceConfigurationInterface getServiceConfiguration()
Gets the service's configuration.

Specified by:
getServiceConfiguration in interface RemoteServiceInterface
Returns:
Service's configuration or null if no service configuration is defined.

configure

void configure(ServiceConfigurationInterface serviceConfiguration)
               throws InitializationException,
                      ServiceException
Configures the service. Note that this method may used to initialize a service or to re-configure a previously initialized service.

An InitializationException will be thrown if the service is unable to complete the configuration request successfully. Suggested policy for handling such an exception is for the service to invoke its destroy() method if a service is being initialized.

A ServiceException will be thrown if a request to reconfigure the service fails and the service is able to restore its previous configuration. If a reconfiguration request fails and the service is unable to restore its previous configuration, then an InitializationException should be thrown instead of a ServiceException.

Specified by:
configure in interface RemoteServiceInterface
Parameters:
serviceConfiguration - An object containing configuration data necessary to initialize or re-configure a service. Note that the service must verify that the object type is supported. An InitializationException should be thrown if the initialization was not completed successfully to indicate that the instance should not be used.
Throws:
InitializationException - if unable to initialize the service. If this exception is thrown then the service should not be used.
ServiceException - if a previously initialized service does not support reconfiguration.

getCreationTime

long getCreationTime()
Gets the time at which this configuration was created.

Specified by:
getCreationTime in interface RemoteServiceInterface
Returns:
Time the service was created.

getServiceState

short getServiceState()
Gets the current state of the service. The state will be one of

Specified by:
getServiceState in interface RemoteServiceInterface
Returns:
Service's state.

isAccessibleToRemoteClients

boolean isAccessibleToRemoteClients()
                                    throws ServiceException
Determines whether or not the service is accessible to remote clients.

Specified by:
isAccessibleToRemoteClients in interface RemoteServiceInterface
Returns:
true if the service is intended to be accessible to remote clients or false if it isn't.
Throws:
ServiceException - if unable to process the request.

isExported

boolean isExported()
                   throws ServiceException
Determines whether or not the service has been exported to the RMI system.

Specified by:
isExported in interface RemoteServiceInterface
Returns:
true if the service has been exported or false if it hasn't.
Throws:
ServiceException - if unable to process the request.

setServiceState

void setServiceState(ServiceState serviceState)
                     throws ServiceException
Sets the state of the service.

Specified by:
setServiceState in interface RemoteServiceInterface
Parameters:
serviceState - Service's state.
Throws:
ServiceException - if an invalid service state is specified.

getServiceProxy

RemoteServiceInterface getServiceProxy()
Gets the service proxy.

Specified by:
getServiceProxy in interface RemoteServiceInterface
Returns:
A proxy to this service or null if a proxy is not available.



Copyright © 2009 SAS Institute Inc. All Rights Reserved.