org.mbari.siam.core
Class FilteredDeviceLog

java.lang.Object
  extended by org.mbari.siam.core.DeviceLog
      extended by org.mbari.siam.core.FilteredDeviceLog
All Implemented Interfaces:
DeviceLogIF, FilteredDeviceLogIF

public class FilteredDeviceLog
extends DeviceLog
implements FilteredDeviceLogIF

FilteredDeviceLog enables retrieval of DevicePackets based on filtering criteria.


Field Summary
protected  PacketFilter[] _defaultFilters
          Default filters to use
protected  boolean _defaultFiltersEnabled
           
protected  java.util.Vector _outputPackets
           
protected  long _shelfLifeMsec
           
 
Fields inherited from class org.mbari.siam.core.DeviceLog
_data, _index, _writeTimer, EOF, SYNC_NOT_FOUND, SYNC_PATTERN
 
Constructor Summary
FilteredDeviceLog(long deviceID, java.lang.String directory)
          Create filtered device log for specified device in specified directory.
FilteredDeviceLog(long deviceID, java.lang.String directory, PacketFilter[] defaultFilters)
          Create filtered device log for specified device in specified directory, with specified default filters.
FilteredDeviceLog(long deviceID, java.lang.String directory, PacketFilter[] defaultFilters, long shelfLifeMsec)
          Create filtered device log for specified device in specified directory, with specified default filters and "shelf life".
 
Method Summary
 void addDefaultFilters(PacketFilter[] addFilters)
          Add specified filters to default filters
 void clearDefaultFilters()
          Remove all default filters
 boolean defaultFiltersEnabled()
          Return true if default filters are enabled
 void disableDefaultFilters()
          Disable default filters
 void enableDefaultFilters()
          Enable default filters
 PacketFilter[] getDefaultFilters()
          Return default filters
 DevicePacketSet getPackets(long startKey, long endKey, int maxEntries)
          Return packet set, using default filter criteria, exclude 'stale' packets..
 DevicePacketSet getPackets(long startKey, long endKey, int maxReturnedPackets, PacketFilter[] filters)
          Return a time-sorted packet set, using specified time window and filter criteria; exclude any 'stale' packets older than this log's _shelfLifeMsec attribute.
 DevicePacketSet getPackets(long startKey, long endKey, int maxReturnedPackets, PacketFilter[] filters, boolean excludeStale)
          Return a time-sorted packet set, using specified time window and filter criteria.
 void setDefaultFilters(PacketFilter[] filters)
          Set default filters
 
Methods inherited from class org.mbari.siam.core.DeviceLog
appendPacket, appendPacket, check, close, getDeviceId, getLastMetadataRef, getLastPacket, getMaxTimestamp, getMinTimestamp, getNextPacket, getNextSync, getNumUnreadPackets, getPacket, getPacketKeyRange, nPackets
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.mbari.siam.distributed.DeviceLogIF
appendPacket, appendPacket, close, getDeviceId, getLastMetadataRef, getLastPacket, getMaxTimestamp, getMinTimestamp, getNextPacket, getNumUnreadPackets, getPacketKeyRange, nPackets
 

Field Detail

_defaultFilters

protected PacketFilter[] _defaultFilters
Default filters to use


_outputPackets

protected java.util.Vector _outputPackets

_defaultFiltersEnabled

protected boolean _defaultFiltersEnabled

_shelfLifeMsec

protected long _shelfLifeMsec
Constructor Detail

FilteredDeviceLog

public FilteredDeviceLog(long deviceID,
                         java.lang.String directory)
                  throws java.io.IOException,
                         java.io.FileNotFoundException
Create filtered device log for specified device in specified directory. By default, filter will pass all packets with no subsampling.

Throws:
java.io.IOException
java.io.FileNotFoundException

FilteredDeviceLog

public FilteredDeviceLog(long deviceID,
                         java.lang.String directory,
                         PacketFilter[] defaultFilters)
                  throws java.io.IOException,
                         java.io.FileNotFoundException
Create filtered device log for specified device in specified directory, with specified default filters.

Throws:
java.io.IOException
java.io.FileNotFoundException

FilteredDeviceLog

public FilteredDeviceLog(long deviceID,
                         java.lang.String directory,
                         PacketFilter[] defaultFilters,
                         long shelfLifeMsec)
                  throws java.io.IOException,
                         java.io.FileNotFoundException
Create filtered device log for specified device in specified directory, with specified default filters and "shelf life".

Throws:
java.io.IOException
java.io.FileNotFoundException
Method Detail

getPackets

public DevicePacketSet getPackets(long startKey,
                                  long endKey,
                                  int maxEntries)
                           throws NoDataException
Return packet set, using default filter criteria, exclude 'stale' packets..

Specified by:
getPackets in interface DeviceLogIF
Overrides:
getPackets in class DeviceLog
Parameters:
startKey - beginning key value (inclusive) of the result set
endKey - ending key value (inclusive) of the result set
maxEntries - maximum number of packets to include in the set
Throws:
NoDataException
See Also:
Vector, DevicePacket

getPackets

public DevicePacketSet getPackets(long startKey,
                                  long endKey,
                                  int maxReturnedPackets,
                                  PacketFilter[] filters)
                           throws NoDataException
Return a time-sorted packet set, using specified time window and filter criteria; exclude any 'stale' packets older than this log's _shelfLifeMsec attribute. The returned packet set may be "complete" or "incomplete"; a complete packet set contains all packets from the log that meet the retrieval criteria. An incomplete packet set contains packets from the "lower end" of the time-window.

Throws:
NoDataException

getPackets

public DevicePacketSet getPackets(long startKey,
                                  long endKey,
                                  int maxReturnedPackets,
                                  PacketFilter[] filters,
                                  boolean excludeStale)
                           throws NoDataException
Return a time-sorted packet set, using specified time window and filter criteria. The boolean 'excludeStale' argument indicates whether to exclude packets that exceed the _shelfLifeMsec value specified for this FilteredDeviceLog. The returned packet set may be "complete" or "incomplete"; a complete packet set contains all packets from the log that meet the retrieval criteria. An incomplete packet set contains packets from the "lower end" of the time-window.

Specified by:
getPackets in interface FilteredDeviceLogIF
Throws:
NoDataException

clearDefaultFilters

public void clearDefaultFilters()
Remove all default filters


addDefaultFilters

public void addDefaultFilters(PacketFilter[] addFilters)
Add specified filters to default filters


setDefaultFilters

public void setDefaultFilters(PacketFilter[] filters)
Set default filters


getDefaultFilters

public PacketFilter[] getDefaultFilters()
Return default filters


enableDefaultFilters

public void enableDefaultFilters()
Enable default filters


disableDefaultFilters

public void disableDefaultFilters()
Disable default filters


defaultFiltersEnabled

public boolean defaultFiltersEnabled()
Return true if default filters are enabled



Copyright © 2003 MBARI.

The Monterey Bay Aquarium Research Institute (MBARI) provides this documentation and code "as is", with no warranty, express or implied, of its quality or consistency. It is provided without support and without obligation on the part of MBARI to assist in its use, correction, modification, or enhancement.