org.jlab.coda.et
Class SystemConfig

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

public class SystemConfig
extends java.lang.Object

This class defines a configuration for the creation of an ET system.


Field Summary
(package private)  int attachmentsMax
          Maximum number of attachments.
(package private)  java.util.HashSet broadcastAddrs
          Set of all local broadcast addresses to listen on (in String form).
(package private)  int debug
          Debug level.
(package private)  int eventSize
          Size of the "normal" event in bytes.
(package private)  java.util.HashSet multicastAddrs
          Set of all multicast addresses to listen on (in String form).
(package private)  int multicastPort
          UDP port number for thread responding to users' multicasts looking for the ET system.
(package private)  int numEvents
          Total number of events.
(package private)  int serverPort
          TCP port number for the thread establishing connections with users, otherwise referred to as the ET server thread.
(package private)  int stationsMax
          Maximum number of station.
(package private)  int udpPort
          UDP port number for thread responding to users' broadcasts looking for the ET system.
 
Constructor Summary
SystemConfig()
          Creates a new SystemConfig object using default parameters.
SystemConfig(SystemConfig config)
          Creates a new SystemConfig object from an existing one.
 
Method Summary
 void addBroadcastAddr(java.lang.String bCastAddr)
          Adds a broadcast address to the set.
 void addMulticastAddr(java.lang.String mCastAddr)
          Adds a multicast address to the set.
 int getAttachmentsMax()
          Gets the maximum number of attachments.
 java.util.Set getBroadcastAddrs()
          Gets the set of broadcast addresses.
 java.lang.String[] getBroadcastStrings()
          Gets the broadcast addresses as a String array.
 int getDebug()
          Gets the debug level.
 int getEventSize()
          Gets the size of the normal events in bytes.
 java.util.Set getMulticastAddrs()
          Gets the set of multicast addresses.
 int getMulticastPort()
          Gets the multicast port number.
 java.lang.String[] getMulticastStrings()
          Gets the multicast addresses as a String array.
 int getNumEvents()
          Gets the total number of events.
 int getServerPort()
          Gets the tcp server port number.
 int getStationsMax()
          Gets the maximum number of stations.
 int getUdpPort()
          Gets the udp port number.
 void removeBroadcastAddr(java.lang.String addr)
          Removes a broadcast address from the set.
 void removeMulticastAddr(java.lang.String addr)
          Removes a multicast address from the set.
 void setAttachmentsMax(int num)
          Sets the maximum number of attachments.
 void setDebug(int level)
          Sets the debug level.
 void setEventSize(int size)
          Sets the event size in bytes.
 void setMulticastPort(int port)
          Sets the multicast port number.
 void setNumEvents(int num)
          Sets the total number of events.
 void setServerPort(int port)
          Sets the tcp server port number.
 void setStationsMax(int num)
          Sets the maximum number of stations.
 void setUdpPort(int port)
          Sets the udp port number.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

numEvents

int numEvents
Total number of events.


eventSize

int eventSize
Size of the "normal" event in bytes. This is the memory allocated to each event upon starting up the ET system.


stationsMax

int stationsMax
Maximum number of station.


attachmentsMax

int attachmentsMax
Maximum number of attachments.


debug

int debug
Debug level. This may have values of Constants.debugNone meaning print nothing, Constants.debugSevere meaning print only the severest errors, Constants.debugError meaning print all errors, Constants.debugWarn meaning print all errors and warnings, and finally Constants.debugInfo meaning print all errors, warnings, and informative messages.


udpPort

int udpPort
UDP port number for thread responding to users' broadcasts looking for the ET system.


serverPort

int serverPort
TCP port number for the thread establishing connections with users, otherwise referred to as the ET server thread.


multicastPort

int multicastPort
UDP port number for thread responding to users' multicasts looking for the ET system. In Java, a multicast socket cannot have same port number as another datagram socket.


multicastAddrs

java.util.HashSet multicastAddrs
Set of all multicast addresses to listen on (in String form).


broadcastAddrs

java.util.HashSet broadcastAddrs
Set of all local broadcast addresses to listen on (in String form).

Constructor Detail

SystemConfig

public SystemConfig()
Creates a new SystemConfig object using default parameters. The default parameters are: number of events = Constants.defaultNumEvents, event size = Constants.defaultEventSize, max number of stations = Constants.defaultStationsMax, max number of attachments = Constants.defaultAttsMax, debug level = Constants.debugError, udp port = Constants.broadcastPort, server (tcp) port = Constants.serverPort, and multicasting port = Constants.multicastPort.


SystemConfig

public SystemConfig(SystemConfig config)
Creates a new SystemConfig object from an existing one.

Method Detail

getNumEvents

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

Returns:
total number of events

getEventSize

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

Returns:
size of normal events in bytes

getStationsMax

public int getStationsMax()
Gets the maximum number of stations.

Returns:
maximum number of stations

getAttachmentsMax

public int getAttachmentsMax()
Gets the maximum number of attachments.

Returns:
maximum number of attachments

getDebug

public int getDebug()
Gets the debug level.

Returns:
debug level

getUdpPort

public int getUdpPort()
Gets the udp port number.

Returns:
udp port number

getServerPort

public int getServerPort()
Gets the tcp server port number.

Returns:
tcp server port number

getMulticastPort

public int getMulticastPort()
Gets the multicast port number.

Returns:
multicast port number

getMulticastAddrs

public java.util.Set getMulticastAddrs()
Gets the set of multicast addresses.

Returns:
set of multicast addresses

getBroadcastAddrs

public java.util.Set getBroadcastAddrs()
Gets the set of broadcast addresses.

Returns:
set of broadcast addresses

getMulticastStrings

public java.lang.String[] getMulticastStrings()
Gets the multicast addresses as a String array.

Returns:
multicast addresses as a String array

getBroadcastStrings

public java.lang.String[] getBroadcastStrings()
Gets the broadcast addresses as a String array.

Returns:
broadcast addresses as a String array

addMulticastAddr

public void addMulticastAddr(java.lang.String mCastAddr)
                      throws EtException
Adds a multicast address to the set.

Parameters:
mCastAddr - multicast address
Throws:
EtException - if the argument is not a multicast address

addBroadcastAddr

public void addBroadcastAddr(java.lang.String bCastAddr)
                      throws EtException
Adds a broadcast address to the set.

Parameters:
bCastAddr - broadcast address
Throws:
EtException - if the argument is not a broadcast address

removeMulticastAddr

public void removeMulticastAddr(java.lang.String addr)
Removes a multicast address from the set.

Parameters:
addr - multicast address

removeBroadcastAddr

public void removeBroadcastAddr(java.lang.String addr)
Removes a broadcast address from the set.

Parameters:
addr - broadcast address

setNumEvents

public void setNumEvents(int num)
                  throws EtException
Sets the total number of events.

Parameters:
num - total number of events
Throws:
EtException - if the argument is less than 1

setEventSize

public void setEventSize(int size)
                  throws EtException
Sets the event size in bytes.

Parameters:
size - event size in bytes
Throws:
EtException - if the argument is less than 1 byte

setStationsMax

public void setStationsMax(int num)
                    throws EtException
Sets the maximum number of stations.

Parameters:
num - maximum number of stations
Throws:
EtException - if the argument is less than 2

setAttachmentsMax

public void setAttachmentsMax(int num)
                       throws EtException
Sets the maximum number of attachments.

Parameters:
num - maximum number of attachments
Throws:
EtException - if the argument is less than 1

setDebug

public void setDebug(int level)
              throws EtException
Sets the debug level.

Parameters:
level - debug level
Throws:
EtException - if the argument has a bad value

setUdpPort

public void setUdpPort(int port)
                throws EtException
Sets the udp port number.

Parameters:
port - udp port number
Throws:
EtException - if the argument is less than 1024

setServerPort

public void setServerPort(int port)
                   throws EtException
Sets the tcp server port number.

Parameters:
port - tcp server port number
Throws:
EtException - if the argument is less than 1024

setMulticastPort

public void setMulticastPort(int port)
                      throws EtException
Sets the multicast port number.

Parameters:
port - multicast port number
Throws:
EtException - if the argument is less than 1024