Rio Project 4.2 API Documentation



org.rioproject.monitor
Class ProvisionMonitorImpl.OpStringManager

java.lang.Object
  extended by org.rioproject.monitor.ProvisionMonitorImpl.OpStringManager
All Implemented Interfaces:
Remote, ServerProxyTrust, OperationalStringManager
Enclosing class:
ProvisionMonitorImpl

public class ProvisionMonitorImpl.OpStringManager
extends Object
implements OperationalStringManager, ServerProxyTrust

The OpStringManager provides the management for an OperationalString that has been deployed to the ProvisionMonitor


Constructor Summary
ProvisionMonitorImpl.OpStringManager(OperationalString opString, ProvisionMonitorImpl.OpStringManager parent, boolean mode, Configuration config)
          Create an OpStringManager, making it available to receive incoming calls supporting the OperationalStringManager interface
 
Method Summary
 void addServiceElement(ServiceElement sElem)
          This method will add a ServiceElement to an OperationalString.
 void addServiceElement(ServiceElement sElem, ServiceProvisionListener listener)
          This method will add a ServiceElement to an OperationalString.
 void decrement(ServiceBeanInstance instance, boolean recommended, boolean destroy)
          Decrement (decrease the number of) and remove a specific ServiceBean instance from the OperationalString.
 Date[] getDeploymentDates()
          Get the deployment Date history
 DeploymentMap getDeploymentMap()
          Get the DeploymentMap for services in this OperationalString
 OperationalString getOperationalString()
          Get the OperationalString the OperationalStringManager is managing
 int getPendingCount(ServiceElement sElem)
          Get the number of pending service provision requests.
 TrustVerifier getProxyVerifier()
          Returns a TrustVerifier which can be used to verify that a given proxy to this policy handler can be trusted
 ServiceBeanInstance[] getServiceBeanInstances(ServiceElement sElem)
          Get the ServiceBeanInstance objects for a ServiceElement
 ServiceElement getServiceElement(Object proxy)
          This method returns the ServiceElement object for a requested service based on a service's proxy
 ServiceElement getServiceElement(String[] interfaces, String name)
          This method returns the ServiceElement object for a requested service based on the array of interface (or proxy) classes the service implements as an array of String objects and an optional service name.
 ServiceStatement[] getServiceStatements()
          Get the ServiceStatements for all ServiceElements in the OperationalString
 void increment(ServiceElement sElem, boolean permanent, ServiceProvisionListener listener)
          Increment (increase) the number of instances by one.
 boolean isManaging()
          Whether the OperationalStringManager is the active managing OperationalStringManager for the OperationalString.
 void redeploy(ServiceElement sElem, ServiceBeanInstance instance, boolean clean, boolean sticky, long delay, ServiceProvisionListener listener)
          Redeploy an OperationalString, ServiceElement or ServiceBeanInstance.
 void redeploy(ServiceElement sElem, ServiceBeanInstance instance, boolean clean, long delay, ServiceProvisionListener listener)
          Redeploy an OperationalString, ServiceElement or ServiceBeanInstance.
 void relocate(ServiceBeanInstance instance, ServiceProvisionListener listener, Uuid uuid)
          Relocate (move) a ServiceBean instance to another ServiceBeanInstantiator.
 void removeServiceElement(ServiceElement sElem, boolean destroy)
          This method will remove a ServiceElement from an OperationalString and optionally terminate all service instances that have been provisioned from the ServiceElement description
 void setManaging(boolean newActive)
          Set the OperationalStringManager managing status based on the active parameter
 int trim(ServiceElement sElem, int trimUp)
          Trim (remove) service provision requests which are pending allocation.
 Map<String,Throwable> update(OperationalString newOpString)
          Update the OperationalString that the OperationalStringManager is managing.
 void update(ServiceBeanInstance instance)
          Update a ServiceBeanInstance
 void update(ServiceElement sElem)
          This method will modify the ServiceElement attributes of a ServiceElement in the OperationalStringManager.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ProvisionMonitorImpl.OpStringManager

