|
Foundation |
|
| |||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
com.sas.services.ServiceProxy
public class ServiceProxy
Foundation service proxy. If the service is available locally then a local reference will be used. If a local reference isn't available, then the remote service stub will be proxied.
Some attributes of a service are defined at the time a service is constructed an not alterable.
The following attributes are not cached to ensure that the current value is always obtained.
Some service methods may not be invoked by a client that is remote to the process in which the service was instantiated. These methods will be ignored if invoked by a remote client.
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 | |
---|---|
ServiceProxy(RemoteServiceInterface service)
Constructs a foundation service proxy for the specified service. |
Method Summary | |
---|---|
void |
addServiceObserver(ServiceRemoteObserverInterface serviceObserver)
Adds a service observer. |
void |
configure(ServiceConfigurationInterface serviceConfiguration)
Configures the service. |
void |
destroy()
Destroys the service proxy. |
protected RemoteServiceInterface |
findRemoteService()
Attempts to re-discover an instance of a remote service represented by this proxy. |
long |
getCreationTime()
Gets the time at which this service was created. |
java.lang.String |
getEntityKey()
Gets the service proxy's entity key. |
protected RemoteServiceInterface |
getService()
Gets the service. |
ServiceConfigurationInterface |
getServiceConfiguration()
Gets the service's configuration. |
ServiceConfigurationInterface |
getServiceConfiguration(java.lang.Object key)
Gets the service's configuration associated with the specified lookup key. |
RemoteServiceInterface |
getServiceProxy()
Gets the service proxy. |
short |
getServiceState()
Gets the foundation service's state. |
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. |
boolean |
isLocalService()
Determines whether or not this proxy has a local handle to the service. |
boolean |
isProxyToRemoteService()
Determines whether or not this is a proxy to a remote service |
void |
notifyServiceObservers(ServiceEvent serviceEvent)
Notify all registered service observers of the specified service event. |
void |
reconfigure(ServiceConfigurationInterface serviceConfiguration)
Reconfigure the service. |
void |
removeAllServiceObservers()
Removes all service observers. |
void |
removeServiceObserver(ServiceRemoteObserverInterface serviceObserver)
Removes a service observer. |
boolean |
sameEnitityKey(java.lang.String entityKey)
Determines if the this service's entity key is the same. |
boolean |
sameEntity(com.sas.entities.EntityKeyInterface entity)
Determines whether or not the specified entity is the same as this entity. |
void |
setEntityKey(java.lang.String entityKey)
|
void |
setServiceState(ServiceState serviceState)
Sets the state of the service. |
Constructor Detail |
---|
public ServiceProxy(RemoteServiceInterface service) throws InitializationException
service
- Foundation service.
InitializationException
- if an invalid service
is specified.Method Detail |
---|
protected final RemoteServiceInterface getService() throws java.lang.IllegalStateException
If the proxied service is a stub to a remote service which
is no longer available because it is not reachable on a
particular host:port, then a ConnectException
will be thrown when one attempts to invoke a service method.
If the proxied service is a stub to a remote service which
is no longer available because it is not reachable on a
particular host and well known port, then a NoSuchObjectException
will be thrown when one attempts to invoke a service method.
This indicates that the remote object is no longer registered
in the remote JVM by the specified object ID.
findRemoteService()
to attempt to re-initialize
this proxy with another remote service stub that satisfies
the same service template as the original proxied service.
java.lang.IllegalStateException
- if the service has been destroyed.public final void configure(ServiceConfigurationInterface serviceConfiguration) throws ServiceException, java.rmi.RemoteException
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
.
configure
in interface RemoteServiceInterface
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.
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.
java.rmi.RemoteException
- if a network anomaly is encountered.public final void reconfigure(ServiceConfigurationInterface serviceConfiguration) throws ServiceException, java.rmi.RemoteException, java.lang.IllegalStateException
Since the configure method provides one-time functionality such as exporting and adding shutdown hooks, this method should be used in lieu of the configure method to re-configure a service.
reconfigure
in interface RemoteServiceInterface
serviceConfiguration
- An object containing configuration data
necessary to re-configure a service.
ServiceException
- if unable to re-configure the service.
java.rmi.RemoteException
- if a network anomaly is encountered.
java.lang.IllegalStateException
public boolean isExported() throws ServiceException
isExported
in interface RemoteServiceInterface
true
if the service has been exported or
false
if it hasn't.
ServiceException
- if unable to process the request.public boolean isAccessibleToRemoteClients() throws ServiceException
isAccessibleToRemoteClients
in interface RemoteServiceInterface
true
if the service is intended to be accessible
to remote clients or
false
if it isn't.
ServiceException
- if unable to process the request.public final long getCreationTime()
getCreationTime
in interface RemoteServiceInterface
public final short getServiceState() throws java.rmi.RemoteException
getServiceState
in interface RemoteServiceInterface
java.rmi.RemoteException
- if unable to ascertain the state
of a remote service.public final void setServiceState(ServiceState serviceState) throws ServiceException
setServiceState
in interface RemoteServiceInterface
serviceState
- Service's state.
ServiceException
- if an invalid service state is specified.public final ServiceConfigurationInterface getServiceConfiguration()
getServiceConfiguration
in interface RemoteServiceInterface
null
if a configuration
is not defined.public final ServiceConfigurationInterface getServiceConfiguration(java.lang.Object key)
null
.
getServiceConfiguration
in interface RemoteServiceInterface
key
- Lookup key for the desired service configuration.
null
if no service
configuration is defined.public RemoteServiceInterface getServiceProxy()
getServiceProxy
in interface RemoteServiceInterface
null
if a proxy is not available.public final void addServiceObserver(ServiceRemoteObserverInterface serviceObserver) throws java.rmi.RemoteException
addServiceObserver
in interface ServiceNotificationBroadcasterInterface
serviceObserver
- An observer interested in receiving service notifications.
java.rmi.RemoteException
- if a network anomaly is encountered.public final void removeServiceObserver(ServiceRemoteObserverInterface serviceObserver) throws java.rmi.RemoteException
removeServiceObserver
in interface ServiceNotificationBroadcasterInterface
serviceObserver
- 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 ServiceNotificationBroadcasterInterface
java.rmi.RemoteException
- if a network anomaly is encountered.public final void notifyServiceObservers(ServiceEvent serviceEvent) throws java.rmi.RemoteException
notifyServiceObservers
in interface ServiceNotificationBroadcasterInterface
serviceEvent
- Service event to be broadcast to all registered service observers.
java.rmi.RemoteException
- if a network anomaly is encountered.public final void destroy()
destroy
in interface RemoteServiceInterface
public final java.lang.String getEntityKey()
getEntityKey
in interface com.sas.entities.EntityKeyInterface
null
ID indicates
that an entity key could not be determined for the service
indicating that the service is not accessible.public final void setEntityKey(java.lang.String entityKey)
setEntityKey
in interface com.sas.entities.EntityKeyInterface
public final boolean sameEntity(com.sas.entities.EntityKeyInterface entity)
sameEntity
in interface com.sas.entities.EntityKeyInterface
entity
- Entity to be compared
true
if the entities are the same.EntityKeyInterface.sameEntity(EntityKeyInterface)
public final boolean sameEnitityKey(java.lang.String entityKey)
entityKey
- Another service's entity key.
true
if the entity key's are the same.public final boolean isProxyToRemoteService()
true
if this is a proxy to a remote service
or false
if it is a proxy to local service.public final boolean isLocalService()
true
if the service is local.protected RemoteServiceInterface findRemoteService() throws ServiceException, java.rmi.RemoteException
null
if the service is not available.
ServiceException
- if unable to re-discover the service.
java.rmi.RemoteException
- if unable to discover a networked service.
|
Foundation |
|
| |||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |