org.jlab.coda.et
Class SystemOpen

java.lang.Object
  extended byorg.jlab.coda.et.SystemOpen

public class SystemOpen
extends java.lang.Object

This class opens (finds and connects to) an ET system. The use of this class is hidden from the user. There should be no reason to use it.


Field Summary
(package private)  SystemOpenConfig config
          Object specifying how to open an ET system.
(package private)  int debug
          Debug level.
(package private)  int endian
          Endian value of the opened ET system.
(package private)  int eventSize
          Event size in bytes of the opened ET system.
(package private)  java.lang.String host
          Name of the host the ET system resides on.
(package private)  int language
          Language used to implement the opened ET system.
(package private)  int numEvents
          Total number of events of the opened ET system.
(package private)  java.util.ArrayList respondingHosts
          In case of multiple responding ET systems, a list of their hosts.
(package private)  java.util.ArrayList respondingPorts
          In case of multiple responding ET systems, a list of their ports.
(package private)  java.net.Socket sock
          TCP socket connection established with an ET system's server.
(package private)  int stationSelectInts
          Number of select integers in the opened ET system.
(package private)  int tcpPort
          Port number of the ET system's tcp server.
(package private)  int version
          Major version number of the opened ET system.
 
Constructor Summary
SystemOpen(SystemOpenConfig _config)
          Create a SystemOpen object.
 
Method Summary
 void connect()
          Sets up a TCP socket connection to an ET system.
 void disconnect()
           
 java.lang.String[] getAllHosts()
          Gets all host names when multiple ET systems respond.
 int[] getAllPorts()
          Gets all port numbers when multiple ET systems respond.
 SystemOpenConfig getConfig()
          Gets a copy of the SystemOpenConfig configuration object.
 int getDebug()
          Gets the debug output level.
 int getEndian()
          Gets the endian value of the opened ET system.
 int getEventSize()
          Gets the size of the normal events in bytes of the opened ET system.
 java.lang.String getHost()
          Gets the host name the opened ET system is running on.
 int getLanguage()
          Gets the language used to implement the opened ET system..
 java.lang.String getName()
          Gets the name of the ET system (file).
 int getNumEvents()
          Gets the total number of events of the opened ET system.
 int getPort()
          Gets the tcp server port number of the opened ET system.
 int getSelectInts()
          Gets the number of station select integers of the opened ET system..
 java.net.Socket getSocket()
          Gets the socket connecting this object to the ET system..
 int getVersion()
          Gets the major version number of the opened ET system.
 boolean isConnected()
          Gets whether the ET system is connected (opened) or not.
 void setDebug(int _debug)
          Sets the debug output level.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

config

SystemOpenConfig config
Object specifying how to open an ET system.


sock

java.net.Socket sock
TCP socket connection established with an ET system's server.


host

java.lang.String host
Name of the host the ET system resides on.


tcpPort

int tcpPort
Port number of the ET system's tcp server.


debug

int debug
Debug level. Set by setDebug(int).


endian

int endian
Endian value of the opened ET system.


numEvents

int numEvents
Total number of events of the opened ET system.


eventSize

int eventSize
Event size in bytes of the opened ET system.


version

int version
Major version number of the opened ET system.


stationSelectInts

int stationSelectInts
Number of select integers in the opened ET system.


language

int language
Language used to implement the opened ET system. The possible values are Constants.langJava for Java, Constants.langCpp for C++, and Constants.langC for C.


respondingHosts

java.util.ArrayList respondingHosts
In case of multiple responding ET systems, a list of their hosts.


respondingPorts

java.util.ArrayList respondingPorts
In case of multiple responding ET systems, a list of their ports.

Constructor Detail

SystemOpen

public SystemOpen(SystemOpenConfig _config)
Create a SystemOpen object.

Parameters:
_config - SystemOpenConfig object
Method Detail

setDebug

public void setDebug(int _debug)
              throws EtException
Sets the debug output level. Must be either Constants.debugNone, Constants.debugSevere, Constants.debugError, Constants.debugWarn, or Constants.debugInfo.

Parameters:
_debug - debug level
Throws:
EtException - if bad argument value

getNumEvents

public int getNumEvents()
Gets the total number of events of the opened ET system.

Returns:
total number of events

getEventSize

public int getEventSize()
Gets the size of the normal events in bytes of the opened ET system.

Returns:
size of normal events in bytes

getPort

public int getPort()
Gets the tcp server port number of the opened ET system.

Returns:
tcp server port number

getHost

public java.lang.String getHost()
Gets the host name the opened ET system is running on.

Returns:
host name

getName

public java.lang.String getName()
Gets the name of the ET system (file).

Returns:
ET system name

getEndian

public int getEndian()
Gets the endian value of the opened ET system.

Returns:
endian value

getVersion

public int getVersion()
Gets the major version number of the opened ET system.

Returns:
major ET version number

getLanguage

public int getLanguage()
Gets the language used to implement the opened ET system..

Returns:
language

getSelectInts

public int getSelectInts()
Gets the number of station select integers of the opened ET system..

Returns:
number of select integers

getSocket

public java.net.Socket getSocket()
Gets the socket connecting this object to the ET system..

Returns:
socket

getDebug

public int getDebug()
Gets the debug output level.

Returns:
debug output level

getConfig

public SystemOpenConfig getConfig()
Gets a copy of the SystemOpenConfig configuration object.

Returns:
configuration object

isConnected

public boolean isConnected()
Gets whether the ET system is connected (opened) or not.

Returns:
status of connection to ET system

getAllHosts

public java.lang.String[] getAllHosts()
Gets all host names when multiple ET systems respond.

Returns:
all host names from responding ET systems

getAllPorts

public int[] getAllPorts()
Gets all port numbers when multiple ET systems respond.

Returns:
all port numbers from responding ET systems

connect

public void connect()
             throws java.io.IOException,
                    java.net.UnknownHostException,
                    EtException,
                    EtTooManyException
Sets up a TCP socket connection to an ET system.

Throws:
java.io.IOException - if problems with network comunications
java.net.UnknownHostException - if the host address(es) is(are) unknown
EtException - if the responding ET system has the wrong name, runs a different version of ET, or has a different value for Constants.stationSelectInts
EtTooManyException - if there were more than one valid response when policy is set to Constants.policyError and we are looking either remotely or anywhere for the ET system.

disconnect

public void disconnect()