38
Java 2 Enterprise Edition Presented by: Reem Osama Shehata Supervised by: Dr. Sherif Aly 16 th March 2006

Java 2 Enterprise Edition Presented by: Reem Osama Shehata Supervised by: Dr. Sherif Aly 16 th March 2006

Embed Size (px)

Citation preview

Page 1: Java 2 Enterprise Edition Presented by: Reem Osama Shehata Supervised by: Dr. Sherif Aly 16 th March 2006

Java 2 Enterprise Edition

Presented by: Reem Osama ShehataSupervised by:Dr. Sherif Aly16th March 2006

Page 2: Java 2 Enterprise Edition Presented by: Reem Osama Shehata Supervised by: Dr. Sherif Aly 16 th March 2006

Outline

What is J2EE? Java 2 Platform Architecture J2EE and .NET Why J2EE? What Does J2EE Add? J2EE 1.4 APIs Enterprise JavaBeans Transactions Security Web-Services J2EE Architecture Deployment Demo (An Auction House)

Page 3: Java 2 Enterprise Edition Presented by: Reem Osama Shehata Supervised by: Dr. Sherif Aly 16 th March 2006

What is J2EE?

Java 2 Platform, Enterprise Edition– Anything after v.1.1 is “Java 2”– Corporation-wide, larger scale web-deployed applications– Support for huge numbers of users

Also J2SE– “Standard Edition” for desktop applications

Also J2ME– “Micro Edition” for small, light applications running on PDAs,

cell phones, pagers

Page 4: Java 2 Enterprise Edition Presented by: Reem Osama Shehata Supervised by: Dr. Sherif Aly 16 th March 2006

OptionalPackages

OptionalPackages

Java 2Enterprise

Edition(J2EE)

Java 2StandardEdition(J2SE)

Java Virtual Machine KVM

CLDCCDC

MIDPFoundation Profile

Personal Profile

Java 2 Micro Edition(J2ME)

Java 2 Platform Architecture

Page 5: Java 2 Enterprise Edition Presented by: Reem Osama Shehata Supervised by: Dr. Sherif Aly 16 th March 2006

J2EE and .NET

J2EE is a Sun Microsystems initiative .NET is a Microsoft initiative

– a “product”– Features closely match J2EE– Not as widely supported– Single vendor for OS (Win), database (SQL), app

server (IIS), programming languages (C#), ASP– Has been slow to take off– Not portable (Java is portable)

Page 6: Java 2 Enterprise Edition Presented by: Reem Osama Shehata Supervised by: Dr. Sherif Aly 16 th March 2006

Why J2EE?

Increased demand for distributed transactional applications

Extended Enterprises and Fast-moving and demanding world of e-commerce and information technology

Component-based approach to the design, development, assembly, and deployment of enterprise applications

Eliminates or drastically reduces user administration and training by providing the first tier users with easy access to business complexities

Page 7: Java 2 Enterprise Edition Presented by: Reem Osama Shehata Supervised by: Dr. Sherif Aly 16 th March 2006

Why J2EE?

Provides services to a broad range of users, these services need to be:

Highly available, to meet the needs of today’s global business environment.

Secure, to protect the privacy of users and the integrity of the enterprise.

Reliable and scalable, to ensure that business transactions are accurately and promptly processed.

Page 8: Java 2 Enterprise Edition Presented by: Reem Osama Shehata Supervised by: Dr. Sherif Aly 16 th March 2006

So….

The Java™ 2 Platform, Enterprise Edition (J2EE™) reduces the cost and complexity of developing multi-tier, enterprise services.

J2EE applications can be rapidly deployed and easily enhanced as the enterprise responds to competitive pressures.

Enhanced web services, J2EE includes simplified web services support and the latest web services APIs, making it an ideal implementation platform for Service-Oriented Architectures (SOA).

Page 9: Java 2 Enterprise Edition Presented by: Reem Osama Shehata Supervised by: Dr. Sherif Aly 16 th March 2006

What does J2EE add?

Support for – Enterprise JavaBeans (EJBs)– Java Server Pages (JSPs)– Enhanced Web-Services– XML– JMS

And Others…..

Page 10: Java 2 Enterprise Edition Presented by: Reem Osama Shehata Supervised by: Dr. Sherif Aly 16 th March 2006

J2EE 1.4 APIs

Enterprise JavaBeans Technology (EJBs)

Java Servlet Technology JavaServer Pages

Technology (JSP) Java Message Service

(JMS) Java Transaction (JTA) JavaMail JDBC API Java Naming and

Directory Interface (JNDI)

JavaBeans Activation Framework (JAF)

Java API for XML Processing (JAXP)

Java API for XML-Based RPC

SOAP with Attachments API for Java

Java API for XML Registries

J2EE Connector Architecture

Page 11: Java 2 Enterprise Edition Presented by: Reem Osama Shehata Supervised by: Dr. Sherif Aly 16 th March 2006

Enterprise JavaBeans

An Enterprise JavaBeans™ (EJB™) component, or enterprise bean, is a body of code having fields and methods to implement modules of business logic. You can think of an enterprise bean as a building block that can be used alone or with other enterprise beans to execute business logic on the J2EE server.

The EJB container and not the bean developer is responsible for system-level services such as transaction management and security authorization.

The client developer is relieved from coding the business logic. As a result the clients are thinner which is better for support by small devices.

Because the beans are portable they can be used and built upon on any compliant J2EE server which saves time and effort.

Page 12: Java 2 Enterprise Edition Presented by: Reem Osama Shehata Supervised by: Dr. Sherif Aly 16 th March 2006

Enterprise Bean Types

Page 13: Java 2 Enterprise Edition Presented by: Reem Osama Shehata Supervised by: Dr. Sherif Aly 16 th March 2006

Transactions

What is a transaction? The steps within a transaction are a unified whole, a

transaction is often defined as an indivisible unit of work. Transactions control the concurrent access of data by multiple

programs. In the event of a system failure, transactions make sure that after recovery the data will be in a consistent state.

A transaction can end in two ways: with a commit or with a rollback.

The Java Transaction API (JTA) provides a standard interface for demarcating transactions.

The J2EE architecture provides a default auto commit to handle transaction commits and rollbacks.

Page 14: Java 2 Enterprise Edition Presented by: Reem Osama Shehata Supervised by: Dr. Sherif Aly 16 th March 2006

Security

In Enterprise applications you often need to protect resources to ensure that only authorized users have access.

Security for components is provided by their containers. A container provides two kinds of security: declarative and

programmatic security. Secure Socket Layer (SSL) technology allows web browsers

and web servers to communicate over a secure connection. Each tier has its own security module. The Java Authentication and Authorization Service (JAAS)

provides a way for a J2EE application to authenticate and authorize a specific user or group of users to run it.

Page 15: Java 2 Enterprise Edition Presented by: Reem Osama Shehata Supervised by: Dr. Sherif Aly 16 th March 2006

Web-Services

Web services are web-based enterprise applications that use open, XML-based standards and transport protocols to exchange data with calling clients.

No low-level programming is needed because the XML API implementations do the work of translating the application data to and from an XML-based data stream that is sent over the standardized XML-based transport protocols (Simple Object Access Protocol- SOAP).

Page 16: Java 2 Enterprise Edition Presented by: Reem Osama Shehata Supervised by: Dr. Sherif Aly 16 th March 2006

Java Servlet Technologyand JavaServer Pages

Java servlet technology lets you define HTTP-specific servlet classes. A servlet class extends the capabilities of servers that host applications that are accessed by way of a request-response programming model.

JavaServer Pages™ (JSP) technology lets you put parts of servlet code directly into a text-based document. A JSP page is a text-based document that contains two types of text: static data (which can be expressed in any text-based format such as HTML, WML, and XML) and JSP elements, which determine how the page constructs dynamic content.

Page 17: Java 2 Enterprise Edition Presented by: Reem Osama Shehata Supervised by: Dr. Sherif Aly 16 th March 2006

Java Message Service API

The Java Message Service (JMS) API is a messaging standard that allows J2EE application components to create, send, receive, and read messages. Thus, It enables distributed communication.

Page 18: Java 2 Enterprise Edition Presented by: Reem Osama Shehata Supervised by: Dr. Sherif Aly 16 th March 2006

JavaMail API

J2EE applications use the JavaMail™ API to send email notifications. The Java-Mail API has two parts: an application-level interface used by the application components to send mail, and a service provider interface.

The J2EE platform includes JavaMail with a service provider that allows application components to send Internet mail.

It is very needed in enterprise applications as they usually require the sending of confirmation mails for all types of transactional processes.

Page 19: Java 2 Enterprise Edition Presented by: Reem Osama Shehata Supervised by: Dr. Sherif Aly 16 th March 2006

JavaBeans Activation Framework

The JavaBeans Activation Framework (JAF) is included because JavaMail uses it. JAF provides standard services to determine the type of an arbitrary piece of data, encapsulate access to it, discover the operations available on it, and create the appropriate JavaBeans component to perform those operations.

Page 20: Java 2 Enterprise Edition Presented by: Reem Osama Shehata Supervised by: Dr. Sherif Aly 16 th March 2006

Java API for XML Processing

The Java API for XML Processing (JAXP) supports the processing of XML documents using Document Object Model (DOM), Simple API for XML (SAX), and Extensible Stylesheet Language Transformations (XSLT).

JAXP enables applications to parse and transform XML documents independent of a particular XML processing implementation.

Page 21: Java 2 Enterprise Edition Presented by: Reem Osama Shehata Supervised by: Dr. Sherif Aly 16 th March 2006

Java API for XML-Based RPC

The Java API for XML-based RPC (JAX-RPC) uses the SOAP standard and HTTP, so client programs can make XML-based remote procedure calls (RPCs) over the Internet.

It combine HTTP with a Java technology version of the Secure Socket Layer (SSL) and Transport Layer Security (TLS) protocols to establish basic or mutual authentication.

Page 22: Java 2 Enterprise Edition Presented by: Reem Osama Shehata Supervised by: Dr. Sherif Aly 16 th March 2006

Java API for XML Registries

The Java API for XML Registries (JAXR) lets you access business and generalpurpose registries over the web. JAXR supports the ebXML Registry and Repository standards and the emerging UDDI (Universal Description, Discovery and Integration ) specifications.

By using JAXR, developers can learn a single API and gain access to both of these important registry technologies.

Page 23: Java 2 Enterprise Edition Presented by: Reem Osama Shehata Supervised by: Dr. Sherif Aly 16 th March 2006

J2EE Connector Architecture

The J2EE Connector architecture is used by J2EE tools vendors and system integrators to create resource adapters that support access to enterprise information systems (EISs) that can be plugged into any J2EE product.

A resource adapter is a software component that allows J2EE application components to access and interact with the underlying resource manager of the EIS.

It is different for each database or EIS.

Page 24: Java 2 Enterprise Edition Presented by: Reem Osama Shehata Supervised by: Dr. Sherif Aly 16 th March 2006

Java Naming and Directory Interface (JNDI)

It provides applications with methods for performing standard directory operations, such as associating attributes with objects and searching for objects using their attributes.

Using JNDI, a J2EE application can store and retrieve any type of named Java object.

Page 25: Java 2 Enterprise Edition Presented by: Reem Osama Shehata Supervised by: Dr. Sherif Aly 16 th March 2006

Simplified System Integration

The J2EE APIs enable systems and applications integration through the following:

Unified application model across tiers with enterprise beans

Simplified request-and-response mechanism with JSP pages and servlets

Reliable security model with JAAS XML-based data interchange integration with JAXP, SAAJ,

and JAX-RPC Simplified interoperability with the J2EE Connector

architecture Easy database connectivity with the JDBC API Enterprise application integration with message-driven

beans and JMS, JTA, and JNDI

Page 26: Java 2 Enterprise Edition Presented by: Reem Osama Shehata Supervised by: Dr. Sherif Aly 16 th March 2006

J2EE Architecture

A distributed multitiered application model for enterprise applications – Client-tier components run on the client

machine.– Web-tier components run on the J2EE server.– Business-tier components run on the J2EE

server.– Enterprise information system (EIS)-tier

software runs on the EIS server.

Page 27: Java 2 Enterprise Edition Presented by: Reem Osama Shehata Supervised by: Dr. Sherif Aly 16 th March 2006

A Multitierd Application

Page 28: Java 2 Enterprise Edition Presented by: Reem Osama Shehata Supervised by: Dr. Sherif Aly 16 th March 2006

Server Communication

Page 29: Java 2 Enterprise Edition Presented by: Reem Osama Shehata Supervised by: Dr. Sherif Aly 16 th March 2006

Web Tier and J2EE Applications

Page 30: Java 2 Enterprise Edition Presented by: Reem Osama Shehata Supervised by: Dr. Sherif Aly 16 th March 2006

Business and EIS tiers

Page 31: Java 2 Enterprise Edition Presented by: Reem Osama Shehata Supervised by: Dr. Sherif Aly 16 th March 2006

J2EE Architecture Diagram

Page 32: Java 2 Enterprise Edition Presented by: Reem Osama Shehata Supervised by: Dr. Sherif Aly 16 th March 2006

Deployment

The technologies needed NetBeans IDE 4.1: http://www.netbeans.info/downloads Application Server The Sun Java System Application

Server Platform Edition 8.1 The Java 2 Software Development Kit, Standard Edition

(J2SE SDK) 1.4.2_06 or higher http://java.sun.com/j2ee/1.4/download.html#sdk

You can also download the Application Server bundled with the IDE from:

http://www.netbeans.info/downloads

Page 33: Java 2 Enterprise Edition Presented by: Reem Osama Shehata Supervised by: Dr. Sherif Aly 16 th March 2006

Application Server Installation Tips

Note the HTTP port at which the server is installed. The default port is 8080. If 8080 is in use during installation and the installer chooses another port or if you decide to change it yourself, you will need to update the configuration files in your application.

In the Admin configuration pane of the Application Server installer, Select the “Don’t Prompt for Admin User Name” radio button. This will save the user name and password so that you won’t need to provide them when performing administrative operations with the IDE. You will still have to provide the user name and password to log in to the Admin Console.

Page 34: Java 2 Enterprise Edition Presented by: Reem Osama Shehata Supervised by: Dr. Sherif Aly 16 th March 2006

Demo

The example application is a web-based auction house written for the Enterprise JavaBeansTM platform

The three tiers in the web-based auction house example consists of the thin-client servlet, the Enterprise JavaBeans server (the application server), and the database server as shown in the figure:

Page 35: Java 2 Enterprise Edition Presented by: Reem Osama Shehata Supervised by: Dr. Sherif Aly 16 th March 2006

Enterprise JavaBeans

Entity Beans – AuctionItemBean and RegistrationBean

Session Beans– SellerBean and BidderBean

The auction house example implements a complete Enterprise JavaBeans solution by providing only the business logic and using the underlying services provided by the architecture

Page 36: Java 2 Enterprise Edition Presented by: Reem Osama Shehata Supervised by: Dr. Sherif Aly 16 th March 2006

Deploying the Auction Example

Java Archive (JAR) file format is a compression and file packaging format and tool for bundling executable files with other related application files so they can be deployed as a single unit. The auction application has three units of files to deploy to three different locations. 1. The HTML files that make up the auction application user

interface deploy to a publicly accessible location under the web server.

2. The Enterprise Beans deploy to an internal location accessible to your production installation of the Enterprise JavaBeans server.

3. The Administration applet deploys to an internal location accessible to auction administrators where it is run from their browsers.

Page 37: Java 2 Enterprise Edition Presented by: Reem Osama Shehata Supervised by: Dr. Sherif Aly 16 th March 2006

Deploying the Auction Example (cont’d)

Bundle and Deploy the HTML Files Bundle and Deploy the Enterprise Beans Bundle and Deploy the Administration Applet Using the jar tool

file:///E:/Reem/advancedJava/java/JDCBook/JDCBook/jar.html#htmlExample MockupE:\Reem\advancedJava\java\JDCBook\JDCBook\

Auction\index.html

Page 38: Java 2 Enterprise Edition Presented by: Reem Osama Shehata Supervised by: Dr. Sherif Aly 16 th March 2006

Thank YouQuestions???