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 WatchDataSourceImpl

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

All Implemented Interfaces:
  Remote, ServerProxyTrust, WatchDataSource

    public class WatchDataSourceImpl

extends Object
implements WatchDataSource, ServerProxyTrust

The WatchDataSourceImpl provides support for the WatchDataSource interface. The WatchDataSourceImpl supports the following configuration entries; where each configuration entry name is associated with the component name org.jini.rio.watch

- watchDataSourceExporter

  Type: | Exporter
  Default: | A new `BasicJeriExporter` with a `TcpServerEndpoint` created on a random port, a `BasicILFactory`, distributed garbage collection turned off, keep alive on. ``
  Description: | The Exporter used to export the WatchDataSourceImpl server. A new exporter is obtained every time a WatchDataSourceImpl needs to export itself.

- collectionSize

  Type: | int
  Default: | 1000
  Description: | The size of the WatchDataSource history collection.

Field Summary
`static int` | `DEFAULT_COLLECTION_SIZE` defines the default history size
`static int` | `MAX_COLLECTION_SIZE` defines the default history max size

Constructor Summary
`WatchDataSourceImpl(String id, Archivable archivable, Configuration config)` Constructs WatchDataSourceImpl object.

Method Summary
`void` | `addCalculable(Calculable calculable)` Add a Calculable record to the Calculable history
`void` | `clear()` Clears the history
`void` | `clear(String id)` Clears the history for a specific Watch identifier
`void` | `close()` Closes the watch data source and unexports it from the runtime
`WatchDataSource` | `export()` Export the WatchDataSourceImpl using a configured Exporter, defaulting to BasicJeriExporter
`protected void` | `finalize()` Make sure the archival file is closed before garbage collection
`Archivable` | `getArchivable()` Getter for property archivable.
`Calculable[]` | `getCalculable()` Get all Calculable records from the Calculable history
`Calculable[]` | `getCalculable(int offset, int length)` Get Calculable records from the Calculable history for the specified range
`Calculable[]` | `getCalculable(long from, long to)` Get Calculable records from the Calculable history for the specified time range
`Calculable[]` | `getCalculable(String id)` Get Calculable records from the Calculable history
`Calculable[]` | `getCalculable(String id, int offset, int length)` Get Calculable records from the Calculable history
`Calculable[]` | `getCalculable(String id, long from, long to)` Get Calculable records from the Calculable history for the specified time range
`int` | `getCurrentSize()` Get the current size for the Calculable history
`String` | `getID()` Get the ID for the WatchDataSource
`Calculable` | `getLastCalculable()` Gets the last Calculable from the history
`Calculable` | `getLastCalculable(String id)` Gets the last Calculable from the history
`int` | `getMaxSize()` Get the maximum size for the Calculable history
`int` | `getOffset()` Get the offset
`WatchDataSource` | `getProxy()` Get the WatchDataSource proxy
`TrustVerifier` | `getProxyVerifier()` Returns a `TrustVerifier` which can be used to verify that a given proxy to this WatchDataSource can be trusted
`ThresholdValues` | `getThresholdValues()` Getter for property thresholdValues.
`String` | `getView()` Getter for property view.
`void` | `setArchivable(Archivable archivable)` Setter for property archivable.
`void` | `setID(String id)` Setter for property id.
`void` | `setMaxSize(int size)` Set the maximum size for the Calculable history
`void` | `setThresholdValues(ThresholdValues tValues)` Set the ThresholdValues
`void` | `setView(String viewClass)` Setter for property view.
`void` | `unexport(boolean force)` Unexport the WatchDataSourceImpl

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

Field Detail

### DEFAULT_COLLECTION_SIZE

    public static final int DEFAULT_COLLECTION_SIZE

  defines the default history size

  See Also:
    Constant Field Values

### MAX_COLLECTION_SIZE

    public static final int MAX_COLLECTION_SIZE

  defines the default history max size

  See Also:
    Constant Field Values

Constructor Detail

### WatchDataSourceImpl

    public WatchDataSourceImpl(String id,
                               Archivable archivable,
                               Configuration config)

  Constructs WatchDataSourceImpl object.

  Parameters:
    `id` - The ID of the WatchDataSource
    `archivable` - the archivable
    `config` - Configuration object for use

Method Detail

### export

    public WatchDataSource export()
                           throws RemoteException

  Export the WatchDataSourceImpl using a configured Exporter, defaulting to BasicJeriExporter

  Returns:
    A proxy to use for the WatchDataSource
  Throws:
    `RemoteException` - if there are errors exporting the WatchDataSource

### getProxy

    public WatchDataSource getProxy()

  Get the WatchDataSource proxy

  Returns:
    The WatchDataSource proxy

### unexport

    public void unexport(boolean force)

  Unexport the WatchDataSourceImpl

  Parameters:
    `force` - If true, unexports the WatchDataSourceImpl even if there are pending or in-progress calls; if false, only unexports the WatchDataSourceImpl if there are no pending or in-progress calls

### getID

    public String getID()

  Description copied from interface: `WatchDataSource`
  Get the ID for the WatchDataSource

  Specified by:
    `getID` in interface `WatchDataSource`
  Returns:
    The identifier for the WatchDataSource
  See Also:
    `WatchDataSource.getID()`

### setID

    public void setID(String id)

  Setter for property id.

  Parameters:
    `id` - New value of property id.

### getOffset

    public int getOffset()

  Description copied from interface: `WatchDataSource`
  Get the offset

  Specified by:
    `getOffset` in interface `WatchDataSource`
  Returns:
    The offset to begining of the active history
  See Also:
    `WatchDataSource.getOffset()`

### setMaxSize

    public void setMaxSize(int size)

  Description copied from interface: `WatchDataSource`
  Set the maximum size for the Calculable history

  Specified by:
    `setMaxSize` in interface `WatchDataSource`
  Parameters:
    `size` - The maximum size for the Calculable history
  See Also:
    `WatchDataSource.setMaxSize(int)`

### clear

    public void clear()

  Description copied from interface: `WatchDataSource`
  Clears the history

  Specified by:
    `clear` in interface `WatchDataSource`
  See Also:
    `WatchDataSource.clear()`

### clear

    public void clear(String id)

  Description copied from interface: `WatchDataSource`
  Clears the history for a specific Watch identifier

  Specified by:
    `clear` in interface `WatchDataSource`
  Parameters:
    `id` - The Watch identifier
  See Also:
    `WatchDataSource.clear(String)`

### getMaxSize

    public int getMaxSize()

  Description copied from interface: `WatchDataSource`
  Get the maximum size for the Calculable history

  Specified by:
    `getMaxSize` in interface `WatchDataSource`
  Returns:
    The maximum size for the Calculable history
  See Also:
    `WatchDataSource.getMaxSize()`

### getCurrentSize

    public int getCurrentSize()

  Description copied from interface: `WatchDataSource`
  Get the current size for the Calculable history

  Specified by:
    `getCurrentSize` in interface `WatchDataSource`
  Returns:
    The current size for the Calculable history
  See Also:
    `WatchDataSource.getCurrentSize()`

### addCalculable

    public void addCalculable(Calculable calculable)

  Description copied from interface: `WatchDataSource`
  Add a Calculable record to the Calculable history

  Specified by:
    `addCalculable` in interface `WatchDataSource`
  Parameters:
    `calculable` - The Calculable record
  See Also:
    `WatchDataSource.addCalculable(org.jini.rio.watch.Calculable)`

### getArchivable

    public Archivable getArchivable()

  Getter for property archivable.

  Returns:
    Value of property archivable.

### setArchivable

    public void setArchivable(Archivable archivable)

  Setter for property archivable.

  Parameters:
    `archivable` - New value of property archivable.

### getCalculable

    public Calculable[] getCalculable()

  Description copied from interface: `WatchDataSource`
  Get all Calculable records from the Calculable history

  Specified by:
    `getCalculable` in interface `WatchDataSource`
  Returns:
    An array of Calculable records from the Calculable history. If there are no Calculable records in the history, a zero-length array will be returned
  See Also:
    `WatchDataSource.getCalculable()`

### getCalculable

    public Calculable[] getCalculable(String id)

  Description copied from interface: `WatchDataSource`
  Get Calculable records from the Calculable history

  Specified by:
    `getCalculable` in interface `WatchDataSource`
  Parameters:
    `id` - The Watch identifier to match
  Returns:
    Calculable[] An array of Calculable records from the Calculable history that match the Watch id. If there are no Calculable records in the history that maych the Watch id, a zero-length array will be returned
  See Also:
    `WatchDataSource.getCalculable()`

### getCalculable

    public Calculable[] getCalculable(int offset,
                                      int length)

  Description copied from interface: `WatchDataSource`
  Get Calculable records from the Calculable history for the specified range

  Specified by:
    `getCalculable` in interface `WatchDataSource`
  Parameters:
    `offset` - The index of the first record to fetch
    `length` - The number of records to return
  Returns:
    An array of Calculable records from the Calculable history within the provided range. If there are no Calculable records in the range, a zero-length array will be returned
  See Also:
    `WatchDataSource.getCalculable()`

