|
Nodenet Problem Set Javadocs | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
A Registrar is an object that can track and validate the names of nodes.
A registrar can also provide a legal name for a node. Current Node Names
can be both registered and unregistered so that names can be reused if
nodes are deleted. The * registrar may also provide access to a listing
of registered names, and access to a node via it's name, but
implementations may choose to throw an
UnsupportedOperationException
instead of providing these
facilities.
Implicit in the design of this interface is the assumed existance of a
public String getNodeName()
and a
public void setNodeName(String)
or similar method on
Node
objects.
Method Summary | |
java.lang.String |
getLegalName()
Provides a name that is currently legal. |
Node |
getNode(java.lang.String aName)
Provides access to nodes via their registred name. |
java.lang.String[] |
getRegisteredNames()
Provides a list of currently registered node names. |
boolean |
isLegalName(java.lang.String aName)
Tests a name to see if it is currently legal. |
boolean |
isRegistered(Node aNode)
Tests to see if a node has been registered. |
boolean |
isRegistered(java.lang.String aName)
Tests to see if a name belongs to a registered node. |
void |
nameAndRegister(Node aNode)
Gives the node a legal name and registers the node in one step. |
void |
register(Node aNode)
Attempt to register a node. |
void |
unregister(Node aNode)
Ensures that the specified node is nolonger registered. |
Methods inherited from interface java.beans.VetoableChangeListener |
vetoableChange |
Method Detail |
public boolean isLegalName(java.lang.String aName)
Registrar
requires
names to be unique.
aName
- The node name to be tested.
true
if the name is legal, false
otherwise.public java.lang.String getLegalName()
Registrar
requires names
to be unique. The implementation of this method should make a reasonable
attempt not to give out names that will become illegal quickly, either
due to temporal relevance of the name, or due to copetition between
names given out to the clients. For example, this method should not
give out the same node name on consecutive invocations if uniqueness is
a qualification for legality.
public java.lang.String[] getRegisteredNames() throws java.lang.UnsupportedOperationException
UnsupportedOperationException
rather than returning
a bogus list or null.
java.lang.UnsupportedOperationException
public Node getNode(java.lang.String aName) throws java.lang.UnsupportedOperationException
UnsupportedOperationException
rather than returning
a bogus node or null.
aName
- The name of the node to look for.
java.lang.UnsupportedOperationException
public void register(Node aNode) throws java.lang.IllegalArgumentException
isLegalName(String)
. If the name contained in the node
is rejected, The node is not registered or tracked in any way and an
IllegalArgumentException
will be thrown.
aNode
- The node that wishes to register itself.
java.lang.IllegalArgumentException
public void unregister(Node aNode)
aNode
- the node to unregisterpublic boolean isRegistered(Node aNode)
aNode
- The node to test
true
if the node is registered false
otherwise.public boolean isRegistered(java.lang.String aName)
aName
- The node name to test
true
if the name is registered false
otherwise.public void nameAndRegister(Node aNode)
|
Nodenet Problem Set Javadocs | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |