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

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

public class NSRetriever
extends java.lang.Object

NSRetriever may be used to retrieve local instances of the COS naming service. It is independent of its actual implementation. Its newObject method returns an instance of the naming service, obtained thanks to defaults set in the provided context.


Constructor Summary
NSRetriever()
          Buids a new Naming Service factory.
 
Method Summary
static org.omg.CosNaming.NamingContext 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 org.omg.CosNaming.NamingContext getNSDirectly(java.lang.String host, short port, org.omg.CORBA.ORB orb)
          Returns a local interface to the name server.
static org.omg.CosNaming.NamingContext getNSFromFile(java.lang.String file, org.omg.CORBA.ORB orb)
          Returns a local interface to the name server.
static org.omg.CosNaming.NamingContext 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 org.omg.CosNaming.NamingContext 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 org.omg.CosNaming.NamingContext 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 org.omg.CosNaming.NamingContext 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 org.omg.CosNaming.NamingContext 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