org.openorb.util
Class NamingUtils

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

public abstract class NamingUtils
extends Object

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

Author:
Chris Wood, Michael Rumpf

Field Summary
static String CALLBACK_MANAGER_NAME
           
static String CALLBACK_MANAGER_NAME_NS
           
static String CCS_NAME
           
static String CCS_NAME_LONG
           
static String DEFAULT_EVENT_CHANNEL_NAME
           
static String DEFAULT_EVENT_CHANNEL_NAME_NS
           
static String EVENT_CHANNEL_FACTORY_NAME
           
static String EVENT_CHANNEL_FACTORY_NAME_NS
           
static String EVENT_SERVICE_NAME
           
static String EVENT_SERVICE_NAME_LONG
           
static String IR_CCS
          CCS initial reference name (non-standard)
static String IR_CODEC_FACTORY
          CodecFactory initial reference name
static String IR_COMPONENT_HOME_FINDER
          ComponentHomeFinder initial reference name
static String IR_DYN_ANY_FACTORY
          DynAnyFactory initial reference name
static String IR_EVENT_SERVICE
          EventService initial reference name (non-standard)
static String IR_INTERFACE_REPOSITORY
          InterfaceRepository initial reference name
static String IR_NAME
           
static String IR_NAME_LONG
           
static String IR_NAME_SERVICE
          NameService initial reference name
static String IR_NOTIFICATION_SERVICE
          NotificationService initial reference name
static String IR_ORB_POLICY_MANAGER
          ORBPolicyManager initial reference name
static String IR_OTS
          OTS initial reference name (non-standard)
static String IR_PI_CURRENT
          PICurrent initial reference name
static String IR_POA_CURRENT
          POACurrent initial reference name
static String IR_POLICY_CURRENT
          PolicyCurrent initial reference name
static String IR_PROPERTY_SERVICE
          PropertyService initial reference name (non-standard)
static String IR_PSS
          PSS initial reference name
static String IR_ROOT_POA
          RootPOA initial reference name
static String IR_SECURITY_CURRENT
          SecurityCurrent initial reference name
static String IR_SERVICE_TYPE_REPOSITORY
          Trader ServiceTypeRepository initial reference name (non-standard)
static String IR_TIME_SERVICE
          TimeService initial reference name (non-standard)
static String IR_TRADING_SERVICE
          TradingService initial reference name
static String IR_TRANSACTION_CURRENT
          TransactionCurrent initial reference name
static String IR_TYPED_NOTIFICATION_SERVICE
          TypedNotificationService initial reference name
static String LOCK_SET_FACTORY_NAME
           
static String LOCK_SET_FACTORY_NAME_NS
           
static String NAMING_CONTEXT_NAME
           
static String NAMING_CONTEXT_NAME_NS
           
static String NOTIFICATION_CHANNEL_FACTORY_NAME
           
static String NOTIFICATION_CHANNEL_FACTORY_NAME_NS
           
static String NOTIFICATION_SERVICE_NAME
           
static String NOTIFICATION_SERVICE_NAME_LONG
           
static String NS_NAME
           
static String NS_NAME_LONG
           
static String OTS_NAME
           
static String OTS_NAME_LONG
           
static String PROPERTY_SERVICE_NAME
           
static String PROPERTY_SERVICE_NAME_LONG
           
static String PROPERTY_SET_DEF_FACTORY_NAME
           
static String PROPERTY_SET_DEF_FACTORY_NAME_NS
           
static String PROPERTY_SET_FACTORY_NAME
           
static String PROPERTY_SET_FACTORY_NAME_NS
           
static String PSS_CONNECTOR_FACTORY_NAME
           
static String PSS_CONNECTOR_FACTORY_NAME_NS
           
static String PSS_SERVICE_NAME
           
static String PSS_SERVICE_NAME_LONG
           
static String REPOSITORY_NAME
           
static String REPOSITORY_NAME_NS
           
static String ROOT_COS_CONTEXT
          Top-level service context
static String TIME_SERVICE_NAME
           
static String TIME_SERVICE_NAME_LONG
           
static String TIME_SERVICE_NAME_NS
           
static String TIMER_EVENT_SERVICE_NAME
           
