J 2 EE Overview Wipro Technologies Talent Transformation

  • Slides: 55
Download presentation
J 2 EE Overview © Wipro Technologies Talent Transformation J 2 EE Overview ver

J 2 EE Overview © Wipro Technologies Talent Transformation J 2 EE Overview ver 1. 0 1

Objectives In this session, you will learn to: • Identify the characteristics of different

Objectives In this session, you will learn to: • Identify the characteristics of different Java Platforms • Identify the challenges of an enterprise application • Describe J 2 EE architecture • Define the role of various J 2 EE technologies © Wipro Technologies Talent Transformation J 2 EE Overview ver 1. 0 2

Java 2 Editions © Wipro Technologies Talent Transformation J 2 EE Overview ver 1.

Java 2 Editions © Wipro Technologies Talent Transformation J 2 EE Overview ver 1. 0 3

Issues in Enterprise Applications • • • Transactions State management Multithreading Resource pooling Security

Issues in Enterprise Applications • • • Transactions State management Multithreading Resource pooling Security © Wipro Technologies Talent Transformation J 2 EE Overview ver 1. 0 4

Java 2 Platform, Enterprise Edition Java 2: Standard ed. RMI EJB JNDI JMS J

Java 2 Platform, Enterprise Edition Java 2: Standard ed. RMI EJB JNDI JMS J 2 EE JDBC JTA Java. Mail Servlets © Wipro Technologies Talent Transformation Connectors JSP J 2 EE Overview Java IDL ver 1. 0 XML 5

J 2 EE Architecture © Wipro Technologies Talent Transformation J 2 EE Overview ver

J 2 EE Architecture © Wipro Technologies Talent Transformation J 2 EE Overview ver 1. 0 6

J 2 EE Services Web Database Access Naming And Directory Messaging Email Access Protocol

J 2 EE Services Web Database Access Naming And Directory Messaging Email Access Protocol Transaction © Wipro Technologies Talent Transformation Java Technology Servlets/ JSPs (HTML/ XML) Java Data. Base Connectivity (JDBC™) Java Naming and Directory Interface Java Message Service (JMS) Java. Mail™ Java. IDL, Remote Method Invocation (CORBA compatible) Object Transaction Service (OTS), Java Transaction Service (JTS), Java Transaction API (JTA) J 2 EE Overview ver 1. 0 7

Naming Services • Provide J 2 EE components with access to a JNDI naming

Naming Services • Provide J 2 EE components with access to a JNDI naming environment – J 2 EE component locates its environment naming context using JNDI interfaces © Wipro Technologies Talent Transformation J 2 EE Overview ver 1. 0 8

Java Naming and Directory Interface • A standard for Naming and directory services •

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 © Wipro Technologies Talent Transformation J 2 EE Overview ver 1. 0 9

JNDI Interface © Wipro Technologies Talent Transformation J 2 EE Overview ver 1. 0

JNDI Interface © Wipro Technologies Talent Transformation J 2 EE Overview ver 1. 0 10

Transaction Scenario. . . What’s Wrong with This Code? try { // Withdraw funds

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; } © Wipro Technologies Talent Transformation J 2 EE Overview ver 1. 0 11

Transaction Definition • An atomic unit of work • Can consist of multiple operations

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 © Wipro Technologies Talent Transformation J 2 EE Overview ver 1. 0 12

Transaction Participants • Resource has transactional state – Example: Database connection • Resource manager

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 © Wipro Technologies Talent Transformation J 2 EE Overview ver 1. 0 13

Transaction Participants • Transaction manager: – Controls state of transaction, two- phase commit –

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 © Wipro Technologies Talent Transformation J 2 EE Overview ver 1. 0 14

Transactions and the ACID Properties • As we have seen, exceptions are not enough

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 © Wipro Technologies Talent Transformation J 2 EE Overview ver 1. 0 15

Transaction Services • J 2 EE transactions are flat • J 2 EE platform

Transaction Services • J 2 EE transactions are flat • J 2 EE platform implicitly handles many transaction details • A Transaction is a unit of work that makes a set of guarantees about its execution © Wipro Technologies Talent Transformation J 2 EE Overview ver 1. 0 16

Java Transaction API (JTA) and Java Transaction Service (JTS) • JTA: – High level

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 © Wipro Technologies Talent Transformation J 2 EE Overview ver 1. 0 17

Service Technology • Provide access to database, transactions, naming and directory services and enterprise

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 © Wipro Technologies Talent Transformation J 2 EE Overview ver 1. 0 18

Introduction to RMI • Distributed Computing • RPC • RMI © Wipro Technologies Talent

Introduction to RMI • Distributed Computing • RPC • RMI © Wipro Technologies Talent Transformation J 2 EE Overview ver 1. 0 19

Features of RMI • Remote invocations of methods on objects in different JVM’s •

Features of RMI • Remote invocations of methods on objects in different JVM’s • Simple to write reliable distributed applications • RMI is transparent © Wipro Technologies Talent Transformation J 2 EE Overview ver 1. 0 20

RMI Architecture Client Program Server Program Stub Skeleton Layer RRL Transport Layer © Wipro

RMI Architecture Client Program Server Program Stub Skeleton Layer RRL Transport Layer © Wipro Technologies Talent Transformation J 2 EE Overview ver 1. 0 21

Writing a Simple RMI program • Write the Remote Object program //Product. java import

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 get. Description() throws Remote. Exception; } © Wipro Technologies Talent Transformation J 2 EE Overview ver 1. 0 22

Writing a Simple RMI program 2) Write the Remote Server Program //Product. Impl. java

Writing a Simple RMI program 2) Write the Remote Server Program //Product. Impl. java import java. rmi. *; import java. rmi. server. *; public class Product. Impl extends Unicast. Remote. Object implements Product { private String str; public Product. Impl(String d) throws Remote. Exception{ str = d; } public String get. Description() throws Remote. Exception{ return "Product Name : "+str; } © Wipro Technologies Talent Transformation J 2 EE Overview ver 1. 0 23

Writing a Simple RMI program 2) Write the Remote Server Program …contnd public static

Writing a Simple RMI program 2) Write the Remote Server Program …contnd public static void main(String a[]) { try{ Product. Impl p 1= new Product. Impl("Washing Machine"); Product. Impl p 2= new Product. Impl("Microwave Oven"); Naming. rebind("wash", p 1); Naming. rebind("oven", p 2); }catch(Exception e) { System. out. println("ERROR: "+e); e. print. Stack. Trace(); } }} © Wipro Technologies Talent Transformation J 2 EE Overview ver 1. 0 24

Writing a Simple RMI program 3) Write the Client program import java. rmi. *;

Writing a Simple RMI program 3) Write the Client program import java. rmi. *; import java. rmi. server. *; public class Product. Client { public static void main(String a[]){ try{ Product c 1=(Product)Naming. lookup("wash"); Product c 2=(Product)Naming. lookup("oven"); System. out. println(c 1. get. Description()); System. out. println(c 2. get. Description()); }catch(Exception e){System. out. println("Error: "+ e); } System. exit(0); }} © Wipro Technologies Talent Transformation J 2 EE Overview ver 1. 0 25

Java. Mail • The Java. Mail API allows your applications to use e-mail capabilities

Java. Mail • The Java. Mail API allows your applications to use e-mail capabilities • Java. Mail 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 Java. Beans Activation Framework (JAF) to encapsulate message data and to handle interactions with that data © Wipro Technologies Talent Transformation J 2 EE Overview ver 1. 0 26

Java Messaging Service • JMS allows Java programs to exchange messages with other Java

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 © Wipro Technologies Talent Transformation J 2 EE Overview ver 1. 0 27

Real Time Example • Automobile manufacturer – The inventory component can send a message

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. © Wipro Technologies Talent Transformation J 2 EE Overview ver 1. 0 28

JMS Architecture • • JMS clients JMS provider – is a messaging product that

JMS Architecture • • JMS clients 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. © Wipro Technologies Talent Transformation J 2 EE Overview – the programs or components written in the Java programming language that produce and consume messages. • Messages – the objects that communicate information between JMS clients. ver 1. 0 29

Publish-Subscribe Messaging © Wipro Technologies Talent Transformation J 2 EE Overview ver 1. 0

Publish-Subscribe Messaging © Wipro Technologies Talent Transformation J 2 EE Overview ver 1. 0 30

Point- To-Point Messaging © Wipro Technologies Talent Transformation J 2 EE Overview ver 1.

Point- To-Point Messaging © Wipro Technologies Talent Transformation J 2 EE Overview ver 1. 0 31

Enterprise Java. Beans • Enterprise Java. Beans is an architecture for componentbased distributed computing:

Enterprise Java. Beans • Enterprise Java. Beans is an architecture for componentbased 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 © Wipro Technologies Talent Transformation J 2 EE Overview ver 1. 0 32

Defining EJB Technology • EJB servers provide core services to server components: – –

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 © Wipro Technologies Talent Transformation J 2 EE Overview ver 1. 0 33

Defining EJB Technology • Is a server component specification (for vendors) • Separates and

