Rio Project 4.2 API Documentation



org.rioproject.cybernode
Class CybernodeImpl

java.lang.Object
  extended by org.rioproject.resources.servicecore.ServiceProvider
      extended by org.rioproject.jsb.ServiceBeanAdapter
          extended by org.rioproject.cybernode.CybernodeImpl
All Implemented Interfaces:
ServiceProxyAccessor, Remote, MBeanRegistration, NotificationBroadcaster, NotificationEmitter, Administrable, ProxyAccessor, ServerProxyTrust, ServiceBean, ServiceBeanInstantiator, Cybernode, CybernodeImplMBean, ServiceBeanContainerListener, EventProducer, MonitorableService, ServiceBeanAdapterMBean, Service, Watchable

public class CybernodeImpl
extends ServiceBeanAdapter
implements Cybernode, ServiceBeanContainerListener, CybernodeImplMBean, ServerProxyTrust

Implementation of a Cybernode

Author:
Dennis Reedy

Nested Class Summary
 
Nested classes/interfaces inherited from class org.rioproject.jsb.ServiceBeanAdapter
ServiceBeanAdapter.SnapshotThread
 
Field Summary
 
Fields inherited from class org.rioproject.jsb.ServiceBeanAdapter
activationID, admin, computeResource, computeResourceObserver, context, contextMgr, joiner, jsbState, mbeanNoticationInfoList, mbeanServer, objectName, proxy, serviceBeanComponent, serviceID, slaThresholdEventAdapter, snapshotter, state, store, uuid
 
Fields inherited from class org.rioproject.resources.servicecore.ServiceProvider
eventTable, watchRegistry
 
Constructor Summary
CybernodeImpl()
          Create a Cybernode
CybernodeImpl(ActivationID activationID, MarshalledObject data)
          Create a Cybernode that uses RMI Activation
CybernodeImpl(String[] configArgs, LifeCycle lifeCycle)
          Create a Cybernode launched from the ServiceStarter framework
 
Method Summary
protected  void addRegistrationTask(TimerTask task)
          Add a TimerTask to the Collection of TimerTasks
protected  void bootstrap(String[] configArgs)
           
protected  Object createProxy()
          Override ServiceBeanAdapter createProxy to return a Cybernode Proxy
 void destroy()
          Left for concrete implementations of this class to implement
 void destroy(boolean force)
          Override destroy to ensure that any JSBs are shutdown as well
protected  void doEnlist(Schedule schedule)
          Have the Cybernode add itself as a resource which can be used to instantiate dynamic application services.
 void enlist(Schedule schedule)
          Have the Cybernode add itself as a resource which can be used to instantiate dynamic application services.
 Object getAdmin()
          Override parent's getAdmin to return custom service admin
protected  Schedule getAvailabilitySchedule()
          Get the availability schedule
 ComputeResource getComputeResource()
          Get the ComputeResource associated with this Cybernode
static String getConfigComponent()
          Get the component name to use for accessing the services configuration properties
 InetAddress getInetAddress()
          Get the IP address of the ServiceBeanInstantiator
 Uuid getInstantiatorUuid()
          Implemented to support interface contract.
 String getName()
          Get a name for the ServiceBeanInstantiator
 boolean getPersistentProvisioning()
          Get whether the Cybernode supports persistent provisioning of qualitative capabilities
 TrustVerifier getProxyVerifier()
          Override parent's method to return TrustVerifier which can be used to verify that the given proxy to this service can be trusted
protected  TimerTask[] getRegistrationTasks()
          Get all in process TimerTask instances that are specific to availability scheduling for registration to monitor instances
 Schedule getSchedule()
          Get the availability schedule for the Cybernode.
protected  ServiceBeanContainer getServiceBeanContainer()
           
 ServiceBeanInstance[] getServiceBeanInstances(ServiceElement element)
          Get all ServiceBeanInstance objects for a ServiceElement
 Integer getServiceCount()
          Get the number of services that this Cybernode has instantiated
protected  ServiceInfo getServiceInfo()
          Get the ServiceInfo for the Cybernode
 Integer getServiceLimit()
          Get the upper limit of services that this Cybernode can instantiate
 ServiceRecord[] getServiceRecords(int filter)
          This method returns an array of ServiceRecord objects which contain information about the service instances this ServiceBeanInstantiator has instantiated.
 ServiceStatement getServiceStatement(ServiceElement elem)
          This method returns a ServiceStatement for the ServiceElement
 ServiceStatement[] getServiceStatements()
          This method returns an array of ServiceStatement objects which contain information about the ServiceBean instances this ServiceBeanInstantiator has instantiated.
protected  Entry[] getServiceUIs()
          Get the service UIs to add
protected  Timer getTaskTimer()
          Get the Timer created for the Cybernode
 double getUtilization()
          Get the resource's utilization.
protected  Entry getWatchUI()
          Override parents getWatchUI, using cybernode-ui.jar as the JAR containing org.rioproject.watch.AccumulatorViewer
 void initialize(ServiceBeanContext context)
          The initialize method is invoked to initialize the ServiceBean.
 DeployedService instantiate(ServiceProvisionEvent event)
          This method is invoked as a result of event registration to ProvisionManager instances.
 boolean isEnlisted()
          Get the enlisted state
protected  void loadInitialServices(Configuration config)
          Load any initial services
 void release(boolean terminateServices)
          Have the Cybernode remove itself as a resource which that can be used to instantiate dynamic application services.
protected  void removeRegistrationTask(TimerTask task)
          Remove a TimerTask from Collection of scheduled TimerTask instances
 void serviceDiscarded(ServiceRecord serviceRecord)
          Notification that a ServiceBean has been discarded
 void serviceInstantiated(ServiceRecord serviceRecord)
          Notification that a ServiceBean has been instantiated
protected  void setAvailabilitySchedule(Schedule sched)
          Set the availability schedule
protected  void setConfigComponent(String comp)
          Set the component name to use for accessing the services configuration properties
protected  void setEnlisted(boolean value)
          Set the enlisted flag
 void setPersistentProvisioning(boolean provisionEnabled)
          Set whether the Cybernode supports persistent provisioning of qualitative capabilities
 void setServiceLimit(Integer limit)
          Set the upper limit of services that this Cybernode can instantiate
 void update(ServiceElement[] sElements, OperationalStringManager opStringMgr)
          Invoked to update instantiated ServiceBean instances of changes in their ServiceElement objects and OperationalStringManager references.
 
Methods inherited from class org.rioproject.jsb.ServiceBeanAdapter
addAttribute, addAttributes, addNotificationListener, advertise, cleanJMX, createObjectName, destroyWatches, exportDo, getAdminExporter, getAssociationManagement, getComputeResourceObserver, getDiscoveryManager, getExportedProxy, getExporter, getJoinManager, getLookupGroups, getNotificationBroadcasterSupport, getNotificationInfo, getProxy, getServiceBeanContext, getServiceBeanInstantiatorUuid, getServiceProxy, getSLAEventHandler, getStarted, getStartTime, getUuid, initialize, initializeJMX, monitor, ping, postDeregister, postRegister, preDeregister, preRegister, registerMBean, removeNotificationListener, removeNotificationListener, setLookupGroups, start, startHeartbeat, stop, unadvertise
 
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
 
Methods inherited from interface org.rioproject.jsb.MonitorableService
monitor, ping, startHeartbeat
 
Methods inherited from interface org.rioproject.event.EventProducer
register
 
Methods inherited from interface org.rioproject.watch.Watchable
fetch, fetch
 
Methods inherited from interface org.rioproject.jsb.ServiceBeanAdapterMBean
advertise, getLookupGroups, getStarted, setLookupGroups, unadvertise
 

Constructor Detail

CybernodeImpl

