public class ProtocolManager
extends java.lang.Object
The ProtocolManager
class is a singleton class.
See the documentation for the Node
class
for information on how to obtain a reference to its instance.
A reference to a Node's ProtocolManager
allows the Nodes installed
protocols to be managed. Installing a protocol server creates a
LinkServer
that listens on a specified NodeAddressID
.
In order to connect to a Node's LinkServer
, a Node must have
a matching protocol client installed in its local ProtocolManager
.
When protocol clients and servers are installed, an array of
Specification
objects 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 given Profile
.
Modifier and Type | Field and Description |
---|---|
private java.util.Hashtable |
addressSpecifications |
private static ProtocolManager |
instance |
private java.util.Hashtable |
linkServers |
private java.util.Hashtable |
protocolClients
This Hashtable contains protocolID's as the keys which map to
builders that build the links for that protocol.
|
private java.util.Hashtable |
protocolSpecifications |
Modifier | Constructor and Description |
---|---|
private |
ProtocolManager() |
Modifier and Type | Method and Description |
---|---|
Specification[] |
getAddressSpecifications(NodeAddressID addressID)
Returns an array of
Specification objects that are held for
a specified local address. |
(package private) static ProtocolManager |
getInstance() |
Specification[] |
getProtocolSpecifications(ProtocolID protocolID)
Returns an array of
Specification objects that are held for
a specified protocol. |
boolean |
installProtocolClient(ProtocolID protocolID,
Specification[] specifications,
java.util.Hashtable settings)
Installs a protocol client so that links can be established to Nodes with
LinkServer processes listening on the specified protocol. |
boolean |
installProtocolServer(NodeAddressID addressID,
Specification[] specifications)
Installs a
LinkServer listening on a specified
NodeAddressID and holds the specified set of
Specification objects against the address. |
boolean |
removeProtocolClient(ProtocolID protocolID)
Removes the installed protocol client for a specified protocol.
|
boolean |
stopProtocolServer(NodeAddressID addressID)
Stops the
LinkServer that is listening on the specified address. |
private static ProtocolManager instance
private java.util.Hashtable linkServers
private java.util.Hashtable protocolClients
private java.util.Hashtable addressSpecifications
private java.util.Hashtable protocolSpecifications
static ProtocolManager getInstance()
public Specification[] getProtocolSpecifications(ProtocolID protocolID)
Specification
objects that are held for
a specified protocol.protocolID
- the ProtocolID
of a protocolpublic Specification[] getAddressSpecifications(NodeAddressID addressID)
Specification
objects that are held for
a specified local address.addressID
- a NodeAddressID
that should match an address on which a local
LinkServer
is listening.public boolean installProtocolServer(NodeAddressID addressID, Specification[] specifications)
LinkServer
listening on a specified
NodeAddressID
and holds the specified set of
Specification
objects against the address.addressID
- the address on which the LinkServer
should be started.specifications
- the specifications to hold against the address.true
iff the server is successfully installed.public boolean stopProtocolServer(NodeAddressID addressID)
LinkServer
that is listening on the specified address.addressID
- the NodeAddressID
on which the LinkServer
to
stop is listening.true
if, after returning, no LinkServer
is listening
on the specified adddress.public boolean installProtocolClient(ProtocolID protocolID, Specification[] specifications, java.util.Hashtable settings)
LinkServer
processes listening on the specified protocol.protocolID
- The ProtocolID
of the protocol to install.specifications
- The specification of the protocol being installed.settings
- a HashTable
that can contain settings that are passed
to the protocol's Builder
.true
iff the protocol client is successfully installed or
has already been installed.public boolean removeProtocolClient(ProtocolID protocolID)
protocolID
- the ProtocolID
of the protocol client to remove.true
iff a matching protocol client has been successfully removed.