![]() |
![]() |
Overview of WebLogic Enterprise JavaBeansEnterprise JavaBeans (EJB) is a component architecture for building distributed, object-oriented business applications in Java. This whitepaper describes the features of WebLogic's implementation of the JavaSoft EJB specification (version 1.0), and discusses the benefits of using WebLogic EJB. More detailed technical information is available in the Developers Guide, Using WebLogic Enterprise JavaBeans.
The JavaSoft Enterprise JavaBeans (EJB) specification defines a component architecture for building distributed, object-oriented business applications in Java. The EJB architecture addresses the development, deployment, and runtime aspects of an enterprise application's life cycle. An Enterprise JavaBean encapsulates business logic in a component framework that manages the details of security, transaction, and state management. Low-level details such as multi-threading, resource pooling, clustering, distributed naming, automatic persistence, remote invocation, transaction boundary management, and distributed transaction management are handled by the EJB "container." This allows the EJB developer to focus on the business problem to be solved.
An Enterprise JavaBean is, in essence, a transactional and secure
RMI With the EJB model, you will be able to buy business components (such as invoices, bank accounts and shipping routes) and, during deployment into a certain project, specify how the component should be used -- which users have access to which methods, whether the framework should automatically start a transaction or whether it should inherit the caller's transaction, and so on. In this scenario, an EJB contains the business logic (methods) and the customization needed for a particular application (deployment descriptor), and the EJB will run within any standard implementation of the EJB framework. The spirit of "write once, run anywhere" carries through into EJB: any vendor's EJB framework can run any third-party Enterprise JavaBeans to make up an application. Nuances of the security mechanisms and specific distributed transaction monitors are entirely abstracted out of the application code (unless the bean author chooses to make such calls explicitly). Types of beansAn EJ bean can be one of two types:
For example, one method of accessing bank accounts could be through an AccountBean: an entity bean, it represents a specific bank account, and has a specific state (account) associated with it. Another method of accessing the accounts could be through a TellerBean: a session bean, it is stateless, and its interface expects the caller to spell out exactly which account to operate on. Once a transaction is over, the TellerBean can be reused to work on a different bank account, since the caller will not care which teller it is using. With an AccountBean, you would say account.deposit(300); with a TellerBean, you would say teller.deposit(account, 300).
At this point, version 1.0 of EJB specifies only a synchronous calling convention; events and asynchronous communication have not been defined.
Major advantages of the WebLogic EJB implementation include:
It's important to understand that Enterprise JavaBeans are different from the "ordinary" JavaBeans that are used in many integrated development environments (IDEs). There is an unfortunate use of the term "JavaBeans" that causes much confusion. JavaSoft originally introduced JavaBeans to refer to Java classes that were designed according a set of conventions. These conventions enabled the components to be examined dynamically by a development tool and used in the construction of applications. These components, or JavaBeans, can be specialized for particular uses in applications. A convention for generating and receiving events is part of the convention, allowing beans to be "connected together" by a development tool. The most common examples are graphical in nature. For example, a GUI pushbutton widget can be developed as a bean. Any compliant development tool can examine the button bean and determine its properties (e.g., size, shape, label, color, etc.) and can connect to the bean's methods (e.g., program the bean to respond to the user clicking on the button). A specialization of the button might be a specific instance of it on a specific panel with a label of "Exit." Enterprise JavaBeans are also components, but their similarity to JavaBeans ends there. EJB does not implement the same conventions as JavaBeans: EJB has its own distinct interfaces and conventions. The purpose of EJB is to provide a server-side encapsulation of application logic for security and transactional purposes. It does not have the development tool semantics of JavaBeans.
An example of an EJB might be a business entity such as an
invoice. Access to the invoice is controlled by an access control
list WebLogic implements both kinds of beans: Enterprise JavaBeans and WebLogic Beans (i.e., JavaBeans). Each has its place in the application architecture, and each is well supported by the WebLogic framework. The Enterprise JavaBean specification (java.ejb package) shares little with the "ordinary"JavaBeans specification, save for the fact that both specifications have the term "bean" in them, and that both strive to build components (beans).
For more technical information, read the Developers Guide, Using WebLogic Enterprise JavaBeans.
|
|
Copyright © 2000 BEA Systems, Inc. All rights reserved.
|