org.hebe.mps
Class NamingServiceImpl

org.hebe.mps.NamingServiceImpl

public class NamingServiceImpl

Implementation class for the MPS Server Interface defined in ../namingservice.mps. MPS uses an MPS server to locate its own server names!

Note that this class has a main method - it is its own application as well: a standalone MPS name server.

Author:
Tony Garnock-Jones

Field Summary
private  java.util.Hashtable names
          This class uses a naive hashtable-lookup to map objectNames onto resolvedNames (aka canonical names).
 
Constructor Summary
NamingServiceImpl()
           
 
Method Summary
 boolean bind(java.lang.String name, java.lang.String cname, boolean replace)
          Implement the naming-service name binding function.
 org.hebe.mps.naming.Binding[] enumerate()
          Get a list of all the name-value pairs in the current running database.
static void main(java.lang.String[] args)
          Main method for the standalone naming server.
 java.lang.String resolve(java.lang.String name)
          Implement the naming-service resolution function.
 boolean unbind(java.lang.String name)
          Implement the naming-service name unbinding function.
static void usage()
          Display a friendly application-usage message to stdout.
 

Field Detail

names

private java.util.Hashtable names
This class uses a naive hashtable-lookup to map objectNames onto resolvedNames (aka canonical names).
Constructor Detail

NamingServiceImpl

public NamingServiceImpl()
Method Detail

main

public static void main(java.lang.String[] args)
Main method for the standalone naming server.

usage

public static void usage()
Display a friendly application-usage message to stdout.

resolve

public java.lang.String resolve(java.lang.String name)
Implement the naming-service resolution function.
Parameters:
name - the objectName to look up
Returns:
the results of the lookup - an address, or the empty-string

bind

public boolean bind(java.lang.String name,
                    java.lang.String cname,
                    boolean replace)
Implement the naming-service name binding function.
Parameters:
name - the object name to use
cname - the canonical name to use
replace - whether to replace any potential existing bindings with the same name or not
Returns:
true if the bind succeeded; false if an existing binding was not replaced

unbind

public boolean unbind(java.lang.String name)
Implement the naming-service name unbinding function.
Parameters:
name - the name to remove from this nameserver
Returns:
true if the name was removed; false if it was not bound in the first place

enumerate

public org.hebe.mps.naming.Binding[] enumerate()
Get a list of all the name-value pairs in the current running database.
Returns:
an array of Result structures containing every map in the hashtable