Rio Project 4.2 API Documentation



org.rioproject.monitor
Class ProvisionMonitorImpl

java.lang.Object
  extended by org.rioproject.resources.servicecore.ServiceProvider
      extended by org.rioproject.jsb.ServiceBeanAdapter
          extended by org.rioproject.monitor.ProvisionMonitorImpl
All Implemented Interfaces:
ServiceProxyAccessor, Remote, MBeanRegistration, NotificationBroadcaster, NotificationEmitter, Administrable, ProxyAccessor, ServerProxyTrust, ServiceBean, ProvisionManager, EventProducer, MonitorableService, ServiceBeanAdapterMBean, ProvisionMonitor, ProvisionMonitorImplMBean, Service, Watchable

public class ProvisionMonitorImpl
extends ServiceBeanAdapter
implements ProvisionMonitor, ProvisionMonitorImplMBean, ServerProxyTrust

The ProvisionMonitor service provides the capability to deploy and monitor OperationalStrings.

Author:
Dennis Reedy

Nested Class Summary
 class ProvisionMonitorImpl.DeployMonitor
          Use DeployHandlers to provide hot deployment capability
 class ProvisionMonitorImpl.OpStringManager
          The OpStringManager provides the management for an OperationalString that has been deployed to the ProvisionMonitor
 
Nested classes/interfaces inherited from class org.rioproject.jsb.ServiceBeanAdapter
ServiceBeanAdapter.SnapshotThread
 
Nested classes/interfaces inherited from interface org.rioproject.monitor.ProvisionMonitor
ProvisionMonitor.PeerInfo
 
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
ProvisionMonitorImpl()
          Create a ProvisionMonitor
ProvisionMonitorImpl(ActivationID activationID, MarshalledObject data)
          Create a ProvisionMonitor using RMI Activation
ProvisionMonitorImpl(String[] configArgs, LifeCycle lifeCycle)
          Create a ProvisionMonitor launched from the ServiceStarter framework
 
Method Summary
 ProvisionMonitorImpl.OpStringManager addOperationalString(OperationalString opString, Map<String,Throwable> map, ProvisionMonitorImpl.OpStringManager parent, DeployAdmin dAdmin, ServiceProvisionListener listener)
          Add an OpStringManager to this ProvisionMonitor.
 boolean assignBackupFor(ProvisionMonitor primary)
          Assign the ProvisionMonitor as a backup for another ProvisionMonitor
protected  void bootstrap(String[] configArgs)
          Get the ServiceBeanContext and bootstrap the ProvisionMonitor
protected  Object createProxy()
          Override ServiceBeanAdapter createProxy to return a ProvisionMonitor Proxy
 Map<String,Throwable> deploy(OperationalString opString, ServiceProvisionListener listener)
           
 Map deploy(String opStringLocation)
          Deploy an OperationalString URL to the ProvisionMonitor.
 Map<String,Throwable> deploy(String opStringLocation, ServiceProvisionListener listener)
           
 Map<String,Throwable> deploy(URL opStringUrl, ServiceProvisionListener listener)
           
 void destroy()
          Override destroy to ensure that all OpStringManagers are shutdown as well
 Object getAdmin()
          Override parent's getAdmin to return custom service admin
 ProvisionMonitor.PeerInfo[] getBackupInfo()
           
 TabularData getDeployments()
          Get the current deployments for the ProvisionMonitor
protected  ProvisionMonitor getEventProxy()
          Get the ProvisionMonitor event proxy source
 OperationalStringManager getOperationalStringManager(String name)
           
 OperationalStringManager[] getOperationalStringManagers()
           
protected  OperationalString[] getOperationalStrings()
          Get all OperationalString objects from the Collection of OpStringManagers
protected  OpStringLoader getOpStringLoader()
          Get the OpStringloader, the utility to load OperationalStrings