public CybernodeImpl()
Create a Cybernode


CybernodeImpl

public CybernodeImpl(String[] configArgs,
                     LifeCycle lifeCycle)
              throws Exception
Create a Cybernode launched from the ServiceStarter framework

Parameters:
configArgs - Configuration arguments
lifeCycle - The LifeCycle object that started the Cybernode
Throws:
Exception - if bootstrapping fails

CybernodeImpl

public CybernodeImpl(ActivationID activationID,
                     MarshalledObject data)
              throws Exception
Create a Cybernode that uses RMI Activation

Parameters:
activationID - The ActivationID
data - Startup data as a MarshalledObject
Throws:
Exception - if bootstrapping fails
Method Detail

destroy

public void destroy()
Description copied from class: ServiceProvider
Left for concrete implementations of this class to implement

Specified by:
destroy in interface ServiceBeanAdapterMBean
Overrides:
destroy in class ServiceBeanAdapter
See Also:
ServiceBeanAdapterMBean.destroy()

destroy

public void destroy(boolean force)
Override destroy to ensure that any JSBs are shutdown as well

Specified by:
destroy in interface ServiceBean
Specified by:
destroy in interface ServiceBeanAdapterMBean
Overrides:
destroy in class ServiceBeanAdapter
Parameters:
force - 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
See Also:
ServiceBeanAdapterMBean.destroy(boolean)

getProxyVerifier

public TrustVerifier getProxyVerifier()
Override parent's method to return TrustVerifier which can be used to verify that the given proxy to this service can be trusted

Specified by:
getProxyVerifier in interface ServerProxyTrust
Overrides:
getProxyVerifier in class ServiceBeanAdapter
Returns:
TrustVerifier The TrustVerifier used to verify the proxy

getServiceStatements

public ServiceStatement[] getServiceStatements()
Description copied from interface: ServiceBeanInstantiator
This method returns an array of ServiceStatement objects which contain information about the ServiceBean instances this ServiceBeanInstantiator has instantiated.

Specified by:
getServiceStatements in interface ServiceBeanInstantiator
Returns:
An array of ServiceStatement objects. The array will be empty if no ServiceStatement instances are found
See Also:
ServiceBeanInstantiator.getServiceStatements()

getServiceRecords

public ServiceRecord[] getServiceRecords(int filter)
Description copied from interface: ServiceBeanInstantiator
This method returns an array of ServiceRecord objects which contain information about the service instances this ServiceBeanInstantiator has instantiated.

Specified by:
getServiceRecords in interface ServiceBeanInstantiator
Parameters:
filter - A filter for ServiceRecord retrieval. ServiceRecord instances will be returned if the ServiceRecord type matches the filter type. The filter can be either ServiceRecord.ACTIVE_SERVICE_RECORD or ServiceRecord.INACTIVE_SERVICE_RECORD.
Returns:
An array of ServiceRecord objects. The array will be empty if no ServiceRecord instances are found which match the filter
See Also:
ServiceBeanInstantiator.getServiceRecords(int)

getServiceStatement

public ServiceStatement getServiceStatement(ServiceElement elem)
Description copied from interface: ServiceBeanInstantiator
This method returns a ServiceStatement for the ServiceElement

Specified by:
getServiceStatement in interface ServiceBeanInstantiator
Parameters:
elem - The ServiceElement to get the ServiceStatement for. If this argument should is null, an IllegalArgumentException is thrown.
Returns:
A ServiceStatement for the ServiceElement. If the ServiceElement has never been instantiated by the ServiceBeanInstantiator, a null is returned
See Also:
ServiceBeanInstantiator.getServiceStatement(org.rioproject.core.ServiceElement)

getServiceBeanInstances

public ServiceBeanInstance[] getServiceBeanInstances(ServiceElement element)
Description copied from interface: ServiceBeanInstantiator
Get all ServiceBeanInstance objects for a ServiceElement

Specified by:
getServiceBeanInstances in interface ServiceBeanInstantiator
Parameters:
element - The ServiceElement to obtain ServiceBeanInstance objects for.
Returns:
An array of ServiceBeanInstance objects. If the element parameter is null return all ServiceBeanInstance objects. A new array is allocated each time. If there are no matching ServiceBeanInstance objects a zero-length array is returned
See Also:
ServiceBeanInstantiator.getServiceBeanInstances(org.rioproject.core.ServiceElement)

update

public void update(ServiceElement[] sElements,
                   OperationalStringManager opStringMgr)
            throws RemoteException
Description copied from interface: ServiceBeanInstantiator
Invoked to update instantiated ServiceBean instances of changes in their ServiceElement objects and OperationalStringManager references. This method invocation is typically triggered when the OperationalString has been updated, or the OperationalStringManager has been changed, and provides somewhat of a batch update mechanism.

The ServiceBeanInstantiator will match the array of ServiceElement objects to instantiated service instances. For each match, the instance will have it's ServiceElement updated with the provided ServiceElement object.

ServiceElement updates can trigger changes in running services. ServiceElement attributes (and contained class attributes) which may trigger behavior changes as follows:

  1. Additions/removals or changes to declared SLA instances
  2. Additions/removals or changes to declared Association instances
  3. Additions/removals to declared parameters

Specified by:
update in interface ServiceBeanInstantiator
Parameters:
sElements - Array of ServiceElement instances to update
opStringMgr - The OperationalStringManager which is performing the update
Throws:
RemoteException - If communication errors happen
See Also:
ServiceBeanInstantiator.update(org.rioproject.core.ServiceElement[], org.rioproject.core.OperationalStringManager)

getName

public String getName()
Description copied from interface: ServiceBeanInstantiator
Get a name for the ServiceBeanInstantiator

Specified by:
getName in interface ServiceBeanInstantiator
Returns:
A human readable name for the ServiceBeanInstantiator
See Also:
ServiceBeanInstantiator.getName()

getInstantiatorUuid

public Uuid getInstantiatorUuid()
Implemented to support interface contract. The CybernodeProxy returns the result of this method without a backend invocation. For completeness this method will return the Uuid as well

Specified by:
getInstantiatorUuid in interface ServiceBeanInstantiator
Returns:
The Uuid of the ServiceBeanInstantiator
See Also:
ServiceBeanInstantiator.getInstantiatorUuid()

getInetAddress

public InetAddress getInetAddress()
Description copied from interface: ServiceBeanInstantiator
Get the IP address of the ServiceBeanInstantiator

Specified by:
getInetAddress in interface ServiceBeanInstantiator
Returns:
The InetAddress

serviceInstantiated

public void serviceInstantiated(ServiceRecord serviceRecord)
Notification that a ServiceBean has been instantiated

Specified by:
serviceInstantiated in interface ServiceBeanContainerListener
Parameters:
serviceRecord - The ServiceRecord

serviceDiscarded

public void serviceDiscarded(ServiceRecord serviceRecord)
Notification that a ServiceBean has been discarded

Specified by:
serviceDiscarded in interface ServiceBeanContainerListener
Parameters:
serviceRecord - The ServiceRecord

bootstrap

protected void bootstrap(String[] configArgs)
                  throws Exception
Throws:
Exception

getConfigComponent

public static String getConfigComponent()
Get the component name to use for accessing the services configuration properties

Returns:
The component name

setConfigComponent

protected void setConfigComponent(String comp)
Set the component name to use for accessing the services configuration properties

Parameters:
comp - The component name

createProxy

protected Object createProxy()
Override ServiceBeanAdapter createProxy to return a Cybernode Proxy

Overrides:
createProxy in class ServiceBeanAdapter
Returns:
The proxy to use

getAdmin

public Object getAdmin()
Override parent's getAdmin to return custom service admin

