Introduction to Java EE J 2 EE CSE

  • Slides: 51
Download presentation
Introduction to Java EE (J 2 EE) CSE, IITB

Introduction to Java EE (J 2 EE) CSE, IITB

Session Objectives n n n Understanding the value propositions of J 2 EE Getting

Session Objectives n n n Understanding the value propositions of J 2 EE Getting a big picture of J 2 EE architecture and platform Getting high-level exposure of APIs and Technologies that constitute J 2 EE q n You don't have to understand all the details Understanding why J 2 EE can be used for as a platform for development and deployment of web services CSE, IITB

What is J 2 EE? CSE, IITB

What is J 2 EE? CSE, IITB

Enterprise Computing Challenges Portability Diverse Environments Time-to-market Core Competence Assembly Integration Key Technologies J

Enterprise Computing Challenges Portability Diverse Environments Time-to-market Core Competence Assembly Integration Key Technologies J 2 SE™ J 2 EE™ JMS Servlet JSP Connector XML Data Binding XSLT Products App Servers Web Servers Components Databases Object to DB tools Legacy Systems Databases TP Monitors EIS Systems CSE, IITB

What Is the J 2 EE? n Open and standard based platform for q

What Is the J 2 EE? n Open and standard based platform for q q developing, deploying and managing n-tier, Web-enabled, server-centric, and component-based enterprise applications CSE, IITB

The Java™ Platform Java Technology Enabled Devices Java Technology Enabled Desktop Workgroup Server High-End

The Java™ Platform Java Technology Enabled Devices Java Technology Enabled Desktop Workgroup Server High-End Server CSE, IITB

The TM Java Platform Java 2 Platform Micro Edition (J 2 METM) Optional Packages

The TM Java Platform Java 2 Platform Micro Edition (J 2 METM) Optional Packages Java 2 Enterprise Edition (J 2 EE) Java 2 Standard Edition (J 2 SE) Personal Basis Profile Personal Profile Foundation Profile CDC JVM MIDP CLDC KVM Java Card APIs Card. VM CSE, IITB * Under development in JCP

Open and Standard Solution n Use "component and container" model in which container provides

Open and Standard Solution n Use "component and container" model in which container provides system services in a well-defined and as industry standard n J 2 EE is that standard that also provides portability of code because it is based on Java technology and standard-based Java programming APIs CSE, IITB

Why J 2 EE? CSE, IITB

Why J 2 EE? CSE, IITB

Platform Value to Developers n Can use any J 2 EE implementation for development

Platform Value to Developers n Can use any J 2 EE implementation for development and deployment q q n Vast amount of J 2 EE community resources q n Use production-quality standard implementation which is free for development/deployment Use high-end commercial J 2 EE products for scalability and fault-tolerance Many J 2 EE related books, articles, tutorials, quality code you can use, best practice guidelines, design patterns etc. Can use off-the-shelf 3 rd-party business components CSE, IITB

Platform Value to Vendors n Vendors work together on specifications and then compete in

Platform Value to Vendors n Vendors work together on specifications and then compete in implementations q n n In the areas of Scalability, Performance, Reliability, Availability, Management and development tools, and so on Freedom to innovate while maintaining the portability of applications Do not have create/maintain their own proprietary APIs CSE, IITB

Platform Value to Business Customers n Application portability n Many implementation choices are possible

Platform Value to Business Customers n Application portability n Many implementation choices are possible based on various requirements q q n Price (free to high-end), scalability (single CPU to clustered model), reliability, performance, tools, and more Best of breed of applications and platforms Large developer pool CSE, IITB

J 2 EE APIs & Technologies CSE, IITB

J 2 EE APIs & Technologies CSE, IITB

J 2 EE 1. 4 APIs and Technologies n n n n J 2

J 2 EE 1. 4 APIs and Technologies n n n n J 2 SE 1. 4 (improved) JAX-RPC (new) Web Service for J 2 EE Management J 2 EE Deployment JMX 1. 1 JMS 1. 1 JTA 1. 0 n n n n n Servlet 2. 4 JSP 2. 0 EJB 2. 1 JAXR Connector 1. 5 JACC JAXP 1. 2 Java. Mail 1. 3 JAF 1. 0 CSE, IITB

Java EE 5 n n n n JAX-WS 2. 0 & JSR 181 Java

Java EE 5 n n n n JAX-WS 2. 0 & JSR 181 Java Persistence EJB 3. 0 JAXB 2. 0 Java. Sever Faces 1. 2 – new to Platform JSP 2. 1 – Unification w/ JSF 1. 2 St. AX – Pull Parser – new to Platform CSE, IITB

Servlet & JSP (Java. Server Pages) CSE, IITB

