Self-executing Java, J2EE James Atlas July 29, 2008.

Slides:



Advertisements
Similar presentations
11 Copyright © 2005, Oracle. All rights reserved. Creating the Business Tier: Enterprise JavaBeans.
Advertisements

An architecture for webb applications, J2EE
1 Softsmith Open Learning - EJB 21-Nov Enterprise Java Beans Introduction –Application ServerApplication Server –Java 2 Enterprise EditionJava.
Sapana Mehta (CS-6V81) Overview Of J2EE & JBoss Sapana Mehta.
Overview of The Java Platform Solution for E-Business Applications : JSP, Servlet and EJB.
Copyright W. Howden1 Lecture 19: Intro to O/O Components.
J2EE Overview Software engineering group Computer science faculty Binus University.
1 Build a Web Application on J2EE. 2 J2EE Scenario Client – Web Server – EIS Resources Client – Web Server – EIS Resources Client – Application Server.
J2EE vs..NET Nigam Patel. Topics Background –Web Services, J2EE and.NET Similarities Differences Conclusion –Pros and Con (J2EE and.NET)
J2EE Java 2 Enterprise Edition. Relevant Topics in The Java Tutorial Topic Web Page JDBC orial/jdbc
J2EE Kenneth M. Anderson CSCI Web Technologies October 3, 2001.
CS 483 Enterprise and Web Application Programming
© 2004 IBM Corporation BEA WebLogic Server Introduction and Training.
Emmanuel Cecchet et al.  Performance Scalability of J2EE application servers.  Test effect of: ◦ Application Implementation Methods ◦ Container Design.
Chapter 10 EJB Concepts of EJB Three Components in Creating an EJB Starting/Stopping J2EE Server and Deployment Tool Installation and Configuration of.
EJB Overview Celsina Bignoli Distributed Business Applications Server DB Client DB Server DB.
Distributed Multitiered Applications The J2EE platform uses a multitiered distributed application model. Application logic is divided into components 1.
Chapter 4: Core Web Technologies
Enterprise Java Beans CS-422. Application Servers In the late 1980s and though the mid 1990s a number of corporations (Broadvision, Netscape…) marketed.
1 Session Bean Chuyên đề Lập trình Java & J2EE Chương 14 Biên soạn: Th.S Nguyễn văn Lành.
HTTP client wide area network (Internet) HTTP proxy HTTP server HTTP gateway firewall HTTP tunnel Copyright Springer Verlag Berlin Heidelberg 2004.
J2EE Part 2: Enterprise JavaBeans CSCI 4300 Images and code samples from jGuru EJB tutorial,
Glink: GCOS e-business in an application server architecture Summit 2000, Jim Gallagher.
Ing. Ignacio Roqueta ARTech GeneXus and J2EE.
Seminar: Enterprise JavaBeans. Agenda Agenda Java™ 2 Platform Java™ 2 Platform Java™ 2 Platform,Enterprise Edition(J2EE) Java™ 2 Platform,Enterprise Edition(J2EE)
CS 493/693: Distributed Systems Programming V. “Juggy” Jagannathan CSEE, West Virginia University March 21, 2005.
Entity Beans BMP Celsina Bignoli
Advanced Java Session 7 New York University School of Continuing and Professional Studies.
Entity Java Beans Jorg Janke Open Source ERP & CRM.
Enterprise JavaBeans Umer Farooq CS6704: Design Patterns & Component FrameworksFebruary 25, 2002.
The Triad of Beans I Oleh: Dini Addiati ( ) Fahrurrozi Rahman ( Y) Irfan Hilmy ( ) Salman Azis A ( ) Aziiz Surahman.
Presented By Pradeep K Sahu. What will be the Contents of the Seminar ? What is EJB ? EJB Architecture Types of EJB Session Entity Why EJB ? Writing a.
Enterprise JavaBeans. Lesson 1: Introduction to Server-Side Component Software.
Enterprise JavaBeans. What is EJB? l An EJB is a specialized, non-visual JavaBean that runs on a server. l EJB technology supports application development.
Introduction to J2EE Architecture Portions by Kunal Mehta.
EJB Framework.  As we know, EJB is the center of the J2EE architecture that provides a sturdy framework for building enterprise applications. The major.
第十四章 J2EE 入门 Introduction What is J2EE ?
J2EE Structure & Definitions Catie Welsh CSE 432
® IBM Software Group © 2007 IBM Corporation J2EE Web Component Introduction
Enterprise Java Beans Java for the Enterprise Server-based platform for Enterprise Applications Designed for “medium-to-large scale business, enterprise-wide.
Session Beans -) stateless -) stateful. Session Beans A session bean represents a single client inside the J2EE server. To access an application that.
A TUTORIAL TO USING EJBs by SHREERAM IYER 09/17/2001.
J2EE Overview ver 1.0Page 1 © Wipro Technologies Talent Transformation J2EE Overview.
Source: Peter Eeles, Kelli Houston, and Wojtek Kozaczynsky, Building J2EE Applicationa with the Rational Unified Process, Addison Wesley, 2003 Prepared.
Enterprise JavaBeans Understanding EJB Components Version 0.1 Kamal Wickramanayake
© jGuru.com Enterprise JavaBeans Fundamentals.
1 Java EE Programming Enterprise JavaBeans. 2 Topics J2EE Overview Enterprise JavaBeans Overview Enterprise Entity Beans Case Study How to build them.
Assignment of JAVA id : BSSE-F10-M-10-JAVA1 Overview of J2EE/Session 2/Slide 1 of 38.
© FPT SOFTWARE – TRAINING MATERIAL – Internal use 04e-BM/NS/HDCV/FSOFT v2/3 JSP Application Models.
Session Beans Based on: Patel, Brose, Silverman, Mastering Enterprise JavaBeans 3.0.
Introduction to EJB. What is an EJB ?  An enterprise java bean is a server-side component that encapsulates the business logic of an application. By.
1 Distributed System using J2EE. 2 What is J2EE?  J2EE (Java2 Enterprise Edition) offers a suite of software specification to design, develop, assemble.
Introduction to EJB. What is an EJB ?  An enterprise java bean is a server-side component that encapsulates the business logic of an application. By.
Java Programming: Advanced Topics 1 Enterprise JavaBeans Chapter 14.
Enterprise Java Beans N.V.RAJASEKHAR REDDY. Definition of EJB EJBs are the components that are the set of classes and interfaces deployed within a container.
©NIIT Introducing Enterprise JavaBeans (EJB) Lesson 1A / Slide 1 of 43J2EE Server Components Objectives In this lesson, you will learn about: The features.
Enterprise JavaBeans: Fundamentals. EJB Fundamentals(c)CDAC(Formerly NCST)2 Contents Introduction Technology Overview EJB Architecture EJB Specification.
Middleware Technology (J2EE/EJB) EJB Fundamentals.
Glink for Java: applet, application and an API for integrating access to Bull, IBM, UNIX and Minitel systems with your Java based e-business applications.
14 Copyright © 2004, Oracle. All rights reserved. Achieving State Management in the Business Tier.
©NIIT Session Beans Lesson 1B/ Slide 1 of 37J2EE Server Components Objectives In this lesson, you will learn to: Describe the characteristics of session.
J2EE Platform Overview (Application Architecture)
Introduction to J2EE Architecture
Distributed System Using Java 2 Enterprise Edition (J2EE)
Understanding and Designing with EJB
Luca Simone Software Engineering 2 a.a. 2001/2002
Enterprise Java Beans Bina Ramamurthy 1/13/2019 B.Ramamurthy.
Understanding and Designing with EJB
Enterprise Java Beans Bina Ramamurthy 4/5/2019 B.Ramamurthy.
Enterprise Java Beans.
Presentation transcript:

Self-executing Java, J2EE James Atlas July 29, 2008

James Atlas - CISC3702 Review Software Testing Software Testing  Design process

July 29, 2008James Atlas - CISC3703 Announcements Final Exam Final Exam  08/15 at 3:30PM to 5:30PM in 107 Sharp Lab (SHL107)  We will have a review on 08/12, no class on 08/14 Remaining topics Remaining topics  Java Security  3D graphics API + Sound

July 29, 2008James Atlas - CISC3704 Today Self-executing Java Self-executing Java J2EE Intro J2EE Intro

July 29, 2008James Atlas - CISC3705 Self-executing Java "How do I make an.EXE file from my Java application?“ "How do I make an.EXE file from my Java application?“ Many different approaches: Many different approaches:  Executable Jars  Java Web Start  Custom launcher/wrapper  Ahead-Of-Time Compilers

July 29, 2008James Atlas - CISC3706 Executable Jars “zip” archive containing application code and resources “zip” archive containing application code and resources contains a META-INF/MANIFEST.MF file contains a META-INF/MANIFEST.MF file  Main-Class: MyAppMain  Class-Path: mylib.jar automatically associated in Windows with your installed JRE (javaw.exe) automatically associated in Windows with your installed JRE (javaw.exe) requires a working, installed JRE requires a working, installed JRE

July 29, 2008James Atlas - CISC3707 Java Web Start From a web-link it automatically downloads application to a local cache and launches it From a web-link it automatically downloads application to a local cache and launches it Less secure than Applets (with user confirmation) Less secure than Applets (with user confirmation) Internet connectivity required Internet connectivity required Similar to: java -classpath com.mysite.app.Main Similar to: java -classpath com.mysite.app.Main Example: Example:

