CSP for Java
(JCSP) 1.1-rc4

org.jcsp.net.tcpip
Class TCPIPNodeFactory

java.lang.Object
  extended by org.jcsp.net.tcpip.TCPIPNodeFactory
All Implemented Interfaces:
Serializable, NodeFactory

public class TCPIPNodeFactory
extends Object
implements NodeFactory

Default factory for simple initialisations using the TCPIPv4 protocol package.

Other constructors can be used to specify a particular CNS server. The default behaviour will extract a CNS server from the system property "org.jcsp.tcpip.DefaultCNSServer" with the server specified as a name or IP address with optional port number.

If built with 1.4 or higher the user preferences will also be checked but only if a runtime supporting the preferences is available. If not present the system preferences will then be checked.

Author:
Quickstone Technologies Limited
See Also:
Serialized Form

Constructor Summary
TCPIPNodeFactory()
          Default constructor, connecting to the local host on the default CNS port or to a host name in the system properties.
TCPIPNodeFactory(String cnsServer)
          Connect to the named host on the default CNS port.
TCPIPNodeFactory(String cnsServerAddress, int cnsServerPort)
          Connect to a named host on a specific port.
 
Method Summary
 NodeKey initNode(Node node, Node.Attributes attribs)
          Initialise the node to listen on all local addresses, and start a CNS service.
static NodeFactory instantiate()
          Constructs an instance of this class.
 void setLocalPort(int port)
          Sets the port number that should be used.
 void setSecurityAuthority(SecurityService security)
          Sets the security service to be used.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TCPIPNodeFactory

public TCPIPNodeFactory()
Default constructor, connecting to the local host on the default CNS port or to a host name in the system properties. The host name should be specified as name:port or just the host name to use the default CNS port.


TCPIPNodeFactory

public TCPIPNodeFactory(String cnsServer)
Connect to the named host on the default CNS port. If the server name is given as null then the CNS service will not be loaded.

Parameters:
cnsServer - name of server

TCPIPNodeFactory

public TCPIPNodeFactory(String cnsServerAddress,
                        int cnsServerPort)
Connect to a named host on a specific port.

Parameters:
cnsServerAddress - name of the server
cnsServerPort - port to connect to
Method Detail

instantiate

public static NodeFactory instantiate()
Constructs an instance of this class. This method is provided so that a later implementation can opt to pass construction to an alternative under certain conditions. This is for use by the infrastructure only. Users should call the public constructors.


initNode

public NodeKey initNode(Node node,
                        Node.Attributes attribs)
                 throws NodeInitFailedException
Initialise the node to listen on all local addresses, and start a CNS service.

Specified by:
initNode in interface NodeFactory
Parameters:
node - the node to be initialized
attribs - access to the restricted node attributes
Throws:
NodeInitFailedException - if a problem occurs

setLocalPort

public void setLocalPort(int port)
Sets the port number that should be used. If this is not called then the system will allocate an arbitrary port.

Parameters:
port - the port number, 0 <= port < 65536.

setSecurityAuthority

public void setSecurityAuthority(SecurityService security)
Sets the security service to be used.

Parameters:
security - the new security authority.

CSP for Java
(JCSP) 1.1-rc4

Submit a bug or feature to jcsp-team@kent.ac.uk
Version 1.1-rc4 of the JCSP API Specification (Copyright 1997-2008 P.D.Austin and P.H.Welch - All Rights Reserved)
Java is a trademark or registered trademark of Sun Microsystems, Inc. in the US and other countries.