Servlet & JSP (Java. Server Pages) CSE, IITB

What is a Servlet? n n n Java™ objects which extend the functionality of

What is a Servlet? n n n Java™ objects which extend the functionality of a HTTP server Dynamic contents generation Better alternative to CGI, NSAPI, ISAPI, etc. q q Efficient Platform and server independent Session management Java-based CSE, IITB

Servlet vs. CGI Request. CGI 1 Request. CGI 2 Request. CGI 1 Request. Servlet

Servlet vs. CGI Request. CGI 1 Request. CGI 2 Request. CGI 1 Request. Servlet 2 Request Servlet 1 Childfor for. CGI 1 CGI Based Webserver Childfor for. CGI 2 Childfor for. CGI 1 Servlet Based Webserver JVM Servlet 1 Servlet 2 CSE, IITB

What is JSP Technology? n Enables separation of business logic from presentation q q

What is JSP Technology? n Enables separation of business logic from presentation q q q n n Presentation is in the form of HTML or XML/XSLT Business logic is implemented as Java Beans or custom tags Better maintainability, reusability Extensible via custom tags Builds on Servlet technology CSE, IITB

EJB (Enterprise Java Beans) CSE, IITB

EJB (Enterprise Java Beans) CSE, IITB

What is EJB Technology? n n A server-side component technology Easy development and deployment

What is EJB Technology? n n A server-side component technology Easy development and deployment of Java technology-based application that are: q Transactional, distributed, multi-tier, portable, scalable, secure, … CSE, IITB

Why EJB Technology? ● ● Leverages the benefits of component-model on the server side

Why EJB Technology? ● ● Leverages the benefits of component-model on the server side Separates business logic from system code ● Provides framework for portable components ● Container provides system services Over different J 2 EE-compliant servers Over different operational environments Enables deployment-time configuration Deployment descriptor CSE, IITB

EJB Architecture CSE, IITB

EJB Architecture CSE, IITB

Enterprise Java. Beans Synchronous communication Session Bean Stateless Entity Bean Asynchronous communication Message-Driven Bean

Enterprise Java. Beans Synchronous communication Session Bean Stateless Entity Bean Asynchronous communication Message-Driven Bean Stateful Bean managed Persistence (BMP) Container managed Persistence (CMP) CSE, IITB

JMS (Java Message Service) CSE, IITB

JMS (Java Message Service) CSE, IITB

Java Message Service (JMS) n Messaging systems (MOM) provide q q q n Benefits

Java Message Service (JMS) n Messaging systems (MOM) provide q q q n Benefits of Messaging systems q n n De-coupled communication Asynchronous communication Plays a role of centralized post office Flexible, Reliable, Scalable communication systems Point-to-Point, Publish and Subscribe JMS defines standard Java APIs to messaging systems CSE, IITB

Connector Architecture CSE, IITB

Connector Architecture CSE, IITB

Connector Architecture n Defines standard API for integrating J 2 EE technology with EIS

