Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Project Rio
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.jini.rio.qos
Class ComputeResource

    java.lang.Object
      java.util.Observable
          org.jini.rio.qos.ComputeResource

    public class ComputeResource

extends Observable

The `ComputeResource` represents an abstract notion of a compute resource that offers computational resources which can be measured using Quality of Service mechanisms which correlate to qualitative and quantitative capabilities such as CPU, Memory, and others

Nested Class Summary
`class` | `ComputeResource.CapabilityChannel` The CapabilityChannel is an inner class which becomes an Observer to MeasurableCapability components and ends up notifying the ComputeResource to update registered Observer instances if any MeasurableCapability components have changed their state within the interval prescribed for the broadcaster

Constructor Summary
`ComputeResource(String[] configArgs, Configuration sharedConfig)` Create a ComputeResource

Method Summary
`boolean` | `addMeasurableCapability(MeasurableCapability capability)` Add a `MeasurableCapability` object.
`void` | `addPlatformCapability(PlatformCapability pCap)` Add a `PlatformCapability` object.
`void` | `addThresholdListener(ThresholdListener listener)` A helper method which will add a `ThresholdListener` to all contained `MeasurableCapability` components.
`void` | `boot()` Boot the ComputeResource, loading all PlatformCapability and MeasurableCapability instances
`InetAddress` | `getAddress()` Get the InetAddress ComputeResource object has been configured to represent
`String` | `getDescription()` Get the description
`MeasurableCapability[]` | `getMeasurableCapabilities()` Return an array of `MeasurableCapability` objects.
`MeasurableCapability` | `getMeasurableCapability(String description)` Get a MeasurableCapability
`MeasuredResource[]` | `getMeasuredResources()` Get the MeasuredResource components for the ComputeResource
`boolean` | `getPersistentProvisioning()` Get the persistentProvisioning property
`PlatformCapability[]` | `getPlatformCapabilities()` Return an array of `PlatformCapability` objects.
`PlatformCapability` | `getPlatformCapability(String description)` Get a PlatformCapability
`long` | `getReportInterval()` Get the reportInterval property which controls how often the ComputeResource will inform registered Observers of a state change.
`ResourceCapability` | `getResourceCapability()` Return the `ResourceCapability`object that will be used to communicate the platform and measurable capabilities attributes of the ComputeResource
`double` | `getUtilization()` Get the resource utilization as computed by a summation of the MeasurableCapability components
`boolean` | `hasMeasurableCapability(MeasurableCapability capability)` Determine if the MeasurableCapability exists in this ComputeResource
`boolean` | `hasPlatformCapability(PlatformCapability capability)` Determine if the PlatformCapability exists in this ComputeResource
`SoftwareDownloadRecord[]` | `provision(PlatformCapability pCap, SoftwareLoad softwareLoad)` Provision a `SoftwareLoad` for a `PlatformCapability` object.
`boolean` | `removeMeasurableCapability(MeasurableCapability capability)` Remove a `MeasurableCapability` object.
`boolean` | `removePlatformCapability(PlatformCapability pCap, boolean clean)` Remove a `PlatformCapability` object.
`void` | `removeThresholdListener(ThresholdListener listener)` A helper method which will remove a `ThresholdListener` from all contained `MeasurableCapability` components.
`void` | `setPersistentProvisioning(boolean persistentProvisioning)` Set the persistentProvisioning property
`void` | `setPersistentProvisioningRoot(String provisionRoot)` Set the location for the persistent provisioning of PlatformCapability instances
`void` | `setReportInterval(long reportInterval)` Set the reportInterval property which controls how often the ComputeResource will inform registered Observers of a state change.
`void` | `shutdown()` Inform all `MeasurableCapability` instances to stop measuring
`void` | `stateChange()` Notify all registered Observers the ComputeResourcehas changed.
`void` | `updateMeasurableCapability(MeasurableCapability capability)` Update a `MeasurableCapability` object.
`void` | `updatePlatformCapability(PlatformCapability capability)` Update a `PlatformCapability` object.

Methods inherited from class java.util.Observable
`addObserver, clearChanged, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers, setChanged`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### ComputeResource

    public ComputeResource(String[] configArgs,
                           Configuration sharedConfig)
                    throws ConfigurationException,
                           UnknownHostException

  Create a ComputeResource

  Parameters:
    `configArgs` - The arguments used to initialize the ComputeResource
    `sharedConfig` - A Configuration used to resolve any entries in the above config which have the form of $component_entry
  Throws:
    `ConfigurationException` - If there are problems creating the ComputeResource's configuration object
    `UnknownHostException` - If the local host cannot be obtained

Method Detail

### setReportInterval

    public void setReportInterval(long reportInterval)

  Set the reportInterval property which controls how often the ComputeResource will inform registered Observers of a state change. A state change is determined if any of the MeasurableCapability components contained within this ComputeResource provide an update in the interval specified by the reportIntervalProperty

  Parameters:
    `reportInterval` - The interval controlling when the ComputeResource reports change of state to registered Observers

### getReportInterval

    public long getReportInterval()

  Get the reportInterval property which controls how often the ComputeResource will inform registered Observers of a state change. A state change is determined if any of the MeasurableCapability components contained within this ComputeResource provide an update in the interval specified by the reportInterval property

  Returns:
    The interval controlling when the ComputeResource reports change of state to registered Observers

### getDescription

    public String getDescription()

  Get the description

  Returns:
    The description

### getAddress

    public InetAddress getAddress()

  Get the InetAddress ComputeResource object has been configured to represent

  Returns:
    The InetAddress ComputeResource object has been configured to represent

### addPlatformCapability

    public void addPlatformCapability(PlatformCapability pCap)

  Add a `PlatformCapability` object. The addition of a `PlatformCapability` component causes the state of this object to change, triggering the notification of all registered `Observer` instances.

  If there is a `PlatformCapability` component that is equal to the provided `PlatformCapability` (according to the `PlatformCapability.equals()` contract), the existing `PlatformCapability` object will be remain unchanged and the provided `PlatformCapability` ignored

  Parameters:
    `pCap` - The PlatformCapability to add

### provision

    public SoftwareDownloadRecord[] provision(PlatformCapability pCap,
                                              SoftwareLoad softwareLoad)

  Provision a `SoftwareLoad` for a `PlatformCapability` object. The provisioning of a `SoftwareLoad` object for a `PlatformCapability` component causes the state of this object to change, triggering the notification of all registered `Observer` instances.

  If there is a `PlatformCapability` component that is equal to the provided `PlatformCapability` (according to the `PlatformCapability.equals()` contract), the existing `PlatformCapability` object will be changed. If the `PlatformCapability` object does not exist, it will be added

  Parameters:
    `pCap` - The PlatformCapability
    `softwareLoad` - A SoftwareLoad to provision for the PlatformCapability
  Returns:
    Array of SoftwareDownloadRecord instances which represent any software downloaded to add the PlatformCapability. If no software was downloaded to add the PlatformCapability, return an empty array

### hasPlatformCapability

    public boolean hasPlatformCapability(PlatformCapability capability)

  Determine if the PlatformCapability exists in this ComputeResource

  Parameters:
    `capability` - The PlatformCapability to check
  Returns:
    True if exists, false otherwise

### updatePlatformCapability

    public void updatePlatformCapability(PlatformCapability capability)
                                  throws Exception

  Update a `PlatformCapability` object. Updating a `PlatformCapability` component has the following semantic:

  If the `PlatformCapability` object `Class` exists in the collection of `PlatformCapability` components, the existing `PlatformCapability` will be updated with the new `PlatformCapability` mappings. If the `PlatformCapability` object `Class` cannot be found, it will be added to the collection.

  Updating a `PlatformCapability` component causes the state of this object to change, triggering the notification of all registered `Observer` instances

  Parameters:
    `capability` - The PlatformCapability to add
  Throws:
    `Exception` - If there are errors updating the PlatformCapability

### removePlatformCapability

    public boolean removePlatformCapability(PlatformCapability pCap,
                                            boolean clean)

  Remove a `PlatformCapability` object. The removal of a `PlatformCapability` component causes the state of this object to change, triggering the notification of all registered `Observer` instances

  Parameters:
    `pCap` - The PlatformCapability to remove
    `clean` - If this value is true the following will occur :
    - If the PlatformCapability has a SoftwareDownloadRecord defined then remove the PlatformCapability from the system.
    - If the PlatformCapability has an entry in the capabilities.xml file, the entry will be removed
  Returns:
    True if removed, false otherwise

### addMeasurableCapability

    public boolean addMeasurableCapability(MeasurableCapability capability)

  Add a `MeasurableCapability` object. The addition of a `MeasurableCapability` component causes the state of this object to change, triggering the notification of all registered `Observer` instances.

  If there is a `MeasurableCapability` component that is equal to the provided `MeasurableCapability` (according to the `MeasurableCapability.equals()` contract), the existing `MeasurableCapability` object will be remain unchanged and the provided `MeasurableCapability` ignored

  Parameters:
    `capability` - The MeasurableCapability to add
  Returns:
    True if added, false otherwise

### hasMeasurableCapability

    public boolean hasMeasurableCapability(MeasurableCapability capability)

  Determine if the MeasurableCapability exists in this ComputeResource

  Parameters:
    `capability` - The MeasurableCapability to check
  Returns:
    True if the MeasurableCapability exists, false otherwise

