Class ProtocolManager
- java.lang.Object
-
- org.jcsp.net.ProtocolManager
-
public class ProtocolManager extends Object
The
ProtocolManagerclass is a singleton class. See the documentation for theNodeclass for information on how to obtain a reference to its instance.A reference to a Node's
ProtocolManagerallows the Nodes installed protocols to be managed. Installing a protocol server creates aLinkServerthat listens on a specifiedNodeAddressID. In order to connect to a Node'sLinkServer, a Node must have a matching protocol client installed in its localProtocolManager.When protocol clients and servers are installed, an array of
Specificationobjects can be supplied. These are specifications that the client or server meets. The specifications for a given protocol can be obtained and then used to test whether a set of specifications match a givenProfile.- Author:
- Quickstone Technologies Limited
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.jcsp.net.Specification[]getAddressSpecifications(NodeAddressID addressID)Returns an array ofSpecificationobjects that are held for a specified local address.org.jcsp.net.Specification[]getProtocolSpecifications(ProtocolID protocolID)Returns an array ofSpecificationobjects that are held for a specified protocol.booleaninstallProtocolClient(ProtocolID protocolID, org.jcsp.net.Specification[] specifications, Hashtable settings)Installs a protocol client so that links can be established to Nodes withLinkServerprocesses listening on the specified protocol.booleaninstallProtocolServer(NodeAddressID addressID, org.jcsp.net.Specification[] specifications)Installs aLinkServerlistening on a specifiedNodeAddressIDand holds the specified set ofSpecificationobjects against the address.booleanremoveProtocolClient(ProtocolID protocolID)Removes the installed protocol client for a specified protocol.booleanstopProtocolServer(NodeAddressID addressID)Stops theLinkServerthat is listening on the specified address.
-
-
-
Method Detail
-
getProtocolSpecifications
public org.jcsp.net.Specification[] getProtocolSpecifications(ProtocolID protocolID)
Returns an array ofSpecificationobjects that are held for a specified protocol.- Parameters:
protocolID- theProtocolIDof a protocol- Returns:
- the specifications of the supplied protocol.
-
getAddressSpecifications
public org.jcsp.net.Specification[] getAddressSpecifications(NodeAddressID addressID)
Returns an array ofSpecificationobjects that are held for a specified local address.- Parameters:
addressID- aNodeAddressIDthat should match an address on which a localLinkServeris listening.- Returns:
- the set of specifications that are held against the specified address.
-
installProtocolServer
public boolean installProtocolServer(NodeAddressID addressID, org.jcsp.net.Specification[] specifications)
Installs aLinkServerlistening on a specifiedNodeAddressIDand holds the specified set ofSpecificationobjects against the address.- Parameters:
addressID- the address on which theLinkServershould be started.specifications- the specifications to hold against the address.- Returns:
trueiff the server is successfully installed.
-
stopProtocolServer
public boolean stopProtocolServer(NodeAddressID addressID)
Stops theLinkServerthat is listening on the specified address.- Parameters:
addressID- theNodeAddressIDon which theLinkServerto stop is listening.- Returns:
trueif, after returning, noLinkServeris listening on the specified adddress.
-
installProtocolClient
public boolean installProtocolClient(ProtocolID protocolID, org.jcsp.net.Specification[] specifications, Hashtable settings)
Installs a protocol client so that links can be established to Nodes withLinkServerprocesses listening on the specified protocol.- Parameters:
protocolID- TheProtocolIDof the protocol to install.specifications- The specification of the protocol being installed.settings- aHashTablethat can contain settings that are passed to the protocol'sBuilder.- Returns:
trueiff the protocol client is successfully installed or has already been installed.
-
removeProtocolClient
public boolean removeProtocolClient(ProtocolID protocolID)
Removes the installed protocol client for a specified protocol.- Parameters:
protocolID- theProtocolIDof the protocol client to remove.- Returns:
trueiff a matching protocol client has been successfully removed.
-
-