user manual

Chapter 11: Writing enterprise bean clients 111
EJB to CORBA mapping
For example, look at the IDL interface for an ATM enterprise session bean that
has methods to transfer funds between accounts and throws an insufficient
funds exception. By applying the Java/IDL mapping to the home and the
remote interface, you get the following IDL interface.
module transaction {
module ejb {
valuetype InsufficientFundsException : ::java::lang::Exception {};
exception InsufficientFundsEx {
::transaction::ejb::InsufficientFundsException value;
};
interface Atm : ::javax::ejb::EJBObject{
void transfer (in string arg0, in string arg1, in float arg2)
raises (::transaction::ejb::InsufficientFundsEx);
};
interface AtmHome : ::javax::ejb::EJBHome {
::transaction::ejb::Atm create ()
raises (::javax::ejb::CreateEx);
};
};};};};
Mapping for naming
A CORBA-based EJB runtime environment that wants to enable any CORBA
clients to access enterprise beans must use the CORBA Naming Service for
publishing and resolving the home interfaces of the enterprise beans. The
runtime can use the CORBA Naming Service directly or indirectly via JNDI
and its standard mapping to the CORBA Naming Service.
JNDI names have a string representation of the following form "directory1/
directory2/.../directoryN/objectName". The CORBA Naming Service defines
names as a sequence of name components.
typedef string Istring;
struct NameComponent {
Istring id;
Istring kind;
};
typedef sequence<NameComponent> Name;
Each "/" separated name of a JNDI string name is mapped to a name
component; the leftmost component is the first entry in the CORBA Naming
Service name.
A JNDI string name is relative to some naming context, which calls the JNDI
root context. The JNDI root context corresponds to a CORBA Naming Service
initial context. CORBA Naming Service names are relative to the CORBA
initial context.
A CORBA program obtains an initial CORBA Naming Service naming context
by calling resolve_initial_references("NameService") on the ORB (pseudo)
object. The CORBA Naming Service does not prescribe a rooted graph for
organizing naming context and, hence, the notion of a root context does not