static String TIMER_EVENT_SERVICE_NAME_NS
           
static String TRADING_KERNEL_NAME
           
static String TRADING_KERNEL_NAME_NS
           
static String TRADING_SERVICE_NAME
           
static String TRADING_SERVICE_NAME_LONG
           
static String TRADING_SVC_TYPE_REPO_NAME
           
static String TRADING_SVC_TYPE_REPO_NAME_NS
           
static String TRANSACTION_FACTORY_NAME
           
static String TRANSACTION_FACTORY_NAME_NS
           
 
Method Summary
static String bindObjectToCorbalocService(ORB orb, String name, Object obj)
          Bind the specified object at the CorbalocService.
static boolean bindObjectToFileSystem(ORB orb, String name, Object obj)
          "Bind" the object by writing the IOR into a file.
static boolean bindObjectToNamingService(ORB orb, String name, Object obj, boolean bNoNS, org.apache.avalon.framework.logger.Logger logger)
          Binds an object into the Naming Service or uses an alternative binding method.
static boolean bindObjectToNamingService(ORB orb, String name, Object obj, org.apache.avalon.framework.logger.Logger logger)
          Binds an object into the Naming Service or uses an alternative binding method.
static boolean checkAddress(String addr)
          This function checks an address for the correct format.
static String decodeRFC2396(String enc)
          Decodes a RFC2396 encoded string.
static boolean dynamicRebind(ORB orb, String name, Object obj)
          This method binds the object under the specified name at the NamingService.
static Object dynamicResolve(ORB orb, String name)
          This method tries to resolve an object from the NamingService.
static Object dynamicStringToName(String name)
          Convert a string to a org.omg.CosNaming.Name using Java reflection.
static boolean dynamicUnbind(ORB orb, String name)
          This method tries to unbind an object from the NamingService.
static String encodeRFC2396(String str)
          Encodes a string according to RFC2396.
static Object resolveObjectFromNamingService(ORB orb, String name)
           
static Object resolveObjectFromNamingService(ORB orb, String name, boolean bNoNS)
           
static Object resolveObjectFromNamingService(ORB orb, String name, boolean bNoNS, org.apache.avalon.framework.logger.Logger logger)
          Resolve an object from the Naming Service or use an alternative lookup method.
static String rirMapping(String rirName)
          Provides a mapping between names passed to the method resolve_initial_references() and the lookup name for the NamingService.
static boolean unbindObjectFromNamingService(ORB orb, String name)
           
static boolean unbindObjectFromNamingService(ORB orb, String name, boolean bNoNS)
          unbind an object from the Naming Service or delete the ior file from the file system.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

IR_ROOT_POA

public static final String IR_ROOT_POA
RootPOA initial reference name

IR_POA_CURRENT

public static final String IR_POA_CURRENT
POACurrent initial reference name

IR_INTERFACE_REPOSITORY

public static final String IR_INTERFACE_REPOSITORY
InterfaceRepository initial reference name

IR_NAME_SERVICE

public static final String IR_NAME_SERVICE
NameService initial reference name

IR_TRADING_SERVICE

public static final String IR_TRADING_SERVICE
TradingService initial reference name

IR_SECURITY_CURRENT

public static final String IR_SECURITY_CURRENT
SecurityCurrent initial reference name

IR_TRANSACTION_CURRENT

public static final String IR_TRANSACTION_CURRENT
TransactionCurrent initial reference name

IR_DYN_ANY_FACTORY

public static final String IR_DYN_ANY_FACTORY
DynAnyFactory initial reference name

IR_ORB_POLICY_MANAGER

public static final String IR_ORB_POLICY_MANAGER
ORBPolicyManager initial reference name

IR_POLICY_CURRENT

public static final String IR_POLICY_CURRENT
PolicyCurrent initial reference name

IR_NOTIFICATION_SERVICE

public static final String IR_NOTIFICATION_SERVICE
NotificationService initial reference name

IR_TYPED_NOTIFICATION_SERVICE

public static final String IR_TYPED_NOTIFICATION_SERVICE
TypedNotificationService initial reference name

IR_CODEC_FACTORY

public static final String IR_CODEC_FACTORY
CodecFactory initial reference name

IR_PI_CURRENT

