org.mbari.siam.dataTurbine
Class Turbinator

java.lang.Object
  extended by org.mbari.siam.dataTurbine.Turbinator
All Implemented Interfaces:
InstrumentDataListener

public class Turbinator
extends java.lang.Object
implements InstrumentDataListener

Turbinator parses instrument DevicePackets and writes them to DataTurbine channels.


Nested Class Summary
protected  class Turbinator.ChannelDesc
          Class that goes into _channels HashMap
 
Field Summary
protected  DNSAdvertiser _advertiser
          DNSAdvertiser that will advertise service on ZeroConf
protected  int _archiveSize
           
protected  int _cacheSize
           
protected  java.util.HashMap _channels
          Contains Channel names, units, recordTypes
protected  java.util.HashMap _dtChannelMaps
          Contains the ChannelMaps by recordType
protected  java.lang.String _dtHostName
          DataTurbine ring buffer's host name
protected  int _dtHostPort
          DataTurbine ring buffer's host port
protected  com.rbnb.sapi.Source _dtSource
          DataTurbine "source" (Turbinator writes to this, clients read from it)
protected  java.lang.String _instrumentName
          Unique instrument instance name
protected  Turbinator.ChannelDesc _metadataChannel
           
protected  java.util.HashMap _mimeTypes
          Specifies mime type for specific channels
static java.lang.String METADATA_CHANNEL_NAME
           
 
Constructor Summary
Turbinator(PacketParser parser, java.lang.String instrumentName, java.lang.String dtHostName, java.lang.String sourceLocationName, java.lang.String instrumentMnemonic, boolean advertiseService)
           
Turbinator(PacketParser parser, java.lang.String instrumentName, java.lang.String dtHostName, java.lang.String sourceLocationName, java.lang.String instrumentMnemonic, boolean advertiseService, int cacheSize, int archiveSize)
          Create the Turbinator
 
Method Summary
 void close()
          Close the DataTurbine source and associated ZeroConf service
 void dataCallback(DevicePacket sensorData, PacketParser.Field[] fields)
          Write data to DataTurbine
 com.rbnb.sapi.ChannelMap excludeRecordType(long rcdType)
          Exclude the given recordType from being written to DataTurbine
 void serviceRegisteredCallback(RegistryEntry entry)
          Ignore serviceRegisteredCallback()
 void setMimeType(java.lang.String channelName, java.lang.String mimeType)
          Set mime type for specified channel (default is "application/octet-stream"); this method MUST be called prior to parsing first record.
 void write(DevicePacket packet)
          Parse SIAM device packet and write data to DataTurbine
 void write(DevicePacket packet, PacketParser.Field[] fields)
          Write data to DataTurbine from parsed packet
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_channels

protected java.util.HashMap _channels
Contains Channel names, units, recordTypes


_mimeTypes

protected java.util.HashMap _mimeTypes
Specifies mime type for specific channels


_dtChannelMaps

protected java.util.HashMap _dtChannelMaps
Contains the ChannelMaps by recordType


_dtSource

protected com.rbnb.sapi.Source _dtSource
DataTurbine "source" (Turbinator writes to this, clients read from it)


_instrumentName

protected java.lang.String _instrumentName
Unique instrument instance name


_dtHostName

protected java.lang.String _dtHostName
DataTurbine ring buffer's host name


_dtHostPort

protected int _dtHostPort
DataTurbine ring buffer's host port


_metadataChannel

protected Turbinator.ChannelDesc _metadataChannel

_cacheSize

protected int _cacheSize

_archiveSize

protected int _archiveSize

_advertiser

protected DNSAdvertiser _advertiser
DNSAdvertiser that will advertise service on ZeroConf


METADATA_CHANNEL_NAME

public static final java.lang.String METADATA_CHANNEL_NAME
See Also:
Constant Field Values
Constructor Detail

Turbinator

public Turbinator(PacketParser parser,
                  java.lang.String instrumentName,
                  java.lang.String dtHostName,
                  java.lang.String sourceLocationName,
                  java.lang.String instrumentMnemonic,
                  boolean advertiseService,
                  int cacheSize,
                  int archiveSize)
           throws java.lang.Exception
Create the Turbinator

Throws:
java.lang.Exception

Turbinator

public Turbinator(PacketParser parser,
                  java.lang.String instrumentName,
                  java.lang.String dtHostName,
                  java.lang.String sourceLocationName,
                  java.lang.String instrumentMnemonic,
                  boolean advertiseService)
           throws java.lang.Exception
Throws:
java.lang.Exception
Method Detail

serviceRegisteredCallback

public void serviceRegisteredCallback(RegistryEntry entry)
Ignore serviceRegisteredCallback()

Specified by:
serviceRegisteredCallback in interface InstrumentDataListener

dataCallback

public void dataCallback(DevicePacket sensorData,
                         PacketParser.Field[] fields)
Write data to DataTurbine

Specified by:
dataCallback in interface InstrumentDataListener
Parameters:
sensorData - - SensorDataPacket that instrument logged
fields - - Result of passing sensorData to PacketParser.parseFields() if registered DeviceService is an instanceof BaseInstrumentService. Else null.

write

public void write(DevicePacket packet)
           throws java.lang.Exception
Parse SIAM device packet and write data to DataTurbine

Throws:
java.lang.Exception

write

public void write(DevicePacket packet,
                  PacketParser.Field[] fields)
           throws java.lang.Exception
Write data to DataTurbine from parsed packet

Throws:
java.lang.Exception

excludeRecordType

public com.rbnb.sapi.ChannelMap excludeRecordType(long rcdType)
Exclude the given recordType from being written to DataTurbine

Returns:
Previous ChannelMap if it had already been assigned

close

public void close()
Close the DataTurbine source and associated ZeroConf service


setMimeType

public void setMimeType(java.lang.String channelName,
                        java.lang.String mimeType)
Set mime type for specified channel (default is "application/octet-stream"); this method MUST be called prior to parsing first record.



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.