com.sun.comm
Class PortmapEntry

java.lang.Object
  extended bycom.sun.comm.PortmapEntry

class PortmapEntry
extends java.lang.Object

These are the port map entries for the PortmapDatabase. Lines from the portmap.properties file are passed to the constructor to be parsed. The resulting object represents the parsed state of the logical names and their corresponding attributes. Methods are provided to access the portmap entries attributes.

During parsng the PortmapDatabase may be accessed, depending on the references being made.

All references (such as ALNs) are resolved during the parsing of the portmap.properties This includes references to Sun Rays and Sun Ray dongle paths. Sun Ray 'DTU aliases' must be defined (mapping a DTU name to a DTU's terminal ID) before any other references to the DTU can be made in portmap.properties When a DTU alias is assigned, this class checks that the DTU is online, or will log an error (if -Ddebug_portmap was specified on the command line), and throw an exception.

Automatic name references are resolved to full paths to dongle ports during parsing as well. Any ALNs that cannot be resolved result in an error message and an exception thrown as well. This can happen, for example, if a reference is made to a dongle that doesn't exist or a dongle that doesn't have as many ports as the reference requires.

Exceptions are assumed simply to mean that the entry will not be placed in the database and that portmap.properties will continue to be parsed.

Since:
3.0.0
Author:
Paul Klissner

Field Summary
private  Alias alnAlias
           
private  java.lang.String alnPath
           
private  int alnPortType
           
private  boolean assignedToDTU
           
private  boolean dtuAlias
           
private  java.lang.String dtuName
           
private  boolean dtuSpecificALN
           
private  java.lang.String equatedName
           
private  boolean globallyVisible
           
private  boolean hidingAlias
           
private  java.lang.String logicalName
           
private  boolean sessionIndependent
           
private  boolean sessionLocalALN
           
private  java.lang.String terminalId
           
 
Constructor Summary
(package private) PortmapEntry(java.lang.String line)
          Construct a new PortmapEntry from a port map property string
(package private) PortmapEntry(java.lang.String logicalName, java.lang.String equatedName)
          This constructor creates an PortmapEntry of type 'alias'
 
Method Summary
private static java.lang.String formatTerminalId(java.lang.String rawTermId)
          Takes a raw terminal ID, which can be a valid MAC address, or a valid Sun Ray terminal ID.
 Alias getALNalias()
          Get the alias representing the equated name of this ALN.
 java.lang.String getALNpath()
          Get physical path represented by this ALN
 int getALNportType()
          Get the type of port this ALN maps to.
private  java.lang.String getDonglePortPath(Alias alnAlias, int type, java.lang.String termId)
          Look up path for the specified ALN alias
 java.lang.String getDTUname()
          Get DTU name associated with this port mapping entry.
 java.lang.String getDTUterminalId()
          Get DTU terminal id portion of this port mapping entry
 java.lang.String getEquatedTarget()
          Get equated name portion of this port mapping entry
 java.lang.String getLogicalName()
          Get logical name portion of this port mapping entry
 boolean isAssignedToDTU()
          Indicates whether this port map entry is DTU Specific.
 boolean isDTUalias()
          Indicates whether this port map entry is a DTU Alias
 boolean isDTUspecificALN()
          Return true if this PortmapEntry is an Automatic Logical Name that refers to a specific Sun Ray Desktop Unit.
 boolean isGloballyVisible()
          Return true if this PortmapEntry is a Globally Visible server port.
 boolean isHidden()
          Indicates whether this port map entry is a "hiding alias" which is used to make the corresponding port disappear from the CommPortIdentifier list.
 boolean isSessionIndependent()
          Indicates whether this port map entry is a session Independent Assignment
 boolean isSessionLocalALN()
          Return true if this PortmapEntry is an Automatic Logical Name that refers to the DTU the local session is running on.
private static boolean isTerminalId(java.lang.String hypothetical)
          Determines if argument is a valid Sun Ray terminal ID based on its format.
 Alias toAlias()
          Convert this port map entry to an Alias based on the logical name given during construction.
 java.lang.String toString()
          Displays objects of this Class in a more legible formatted representation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

logicalName

private java.lang.String logicalName

equatedName

private java.lang.String equatedName

terminalId

private java.lang.String terminalId

dtuName

private java.lang.String dtuName

alnAlias

private Alias alnAlias

alnPath

private java.lang.String alnPath

alnPortType

private int alnPortType

dtuAlias

private boolean dtuAlias

assignedToDTU

private boolean assignedToDTU

dtuSpecificALN

private boolean dtuSpecificALN

sessionLocalALN

private boolean sessionLocalALN

sessionIndependent

private boolean sessionIndependent

hidingAlias

private boolean hidingAlias

globallyVisible

private boolean globallyVisible
Constructor Detail

PortmapEntry

PortmapEntry(java.lang.String line)
       throws java.io.IOException
Construct a new PortmapEntry from a port map property string

Parameters:
line - A non-blank, non-comment line of the format defined for portmap.properties.

PortmapEntry

PortmapEntry(java.lang.String logicalName,
             java.lang.String equatedName)
This constructor creates an PortmapEntry of type 'alias'

Parameters:
logicalName - Alias name
equatedName - target name
Method Detail

getDonglePortPath

private java.lang.String getDonglePortPath(Alias alnAlias,
                                           int type,
                                           java.lang.String termId)
                                    throws java.io.IOException
Look up path for the specified ALN alias

Parameters:
alnAlias - alias of ALN
type - type of port (serial or parallel)
termId - the terminal ID for which the ALN is targetted (null if session local).
Returns:
path to port (or null if not ALN)
Throws:
IOException.
java.io.IOException

toAlias

public Alias toAlias()
Convert this port map entry to an Alias based on the logical name given during construction.

Returns:
A new Alias object associated with logical name.

getLogicalName

public java.lang.String getLogicalName()
Get logical name portion of this port mapping entry

Returns:
logical name.
See Also:
loadPortmapFile

getEquatedTarget

public java.lang.String getEquatedTarget()
Get equated name portion of this port mapping entry

Returns:
equated name.
See Also:
loadPortmapFile

getDTUterminalId

public java.lang.String getDTUterminalId()
Get DTU terminal id portion of this port mapping entry

Returns:
DTU terminal ID (or null if this isn't a DTU alias).
See Also:
loadPortmapFile

getDTUname

public java.lang.String getDTUname()
Get DTU name associated with this port mapping entry.

Returns:
DTU name (or null if this isn't a DTU alias, or making reference to one).
See Also:
loadPortmapFile

getALNalias

public Alias getALNalias()
Get the alias representing the equated name of this ALN.

Returns:
Alias representing ALN, or null if not an ALN

getALNportType

public int getALNportType()
Get the type of port this ALN maps to.

Returns:
CommPortIdentifier port type this ALN represents.

getALNpath

public java.lang.String getALNpath()
Get physical path represented by this ALN

Returns:
path, or null if not an ALN.

isTerminalId

private static boolean isTerminalId(java.lang.String hypothetical)
Determines if argument is a valid Sun Ray terminal ID based on its format.

Parameters:
hypothetical - String Argument to check for validity.
Returns:
boolean True if argument has valid format.

isDTUalias

public boolean isDTUalias()
Indicates whether this port map entry is a DTU Alias

Returns:
True if dtu alias.
See Also:
loadPortmapFile

isAssignedToDTU

public boolean isAssignedToDTU()
Indicates whether this port map entry is DTU Specific.

Returns:
True if DTU-specific
See Also:
loadPortmapFile

isSessionIndependent

public boolean isSessionIndependent()
Indicates whether this port map entry is a session Independent Assignment

Returns:
True if session independent port assignment.
See Also:
loadPortmapFile

isHidden

public boolean isHidden()
Indicates whether this port map entry is a "hiding alias" which is used to make the corresponding port disappear from the CommPortIdentifier list.

Returns:
True if hiding alias
See Also:
loadPortmapFile

isSessionLocalALN

public boolean isSessionLocalALN()
Return true if this PortmapEntry is an Automatic Logical Name that refers to the DTU the local session is running on.

Returns:
true if this alias is a DTU-specific ALN
See Also:
loadPortmapFile

isGloballyVisible

public boolean isGloballyVisible()
Return true if this PortmapEntry is a Globally Visible server port.

Returns:
true if this alias is a DTU-specific ALN
See Also:
loadPortmapFile

isDTUspecificALN

public boolean isDTUspecificALN()
Return true if this PortmapEntry is an Automatic Logical Name that refers to a specific Sun Ray Desktop Unit.

Returns:
true if this alias is a DTU-specific ALN
See Also:
loadPortmapFile

formatTerminalId

private static java.lang.String formatTerminalId(java.lang.String rawTermId)
Takes a raw terminal ID, which can be a valid MAC address, or a valid Sun Ray terminal ID.

  • xx:xx:xx:xx:xx:xx
  • IEE802.xxxxxxxxxxxx
And returns it as a properly formatted Sun Ray terminal ID of form IEEE802.xxxxxxxxxxxx

Parameters:
rawTermId - String The value to validate and format.
Returns:
String Properly formatted value or null, if argument presented was invalid.

toString

public java.lang.String toString()
Displays objects of this Class in a more legible formatted representation.

Returns:
Formatted string representing state of the current object.