isc.sensor.outputadaptor.oaextensions
Class PCAPFileSink

java.lang.Object
  extended by org.openadaptor.adaptor.SimpleComponent
      extended by org.openadaptor.adaptor.AbstractWriter
          extended by org.openadaptor.adaptor.AbstractSimpleSink
              extended by isc.sensor.outputadaptor.oaextensions.PCAPFileSink
All Implemented Interfaces:
org.openadaptor.adaptor.CallbackProvider, org.openadaptor.adaptor.Component, org.openadaptor.adaptor.Configurable, org.openadaptor.adaptor.IbafTransactionalResource, org.openadaptor.adaptor.Sink, org.openadaptor.doconverter.DOMessageReaderDelegate

public class PCAPFileSink
extends org.openadaptor.adaptor.AbstractSimpleSink

This sink will create a PCAP file from an Special Object Type PcapPacket created with StaticPortPacketCapture or similar parser.

NOTE: The packet data byte array can be either a raw byte array (byte[]) or a String that was previously converted using SDOTypeOpaqueTransformerToString.

Configuration Options are:

   Sample configuration:
 
 A.C2.ClassName = isc.sensor.outputadaptor.oaextensions.PCAPFileSink
 A.C2.FileName = /tmp/homelan.pcap A.C2.Overwrite = false
 

PcapPacket DataObject
Attributes:

   Name            Type
 ---------       --------------
 time            String java.sql.Timestamp --- Some db's don't handle this correctly; should be: "YYYY-MM-DD HH:MM:SS[.fffffff]"
 milliseconds    long
 nanoseconds     integer
 sensorName      String
 interface       String
 sessionKey      String
 packetSize      integer
 packet          byte[]
 

Author:
John Casey
Project: DNA_sensor - Aug 12, 2005
See Also:
PCAP man pages, SDOTypeOpaqueTransformerToString, StaticPortPacketCapture, Openadaptor Documentation

Nested Class Summary
 
Nested classes/interfaces inherited from class org.openadaptor.adaptor.SimpleComponent
org.openadaptor.adaptor.SimpleComponent.StateHolder
 
Field Summary
protected  java.lang.String _defaultfname
           
protected  java.lang.String _filename
           
protected  boolean _overwrite
           
protected  byte[] err
           
protected  javacap jp
           
protected static org.apache.log4j.Logger log
          Property name for writeSummary flag
protected  org.openadaptor.dostrings.transformers.AbstractTransformer pktFromStr
           
 
Fields inherited from class org.openadaptor.adaptor.AbstractSimpleSink
_continue_on_exception
 
Fields inherited from class org.openadaptor.adaptor.AbstractWriter
_packetName, _packetSize, _record_delimiter, _string_writer, _writeBatchAsRecord, _writer, PACKET_NAME, PACKET_SIZE
 
Fields inherited from class org.openadaptor.adaptor.SimpleComponent
_controller, _formatter, _name, _propsPrefix, _readerDelegate, _textEncoding, MESSAGE_WRITER_PREFIX, MESSAGEID_ATTR, TEXT_ENCODING_ATTR
 
Constructor Summary
PCAPFileSink()
           
 
Method Summary
 void init(java.lang.String name, java.util.Properties props, java.lang.String prefix, org.openadaptor.adaptor.Controller controller)
          Initializes the sink.
 void processMessage(org.openadaptor.adaptor.Message message)
          checks continue on exception flag, this will either throw a pipeline exception or mark data array element with exception and set mapping /** Processes the messages passed to it by the controller.
 
Methods inherited from class org.openadaptor.adaptor.AbstractSimpleSink
cleanUp, processHospitalException, writerHospitalException
 
Methods inherited from class org.openadaptor.adaptor.AbstractWriter
getDOStringWriter, getRecordDelimiter, getWriter, setDOStringWriter, setRecordDelimiter, setWriter, writeDataObjects, writeMessage, writerCleanUp, writeRecord, writerStartUp
 
Methods inherited from class org.openadaptor.adaptor.SimpleComponent
addCallback, canUpdateWhileRunning, customControl, didReceiveMessage, getAsProperties, getCallbackManager, getCurrentState, getCustomControlProperties, getLastUID, getName, getProperty, getProperty, getPropsPrefix, getRequestedState, getSecurityManager, getStatus, getTextEncoding, getXMLFormatter, notifyEvent, pause, removeCallback, resume, setCallbackManager, setCallbackManager, setCurrentState, setFromProperties, setFromProperties, setFromResource, setName, setPropsPrefix, setRequestedState, terminate, txnBegin, txnCommit, txnCommitWithExceptions, txnRollback, txnRollback, waitForRequestedStateChange
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.openadaptor.adaptor.Component
customControl, getName, getPropsPrefix, getRequestedState, getStatus, pause, resume, setName, setPropsPrefix, terminate
 
Methods inherited from interface org.openadaptor.adaptor.IbafTransactionalResource
txnBegin, txnCommit, txnCommitWithExceptions, txnRollback, txnRollback
 
Methods inherited from interface org.openadaptor.adaptor.Configurable
canUpdateWhileRunning, getAsProperties, setFromProperties, setFromProperties
 
Methods inherited from interface org.openadaptor.adaptor.CallbackProvider
addCallback, getCallbackManager, notifyEvent, removeCallback, setCallbackManager, setCallbackManager
 

Field Detail

log

protected static org.apache.log4j.Logger log
Property name for writeSummary flag


pktFromStr

protected org.openadaptor.dostrings.transformers.AbstractTransformer pktFromStr

jp

protected javacap jp

_filename

protected java.lang.String _filename

_overwrite

protected boolean _overwrite

err

protected byte[] err

_defaultfname

protected java.lang.String _defaultfname
Constructor Detail

PCAPFileSink

public PCAPFileSink()
Method Detail

init

public void init(java.lang.String name,
                 java.util.Properties props,
                 java.lang.String prefix,
                 org.openadaptor.adaptor.Controller controller)
          throws org.openadaptor.adaptor.IbafException
Initializes the sink.

Specified by:
init in interface org.openadaptor.adaptor.Component
Overrides:
init in class org.openadaptor.adaptor.AbstractSimpleSink
Parameters:
name - The name to be given to the component
props - Properties object
prefix - Prefix string to search for properties
controller - The component's controller object
Throws:
org.openadaptor.adaptor.IbafException - Thrown if initialisation fails, mandatory properties are missing or properties cannot be parsed.
See Also:
Controller, SimpleController

processMessage

public void processMessage(org.openadaptor.adaptor.Message message)
                    throws org.openadaptor.adaptor.PipelineException
Description copied from class: org.openadaptor.adaptor.AbstractSimpleSink
checks continue on exception flag, this will either throw a pipeline exception or mark data array element with exception and set mapping /** Processes the messages passed to it by the controller. Typically a Sink will take some decisive, final action with the message it receives. For example

Specified by:
processMessage in interface org.openadaptor.adaptor.Sink
Specified by:
processMessage in class org.openadaptor.adaptor.AbstractSimpleSink
Throws:
org.openadaptor.adaptor.PipelineException - If processing fails for any reason.