Presentation is loading. Please wait.

Presentation is loading. Please wait.

J2EE Overview ver 1.0Page 1 © Wipro Technologies Talent Transformation J2EE Overview.

Similar presentations


Presentation on theme: "J2EE Overview ver 1.0Page 1 © Wipro Technologies Talent Transformation J2EE Overview."— Presentation transcript:

1 J2EE Overview ver 1.0Page 1 © Wipro Technologies Talent Transformation J2EE Overview

2 J2EE Overview ver 1.0Page 2 © Wipro Technologies Talent Transformation Objectives In this session, you will learn to: Identify the characteristics of different Java Platforms Identify the challenges of an enterprise application Describe J2EE architecture Define the role of various J2EE technologies

3 J2EE Overview ver 1.0Page 3 © Wipro Technologies Talent Transformation Java 2 Editions

4 J2EE Overview ver 1.0Page 4 © Wipro Technologies Talent Transformation Issues in Enterprise Applications Transactions State management Multithreading Resource pooling Security

5 J2EE Overview ver 1.0Page 5 © Wipro Technologies Talent Transformation Java 2 Platform, Enterprise Edition J2EE RMIJNDIJDBCJavaMailServletsJSPJava IDLEJBJMSJTAConnectorsXML Java 2: Standard ed.

6 J2EE Overview ver 1.0Page 6 © Wipro Technologies Talent Transformation J2EE Architecture

7 J2EE Overview ver 1.0Page 7 © Wipro Technologies Talent Transformation J2EE Services Java Technology Web Servlets/ JSPs (HTML/ XML) Database Access Java DataBase Connectivity (JDBC™) Naming And Directory Java Naming and Directory Interface Messaging Java Message Service (JMS) Email Access JavaMail™ Protocol JavaIDL, Remote Method Invocation (CORBA compatible) Transaction Object Transaction Service (OTS), Java Transaction Service (JTS), Java Transaction API (JTA)

8 J2EE Overview ver 1.0Page 8 © Wipro Technologies Talent Transformation Naming Services Provide J2EE components with access to a JNDI naming environment –J2EE component locates its environment naming context using JNDI interfaces

9 J2EE Overview ver 1.0Page 9 © Wipro Technologies Talent Transformation Java Naming and Directory Interface A standard for Naming and directory services EJB strictly relies on JNDI for looking up distributed components across the network e.g. Novell’s NDS and the internet standard LDAP –Each one is accessed differently –Stores info in a proprietary way JNDI bridges the gap between different directory services: provides portable interface

10 J2EE Overview ver 1.0Page 10 © Wipro Technologies Talent Transformation JNDI Interface

11 J2EE Overview ver 1.0Page 11 © Wipro Technologies Talent Transformation Transaction Scenario... What’s Wrong with This Code? try { // Withdraw funds from account 1 } catch (Exception e) { // If an error occurred, do not proceed. return;}} try { // Otherwise, deposit funds into account 2 } catch (Exception e) { // If an error occurred, do not proceed, // and redeposit the funds back into account 1. return; }

12 J2EE Overview ver 1.0Page 12 © Wipro Technologies Talent Transformation Transaction Definition An atomic unit of work Can consist of multiple operations from multiple objects Example: withdrawing money from an account using an automatic teller machine Can support the following features: –Distribution across a network –Two - phase commits –Nested transactions

13 J2EE Overview ver 1.0Page 13 © Wipro Technologies Talent Transformation Transaction Participants Resource has transactional state –Example: Database connection Resource manager can commit and rollback –Example: JDBC driver Application server assists in managing usage of transactional resources by beans –Example: EJB server

14 J2EE Overview ver 1.0Page 14 © Wipro Technologies Talent Transformation Transaction Participants Transaction manager: –Controls state of transaction, two- phase commit –Coordinates/ controls all resource managers within transaction Transactional application obtains a limited access to the transaction manager: –Client application –Enterprise bean

15 J2EE Overview ver 1.0Page 15 © Wipro Technologies Talent Transformation Transactions and the ACID Properties As we have seen, exceptions are not enough for enterprise computing –Code is non- deterministic Transactions guarantee determinism Transactions give you four virtues, called the ACID properties: –Atomicity –Consistency –Isolation –Durability

16 J2EE Overview ver 1.0Page 16 © Wipro Technologies Talent Transformation Transaction Services J2EE transactions are flat J2EE platform implicitly handles many transaction details A Transaction is a unit of work that makes a set of guarantees about its execution

17 J2EE Overview ver 1.0Page 17 © Wipro Technologies Talent Transformation Java Transaction API (JTA) and Java Transaction Service (JTS) JTA: –High level transaction interface: EJB clients use JTA –Required to perform transactions in Java JTS: –Low-level transaction interface: EJB uses behind the scene –Makes possible multiple vendors to collaborate for distributed transactions

18 J2EE Overview ver 1.0Page 18 © Wipro Technologies Talent Transformation Service Technology Provide access to database, transactions, naming and directory services and enterprise information systems JDBC API Java Transaction API and Service Java Naming and Directory Interface Connector Architecture Communication Techniques –Internet protocols –RMI protocols –OMG protocols –Messaging technologies

19 J2EE Overview ver 1.0Page 19 © Wipro Technologies Talent Transformation Introduction to RMI Distributed Computing RPC RMI

20 J2EE Overview ver 1.0Page 20 © Wipro Technologies Talent Transformation Features of RMI Remote invocations of methods on objects in different JVM’s Simple to write reliable distributed applications RMI is transparent

21 J2EE Overview ver 1.0Page 21 © Wipro Technologies Talent Transformation RMI Architecture Client Program Stub RRL Transport Layer Server Program Skeleton Layer RRL

22 J2EE Overview ver 1.0Page 22 © Wipro Technologies Talent Transformation Writing a Simple RMI program Write the Remote Object program //Product.java import java.rmi.*; import java.rmi.server.*; interface Product extends Remote { public String getDescription() throws RemoteException; }

23 J2EE Overview ver 1.0Page 23 © Wipro Technologies Talent Transformation Writing a Simple RMI program 2) Write the Remote Server Program //ProductImpl.java import java.rmi.*; import java.rmi.server.*; public class ProductImpl extends UnicastRemoteObject implements Product {private String str; public ProductImpl(String d) throws RemoteException{ str = d; } public String getDescription() throws RemoteException{ return "Product Name : "+str; }

