|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.rioproject.resources.servicecore.ServiceProvider
org.rioproject.jsb.ServiceBeanAdapter
public abstract class ServiceBeanAdapter
The ServiceBeanAdapter implements the ServiceBean interface and provides the necessary service infrastructure to make a service developer succesful. Extend this class to take advantage of the Rio ServiceBean capabilities
| Nested Class Summary | |
|---|---|
class |
ServiceBeanAdapter.SnapshotThread
A Thread that will perform snapshots. |
| Field Summary | |
|---|---|
protected ActivationID |
activationID
The activation id for this service. |
protected ServiceAdminImpl |
admin
The ServiceAdmin implementation for this ServiceBeanAdapter |
protected ComputeResource |
computeResource
A reference to the compute resource for this ServiceBean |
protected ComputeResourceObserver |
computeResourceObserver
Observe the ComputeResource object associated with this ServiceBean. |
protected ServiceBeanContext |
context
A ServiceBeanContext provides the ServiceBean with necessary context required to obtain information about it's environment, attributes and ServiceBeanManager instance |
protected ServiceBeanContextManager |
contextMgr
Manages persistence of the ServiceBeanContext |
protected Joiner |
joiner
Joiner utility that contains a JoinManager and provides general utility to set the ServiceProvider's attribute collection |
protected ServiceBeanState |
jsbState
The ServiceBeanState component, managing the state of the ServiceBean |
protected List<MBeanNotificationInfo> |
mbeanNoticationInfoList
|
protected MBeanServer |
mbeanServer
|
protected ObjectName |
objectName
|
protected Object |
proxy
The proxy object for the service that will be registered into the lookup service |
protected String |
serviceBeanComponent
Component name we use to find items in the configuration. |
protected ServiceID |
serviceID
The serviceID for the ServiceBean |
protected SLAThresholdEventAdapter |
slaThresholdEventAdapter
|
protected ServiceBeanAdapter.SnapshotThread |
snapshotter
Thread that will do snapshots |
protected int |
state
The state of the ServiceBean |
protected PersistentStore |
store
PersistentStore the ServiceBeanContextManager uses to manage the state of the ServiceBeanContext |
protected Uuid |
uuid
The Uuid for the ServiceBean |
| Fields inherited from class org.rioproject.resources.servicecore.ServiceProvider |
|---|
eventTable, watchRegistry |
| Constructor Summary | |
|---|---|
ServiceBeanAdapter()
Construct a ServiceBeanAdapter |
|
| Method Summary | |
|---|---|
void |
addAttribute(Entry attribute)
Add an attribute to the Collection of attributes the Joiner utility maintains. |
void |
addAttributes(Entry[] attributes)
Add attributes to the Collection of attributes the Joiner utility maintains. |
void |
addNotificationListener(NotificationListener listener,
NotificationFilter filter,
Object object)
|
void |
advertise()
The advertise method provides the capability for a ServiceBean to advertise itself on the network providing access to all clients. |
protected void |
cleanJMX()
Called from destroy() (or if the service bean is aborted during start) to cleanup JMX resources and unregister from MBeanServer |
protected ObjectName |
createObjectName(ServiceBeanContext context)
Create JMX ObjectName used for MBeanServer registration |
protected Object |
createProxy()
Create the Object (the proxy) to communicate with the ServiceBean. |
void |
destroy()
Left for concrete implementations of this class to implement |
void |
destroy(boolean force)
The destroy method is used to destroy an instance of a ServiceBean. |
protected void |
destroyWatches()
Close down all WatchDataSource instances, unexporting them from the runtime |
protected Remote |
exportDo(Exporter exporter)
This method exports the remote object making it available to receive incoming calls |
Object |
getAdmin()
Provide a concrete implementation of getAdmin |
protected Exporter |
getAdminExporter()
Get the Exporter to export the ServiceAdmin |
AssociationManagement |
getAssociationManagement()
Deprecated. Use ServiceBeanContext.getAssociationManagement() instead |
protected ComputeResourceObserver |
getComputeResourceObserver()
Get the ComputeResourceObserver |
DiscoveryManagement |
getDiscoveryManager()
Deprecated. Use ServiceBeanContext.getDiscoveryManager |
protected Remote |
getExportedProxy()
Get the Object created by the configured Exporter |
protected Exporter |
getExporter(Configuration config)
Get the configured Exporter |
JoinManager |
getJoinManager()
Get the JoinManager created by the Joiner utility |
String[] |
getLookupGroups()
Get the discovery groups |
NotificationBroadcasterSupport |
getNotificationBroadcasterSupport()
|
MBeanNotificationInfo[] |
getNotificationInfo()
|
Object |
getProxy()
|
TrustVerifier |
getProxyVerifier()
Returns a TrustVerifier which can be used to verify that a
given proxy to this service can be trusted |
ServiceBeanContext |
getServiceBeanContext()
Get the ServiceBeanContext |
Uuid |
getServiceBeanInstantiatorUuid()
Get the Uuid of the Cybernode |
protected ServiceInfo |
getServiceInfo()
|
Object |
getServiceProxy()
Get the Object (the proxy) to communicate with the ServiceBean. |
EventHandler |
getSLAEventHandler()
Get the EventHandler that has been created to handle the sending of SLAThresholdEvent event objects to registered EventConsumer clients |
Date |
getStarted()
Get the Date the ServiceBean was started |
long |
getStartTime()
|
Uuid |
getUuid()
Get the Uuid |
protected Entry |
getWatchUI()
Get the Watch Ui (User Interface) UIDescriptor. |
void |
initialize(ServiceBeanContext context)
The initialize method is invoked to initialize the ServiceBean. |
void |
initialize(ServiceBeanContext context,
PersistentStore store)
The initialize method is invoked to initialize the ServiceBean. |
protected void |
initializeJMX(ServiceBeanContext context)
Called from initialize() to prepare JMX resources such as registering with MBeanServer |
Lease |
monitor(long duration)
Establish a Lease to monitor the reachability of the Service |
void |
ping()
Low cost roundtrip check |
void |
postDeregister()
Called after unregistering from MBeanServer. |
void |
postRegister(Boolean aBoolean)
Implemented as part of the contract for a MBeanRegistration, empty implementation |
void |
preDeregister()
Implemented as part of the contract for a MBeanRegistration, empty implementation |
ObjectName |
preRegister(MBeanServer mBeanServer,
ObjectName objectName)
Save registered objectName and MBeanServer as members |
protected void |
registerMBean(ObjectName oName,
MBeanServer mbeanServer)
Register the service using the ObjectName to the MBeanServer |
void |
removeNotificationListener(NotificationListener listener)
|
void |
removeNotificationListener(NotificationListener listener,
NotificationFilter filter,
Object object)
|
void |
setLookupGroups(String[] groups)
Set the discovery groups |
Object |
start(ServiceBeanContext context)
The start method provides the capability for a ServiceBean to initialize itself and make it ready to accept inbound communications, returning an Object which can be used to communicate with the ServiceBean. |
void |
startHeartbeat(String[] configArgs)
Start a heartbeat mechanism to determine the reachability of the Service. |
void |
stop(boolean force)
The stop method informs the ServiceBean to unexport itself from any underlying distributed Object communication mechanisms making it incapable of accepting inbound communications |
void |
unadvertise()
The unadvertise method informs the ServiceBean to cancel all advertisements (registrations, etc...) it has made on the network. |
| Methods inherited from class org.rioproject.resources.servicecore.ServiceProvider |
|---|
fetch, fetch, getConfiguration, getEventTable, getWatchRegistry, register, setConfiguration, setEventTable, setWatchRegistry |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected ServiceBeanContext context
protected Uuid uuid
protected ServiceID serviceID
protected ServiceAdminImpl admin
protected Joiner joiner
protected Object proxy
protected ComputeResource computeResource
protected ComputeResourceObserver computeResourceObserver
protected ServiceBeanAdapter.SnapshotThread snapshotter
protected ServiceBeanContextManager contextMgr
protected PersistentStore store
protected int state
protected ServiceBeanState jsbState
protected ActivationID activationID
protected String serviceBeanComponent
protected ObjectName objectName
protected MBeanServer mbeanServer
protected final List<MBeanNotificationInfo> mbeanNoticationInfoList
protected SLAThresholdEventAdapter slaThresholdEventAdapter
| Constructor Detail |
|---|
public ServiceBeanAdapter()
| Method Detail |
|---|
public Object start(ServiceBeanContext context)
throws Exception
start in interface ServiceBeancontext - The ServiceBeanContext containing ServiceBean
initialization attributes
Exception - If any errors or unexpected conditions occur
public void initialize(ServiceBeanContext context)
throws Exception
initialize in interface ServiceBeancontext - The ServiceBeanContext to initialize the ServiceBean with
Exception - If something unexpected happens
public void initialize(ServiceBeanContext context,
PersistentStore store)
throws Exception
context - The ServiceBeanContext to initialize the ServiceBean. If
this parameter is null a NullPointerException is thrownstore - A PersistentStore which will be used as a basis to create
a ServiceBeanContextManager used to manage the state of the
ServiceBeanContext. If this parameter is null, a
ServiceBeanContextManager will not be created
Exception - If something unexpected happensprotected ComputeResourceObserver getComputeResourceObserver()
protected void initializeJMX(ServiceBeanContext context)
throws Exception
context - The ServiceBeanContext
Exception - If errors occur
protected void registerMBean(ObjectName oName,
MBeanServer mbeanServer)
throws NotCompliantMBeanException,
MBeanRegistrationException,
InstanceAlreadyExistsException
oName - The ObjectName to registermbeanServer - The MBeanServer to use
NotCompliantMBeanException - If the bean is not compliant
MBeanRegistrationException - If the bean is already registered
InstanceAlreadyExistsException - If the instance already existsprotected void cleanJMX()
protected ObjectName createObjectName(ServiceBeanContext context)
throws MalformedObjectNameException
context - The ServiceBeanContext to use
MalformedObjectNameException - If there are errors creating the
JMX object name
public ObjectName preRegister(MBeanServer mBeanServer,
ObjectName objectName)
throws Exception
preRegister in interface MBeanRegistrationExceptionMBeanRegistration.preRegister(javax.management.MBeanServer, javax.management.ObjectName)public void postRegister(Boolean aBoolean)
MBeanRegistration, empty implementation
postRegister in interface MBeanRegistration
public void preDeregister()
throws Exception
MBeanRegistration, empty implementation
preDeregister in interface MBeanRegistrationExceptionpublic void postDeregister()
postDeregister in interface MBeanRegistrationMBeanRegistration.postDeregister()public ServiceBeanContext getServiceBeanContext()
public AssociationManagement getAssociationManagement()
protected Entry getWatchUI()
throws IOException
IOException - If errors occur creating the Entryprotected Remote getExportedProxy()
protected Object createProxy()
null or the ServiceBean has not been started. The default
semantic is to return the Remote Object created by the exporter.
If a different Object (proxy) is required, concrete implementations of
the ServiceBeanAdapter must override this method and set the desired
Object, or declare the CreateProxy
annotation or declare the "createProxy(arg)" method
public Object getServiceProxy()
getServiceProxy in interface ServiceProxyAccessorgetServiceProxy in class ServiceProviderpublic Object getProxy()
getProxy in interface ProxyAccessorProxyAccessor.getProxy()public TrustVerifier getProxyVerifier()
TrustVerifier which can be used to verify that a
given proxy to this service can be trusted
getProxyVerifier in interface ServerProxyTrust
public DiscoveryManagement getDiscoveryManager()
throws IOException
IOException - because construction of the class
DiscoveryManagement implementation may initiate the discovery process,
which can throw an IOException when socket allocation occurs.public EventHandler getSLAEventHandler()
public void addAttribute(Entry attribute)
attribute - Entry to addpublic void addAttributes(Entry[] attributes)
attributes - Array of Entry attributes
public void advertise()
throws IOException
ServiceBean
advertise in interface ServiceBeanadvertise in interface ServiceBeanAdapterMBeanIOException - If errors occur access underlying communication
mechanismsServiceBeanAdapterMBean.advertise()protected ServiceInfo getServiceInfo()
public void unadvertise()
ServiceBean
unadvertise in interface ServiceBeanunadvertise in interface ServiceBeanAdapterMBeanServiceBeanAdapterMBean.unadvertise()public void stop(boolean force)
stop in interface ServiceBeanforce - If true, unexports the ServiceBean even if there are
pending or in-progress calls; if false, only unexports the ServiceBean
if there are no pending or in-progress calls.
If the force parameters is false, unexporting
the ServiceBean will be governed by the following configuration
properties:
IllegalStateException - If the state transition is illegalpublic Object getAdmin()
getAdmin in interface AdministrablegetAdmin in class ServiceProviderprotected void destroyWatches()
public void destroy()
ServiceProvider
destroy in interface ServiceBeanAdapterMBeandestroy in class ServiceProviderServiceBeanAdapterMBean.destroy()public void destroy(boolean force)
ServiceBean
destroy in interface ServiceBeandestroy in interface ServiceBeanAdapterMBeanforce - If true, unexports the ServiceBean even if there are
pending or in-progress calls; if false, only unexports the ServiceBean if
there are no pending or in-progress callsServiceBeanAdapterMBean.destroy(boolean)
public Lease monitor(long duration)
throws LeaseDeniedException,
RemoteException
MonitorableService
monitor in interface MonitorableServiceduration - The duration (in milliseconds) of the requested Lease
LeaseDeniedException - If requested Lease is denied
RemoteException - If communication errors occurMonitorableService.monitor(long)
public void startHeartbeat(String[] configArgs)
throws ConfigurationException,
RemoteException
MonitorableServiceorg.rioproject.fdh.HeartbeatFaultDetectionHandler.heartbeatServer
startHeartbeat in interface MonitorableServiceconfigArgs - Configuration attributes the Service will use to
establish a heartbeat mechanism
ConfigurationException - If there are errors processing the
configuration
RemoteException - If communication errors occurMonitorableService.startHeartbeat(java.lang.String[])
public void ping()
throws RemoteException
MonitorableService
ping in interface MonitorableServiceRemoteException - If an error occured during communication with the
serviceMonitorableService.ping()public Uuid getUuid()
getUuid in class ServiceProviderpublic Uuid getServiceBeanInstantiatorUuid()
public JoinManager getJoinManager()
protected Exporter getExporter(Configuration config)
throws Exception
config - The configuration to obtain
Exception - If there are errors getting the Exporter
protected Remote exportDo(Exporter exporter)
throws Exception
exporter - The Exporter to use, must not be null
Exception - If errors occurpublic Date getStarted()
ServiceBeanAdapterMBean
getStarted in interface ServiceBeanAdapterMBeanServiceBeanAdapterMBean.getStarted()public long getStartTime()
public String[] getLookupGroups()
ServiceBeanAdapterMBean
getLookupGroups in interface ServiceBeanAdapterMBeanServiceBeanAdapterMBean.getLookupGroups()public void setLookupGroups(String[] groups)
ServiceBeanAdapterMBean
setLookupGroups in interface ServiceBeanAdapterMBeanServiceBeanAdapterMBean.setLookupGroups(java.lang.String[])
protected Exporter getAdminExporter()
throws ConfigurationException,
UnknownHostException
ConfigurationException - If there are errors reading the
configuration
UnknownHostException - If the host is unknown
public void removeNotificationListener(NotificationListener listener,
NotificationFilter filter,
Object object)
throws ListenerNotFoundException
removeNotificationListener in interface NotificationEmitterListenerNotFoundException
public void addNotificationListener(NotificationListener listener,
NotificationFilter filter,
Object object)
throws IllegalArgumentException
addNotificationListener in interface NotificationBroadcasterIllegalArgumentException
public void removeNotificationListener(NotificationListener listener)
throws ListenerNotFoundException
removeNotificationListener in interface NotificationBroadcasterListenerNotFoundExceptionpublic MBeanNotificationInfo[] getNotificationInfo()
getNotificationInfo in interface NotificationBroadcasterpublic NotificationBroadcasterSupport getNotificationBroadcasterSupport()
|
Copyright © Rio Project. | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||