### updateMeasurableCapability

    public void updateMeasurableCapability(MeasurableCapability capability)

  Update a `MeasurableCapability` object. Updating a `MeasurableCapability` component causes the state of this object to change, triggering the notification of all registered `Observer` instances.

  If there is a `MeasurableCapability` object that is equal to the provided `MeasurableCapability` (according to the `MeasurableCapability.equals()` contract), the existing `MeasurableCapability` object will be replaced by the provided `MeasurableCapability` object

  Parameters:
    `capability` - The MeasurableCapability to update

### removeMeasurableCapability

    public boolean removeMeasurableCapability(MeasurableCapability capability)

  Remove a `MeasurableCapability` object. The removal of a `MeasurableCapability` component causes the state of this object to change, triggering the notification of all registered `Observer` instances

  Parameters:
    `capability` - The MeasurableCapability to remove
  Returns:
    True if removed, false otherwise

### stateChange

    public void stateChange()

  Notify all registered Observers the ComputeResourcehas changed. The argument provided on the Observable.notifyObservers() invocation will be the ResourceCapability component, used to communicate the resource utilization, platform and measurable capabilities attributes of the ComputeResource

### addThresholdListener

    public void addThresholdListener(ThresholdListener listener)

  A helper method which will add a `ThresholdListener` to all contained `MeasurableCapability` components. An alternate mechanism is to obtain all `MeasurableCapability` components contained by the `ComputeResource` and add the listener to each component

  Parameters:
    `listener` - The ThresholdListener to add

### removeThresholdListener

    public void removeThresholdListener(ThresholdListener listener)

  A helper method which will remove a `ThresholdListener` from all contained `MeasurableCapability` components. An alternate mechanism is to obtain all `MeasurableCapability` components contained by the `ComputeResource` and remove the listener from each component

  Parameters:
    `listener` - The ThresholdListener

### getPlatformCapabilities

    public PlatformCapability[] getPlatformCapabilities()

  Return an array of `PlatformCapability` objects. This method will create a new array of `PlatformCapability` objects each time it is invoked. If there are no `PlatformCapability` objects contained within the `platformCapabilities` Collection, a zero-length array will be returned.

  Returns:
    Array of PlatformCapability objects

### getPlatformCapability

    public PlatformCapability getPlatformCapability(String description)

  Get a PlatformCapability

  Parameters:
    `description` - The description of the PlatformCapability
  Returns:
    The first PlatformCapability that matches the description. If no PlatformCapability matches the description, return null

### getMeasurableCapability

    public MeasurableCapability getMeasurableCapability(String description)

  Get a MeasurableCapability

  Parameters:
    `description` - The description of the MeasurableCapability
  Returns:
    The first MeasurableCapability that matches the description. If no MeasurableCapability matches the description, return null

### getMeasurableCapabilities

    public MeasurableCapability[] getMeasurableCapabilities()

  Return an array of `MeasurableCapability` objects. This method will create a new array of `MeasurableCapability` objects each time it is invoked. If there are no `MeasurableCapability` objects contained within the `measurables` Collection, a zero-length array will be returned.

  Returns:
    Array of MeasurableCapability objects

### getMeasuredResources

    public MeasuredResource[] getMeasuredResources()

  Get the MeasuredResource components for the ComputeResource

  Returns:
    Array of MeasuredResource instances that correspond to MeasurableCapability components

### getUtilization

    public double getUtilization()

  Get the resource utilization as computed by a summation of the MeasurableCapability components

  Returns:
    The aggregate utilization of the ComputeResource

### setPersistentProvisioning

    public void setPersistentProvisioning(boolean persistentProvisioning)

  Set the persistentProvisioning property

  Parameters:
    `persistentProvisioning` - True if the ComputeResource supports persistent provisioning, false otherise

### getPersistentProvisioning

    public boolean getPersistentProvisioning()

  Get the persistentProvisioning property

  Returns:
    True if the ComputeResource supports persistent provisioning, false otherwise

### setPersistentProvisioningRoot

    public void setPersistentProvisioningRoot(String provisionRoot)

  Set the location for the persistent provisioning of PlatformCapability instances

  Parameters:
    `provisionRoot` - The root directory for the persistent provisioning of PlatformCapability instances

### getResourceCapability

    public ResourceCapability getResourceCapability()

  Return the `ResourceCapability`object that will be used to communicate the platform and measurable capabilities attributes of the ComputeResource

  Returns:
    The ResourceCapability object for the ComputeResource

### boot

    public void boot()

  Boot the ComputeResource, loading all PlatformCapability and MeasurableCapability instances

### shutdown

    public void shutdown()

  Inform all `MeasurableCapability` instances to stop measuring

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Project Rio
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © Project Rio.