Beruflich Dokumente
Kultur Dokumente
Java
Introduction
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
From Simple
JDBC
Client Database Server
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
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
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
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
J2EE Components
• J2EE Platform
• J2EE Compatibility Test Suite
• J2EE Reference Implementation
• Sun Blueprints Design Guidelines for J2EE
Reference Implementation
• Operational definition of the J2EE platform
• Proves spec is implementable
• Programmer experimentation
• Download At:
– http://java.sun.com/j2ee/download.html
Blueprints
• Set of best practices
• http://java.sun.com/blueprints/
J2EE Platform
• Our main focus – standard execution environment for
enterprise components
Connectors
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
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
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
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
JCA Overview
JCA Scenario
J2EE Services
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
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
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
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
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
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
Transactions
• Transactional Resources
– JDBC Connections
– JMS Sessions
– XATransaction Resource Adapters
• Transaction boundaries specified programmatically and
declaratively
• Transactions may span multiple components and
transactional resources
Transaction Scenarios
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
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.
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
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
Interoperability
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
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
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
J2EE Architecture
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
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
Client Scenarios
Business-to-Business Scenario
• 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
References
• Sun’s Website
– http://java.sun.com/j2ee