24 J2EE Overview ver 1.0Page 24 © Wipro Technologies Talent Transformation Writing a Simple RMI program 2) Write the Remote Server Program …contnd public static void main(String a[]) { try{ ProductImpl p1= new ProductImpl("Washing Machine"); ProductImpl p2= new ProductImpl("Microwave Oven"); Naming.rebind("wash",p1); Naming.rebind("oven",p2); }catch(Exception e){ System.out.println("ERROR: "+e); e.printStackTrace(); } }}

25 J2EE Overview ver 1.0Page 25 © Wipro Technologies Talent Transformation Writing a Simple RMI program 3) Write the Client program import java.rmi.*; import java.rmi.server.*; public class ProductClient { public static void main(String a[]){ try{ Product c1=(Product)Naming.lookup("wash"); Product c2=(Product)Naming.lookup("oven"); System.out.println(c1.getDescription()); System.out.println(c2.getDescription()); }catch(Exception e){System.out.println("Error: "+ e);} System.exit(0);}}

26 J2EE Overview ver 1.0Page 26 © Wipro Technologies Talent Transformation JavaMail The JavaMail API allows your applications to use e-mail capabilities JavaMail defines a set of interfaces to which you write your application code, and those interfaces shield your code from the specific protocols or mail service implementations used Based on JavaBeans Activation Framework (JAF) to encapsulate message data and to handle interactions with that data

27 J2EE Overview ver 1.0Page 27 © Wipro Technologies Talent Transformation Java Messaging Service JMS allows Java programs to exchange messages with other Java programs sharing a messaging system. Messaging systems are sometimes called Message- Oriented Middleware (MOM) JMS API enables communication that is : –Asynchronous –Reliable

28 J2EE Overview ver 1.0Page 28 © Wipro Technologies Talent Transformation Real Time Example Automobile manufacturer –The inventory component can send a message to the factory component when the inventory level for a product goes below a certain level, so the factory can make more cars. –The factory component can send a message to the parts components so that the factory can assemble the parts it needs. –The parts components in turn can send messages to their own inventory and order components to update their inventories and order new parts from suppliers. –Both the factory and parts components can send messages to the accounting component to update their budgets. –The business publishes updated catalog items to its sales force and web site.

29 J2EE Overview ver 1.0Page 29 © Wipro Technologies Talent Transformation JMS Architecture JMS provider –is a messaging product that implements the JMS interfaces and provides administrative and control features Administered objects –pre-configured JMS objects created by an administrator for the use of clients. JMS clients –the programs or components written in the Java programming language that produce and consume messages. Messages –the objects that communicate information between JMS clients.

30 J2EE Overview ver 1.0Page 30 © Wipro Technologies Talent Transformation Publish-Subscribe Messaging

