org.openorb.ns.util
Class NamingUtils

java.lang.Object
  extended by org.openorb.ns.util.NamingUtils

public class NamingUtils
extends java.lang.Object


Constructor Summary
NamingUtils()
           
 
Method Summary
static void deepBind(org.omg.CosNaming.NamingContext context, org.omg.CosNaming.NameComponent[] name, org.omg.CORBA.Object obj)
          Binds a objet to a name, creating any required subcontexts.
static void deepBind(org.omg.CosNaming.NamingContext context, java.lang.String name, org.omg.CORBA.Object obj)
          Binds a objet to a name, creating any required subcontexts.
static void deepRebind(org.omg.CosNaming.NamingContext context, org.omg.CosNaming.NameComponent[] name, org.omg.CORBA.Object obj)
          Binds a objet to a name, creating any required subcontexts.
static void deepRebind(org.omg.CosNaming.NamingContext context, java.lang.String name, org.omg.CORBA.Object obj)
          Binds a objet to a name, creating any required subcontexts.
static org.omg.CosNaming.NameComponent[] parent(org.omg.CosNaming.NameComponent[] name)
          Get the parent name of the given name.
static java.lang.String parent(java.lang.String name)
          Get the parent name of the given name.
static org.omg.CosNaming.NamingContext resolveOrCreateContext(org.omg.CosNaming.NamingContext context, org.omg.CosNaming.NameComponent[] name)
          Resolve contexts as far as they exist in the name, and create the remainder
static org.omg.CosNaming.NameComponent[] to_name(java.lang.String sn)
          This operation accepts a stringified name and returns a Name.
static java.lang.String to_string(org.omg.CosNaming.NameComponent[] n)
          This operation accepts Name and returns a stringified name.
static java.lang.String to_url(java.lang.String addr, java.lang.String sn)
          This operation takes an URL address and performs any escapes necessary on the stringified name and returns a fully formed URL string.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NamingUtils

public NamingUtils()
Method Detail

deepBind

public static void deepBind(org.omg.CosNaming.NamingContext context,
                            java.lang.String name,
                            org.omg.CORBA.Object obj)
                     throws org.omg.CosNaming.NamingContextPackage.InvalidName,
                            org.omg.CosNaming.NamingContextPackage.NotFound,
                            org.omg.CosNaming.NamingContextPackage.CannotProceed,
                            org.omg.CosNaming.NamingContextPackage.AlreadyBound
Binds a objet to a name, creating any required subcontexts.

Parameters:
context - The name context root.
name - The name
obj - The object to bind.
Throws:
org.omg.CosNaming.NamingContextPackage.InvalidName - invalid name
org.omg.CosNaming.NamingContextPackage.NotFound - context not found
org.omg.CosNaming.NamingContextPackage.CannotProceed - canno bind
org.omg.CosNaming.NamingContextPackage.AlreadyBound - name already bound

deepBind

public static void deepBind(org.omg.CosNaming.NamingContext context,
                            org.omg.CosNaming.NameComponent[] name,
                            org.omg.CORBA.Object obj)
                     throws org.omg.CosNaming.NamingContextPackage.InvalidName,
                            org.omg.CosNaming.NamingContextPackage.NotFound,
                            org.omg.CosNaming.NamingContextPackage.CannotProceed,
                            org.omg.CosNaming.NamingContextPackage.AlreadyBound
Binds a objet to a name, creating any required subcontexts.

Parameters:
context - The name context root.
name - The name
obj - The object to bind.
Throws:
org.omg.CosNaming.NamingContextPackage.InvalidName - if the name is invalid
org.omg.CosNaming.NamingContextPackage.NotFound - context not found
org.omg.CosNaming.NamingContextPackage.CannotProceed - if the binding cannot be completed
org.omg.CosNaming.NamingContextPackage.AlreadyBound - if already bound

deepRebind

public static void deepRebind(org.omg.CosNaming.NamingContext context,
                              java.lang.String name,
                              org.omg.CORBA.Object obj)
                       throws org.omg.CosNaming.NamingContextPackage.InvalidName,
                              org.omg.CosNaming.NamingContextPackage.NotFound,
                              org.omg.CosNaming.NamingContextPackage.CannotProceed