Specified by:
getAdmin in interface Administrable
Overrides:
getAdmin in class ServiceBeanAdapter
Returns:
A CybernodeAdminProxy instance

initialize

public void initialize(ServiceBeanContext context)
                throws Exception
Description copied from class: ServiceBeanAdapter
The initialize method is invoked to initialize the ServiceBean. This method is invoked only once. The ServiceBeanAdapter initializes required infrastructure elements in order to prepare the ServiceBean for processing.

Specified by:
initialize in interface ServiceBean
Overrides:
initialize in class ServiceBeanAdapter
Parameters:
context - The ServiceBeanContext to initialize the ServiceBean with
Throws:
Exception - If something unexpected happens
See Also:
ServiceBean.initialize(org.rioproject.core.jsb.ServiceBeanContext)

loadInitialServices

protected void loadInitialServices(Configuration config)
Load any initial services

Parameters:
config - The Jini configuration to use

isEnlisted

public boolean isEnlisted()
Get the enlisted state

Specified by:
isEnlisted in interface Cybernode
Specified by:
isEnlisted in interface CybernodeImplMBean
Returns:
True if the Cybernode can be used to instantiate dynamic application services.

setEnlisted

protected void setEnlisted(boolean value)
Set the enlisted flag

Parameters:
value - True if enlisted, false if not

getAvailabilitySchedule

protected Schedule getAvailabilitySchedule()
Get the availability schedule

Returns:
The Schedule for availability

setAvailabilitySchedule

protected void setAvailabilitySchedule(Schedule sched)
Set the availability schedule

Parameters:
sched - The Schedule for availability

getRegistrationTasks

protected TimerTask[] getRegistrationTasks()
Get all in process TimerTask instances that are specific to availability scheduling for registration to monitor instances

Returns:
Array of in process TimerTask instances. If there are no TimerTask instances return a zero-length array

addRegistrationTask

protected void addRegistrationTask(TimerTask task)
Add a TimerTask to the Collection of TimerTasks

Parameters:
task - The TimerTask

removeRegistrationTask

protected void removeRegistrationTask(TimerTask task)
Remove a TimerTask from Collection of scheduled TimerTask instances

Parameters:
task - The TimerTask to remove

doEnlist

protected void doEnlist(Schedule schedule)
Have the Cybernode add itself as a resource which can be used to instantiate dynamic application services. Once a Cybernode is enlisted, it will use the provided availability schedule to control when it registers and unregisters to discovered Provision Manager instances If the Cybernode is already enlisted, this method will have no effect

Parameters:
schedule - The Schedule to use for enlistment

getTaskTimer

protected Timer getTaskTimer()
Get the Timer created for the Cybernode

Returns:
The task Timer used to schedule tasks

getServiceInfo

protected ServiceInfo getServiceInfo()
Get the ServiceInfo for the Cybernode

Overrides:
getServiceInfo in class ServiceBeanAdapter
Returns:
The ServiceInfo

getWatchUI

protected Entry getWatchUI()
                    throws IOException
Override parents getWatchUI, using cybernode-ui.jar as the JAR containing org.rioproject.watch.AccumulatorViewer

Overrides:
getWatchUI in class ServiceBeanAdapter
Returns:
The Entry object describing the AccumulatorViewer UIDescriptor
Throws:
MalformedURLException
IOException

getServiceUIs

protected Entry[] getServiceUIs()
                         throws IOException
Get the service UIs to add

Returns:
An array of UIDescriptors used for the service-UIs for the Cybernode.
Throws:
IOException - If the UIDescriptos cannot be created

getServiceBeanContainer

protected ServiceBeanContainer getServiceBeanContainer()

instantiate

public DeployedService instantiate(ServiceProvisionEvent event)
                            throws JSBInstantiationException,
                                   UnknownEventException
Description copied from interface: ServiceBeanInstantiator
This method is invoked as a result of event registration to ProvisionManager instances. The ServiceBeanInstantiator will register for ServiceProvisionEvent notifications.

