JAVA 2 Enterprise Edition-Enterprise Applicatio Development-Lecture Handout, Exercises of Software Development

This lecture handout was provided by Sir Aabher Dutt at Indian Institute of Space Science and Technology for Enterprise Application Development course. It includes: Java, Enterprise, Edition, Database, Information, System, Services, Protocols, Applets, Server, Multithreaded

Typology: Exercises

2011/2012

Uploaded on 07/19/2012

pankti
pankti 🇮🇳

4.1

(8)

39 documents

1 / 10

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
1
JAVA 2 Enterprise Edition
J2EE stands for “Java to Enterprise Edition”. “Sun Microsystems”, together with “IBM”, designed Java
2 Platform Enterprise Edition. J2EE is a multi tiered architecture model and was designed to develop
enterprise information system (EIS). EIS is a multi-tier, web based, enterprise application with
distributed components. J2EE services are performed in the middle tier between the user's machine
and the enterprise's databases and legacy information systems.
J2EE is a widely used platform for server programming in Java. It is a platform independent,
Java centric environment. The J2EE platform consists of:
Set of services
APIs, and
Protocols
J2EE supports:
Pure HTML
Java applets or applications
It relies on Java Server Pages and servlet code to create HTML or other formatted data for the client.
Goals
It reduces the cost and complexity of development
It allows J2EE applications to be rapidly deployed and easily enhanced
J2EE Block Diagram
Figure 1: J2EE block diagram
J2EE Architecture
J2EE multi-tiered applications are generally considered to be three tiers applications because they are
distributed over three different locations:
Client machine
docsity.com
pf3
pf4
pf5
pf8
pf9
pfa

Partial preview of the text

Download JAVA 2 Enterprise Edition-Enterprise Applicatio Development-Lecture Handout and more Exercises Software Development in PDF only on Docsity!

JAVA 2 Enterprise Edition

J2EE stands for “Java to Enterprise Edition”. “Sun Microsystems”, together with “IBM”, designed Java 2 Platform Enterprise Edition. J2EE is a multi tiered architecture model and was designed to develop enterprise information system (EIS). EIS is a multi-tier, web based, enterprise application with distributed components. J2EE services are performed in the middle tier between the user's machine and the enterprise's databases and legacy information systems. J2EE is a widely used platform for server programming in Java. It is a platform independent, Java centric environment. The J2EE platform consists of:  Set of services  APIs, and  Protocols J2EE supports:  Pure HTML  Java applets or applications It relies on Java Server Pages and servlet code to create HTML or other formatted data for the client.

Goals  It reduces the cost and complexity of development  It allows J2EE applications to be rapidly deployed and easily enhanced

J2EE Block Diagram

Figure 1: J2EE block diagram

J2EE Architecture J2EE multi-tiered applications are generally considered to be three tiers applications because they are distributed over three different locations:  Client machine

 J2EE server machine and  Database at back end

Figure 2: 3-tier J2EE model

The above figure shows an example of J2EE architecture. It consists of client tier, J2EE server tier and a database tier or EIS tier. Client tier consists of different J2EE applications including dynamic HTML pages. J2EE server tier further consists of web tier and business tier including JSP pages and enterprise JAVA beans respectively

Figure 3: J2EE Architectural view

Three tier applications that run in this way extend the standard two tiered client and server model by placing a multithreaded application server between the client application and back-end storage

1.1 Java Servlets:

Servlets provide a component based, platform-independent, method for building web based applications, without the performance limitations of CGI programs. Important features of Servlets are:  These are special Java classes located on the server  Use HTTP for request/response. It utilize data embedded within HTTP requests for input and provide resulting output using the HTTP response.  Loaded into memory once and then called many times  Provides APIs (Applications Programming Interface) for session management  Available to all clients  Dynamic generation of web content instead of static content  The client invokes a servlet using an HTTP request  The web container forwards the request to the servlet.  The servlet processes it and generates the content dynamically.  The web container then transmits the response back to the web server and finally to the client Disadvantages of servlets are:  Html mixed with Java  Recompilation required after changes in the source code

1.2 Java Server Pages:

Important features of java server pages are:  JSPs are special html-pages located on the server  It accepts HTML tags, special JSP tags, and scriptlets of Java code  These are naturally appropriate for the implementation of web-based user interfaces  JSPs are not particular well suited to perform processing logic  JSPs are transformed into servlets at runtime  No Recompilation required after changes of the layout  JSP pages provide dynamic web application capability to the J2EE Platform.  JSPs help us to separate presentation from content.

1.3 Enterprise Java Beans:

EJBs are the server side components technology that are developed into containers. EJBs provide another layer where the platform's logic is stored. An EJB server provides functions such as:  Threading  Concurrency  Security  Memory management

Figure 5: EJB architecture

Three types of EJBs are:

1. Entity Beans a. Provide an object-oriented view to the underlying persistent data b. Container- vs. Bean Managed Persistence c. Synchronous access d. For example, an entity bean could represent a customer and changing the values in that entity bean would cause update to database row 2. Session Beans a. Modeling business processes b. Stateless vs. stateful session beans c. They are conversational and perform specific actions d. Synchronous access using RMI-IIOP e. For example, a session bean could charge a credit card for a specific transaction 3. Message-driven Beans a. Stateless, server side components b. Invoked by EJB containers on the receipt of a message c. Provide asynchronous access d. For example, a message bean could be activated when vendor sends a purchase order to queue.

 EJB container to manage EJB components  Web container to manage servlets and JSP pages  Other two containers are client side containers:  Application container for stand-alone GUI console  Applet container (a browser) Containers handle:  Concurrency  Security  Availability  Scalability  Persistence  Transaction  Life-cycle management  Management

1.2 J2EE components:

Each component is a modular software unit deployed within the application server and interacts with its host environment and other components through the J2EE APIs. APIs determine the facilities that the components have access to.  Client components run on the client machine, which correlate to the client containers. Application clients and applets are client components.  Java Servlet and JavaServer Pages (JSP) technology components are web components.  Enterprise JavaBeans (EJB) components (enterprise beans) are business components. Components handle:  Presentation  Business Logic

J2EE APIs and Technologies There are several APIs and technologies which make J2EE a working platform. These APIs and technologies are:

  1. Java Database Connectivity (JDBC) API: It is dedicated to database access, like ADO.NET..
  2. Remote Method Invocation (RMI): It allows Java objects to communicate remotely with other objects.
  3. Java IDL: IDL is a standard platform-independent declarative language which is used to define interfaces. It allows any Java object to communicate with other objects in any language by means of IDL.
  4. Enterprise Java Beans: This layer of J2EE handles the transactionnal, load-balancing, and component scalability services. It looks like the .NET Serviced Components. 5. Servlets: A way of building dynamic web pages exclusively coded with Java classes.
  1. Java Server Pages (JSP): A way of building dynamic web pages that contain Java code.
  2. Java Message Service (JMS): JMS API is a messaging standard that allows J2EE components to create, send, receive, and read messages. It enables distributed communication between components.
  3. Java Transaction API (JTA): JTA allows J2EE components to perform distributed transactions.
  4. JavaMail: JavaMail API allows Java components send and receive emails in a platform- independent way.
  5. Java API for XML Processing (JAXP): Extensive Markup Language (XML) is a data format for interchanging structured documents on the Web
  6. TagLibs : A kind of extensible and reusable tags to be included into JSP pages

J2EE Application Anatomies4 - tier J2EE applications  HTML client, JSP/Servlets, EJB, JDBC/Connector  3 - tier J2EE applications  HTML client, JSP/Servlets, JDBC  3 - tier J2EE applications  EJB standalone applications, EJB, JDBC/Connector  B2B Enterprise applications  J2EE platform to J2EE platform through the exchange of JMS or XML-based messages

Figure 8: 3-tier application model

 Several steps required until the application is running  Compilation  Packaging  Deployment  Running the application