org.jlab.coda.et
Class SystemOpenConfig

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

public class SystemOpenConfig
extends java.lang.Object

This class defines parameters used to open an ET system.


Field Summary
(package private)  java.util.HashSet broadcastAddrs
          Local subnet broadcast addresses.
(package private)  int contactMethod
          Means used to contact an ET system.
(package private)  java.lang.String host
          Either ET system host name or destination of broadcasts and multicasts.
(package private)  java.util.HashSet multicastAddrs
          Multicast addresses.
(package private)  int multicastPort
          Port number to multicast to.
(package private)  java.lang.String name
          ET system name.
(package private)  int responsePolicy
          Policy on what to do about multiple responding ET systems to a broadcast or multicast.
(package private)  int tcpPort
          TCP server port number of the ET system.
(package private)  int ttl
          Time-to_live value for multicasting.
(package private)  int udpPort
          UDP port number for broadcasting or sending udp packets to known hosts.
 
Constructor Summary
SystemOpenConfig(java.lang.String etName, java.lang.String hostName, java.util.Collection bAddrs, java.util.Collection mAddrs, int method, int tPort, int uPort, int mPort, int ttlNum, int policy)
          Most general constructor for creating a new SystemOpenConfig object.
SystemOpenConfig(java.lang.String etName, java.lang.String hostName, java.util.Collection bAddrs, int uPort)
          Constructor for broadcasting.
SystemOpenConfig(java.lang.String etName, java.lang.String hostName, java.util.Collection mAddrs, int mPort, int ttlNum)
          Constructor for multicasting.
SystemOpenConfig(java.lang.String etName, java.lang.String hostName, java.util.Collection mAddrs, int uPort, int mPort, int ttlNum)
          Constructor for multicasting.
SystemOpenConfig(java.lang.String etName, java.lang.String hostName, int tPort)
          Constructor for connecting directly to tcp server.
SystemOpenConfig(SystemOpenConfig config)
          Constructor to create a new SystemOpenConfig object from another.
 
Method Summary
 void addBroadcastAddr(java.lang.String addr)
          Adds a broadcast address to the set.
 void addMulticastAddr(java.lang.String addr)
          Adds a multicast address to the set.
 java.util.HashSet getBroadcastAddrs()
          Gets local subnet broadcast addresses (as a set of Strings).
 int getContactMethod()
          Gets the means used to contact an ET system.
 java.lang.String getEtName()
          Gets the ET system name.
 java.lang.String getHost()
          Gets the ET system host name or broad/multicast destination.
 java.util.HashSet getMulticastAddrs()
          Gets multicast addresses (as set of Strings).
 int getMulticastPort()
          Gets port number to multicast to.
 int getNumBroadcastAddrs()
          Gets the number of local subnet broadcast addresses.
 int getNumMulticastAddrs()
          Gets the number of multicast addresses.
 int getResponsePolicy()
          Gets policy on what to do about multiple responding ET systems to a broadcast or multicast.
 int getTcpPort()
          Gets TCP server port number of the ET system.
 int getTTL()
          Gets time-to_live value for multicasting.
 int getUdpPort()
          Gets UDP port number for broadcasting or sending udp packets to known hosts.
 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 setBroadcastAddrs(java.util.Collection addrs)
          Adds a collection of broadcast addresses to the set.
 void setContactMethod(int method)
          Sets the means or method of contacting an ET system.
 void setEtName(java.lang.String etName)
          Sets the ET system name.
 void setHost(java.lang.String hostName)
          Sets the ET system host name or broad/multicast destination.
 void setMulticastAddrs(java.util.Collection addrs)
          Adds a collection of multicast addresses to the set.
 void setMulticastPort(int port)
          Sets the port number to multicast to.
 void setResponsePolicy(int policy)
          Sets the policy on what to do about multiple responding ET systems to a broadcast or multicast.
 void setTcpPort(int port)
          Sets the TCP server port number of the ET system.
 void setTTL(int ttlNum)
          Sets the Time-to_live value for multicasting.
 void setUdpPort(int port)
          Sets the UDP port number for broadcastiong and sending udp packets to known hosts.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

name

java.lang.String name
ET system name.


host

java.lang.String host
Either ET system host name or destination of broadcasts and multicasts.


broadcastAddrs

java.util.HashSet broadcastAddrs
Local subnet broadcast addresses.


multicastAddrs

java.util.HashSet multicastAddrs
Multicast addresses.


contactMethod

int contactMethod
Means used to contact an ET system. The possible values are Constants.broadcast for broadcasting, Constants.multicast for multicasting, Constants.direct for connecting directly to the ET tcp server, Constants.broadAndMulticast for using both broadcasting and multicasting, and Constants.udpToHost for sending a udp packet to a known host to find an ET system.