public ProvisionMonitorImpl.OpStringManager(OperationalString opString,
                                            ProvisionMonitorImpl.OpStringManager parent,
                                            boolean mode,
                                            Configuration config)
                                     throws RemoteException
Create an OpStringManager, making it available to receive incoming calls supporting the OperationalStringManager interface

Parameters:
opString - The OperationalString to manage
parent - The OpStringManager parent. May be null
mode - Whether the OperationalStringManager is the active manager
config - Configuration object
Throws:
RemoteException - if the OpStringManager cannot export itself
Method Detail

setManaging

public void setManaging(boolean newActive)
Description copied from interface: OperationalStringManager
Set the OperationalStringManager managing status based on the active parameter

Specified by:
setManaging in interface OperationalStringManager
Parameters:
newActive - If true, the OperationalStringManager is the active managing OperationalStringManager for the OperationalString. The managing OperationalStringManager will actively respond to scenarios where service's contained within this OperationalString need to be allocated, updated, relocated, removed or added. If the OperationalStringManager is not the managing OperationalStringManager, it will observe and record OperationalString transitions but not act on them.
See Also:
OperationalStringManager.setManaging(boolean)

isManaging

public boolean isManaging()
Description copied from interface: OperationalStringManager
Whether the OperationalStringManager is the active managing OperationalStringManager for the OperationalString. The managing OperationalStringManager will actively respond to scenarios where service's contained within this OperationalString need to be allocated, updated, relocated, removed or added. If the OperationalStringManager is not the managing OperationalStringManager, it will observe and record OperationalString transitions but not act on them.

Specified by:
isManaging in interface OperationalStringManager
Returns:
True if managing, false otherwise
See Also:
OperationalStringManager.isManaging()

getDeploymentDates

public Date[] getDeploymentDates()
Description copied from interface: OperationalStringManager
Get the deployment Date history

Specified by:
getDeploymentDates in interface OperationalStringManager
Returns:
An array of Date objects documenting the date & time the OperationalString has been deployed. If has never been deployed (has been scheduled) then a zero-length array will be returned.
See Also:
OperationalStringManager.getDeploymentDates()

update

public Map<String,Throwable> update(OperationalString newOpString)
                             throws OperationalStringException,
                                    RemoteException
Description copied from interface: OperationalStringManager
Update the OperationalString that the OperationalStringManager is managing. This involves updating ServiceElement instances, which may include the additon and or removal of ServiceElements in the OperationalString If the input OperationalString includes nested OperationalStrings, and the nested OperationalString is not deployed, the nested OperationalString will be deployed If the nested OperationalString has been deployed and is referenced by only the OperationalString being updated, the nested OperationalString will be updated as well

Specified by:
update in interface OperationalStringManager
Parameters:
newOpString - The OperationalString to update
Returns:
If there are errors updating the OperationalString a Map will be returned with name value pairs associating the service and corresponding exception attempting to update the OperationalString
Throws:
OperationalStringException - If there are problems updating the the OperationalString
RemoteException - If communication errors happen
See Also:
OperationalStringManager.update(org.rioproject.core.OperationalString)

addServiceElement

public void addServiceElement(ServiceElement sElem)
                       throws OperationalStringException
Description copied from interface: OperationalStringManager
This method will add a ServiceElement to an OperationalString. Based on the attributes of the ServiceElement, ServiceBean instances will be provisioned to available compute resources based on the capability of the compute resource to meet the operational criteria criteria of the ServiceElement

Specified by:
addServiceElement in interface OperationalStringManager
Parameters:
sElem - The ServiceElement to add
Throws:
OperationalStringException - If the service described by the ServiceElement already exists, or there are problems adding the ServiceElement

addServiceElement

public void addServiceElement(ServiceElement sElem,
                              ServiceProvisionListener listener)
                       throws OperationalStringException
Description copied from interface: OperationalStringManager
This method will add a ServiceElement to an OperationalString. Based on the attributes of the ServiceElement, ServiceBean instances will be provisioned to available compute resources based on the capability of the compute resource to meet the operational criteria criteria of the ServiceElement

Specified by:
addServiceElement in interface OperationalStringManager
Parameters:
sElem - The ServiceElement to add
listener - If not null, the ServiceProvisionListener will be notified on the result of the attempt to instantiate each service instance.
Throws:
OperationalStringException - If the service described by the ServiceElement already exists, or there are problems adding the ServiceElement

removeServiceElement

public void removeServiceElement(ServiceElement sElem,
                                 boolean destroy)
                          throws OperationalStringException
Description copied from interface: OperationalStringManager
This method will remove a ServiceElement from an OperationalString and optionally terminate all service instances that have been provisioned from the ServiceElement description

Specified by:
removeServiceElement in interface OperationalStringManager
Parameters:
sElem - The ServiceElement to remove
destroy - If true, destroy all services upon removal, otherwise just remove
Throws:
OperationalStringException - If the ServiceElement is null or not being managed by the OperationalStringManager

update

public void update(ServiceElement sElem)
            throws OperationalStringException
Description copied from interface: OperationalStringManager
This method will modify the ServiceElement attributes of a ServiceElement in the OperationalStringManager. The OperationalStringManager will locate deployed ServiceElement instances, and apply the attributes to those running instances. If the ServiceElement is not found it will be added and deployed.

Specified by:
update in interface OperationalStringManager
Parameters:
sElem - The ServiceElement to update
Throws:
OperationalStringException - If there are problems updating the ServiceElement

relocate

public void relocate(ServiceBeanInstance instance,
                     ServiceProvisionListener listener,
                     Uuid uuid)
              throws OperationalStringException,
                     RemoteException
Description copied from interface: OperationalStringManager
Relocate (move) a ServiceBean instance to another ServiceBeanInstantiator. If the relocating request cannot be carried out, the request will not be submitted for future processing.

Specified by:
relocate in interface OperationalStringManager
Parameters:
instance - The ServiceBeanInstance to relocate
listener - If not null, the ServiceProvisionListener will be notified on the result of the attempt to relocate the service instance.
uuid - The Uuid of the ServiceBeanInstantiator (Cybernode) to relocate to. If this parameter is null, the OperationalStringManager will determine a suitable compute resource
Throws:
OperationalStringException - If the ServiceElement is not being managed by the OperationalStringManager, or the service requesting relocation is not a ServiceElement.ProvisionType.DYNAMIC service
RemoteException - If communication errors occur

update

public void update(ServiceBeanInstance instance)
            throws OperationalStringException
Description copied from interface: OperationalStringManager
Update a ServiceBeanInstance

Specified by:
update in interface OperationalStringManager
Parameters:
instance - The ServiceBeanInstance to update. The configuration and properties of the instance are updated, ensuring if the instance is (re-)allocated or relocated, the settings are applied to the new i nstance.
Throws:
OperationalStringException - If the ServiceElement is not being managed by the OperationalStringManager

increment

public void increment(ServiceElement sElem,
                      boolean permanent,
                      ServiceProvisionListener listener)
               throws OperationalStringException,
                      RemoteException
Description copied from interface: OperationalStringManager
Increment (increase) the number of instances by one. This will cause the provisioning of a ServiceBean to an available compute resource which meets the operational criteria specified by the ServiceElement. If the increment request cannot be accomplished (no available compute resources that meet operational requirements of the service), and the ServiceProvisionListener parameter is not null, the ServiceProvisionListener will be notified of the result. Additionally if the increment request cannot be carried out, the request will be submitted for future processing

Specified by:
increment in interface OperationalStringManager
Parameters:
sElem - The ServiceElement instance to increment. This parameter is used to match a ServiceElement being managed by the OperationalStringManager
permanent - If the increment request should be considered permanent. If set to false, the number of service instances may vary over time
listener - If not null, the ServiceProvisionListener will be notified on the result of the attempt to increment the amount of service instances.
Throws:
OperationalStringException - If the ServiceElement is not being managed by the OperationalStringManager (or the OperationalStringManager is not the managing OperationalStringManager for the OperationalString)
RemoteException - If communication errors occur

getPendingCount

