|
| Foundation |
|
| |||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||||||
com.sas.services.AbstractRemoteService
public abstract class AbstractRemoteService
Abstract implementation of a service which can be accessed from a remote JVM. A service may extend this implementation if it is intended to be deployed in a distributed environment.
Note that this class is extended by
AbstractService
which provides a version that may be used
locally within a JVM process. Methods specified in the local version do
not throw RemoteException.
RemoteServiceInterface,
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 | |
|---|---|
AbstractRemoteService()
Constructs a service. |
|
AbstractRemoteService(DiscoveryServiceInterface discoveryService)
Constructs a service. |
|
| Method Summary | |
|---|---|
void |
addServiceObserver(ServiceRemoteObserverInterface serviceObserver)
Adds a service observer. |
void |
bindToDiscoveryService()
Binds this service to the discovery service. |
void |
configure(ServiceConfigurationInterface serviceConfiguration)
Configures the service. |
void |
destroy()
Handles the destruction of this service. |
long |
getCreationTime()
Gets the time at which this configuration was created. |
java.lang.String |
getDetails()
Returns a String representation of this service. |
DiscoveryServiceInterface |
getDiscoveryService()
Gets the discovery service. |
java.lang.String |
getEntityKey()
Gets this service's entity key. |
protected Environment |
getEnvironment()
Get the Environment object. |
ServiceConfigurationInterface |
getServiceConfiguration()
Gets this service's configuration. |
ServiceConfigurationInterface |
getServiceConfiguration(java.lang.Object key)
Gets the service configuration associated with the specified lookup key. |
RemoteServiceInterface |
getServiceProxy()
Gets the service proxy. |
short |
getServiceState()
Gets the service's state. |
void |
handleJVMShutdown()
Handles JVM shutdown to destroy resources allocated by this service. |
boolean |
isAccessibleToRemoteClients()
Determines whether or not the service is intended to be accessible to remote clients. |
boolean |
isExported()
Determines whether or not the service has been exported to the RMI system. |
boolean |
isHandlingJVMShutdown()
Determines whether or not this service is currently handling a JVM shutdown. |
void |
notifyServiceObservers(ServiceEvent serviceEvent)
Notify all registered service observers of the specified service event. |
void |
reconfigure(ServiceConfigurationInterface serviceConfiguration)
Re-configures the service. |
void |
removeAllServiceObservers()
Removes all service observers. |
void |
removeServiceObserver(ServiceRemoteObserverInterface serviceObserver)
Removes a service observer. |
boolean |
sameEntity(com.sas.entities.EntityKeyInterface entity)
Determines whether or not this service entity is the same as the specified entity. |
void |
setDiscoveryService(DiscoveryServiceInterface discoveryService)
Sets the discovery service which may be used to locate other services. |
void |
setEntityKey(java.lang.String entityKey)
Set the unique entity key for the service. |
void |
setRemoteableExporter(com.sas.net.rmi.RemoteObjectExporterInterface remoteableExporter)
Sets the remoteable exporter. |
void |
setServiceState(ServiceState serviceState)
Sets the service's state. |
java.lang.String |
toString()
Returns a String representation of this service that includes the service's entity key. |
void |
unbindFromDiscoveryService()
Removes this service from the discovery service. |
| Constructor Detail |
|---|
public AbstractRemoteService()
public AbstractRemoteService(DiscoveryServiceInterface discoveryService)
discoveryService - A discovery service which may be used to locate other services and
to which a service must be bound in order to be discovered by other
services.| Method Detail |
|---|
public DiscoveryServiceInterface getDiscoveryService()
null if undefined.
public void bindToDiscoveryService()
throws ServiceException
ServiceException - if an exception was encountered
binding this service to the discovery service.
public void unbindFromDiscoveryService()
throws ServiceException
ServiceException - if an exception was encountered
removing this service from the discovery service.public void setDiscoveryService(DiscoveryServiceInterface discoveryService)
discoveryService - Discovery service which may be used to locate other services.
public void setRemoteableExporter(com.sas.net.rmi.RemoteObjectExporterInterface remoteableExporter)
throws java.lang.IllegalStateException
remoteableExporter - Utility to export/unexport a remoteable object.
java.lang.IllegalStateException - if the service has been destroyed.
public ServiceConfigurationInterface getServiceConfiguration()
throws java.lang.IllegalStateException
The service's configuration can always be retrieved regardless of the service's state.
getServiceConfiguration in interface RemoteServiceInterfacejava.lang.IllegalStateException - if the service has been destroyed.
public ServiceConfigurationInterface getServiceConfiguration(java.lang.Object key)
throws java.lang.IllegalStateException
ServiceConfigurationInterface.CONFIGURATION_SERVICE_DISCOVERY
then this configuration would be returned if defined.
If a null lookup key is specified, then the base service
configuration is returned.
The service's configuration can always be retrieved regardless of the service's state.
getServiceConfiguration in interface RemoteServiceInterfacekey - Key designating an ancillary configuration.
null if no configuration is defined for the
specified key.
java.lang.IllegalStateException - if the service has been destroyed.
public void configure(ServiceConfigurationInterface serviceConfiguration)
throws InitializationException,
java.rmi.RemoteException,
ServiceException
configure in interface RemoteServiceInterfaceserviceConfiguration - Service's configuration.
InitializationException - in unable to configure the service.
java.rmi.RemoteException - if a network anomaly is encountered.
ServiceException - if a service exception is encountered.
public void reconfigure(ServiceConfigurationInterface serviceConfiguration)
throws ServiceException,
java.rmi.RemoteException
reconfigure in interface RemoteServiceInterfaceserviceConfiguration - Service's configuration.
ServiceException - in unable to reconfigure the service.
java.rmi.RemoteException - if a network anomaly is encountered.
public java.lang.String getEntityKey()
throws java.rmi.RemoteException,
java.lang.IllegalStateException
getEntityKey in interface com.sas.entities.EntityKeyInterfacejava.rmi.RemoteException - if a network anomaly occurs.
java.lang.IllegalStateException - if the service has been destroyed.
public void setEntityKey(java.lang.String entityKey)
throws java.rmi.RemoteException,
java.lang.IllegalStateException
setEntityKey in interface com.sas.entities.EntityKeyInterfaceentityKey - Unique entity key.
java.rmi.RemoteException - if a network anomaly occurs.
java.lang.IllegalStateException - if the service has been destroyed or
if an attempt is made to alter the entity key which is
immutable.
public boolean sameEntity(com.sas.entities.EntityKeyInterface entity)
throws java.rmi.RemoteException,
java.lang.IllegalStateException
sameEntity in interface com.sas.entities.EntityKeyInterfaceentity - Entity to be compared to this service entity.
true if the service entities are the same or
false if they aren't.
java.rmi.RemoteException - if a network anomaly occurs.
java.lang.IllegalStateException - if the service has been destroyed.public short getServiceState()
getServiceState in interface RemoteServiceInterface
public void setServiceState(ServiceState serviceState)
throws ServiceException
setServiceState in interface RemoteServiceInterfaceserviceState - Service's new state.
ServiceException - if unable to process the request.
java.lang.IllegalArgumentException - if a null
service state is specified.
public boolean isExported()
throws java.lang.IllegalStateException
isExported in interface RemoteServiceInterfacetrue if the service has been exported or
false if it hasn't.
java.lang.IllegalStateException - if the service has not been configured
or has been destroyed.
public boolean isAccessibleToRemoteClients()
throws java.lang.IllegalStateException
isAccessibleToRemoteClients in interface RemoteServiceInterfacetrue if the service is intended to be accessible
to remote clients or
false if it isn't.
java.lang.IllegalStateException - if the service has not been configured
or has been destroyed.
public void handleJVMShutdown()
throws ServiceException
ServiceException - if unable to shutdown cleanly.public final boolean isHandlingJVMShutdown()
true if the service is destroying itself
in response to a JVM shutdown call back.
public void destroy()
throws java.rmi.RemoteException,
ServiceException
Once a service has been destroyed it should never be used again. The
service's state is set to
ServiceState.SERVICE_STATE_DEACTIVATED.
destroy in interface RemoteServiceInterfacejava.rmi.RemoteException - if a network anomaly is encountered.
ServiceException - if a service exception is encountered.
public final void addServiceObserver(ServiceRemoteObserverInterface serviceObserver)
throws java.rmi.RemoteException,
java.lang.IllegalStateException
addServiceObserver in interface ServiceNotificationBroadcasterInterfaceserviceObserver - An observer interested in receiving service notifications.
java.rmi.RemoteException - if a network anomaly is encountered.
java.lang.IllegalStateException - if the service has not been configured
or has been destroyed.
public final void removeServiceObserver(ServiceRemoteObserverInterface serviceObserver)
throws java.rmi.RemoteException
removeServiceObserver in interface ServiceNotificationBroadcasterInterfaceserviceObserver - An observer no longer interested in receiving service notifications.
java.rmi.RemoteException - if a network anomaly is encountered.
public final void removeAllServiceObservers()
throws java.rmi.RemoteException
removeAllServiceObservers in interface ServiceNotificationBroadcasterInterfacejava.rmi.RemoteException - if a network anomaly is encountered.
public final void notifyServiceObservers(ServiceEvent serviceEvent)
throws java.rmi.RemoteException,
java.lang.IllegalArgumentException
notifyServiceObservers in interface ServiceNotificationBroadcasterInterfaceserviceEvent - Service event to be broadcast to all registered service observers.
java.rmi.RemoteException - if a network anomaly is encountered.
java.lang.IllegalArgumentException - if a null service event
is specified.public final long getCreationTime()
getCreationTime in interface RemoteServiceInterface
public RemoteServiceInterface getServiceProxy()
throws java.lang.IllegalStateException
getServiceProxy in interface RemoteServiceInterfacenull
if a proxy is not available.
java.lang.IllegalStateException - if the service has not been configured
or has been destroyed.public java.lang.String getDetails()
public java.lang.String toString()
toString in class java.lang.Objectprotected final Environment getEnvironment()
null.
|
| Foundation |
|
| |||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||||||