udpPort

int udpPort
UDP port number for broadcasting or sending udp packets to known hosts.


tcpPort

int tcpPort
TCP server port number of the ET system.


multicastPort

int multicastPort
Port number to multicast to. In Java, a multicast socket cannot have same port number as another datagram socket.


ttl

int ttl
Time-to_live value for multicasting.


responsePolicy

int responsePolicy
Policy on what to do about multiple responding ET systems to a broadcast or multicast. The possible values are Constants.policyFirst which chooses the first ET system to respond, Constants.policyLocal which chooses the first local ET system to respond and if none then the first response, or Constants.policyError which throws an EtTooManyException exception.

Constructor Detail

SystemOpenConfig

public SystemOpenConfig(java.lang.String etName,
                        java.lang.String hostName,
                        java.util.Collection bAddrs,
                        java.util.Collection mAddrs,
                        int method,
                        int tPort,
                        int uPort,
                        int mPort,
                        int ttlNum,
                        int policy)
                 throws EtException
Most general constructor for creating a new SystemOpenConfig object.

Parameters:
etName - ET system name
hostName - ET system host name or destination of broad/multicasts
bAddrs - Collection of local subnet broadcast addresses (as Strings)
mAddrs - Collection of multicast addresses (as Strings)
method - Means used to contact an ET system
tPort - TCP server port number of the ET system
uPort - UDP port number for broadcasting or sending udp packets to known hosts
mPort - Port number to multicast to
ttlNum - Time-to_live value for multicasting
policy - Policy on what to do about multiple responding ET systems to a broadcast or multicast
Throws:
EtException - if method is not Constants.broadcast, Constants.multicast, Constants.direct, Constants.broadAndMulticast, or Constants.udpToHost.
EtException - if method is not direct and no broad/multicast addresses were specified, or if method is direct and no actual host name was specified.
EtException - if port numbers are < 1024 or > 65535
EtException - if ttl is < 0 or > 254
EtException - if policy is not Constants.policyFirst, Constants.policyLocal, or Constants.policyError

SystemOpenConfig

public SystemOpenConfig(java.lang.String etName,
                        java.lang.String hostName,
                        java.util.Collection bAddrs,
                        int uPort)
                 throws EtException
Constructor for broadcasting. First responder is chosen.

Parameters:
etName - ET system name
hostName - ET system host name or destination of broadcasts
bAddrs - Collection of local subnet broadcast addresses (as Strings)
uPort - UDP port number to broadcast to
Throws:
EtException - if no broadcast addresses were specified
EtException - if port number is < 1024 or > 65535

SystemOpenConfig

public SystemOpenConfig(java.lang.String etName,
                        java.lang.String hostName,
                        java.util.Collection mAddrs,
                        int mPort,
                        int ttlNum)
                 throws EtException
Constructor for multicasting. First responder is chosen.

Parameters:
etName - ET system name
hostName - ET system host name or destination of multicasts
mAddrs - Collection of multicast addresses (as Strings)
mPort - Port number to multicast to
ttlNum - Time-to_live value for multicasting
Throws:
EtException - if no multicast addresses were specified
EtException - if port number is < 1024 or > 65535, or ttl is < 0 or > 254

SystemOpenConfig

public SystemOpenConfig(java.lang.String etName,
                        java.lang.String hostName,
                        java.util.Collection mAddrs,
                        int uPort,
                        int mPort,
                        int ttlNum)
                 throws EtException
Constructor for multicasting. First responder is chosen.

Parameters:
etName - ET system name
hostName - ET system host name or destination of multicasts
mAddrs - Collection of multicast addresses (as Strings)
uPort - Port number to send direct udp packet to
mPort - Port number to multicast to
ttlNum - Time-to_live value for multicasting
Throws:
EtException - if no multicast addresses were specified
EtException - if port numbers are < 1024 or > 65535, or ttl is < 0 or > 254

SystemOpenConfig

public SystemOpenConfig(java.lang.String etName,
                        java.lang.String hostName,
                        int tPort)
                 throws EtException
Constructor for connecting directly to tcp server. First responder is chosen.

Parameters:
etName - ET system name
hostName - ET system host name
tPort - TCP server port number of the ET system
Throws:
EtException - if no actual host name was specified.
EtException - if port number is < 1024 or > 65535

SystemOpenConfig

public SystemOpenConfig(SystemOpenConfig config)
Constructor to create a new SystemOpenConfig object from another.

Method Detail

getEtName

public java.lang.String getEtName()
Gets the ET system name.

Returns:
ET system name

getHost

public java.lang.String getHost()
Gets the ET system host name or broad/multicast destination.