Specified by:
instantiate in interface ServiceBeanInstantiator
Parameters:
event - - The ServiceProvisionEvent
Returns:
The deployed service object
Throws:
JSBInstantiationException - if there are problems loading or instantiating the ServiceBean
UnknownEventException - if it does not recognize the Event ID
See Also:
ServiceBeanInstantiator.instantiate(org.rioproject.core.provision.ServiceProvisionEvent)

getComputeResource

public ComputeResource getComputeResource()
Get the ComputeResource associated with this Cybernode

Returns:
The ComputeResource associated with this Cybernode

getSchedule

public Schedule getSchedule()
Description copied from interface: Cybernode
Get the availability schedule for the Cybernode. The Cybernode registers and unregisters to discovered Provision Manager instances based on the declared schedule. If there is not schedule, the Cybernode is always available

Specified by:
getSchedule in interface Cybernode
Returns:
A {org.rioproject.core.Schedule} object if the Cybernode has been configured with an availability schedule, otherwise return null

enlist

public void enlist(Schedule schedule)
Description copied from interface: Cybernode
Have the Cybernode add itself as a resource which can be used to instantiate dynamic application services. Once a Cybernode is enlisted, it will use the provided availability schedule to control when it registers and unregisters to discovered Provision Manager instances If the Cybernode is already enlisted, this method will have no effect

Specified by:
enlist in interface Cybernode
Parameters:
schedule - The availability schedule for the Cybernode. The Cybernode registers and unregisters to discovered Provision Manager instances based on the declared schedule. The schedule must not be null

release

public void release(boolean terminateServices)
Description copied from interface: Cybernode
Have the Cybernode remove itself as a resource which that can be used to instantiate dynamic application services. If the Cybernode is already released, this method will have no effect

Specified by:
release in interface Cybernode
Parameters:
terminateServices - If this parameter is true, all services which are being hosted by the Cybernode will be terminated as a result of this method invocation

getServiceLimit

public Integer getServiceLimit()
Description copied from interface: CybernodeImplMBean
Get the upper limit of services that this Cybernode can instantiate

Specified by:
getServiceLimit in interface CybernodeImplMBean
Returns:
The upper limit of services

setServiceLimit

public void setServiceLimit(Integer limit)
Description copied from interface: CybernodeImplMBean
Set the upper limit of services that this Cybernode can instantiate

Specified by:
setServiceLimit in interface CybernodeImplMBean
Parameters:
limit - The upper limit of services

getServiceCount

public Integer getServiceCount()
Description copied from interface: CybernodeImplMBean
Get the number of services that this Cybernode has instantiated

Specified by:
getServiceCount in interface CybernodeImplMBean
Returns:
The number of services the Cybernode has instantiated

getPersistentProvisioning

public boolean getPersistentProvisioning()
Description copied from interface: CybernodeImplMBean
Get whether the Cybernode supports persistent provisioning of qualitative capabilities

Specified by:
getPersistentProvisioning in interface CybernodeImplMBean
Returns:
True if the Cybernode supports persistent provisioning of qualitative capabilities otherwise return false

setPersistentProvisioning

public void setPersistentProvisioning(boolean provisionEnabled)
                               throws IOException
Description copied from interface: CybernodeImplMBean
Set whether the Cybernode supports persistent provisioning of qualitative capabilities

Specified by:
setPersistentProvisioning in interface CybernodeImplMBean
Parameters:
provisionEnabled - If the Cybernode supports persistent provisioning of qualitative capabilities
Throws:
IOException

getUtilization

public double getUtilization()
Description copied from interface: CybernodeImplMBean
Get the resource's utilization. This method returns the aggregate of all measured system utilization values

Specified by:
getUtilization in interface CybernodeImplMBean
Returns:
The aggregate utilization as a relative value

Copyright © Rio Project.

Copyright © 2006-2011 Rio Project. All Rights Reserved.