Don't know a JavaBean from a green bean? Or, perhaps you're a hardcore veteran EJB developer. Regardless of whether you're a novice or an expert, searchMiddleware is coming to the rescue! We're launching this new EJB tip section just for you! We encourage our readership to support this effort by submitting their favorite EJB tips. Your peers are depending on you - so pitch in and share your EJB knowledge today!
To get the ball rolling for our first tip, I'd like to offer this introductory information. Here's what Vlada Matena and Beth Stearns have to say in their book Applying Enterprise JavaBeans, published by Addison Wesley.
What are Enterprise JavaBeans Applications?
Vlada Matena and Beth Stearns
Enterprise beans are components that are used as parts of distributed enterprise applications. Each enterprise bean encapsulates a part of the business logic of the application. An enterprise bean typically communicates with resource managers, such as database management systems, and other enterprise beans.
At the same time, different types of clients access enterprise beans. The clients of an enterprise bean can be other enterprise beans, Web applications, servlets, or application clients.
At runtime, an enterprise bean resides in the EJB container. An EJB container provides the deployment and runtime environment for enterprise beans, including services such as security, transaction, deployment, and concurrency and instance life cycle management. The process of installing an enterprise bean in an EJB container is called enterprise bean deployment.
An enterprise application can include a single enterprise bean or multiple enterprise beans can be deployed either in a single container or in multiple containers located on the enterprise's network. Each enterprise bean that invokes a method on another enterprise bean is considered a client of the second enterprise bean.
A client accesses an enterprise bean through the enterprise bean's client-view API. The client-view API is location transparent. This means that a client invokes an enterprise bean using the same API regardless of whether the client executes in the same Java Virtual Machine (JVM) as the enterprise bean or in a different JVM. If the client and the enterprise beans are in the same JVM, the container uses an optimized internal path to perform the invocation. If they are in different containers, the client communicates with the enterprise bean over the network to perform the invocation.
The client-view API is independent from the type of the client using the API. This means that a client that is itself an enterprise bean uses the same API to invoke another enterprise bean as, for example, a Web application and a stand alone Java client program.
The client-view API is uniform across all enterprise beans of the same type (that is, entity or session). Clients use all enterprise beans in a similar way. The uniformity of the enterprise bean's client-view API makes it possible to develop powerful tools that simplify the entire application development process. Developers use these tools for the following tasks:
- To assemble enterprise beans into multi-tier applications
- To construct enterprise bean clients, such as Web applications
- To integrate enterprise bean applications developed by multiple vendors
To succeed in the marketplace, all enterprise applications must quickly adapt to rapidly changing requirements, and at the same time enterprises need to evolve their business. It is essential that an application environment allow for this evolution, and the EJB architecture and the client-view API do allow for this. The organization of an application's business logic into components that communicate with each other via a well-defined client-view API enables application evolution to be accomplished with a minimum of overhead and disruption or downtime.
If business rules change, an enterprise needs to upgrade only the enterprise bean that implements the changed business rules. If the upgraded enterprise bean preserves the original client-view API, or if tit provides a backward-compatible client view API, and enterprise does not need to change the rest of the application to accommodate the changed business rules.
FOR MORE INFORMATION:
Discuss Enterprise JavaBeans (EJB) in our Discussion Forums.
Visit Ask the Experts to read previous answers and pose your own JavaBeans question.
Did you like this tip? Send us an email to let us know. We want to know what you think.