protected  ProvisionMonitorImpl.OpStringManager getOpStringManager(String name)
          Get the OpStringManager for an OperationalString
 ProvisionMonitor.PeerInfo getPeerInfo()
          Get the PeerInfo object for the ProvisionMonitor
protected  DeployAdmin getPrimaryManager(String opStringName)
          Get the primary OperationalStringManager for the opstring
 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
 ServiceBeanInstantiator[] getServiceBeanInstantiators()
          Get all registered ServiceBeanInstantiator instances.
protected  ServiceInfo getServiceInfo()
           
 boolean hasDeployed(String opStringName)
           
 void initialize(ServiceBeanContext context)
          Override parent initialize() method to provide specific initialization for the ProvisionMonitor
 boolean opStringExists(String opStringName)
          Determine if the OperationalString with the provided name is deployed
protected  void processEvent(ProvisionMonitorEvent event)
          Helper method to obtain a PoolableThread and create a ProvisionMonitorTask to send a ProvisionMonitorEvent
 EventRegistration register(ServiceBeanInstantiator instantiator, MarshalledObject handback, ResourceCapability resourceCapability, List<DeployedService> deployedServices, int serviceLimit, long duration)
          Register for notifications of ServiceProvisionEvent objects.
 boolean removeBackupFor(ProvisionMonitor primary)
          Remove the ProvisionMonitor as a backup for another ProvisionMonitor
protected  void stateChanged(ProvisionMonitorImpl.OpStringManager opMgr, boolean remove)
          Notification of an OperationalString state change.
 boolean undeploy(String opStringName)
          Undeploy and Remove an OperationalString deployed by the ProvisionMonitor.
 boolean undeploy(String name, boolean terminate)
           
 void update(ProvisionMonitor.PeerInfo peerInfo)
          Notification from ProvisionMonitor peers updates to the PeerInfo object.
 void update(ServiceBeanInstantiator instantiator, ResourceCapability resourceCapability, List<DeployedService> deployedServices, int serviceLimit)
          Provides a feedback mechanism for a ServiceBeanInstantiator to update it's operational capabilities as described by the ResourceCapability object, and any changes in the maximum number of services the ServiceBeanInstantiator will accept for service provisioning The ServiceBeanInstantiator must have an active Lease with the ProvisionManager for this method to be successful
 
Methods inherited from class org.rioproject.jsb.ServiceBeanAdapter
addAttribute, addAttributes, addNotificationListener, advertise, cleanJMX, createObjectName, destroy, destroyWatches, exportDo, getAdminExporter, getAssociationManagement, getComputeResourceObserver, getDiscoveryManager, getExportedProxy, getExporter, getJoinManager, getLookupGroups, getNotificationBroadcasterSupport, getNotificationInfo, getProxy, getServiceBeanContext, getServiceBeanInstantiatorUuid, getServiceProxy, getSLAEventHandler, getStarted, getStartTime, getUuid, getWatchUI, 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, destroy, getLookupGroups, getStarted, setLookupGroups, unadvertise
 

Constructor Detail

ProvisionMonitorImpl

public ProvisionMonitorImpl()
                     throws Exception
Create a ProvisionMonitor

Throws:
Exception - If the ProvisionMonitorImpl cannot be created

ProvisionMonitorImpl

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

Parameters:
configArgs - Configuration arguments
lifeCycle - Service lifecycle manager
Throws:
Exception - If the ProvisionMonitorImpl cannot be created

ProvisionMonitorImpl

public ProvisionMonitorImpl(ActivationID activationID,
                            MarshalledObject data)
                     throws Exception
Create a ProvisionMonitor using RMI Activation

Parameters:
activationID - The ActivationID
data - Serialized data for initialization
Throws:
Exception - If the ProvisionMonitorImpl cannot be created
Method Detail

bootstrap

protected void bootstrap(String[] configArgs)
                  throws Exception
Get the ServiceBeanContext and bootstrap the ProvisionMonitor

Parameters:
configArgs - configuration arguments
Throws:
Exception - If bootstrapping fails

destroy

public void destroy()
Override destroy to ensure that all OpStringManagers are shutdown as well

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

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 ProvisionMonitorAdminProxy instance

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

createProxy

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

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

getServiceInfo

protected ServiceInfo getServiceInfo()
Overrides:
getServiceInfo in class ServiceBeanAdapter

getOperationalStringManagers

public OperationalStringManager[] getOperationalStringManagers()

getOperationalStringManager

public OperationalStringManager getOperationalStringManager(String name)
                                                     throws OperationalStringException
Throws:
OperationalStringException

deploy

public Map deploy(String opStringLocation)
           throws MalformedURLException
Description copied from interface: ProvisionMonitorImplMBean
Deploy an OperationalString URL to the ProvisionMonitor. The ProvisionMonitor will attempt to load the argument first from the local file system as a File object, if the File object exists, it will be used, otherwise the argument will be used to create a URL object. If the OperationalString includes nested OperationalStrings, the nested OperationalStrings will be deployed as well. If nested OperationalString items are already deployed, they will not be re-deployed. If the OperationalString specified by the input URL has already been deployed, or is scheduled for deployment, then no part of that OperationalString (or nested OperationalString instances) will be deployed

Specified by:
deploy in interface ProvisionMonitorImplMBean
Parameters:
opStringLocation - The parameter indicating the location of the OperationalString to deploy, may also be an artifact {groupId:artifactId:version}
Returns:
If there are errors loading part of the OperationalString the Map will be returned with name value pairs associating the service and corresponding exceptions
Throws:
MalformedURLException - if the opStringUrl cannot be used to create a java.net.URL

deploy

public Map<String,Throwable> deploy(String opStringLocation,
                                    ServiceProvisionListener listener)
                             throws OperationalStringException
Throws:
OperationalStringException

deploy

public Map<String,Throwable> deploy(URL opStringUrl,
                                    ServiceProvisionListener listener)
                             throws OperationalStringException
Throws:
OperationalStringException

deploy

public Map<String,Throwable> deploy(OperationalString opString,
                                    ServiceProvisionListener listener)
                             throws OperationalStringException
Throws:
OperationalStringException

undeploy

public boolean undeploy(String opStringName)
Description copied from interface: ProvisionMonitorImplMBean
Undeploy and Remove an OperationalString deployed by the ProvisionMonitor. The ProvisionMonitor will search for the OperationalString by it's name and if found, remove the OperationalString and any nested OperationalStrings that are included by the OperatinalString. As a result of undeploying the OperationalString(s), all services that have a provision type of ServiceProvisionManagement.DYNAMIC or ServiceProvisionManagement.FIXED will be terminated. If any DeploymentRequest or RedeploymenRequests are pending for the OperationalString(s) being undeployed, these requests will be cancelled

Specified by:
undeploy in interface ProvisionMonitorImplMBean
Parameters:
opStringName - The name of the OperationalString to remove
Returns:
Returns true if the OperationalString has been undeployed

undeploy

public boolean undeploy(String name,
                        boolean terminate)
                 throws OperationalStringException
Throws:
OperationalStringException

hasDeployed

public boolean hasDeployed(String opStringName)

getDeployments

public TabularData getDeployments()
Description copied from interface: ProvisionMonitorImplMBean
Get the current deployments for the ProvisionMonitor

Specified by:
getDeployments in interface ProvisionMonitorImplMBean
Returns:
The current deployments in a tabular form, containing the deployment name, the role of the Provisioner, and the time deployed

getBackupInfo

public ProvisionMonitor.PeerInfo[] getBackupInfo()

getPeerInfo

public ProvisionMonitor.PeerInfo getPeerInfo()
                                      throws RemoteException
Description copied from interface: ProvisionMonitor
Get the PeerInfo object for the ProvisionMonitor

Specified by:
getPeerInfo in interface ProvisionMonitor
Returns:
The PeerInfo object for the ProvisionMonitor
Throws:
RemoteException - if communication errors occur

assignBackupFor

public boolean assignBackupFor(ProvisionMonitor primary)
                        throws RemoteException
Description copied from interface: ProvisionMonitor
Assign the ProvisionMonitor as a backup for another ProvisionMonitor

Specified by:
assignBackupFor in interface ProvisionMonitor
Parameters:
primary - The ProvisionMonitor that will be backed up. If this ProvisionMonitor is removed from the network, then all OperationalString instances the removed ProvisionManager was managing will be managed by this ProvisionMonitor
Returns:
Return true if the ProvisionMonitor accepts the backup role, false if it refuses.
Throws:
RemoteException - if communication errors occur

removeBackupFor

public boolean removeBackupFor(ProvisionMonitor primary)
                        throws RemoteException
Description copied from interface: ProvisionMonitor
Remove the ProvisionMonitor as a backup for another ProvisionMonitor

Specified by:
removeBackupFor in interface ProvisionMonitor
Parameters:
primary - The primary ProvisionMonitor that no longer requires the support of this ProvisionManager
Returns:
Return true if the ProvisionMonitor has removed itself as a backup
Throws:
RemoteException - if communication errors occur

update

public void update(ProvisionMonitor.PeerInfo peerInfo)
            throws RemoteException
Description copied from interface: ProvisionMonitor
Notification from ProvisionMonitor peers updates to the PeerInfo object. This notification is sent as ProvisionMonitor instances are selected by other ProvisionMonitor instances for backup duty.

Specified by:
update in interface ProvisionMonitor
Parameters:
peerInfo - The PeerInfo object
Throws:
RemoteException - if communication errors occur

register

public EventRegistration register(ServiceBeanInstantiator instantiator,
                                  MarshalledObject handback,
                                  ResourceCapability resourceCapability,
                                  List<DeployedService> deployedServices,
                                  int serviceLimit,
                                  long duration)
                           throws LeaseDeniedException,
                                  RemoteException
Description copied from interface: ProvisionManager
Register for notifications of ServiceProvisionEvent objects. The returned EventRegistration is leased; the lease must be managed by the caller. The event ID in the returned EventRegistration corresponds to the event ID of the ServiceProvisionEvent.

While the EventRegistration is valid, ServiceProvisionEvent notifications are sent to the specified ServiceBeanInstantiator whenever the ProvisionManager determines that a ServiceBeanInstantiator meets requirements specified by the ServiceBean.

Specified by:
register in interface ProvisionManager
Parameters:
instantiator - The ServiceBeanInstantiator
handback - The handback Object to include with event notification
resourceCapability - The capabilities of the compute resource
deployedServices - An immutable List of DeployedService objects documenting existing deployed (and active) services. If there are no active services, an empty List must be provided.
serviceLimit - The maximum amount of services the compute resources will accept for provisioning
duration - The requested lease duration
Returns:
An EventRegistration
Throws:
LeaseDeniedException - If the Lease to the ProvisionManager is denied
RemoteException - If communication errors happen

update

public void update(ServiceBeanInstantiator instantiator,
                   ResourceCapability resourceCapability,
                   List<DeployedService> deployedServices,
                   int serviceLimit)
            throws UnknownLeaseException,
                   RemoteException
Description copied from interface: ProvisionManager
Provides a feedback mechanism for a ServiceBeanInstantiator to update it's operational capabilities as described by the ResourceCapability object, and any changes in the maximum number of services the ServiceBeanInstantiator will accept for service provisioning

The ServiceBeanInstantiator must have an active Lease with the ProvisionManager for this method to be successful

Specified by:
update in interface ProvisionManager
Parameters:
instantiator - The Listener to send events to
resourceCapability - The capabilities of the compute resource
deployedServices - An immutable List of DeployedService objects documenting existing deployed (and active) services. If there are no active services, an empty List must be provided.
serviceLimit - The maximum amount of services the compute resources will accept for provisioning
Throws:
UnknownLeaseException - If the Lease to the ProvisionManager is unknown
RemoteException - If communication errors happen

getServiceBeanInstantiators

public ServiceBeanInstantiator[] getServiceBeanInstantiators()
Description copied from interface: ProvisionManager
Get all registered ServiceBeanInstantiator instances.

Specified by:
getServiceBeanInstantiators in interface ProvisionManager
Returns:
An array of registered ServiceBeanInstantiator instances. If there are no registered ServiceBeanInstantiators, return a zero-length array. A new array is allocated each time

addOperationalString

public ProvisionMonitorImpl.OpStringManager addOperationalString(OperationalString opString,
                                                                 Map<String,Throwable> map,
                                                                 ProvisionMonitorImpl.OpStringManager parent,
                                                                 DeployAdmin dAdmin,
                                                                 ServiceProvisionListener listener)
                                                          throws Exception
Add an OpStringManager to this ProvisionMonitor.

Parameters:
opString - The OperationalString to add
map - A Map to store any exceptions produced while loading the opString
parent - The parent of the opString. The addOperationalString method recursively processes OperationalString instances and uses this parameter to indicate a nested OperationalString
dAdmin - The managing DeployAdmin, if the OperationalString is being added in an inactive mode, as a backup. If this value is null, this ProvisionMonitor is set to be active
listener - A ServiceProvisionListener that will be set to the OperationalStringManager for notification of services as they are deployed initially.
Returns:
An OpStringManager
Throws:
Exception - if an OpStringManger cannot be created

opStringExists

public boolean opStringExists(String opStringName)
Determine if the OperationalString with the provided name is deployed

Parameters:
opStringName - The name of the OperationalString
Returns:
true if the OperationalString with the provided name is loaded

getEventProxy

protected ProvisionMonitor getEventProxy()
Get the ProvisionMonitor event proxy source

Returns:
The ProvisionMonitor event proxy source

getPrimaryManager

protected DeployAdmin getPrimaryManager(String opStringName)
Get the primary OperationalStringManager for the opstring

Parameters:
opStringName - The opstring name
Returns:
The primary OperationalStringManager for the opsting, or null if not found

getOpStringManager

protected ProvisionMonitorImpl.OpStringManager getOpStringManager(String name)
Get the OpStringManager for an OperationalString

Parameters:
name - The name of an OperationalString
Returns:
The corresponding OpStringManager, or null if not found

getOperationalStrings

protected OperationalString[] getOperationalStrings()
Get all OperationalString objects from the Collection of OpStringManagers

Returns:
Array of OperationalString objects

initialize

public void initialize(ServiceBeanContext context)
                throws Exception
Override parent initialize() method to provide specific initialization for the ProvisionMonitor

Specified by:
initialize in interface ServiceBean
Overrides:
initialize in class ServiceBeanAdapter
Parameters:
context - The ServiceBeanContext
Throws:
Exception - If something unexpected happens

getOpStringLoader

protected OpStringLoader getOpStringLoader()
                                    throws Exception
Get the OpStringloader, the utility to load OperationalStrings

Returns:
The OpStringLoader
Throws:
Exception - if the OpStringLoader cannot be created

stateChanged

protected void stateChanged(ProvisionMonitorImpl.OpStringManager opMgr,
                            boolean remove)
Notification of an OperationalString state change. This method is invoked whenever an OperationalString has been added or removed, and whenever elements of an OperationalString have been modified, added or removed.

Parameters:
opMgr - The OpStringManager that has changed
remove - Whether or not the OpStringManager has been removed

processEvent

protected void processEvent(ProvisionMonitorEvent event)
Helper method to obtain a PoolableThread and create a ProvisionMonitorTask to send a ProvisionMonitorEvent

Parameters:
event - The ProvisionMonitorEvent to send

Copyright © Rio Project.

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