gov.sns.tools.pvlogger
Interface StateStore

All Known Implementing Classes:
SimpleStateStore, SqlStateStore

public interface StateStore

StateStore is an interface that persistent storages must implement for publishing and recovering machine state.


Method Summary
 ChannelGroup fetchGroup(java.lang.String type)
          Fetch a channel group for the specified logger type
 MachineSnapshot fetchMachineSnapshot(long id)
          Fetch the machine snapshot associated with the unique machine snapshot identifier.
 MachineSnapshot[] fetchMachineSnapshotsInRange(java.lang.String type, java.util.Date startTime, java.util.Date endTime)
          Fetch the machine snapshots within the specified time range.
 java.lang.String[] fetchTypes()
          Fetch an array of valid logger types
 MachineSnapshot loadChannelSnapshotsInto(MachineSnapshot machineSnapshot)
          Fetch the channel snapshots from the data source and populate the machine snapshot
 void publish(ChannelSnapshot snapshot, long machineId)
          Publish the channel snapshot and associate it with the machine snapshot given by the machine snapshop id.
 void publish(MachineSnapshot machineSnapshot)
          Publish the machine snapshot.
 

Method Detail

publish

public void publish(ChannelSnapshot snapshot,
                    long machineId)
Publish the channel snapshot and associate it with the machine snapshot given by the machine snapshop id.

Parameters:
snapshot - The channel snapshot to publish
machineId - The unique id of the associated machine snapshot

publish

public void publish(MachineSnapshot machineSnapshot)
Publish the machine snapshot.

Parameters:
machineSnapshot - The machine snapshot to publish.

fetchMachineSnapshot

public MachineSnapshot fetchMachineSnapshot(long id)
Fetch the machine snapshot associated with the unique machine snapshot identifier.

Parameters:
id - The unique machine snapshot identifier
Returns:
The machine snapshop read from the persistent store.

loadChannelSnapshotsInto

public MachineSnapshot loadChannelSnapshotsInto(MachineSnapshot machineSnapshot)
Fetch the channel snapshots from the data source and populate the machine snapshot

Parameters:
machineSnapshot - The machine snapshot for which to fetch the channel snapshots and load them
Returns:
the machineSnapshot which is the same as the parameter returned for convenience

fetchMachineSnapshotsInRange

public MachineSnapshot[] fetchMachineSnapshotsInRange(java.lang.String type,
                                                      java.util.Date startTime,
                                                      java.util.Date endTime)
Fetch the machine snapshots within the specified time range. If the type is not null, then restrict the machine snapshots to those of the specified type. The machine snapshots do not include the channel snapshots. A complete snapshot can be obtained using the fetchMachineSnapshot(id) method.

Parameters:
type - The type of machine snapshots to fetch or null for no restriction
startTime - The start time of the time range
endTime - The end time of the time range
Returns:
An array of machine snapshots meeting the specified criteria

fetchTypes

public java.lang.String[] fetchTypes()
Fetch an array of valid logger types

Returns:
an array of available logger types

fetchGroup

public ChannelGroup fetchGroup(java.lang.String type)
Fetch a channel group for the specified logger type

Parameters:
type - the logger type
Returns:
a channel group for the logger type which includes the type, description and the pvs to log