public static final String IR_PI_CURRENT
PICurrent initial reference name

IR_COMPONENT_HOME_FINDER

public static final String IR_COMPONENT_HOME_FINDER
ComponentHomeFinder initial reference name

IR_PSS

public static final String IR_PSS
PSS initial reference name

IR_CCS

public static final String IR_CCS
CCS initial reference name (non-standard)

IR_OTS

public static final String IR_OTS
OTS initial reference name (non-standard)

IR_EVENT_SERVICE

public static final String IR_EVENT_SERVICE
EventService initial reference name (non-standard)

IR_PROPERTY_SERVICE

public static final String IR_PROPERTY_SERVICE
PropertyService initial reference name (non-standard)

IR_SERVICE_TYPE_REPOSITORY

public static final String IR_SERVICE_TYPE_REPOSITORY
Trader ServiceTypeRepository initial reference name (non-standard)

IR_TIME_SERVICE

public static final String IR_TIME_SERVICE
TimeService initial reference name (non-standard)

ROOT_COS_CONTEXT

public static final String ROOT_COS_CONTEXT
Top-level service context

NS_NAME

public static final String NS_NAME

NS_NAME_LONG

public static final String NS_NAME_LONG

NAMING_CONTEXT_NAME

public static final String NAMING_CONTEXT_NAME

NAMING_CONTEXT_NAME_NS

public static final String NAMING_CONTEXT_NAME_NS

CALLBACK_MANAGER_NAME

public static final String CALLBACK_MANAGER_NAME

CALLBACK_MANAGER_NAME_NS

public static final String CALLBACK_MANAGER_NAME_NS

CCS_NAME

public static final String CCS_NAME

CCS_NAME_LONG

public static final String CCS_NAME_LONG

LOCK_SET_FACTORY_NAME

public static final String LOCK_SET_FACTORY_NAME

LOCK_SET_FACTORY_NAME_NS

public static final String LOCK_SET_FACTORY_NAME_NS

EVENT_SERVICE_NAME

public static final String EVENT_SERVICE_NAME

EVENT_SERVICE_NAME_LONG

public static final String EVENT_SERVICE_NAME_LONG

EVENT_CHANNEL_FACTORY_NAME

public static final String EVENT_CHANNEL_FACTORY_NAME

EVENT_CHANNEL_FACTORY_NAME_NS

public static final String EVENT_CHANNEL_FACTORY_NAME_NS

DEFAULT_EVENT_CHANNEL_NAME

public static final String DEFAULT_EVENT_CHANNEL_NAME

DEFAULT_EVENT_CHANNEL_NAME_NS

public static final String DEFAULT_EVENT_CHANNEL_NAME_NS

NOTIFICATION_SERVICE_NAME

public static final String NOTIFICATION_SERVICE_NAME

NOTIFICATION_SERVICE_NAME_LONG

public static final String NOTIFICATION_SERVICE_NAME_LONG

NOTIFICATION_CHANNEL_FACTORY_NAME

public static final String NOTIFICATION_CHANNEL_FACTORY_NAME

NOTIFICATION_CHANNEL_FACTORY_NAME_NS

public static final String NOTIFICATION_CHANNEL_FACTORY_NAME_NS

PSS_SERVICE_NAME

public static final String PSS_SERVICE_NAME

PSS_SERVICE_NAME_LONG

public static final String PSS_SERVICE_NAME_LONG

PSS_CONNECTOR_FACTORY_NAME

public static final String PSS_CONNECTOR_FACTORY_NAME

PSS_CONNECTOR_FACTORY_NAME_NS

public static final String PSS_CONNECTOR_FACTORY_NAME_NS

PROPERTY_SERVICE_NAME

public static final String PROPERTY_SERVICE_NAME

PROPERTY_SERVICE_NAME_LONG

public static final String PROPERTY_SERVICE_NAME_LONG

PROPERTY_SET_FACTORY_NAME

public static final String PROPERTY_SET_FACTORY_NAME

PROPERTY_SET_FACTORY_NAME_NS

public static final String PROPERTY_SET_FACTORY_NAME_NS

PROPERTY_SET_DEF_FACTORY_NAME

public static final String PROPERTY_SET_DEF_FACTORY_NAME

