Interoperable naming

EAServer supports interoperable naming for EJB 2.0, and implements the NamingContextExt interface, which enables you to look up objects with URLs and stringified names (an object reference converted to a string.)

The IDL specification for the NamingContextExt interface is:

module CosNaming {
//...
  interface NamingContextExt: NamingContext{
    typedef string URLString;
    typedef string Address;
    typedef string StringName;

    StringName to_string(in Name n) raises(InvalidName);
    Name to_name(in StringName sn) raises(InvalidName);

    exception InvalidAddress{};

    URLString to_url(in Address addrkey, in StringName sn)
                     raises(InvalidAddress, InvalidName);
    Object resolve_str(in StringName n) 
                     raises(NotFound, CannotProceed, InvalidName);
  };
};

The com.sybase.CORBA.ORB implementation supports corbaloc and corbaname URLs, which allow you to define object references that are more readable and easier to use than IORs. The corbaloc URL format is similar to FTP or HTTP URLs and can be modified more easily than IORs. corbaloc URLs can be used for objects that are accessible through IIOP or resolve_initial_references (rir:). This is an example of the corbaloc format that uses the rir protocol, where “NamingService” is the key string that is passed to resolve_initial_references:

corbaloc:rir:/NamingService

When you use rir, you cannot use any other protocol. This example uses IIOP to look up the key string “Prod/TradingServices” on the host “555xyz.com”:

corbaloc:iiop1.1@555xyz.com/Prod/TradingServices

When you use the corbaloc format to reference beans on another server, you must be sure that both servers use interoperable security; for more information, see the EAServer Security Administration and Programming Guide.

A corbaname URL is similar to a corbaloc URL, but it also contains a stringified name that identifies a naming context binding. In this example, the host is “555xyz.com”, the key string is “dev/NContext1”, and “#” marks the beginning of the stringified name:

corbaname::555xyz.com/dev/NContext1#a/b/c

When an object reference does not contain an object key, the default key “NamingService” is used. In this example, “NamingService” is used to look up a NamingContext, then the stringified name “a/b/c” is used to resolve the final object:

corbaname::555.xyz.com#a/b/c

You can reference local beans (those that run within the same Java VM by prefixing the bean name with “local:”; for instance, local:ejb/MyBean.

To define this reference using the corbaname format, use this syntax:

corbaname:rir:#ejb/MyBean

For information on using interoperable naming URLs for EJB 2.0 components and clients, see Chapter 9, “EAServer EJB Interoperability,” in the EAServer Programmer’s Guide.