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.watch
Class WatchInjector

    java.lang.Object
      org.jini.rio.watch.WatchInjector

    public class WatchInjector

extends Object

The WatchInjector provides support for declarative Watch management, by taking a `WatchDescriptor` and creating `Watch` instances which are then registered for an instantiated service.

If the watch already exists in the bean's `WatchRegistry`, the watch will not be added.

The bean must declare a Java bean getter method that has as it's return type one of the following:

- Supported primitive types: int.class, long.class, float.class, double.class
- Supported types: Integer.class, Long.class, Lloat.class, Double.class

The read property return type is verified prior to watch creation. For example, given a bean called Foo, which declares a method called `getCount()` :

     public class Foo  {
         ...
         public long getCount() {
             return(value);
         }
         ...
     }

Finally, in the OperationalString, Watch declaration is accomplished using the embedded the <Monitor> element, for example:

     <ServiceLevelAgreements>
         <SLA ID="backlog" Low="100" High="500">
             <PolicyHandler type="scaling" max="10"
                               lowerDampener="3000" upperDampener="3000"/>
             <Monitor name="entryCounter" property="count" period="10000"/>
         </SLA>
     </ServiceLevelAgreements>

This declaration creates a `GaugeWatch` with a name of `entryCounter`, which adds the value returned from the `getCount()` method every 10 seconds.

Constructor Summary
`WatchInjector(Object impl, ServiceBeanContext context)`

Method Summary
`protected Watch` | `createWatch(WatchDescriptor wDesc, Configuration config)`
`WatchDescriptor` | `getWatchDescriptor(String name)` Get the WatchDescriptor from a Watch name
`String[]` | `getWatchNames()` Get all created Watch names
`Watch` | `inject(WatchDescriptor wDesc)` Add a WatchDescriptor, creating the Watch
`void` | `modify(WatchDescriptor wDesc)` Modify an injected Watch
`void` | `remove(String name)` Unregister and remove an injected Watch
`void` | `remove(WatchDescriptor wDesc)` Unregister and remove an injected Watch
`void` | `terminate()` Terminate all watches, and cancel the timer

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

Constructor Detail

### WatchInjector

    public WatchInjector(Object impl,
                         ServiceBeanContext context)
                  throws IntrospectionException

Throws:
  `IntrospectionException`

Method Detail

### inject

    public Watch inject(WatchDescriptor wDesc)
                 throws ConfigurationException

  Add a WatchDescriptor, creating the Watch

  Parameters:
    `wDesc` - The WatchDescriptor to add, must not be null
  Returns:
    The created Watch, or `null` if it could not be created. If the watch already exists, the current atch wil be returned
  Throws:
    `ConfigurationException` - if there are problems getting the configuration from the context

### terminate

    public void terminate()

  Terminate all watches, and cancel the timer

### createWatch

    protected Watch createWatch(WatchDescriptor wDesc,
                                Configuration config)

### getWatchNames

    public String[] getWatchNames()

  Get all created Watch names

  Returns:
    The names of all watches that have been created and registered by this utility. If there are no watches created and registered by this utility a zero-length array is returned. A new array is allocated each time

### getWatchDescriptor

    public WatchDescriptor getWatchDescriptor(String name)

  Get the WatchDescriptor from a Watch name

  Parameters:
    `name` - The Watch name (id), must not be null
  Returns:
    A WatchDescriptor instance or null if not found

### modify

    public void modify(WatchDescriptor wDesc)
                throws ConfigurationException

  Modify an injected Watch

  Parameters:
    `wDesc` - The WatchDescriptor to modify, must not be null
  Throws:
    `ConfigurationException` - if there are errors reading the configuration

### remove

    public void remove(WatchDescriptor wDesc)

  Unregister and remove an injected Watch

  Parameters:
    `wDesc` - The WatchDescriptor to remove, must not be null

### remove

    public void remove(String name)

  Unregister and remove an injected Watch

  Parameters:
    `name` - The Watch name (id) to remove, must not be null

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.