Briefly describe EJB architecture.- The EJB architecture is an extension of Web architecture.
- It has an additional tier.
- The clients of an enterprise bean can be a traditional java application – an applet, a JSP or servlet.
- Like in a web application, client browser has to go all the way to web container to use a servlet or JSP, the communication between beans and clients is performed by the EJB container.
- The following are the flows of the EJB architecture.
1. The client is working on a web browser.
2. There is a database server that hosts a database, like MySQL / Oracle.
3. The J2EE server machine is running on an application server
4. The client interface is provided with JSP / Servlet. The enterprise beans reside in the business tier providing to the client tier.
5. The Application Server manages the relationships between the client and database machines.
Briefly describe EJB architecture.- An enterprise bean is a non-visual component of a distributed, transaction-oriented enterprise application.
- Enterprise beans are typically deployed in EJB containers and run on EJB servers.
- Every EJB has three classes:
1. A home interface which acts as a factory of remote objects.
2. A remote object which is used for client interaction
3. A bean object which contains all the business logic
Remote client view :
- Its specification is available only in EJB 2.0 and an enterprise bean remote client view is location independent.
Remote interface :
- It specifies the remote business methods that a client can call on an enterprise bean.
- Remote home interface.
- It specifies the methods used by remote clients for locating, creating, and removing instances of the enterprise bean classes.
Local client view :
- Its specification is only available in EJB 2.0 and the local client view of a bean is location dependent, unlike the remote client view.
1. Local interface :
- It is a lightweight version of the remote interface, but for local clients.
- It includes business logic methods that can be called by a local client.
2. Local home interface :
- The local home interface specifies the methods used by local clients for locating, creating, and removing instances of enterprise bean classes.
EJB client JAR file :
- An EJB client JAR file is an optional JAR file that can contain all the class files that a client program needs to use the client view of the enterprise beans that are contained in the EJB JAR file.
- If you decide not to create a client JAR file for an EJB module, all of the client interface classes will be in the EJB JAR file.
EJB container :
- An EJB container is a run-time environment that manages one or more enterprise beans.
- It manages the life cycles of enterprise bean objects, coordinates distributed transactions and implements object security.
Deployment descriptor :
- A deployment descriptor is an XML file packaged with the enterprise beans in an EJB JAR file or an EAR file.
- It contains metadata describing the contents and structure of the enterprise beans, and runtime transaction and security information for the EJB container.
EJB server :
- An EJB server is a high-level process or application that provides a run-time environment to support the execution of server applications that use enterprise beans.
- An EJB server provides a JNDI-accessible naming service.
- It manages and coordinates the allocation of resources to client applications, provides access to system resources and provides a transaction service.