PROPERTY_SET_DEF_FACTORY_NAME_NS

public static final String PROPERTY_SET_DEF_FACTORY_NAME_NS

TIME_SERVICE_NAME

public static final String TIME_SERVICE_NAME

TIME_SERVICE_NAME_LONG

public static final String TIME_SERVICE_NAME_LONG

TIME_SERVICE_NAME_NS

public static final String TIME_SERVICE_NAME_NS

TIMER_EVENT_SERVICE_NAME

public static final String TIMER_EVENT_SERVICE_NAME

TIMER_EVENT_SERVICE_NAME_NS

public static final String TIMER_EVENT_SERVICE_NAME_NS

TRADING_SERVICE_NAME

public static final String TRADING_SERVICE_NAME

TRADING_SERVICE_NAME_LONG

public static final String TRADING_SERVICE_NAME_LONG

TRADING_KERNEL_NAME

public static final String TRADING_KERNEL_NAME

TRADING_KERNEL_NAME_NS

public static final String TRADING_KERNEL_NAME_NS

TRADING_SVC_TYPE_REPO_NAME

public static final String TRADING_SVC_TYPE_REPO_NAME

TRADING_SVC_TYPE_REPO_NAME_NS

public static final String TRADING_SVC_TYPE_REPO_NAME_NS

OTS_NAME

public static final String OTS_NAME

OTS_NAME_LONG

public static final String OTS_NAME_LONG

TRANSACTION_FACTORY_NAME

public static final String TRANSACTION_FACTORY_NAME

TRANSACTION_FACTORY_NAME_NS

public static final String TRANSACTION_FACTORY_NAME_NS

IR_NAME

public static final String IR_NAME

IR_NAME_LONG

public static final String IR_NAME_LONG

REPOSITORY_NAME

public static final String REPOSITORY_NAME

REPOSITORY_NAME_NS

public static final String REPOSITORY_NAME_NS
Method Detail

rirMapping

public static String rirMapping(String rirName)
Provides a mapping between names passed to the method resolve_initial_references() and the lookup name for the NamingService. See CORBA 3.0, Table 4-1, for details.

encodeRFC2396

public static String encodeRFC2396(String str)
                            throws 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:
UnsupportedEncodingException - When the string can't be converted into UTF-8 format.

decodeRFC2396

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

checkAddress

public static boolean checkAddress(String addr)
This function checks an address for the correct format.
Parameters:
addr - The address to check.
Returns:
True if the format is correct, false otherwise.

dynamicStringToName

public static Object dynamicStringToName(String name)
                                  throws Exception
Convert a string to a org.omg.CosNaming.Name using Java reflection.
Parameters:
name - The string to be converted into a org.omg.CosNaming.Name.
Returns:
The org.omg.CosNaming.Name converted from the String.
Throws:
Exception - Various reflection exceptions.

dynamicRebind

public static boolean dynamicRebind(ORB orb,
                                    String name,
                                    Object obj)
This method binds the object under the specified name at the NamingService. The NamingService is retrieved by rir "NameService". The method returns true upon success and false otherwise.
Parameters:
orb - The orb instance on which to resolve the "NameService" reference.
name - The name under which to bind the object.
obj - The object to bind.
Returns:
True if bind was successful or false otherwise.

dynamicResolve

public static Object dynamicResolve(ORB orb,
                                    String name)
This method tries to resolve an object from the NamingService. The NamingService is retrieved by rir "NameService". The method returns the object when one could be found under the specified path name, or null otherwise.
Parameters:
orb - The orb instance on which to resolve the "NameService" reference.
name - The name under which to bind the object.
Returns:
The object resolved or null when no object was found.

dynamicUnbind

public static boolean dynamicUnbind(ORB orb,
                                    String name)
This method tries to unbind an object from the NamingService. The NamiingService is retrieved by rir "NameService". The method tries to unbind the object from the NamingService. The method returns true when the unbind was successful or false otherwise.
Parameters:
orb - The orb instance on which to resolve the "NameService" reference.
name - The name under which to bind the object.
Returns:
The object resolved or null when no object was found.

bindObjectToCorbalocService

public static String bindObjectToCorbalocService(ORB orb,
                                                 String name,
                                                 Object obj)