public int getPendingCount(ServiceElement sElem)
Description copied from interface: OperationalStringManager
Get the number of pending service provision requests. This method will only take action if the ServiceElement provision type is ServiceElement.ProvisionType.DYNAMIC. Any other provisiontype will be ignored

Specified by:
getPendingCount in interface OperationalStringManager
Parameters:
sElem - The ServiceElement instance to query. This parameter is used to match a ServiceElement being managed by the OperationalStringManager
Returns:
The number of pending requests. If the ServiceElement provision type is not ServiceElement.ProvisionType.DYNAMIC OperationalStringManager is not the managing OperationalStringManager, -1 will be returned

trim

public int trim(ServiceElement sElem,
                int trimUp)
         throws OperationalStringException
Description copied from interface: OperationalStringManager
Trim (remove) service provision requests which are pending allocation. This method will only take action if the ServiceElement provision type is ServiceElement.ProvisionType.DYNAMIC. Any other provision type will be ignored

Specified by:
trim in interface OperationalStringManager
Parameters:
sElem - The ServiceElement instance to trim. This parameter is used to match a ServiceElement being managed by the OperationalStringManager
trimUp - The number of pending requests to trim. The number of pending requests to trim will be determined as follows :
  • If the trimUp value is -1, then trim the all pending requests
  • If the trimUp value is not -1, the number of pending requests to trim will be calaculated as follows:
    Math.min((planned-actual), trimUp)
    Where planned is the property obtained from the managed ServiceElement, actual is the number of active (deployed) services, and trimUp is the input value.
Returns:
The number of pending requests that were trimmed. The value will be the new managed ServiceElement planned property. If the ServiceElement provision type is not ServiceElement.ProvisionType.DYNAMIC, -1 will be returned
Throws:
OperationalStringException - If the ServiceElement is not being managed by the OperationalStringManager

decrement

public void decrement(ServiceBeanInstance instance,
                      boolean recommended,
                      boolean destroy)
               throws OperationalStringException
Description copied from interface: OperationalStringManager
Decrement (decrease the number of) and remove a specific ServiceBean instance from the OperationalString.

Specified by:
decrement in interface OperationalStringManager
Parameters:
instance - The ServiceBeanInstance
recommended - The mandate parameter is processed as follows:
    If set to true, and the number of running services is equal to the number of services to maintain, the number of services to maintain will be decremented by 1.
  • If set to false, and the number of service instances running is greater then the number of services to maintain, the number of services to maintain will be decremented by 1.
  • If set to false, and the number of running service is equal to the number of services to maintain, the decrement will not be allowed.
destroy - If true, destroy the ServiceBean upon decrementing, otherwise just remove the service instance from being a managed service.
Throws:
OperationalStringException - If the ServiceElement is not being managed by the OperationalStringManager

getOperationalString

public OperationalString getOperationalString()
Description copied from interface: OperationalStringManager
Get the OperationalString the OperationalStringManager is managing

Specified by:
getOperationalString in interface OperationalStringManager
Returns:
The OperationalString

getServiceElement

public ServiceElement getServiceElement(Object proxy)
Description copied from interface: OperationalStringManager
This method returns the ServiceElement object for a requested service based on a service's proxy

Specified by:
getServiceElement in interface OperationalStringManager
Parameters:
proxy - The proxy for the Service
Returns:
The ServiceElement for the query. If there is no matching ServiceElement, a null is returned

getServiceBeanInstances

public ServiceBeanInstance[] getServiceBeanInstances(ServiceElement sElem)
                                              throws OperationalStringException
Description copied from interface: OperationalStringManager
Get the ServiceBeanInstance objects for a ServiceElement

Specified by:
getServiceBeanInstances in interface OperationalStringManager
Parameters:
sElem - The ServiceElement
Returns:
An array of ServiceBeanInstance objects found for the ServiceElement. If there are no ServiceBeanInstances, a zero-length array is returned. A new array is allocated each time.
Throws:
OperationalStringException - If the ServiceElement is unknown to the OperationalStringManager

getServiceElement

public ServiceElement getServiceElement(String[] interfaces,
                                        String name)
Description copied from interface: OperationalStringManager
This method returns the ServiceElement object for a requested service based on the array of interface (or proxy) classes the service implements as an array of String objects and an optional service name. The OperationalStringManager will locate the ServiceElement by matching the interface (or proxy) names provided and the name (if not null) of the supplied OperationalString.

Specified by:
getServiceElement in interface OperationalStringManager
Parameters:
interfaces - Array of interface (or proxy) classes the service implements as an array of String objects
name - The name of the Service
Returns:
The ServiceElement for the query. If there is no matching ServiceElement, a null is returned

redeploy

public void redeploy(ServiceElement sElem,
                     ServiceBeanInstance instance,
                     boolean clean,
                     long delay,
                     ServiceProvisionListener listener)
              throws OperationalStringException
Description copied from interface: OperationalStringManager
Redeploy an OperationalString, ServiceElement or ServiceBeanInstance. This method will terminate then reallocate services based on the following criteria:

Specified by:
redeploy in interface OperationalStringManager
Parameters:
sElem - If not null, the ServiceElement to redeploy
instance - If not null, and the sElem param is not null, the ServiceBeanInstance to redeploy
clean - If set to true, the service will be allocated using the ServiceElement configuration, not the ServiceBeanInstance configuration
delay - The amount of time (in milliseconds) to wait until the redeployment is performed. A value > 0 will result in scheduling the redeployment
listener - If not null, the ServiceProvisionListener will be notified as each service is redeployed
Throws:
OperationalStringException - If there are errors redeploying
See Also:
OperationalStringManager.redeploy(org.rioproject.core.ServiceElement, org.rioproject.core.ServiceBeanInstance, boolean, long, org.rioproject.core.ServiceProvisionListener)

redeploy

public void redeploy(ServiceElement sElem,
                     ServiceBeanInstance instance,
                     boolean clean,
                     boolean sticky,
                     long delay,
                     ServiceProvisionListener listener)
              throws OperationalStringException
Description copied from interface: OperationalStringManager
Redeploy an OperationalString, ServiceElement or ServiceBeanInstance. This method will terminate then reallocate services based on the following criteria:

Specified by:
redeploy in interface OperationalStringManager
Parameters:
sElem - If not null, the ServiceElement to redeploy
instance - If not null, and the sElem param is not null, the ServiceBeanInstance to redeploy
clean - If set to true, the service will be allocated using the ServiceElement configuration, not the ServiceBeanInstance configuration
sticky - If set to true, the service(s) will be re-allocated to the same ServiceBeanInstantiator that had instantiated the service. If the service has requirements that cannot be met by the compute resource hosting the ServiceBeanInstantiator, the service will be allocated on the next available compute resource that meets the requirements of the service.
delay - The amount of time (in milliseconds) to wait until the redeployment is performed. A value > 0 will result in scheduling the redeployment
listener - If not null, the ServiceProvisionListener will be notified as each service is redeployed
Throws:
OperationalStringException - If there are errors redeploying
See Also:
OperationalStringManager.redeploy(org.rioproject.core.ServiceElement, org.rioproject.core.ServiceBeanInstance, boolean, long, org.rioproject.core.ServiceProvisionListener)

getServiceStatements

public ServiceStatement[] getServiceStatements()
Description copied from interface: OperationalStringManager
Get the ServiceStatements for all ServiceElements in the OperationalString

Specified by:
getServiceStatements in interface OperationalStringManager
Returns:
An array of ServiceStatement instances.
See Also:
OperationalStringManager.getServiceStatements()

getDeploymentMap

public DeploymentMap getDeploymentMap()
Description copied from interface: OperationalStringManager
Get the DeploymentMap for services in this OperationalString

Specified by:
getDeploymentMap in interface OperationalStringManager
Returns:
A DeploymentMap for services in this OperationalString
See Also:
OperationalStringManager.getDeploymentMap()

getProxyVerifier

public TrustVerifier getProxyVerifier()
Returns a TrustVerifier which can be used to verify that a given proxy to this policy handler can be trusted

Specified by:
getProxyVerifier in interface ServerProxyTrust

Copyright © Rio Project.

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