12.11.2014 Views

web server - Borland Technical Publications

web server - Borland Technical Publications

web server - Borland Technical Publications

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

EJB to CORBA mapping<br />

The mapping is based on the Java-to-IDL mapping. The specification includes the<br />

following parts: mapping of distribution-related aspects, the mapping of naming<br />

conventions, the mapping of transactions, and the mapping of security. We explain<br />

each of these aspects in the following sections. Since the mapping uses new IDL<br />

features introduced by the OMG's Object-by-Value specification, interoperability with<br />

other programming languages requires CORBA 2.3-compliant ORBs.<br />

Mapping for distribution<br />

An enterprise bean has two interfaces that are remotely accessible: the remote<br />

interface and the home interface. Applying the Java/IDL mapping to these interfaces<br />

results in corresponding IDL specifications. The base classes defined in the EJB<br />

specification are mapped to IDL in the same manner.<br />

For example, look at the IDL interface for an ATM enterprise session bean that has<br />

methods to transfer funds between accounts and throws an insufficient funds<br />

exception. By applying the Java/IDL mapping to the home and the remote interface,<br />

you get the following IDL interface.<br />

module transaction {<br />

module ejb {<br />

valuetype InsufficientFundsException : ::java::lang::Exception {};<br />

exception InsufficientFundsEx {<br />

::transaction::ejb::InsufficientFundsException value;<br />

};<br />

interface Atm : ::javax::ejb::EJBObject{<br />

void transfer (in string arg0, in string arg1, in float arg2)<br />

raises (::transaction::ejb::InsufficientFundsEx);<br />

};<br />

interface AtmHome : ::javax::ejb::EJBHome {<br />

::transaction::ejb::Atm create ()<br />

raises (::javax::ejb::CreateEx);<br />

};<br />

};};};};<br />

Mapping for naming<br />

A CORBA-based EJB runtime environment that wants to enable any CORBA clients to<br />

access enterprise beans must use the CORBA Naming Service for publishing and<br />

resolving the home interfaces of the enterprise beans. The runtime can use the<br />

CORBA Naming Service directly or indirectly via JNDI and its standard mapping to the<br />

CORBA Naming Service.<br />

JNDI names have a string representation of the following form “directory1/directory2/<br />

.../directoryN/objectName”. The CORBA Naming Service defines names as a<br />

sequence of name components.<br />

typedef string Istring;<br />

struct NameComponent {<br />

Istring id;<br />

Istring kind;<br />

};<br />

typedef sequence Name;<br />

Each “/” separated name of a JNDI string name is mapped to a name component; the<br />

leftmost component is the first entry in the CORBA Naming Service name.<br />

A JNDI string name is relative to some naming context, which calls the JNDI root<br />

context. The JNDI root context corresponds to a CORBA Naming Service initial<br />

context. CORBA Naming Service names are relative to the CORBA initial context.<br />

Chapter 11: Writing enterprise bean clients 93

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!