Saturday, January 10, 2009

Enterprise JavaBeans Technology ejb

Enterprise JavaBeans Technology ejb

Enterprise JavaBeans Technology

EJB is a standard for developing and deploying

server-side distributed components in Java. It defines an agreement (contract) between components and application servers that enables any component to run in any compliant application server.

The three main value propositions of EJB are

It is a ubiquitous industry standard. EJB has benefited from its widespread use—it is easy now to hire staff with a good knowledge of EJB to develop and maintain your systems. Also, due to the maturity of the technology, numerous best practices for implementing EJB are available to those who use it.

Portability is possible. The EJB specification is published and available freely to all. Since EJB is a standard, you do not need to gamble on the long-term viability and proprietary architecture of a single vendor. And although porting applications from one platform to another will never

be without its costs, it is easier to get it done working with a standard than without it.

The three main value propositions of EJB are

Rapid application development. Your application can be built faster because you get middleware infrastructure services such as transactions, pooling, security, and so on from the application server. Also, innumerable tools have been made available by vendors as well as the open source community over the years to do rapid application development using EJB.

Why Java?

The EJB framework has supported only the Java language thus far, unlike the .NET framework that supports multiple languages. Though this sounds a bit restrictive, the good news is that Java is one of the best-suited languages for building distributed components for the following reasons

Interface/implementation separation.

Safe and secure

Cross-platform

EJB as a Business Tier Component

Enterprise beans, on the other hand, are not intended for the client side; they are server-side components. They are meant to perform server-side operations, such as executing complex algorithms or performing highly transactional business operations. The server side has different kinds of needs than GUI clients do. Server-side components need to run in a highly available (24x7),fault-tolerant, transactional, multi-user, secure environment. The application server provides such a server-side environment for the enterprise beans, and it provides the runtime services necessary for the functioning of enterprise beans

EJB components (enterprise beans) can perform any of the following tasks

Perform business logic. Examples include computing taxes on a shopping cart, ensuring that the manager has authority to approve the purchase order, or sending an order confirmation e-mail using the JavaMail API

Access a database

Integrate with other systems

VSAM , SAP R/3

Examples of EJB clients

Application clients.

Dynamically generated Web pages

Web service clients

Distributed Computing

EJB enables development and deployment of distributed components. A distributed component, also commonly referred to as distributed object or remote object, is callable from a remote system .

That is, not only can it be called from an in-process client but also from an out-of-process client that might be located on a different system on the network.

Steps in remote method Invocation

The client calls a stub, which is a client-side proxy object. This stub is responsible for masking network communications from the client. The stub knows how to call over the network using sockets and also how to

massage parameters from their Java representations to the corresponding network representations

The stub calls over the network to a skeleton, which is a server-side proxy object. The skeleton masks network communication from the distributed object.

The skeleton delegates the call to the appropriate implementation object. This object serves the call and does its work, and returns control to the skeleton, which returns it to the stub, which finally returns control to the client.

Remote Method Invocation

EJB Middleware Services

There are two ways in which a framework such as EJB can provide middleware services—explicitly and implicitly. To use explicit middleware services you must explicitly call the middleware services’ APIs.

Implicit middleware services can be used without having to write against the middleware APIs viz. implicitly.

Roles in the EJB Application Life Cycle

An EJB application’s life cycle involve three main phases—development, deployment, and administration

The Bean Provider

The bean provider supplies business components, or enterprise beans. It is tasked with writing the code of enterprise beans and also unit testing their beans. The bean provider can be an internal department providing components to other departments, or it can be a group of developers in a team responsible for writing EJB components, which can subsequently be used by other developers in the same team

The Application Assembler

The application assembler is the overall application architect. This party is responsible for understanding how various components fit together and writes the glue code, if required, to make the components work together in a meaningful manner

The EJB Deployer

After the application assembler builds the application, the application must be deployed (and go into production) in a running operational environment

The System Administrator

Once the deployment goes live, the system administrator steps in to oversee the stability of the operational solution. The system administrator is responsible for the upkeep and monitoring of the deployed system and may make use of various performance monitoring and application management tools in the process.

EJB Ecosystem

The EJB ecosystem comprises literally, thousands of tools, servers, utilities, IDEs, and so on that are available to the developers for all stages of EJB application development and deployment

EJB Container

The EJB container is the piece of software that implements the EJB specification.

The reason it is called a container is that it provides an environment within which EJB components live and breath

It provides containment to the EJB components

An application server provider usually also provides

an EJB container

EJB Tools

To facilitate EJB development and deployment

Borland JBuilder, Oracle JDeveloper, BEA WebLogic Workshop, IBM WebSphere Studio Application

Developer, Sun Microsystems Java Studio Enterprise, NetBeans, and Eclipse.

The Java EE Technologies

Java EE is a robust suite of middleware services that make life very easy for server-side application developers. It builds upon the existing technologies in the J2SE. J2SE includes support for core Java language semantics as well as various libraries (.awt, .net, .io, and so on).

Java EE technologies

Enterprise JavaBeans (EJB)

Java API for Web Services (JAX-WS)

The Web Services Metadata for the Java Platform

Java Remote Method Invocation (RMI) and RMI-IIOP. RMI

Java Naming and Directory Interface (JNDI). JNDI

Java Database Connectivity (JDBC).

Java Transaction API (JTA) and Java Transaction Service (JTS).

Java Transaction API (JTA) and Java Transaction Service (JTS).

Java EE technologies

Java Messaging Service (JMS).

Java servlets.

Java Server Pages (JSP)

JavaServer Faces (JSF).

Java EE Connector Architecture (JCA).

The Java API for XML Parsing (JAXP).

The Java Architecture for XML Binding (JAXB).

The Java Authentication and Authorization Service (JAAS).

What Constituted a Pre-EJB 3.0 Enterprise Bean?

An enterprise bean is a server-side software component that can be deployed in a distributed multi-tiered environment, and it will remain that way going forward.

There are three types of beans—session beans, entity beans, and message-driven beans (MDBs).

Session beans

Session beans model business processes. They are like verbs because they perform actions. The action could be anything, such as adding numbers, accessing a database, calling a legacy system, or calling other enterprise beans.

Examples include a pricing engine, a workflow

engine, a catalog service, a credit card authorization service.

Message-driven beans (MDBs)

Message-driven beans are similar to session

beans in that they perform actions. The difference is that you can call message-driven beans only implicitly by sending messages to those beans. That is to say that there is no direct way of invoking a method on the message-driven bean

Entity beans

Entity beans model business data. They are like nouns because they are data objects, that is, Java objects that cache database information.

Examples include a product, an order, an employee, a credit card, or a stock

EJB implementation

Enterprise bean class.

EJB object

Remote interface

Local interface

Home interface

Deployment descriptor

Vendor-specific files

The Ejb-jar file

Developing and Deploying a Pre-EJB 3.0 Enterprise
Java Bean

1. Write the Java code for the files composing your bean—the remote and/or local interface, the bean class, and the home interface.

2. Write the deployment descriptor or have it generated by using an IDE or tools such as XDoclet.

3. Compile the Java source codes from step 1.

4. Using the jar utility, create an Ejb-jar file containing the deployment descriptor and the .class files from step 3.

5. Deploy the Ejb-jar file into your container in a vendor-specific manner,perhaps by using a vendor-specific tool or perhaps by copying your Ejb-jar file into a folder where your container looks to load Ejb-jar files.

No comments:

Post a Comment