Binds a objet to a name, creating any required subcontexts.

Parameters:
context - The name context root.
name - The name
obj - The object to bind.
Throws:
org.omg.CosNaming.NamingContextPackage.InvalidName - if the name is invalid
org.omg.CosNaming.NamingContextPackage.NotFound - if the context cannot be found
org.omg.CosNaming.NamingContextPackage.CannotProceed - if the rebind conot proceed

deepRebind

public static void deepRebind(org.omg.CosNaming.NamingContext context,
                              org.omg.CosNaming.NameComponent[] name,
                              org.omg.CORBA.Object obj)
                       throws org.omg.CosNaming.NamingContextPackage.InvalidName,
                              org.omg.CosNaming.NamingContextPackage.NotFound,
                              org.omg.CosNaming.NamingContextPackage.CannotProceed
Binds a objet to a name, creating any required subcontexts.

Parameters:
context - The name context root.
name - The name
obj - The object to bind.
Throws:
org.omg.CosNaming.NamingContextPackage.InvalidName - if the name is invalid
org.omg.CosNaming.NamingContextPackage.NotFound - if the context cannot be found
org.omg.CosNaming.NamingContextPackage.CannotProceed - if the bind conot proceed

resolveOrCreateContext

public static org.omg.CosNaming.NamingContext resolveOrCreateContext(org.omg.CosNaming.NamingContext context,
                                                                     org.omg.CosNaming.NameComponent[] name)
                                                              throws org.omg.CosNaming.NamingContextPackage.InvalidName,
                                                                     org.omg.CosNaming.NamingContextPackage.NotFound,
                                                                     org.omg.CosNaming.NamingContextPackage.CannotProceed
Resolve contexts as far as they exist in the name, and create the remainder

Parameters:
context - The name context root.
name - The name
Returns:
NamingContext the naming context
Throws:
org.omg.CosNaming.NamingContextPackage.InvalidName - if the name is invalid
org.omg.CosNaming.NamingContextPackage.NotFound - if the context cannot be found
org.omg.CosNaming.NamingContextPackage.CannotProceed - if the resolve/context creation connot proceed

to_name

public static org.omg.CosNaming.NameComponent[] to_name(java.lang.String sn)
                                                 throws org.omg.CosNaming.NamingContextPackage.InvalidName
This operation accepts a stringified name and returns a Name.

Parameters:
sn - the stringified name to transform to a name.
Returns:
NameComponent[] the name
Throws:
org.omg.CosNaming.NamingContextPackage.InvalidName - This exception is raised if the stringified name is syntactically malformed or violates an implementation limit.

to_string

public static java.lang.String to_string(org.omg.CosNaming.NameComponent[] n)
                                  throws org.omg.CosNaming.NamingContextPackage.InvalidName
This operation accepts Name and returns a stringified name.

Parameters:
n - the name to stringified.
Returns:
String the stringified name
Throws:
org.omg.CosNaming.NamingContextPackage.InvalidName - This exception is raised if the name is invalid.

to_url

public static java.lang.String to_url(java.lang.String addr,
                                      java.lang.String sn)
                               throws org.omg.CosNaming.NamingContextExtPackage.InvalidAddress,
                                      org.omg.CosNaming.NamingContextPackage.InvalidName
This operation takes an URL address and performs any escapes necessary on the stringified name and returns a fully formed URL string.

Parameters:
addr - the address ( for example myhost.xyz.com )
sn - the stringified name to add to the URL
Returns:
the URL string format.
Throws:
org.omg.CosNaming.NamingContextExtPackage.InvalidAddress - This exception is raised if an address is invalid ( it means that the address does not respect the address format ).
org.omg.CosNaming.NamingContextPackage.InvalidName - This exception is raised if the stringified name is syntactically malformed or violates an implementation limit.

parent

public static org.omg.CosNaming.NameComponent[] parent(org.omg.CosNaming.NameComponent[] name)
Get the parent name of the given name. The parent of the empty name will be also empty.

Parameters:
name - the name.
Returns:
the parent name.

parent

public static java.lang.String parent(java.lang.String name)
Get the parent name of the given name. The parent of the empty name will be also empty. It is assumed that the name is in the correct format.

Parameters:
name - the name.
Returns:
the parent name.