Bind the specified object at the CorbalocService.
Parameters:
orb - The orb from which to get the CorbalocService.
name - The name under which to bind the object.
obj - The object to bind.
Returns:
A string containing the corbaloc URL, or null, when the bind failed.

bindObjectToNamingService

public static boolean bindObjectToNamingService(ORB orb,
                                                String name,
                                                Object obj,
                                                org.apache.avalon.framework.logger.Logger logger)
Binds an object into the Naming Service or uses an alternative binding method. The standard route is taken first, i.e. it is attempted to bind the object at a running NamingService instance. If this fails a temporary folder is created that reflects the hierarchy of the NamingService.
Parameters:
orb - The orb instance to resolve the NamingService from.
name - The name under which to bind the object in the NamingService.
obj - The object to bind.
logger - logger to use for logging
Returns:
True when the bind was successful, false otherwise.

bindObjectToNamingService

public static boolean bindObjectToNamingService(ORB orb,
                                                String name,
                                                Object obj,
                                                boolean bNoNS,
                                                org.apache.avalon.framework.logger.Logger logger)
Binds an object into the Naming Service or uses an alternative binding method. The standard route is taken first, i.e. it is attempted to bind the object at a running NamingService instance. If this fails a temporary folder is created that reflects the hierarchy of the NamingService.
Parameters:
orb - The orb instance to resolve the NamingService from.
name - The name under which to bind the object in the NamingService.
obj - The object to bind.
bNoNS - Do not try to bind at the NamingService.
logger - logger to use for logging
Returns:
True when the bind was successful, false otherwise.

bindObjectToFileSystem

public static boolean bindObjectToFileSystem(ORB orb,
                                             String name,
                                             Object obj)
"Bind" the object by writing the IOR into a file.
Parameters:
orb - The orb instance to resolve the NamingService from.
name - The name under which to bind the object in the NamingService.
obj - The object to bind.
Returns:
true if success; false if failure

resolveObjectFromNamingService

public static Object resolveObjectFromNamingService(ORB orb,
                                                    String name)
See Also:
resolveObjectFromNamingService(org.omg.CORBA.ORB,java.lang.String,boolean)

resolveObjectFromNamingService

public static Object resolveObjectFromNamingService(ORB orb,
                                                    String name,
                                                    boolean bNoNS)
See Also:
resolveObjectFromNamingService(org.omg.CORBA.ORB,java.lang.String,boolean,Logger)

resolveObjectFromNamingService

public static Object resolveObjectFromNamingService(ORB orb,
                                                    String name,
                                                    boolean bNoNS,
                                                    org.apache.avalon.framework.logger.Logger logger)
Resolve an object from the Naming Service or use an alternative lookup method. The standard route is taken first, i.e. it is attempted to resolve the object from a running NamingService instance. If this fails a temporary folder is searched that reflects the hierarchy of the NamingService.
Parameters:
orb - The orb instance to resolve the NamingService from.
name - The name under which to bind the object in the NamingService.
bNoNS - Do not try to resolve from the NamingService. This option is used for the NamingService itself, because resolving the initial NamingService at the NamingService wouldn't make any sense.
Returns:
The object bound or null if no object was found.

unbindObjectFromNamingService

public static boolean unbindObjectFromNamingService(ORB orb,
                                                    String name)
See Also:
unbindObjectFromNamingService(org.omg.CORBA.ORB,java.lang.String,boolean)

unbindObjectFromNamingService

public static boolean unbindObjectFromNamingService(ORB orb,
                                                    String name,
                                                    boolean bNoNS)
unbind an object from the Naming Service or delete the ior file from the file system. The standard route is taken first, i.e. it is attempted to unbind the object from a running NamingService instance. If this fails a temporary folder is searched that reflects the hierarchy of the NamingService. If an ior file for the service is found then the file will be deleted.
Parameters:
orb - The orb instance to unbind the NamingService from.
name - The name of the object to unbind from the NamingService.
bNoNS - Do not try to unbind from the NamingService. This option is used for the NamingService itself, because unbinding the initial NamingService from the NamingService wouldn't make any sense.
Returns:
True when unbind was successful, false otherwise.