Enterprise
Java
Enterprise Computing and J2EE
Introduction
v012405 J2EE Introduction 1
Enterprise
Java
Objectives
• Understand complexity of enterprise applications
• Understand N-Tier architectures
• Differentiate between Java platforms
– J2SE, J2ME, and J2EE
• High-level understanding of J2EE architecture and
components
v012405 J2EE Introduction 2
Enterprise
Java
From Simple
JDBC
Client Database Server
v012405 J2EE Introduction 3
Enterprise
Java
To Complex
Fat Client Order
(SWING) RMI Database
JDBC
Browser HTTP Enterprise
Client Inventory
Application Management
IIOP
CORBA Custom
Client
SNMP/JMX CRM
SOAP System
SOAP
Client Management
Console
Also: PDAs, Cell, etc.
v012405 J2EE Introduction 4
Enterprise
Java
Enterprise Applications
• Extend their reach, reduce costs, lower response times
• Provide easy access for customers, employees, and
suppliers
• Provide services that integrate existing Enterprise
Information Systems (EIS) with new business functions
– highly available
– Secure
– reliable/scaleable
v012405 J2EE Introduction 5
Enterprise
Java
Enterprise Application Requirements
• Highly Available
– Business is being bet on the system in many cases
• Secure
– Sensitive systems
– Sometimes ‘anonymous’ clients
• Scalable
– Unpredictable system loads
• Wide variety of systems, platforms, languages, and APIs to
integrate
v012405 J2EE Introduction 6
Enterprise
Java
N-Tier Architectures
• Developed to manage complexity and scalability issues
– Middle tier implements new functionality
– client-tier hides the complexity while taking advantage of low
administration web-based interfaces
• Enables system to be composed of different parts
• Areas of functionality can be ‘scaled up’ as demand
requires
• Definitely more complex than the simple client-server
application
v012405 J2EE Introduction 7
Enterprise
Java
Dynamic
Web
Web F Content
F Database
Server I Dynamic
I
R Web
R
Load Web Content
E E
Balancer Server Business
W W System
A A
L Business
L Web
L Logic
L Server
Business
Business System
For Fat Clients Logic
v012405 J2EE Introduction 8
Enterprise
Java
Java 2 Enterprise Edition
• ‘Standard’ for developing multi-tier, enterprise
applications
• Simplify development of multi-tier applications
– Handle difficult middleware requirements
• Transactions
• Security
• Distributed objects
• Scaling
v012405 J2EE Introduction 9
Enterprise
Java
Java Platforms
• Java 2 Micro Edition (J2ME)
– Java applications for ‘micro’ devices
– PDAs, cell phones, set-top boxes
• Java 2 Standard Edition (J2SE)
– Used by J2EE. Write-Once Run-Anywhere
– ‘JDK’
• Java 2 Enterprise Edition (J2EE)
– N-Tier server-side applications
v012405 J2EE Introduction 10
Enterprise
Java
J2EE Components
• J2EE Platform
• J2EE Compatibility Test Suite
• J2EE Reference Implementation
• Sun Blueprints Design Guidelines for J2EE
v012405 J2EE Introduction 11
Enterprise
Java
Compatibility Test Suite
• Verifies platform vendors have correctly implemented to
the spec
• J2EE 1.3 Compatible Implementations
– BEA Weblogic Server 7.0, Borland Enterprise Server, Computer
Associates Advantage Joe, Fujitsu Interstage, IBM Websphere,
Macromedia JRun 4, Oracle 9i App Server, Pramati Server 3.0,
SAS AppDev Studio, Silverstream App Server, Sun ONE
Application Server, Sybase EAServer 4.1, TMax Soft JEUS 4.0,
TriFork Application Server 3.1, J2EE SDK 1.3
• J2EE 1.4
– “Web Services”
• J2EE 1.5
– “Ease of Use”
v012405 J2EE Introduction 12
Enterprise
Java
Reference Implementation
• Operational definition of the J2EE platform
• Proves spec is implementable
• Programmer experimentation
• Download At:
– http://java.sun.com/j2ee/download.html
v012405 J2EE Introduction 13
Enterprise
Java
Blueprints
• Set of best practices
• http://java.sun.com/blueprints/
v012405 J2EE Introduction 14
Enterprise
Java
v012405 J2EE Introduction 15
Enterprise
Java
J2EE Platform
• Our main focus – standard execution environment for
enterprise components
v012405 J2EE Introduction 16
Enterprise
Java
J2EE Architectural Model
v012405 J2EE Introduction 17
Enterprise
Java
J2EE Architecture Diagram
v012405 J2EE Introduction 18
Containers, Components, and Enterprise
Java
Connectors
v012405 J2EE Introduction 19
Enterprise
Java
Application Components
• Application Clients
• Applets
• Servlets, JSP pages, filters, and web event listeners
– Referred to as ‘Web Components’
• Enterprise Java Beans
– Business logic for J2EE application
– transactional
v012405 J2EE Introduction 20
Enterprise
Java
Application Component Categories
• Deployed, managed, and executed on the J2EE server
– JSPs, Servlets, EJBs
• Deployed and managed on the J2EE server, but executed
on the client platform
– HTML pages
– Applets embedded within HTML pages
• Deployment and management not fully addressed by J2EE
specification
– Application Clients
v012405 J2EE Introduction 21
Enterprise
Java
Containers
• Provide run-time support to application components
– Provides Java 2 Standard Environment
– Provides APIs to access standard set of J2EE services
• Interposed between application clients and J2EE services
– allows for declarative (versus programmatic) implementation of
services (e.g., security, transactions, and state management)
• Understands application packaging forms for deployment
• Part of a J2EE ‘server’
– Typically implemented from an existing transaction processing
infrastructure
v012405 J2EE Introduction 22
Enterprise
Java
Containers (Cont)
• Deployment descriptor is the contract between a
component and the container
– TellerBean – no one can invoke the ‘closeAccount’ method unless
they are in the ‘manager’ role
– Essentially an XML config file
• Other Services
– Lifecycle management
• Create and Destroy components as as demand and resources require
– Resource Pooling
• Object pooling, connection pooling, thread pooling
v012405 J2EE Introduction 23
Enterprise
Java
Connectors
• Integrate EIS systems with J2EE system components
– CICS
– Tandem
– SAP/R3
– PeopleSoft
– See: http://java.sun.com/j2ee/connector/products.html
• http://java.sun.com/j2ee/connector
v012405 J2EE Introduction 24
Enterprise
Java
JCA Overview
v012405 J2EE Introduction 25
Enterprise
Java
JCA Scenario
v012405 J2EE Introduction 26
Enterprise
Java
J2EE Services
v012405 J2EE Introduction 27
Enterprise
Java
Services (Cont)
• Java Naming and Directory Interface (JNDI)
– Look up objects (services)
• JDBC
– Access to relational databases and other repositories
• JavaMail
– Send and receive mail
– Order confirmations, customer feedback
– Requires Java Activation Framework (JAF)
• CORBA Compliance
– JavaIDL and RMI/IIOP
v012405 J2EE Introduction 28
Enterprise
Java
Services (Cont)
• Java Transaction API (JTA)
– Components may manage transactions
– Usually, better left to platform
• XML Deployment Descriptors
– Custom tool development
• Java Message Service (JMS)
– Asynchronous communication with fault tolerance
v012405 J2EE Introduction 29
Enterprise
Java
Services (Cont)
• HTTP
– Client-side API defined in java.net
– Standard: http://www.w3.org/Protocols/
• HTTPs
– HTTP over Secure Socket Layer (SSL)
• JAXP
– Java API for XML Parsing
v012405 J2EE Introduction 30
Enterprise
Java
Services (Cont)
• J2EE Connector Architecture (JCA)
– Standardized access to EIS
• Security Services
– JAAS allows services to authenticate and enforce access controls
– JACC allows security implementations to be ‘plugged into’ a J2EE
application server
v012405 J2EE Introduction 31
Enterprise
Java
Services (Cont)
• Management
– Manage servers using an enterprise bean
– Some JMX support
• Deployment
– Contract between deployment tools and J2EE products
– J2EE product provides a plug-in component that the tool can use to
deploy applications into the product
v012405 J2EE Introduction 32
Enterprise
Java
Services (Cont)
• Web Services
– Deployment of web service clients and service endpoints fully
specified
– Web service clients
• JAX-RPC for SOAP Web service calls
– Web service endpoints
• Implementation using enterprise beans
– Java API for XML Registries for registry support
v012405 J2EE Introduction 33
Enterprise
Java
Transactions
• Transactional Resources
– JDBC Connections
– JMS Sessions
– XATransaction Resource Adapters
• Transaction boundaries specified programmatically and
declaratively
• Transactions may span multiple components and
transactional resources
v012405 J2EE Introduction 34
Enterprise
Java
Transaction Scenarios
v012405 J2EE Introduction 35
Enterprise
Java
J2EE Security Goals
• Security should be portable and interoperable
• Security policy specified declaratively in deployment
descriptors whenever possible
• Non-goals
– Does not dictate a security policy
– Does not mandate a specific security technology
v012405 J2EE Introduction 36
Enterprise
Java
Security (Cont)
• Authentication
– Prove identity
– Basic Authentication, HTTPs client authentication, SSL mutual
authentication, Form-based authentication
– Application clients/JAAS
• Access Control
– Limit access to resources based on role
• Can client access web page, servlet, JSP
• Can client invoke EJB method
v012405 J2EE Introduction 37
Enterprise
Java
Security (Cont)
• Deployment descriptor states security policies for
declarative security
• APIs give access to security information
– HttpServletRequest
• getUserPrincipal, isUserInRole
– EJBContext
• getCallerPrincipal, isCallerInRole
• A J2EE product may restrict the use of certain J2SE
classes and methods to secure and insure proper operation
of the system.
v012405 J2EE Introduction 38
Enterprise
Java
Naming
• J2EE application clients, enterprise beans, and web
components are required to have access to a JNDI naming
environment.
• Containers provide naming context for components
• Deployment descriptors specify the component’s
requirements for access to external information to the
application assembler and deployers
• Components use JNDI interface
v012405 J2EE Introduction 39
Enterprise
Java
J2EE Applications
• J2EE Applications are composed of:
– One or more J2EE components
– Module-level deployment descriptor
• Lists application components as ‘modules’
• Goal:
– Modular application assembly
– Portable deployment
v012405 J2EE Introduction 40
Enterprise
Java
v012405 J2EE Introduction 41
Enterprise
Java
Application Development Lifecycle
v012405 J2EE Introduction 42
Enterprise
Java
Interoperability
v012405 J2EE Introduction 43
Enterprise
Java
Product Extensions
• Product Extensions are possible to standard
– Specification defines the minimum with extensions expected
– Extensions may not change or add anything (classes, methods,
parameters, etc.) to the packages identified by the specification
– may provide additional APIs
v012405 J2EE Introduction 44
Enterprise
Java
Product Requirements
• No specification on the number of programs or computers
it takes to implement the standard
• No specification on the partitioning of services
• No specification on the product boundaries
– may need to purchase different levels of compatibility
incrementally
v012405 J2EE Introduction 45
Enterprise
Java
Platform Roles
• J2EE Product Provider
– typically operating system venders, database venders, application
server vendors, or web server vendors
– provide component containers, API implementations, etc.
– provides deployment and management tools
• Application Component Provider
– HTML document designers
– Applet developers
– EJB developers
v012405 J2EE Introduction 46
Enterprise
Java
Platform Roles (Cont)
• Application Assembler
– assembles application components into a J2EE application
• Deployer
– deploys software
– configures J2EE application for use in a specific environment
– instantiates application
– expert in the deployment environment
v012405 J2EE Introduction 47
Enterprise
Java
Platform Roles (Cont)
• System Administrator
– configuration and administration of computing and networking
infrastructure
– monitors operation of application
• Tool Provider
– develops tools for the development and packaging of components
v012405 J2EE Introduction 48
Enterprise
Java
J2EE Architecture
v012405 J2EE Introduction 49
Enterprise
Java
Multi-Tier Model
• Client Tier
– supports client access both inside and outside corporate firewall
• Middle Tier
– supports client services through Web containers in the Web Tier
– supports business logic through EJB containers in the EJB Tier
• Enterprise Information Tier
– supports access to information through standard APIs
v012405 J2EE Introduction 50
Enterprise
Java
Client Tier
• Variety of client types both inside and outside the
enterprise firewall
– Web Browsers using
• plain HTML pages
• dynamic HTML pages generated through JSPs
• Applets
– Standalone Java applications (portable code, non-portable install)
• Access Middle-Tier using web standards
– HTTP, HTML, and XML
• Complex client interaction
– communicated with through middle-tier Servlets
– clients access through JavaBeans
v012405 J2EE Introduction 51
Enterprise
Java
Middle Tier
• Application developer supplies business code in the form
of Enterprise JavaBeans
• EJB Container provides reliability, scalability, security,and
other qualities/services for the business code
– APIs to implement business code
– Distributed environment to use the business code
v012405 J2EE Introduction 52
Enterprise
Java
v012405 J2EE Introduction 53
Enterprise
Java
Client Scenarios
v012405 J2EE Introduction 54
Enterprise
Java
Direct Client-EJB Access
v012405 J2EE Introduction 55
Enterprise
Java
Direct Client EIS Access
v012405 J2EE Introduction 56
Enterprise
Java
Direct Client Access to Web Content
v012405 J2EE Introduction 57
3 Tier Web-Centric Application Scenario Enterprise
Java
v012405 J2EE Introduction 58
Enterprise
Java
Business-to-Business Scenario
v012405 J2EE Introduction 59
Enterprise
Java
J2EE Future Directions
• XML Data Binding (JSR-031)
– http://java.sun.com/aboutJava/communityprocess/jsr/jsr_031_xmld.html
• JNLP
– Java Network Launch Protocol
– Deploy applications on server and launch on client
– Java Web Start is reference implementation
• J2EE SPI
– Make more aspects of an application server ‘pluggable’
– http://java.sun.com/aboutJava/communityprocess/jsr/jsr_111_jsf.html a possibility
v012405 J2EE Introduction 60
Enterprise
Java
Future Directions (Cont)
• JDBC Rowsets
– Standard way to send tabular data between remote components of a
distributed app
– http://java.sun.com/products/jdbc.
• Security APIs
– Expand APIs available to a client that wishes to control security
programmatically
• SQLJ Part 0
– Embed SQL statements in Java program
– http://www.sqlj.org
v012405 J2EE Introduction 61
Enterprise
Java
References
• Sun’s Website
– http://java.sun.com/j2ee
v012405 J2EE Introduction 62