Class ProtocolID
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
TCPIPProtocolID
Abstract class that identifies a protocol.
Provides methods for obtaining the protocol's Builder to be
installed in the LinkFactory, starting a LinkServer for this
protocol and for creating a NodeAddressID for this protocol
from a String.
Protocols must not make use of the NodeID so that protocols can be installed before the node ID is determined. The current definition of TCPIPv4 protocol meets this criteria. Such a change will allow the UIFactory or other initialisation details to be obtained from a central server.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate intThe position in the order of preference of protocols. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract NodeAddressIDcreateAddressID(String stAddressID, boolean uniqueAddress) Constructs aNodeAddressIDfrom aString.booleanThis tests whether another object is equal to this object.protected abstract LinkFactory.BuildergetLinkBuilder(Hashtable settings) Obtains the Builder for this protocol.final intGets the position of this protocol in the order of preference.final inthashCode()Returns a hash code for this object.abstract booleanisActive()Not currently used.abstract booleanReturns whether the protocol requires user interaction in order for data to be delivered.(package private) final voidsetPosition(int position) Sets the position of this protocol in the order of general preference.protected abstract LinkServerstartLinkServer(NodeAddressID addressID) Constructs, starts and returns aLinkServeron a specifiedNodeAddressID.
-
Field Details
-
position
private int positionThe position in the order of preference of protocols.
-
-
Constructor Details
-
ProtocolID
public ProtocolID()
-
-
Method Details
-
equals
This tests whether another object is equal to this object. TwoProtocolIDobjects are equal if their classes are the same. This is a default implementation, it is probably more efficient to override this with an implementation that uses the instanceof operator. -
hashCode
public final int hashCode()Returns a hash code for this object. -
isActive
public abstract boolean isActive()Not currently used.
This is envisaged to be used if a protocol that is in use and needs to be removed sometime in the future. This will stop any further use of the protocol.
- Returns:
- boolean indicating whether protocol is active.
-
requiresUserInteraction
public abstract boolean requiresUserInteraction()Returns whether the protocol requires user interaction in order for data to be delivered. There could be a protocol that writes data out to floppy disk or CD-R (see Tanenbaum's example of bandwidth and lorry!).
- Returns:
- boolean indicating whether user interaction is required.
-
setPosition
final void setPosition(int position) Sets the position of this protocol in the order of general preference.- Parameters:
position- the position of this protocol in the order.
-
getPosition
public final int getPosition()Gets the position of this protocol in the order of preference.- Returns:
- the order of preference as an
int.
-
getLinkBuilder
Obtains the Builder for this protocol. Provides a Hashtable that can can contain settings needed to construct the Link.- Parameters:
settings-Hashtablecontaining settings.- Returns:
- the
Builderfor constructing Links.
-
startLinkServer
protected abstract LinkServer startLinkServer(NodeAddressID addressID) throws IllegalArgumentException Constructs, starts and returns a
LinkServeron a specifiedNodeAddressID.- Parameters:
addressID- The address for the server to listen on.- Returns:
- the constructed
LinkServer - Throws:
IllegalArgumentException- if the suppliedNodeAddressIDis invalid.
-
createAddressID
protected abstract NodeAddressID createAddressID(String stAddressID, boolean uniqueAddress) throws IllegalArgumentException Constructs aNodeAddressIDfrom aString.- Parameters:
stAddressID- The address in String form.uniqueAddress- boolean indicating whether address is unique.- Returns:
- the constructed
NodeAddressID - Throws:
IllegalArgumentException- if theStringsupplied is invalid.
-