Defining EJB Technology • Is a server component specification (for vendors) • Separates and defines integration of development stages: – Component creation – Application assembly – Application deployment © Wipro Technologies Talent Transformation J 2 EE Overview ver 1. 0 34

EJB Developer Roles © Wipro Technologies Talent Transformation J 2 EE Overview ver 1.

EJB Developer Roles © Wipro Technologies Talent Transformation J 2 EE Overview ver 1. 0 35

EJB Programming Paradigm • Declarative programming and customizing © Wipro Technologies Talent Transformation J

EJB Programming Paradigm • Declarative programming and customizing © Wipro Technologies Talent Transformation J 2 EE Overview ver 1. 0 36

EJB Programming Paradigm • Deploying © Wipro Technologies Talent Transformation J 2 EE Overview

EJB Programming Paradigm • Deploying © Wipro Technologies Talent Transformation J 2 EE Overview ver 1. 0 37

EJB Architecture Overview • Uniform client access whether local or remote • Home object

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 © Wipro Technologies Talent Transformation J 2 EE Overview ver 1. 0 38

EJB Architecture Overview © Wipro Technologies Talent Transformation J 2 EE Overview ver 1.

EJB Architecture Overview © Wipro Technologies Talent Transformation J 2 EE Overview ver 1. 0 39

EJB Server • Services: – – Transaction support Data access System resource Namespace •

EJB Server • Services: – – Transaction support Data access System resource Namespace • Industry support: – Application/ middleware servers – Database servers © Wipro Technologies Talent Transformation J 2 EE Overview ver 1. 0 40

EJB Container • Can contain multiple Bean classes or homes – Often created using

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 © Wipro Technologies Talent Transformation J 2 EE Overview ver 1. 0 41

EJB Container • Provides some standard services: – – – Persistence Transaction control Security

EJB Container • Provides some standard services: – – – Persistence Transaction control Security EJB instance lifecycle management EJB instance identification © Wipro Technologies Talent Transformation J 2 EE Overview ver 1. 0 42

Home Interface • Factory interface for the bean: – Interface provided by EJB developer

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 © Wipro Technologies Talent Transformation J 2 EE Overview ver 1. 0 43

© Wipro Technologies Talent Transformation J 2 EE Overview ver 1. 0 44

© Wipro Technologies Talent Transformation J 2 EE Overview ver 1. 0 44

Remote Interface • Interface is provided by bean developer. • Implementation is provided by

Remote Interface • Interface is provided by bean developer. • Implementation is provided by container tools, which include: – Stubs and skeletons – The EJB Object © Wipro Technologies Talent Transformation J 2 EE Overview ver 1. 0 45

EJB Object • The EJB Object is a wrapper object that acts as a

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 © Wipro Technologies Talent Transformation J 2 EE Overview ver 1. 0 46

Stubs and Skeletons • Stub is downloaded from server • Communication between stub and

Stubs and Skeletons • Stub is downloaded from server • Communication between stub and skeleton can be proprietary, yet EJB code is still portable © Wipro Technologies Talent Transformation J 2 EE Overview ver 1. 0 47

Types of EJBs © Wipro Technologies Talent Transformation J 2 EE Overview ver 1.

Types of EJBs © Wipro Technologies Talent Transformation J 2 EE Overview ver 1. 0 48

J 2 EE Components and Containers © Wipro Technologies Talent Transformation J 2 EE

J 2 EE Components and Containers © Wipro Technologies Talent Transformation J 2 EE Overview ver 1. 0 49

Summary In this session, you learnt to: • Identify characteristics of different Java Platforms

Summary In this session, you learnt to: • Identify characteristics of different Java Platforms • Identify the challenges of an enterprise application • Describe J 2 EE architecture • Define the role of various J 2 EE technologies © Wipro Technologies Talent Transformation J 2 EE Overview ver 1. 0 50

© Wipro Technologies Talent Transformation J 2 EE Overview ver 1. 0 51

© Wipro Technologies Talent Transformation J 2 EE Overview ver 1. 0 51

© Wipro Technologies Talent Transformation J 2 EE Overview ver 1. 0 52

© Wipro Technologies Talent Transformation J 2 EE Overview ver 1. 0 52

© Wipro Technologies Talent Transformation J 2 EE Overview ver 1. 0 53

© Wipro Technologies Talent Transformation J 2 EE Overview ver 1. 0 53

© Wipro Technologies Talent Transformation J 2 EE Overview ver 1. 0 54

© Wipro Technologies Talent Transformation J 2 EE Overview ver 1. 0 54

References © Wipro Technologies Talent Transformation J 2 EE Overview ver 1. 0 55

References © Wipro Technologies Talent Transformation J 2 EE Overview ver 1. 0 55