gov.nasa.gsfc.drl.rtstps.core.ccsds.path
Class PacketRouter

java.lang.Object
  extended by gov.nasa.gsfc.drl.rtstps.core.ccsds.path.PacketRouter
All Implemented Interfaces:
PacketReceiver, Receiver

final class PacketRouter
extends java.lang.Object
implements PacketReceiver

This class receives packets. It contains a map of PacketReceivers keyed by packet application id. It sends a packet to a PacketReceiver based on the matching application id. This class is almost always attached to a Path Service node.


Field Summary
private  PacketReceiver deadletters
           
private  LongStatusItem deletedPackets
           
private  LongStatusItem idlePackets
           
private  java.lang.String name
           
private  java.util.TreeMap<java.lang.Integer,PacketReceiver> output
           
private  LongStatusItem sentPackets
           
private  LongStatusItem unrouteablePackets
           
 
Constructor Summary
PacketRouter(java.lang.String name, java.util.Collection<StatusItem> statusItemList)
          Create a PacketRouter.
 
Method Summary
(package private)  void addPacketReceiver(int applicationId, PacketReceiver pr)
          Add a packet receiver to this class' receiver list.
 void flush()
          Flush the pipeline.
 java.lang.String getLinkName()
          Get this receiver's name (for error messages).
 void putPacket(Packet packet)
          Give a packet to this PacketReceiver.
 void putPackets(Packet[] packets)
          Give an array of packets to this PacketReceiver.
(package private)  void setDeadLetterPath(PacketReceiver pp)
          Set a receiver to which this class sends unrouteable packets.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

name

private java.lang.String name

output

private java.util.TreeMap<java.lang.Integer,PacketReceiver> output

deadletters

private PacketReceiver deadletters

unrouteablePackets

private LongStatusItem unrouteablePackets

sentPackets

private LongStatusItem sentPackets

idlePackets

private LongStatusItem idlePackets

deletedPackets

private LongStatusItem deletedPackets
Constructor Detail

PacketRouter

PacketRouter(java.lang.String name,
             java.util.Collection<StatusItem> statusItemList)
Create a PacketRouter.

Method Detail

getLinkName

public java.lang.String getLinkName()
Description copied from interface: PacketReceiver
Get this receiver's name (for error messages).

Specified by:
getLinkName in interface PacketReceiver
Specified by:
getLinkName in interface Receiver

addPacketReceiver

void addPacketReceiver(int applicationId,
                       PacketReceiver pr)
Add a packet receiver to this class' receiver list.


setDeadLetterPath

void setDeadLetterPath(PacketReceiver pp)
Set a receiver to which this class sends unrouteable packets. Otherwise, it discards unrouteable packets.


putPackets

public void putPackets(Packet[] packets)
                throws RtStpsException
Give an array of packets to this PacketReceiver.

Specified by:
putPackets in interface PacketReceiver
Throws:
RtStpsException

putPacket

public void putPacket(Packet packet)
               throws RtStpsException
Give a packet to this PacketReceiver.

Specified by:
putPacket in interface PacketReceiver
Throws:
RtStpsException

flush

public void flush()
           throws RtStpsException
Flush the pipeline.

Specified by:
flush in interface PacketReceiver
Specified by:
flush in interface Receiver
Throws:
RtStpsException

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object