gov.nist.antd.merlin.protocol.sample
Class SimpleProtocol

java.lang.Object
  |
  +--SSF.OS.ProtocolSession
        |
        +--gov.nist.antd.merlin.protocol.sample.SimpleProtocol
All Implemented Interfaces:
com.renesys.raceway.DML.Configurable, DMLDump

public class SimpleProtocol
extends ProtocolSession
implements DMLDump

This class implements a protocol that sends a message to an other node (for test only).

 This class was developed at the National Institute of Standards and
 Technology by employees of the Federal Government in the course of
 their official duties. Pursuant to title 17 Section 105 of the United
 States Code this software is not subject to copyright protection and
 is in the public domain.
 NIST assumes no responsibility whatsoever for its use by other parties,
 and makes no guarantees, expressed or implied, about its quality,
 reliability, or any other characteristic.
 
We would appreciate acknowledgement if the software is used.
NIST ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" CONDITION AND DISCLAIM ANY LIABILITY OF ANY KIND FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.

Author:
borchert
, rouil

Field Summary
private  double bandwidth
          The bandwidth for the connection request (default = 2.5 Gig).
private  double delay
          The delay between retransmission.
private  int destination
          Destination of the message.
private  OpticalConnection route
          The current optical route used.
private  java.lang.String routingAlgo
          The name of the routing algorithm (default = ShortestPathDistance).
private  boolean send
          Define if we should send or not.
private  java.lang.String wavelengthAlgo
          The name of the wavelength assignment algorithm (default = BestFit).
 
Fields inherited from class SSF.OS.ProtocolSession
name, use
 
Constructor Summary
SimpleProtocol()
          Default constructor.
 
Method Summary
 void config(com.renesys.raceway.DML.Configuration cfg)
          Configuration
 double getBandwidth()
          Get the requested bandwidth
 double getDelay()
          Get the delay between two transmissions
 int getDestination()
          Return the destination ID
 java.lang.String getRoutingAlgorithm()
          Return the name of the routing algorithm to be used
 java.lang.String getWavelengthAlgorithm()
          Return the name of the wavelength algorithm to be used
 void go()
          Function called after the timer is out
 void init()
          Initialization routine, called by the ProtocolGraph after instantiation.
 boolean push(ProtocolMessage message, ProtocolSession fromSession)
          Print the message received.
 boolean send(java.lang.String message)
          send the message.
 void setBandwidth(double bandwidth)
          Set the bandwidth requested
 void setDelay(double delay)
          Set the delay between two transmissions
 void setDestination(int id)
          Set the destination node
 void setRoutingAlgorithm(java.lang.String name)
          Set the routing algorithm
 void setWavelengthAlgorithm(java.lang.String name)
          Set the wavelength algorithm
 java.lang.String toDML()
          This method generates the DML configuration for the options of this class.
 
Methods inherited from class SSF.OS.ProtocolSession
close, closed, debugIdentifier, inGraph, open, opened, pushAfterDelay, pushAfterDelayFailed, setGraph, version
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

routingAlgo

private java.lang.String routingAlgo
The name of the routing algorithm (default = ShortestPathDistance).


wavelengthAlgo

private java.lang.String wavelengthAlgo
The name of the wavelength assignment algorithm (default = BestFit).


bandwidth

private double bandwidth
The bandwidth for the connection request (default = 2.5 Gig).


destination

private int destination
Destination of the message.


send

private boolean send
Define if we should send or not.


route

private OpticalConnection route
The current optical route used.


delay

private double delay
The delay between retransmission.

Constructor Detail

SimpleProtocol

public SimpleProtocol()
Default constructor.

Method Detail

config

public void config(com.renesys.raceway.DML.Configuration cfg)
            throws com.renesys.raceway.DML.configException
Configuration

Specified by:
config in interface com.renesys.raceway.DML.Configurable
Overrides:
config in class ProtocolSession
Parameters:
cfg - The DML configuration
Throws:
if - a configuration error occurs
com.renesys.raceway.DML.configException

init

public void init()
          throws ProtocolException
Initialization routine, called by the ProtocolGraph after instantiation. The order of initialization of a set of protocols is unspecified, so other methods (like open()) may be called before init(). Resources (like connection tables) that may be needed by open() should therefore be created in the ProtocolSession constructor.

Overrides:
init in class ProtocolSession
ProtocolException

go

public void go()
Function called after the timer is out


send

public boolean send(java.lang.String message)
send the message.

Parameters:
message - The message to be sent.
Returns:
True if the message is pushed. False if it is dropped.

push

public boolean push(ProtocolMessage message,
                    ProtocolSession fromSession)
             throws ProtocolException
Print the message received.

Specified by:
push in class ProtocolSession
Parameters:
message - The message received.
fromSession - The protocol session which sent the message.
Returns:
True if the message is pushed. False if it is dropped.
Throws:
ProtocolException - If a protocol session exception occurs.

setDestination

public void setDestination(int id)
Set the destination node

Parameters:
id - The destination node ID

getDestination

public int getDestination()
Return the destination ID

Returns:
The destination ID

setBandwidth

public void setBandwidth(double bandwidth)
Set the bandwidth requested

Parameters:
bandwidth - The requested bandwidth

getBandwidth

public double getBandwidth()
Get the requested bandwidth

Returns:
the requested bandwidth

setRoutingAlgorithm

public void setRoutingAlgorithm(java.lang.String name)
Set the routing algorithm

Parameters:
name - The name of the routing algorithm to be used

getRoutingAlgorithm

public java.lang.String getRoutingAlgorithm()
Return the name of the routing algorithm to be used

Returns:
The name of the routing algorithm to be used

setWavelengthAlgorithm

public void setWavelengthAlgorithm(java.lang.String name)
Set the wavelength algorithm

Parameters:
name - The name of the wavelength algorithm to be used

getWavelengthAlgorithm

public java.lang.String getWavelengthAlgorithm()
Return the name of the wavelength algorithm to be used

Returns:
The name of the wavelength algorithm to be used

setDelay

public void setDelay(double delay)
Set the delay between two transmissions

Parameters:
delay - The delay between two transmissions

getDelay

public double getDelay()
Get the delay between two transmissions

Returns:
The delay between two transmissions

toDML

public java.lang.String toDML()
This method generates the DML configuration for the options of this class.

Specified by:
toDML in interface DMLDump
Returns:
The DML configuration as String