in ejb/corba integration, complexity can range from simple to complex and depends in part on the direction of the communication. from ejb to corba, communication is relatively simple because the ejb bean invokes corba as it does any external resource. corba-to-ejb communication, however, depends on the application servers support of rmi-iiop. if the application server doesnt support rmi-iiop, then its best to create a wrapper or adapter class that redirects or delegates the function calls from the client via a corba servant, which then calls the ejb.
part 1: ejb/corba integration
communicating from ejb to corba is the simplest case. the ejb will require an orb and some means of looking up the remote corba object, the servant, in a directory service that could be cosnaming or jndi over cosnaming. note: it isnt necessary to use corba 2.3, which is required by rmi-iiop (see below). like any external resource, such as a socket or file descriptor, any orb can be initialized and used by the ejb.orb initialization should be performed once using the singleton design pattern that can act as a factory for looking up remote corba servants. a suitable design to ensure this scenario requires the use of a stateless session bean, which is never passivated. entity or stateful session beans may be passivated and reactivated and would require the disposal and cleanup of the orb, which has a high performance cost as well.
using the stateless session bean fits the ejb model best, and the orb can be a static data member in the bean or in the above mentioned singleton support class to help ensure one instance. a deployment descriptor can also be set, for example, in weblogic, which allows the container to create only one stateless session bean.
currently, theres no standard mapping between ejb and corba for passing user identity and transaction propagation. so, if transaction and security services are required in your implementation, then the ejb bean wrapping this corba call should invoke the appropriate corba services in the desired way. in other words theres no automatic solution, and transaction and security will need to be customized for your situation.
in listing 1 (see
www.javadevelopers journal.com for listings) the call
corbabean is a stateless session bean implementation that makes a
call to an object r which initializes the orb (if its not
initializ... 下一页