### getCalculable

    public Calculable[] getCalculable(long from,
                                      long to)

  Description copied from interface: `WatchDataSource`
  Get Calculable records from the Calculable history for the specified time range

  Specified by:
    `getCalculable` in interface `WatchDataSource`
  Parameters:
    `from` - The start time
    `to` - The end time
  Returns:
    An array of Calculable records from the Calculable history within the provided time range. If there are no Calculable records in the range, a zero-length array will be returned
  See Also:
    `WatchDataSource.getCalculable(long, long)`

### getCalculable

    public Calculable[] getCalculable(String id,
                                      long from,
                                      long to)

  Description copied from interface: `WatchDataSource`
  Get Calculable records from the Calculable history for the specified time range

  Specified by:
    `getCalculable` in interface `WatchDataSource`
  Parameters:
    `id` - The Watch identifier to match
    `from` - The start time
    `to` - The end time
  Returns:
    An array of Calculable records from the Calculable history within the provided time range. If there are no Calculable records in the range, a zero-length array will be returned
  See Also:
    `WatchDataSource.getCalculable(String, long, long)`

### getCalculable

    public Calculable[] getCalculable(String id,
                                      int offset,
                                      int length)

  Description copied from interface: `WatchDataSource`
  Get Calculable records from the Calculable history

  Specified by:
    `getCalculable` in interface `WatchDataSource`
  Parameters:
    `id` - The Watch identifier to match
    `offset` - The index of the first record to match
    `length` - The number of records to compare
  Returns:
    An array of Calculable records from the Calculable history that match the Watch id within the provided range. If there are no Calculable records in the range that match the Watch ID, a zero-length array will be returned
  See Also:
    `WatchDataSource.getCalculable()`

### getLastCalculable

    public Calculable getLastCalculable()

  Description copied from interface: `WatchDataSource`
  Gets the last Calculable from the history

  Specified by:
    `getLastCalculable` in interface `WatchDataSource`
  Returns:
    The last Calculable in the history
  See Also:
    `WatchDataSource.getLastCalculable()`

### getLastCalculable

    public Calculable getLastCalculable(String id)

  Description copied from interface: `WatchDataSource`
  Gets the last Calculable from the history

  Specified by:
    `getLastCalculable` in interface `WatchDataSource`
  Parameters:
    `id` - The Watch identifier to match
  Returns:
    The last Calculable in the history that matches the Watch ID
  See Also:
    `WatchDataSource.getLastCalculable()`

### finalize

    protected void finalize()
                     throws Throwable

  Make sure the archival file is closed before garbage collection

  Overrides:
    `finalize` in class `Object`
  Throws:
    `Throwable`

### getThresholdValues

    public ThresholdValues getThresholdValues()

  Description copied from interface: `WatchDataSource`
  Getter for property thresholdValues.

  Specified by:
    `getThresholdValues` in interface `WatchDataSource`
  Returns:
    Value of property thresholdValues.
  See Also:
    `WatchDataSource.getThresholdValues()`

### setThresholdValues

    public void setThresholdValues(ThresholdValues tValues)

  Description copied from interface: `WatchDataSource`
  Set the ThresholdValues

  Specified by:
    `setThresholdValues` in interface `WatchDataSource`
  Parameters:
    `tValues` - The ThresholdValues to set
  See Also:
    `WatchDataSource.setThresholdValues(org.jini.rio.core.ThresholdValues)`

### close

    public void close()

  Description copied from interface: `WatchDataSource`
  Closes the watch data source and unexports it from the runtime

  Specified by:
    `close` in interface `WatchDataSource`
  See Also:
    `WatchDataSource.close()`

### setView

    public void setView(String viewClass)

  Description copied from interface: `WatchDataSource`
  Setter for property view.

  Specified by:
    `setView` in interface `WatchDataSource`
  Parameters:
    `viewClass` - The view class name, suitable for Class.forName
  See Also:
    `WatchDataSource.setView(java.lang.String)`

### getView

    public String getView()

  Description copied from interface: `WatchDataSource`
  Getter for property view.

  Specified by:
    `getView` in interface `WatchDataSource`
  Returns:
    The Value of the property view
  See Also:
    `WatchDataSource.getView()`

### getProxyVerifier

    public TrustVerifier getProxyVerifier()

  Returns a `TrustVerifier` which can be used to verify that a given proxy to this WatchDataSource can be trusted

  Specified by:
    `getProxyVerifier` in interface `ServerProxyTrust`

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.