July 29, 2008James Atlas - CISC3708 Custom launcher/wrapper Creates a small native program that calls the appropriate java commands Creates a small native program that calls the appropriate java commands  Allows custom taskbar icons and splashscreens  Can be configured to use a bundled JRE Launch4J - Launch4J -

July 29, 2008James Atlas - CISC3709 Ahead-Of-Time Compilers Produces a conventional native executable for the target platform Produces a conventional native executable for the target platform Pros: Pros:  performance  Intellectual Property  No “warm-up” time Cons: Cons:  limited tools depending on what version of Java  very hard to do dynamic applications (custom classloaders like web servers with JSP content)  produces executable that is platform specific but somewhat hardware agnostic

July 29, 2008James Atlas - CISC37010 Programming Assignment 5

July 29, 2008James Atlas - CISC37011 J2EE

July 29, 2008James Atlas - CISC37012 History Initially two tier architecture (client server applications) Initially two tier architecture (client server applications) Client is responsible for data access applying business logic and presentation of data Client is responsible for data access applying business logic and presentation of data Only service provided by Server was that of database server. Only service provided by Server was that of database server.

July 29, 2008James Atlas - CISC37013 Two Tier Application Architecture Client Server Client Server

July 29, 2008James Atlas - CISC37014 Two Tier Application Architecture Drawbacks Drawbacks - Easy to deploy but difficult to enchance or upgrade. - It makes reuse of business and presentation logic difficult - Not scalable and not suited for internet

July 29, 2008James Atlas - CISC37015 J2EE To develop N tier application To develop N tier application It supports the development of a variety of application types It supports the development of a variety of application types  small client server systems  Systems running on Intranets  Systems on large scale internet e- commerce site

July 29, 2008James Atlas - CISC37016 J2EE Features Component based model Component based model Container provided services Container provided services Highly Scaleable Highly Scaleable Simplified Architecture Simplified Architecture Flexible security model Flexible security model

July 29, 2008James Atlas - CISC37017 Key J2EE APIs Component Technologies Component Technologies  Servlets  Java Server Pages (JSP)  Enterprise Java Beans (EJB) Standard Services Standard Services  Java Database Connectivity (JDBC API)  Java Naming and Directory Interface (JNDI)  Java Transaction API (JTA) Other Services Other Services  HTTP, HTTPS, RMI-IIOP, JMS, JavaMail

July 29, 2008James Atlas - CISC37018 Containers in the N-Tier J2EE Architecture

July 29, 2008James Atlas - CISC37019 J2EE Tiers Client Presentation Client Presentation  HTML or Java applets deployed in Browser  XML documentations transmitted through HTTP  Java clients running in Client Java Virtual Machine (JVM) Presentation Logic Presentation Logic  Servlets or JavaServer Pages running in web server Application Logic Application Logic  Enterprise JavaBeans running in Server

July 29, 2008James Atlas - CISC37020 J2EE Application Model Browser is able to process HTML and applets pages. Browser is able to process HTML and applets pages. It forwards requests to the web server, which has JSPs and Servlets It forwards requests to the web server, which has JSPs and Servlets Servlets and JSPs may access EJB server. Servlets and JSPs may access EJB server. Java Standalone runs on java client, which access EJB server using RMI. Java Standalone runs on java client, which access EJB server using RMI.

July 29, 2008James Atlas - CISC37021 J2EE Application Model

July 29, 2008James Atlas - CISC37022 EJB – Enterprise Java Beans Enterprise Java Beans are components that are deployed into containers Enterprise Java Beans are components that are deployed into containers The container provides services The container provides services  Loading / Initialization  Transactions  Persistence  Communication with EJB clients  Enterprise Naming Context (JNDI name space)

July 29, 2008James Atlas - CISC37023 Anatomy of an EJB Remote Interface Remote Interface  Methods that can be accessed by the outside world.  Extends javax.ejb.EJBObject Remote Home Interface Remote Home Interface  Life-cycle methods (create, findByPrimaryKey)  Extends javax.ejb.EJBHome which extends java.rmi.Remote Bean class Bean class  The class performing the actual business process  Implements an interface based on type of bean

July 29, 2008James Atlas - CISC37024 EJB – Enterprise Java Beans Entity Beans Entity Beans Session Beans Session Beans Message Beans Message Beans  New in EJB 2.0

July 29, 2008James Atlas - CISC37025 Client / EJB Relationship How does a client application (Java class) utilize EJBs? 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

July 29, 2008James Atlas - CISC37026 EJB – Enterprise Java Beans Entity Beans Entity Beans Session Beans Session Beans Message Beans Message Beans  New in EJB 2.0

July 29, 2008James Atlas - CISC37027 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. 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 provide an abstraction layer so that working with the entity is not specific to the storage mechanism for that entity.

July 29, 2008James Atlas - CISC37028 Entity Beans - Persistence Container Managed Persistence (CMP) 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) 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

July 29, 2008James Atlas - CISC37029 EJB – Session Beans Session beans perform work for a client application Session beans perform work for a client application  For example, a session bean could charge a credit card for a specific transaction.

July 29, 2008James Atlas - CISC37030 Session Beans – State Stateful – A stateful bean maintains a conversational state with a client. The client perceives that it is only talking to one bean, and that bean maintains information between calls Stateful – A stateful bean maintains a conversational state 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 Stateless – A stateless bean maintains no client information between method calls – the container can substitute beans as necessary between method calls

July 29, 2008James Atlas - CISC37031 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; }

July 29, 2008James Atlas - CISC37032 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; }

July 29, 2008James Atlas - CISC37033 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) {} }

July 29, 2008James Atlas - CISC37034 EJB – Session Bean Example JBoss Interest Sample Application Interest EJB Interest org.jboss.docs.interest.InterestHome org.jboss.docs.interest.Interest org.jboss.docs.interest.InterestBean Stateless Bean

July 29, 2008James Atlas - CISC37035 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 interest = home.create(); //Create an Interest object from the Home interface System.out.println(interest.calculateCompoundInterest(1000, 0.10, 2)); } catch(Exception e) { System.out.println(e.toString()); }

July 29, 2008James Atlas - CISC37036 EJB – Message Beans Message beans are classes that receive asynchronous notification from a Java Message Service server 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.

July 29, 2008James Atlas - CISC37037 JMS – Java Message Service JMS Queue

July 29, 2008James Atlas - CISC37038 JMS – Java Message Service JMS Topic

July 29, 2008James Atlas - CISC37039 JMS – Java Message Service Why should I use JMS? Why should I use JMS?  Loosely-coupled systems Connectionless Connectionless Removes dependence on client and server platform / programming language / version Removes dependence on client and server platform / programming language / version  Publish / Subscribe metaphor Send / receive information with many, unknown clients Send / receive information with many, unknown clients  Integration with other messaging systems IBM MQ-Series IBM MQ-Series Microsoft Message Queue Microsoft Message Queue

July 29, 2008James Atlas - CISC37040 Example EJB Application

July 29, 2008James Atlas - CISC37041 Servlets Are container managed web components Are container managed web components Replace Common Gateway Interface(CGI) or Active Server Pages (ASP) Replace Common Gateway Interface(CGI) or Active Server Pages (ASP) Generate dynamic response to requests from web based clients Generate dynamic response to requests from web based clients Synchronize multiple concurrent client request Synchronize multiple concurrent client request Serve as client proxies Serve as client proxies

July 29, 2008James Atlas - CISC37042 JavaServer Pages (JSP) Text based documents describe how to process a request and create a response Text based documents describe how to process a request and create a response Contains HTML or XML and other JSP elements defined by JSP specification. Contains HTML or XML and other JSP elements defined by JSP specification. Installed on web server Installed on web server Web components that sit on top of java servlets Web components that sit on top of java servlets

July 29, 2008James Atlas - CISC37043 J2EE Application Packaging

July 29, 2008James Atlas - CISC37044 JBoss

July 29, 2008James Atlas - CISC37045 What is JBoss Created in 1999, JBoss is the product of an OpenSource developer community dedicated to developing the best J2EE-compliant application server in the market Created in 1999, JBoss is the product of an OpenSource developer community dedicated to developing the best J2EE-compliant application server in the market With 1000 developers worldwide and a steadily growing number of downloads per month, reaching 72,000 for October ’01 (per independent JBoss is arguably the most downloaded application server in the world today With 1000 developers worldwide and a steadily growing number of downloads per month, reaching 72,000 for October ’01 (per independent JBoss is arguably the most downloaded application server in the world today Distributed under an LGPL license, JBoss is absolutely FREE for use. No cost. Period. Distributed under an LGPL license, JBoss is absolutely FREE for use. No cost. Period.

July 29, 2008James Atlas - CISC37046 What is Application Server  Application servers enable the development of multi-tiered distributed applications. They are also called “middleware”  An application server acts as the interface between the database(s), the web servers and the client browsers

July 29, 2008James Atlas - CISC37047 JBoss- Application Server

July 29, 2008James Atlas - CISC37048 JBoss - example

July 29, 2008James Atlas - CISC37049 Project 2 Need to setup group meeting time Need to setup group meeting time