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 SLAPolicyHandler

    java.lang.Object
      org.jini.rio.qos.SLAPolicyHandler

All Implemented Interfaces:
  ThresholdListener

Direct Known Subclasses:
  RelocationPolicyHandler, ScalingPolicyHandler

    public class SLAPolicyHandler

extends Object
implements ThresholdListener

A SLAPolicyHandler handles thresholds for a ThresholdWatch, registering to a ThresholdManager. If a threshold is crossed (breached or cleared), the SLAPolicyHandler will fire a SLAThresholdEvent using an EventHandler provided The SLAPolicyHandler should be extended to provide logic on how to process specific policy (if-then-else logic) on how to manage SLA Thresholds produced by ThresholdWatch instantiations

Field Summary
`protected ServiceBeanContext` | `context` ServiceBeanContext for the ServiceBean
`protected Object` | `eventSource` Event source object
`protected boolean` | `initialized` Flag which indicates the SLAPolicyHandler has initialized
`protected ThresholdManager` | `thresholdManager` The ThresholdManager the SLA is for

Constructor Summary
`SLAPolicyHandler(SLA sla)` Construct a SLAPolicyHandler

Method Summary
`void` | `disconnect()` Disconnect from the ThresholdManager
`Configuration` | `getConfiguration()` Get the Configuration object
`String` | `getDescription()` Get the description
`protected Object` | `getEventSource()` Get the source property
`String` | `getID()` Get the ID of the ThresholdWatch the ThresholdListener is associated to
`SLA` | `getSLA()` Get the SLA
`ThresholdManager` | `getThresholdManager()`
`void` | `initialize(Object eventSource, EventHandler eventHandler, ServiceBeanContext context)` Prepare the SLAPolicyHandler for processing.
`void` | `notify(Calculable calculable, ThresholdValues thresholdValues, int type)` Notify for a threshold event
`protected void` | `notifyListeners(SLAPolicyEvent event)` Notify all registered SLAPolicyEventListener instances
`void` | `registerListener(SLAPolicyEventListener listener)` Register for SLAPolicyEvent notifications
`protected void` | `sendSLAThresholdEvent(Calculable calculable, ThresholdValues tValues, int type)` Set up a SLAThresholdEvent and send it
`void` | `setSendRemoteNotification(boolean sendRemoteNotifications)` Set whether the SLAPolicyHandler should send SLAThresholdEvent notifications as it is notified of thresholds being crossed
`void` | `setThresholdManager(ThresholdManager thresholdManager)` Set the ThresholdManager and connect to the ThresholdManager
`void` | `unregisterListener(SLAPolicyEventListener listener)` Unregister for SLAPolicyEvent notifications
`void` | `updateSLA(SLA sla)` Update the SLA

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

Field Detail

### eventSource

    protected Object eventSource

  Event source object

### context

    protected ServiceBeanContext context

  ServiceBeanContext for the ServiceBean

### thresholdManager

    protected ThresholdManager thresholdManager

  The ThresholdManager the SLA is for

### initialized

    protected boolean initialized

  Flag which indicates the SLAPolicyHandler has initialized

Constructor Detail

### SLAPolicyHandler

    public SLAPolicyHandler(SLA sla)

  Construct a SLAPolicyHandler

  Parameters:
    `sla` - The SLA for the SLAPolicyHandler

Method Detail

### initialize

    public void initialize(Object eventSource,
                           EventHandler eventHandler,
                           ServiceBeanContext context)

  Prepare the SLAPolicyHandler for processing. The method will only set these values if the SLAPolicyHandler has not been initialized before

  Parameters:
    `eventSource` - The object to be used as the remote event source
    `eventHandler` - Handler which sends events
    `context` - The ServiceBeanContext
  Throws:
    `NullPointerException` - if any of the parameters are null

### getEventSource

    protected Object getEventSource()

  Get the source property

  Returns:
    The Object used as the event source

### getDescription

    public String getDescription()

  Get the description

  Returns:
    String The descriptive attribute for this SLA Handler

### updateSLA

    public void updateSLA(SLA sla)

  Update the SLA

  Parameters:
    `sla` - The SLA

### getSLA

    public SLA getSLA()

  Get the SLA

  Returns:
    The SLA that the SLAPolicyHandler has been constructed with

### getConfiguration

    public Configuration getConfiguration()
                                   throws ConfigurationException

  Get the Configuration object

  Returns:
    A Configuration object created from the SLA. If there is no configuration arguments an EmptyConfiguration is returned. A new Configuration will be created each time this method is called
  Throws:
    `ConfigurationException` - If the configuration cannot be created

### getID

    public String getID()

  Description copied from interface: `ThresholdListener`
  Get the ID of the ThresholdWatch the ThresholdListener is associated to

  Specified by:
    `getID` in interface `ThresholdListener`
  Returns:
    The identifier (ID) of the ThresholdWatch the ThresholdListener is asscociated to
  See Also:
    `ThresholdListener.getID()`

### setThresholdManager

    public void setThresholdManager(ThresholdManager thresholdManager)

  Description copied from interface: `ThresholdListener`
  Set the ThresholdManager and connect to the ThresholdManager

  Specified by:
    `setThresholdManager` in interface `ThresholdListener`
  Parameters:
    `thresholdManager` - The ThresholdManager to connect to
  See Also:
    `ThresholdListener.setThresholdManager(org.jini.rio.watch.ThresholdManager)`

### getThresholdManager

    public ThresholdManager getThresholdManager()

  Returns:
    Get the ThresholdManager

### disconnect

    public void disconnect()

  Disconnect from the ThresholdManager

### notify

    public void notify(Calculable calculable,
                       ThresholdValues thresholdValues,
                       int type)

  Description copied from interface: `ThresholdListener`
  Notify for a threshold event

  Specified by:
    `notify` in interface `ThresholdListener`
  Parameters:
    `calculable` - The current metric
    `thresholdValues` - The current thresholds
    `type` - The type of threshold event, breached or cleared
  See Also:
    `ThresholdListener.notify(org.jini.rio.watch.Calculable, org.jini.rio.core.ThresholdValues, int)`

### registerListener

    public void registerListener(SLAPolicyEventListener listener)

  Register for SLAPolicyEvent notifications

  Parameters:
    `listener` - The SLAPolicyEventListener

### unregisterListener

    public void unregisterListener(SLAPolicyEventListener listener)

  Unregister for SLAPolicyEvent notifications

  Parameters:
    `listener` - The SLAPolicyEventListener

### setSendRemoteNotification

    public void setSendRemoteNotification(boolean sendRemoteNotifications)

  Set whether the SLAPolicyHandler should send SLAThresholdEvent notifications as it is notified of thresholds being crossed

  Parameters:
    `sendRemoteNotifications` - If false do not send notifications

### notifyListeners

    protected void notifyListeners(SLAPolicyEvent event)

  Notify all registered SLAPolicyEventListener instances

  Parameters:
    `event` - The SLAPolicyEvent

### sendSLAThresholdEvent

    protected void sendSLAThresholdEvent(Calculable calculable,
                                         ThresholdValues tValues,
                                         int type)

  Set up a SLAThresholdEvent and send it

  Parameters:
    `calculable` - The current metric
    `tValues` - The current thresholds
    `type` - The type of threshold event, breached or cleared

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.