gov.nist.antd.optical.path
Class OpticalChannel

java.lang.Object
  |
  +--gov.nist.antd.optical.AbstractObject
        |
        +--gov.nist.antd.optical.path.OpticalChannel

public class OpticalChannel
extends AbstractObject

This is an end-to-end connection for a single wavelength.

 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  int id
          The id of this optical channel.
private  int noChannelSegments
          Number of channelsegments assigned to the channel.
private  OpticalPath opticalPath
          The optical path this connection belongs to.
private  OpticalChannelSegment[] segment
          This array contains the optical segments that creates the channel.
private  boolean switchConfigured
          Indicates if the configuration method is already called or not.
private  java.util.Vector wsg
          Waveband Switching Group.
 
Fields inherited from class gov.nist.antd.optical.AbstractObject
INITIAL_ARRAY_SIZE
 
Constructor Summary
OpticalChannel(OpticalPath opticalPath)
          Creates an optical channel connection.
 
Method Summary
 void addChannelSegment(OpticalChannelSegment newSegment)
          Add an optical channel segment.
 boolean configDropSession(ProtocolSession receiver)
          Set the protocol that receive message for this channel
 void configSwitches()
          Configures the switches for this Channel.
 boolean connectEnds(OXCSwitch oxcSrc, int addPort, OXCSwitch oxcDest, int dropPort)
          Connect the channel according to the given parameters
protected  java.lang.Object[] createArray(int size)
          Creates an OpticalChannelSegment array of the specified size.
 void finalize()
          Reset switches if not already done before the Channel will be discarded.
 int getAddPort()
          Find the addPort for this channel
 double getBandwidth()
          Return the bandwidth of this channel.
 int getDropPort()
          Find the dropPort for this channel
 ProtocolSession getDropSession()
          Return the DropSession that receives the messages
 int getID()
          Get the id of this optical channel.
protected  int getNoSegments()
          Returns the number of stored channel segments.
 OpticalPath getOpticalPath()
          Get the optical path this connection belongs to.
 OpticalChannelSegment getSegment(int index)
          Returns the specific segment which belongs to this channel.
 OpticalChannelSegment[] getSegments()
          Returns a copy of the list of channel segments which belong to this channel.
private  OXCSwitch getSwitchBetween(OpticalChannelSegment from, OpticalChannelSegment to)
          Determines the switch that connects two segments.
 java.util.Vector getWsg()
          get the Waveband Switching Group.
 boolean isFailure()
          Determines if the Channel is usable.
 boolean isSwitchConfigured()
          Determines if the Channel is configured for use .
 void removeChannelSegment(OpticalChannelSegment newSegment)
          Removes the given channel segment.
 void resetSwitches()
          Reset the switches for this Channel.
 void setID(int newID)
          Set the id of this optical channel.
protected  void setNoElements(int size)
          Set the number of channel segments.
protected  void setSwitchConfigured(boolean newValue)
          Set the switch status of the Channel.
 void setWsg(java.util.Vector wsg)
          Set the Waveband Switching Group.
 java.lang.String toString()
          Return the textual representatrion of the lambdas of this channel
 
Methods inherited from class gov.nist.antd.optical.AbstractObject
addElement, clear, isElementOf, removeElement
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

id

private int id
The id of this optical channel.


opticalPath

private OpticalPath opticalPath
The optical path this connection belongs to.


noChannelSegments

private int noChannelSegments
Number of channelsegments assigned to the channel.


switchConfigured

private boolean switchConfigured
Indicates if the configuration method is already called or not.


segment

private OpticalChannelSegment[] segment
This array contains the optical segments that creates the channel.


wsg

private java.util.Vector wsg
Waveband Switching Group. This Vector contains all instances of OpticalChannel that belongs to the identical group.

Constructor Detail

OpticalChannel

public OpticalChannel(OpticalPath opticalPath)
Creates an optical channel connection.

Parameters:
opticalPath - the path the channel used for.
Method Detail

addChannelSegment

public void addChannelSegment(OpticalChannelSegment newSegment)
Add an optical channel segment. The given segment must not belong to the same optical link an other segment in this channel belongs to.

Parameters:
newSegment - The segment that has to be added to this channel.

getID

public int getID()
Get the id of this optical channel.

Returns:
The id.

getOpticalPath

public OpticalPath getOpticalPath()
Get the optical path this connection belongs to.

Returns:
The attribute opticalPath.

getWsg

public java.util.Vector getWsg()
get the Waveband Switching Group.

Returns:
The attribute wsg.

isFailure

public boolean isFailure()
Determines if the Channel is usable.

Returns:
true if an failure occured in one or more segments;otherwise false.

getSegments

public OpticalChannelSegment[] getSegments()
Returns a copy of the list of channel segments which belong to this channel.

Returns:
A copy of the channel segment list.

getSegment

public OpticalChannelSegment getSegment(int index)
Returns the specific segment which belongs to this channel.

Parameters:
index - The index of the requested segment.
Returns:
the specific segment which belongs to this channel.
Since:
2.0

getBandwidth

public double getBandwidth()
Return the bandwidth of this channel.

Returns:
double The bandwidth of this channel

getNoSegments

protected int getNoSegments()
Returns the number of stored channel segments.

Returns:
The number of segments.

getSwitchBetween

private OXCSwitch getSwitchBetween(OpticalChannelSegment from,
                                   OpticalChannelSegment to)
Determines the switch that connects two segments.

Parameters:
from - the incomming segment.
to - the outgoing segment.
Returns:
The OXCSwitch between both or null.
Since:
2.0

isSwitchConfigured

public boolean isSwitchConfigured()
Determines if the Channel is configured for use .

Returns:
if the switches are configured or not.

setID

public void setID(int newID)
           throws IllegalIDException
Set the id of this optical channel.

Parameters:
newID - The new id.
Throws:
IllegalIDException - if the parameter is invalid.

setWsg

public void setWsg(java.util.Vector wsg)
Set the Waveband Switching Group.

Parameters:
wsg - The wsg vector.

removeChannelSegment

public void removeChannelSegment(OpticalChannelSegment newSegment)
Removes the given channel segment. This method DOES NOT check if the channel is in use or not. It even so does not reconfigure the switch.

Parameters:
newSegment - The segment to remove.

setNoElements

protected void setNoElements(int size)
Set the number of channel segments.

Specified by:
setNoElements in class AbstractObject
Parameters:
size - the new number of channel segments.

setSwitchConfigured

protected void setSwitchConfigured(boolean newValue)
Set the switch status of the Channel. Additional verbose description.

Parameters:
newValue - true if the switch is configured, otherwise false.

createArray

protected java.lang.Object[] createArray(int size)
Creates an OpticalChannelSegment array of the specified size.

Specified by:
createArray in class AbstractObject
Parameters:
size - The size of the segment array.
Returns:
The array of OpticalChannelSegments.

configSwitches

public void configSwitches()
                    throws OpticalChannelException,
                           InvalidConnectionException
Configures the switches for this Channel.

Throws:
OpticalChannelException - Will be thrown if a switch is missing between two segments.
InvalidConnectionException - will be throws by the OXCSwitch
Since:
2.0

resetSwitches

public void resetSwitches()
                   throws OpticalChannelException,
                          InvalidConnectionException
Reset the switches for this Channel. Even if an error occurs the method tries to reset as much as possible switches.

Throws:
OpticalChannelException - Will be thrown if a switch is missing between two segments.
InvalidConnectionException - Will be throws by the OXCSwitch
Since:
2.0

finalize

public void finalize()
Reset switches if not already done before the Channel will be discarded.

Overrides:
finalize in class java.lang.Object

toString

public java.lang.String toString()
Return the textual representatrion of the lambdas of this channel

Overrides:
toString in class java.lang.Object
Returns:
The String that contains the information of the segments

connectEnds

public boolean connectEnds(OXCSwitch oxcSrc,
                           int addPort,
                           OXCSwitch oxcDest,
                           int dropPort)
Connect the channel according to the given parameters

Parameters:
oxcSrc - The oxcswitch at the source node
addPort - The addPort number to connect with
oxcDest - The oxcswitch at the destination node
dropPort - The dropPort number to connect with
Returns:
True if the connection is done.

configDropSession

public boolean configDropSession(ProtocolSession receiver)
Set the protocol that receive message for this channel

Parameters:
receiver - The protocol receiver
Returns:
True if the configuration is done.

getAddPort

public int getAddPort()
Find the addPort for this channel

Returns:
The id of the AddPort or -1 if not connected

getDropPort

public int getDropPort()
Find the dropPort for this channel

Returns:
The id of the dropPort or -1 if not connected

getDropSession

public ProtocolSession getDropSession()
Return the DropSession that receives the messages

Returns:
The DropSession that recevies the messages or null