|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.sun.comm.Portmapping
This class is used to handle all portmapping for javax.comm. it maintains the active list of exposedCommPortIdentifier
objects, and is used to build and refresh thePortmapDatabase
all alias mappings according to the portmap.properties file, which it parses and maintains an internal database to reflect.This class populates the list of
CommPortIdentifiers
that will be seen by the application. This view of the ports and their aliases is determined by the portmap.properties configuration, which Sun Rays are on line, which dongles they have connected, whether or not the user is running on a Sun Ray session, and if in a Sun Ray session, which DTU the user is on.If no portmap.properties file exists, server ports are displayed according to the
PathBundle
passed intorefreshPortDatabase()
. Sun Ray dongle paths are detected automatically, so no list need be provided. By default, Sun Ray dongle ports are shown by the basename of their path in the Sun Ray device tree (see the manpage for basename(1)), but the default aliases can be overridden.Logical name definitions in the portmap.properties file can be used to create
CommPortIdentifier
referring server ports using names other other than their physical paths, or to omit certain paths (for example, /dev/cua/a and /dev/cua/b are good candidates since they overlap with /dev/term/a and /dev/term/b, albeit with certain implications).
Format of portmap.properties file
Field Summary | |
private static int |
DEFAULT_ALIASING
|
private static int |
DONGLE_ALIASING
|
private static CommDriver |
driver
|
private static int |
PARALLEL
|
private static int |
SERIAL
|
Constructor Summary | |
Portmapping()
|
Method Summary | |
static void |
add(CommPortIdentifier cpi)
Get current list of CommPortIdentifiers |
static java.util.Enumeration |
getCommPortIdentifiers()
Get current list of CommPortIdentifiers |
static java.util.Enumeration |
refreshPortDatabase(java.lang.String portMapFilename,
CommDriver driver,
PathBundle serverPorts)
Parses portmap.properties, building new port database accordingly. |
private static void |
registerCommPorts(PathBundle serverPorts)
Scan ports on system, registering them according to portmapping rules. |
static java.lang.String |
translatePortname(java.lang.String portName)
Attempt to translate the portname. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private static CommDriver driver
private static final int SERIAL
private static final int PARALLEL
private static final int DEFAULT_ALIASING
private static final int DONGLE_ALIASING
Constructor Detail |
public Portmapping()
Method Detail |
public static java.util.Enumeration refreshPortDatabase(java.lang.String portMapFilename, CommDriver driver, PathBundle serverPorts) throws java.io.IOException
portMapFilename
- full path to
portmap.propertiesdriver
- implementation of CommPort driver to use during
CommPortIdentifier
creation serverPorts
- list of server-side physical comm ports
and/or directories containing them.
Enumeration
containing up-to-date list of
commPortIdentifiers
java.io.IOException
loadPortmapFile
,
translatePortname
private static void registerCommPorts(PathBundle serverPorts)
Creates a new CommPortIdentifier
for each port on the system that meets
the criteria laid out in the
portmap.properties file.
Behavior of this
comm. port registration is different depending on whether javax.comm is running
in a Sun Ray session or not.
- javax.comm Running inside Sun Ray session:
- Register server side ports assigned to this DTU
- Register dongle ports connected DTU if no other aliases reference them, using port device basename as default alias. The full path to Sun Ray dongle ports is not used, because the path is too long.
- Register session-local automatic logically named dongle ports. In many cases, this is the preferred way to refer to Sun Ray dongle ports.
- javax.comm Running outside of a Sun Ray session
- Register server-side ports that aren't explicitly hidden with a [hide] assignment, and which are session independent, (ie. aren't server-side port that are revealed to sessions running on particular DTU).
If aliases exist for the specified server-side paths, use those names instead.
- Register DTU specific automatic logical name assignments, if we're running as super user and specified DTUs are online.
serverPorts
- server-side physical ports to register as
determined by
portmap.properties.
public static java.util.Enumeration getCommPortIdentifiers()
CommPortIdentifiers
CommPortIdentifiers
public static void add(CommPortIdentifier cpi)
CommPortIdentifiers
cpi
- CommPortIdentifier we're adding to the list.public static java.lang.String translatePortname(java.lang.String portName) throws java.io.IOException
java.io.IOException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |