J2EE Overview. Presentation Overview. Introduction to J2EE Explain the major technologies within the J2EE designation J2EE applications J2EE servers

Similar documents
Software Development using MacroMedia s JRun

Client-Server Architecture & J2EE Platform Technologies Overview Ahmed K. Ezzat

Java 2 Platform, Enterprise Edition (J2EE) Bruno Souza Java Technologist, Sun Microsystems, Inc.

Java EE Introduction, Content. Component Architecture: Why and How Java EE: Enterprise Java

Java E-Commerce Martin Cooke,

Component Middleware. Sophie Chabridon. INT - INF Department - Distributed Systems team 2006

Announcements. Comments on project proposals will go out by in next couple of days...

J2EE Web Development. Agenda. Application servers. What is J2EE? Main component types Application Scenarios J2EE APIs and Services.

Lösungsvorschläge zum Übungsblatt 13: Fortgeschrittene Aspekte objektorientierter Programmierung (WS 2005/06)

ACM Crossroads Student Magazine The ACM's First Electronic Publication

Web Container Components Servlet JSP Tag Libraries

Building Web Applications, Servlets, JSP and JDBC

Glassfish, JAVA EE, Servlets, JSP, EJB

Java 2 Platform, Enterprise Edition (J2EE): Enabling Technologies for EAI

How to Build an E-Commerce Application using J2EE. Carol McDonald Code Camp Engineer

White paper. IBM WebSphere Application Server architecture

Contents. Client-server and multi-tier architectures. The Java 2 Enterprise Edition (J2EE) platform

JAVA ENTERPRISE IN A NUTSHELL. Jim Farley and William Crawford. O'REILLY 4 Beijing Cambridge Farnham Koln Paris Sebastopol Taipei Tokyo.

Oracle WebLogic Foundation of Oracle Fusion Middleware. Lawrence Manickam Toyork Systems Inc

EJB & J2EE. Component Technology with thanks to Jim Dowling. Components. Problems with Previous Paradigms. What EJB Accomplishes

WebSphere Training Outline

Internet Engineering: Web Application Architecture. Ali Kamandi Sharif University of Technology Fall 2007

CACHÉ: FLEXIBLE, HIGH-PERFORMANCE PERSISTENCE FOR JAVA APPLICATIONS

What Is the Java TM 2 Platform, Enterprise Edition?

EJB 3.0 and IIOP.NET. Table of contents. Stefan Jäger / stefanjaeger@bluewin.ch

IBM Rational Rapid Developer Components & Web Services

3-Tier Architecture. 3-Tier Architecture. Prepared By. Channu Kambalyal. Page 1 of 19

Creating Java EE Applications and Servlets with IntelliJ IDEA

Web Application Programmer's Guide

Implementation of an Enterprise-level Groupware System Based on J2EE Platform and WebDAV Protocol

How To Protect Your Computer From Being Hacked On A J2Ee Application (J2Ee) On A Pc Or Macbook Or Macintosh (Jvee) On An Ipo (J 2Ee) (Jpe) On Pc Or

JAVA/J2EE DEVELOPER RESUME

Introduction to J2EE Web Technologies

Implementing the Shop with EJB

AN OVERVIEW OF SERVLET AND JSP TECHNOLOGY

Enterprise Application Integration

Automatic generation of distributed dynamic applications in a thin client environment

Supplement IV.E: Tutorial for Tomcat. For Introduction to Java Programming By Y. Daniel Liang

7 Web Databases. Access to Web Databases: Servlets, Applets. Java Server Pages PHP, PEAR. Languages: Java, PHP, Python,...

Objectives. Software Development using MacroMedia s JRun. Enterprise Application Model. Topics for Discussion

WEB APPLICATION DEVELOPMENT. UNIT I J2EE Platform 9

Servlets. Based on Notes by Dave Hollinger & Ethan Cerami Also, the Online Java Tutorial by Sun

Chapter 4. Architecture. Table of Contents. J2EE Technology Application Servers. Application Models

2012 LABVANTAGE Solutions, Inc. All Rights Reserved.

JBS-102: Jboss Application Server Administration. Course Length: 4 days

Mastering Tomcat Development

MagDiSoft Web Solutions Office No. 102, Bramha Majestic, NIBM Road Kondhwa, Pune Tel: /

An introduction to web programming with Java

Extreme Java G Session 3 Main Theme Java Core Technologies (Part I) Dr. Jean-Claude Franchitti

Agenda. Summary of Previous Session. Application Servers G Session 3 - Main Theme Page-Based Application Servers (Part II)

Japan Communication India Skill Development Center

JEE Web Applications Jeff Zhuk

WebOTX Application Server

Complete Java Web Development

Java EE 6 Ce qui vous attends

Introduction to Sun ONE Application Server 7

Java EE 7: Back-End Server Application Development

Enterprise Applications

Long haul product development

Database Applications Recitation 10. Project 3: CMUQFlix CMUQ s Movies Recommendation System

As you learned about in Chapter 1, WebSphere Application Server V6 supports the

Client-server 3-tier N-tier

Getting Started with Web Applications

Course Name: Course in JSP Course Code: P5

Java-technology based projects

Client/server is a network architecture that divides functions into client and server

Oracle WebLogic Server 11g Administration

CrownPeak Java Web Hosting. Version 0.20

Web Application Architecture (based J2EE 1.4 Tutorial)

CHAPTER 1 - JAVA EE OVERVIEW FOR ADMINISTRATORS

INTRODUCTION TO WEB TECHNOLOGY

Version Overview. Business value

Communiqué 4. Standardized Global Content Management. Designed for World s Leading Enterprises. Industry Leading Products & Platform

A standards-based approach to application integration

CS Developing Web Applications with Java Technologies

2. Follow the installation directions and install the server on ccc

WebSphere Suite Overview

era J2EE Platform and Tool Recommendations

Developing an EJB3 Application. on WebSphere 6.1. using RAD 7.5

WHITE PAPER. Domo Advanced Architecture

Jitterbit Technical Overview : Microsoft Dynamics AX

DataDirect XQuery Technical Overview

How To Create A C++ Web Service

The Comparison of J2EE and.net for e-business

IBM WebSphere Server Administration

Web Express Logon Reference

WebSphere Server Administration Course

Virtual Credit Card Processing System

How To Understand The Architecture Of Java 2Ee, J2Ee, And J2E (Java) In A Wordpress Blog Post

Case Studies of Running the Platform. NetBeans UML Servlet JSP GlassFish EJB

10. Java Servelet. Introduction

OUR COURSES 19 November All prices are per person in Swedish Krona. Solid Beans AB Kungsgatan Göteborg Sweden

White Paper: 1) Architecture Objectives: The primary objective of this architecture is to meet the. 2) Architecture Explanation

How To Test A Load Test On A Java Testnet 2.5 (For A Testnet) On A Test Server On A Microsoft Web Server On An Ipad Or Ipad (For An Ipa) On Your Computer Or Ipa

ActiveVOS Server Architecture. March 2009

Oracle WebLogic Server

enterprise^ IBM WebSphere Application Server v7.0 Security "publishing Secure your WebSphere applications with Java EE and JAAS security standards

CONFIGURATION AND APPLICATIONS DEPLOYMENT IN WEBSPHERE 6.1

Distributed Database Design

B. WEB APPLICATION ARCHITECTURE MODELS

Transcription:

J2EE Overview Presentation Overview Introduction to J2EE Explain the major technologies within the J2EE designation J2EE applications J2EE servers 1

The Java 2 Platform Platform introduced June, 1999 J2SE Java 2 Standard d Edition Java for the desktop / workstation http://java.sun.com/j2se J2ME Java 2 Micro Edition Java for the consumer device http://java.sun.com/j2me J2EE - Java 2 Enterprise Edition Java for the server http://java.sun.com/j2ee The Java 2 Platform http://java.sun.com/java2/ 2

J2EE Technologies Java Servlets JSP EJB JMS JDBC JNDI JTA / JTS JavaMail JAAS XML J2EE Components http://java.sun.com/j2ee/overview3.html 3

Java Servlets Servlets are the Java platform technology of choice for extending and enhancing web servers. Servlets provide a component-based, platform-independent method for building web-based applications, without the performance limitations of CGI programs. http://java.sun.com/products/servlets/index.html Java Servlets Servlets have access to the entire family of Java APIs, including the JDBC TM API to access enterprise databases. Servlets can also access a library of HTTPspecific calls and receive all the benefits of the mature Java language, including portability, performance, reusability, and crash protection ti http://java.sun.com/products/servlets/index.html 4

Anatomy of a Servlet init() the init() function is called when the servlet is initialized by the server. This often happens on the first doget() or doput() call of the servlet. destroy() this function is called when the servlet is being destroyed by the server, typically when the server process is being stopped. http://java.sun.com/docs/books/tutorial/servlets/lifecycle/index.html Anatomy of a Servlet doget() the doget() function is called when the servlet is called via an HTTP GET. dopost() the dopost() function is called when the servlet is called via an HTTP POST. POSTs are a good way to get input from HTML forms http://java.sun.com/docs/books/tutorial/servlets/lifecycle/index.html 5

Anatomy of a Servlet HTTPServletRequest object Information about an HTTP request Headers Query String Session Cookies HTTPServletResponse object Used for formatting an HTTP response Headers Status codes Cookies Sample Servlet import java.io.*; //Apache Tomcat sample code import javax.servlet.*; import javax.servlet.http.*; public class HelloWorld extends HttpServlet { public void doget(httpservletrequest request, HttpServletResponse response) throws IOException, ServletException { response.setcontenttype("text/html"); PrintWriter out = response.getwriter(); out.println("<html>"); out.println("<body>"); out.println("<head>"); out.println("<title>hello World!</title>"); out.println("</head>"); out.println("<body>"); out.println("<h1>hello World!</h1>"); out.println("</body>"); out.println("</html>"); 6

JSP JavaServer Pages JavaServer Pages technology uses XML-like tags and scriptlets written in the Java programming language to encapsulate the logic that generates the content for the page. Any and all formatting (HTML or XML) tags are passed directly back to the response page. By separating the page logic from its design and display and supporting a reusable component-based design, JSP technology makes it faster and easier than ever to build web-based applications. http://java.sun.com/products/jsp/index.html Sample JSP <html> <!- Apache Tomcat Samples -> <!-- Copyright (c) 1999 The Apache Software Foundation. All rights reserved.--> <body bgcolor="white"> <jsp:usebean id='clock' scope='page' class='dates.jspcalendar' type="dates.jspcalendar" /> <font size=4><ul> <li> Day of month: is <jsp:getproperty name="clock" property="dayofmonth"/> <li> Year: is <jsp:getproperty name="clock" property="year"/> <li> Month: is <jsp:getproperty name="clock" property="month"/> <li> Time: is <jsp:getproperty name="clock" property="time"/> <li> Date: is <jsp:getproperty name="clock" property="date"/> <li> Day: is <jsp:getproperty name="clock" property="day"/> <li> Day Of Year: is <jsp:getproperty name="clock" property="dayofyear"/> <li> Week Of Year: is <jsp:getproperty name="clock" property="weekofyear"/> <li> era: is <jsp:getproperty name="clock" property="era"/> <li> DST Offset: is <jsp:getproperty name="clock" property="dstoffset"/> <li> Zone Offset: is <jsp:getproperty name="clock" property="zoneoffset"/> </ul> </font> </body> </html> 7

EJB Enterprise Java Beans Enterprise JavaBeans TM is the server-side component architecture t for the J2EE TM platform. EJB TM enables rapid and simplified development of distributed, transactional, secure and portable Java applications. http://java.sun.com/products/ejb/index.html EJB Enterprise Java Beans Enterprise Java Beans are components that are deployed d into containers The container provides services Loading / Initialization Transactions Persistence Communication with EJB clients Enterprise Naming Context (JNDI name space) 8

Anatomy of an EJB Remote Interface Methods that can be accessed by the outside world. Extends javax.ejb.ejbobject Remote Home Interface Life-cycle methods (create, findbyprimarykey) Extends javax.ejb.ejbhome which extends java.rmi.remote Bean class The class performing the actual business process Implements an interface based on type of bean Anatomy of an EJB EJB 2.0 Interfaces New Interfaces allow bean to bean method calls within the same container Local Interface Similar to the remote interface, but without RMI Extends javax.ejb.ejblocalobject Local Home Interface Similar to the remote home interface, but without RMI Extends javax.ejb.ejblocalhome 9

Client / EJB Relationship How does a client application (Java class) utilize EJBs? Lookup - JNDI ENC Network protocol - RMI EJB container creates object with RemoteHome and Home interfaces this object passes calls to the bean class EJB Enterprise Java Beans Entity Beans Session Beans Message Beans New in EJB 2.0 10

EJB Entity Beans Entity beans are classes that map to individual entities typically, an Entity bean references a row in a database table, providing an object representation of that database object. For example, an entity bean could represent a customer, and changing the values in that entity bean would cause updates to that database row Entity beans provide an abstraction layer so that working with the entity is not specific to the storage mechanism for that entity. Entity Beans - Persistence Container Managed Persistence (CMP) The EJB container automatically persists the EJB objects, usually to a relational database where each type of object is represented as a table, and each instance of the object is a row in that table Bean Managed Persistence (BMP) The EJB container calls bean methods when it is appropriate for the bean to load, save or update data, enforcing transactions without transaction code written by the bean developer 11

EJB Session Beans Session beans perform work for a client application For example, a session bean could charge a credit card for a specific transaction. Session Beans State Stateful A stateful bean maintains a conversational state t with a client. The client perceives that it is only talking to one bean, and that bean maintains information between calls Stateless A stateless bean maintains no client information between method calls the container can substitute beans as necessary between method calls 12

EJB Session Bean Example package org.jboss.docs.interest; import javax.ejb.ejbobject; import java.rmi.remoteexception; /** This interface defines the `Remote' interface for the `Interest' EJB. Its single method is the only method exposed to the outside world. The class InterestBean implements the method. */ public interface Interest extends EJBObject { /** Calculates the compound interest on the sum `principle', with interest rate per period `rate' over `periods' time periods. This method also prints a message to standard output; this is picked up by the EJB server and logged. In this way we can demonstrate that the method is actually being executed on the server, rather than the client. */ public double calculatecompoundinterest(double principle, double rate, double periods) throws RemoteException; EJB Session Bean Example package org.jboss.docs.interest; import java.io.serializable; import java.rmi.remoteexception; import javax.ejb.createexception; import javax.ejb.ejbhome; /** This interface defines the 'home' interface for the 'Interest' EJB. */ public interface InterestHome extends EJBHome { /** Creates an instance of the `InterestBean' class on the server, and returns a remote reference to an Interest interface on the client. */ Interest create() throws RemoteException, CreateException; 13

EJB Session Bean Example package org.jboss.docs.interest; import java.rmi.remoteexception; import javax.ejb.sessionbean; import javax.ejb.sessioncontext; /** This class contains the implementation for the 'calculatecompoundinterest' method exposed by this Bean. It includes empty method bodies for the methods prescribe by the SessionBean interface; these don't need to do anything in this simple example. */ public class InterestBean implements SessionBean { public double calculatecompoundinterest(double principle, double rate, double periods) { System.out.println("Someone called `calculatecompoundinterest!'"); return principle * Math.pow(1+rate, periods) - principle; public void ejbcreate() { public void ejbpostcreate() { public void ejbremove() { public void ejbactivate() { public void ejbpassivate() { public void setsessioncontext(sessioncontext sc) { EJB Session Bean Example <?xml version="1.0" encoding="utf-8"?> <ejb-jar> jar <description>jboss Interest Sample Application</description> <display-name>interest EJB</display-name> <enterprise-beans> <session> <ejb-name>interest</ejb-name> <home>org.jboss.docs.interest.interesthome</home> <remote>org.jboss.docs.interest.interest</remote> <ejb-class>org.jboss.docs.interest.interestbean</ejb-class> <session-type>stateless</session-type> <transaction-type>bean</transaction-type> </session> </enterprise-beans> </ejb-jar> 14

EJB Session Bean Example package org.jboss.docs.interest; import javax.naming.initialcontext; import javax.rmi.portableremoteobject; class InterestClient { /** This method does all the work. It creates an instance of the Interest EJB on the EJB server, and calls its `calculatecompoundinterest()' method, then prints the result of the calculation. */ public static void main(string[] args) { try { InitialContext jndicontext = new InitialContext(); ref = jndicontext.lookup("interest/interest"); InterestHome home = (InterestHome) PortableRemoteObject.narrow(ref, InterestHome.class); Interest t interest t = home.create(); //Create an Interest t object from the Home interface System.out.println(interest.calculateCompoundInterest(1000, 0.10, 2)); catch(exception e) { System.out.println(e.toString()); EJB Message Beans Message beans are classes that receive asynchronous notification from a Java Message Service server For example, a message bean could be activated when vendor sends a purchase order to a JMS queue. 15

JMS Java Message Service Enterprise messaging provides a reliable, flexible service for the asynchronous exchange of critical business data and events throughout an enterprise. The JMS API adds to this a common API and provider framework that enables the development of portable, message based applications in the Java programming language. http://java.sun.com/products/jms/index.html JMS Java Message Service JMS Queue JMS Topic 16

JMS Java Message Service The JMS API in the J2EE 1.3 platform has the following new features: A new kind of enterprise bean, the message-driven bean, enables the asynchronous consumption of messages. Message sends and receives can participate in Java Transaction API (JTA) transactions. http://java.sun.com/products/jms/index.html JMS Java Message Service Why should I use JMS? Loosely-coupled systems Connectionless Removes dependence on client and server platform / programming language / version Publish / Subscribe metaphor Send / receive information with many, unknown clients Integration with other messaging systems IBM MQ-Series Microsoft Message Queue http://java.sun.com/products/jms/index.html 17

JDBC Data Access API JDBC TM technology is an API that lets you access virtually any tabular data source from the Java TM programming language. Cross-DBMS connectivity to a wide range of SQL databases Access to other tabular data sources, such as spreadsheets or flat files. http://java.sun.com/products/jdbc/index.html JDBC Driver Types Level 1 - A JDBC-ODBC bridge provides JDBC API access via one or more ODBC drivers. Level 2 - A native-api partly Java technologyenabled driver converts JDBC calls into calls on the client API for Oracle, Sybase, Informix, DB2, or other DBMS. Level 3 - A net-protocol fully Java technologyenabled driver translates JDBC API calls into a DBMS-independent d net protocol which h is then translated to a DBMS protocol by a server. Level 4 - A native-protocol fully Java technologyenabled driver converts JDBC technology calls into the network protocol used by DBMSs directly. http://java.sun.com/products/jdbc/driverdesc.html 18

JNDI Java Naming and Directory Interface JNDI is an API specified in Java tm that provides naming and directory functionality to applications written in Java. It is designed especially for Java by using Java's object model. Using JNDI, Java applications can store and retrieve named Java objects of any type. JNDI provides methods for performing standard directory operations, such as associating attributes with objects and searching for objects using their attributes. JNDI allows Java applications to take advantage of information in a variety of existing naming and directory services, such as LDAP, NDS, DNS, and NIS(YP), and allows Java applications to coexist with legacy applications and systems. http://java.sun.com/products/jndi/overview.html JNDI - Layers 19

JNDI Common Uses JNDI ENC enterprise naming context EJB lookup within a J2EE app server LDAP integration Dynamic registration of services and clients Peer to Peer computing JNDI Session Bean Example package org.jboss.docs.interest; import javax.naming.initialcontext; import javax.rmi.portableremoteobject; class InterestClient { /** This method does all the work. It creates an instance of the Interest EJB on the EJB server, and calls its `calculatecompoundinterest()' method, then prints the result of the calculation. */ public static void main(string[] args) { try { InitialContext jndicontext = new InitialContext(); ref = jndicontext.lookup("interest/interest"); InterestHome home = (InterestHome) PortableRemoteObject.narrow(ref, InterestHome.class); Interest t interest t = home.create(); //Create an Interest t object from the Home interface System.out.println(interest.calculateCompoundInterest(1000, 0.10, 2)); catch(exception e) { System.out.println(e.toString()); 20

JTA / JTS Transactions The Java Transaction API (JTA) and the Java Transaction Service (JTS) allow J2EE application servers to take the burden of transaction management off of the component developer. Developers can define the transactional properties of Enterprise JavaBeans TM technology based components during design or deployment using declarative statements in the deployment descriptor. The application server takes over the transaction management responsibilities. http://java.sun.com/j2ee/transactions.html JavaMail The JavaMail TM 1.2 API provides a set of abstract classes that model a mail system. The API provides a platform independent and protocol independent framework to build Java technology-based mail and messaging applications. J2EE contains JAF JavaBeans Activation Framework since it is required by JavaMail Supports common mail protocols IMAP POP SMTP MIME http://java.sun.com/products/javamail/index.html 21

JAAS Java Authentication and Authorization Service Authentication of users, to reliably and securely determine who is currently executing Java code, regardless of whether the code is running as an application, an applet, a bean, or a servlet; and Authorization of users to ensure they have the access control rights (permissions) required to do the actions performed. Sample authentication modules using: Java TM Naming and Directory Interface (JNDI) Unix Operating Environment Windows NT Kerberos Keystore http://java.sun.com/products/jaas/index.html XML J2EE 1.3 includes JAXP 1.1 support, as well as Servlet Filters and XML JSP TM documents. The Java TM API for XML Processing ("JAXP") supports processing of XML documents using DOM, SAX, and XSLT. The portability and extensibility of both XML and Java make them the ideal choice for the flexibility and wide availability requirements of this new web. http://java.sun.com/xml/index.html http://java.sun.com/xml/jaxp/index.html 22

J2EE Connectors The J2EE Connector architecture defines a standard architecture for connecting the J2EE platform to heterogeneous EISs (Enterprise Information Systems). Examples of EISs include ERP, mainframe transaction processing, database systems, and legacy applications not written in the Java programming language. http://java.sun.com/j2ee/connector/index.html J2EE Applications http://java.sun.com/j2ee/tutorial/1_3-fcs/doc/oveview3.html 23

J2EE Deployment JAR Java ARchive Java class file EJBs WAR - Web ARchive Servlets JSPs EAR - Enterprise ARchive Contains other JARs and WARs to form an entire application Deployment descriptors XML Required for EJB JARs, WARs, EARs J2EE Servers Application Server As of Sept 01 - MetaGroup Survey by sales $$ BEA Weblogic - 37% IBM Websphere 22% Oracle 11% Iplanet 5% Other- 12% Open-source Jboss www.jboss.org Sun s listing of J2EE compatible servers - http://java.sun.com/j2ee/compatibility.html 24

J2EE Servers Servlet / JSP Servers Most of the commercial application servers also include servlet / JSP support Open-Source Apache Tomcat Jetty Sun s listing of servlet / JSP servers - http://java.sun.com/products/servlet/industry.html J2EE Development Tools Major IDEs support J2EE in some form Wizards for EJB / Servlets Custom editors for JSP Deployment descriptor support Deployment support for application servers Embedded servers for testing within IDE 25

Learning more Enterprise JavaBeans 3 rd Edition Richard Monson-Haefel O Reilly 2001 JBoss documentation http://www.jboss.org/online-manual/html/index.html Designing Enterprise Applications with the Java 2 Platform, Enterprise Edition Nicholas Kassem and the Enterprise Team Addison Wesley 2000 Core Servlets and JavaServer Pages (JSP) Marty Hall Prentice Hall 2000 Learning more J2EE Tutorial - http://java.sun.com/j2ee/tutorial/1_3-fcs J2EE Developers Guide - http://java.sun.com/j2ee/sdk_1.2.1/techdocs/guides/ejb/html/dev GuideTOC.html JNDI - http://java.sun.com/products/jndi/tutorial/ JMS - http://java.sun.com/products/jms/tutorial/ JDBC - http://java.sun.com/docs/books/tutorial/jdbc Servlets - http://java.sun.com/docs/books/tutorial/servlets JSP - http://java.sun.com/products/jsp/docs.html JAXP - http://java.sun.com/xml/jaxp/dist/1.1/docs/tutorial 26