Returns:
ET system host name or broad/multicast destination

getBroadcastAddrs

public java.util.HashSet getBroadcastAddrs()
Gets local subnet broadcast addresses (as a set of Strings).

Returns:
local subnet broadcast addresses (as a set of Strings)

getMulticastAddrs

public java.util.HashSet getMulticastAddrs()
Gets multicast addresses (as set of Strings).

Returns:
multicast addresses (as set of Strings)

getContactMethod

public int getContactMethod()
Gets the means used to contact an ET system.

Returns:
means used to contact an ET system

getResponsePolicy

public int getResponsePolicy()
Gets policy on what to do about multiple responding ET systems to a broadcast or multicast.

Returns:
policy on what to do about multiple responding ET systems to a broadcast or multicast

getUdpPort

public int getUdpPort()
Gets UDP port number for broadcasting or sending udp packets to known hosts.

Returns:
UDP port number for broadcast or sending udp packets to known hosts

getTcpPort

public int getTcpPort()
Gets TCP server port number of the ET system.

Returns:
TCP server port number of the ET system

getMulticastPort

public int getMulticastPort()
Gets port number to multicast to.

Returns:
port number to multicast to

getTTL

public int getTTL()
Gets time-to_live value for multicasting.

Returns:
time-to_live value for multicasting

getNumBroadcastAddrs

public int getNumBroadcastAddrs()
Gets the number of local subnet broadcast addresses.

Returns:
the number of local subnet broadcast addresses

getNumMulticastAddrs

public int getNumMulticastAddrs()
Gets the number of multicast addresses.

Returns:
the number of multicast addresses

setEtName

public void setEtName(java.lang.String etName)
Sets the ET system name.

Parameters:
etName - ET system name

setHost

public void setHost(java.lang.String hostName)
Sets the ET system host name or broad/multicast destination.


removeBroadcastAddr

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

Parameters:
addr - broadcast address to be removed

removeMulticastAddr

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

Parameters:
addr - multicast address to be removed

addBroadcastAddr

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

Parameters:
addr - broadcast address to be added
Throws:
EtException - if the address is not a broadcast address

addMulticastAddr

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

Parameters:
addr - multicast address to be added
Throws:
EtException - if the address is not a multicast address

setBroadcastAddrs

public void setBroadcastAddrs(java.util.Collection addrs)
                       throws EtException
Adds a collection of broadcast addresses to the set.

Parameters:
addrs - collection of broadcast addresses to be added
Throws:
EtException - if one of the addresses is not a broadcast address

setMulticastAddrs

public void setMulticastAddrs(java.util.Collection addrs)
                       throws EtException
Adds a collection of multicast addresses to the set.

Parameters:
addrs - collection of multicast addresses to be added
Throws:
EtException - if one of the addresses is not a multicast address

setContactMethod

public void setContactMethod(int method)
                      throws EtException
Sets the means or method of contacting an ET system. Its values may be Constants.broadcast for broadcasting, Constants.multicast for multicasting, Constants.direct for connecting directly to the ET tcp server, Constants.broadAndMulticast for using both broadcasting and multicasting, and Constants.udpToHost for sending a udp packet to a known host to find an ET system.

Parameters:
method - means or method of contacting an ET system
Throws:
EtException - if the argument has a bad value

setResponsePolicy

public void setResponsePolicy(int policy)
                       throws EtException
Sets the policy on what to do about multiple responding ET systems to a broadcast or multicast. The possible values are Constants.policyFirst which chooses the first ET system to respond, Constants.policyLocal which chooses the first local ET system to respond and if none then the first response, or Constants.policyError which throws an EtTooManyException exception.

Parameters:
policy - policy on what to do about multiple responding ET systems
Throws:
EtException - if the argument has a bad value or if the policy says to choose a local ET system but the host is set to chose a remote system.

setUdpPort

public void setUdpPort(int port)
                throws EtException
Sets the UDP port number for broadcastiong and sending udp packets to known hosts.

Parameters:
port - UDP port number for broadcasting and sending udp packets to known hosts
Throws:
EtException - if the port number is < 1024 or > 65535

setTcpPort

public void setTcpPort(int port)
                throws EtException
Sets the TCP server port number of the ET system.

Parameters:
port - TCP server port number of the ET system
Throws:
EtException - if the port number is < 1024 or > 65535

setMulticastPort

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

Parameters:
port - port number to multicast to
Throws:
EtException - if the port number is < 1024 or > 65535

setTTL

public void setTTL(int ttlNum)
            throws EtException
Sets the Time-to_live value for multicasting.

Parameters:
ttlNum - time-to_live value for multicasting
Throws:
EtException - if the port number is < 0 or > 254