org.objectweb.mobilitools.util.corba
Class NameService

java.lang.Object
  |
  +--org.objectweb.mobilitools.util.corba.NameService

public class NameService
extends java.lang.Object

MobiliTools $Name: $, $Id: NameService.java,v 1.1.1.1 2003/03/28 14:48:06 dillense Exp $

Front-end utility for the CORBA naming service.


Constructor Summary
NameService(org.omg.CORBA.Object obj)
          Creates and initializes a new name service front-end.
NameService(org.omg.CORBA.ORB orb)
          Creates and initializes a new name service front-end.
 
Method Summary
 void bind(org.omg.CosNaming.NameComponent[] name, org.omg.CORBA.Object obj)
           
 void bind(org.omg.CosNaming.NameComponent[] name, org.omg.CORBA.Object obj, boolean force)
           
 void bind(java.lang.String name, org.omg.CORBA.Object obj)
           
 void deepUnbind(org.omg.CosNaming.NameComponent[] name)
           
 void deepUnbind(java.lang.String name)
           
 void destroy(org.omg.CosNaming.NameComponent[] name)
           
 void destroy(java.lang.String name)
           
 boolean isContext(org.omg.CosNaming.NameComponent[] name)
           
static boolean isContext(org.omg.CORBA.Object obj)
           
 boolean isContext(java.lang.String name)
           
 NSbinding[] list(org.omg.CosNaming.NameComponent[] contextName)
          Returns an array of objects of contexts bound in the given context name.
 NSbinding[] list(java.lang.String contextName)
          Returns an array of objects of contexts bound in the given context name.
 void makePath(org.omg.CosNaming.NameComponent[] name)
           
 void makePath(java.lang.String name)
           
static java.lang.String nameToString(org.omg.CosNaming.NameComponent[] name)
           
 void rebind(org.omg.CosNaming.NameComponent[] name, org.omg.CORBA.Object obj)
           
 void rebind(java.lang.String name, org.omg.CORBA.Object obj)
           
 org.omg.CORBA.Object resolve(org.omg.CosNaming.NameComponent[] name)
          Resolves a name to the bound object reference.
 org.omg.CORBA.Object resolve(java.lang.String name)
          Resolves a String-fied name to the bound object reference.
static org.omg.CosNaming.NameComponent[] stringToName(java.lang.String strName)
           
 void unbind(org.omg.CosNaming.NameComponent[] name)
           
 void unbind(java.lang.String name)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NameService

public NameService(org.omg.CORBA.ORB orb)
            throws NameServiceException
Creates and initializes a new name service front-end.
Parameters:
orb - reference to the current ORB object (see return from ORB.init() call).
Throws:
NameServiceException - thrown if the initial reference to a naming service cannot be obtained.

NameService

public NameService(org.omg.CORBA.Object obj)
            throws NameServiceException
Creates and initializes a new name service front-end.
Parameters:
obj - object reference narrowing to a naming context.
Throws:
NameServiceException - thrown if the object reference to a naming service cannot be narrowed to a naming context.
Method Detail

resolve

public org.omg.CORBA.Object resolve(java.lang.String name)
                             throws NameServiceException
Resolves a String-fied name to the bound object reference.
Parameters:
name - string translation ("context!kind/.../object!kind") of the object's name.
Returns:
the object reference bound to the named object.
Throws:
NameServiceException - same as resolve(org.omg.CosNaming.NameComponent[])
See Also:
resolve(org.omg.CosNaming.NameComponent[]), stringToName(java.lang.String)

resolve

public org.omg.CORBA.Object resolve(org.omg.CosNaming.NameComponent[] name)
                             throws NameServiceException
Resolves a name to the bound object reference.
Parameters:
name - name of the object in the naming service.
Returns:
the object reference bound to the named object.
Throws:
NameServiceException - thrown in several failure situations:
  • CORBA system exception,
  • the name is invalid,
  • the name was not found,
  • naming service internal error.
See the exception attribute of the NameServiceException, and refer to the CORBA naming service definitions to get the actual diagnostic.

list

public NSbinding[] list(java.lang.String contextName)
                 throws NameServiceException
Returns an array of objects of contexts bound in the given context name.
Parameters:
contextName - the string-fied name of the context to list ("contex!kind/..." format).
Returns:
an array of NSbinding objects listing the objects and contexts found.
Throws:
NameServiceException - same as list(org.omg.CORBA.NameComponent[]).
See Also:
list(NameComponent[])

list

public NSbinding[] list(org.omg.CosNaming.NameComponent[] contextName)
                 throws NameServiceException
Returns an array of objects of contexts bound in the given context name.
Parameters:
contextName - name of the context to list.
Returns:
an array of NSbinding objects listing the objects and contexts found.
Throws:
NameServiceException - thrown if a communication exception occurs while getting the content list of the specified context, or if the specified context cannot be narrowed to a naming context. In the former case, the actual exception object is attached to the NameServiceException. Since some bindings may disappear while resolving the object references, the resulting exceptions are ignored.

makePath

public void makePath(java.lang.String name)
              throws NameServiceException

makePath

public void makePath(org.omg.CosNaming.NameComponent[] name)
              throws NameServiceException

bind

public void bind(java.lang.String name,
                 org.omg.CORBA.Object obj)
          throws NameServiceException

bind

public void bind(org.omg.CosNaming.NameComponent[] name,
                 org.omg.CORBA.Object obj)
          throws NameServiceException

rebind

public void rebind(java.lang.String name,
                   org.omg.CORBA.Object obj)
            throws NameServiceException

rebind

public void rebind(org.omg.CosNaming.NameComponent[] name,
                   org.omg.CORBA.Object obj)
            throws NameServiceException

unbind

public void unbind(java.lang.String name)
            throws NameServiceException

unbind

public void unbind(org.omg.CosNaming.NameComponent[] name)
            throws NameServiceException

destroy

public void destroy(java.lang.String name)
             throws NameServiceException

destroy

public void destroy(org.omg.CosNaming.NameComponent[] name)
             throws NameServiceException

deepUnbind

public void deepUnbind(java.lang.String name)
                throws NameServiceException

deepUnbind

public void deepUnbind(org.omg.CosNaming.NameComponent[] name)
                throws NameServiceException

bind

public void bind(org.omg.CosNaming.NameComponent[] name,
                 org.omg.CORBA.Object obj,
                 boolean force)
          throws NameServiceException

isContext

public static boolean isContext(org.omg.CORBA.Object obj)

isContext

public boolean isContext(java.lang.String name)
                  throws NameServiceException

isContext

public boolean isContext(org.omg.CosNaming.NameComponent[] name)
                  throws NameServiceException

nameToString

public static java.lang.String nameToString(org.omg.CosNaming.NameComponent[] name)

stringToName

public static org.omg.CosNaming.NameComponent[] stringToName(java.lang.String strName)