com.mindtree.techworks.insight.receiver
Class RemoteProtocolStreamReceiver

java.lang.Object
  extended by java.lang.Thread
      extended by com.mindtree.techworks.insight.receiver.AbstractReceiver
          extended by com.mindtree.techworks.insight.receiver.RemoteProtocolStreamReceiver
All Implemented Interfaces:
ILogEventModelMutator, ReceiverInterpreter, java.lang.Runnable

public class RemoteProtocolStreamReceiver
extends AbstractReceiver

This is a concrete implementation of the com.mindtree.techworks.insight.receiver.AbstractReceiver class. It supports listening on an UDP port and receiving log events in the form of DataPackets as defined in com.mindtree.techworks.insight.remoteprotocol.spi.DataPacket.

This class supports receiving from multiple namespaces at the same time, and also from multiple sources at the same time.

Version:
$Revision: 27 $ $Date: 2007-12-16 04:58:03 -0700 (Sun, 16 Dec 2007) $
Author:
Bindul Bhowmik
See Also:
AbstractReceiver, DataPacket

Nested Class Summary
protected  class RemoteProtocolStreamReceiver.SourceDetails
          Inner class to hold the different objects in relation to a particular source including the LogNamespace, LogInterpreter (including the ReceiverFormat) and if a startup message has been received for this source.
 
Nested classes/interfaces inherited from class java.lang.Thread
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler
 
Field Summary
protected  java.util.LinkedList packetQueue
          The queue containing all packets that are read.
protected  int portListeningOn
          The port on which the receiver is listening
 
Fields inherited from class com.mindtree.techworks.insight.receiver.AbstractReceiver
interpretedEventCount
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Fields inherited from interface com.mindtree.techworks.insight.receiver.ReceiverInterpreter
FAILURE, SUCCESS
 
Fields inherited from interface com.mindtree.techworks.insight.model.ILogEventModelMutator
FAILURE, NON_TAILING_MUTATOR, SUCCESS, TAILING_MUTATOR
 
Constructor Summary
RemoteProtocolStreamReceiver(ReceiverFormat[] receiverFormat, int portListeningOn)
          Creates an instance of the Receiver
 
Method Summary
protected  void deInitialize()
          Informs this AbstractReceiver to reset itself.
 LogNamespace[] getNamespaces()
          Returns the LogNamespace that this AbstractReceiver was initialized with
protected  LogEvent[] getNextEvents()
          Gets null or the next LoggingEvent(s) processed by this receiver
protected  boolean hasMoreEvents()
          Determines if this receiver has any more events to process
protected  void initialize(LogNamespace namespace, boolean isTailing)
          Initializes this instance.
 boolean isTailing()
          Always returns true since the RemoteProtocolStreamReceiver is by nature tailing.
 
Methods inherited from class com.mindtree.techworks.insight.receiver.AbstractReceiver
addAppender, addMutatorListener, addReceiverListener, removeAppender, removeMutatorListener, removeReceiverListener, run, shutdown, startup
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

packetQueue

protected java.util.LinkedList packetQueue
The queue containing all packets that are read.


portListeningOn

protected int portListeningOn
The port on which the receiver is listening

Constructor Detail

RemoteProtocolStreamReceiver

public RemoteProtocolStreamReceiver(ReceiverFormat[] receiverFormat,
                                    int portListeningOn)
                             throws ReceiverInitializationException
Creates an instance of the Receiver

Parameters:
receiverFormat - The Receiver format used for the receiver.
portListeningOn - The port on which to listen.
Throws:
ReceiverInitializationException - If the Receiver could not be initialized properly.
Method Detail

getNamespaces

public LogNamespace[] getNamespaces()
Description copied from class: AbstractReceiver
Returns the LogNamespace that this AbstractReceiver was initialized with

Specified by:
getNamespaces in class AbstractReceiver
Returns:
Returns the namespace.
See Also:
AbstractReceiver.getNamespaces()

isTailing

public boolean isTailing()
Always returns true since the RemoteProtocolStreamReceiver is by nature tailing.

Specified by:
isTailing in class AbstractReceiver
Returns:
the isTailing value specified during initialization
See Also:
AbstractReceiver.isTailing()

initialize

protected void initialize(LogNamespace namespace,
                          boolean isTailing)
                   throws ReceiverInitializationException
Initializes this instance. Both the parameters are ignored.

Specified by:
initialize in class AbstractReceiver
Parameters:
namespace - the LogNamespace that this AbstractReceiver will process events from
isTailing - determines if this AbstractReceiver tails the specified LogNamespace
Throws:
ReceiverInitializationException - if any problems occurs during the initialization of receiver.
See Also:
AbstractReceiver.initialize(com.mindtree.techworks.insight.spi.LogNamespace, boolean)

deInitialize

protected void deInitialize()
Description copied from class: AbstractReceiver
Informs this AbstractReceiver to reset itself. This method is called post shutdown to let this class cleanup and release resources such socket connections, input streams e.t.c.

Specified by:
deInitialize in class AbstractReceiver
See Also:
AbstractReceiver.deInitialize()

getNextEvents

protected LogEvent[] getNextEvents()
Description copied from class: AbstractReceiver
Gets null or the next LoggingEvent(s) processed by this receiver

Specified by:
getNextEvents in class AbstractReceiver
Returns:
null or the LoggingEvent instance
See Also:
AbstractReceiver.getNextEvents()

hasMoreEvents

protected boolean hasMoreEvents()
Description copied from class: AbstractReceiver
Determines if this receiver has any more events to process

Specified by:
hasMoreEvents in class AbstractReceiver
Returns:
true if events exist in the log namespace for processing
See Also:
AbstractReceiver.hasMoreEvents()


Copyright © 2003-2008 MindTree Consulting Ltd.. All Rights Reserved.