1 / 55

J2EE Overview

J2EE Overview. 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. Java 2 Editions.

Download Presentation

J2EE Overview

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. J2EE Overview J2EE Overview ver 1.0

  2. 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 J2EE Overview ver 1.0

  3. Java 2 Editions J2EE Overview ver 1.0

  4. Issues in Enterprise Applications • Transactions • State management • Multithreading • Resource pooling • Security J2EE Overview ver 1.0

  5. RMI JNDI JDBC JavaMail Servlets JSP Java IDL EJB JMS JTA Connectors XML Java 2: Standard ed. Java 2 Platform, Enterprise Edition J2EE J2EE Overview ver 1.0

  6. J2EE Architecture J2EE Overview ver 1.0

  7. 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) J2EE Overview ver 1.0

  8. Naming Services • Provide J2EE components with access to a JNDI naming environment • J2EE component locates its environment naming context using JNDI interfaces J2EE Overview ver 1.0

  9. 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 J2EE Overview ver 1.0

  10. JNDI Interface J2EE Overview ver 1.0

  11. 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; } J2EE Overview ver 1.0

  12. 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 J2EE Overview ver 1.0

  13. 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 J2EE Overview ver 1.0

  14. 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 J2EE Overview ver 1.0

  15. 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 J2EE Overview ver 1.0

  16. 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 J2EE Overview ver 1.0

  17. 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 J2EE Overview ver 1.0

  18. 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 J2EE Overview ver 1.0

  19. Introduction to RMI • Distributed Computing • RPC • RMI J2EE Overview ver 1.0

  20. Features of RMI • Remote invocations of methods on objects in different JVM’s • Simple to write reliable distributed applications • RMI is transparent J2EE Overview ver 1.0

  21. Client Program Server Program Stub Skeleton Layer RRL RRL • Transport Layer RMI Architecture J2EE Overview ver 1.0

  22. 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; } J2EE Overview ver 1.0

  23. 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; } J2EE Overview ver 1.0

  24. 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(); } }} J2EE Overview ver 1.0

  25. 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);}} J2EE Overview ver 1.0

  26. 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 J2EE Overview ver 1.0

  27. 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 J2EE Overview ver 1.0

  28. 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. J2EE Overview ver 1.0

  29. 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 Architecture • 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. J2EE Overview ver 1.0

  30. Publish-Subscribe Messaging J2EE Overview ver 1.0

  31. Point- To-Point Messaging J2EE Overview ver 1.0

  32. 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 J2EE Overview ver 1.0

  33. 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 J2EE Overview ver 1.0

  34. Defining EJB Technology • Is a server component specification (for vendors) • Separates and defines integration of development stages: • Component creation • Application assembly • Application deployment J2EE Overview ver 1.0

  35. EJB Developer Roles J2EE Overview ver 1.0

  36. EJB Programming Paradigm • Declarative programming and customizing J2EE Overview ver 1.0

  37. EJB Programming Paradigm • Deploying J2EE Overview ver 1.0

  38. 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 J2EE Overview ver 1.0

  39. EJB Architecture Overview J2EE Overview ver 1.0

  40. EJB Server • Services: • Transaction support • Data access • System resource • Namespace • Industry support: • Application/ middleware servers • Database servers J2EE Overview ver 1.0

  41. 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 J2EE Overview ver 1.0

  42. EJB Container • Provides some standard services: • Persistence • Transaction control • Security • EJB instance lifecycle management • EJB instance identification J2EE Overview ver 1.0

  43. Home Interface • Factory interface for the bean: • Interface provided by EJB developer • Class generated by vendor tool • One factory class per bean class • Factory instanceis installed into the server’s naming service J2EE Overview ver 1.0

  44. J2EE Overview ver 1.0

  45. Remote Interface • Interface is provided by bean developer. • Implementation is provided by container tools, which include: • Stubs and skeletons • The EJB Object J2EE Overview ver 1.0

  46. 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 J2EE Overview ver 1.0

  47. Stubs and Skeletons • Stub is downloaded from server • Communication between stub and skeleton can be proprietary, yet EJB code is still portable J2EE Overview ver 1.0

  48. Types of EJBs J2EE Overview ver 1.0

  49. J2EE Components and Containers J2EE Overview ver 1.0

  50. 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 J2EE Overview ver 1.0

More Related