31 J2EE Overview ver 1.0Page 31 © Wipro Technologies Talent Transformation Point- To-Point Messaging

32 J2EE Overview ver 1.0Page 32 © Wipro Technologies Talent Transformation Enterprise JavaBeans Enterprise JavaBeans is an architecture for component- based distributed computing: –Customizable at deployment time –Deployed on a compatible application server –Portable to other application servers Enterprise Beans are components of distributed transaction - oriented enterprise applications

33 J2EE Overview ver 1.0Page 33 © Wipro Technologies Talent Transformation Defining EJB Technology EJB servers provide core services to server components: –Transaction –Security –Concurrency –Naming –Persistence EJB technology enhances: –Simplified access to services –Portability of components across server platforms

34 J2EE Overview ver 1.0Page 34 © Wipro Technologies Talent Transformation Defining EJB Technology Is a server component specification (for vendors) Separates and defines integration of development stages: –Component creation –Application assembly –Application deployment

35 J2EE Overview ver 1.0Page 35 © Wipro Technologies Talent Transformation EJB Developer Roles

36 J2EE Overview ver 1.0Page 36 © Wipro Technologies Talent Transformation EJB Programming Paradigm Declarative programming and customizing

37 J2EE Overview ver 1.0Page 37 © Wipro Technologies Talent Transformation EJB Programming Paradigm Deploying

38 J2EE Overview ver 1.0Page 38 © Wipro Technologies Talent Transformation EJB Architecture Overview Uniform client access whether local or remote Home object is a factory for EJBs EJB object is the remote object for accessing EJBs

39 J2EE Overview ver 1.0Page 39 © Wipro Technologies Talent Transformation EJB Architecture Overview

40 J2EE Overview ver 1.0Page 40 © Wipro Technologies Talent Transformation EJB Server Services: –Transaction support –Data access –System resource –Namespace Industry support: –Application/ middleware servers –Database servers

41 J2EE Overview ver 1.0Page 41 © Wipro Technologies Talent Transformation EJB Container Can contain multiple Bean classes or homes –Often created using code generation by tools –Is normally provided by EJB server vendor Is not visible to the client Is implemented in different ways by different vendors

42 J2EE Overview ver 1.0Page 42 © Wipro Technologies Talent Transformation EJB Container Provides some standard services: –Persistence –Transaction control –Security –EJB instance lifecycle management –EJB instance identification

43 J2EE Overview ver 1.0Page 43 © Wipro Technologies Talent Transformation Home Interface Factory interface for the bean: –Interface provided by EJB developer –Class generated by vendor tool One factory class per bean class Factory instance is installed into the server’s naming service

44 J2EE Overview ver 1.0Page 44 © Wipro Technologies Talent Transformation

45 J2EE Overview ver 1.0Page 45 © Wipro Technologies Talent Transformation Remote Interface Interface is provided by bean developer. Implementation is provided by container tools, which include: –Stubs and skeletons –The EJB Object

46 J2EE Overview ver 1.0Page 46 © Wipro Technologies Talent Transformation EJB Object The EJB Object is a wrapper object that acts as a proxy to the EJB instance. –Interface provided by Bean developer –Implementation class generated by vendor tool Each business method has a corresponding wrapper method in the EJB Object –Wrapper method implements container- provided services

47 J2EE Overview ver 1.0Page 47 © Wipro Technologies Talent Transformation Stubs and Skeletons Stub is downloaded from server Communication between stub and skeleton can be proprietary, yet EJB code is still portable

48 J2EE Overview ver 1.0Page 48 © Wipro Technologies Talent Transformation Types of EJBs

49 J2EE Overview ver 1.0Page 49 © Wipro Technologies Talent Transformation J2EE Components and Containers

50 J2EE Overview ver 1.0Page 50 © Wipro Technologies Talent Transformation Summary In this session, you learnt to: Identify characteristics of different Java Platforms Identify the challenges of an enterprise application Describe J2EE architecture Define the role of various J2EE technologies

51 J2EE Overview ver 1.0Page 51 © Wipro Technologies Talent Transformation

52 J2EE Overview ver 1.0Page 52 © Wipro Technologies Talent Transformation

53 J2EE Overview ver 1.0Page 53 © Wipro Technologies Talent Transformation

54 J2EE Overview ver 1.0Page 54 © Wipro Technologies Talent Transformation

55 J2EE Overview ver 1.0Page 55 © Wipro Technologies Talent Transformation References


Download ppt "J2EE Overview ver 1.0Page 1 © Wipro Technologies Talent Transformation J2EE Overview."

Similar presentations


Ads by Google