org.openorb.util
Class NamingUtils

java.lang.Object
  |
  +--org.openorb.util.NamingUtils

public abstract class NamingUtils
extends java.lang.Object

The functions in this class perform various translations on stringified CosNaming names.

Author:
Chris Wood

Constructor Summary
NamingUtils()
           
 
Method Summary
static java.lang.String decodeRFC2396(java.lang.String enc)
          Decodes a RFC2396 encoded string.
static void deepBind(NamingContext context, NameComponent[] name, Object obj)
          Deprecated. This method uses interfaces from the CosNaming module. Which results in an implicit dependency to the naming service. This dependency is going to be removed in the future.
static void deepBind(NamingContext context, java.lang.String name, Object obj)
          Deprecated. This method uses interfaces from the CosNaming module. Which results in an implicit dependency to the naming service. This dependency is going to be removed in the future.
static void deepRebind(NamingContext context, NameComponent[] name, Object obj)
          Deprecated. This method uses interfaces from the CosNaming module. Which results in an implicit dependency to the naming service. This dependency is going to be removed in the future.
static void deepRebind(NamingContext context, java.lang.String name, Object obj)
          Deprecated. This method uses interfaces from the CosNaming module. Which results in an implicit dependency to the naming service. This dependency is going to be removed in the future.
static java.lang.String encodeRFC2396(java.lang.String str)
          Encodes a string according to RFC2396.
static NameComponent[] parent(NameComponent[] name)
          Deprecated. This method uses interfaces from the CosNaming module. Which results in an implicit dependency to the naming service. This dependency is going to be removed in the future.
static java.lang.String parent(java.lang.String name)
          Deprecated. This method uses interfaces from the CosNaming module. Which results in an implicit dependency to the naming service. This dependency is going to be removed in the future.
static NamingContext resolveOrCreateContext(NamingContext context, NameComponent[] name)
          Deprecated. This method uses interfaces from the CosNaming module. Which results in an implicit dependency to the naming service. This dependency is going to be removed in the future.
static NameComponent[] to_name(java.lang.String sn)
          Deprecated. This method uses interfaces from the CosNaming module. Which results in an implicit dependency to the naming service. This dependency is going to be removed in the future. Additionally this method is part of the NamingContextExt package and there is no reason for duplicating it here.
static java.lang.String to_string(NameComponent[] n)
          Deprecated. This method uses interfaces from the CosNaming module. Which results in an implicit dependency to the naming service. This dependency is going to be removed in the future. Additionally this method is part of the NamingContextExt package and there is no reason for duplicating it here.
static java.lang.String to_url(java.lang.String addr, java.lang.String sn)
          Deprecated. This method uses interfaces from the CosNaming module. Which results in an implicit dependency to the naming service. This dependency is going to be removed in the future. Additionally this method is part of the NamingContextExt package and there is no reason for duplicating it here.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NamingUtils

public NamingUtils()
Method Detail

encodeRFC2396

public static java.lang.String encodeRFC2396(java.lang.String str)
                                      throws java.io.UnsupportedEncodingException
Encodes a string according to RFC2396. All escaped chars use UTF-8 encoding ( RFC2396 has been updated to RFC2732 ).
Parameters:
str - The string to encode.
Returns:
The encoded string.
Throws:
java.io.UnsupportedEncodingException - When the string can't be converted into UTF-8 format.

decodeRFC2396

public static java.lang.String decodeRFC2396(java.lang.String enc)
                                      throws java.io.UnsupportedEncodingException
Decodes a RFC2396 encoded string.
Parameters:
enc - The string to encode.
Returns:
The decoded string.
Throws:
java.io.UnsupportedEncodingException -  
java.lang.NumberFormatException -  

deepBind

public static void deepBind(NamingContext context,
                            java.lang.String name,
                            Object obj)
                     throws InvalidName,
                            NotFound,
                            CannotProceed,
                            AlreadyBound
Deprecated. This method uses interfaces from the CosNaming module. Which results in an implicit dependency to the naming service. This dependency is going to be removed in the future.

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:
InvalidName - invalid name
NotFound - context not found
CannotProceed - canno bind
AlreadyBound - name already bound

deepBind

public static void deepBind(NamingContext context,
                            NameComponent[] name,
                            Object obj)
                     throws InvalidName,
                            NotFound,
                            CannotProceed,
                            AlreadyBound
Deprecated. This method uses interfaces from the CosNaming module. Which results in an implicit dependency to the naming service. This dependency is going to be removed in the future.

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:
InvalidName - if the name is invalid
NotFound - context not found
CannotProceed - if the binding cannot be completed
AlreadyBound - if already bound

deepRebind

public static void deepRebind(NamingContext context,
                              java.lang.String name,
                              Object obj)
                       throws InvalidName,
                              NotFound,
                              CannotProceed
Deprecated. This method uses interfaces from the CosNaming module. Which results in an implicit dependency to the naming service. This dependency is going to be removed in the future.

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:
InvalidName - if the name is invalid
NotFound - if the context cannot be found
CannotProceed - if the rebind conot proceed

deepRebind

public static void deepRebind(NamingContext context,
                              NameComponent[] name,
                              Object obj)
                       throws InvalidName,
                              NotFound,
                              CannotProceed
Deprecated. This method uses interfaces from the CosNaming module. Which results in an implicit dependency to the naming service. This dependency is going to be removed in the future.

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:
InvalidName - if the name is invalid
NotFound - if the context cannot be found
CannotProceed - if the bind conot proceed

resolveOrCreateContext

public static NamingContext resolveOrCreateContext(NamingContext context,
                                                   NameComponent[] name)
                                            throws InvalidName,
                                                   NotFound,
                                                   CannotProceed
Deprecated. This method uses interfaces from the CosNaming module. Which results in an implicit dependency to the naming service. This dependency is going to be removed in the future.

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:
InvalidName - if the name is invalid
NotFound - if the context cannot be found
CannotProceed - if the resolve/context creation connot proceed

to_name

public static NameComponent[] to_name(java.lang.String sn)
                               throws InvalidName
Deprecated. This method uses interfaces from the CosNaming module. Which results in an implicit dependency to the naming service. This dependency is going to be removed in the future. Additionally this method is part of the NamingContextExt package and there is no reason for duplicating it here.

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:
InvalidName - This exception is raised if the stringified name is syntactically malformed or violates an implementation limit.
InvalidName - if a name is invalid

to_string

public static java.lang.String to_string(NameComponent[] n)
                                  throws InvalidName
Deprecated. This method uses interfaces from the CosNaming module. Which results in an implicit dependency to the naming service. This dependency is going to be removed in the future. Additionally this method is part of the NamingContextExt package and there is no reason for duplicating it here.

This operation accepts Name and returns a stringified name.
Parameters:
n - the name to stringified.
Returns:
String the stringified name
Throws:
InvalidName - This exception is raised if the name is invalid.
InvalidName - if a name is invalid

to_url

public static java.lang.String to_url(java.lang.String addr,
                                      java.lang.String sn)
                               throws InvalidAddress,
                                      InvalidName
Deprecated. This method uses interfaces from the CosNaming module. Which results in an implicit dependency to the naming service. This dependency is going to be removed in the future. Additionally this method is part of the NamingContextExt package and there is no reason for duplicating it here.

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:
InvalidAddress - This exception is raised if an address is invalid ( it means that the address does not respect the address format ).
InvalidName - This exception is raised if the stringified name is syntactically malformed or violates an implementation limit.

parent

public static NameComponent[] parent(NameComponent[] name)
Deprecated. This method uses interfaces from the CosNaming module. Which results in an implicit dependency to the naming service. This dependency is going to be removed in the future.

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)
Deprecated. This method uses interfaces from the CosNaming module. Which results in an implicit dependency to the naming service. This dependency is going to be removed in the future.

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.