Connector Architecture n Defines standard API for integrating J 2 EE technology with EIS systems q n Before Connector architecture, each App server has to provide an proprietary adaptor for each EIS system q n CICS, SAP, People. Soft, etc. m (# of App servers) x n (# of EIS's) Adaptors With Connector architecture, same adaptor works with all J 2 EE compliant containers q 1 (common to all App servers) x n (# of EIS's) Adaptors CSE, IITB

m x n Problem Before Connector Architecture m n App Server 1 SAP App

m x n Problem Before Connector Architecture m n App Server 1 SAP App Server 2 EIS 2 App Server 3 EIS 3 App Server EIS 4 CSE, IITB

JAAS (Part of J 2 SE 1. 4) (Java Authentication & Authorization Service) CSE,

JAAS (Part of J 2 SE 1. 4) (Java Authentication & Authorization Service) CSE, IITB

JAAS: Authentication n Pluggable authentication framework q q n Userid/password Smartcard Kerberos Biometric Application

JAAS: Authentication n Pluggable authentication framework q q n Userid/password Smartcard Kerberos Biometric Application portability regardless of authentication schemes underneath q q JAAS provides authentication scheme independent API Authentication schemes are specified Login configuration file, which will be read by JAAS CSE, IITB

JAAS Pluggable Authentication CSE, IITB

JAAS Pluggable Authentication CSE, IITB

Other J 2 EE APIs & Technologies CSE, IITB

Other J 2 EE APIs & Technologies CSE, IITB

JNDI n Java Naming and Directory Interface n Utilized by J 2 EE applications

JNDI n Java Naming and Directory Interface n Utilized by J 2 EE applications to locate resources and objects in portable fashion q q Applications use symbolic names to find object references to resources via JNDI The symbolic names and object references have to be configured by system administrator when the application is deployed. CSE, IITB

JDBC n Provides standard Java programming API to relational database q n Uses SQL

JDBC n Provides standard Java programming API to relational database q n Uses SQL Vendors provide JDBC compliant driver which can be invoked via standard Java programming API CSE, IITB

J 2 EE Management (JSR-77) n n Management applications should be able to discover

J 2 EE Management (JSR-77) n n Management applications should be able to discover and interpret the managed data of any J 2 EE platform Single management platform can manage multiple J 2 EE servers from different vendors Management protocol specifications ensure a uniform view by SNMP and WBEM management stations Leverages JMX CSE, IITB

J 2 EE Deployment (JSR-88) - J 2 EE 1. 4 Tools IDEs Standard

J 2 EE Deployment (JSR-88) - J 2 EE 1. 4 Tools IDEs Standard Deployment API (Universal Remote) J 2 EE Platforms Vendor Deploy Tools Management Tools CSE, IITB

JMX API into the J 2 EE 1. 4 platform Dynamic Deployment JMX App

JMX API into the J 2 EE 1. 4 platform Dynamic Deployment JMX App J 2 EE App Server JMX defacto A single technology for the J 2 EE platform CSE, IITB

J 2 EE is an End-to-End Architecture CSE, IITB

J 2 EE is an End-to-End Architecture CSE, IITB

N-tier J 2 EE Architecture CSE, IITB

N-tier J 2 EE Architecture CSE, IITB

J 2 EE Component & Container Architecture CSE, IITB

J 2 EE Component & Container Architecture CSE, IITB

J 2 EE Containers & Components Web Container App Client HTTP/ HTTPS Java. Mail

J 2 EE Containers & Components Web Container App Client HTTP/ HTTPS Java. Mail JAF JDBC JTA JAF JMS Java. Mail JNDI JTA JMS App Client Container JNDI J 2 SE EJB RMI/IIOP Servlet JSP JDBC HTTP/ HTTPS Applet EJB Container RMI/IIOP Applet Container J 2 SE JDBC RMI/IIOP JMS JNDI RMI J 2 SE Database CSE, IITB

Containers Handle Concurrency Security Availability Scalability Persistence Transaction Life-cycle management Management Components Handle Presentation

Containers Handle Concurrency Security Availability Scalability Persistence Transaction Life-cycle management Management Components Handle Presentation Business Logic CSE, IITB

Containers & Components n Containers do their work invisibly – No complicated APIs –

Containers & Components n Containers do their work invisibly – No complicated APIs – They control by interposition n Containers implement J 2 EE – Look the same to components – Vendors making the containers have great freedom to innovate CSE, IITB

J 2 EE Application Anatomies CSE, IITB

J 2 EE Application Anatomies CSE, IITB

Possible J 2 EE Application Anatomies Web Server EJB Server DB & EIS Resources

Possible J 2 EE Application Anatomies Web Server EJB Server DB & EIS Resources Browser Web Server EJB Server Stand-alone CSE, IITB

J 2 EE Application Anatomies ● 4 -tier J 2 EE applications – HTML

J 2 EE Application Anatomies ● 4 -tier J 2 EE applications – HTML client, JSP/Servlets, EJB, JDBC/Connector ● 3 -tier J 2 EE applications – HTML client, JSP/Servlets, JDBC ● 3 -tier J 2 EE applications – EJB standalone applications, EJB, JDBC/Connector ● B 2 B Enterprise applications – J 2 EE platform to J 2 EE platform through the exchange of JMS or XML-based messages CSE, IITB

Which One to Use? ● Depends on several factors Requirements of applications Availability of

Which One to Use? ● Depends on several factors Requirements of applications Availability of EJB tier Availability of developer resource CSE, IITB

Assignment 3 CSE, IITB

Assignment 3 CSE, IITB

Assignment 3 – Deadline Feb 5 Booking server Client (Browser) JSP 1 SB 1

Assignment 3 – Deadline Feb 5 Booking server Client (Browser) JSP 1 SB 1 Xaction. # JMS Topic Posting & Display server JSP 2 MDB SB 2 CSE, IITB

Notes on Assignment n JSP 1 – takes in a a stock trade to

Notes on Assignment n JSP 1 – takes in a a stock trade to do as input (Ticker symbol & quantity) q q n n n Assume all trades are buys. Invokes the SB SB posts trade into a “Transactions” table (ID, Ticker symbol and trade amount) and the transaction ID (Unique) into the queue. The MDB gets notified from the queue and invokes the SB 2 reads the transaction and adjusts the “Positions” table. (Ticker symbol, Current position) JSP 2 is used to read the current positions. Build a delay into the MDB. CSE, IITB