org.objectweb.david.libs.services.naming
Class NSRetriever

java.lang.Object
  extended byorg.objectweb.david.libs.services.naming.NSRetriever

public class NSRetriever
extends java.lang.Object

NSRetriever may be used to retrieve local instances of the naming service.


Constructor Summary
NSRetriever()
          Buids a new Naming Service factory.
 
Method Summary
static NameServer getNS(int method, java.lang.String host, int port, java.lang.String url, java.lang.String file, org.omg.CORBA.ORB orb)
          Returns a name server according to the method parameter.
static NameServer getNSDirectly(java.lang.String host, short port, org.omg.CORBA.ORB orb)
          Returns a local interface to the name server.
static NameServer getNSFromFile(java.lang.String file, org.omg.CORBA.ORB orb)
          Returns a local interface to the name server.
static NameServer getNSFromURL(java.lang.String url, org.omg.CORBA.ORB orb)
          Returns a local interface to the name server.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NSRetriever

public NSRetriever()
Buids a new Naming Service factory.

Method Detail

getNSFromFile

public static NameServer getNSFromFile(java.lang.String file,
                                       org.omg.CORBA.ORB orb)
                                throws org.objectweb.jonathan.apis.kernel.JonathanException,
                                       java.io.IOException
Returns a local interface to the name server.

This method tries to read the IOR of a name server from the specified file, and to build a local surrogate for the name server.

Parameters:
file - the file name;
orb - an ORB instance.
Returns:
a local interface to the name server.
Throws:
org.objectweb.jonathan.apis.kernel.JonathanException - if the binding with the distant name server failed.
java.io.IOException - if an IO error occurred;

getNSFromURL

public static NameServer getNSFromURL(java.lang.String url,
                                      org.omg.CORBA.ORB orb)
                               throws org.objectweb.jonathan.apis.kernel.JonathanException,
                                      java.io.IOException
Returns a local interface to the name server.

This method tries to read the IOR of a name server from the specified url, and to build a local surrogate for the name server.

Parameters:
url - the name of the url corresponding to a file containing an IOR;
orb - an ORB instance.
Returns:
a local interface to the name server.
Throws:
org.objectweb.jonathan.apis.kernel.JonathanException - if the binding with the distant name server failed.
java.io.IOException - if an IO error occurred;

getNSDirectly

public static NameServer getNSDirectly(java.lang.String host,
                                       short port,
                                       org.omg.CORBA.ORB orb)
                                throws org.objectweb.jonathan.apis.kernel.JonathanException
Returns a local interface to the name server.

This method tries to forge the IOR of a name server thanks to the specified host and port, and to build a local surrogate for the name server.

Parameters:
host - a hostname;
port - a port number;
orb - an ORB instance.
Returns:
a local interface to the name server.
Throws:
org.objectweb.jonathan.apis.kernel.JonathanException - if the binding with the distant name server failed.

getNS

public static NameServer getNS(int method,
                               java.lang.String host,
                               int port,
                               java.lang.String url,
                               java.lang.String file,
                               org.omg.CORBA.ORB orb)
                        throws org.objectweb.jonathan.apis.kernel.JonathanException
Returns a name server according to the method parameter. If method==0, host and port are used, if method == 1, url is used, if method == 2, file is used.

Parameters:
method -
host -
port -
url -
file -
orb -
Returns:
Throws:
org.objectweb.jonathan.apis.kernel.JonathanException