Wednesday, February 10, 2010

EJB-Introduction

Enterprise JAVA Bean(EJB)

EJB are the server side component wwritten in java.They are hosted in EJB conatiner and are based on remote method invocation(RMI) communication.They are platform independent and contains the business logic for any business application.It can be exposed as a web service.

Types of EJB

1>Entity Bean
It is used to model the persistence part of an application.

2>Session Bean
IT is modelled to perform a client and service provider application where in client invokes a business application running on provider side.

3>Message –driven –Bean
They are triggered by the message sent to a messaging server like IBM MQ series,Oralce AQ.It enables sending asynchronous message between system components.


JAVA persistence API

IT is a relational mapping between the objects to the corresponding records in the database.Basically used for data persistence.

Web components
=================
Servlets-A servlet is a java program that runs on a server and produces dynamic pages typically in response to a client request.So a general scenario is

Cleint send a request through servlet.It is nothing but the java code which communicates with the other java class and end services like database using JDBC and form the result in form of HTML or XML and send it back to the client’s web browser.Servlets mainly contain java code so they are best suited for programs that perform more processsing than presentation.So we use JSP’s for presentation layer.

JSP’s-Java Server Page or JSP is a text based document that includes HTML,JSP tags and java code.It is mainly focused on presentation.IT seperates the code from the presentation logic.

JSF-Java server faces or JSF is a component based framework for developing web based applications.IT combines the functionality of a JSP and a built in controller.IT is based on MVC architecture.I will discuss the MVC architecture later.


JAVA EE application
Java EE application are server side applications that contain standard components such as servlets,JSP’s,JSF’s and EJB’s.All these things are packages in the form of an ear (Enterprise Archieve)file.An ear file contains a Java ee module and deployment descriptors.Deployment descriptors are xml document that describes the deployment settings of an application,a module or a component.A ear file is typically contains the following things

1>.war files-It includes all the web components like servlet,jsp,jsf,html,xml,gif files etc.
2>.jar files-It includes all the java codes and the deployment descriptor.
3>.rar files(Resource adapter)-It contains all the java interface,classes,libraries and documentation and the resource adapter deployment descriptor.
4>ejb.jar-IT contains the class files for enterprise beans and an ejb deployment descriptor.


Communication API’s
Java EE provides several API’s that include
1>Remote method Invocation(RMI).
2>Java Naming and Directory Interface(JNDI).
3>Java database connectivity(JDBC).
4>Java Message Service(JMS).

The directiry structure for an ear file looks like this

No comments: