Title: Java 2 Platform, Enterprise Edition (J2EE) An Overview
1Java 2 Platform, Enterprise Edition(J2EE)An
Overview
? ? ? ?????????? tsaiwn_at_csie.nctu.edu.tw
2What Is J2EE ?
- Java 2 Enterprise Edition
- There are 3 different specifications within the
Java framework (J2SE, J2ME, J2EE) - Created to provide a simple, unified standard for
distributed applications through a component
based application model - Specification is managed by a consortium of
industry leaders
3Some useful online references
- http//java.sun.com
- http//java.sun.com/j2ee
- http//java.sun.com/j2ee/tutorial/index.html
4J2EE and Other Java 2 Platform Editions
Source Computer, August 2000
J2EE, J2SE, J2ME
5J2EE and Other Java 2 Platform Editions
J2EE, J2SE, J2ME
Source Sun Microsystems, Inc.
6Java Development and Runtime Environment
Source P.J. Perrone and V.S.R.R. Chaganti,
Building Java Enterprise Systems with J2EE
7Java 2 Platform Runtime Architecture
Source P.J. Perrone and V.S.R.R. Chaganti,
Building Java Enterprise Systems with J2EE
8Java 2 Platform, Standard Edition (J2SE 1.3)
Source Sun Microsystems, Inc.,
http//java.sun.com/j2se/1.3/
9Java 2 Platform, Standard Edition (J2SE 1.4)
Source Sun Microsystems, Inc.,
http//java.sun.com/j2se/1.4/
10Why J2EE ?
- A stand alone program
- Client/Server (2-Tier)
- BBS, News, FTP, Telnet,
- Traditional (non-component) N-Tier Systems
- 3-tier application Browser WEB Server DBMS
- New trend
- Component N-Tier Systems(J2EE Architecture)
See figures on next slides
112-Tier Database Access
- Client Tier Presentation, Business Logic
- Data Tier Database Management Services
Source Sun Microsystems, Inc., JDBC 3.0
Specification
12Traditional(non-component) N-Tier Systems
- Client Tier Presentation Logic
- Application Tier Business Logic
- Data Tier Database Management Services
Source Sun Microsystems, Inc., JDBC 3.0
Specification
13Component N-Tier SystemsJ2EE Architecture
EIS Tier
Web Tier
Business Tier
Client Tier
J2EE Server Machine
Client Machine
Database Server Machine
14J2EE Architecture (1/2) J2EE Component and
Container
Source Sun Microsystems, Inc., J2EE
Specification v1.3
15J2EE Architecture (2/2)
- J2EE consists of three major parts
- Components
- Hold presentation and business logic
- Containers
- Provide context for components
- Connectors
- Provide access to legacy enterprise systems
16J2EE Components
- Application clients
- Applets
- Web components
- Servelets, Java Server Pages (JSP)
- Portlet (see JSR168)
- Business components
- Enterprise Java Beans (EJB)
17J2EE ComponentApplet Component
- An applet is a program written in the JavaTM
programming language that can be included in an
HTML page, much in the same way an image is
included. When you use a Java technology-enabled
browser to view a page that contains an applet,
the applet's code is transferred to your system
and executed by the browser's Java Virtual
Machine (JVM). - An applet is a small program that is intended not
to be run on its own, but rather to be embedded
inside another application.
18Applet pro vs. con
- Applets Java code that runs inside browser
- Advantages
- Extends functionality on the client side
- More complicated GUIs than w/ HTML or JavaScript
- Computation can be off-loaded from server
- Users dont have to build, install, and configure
- Disadvantages
- Download time
- Sandbox limits functionality (unless signed)
- Window management by browser
19J2EE ComponentWeb Component
- Servlets
- A servlet is a program that extends the
functionality of a Web server. Servlets receive a
request from a client, dynamically generate the
response (possibly querying databases to fulfill
the request), and then send the response
containing an HTML or XML document to the client - JSP
- The JavaServer Pages (JSP) technology provides an
extensible way to generate dynamic content for a
Web client. A JSP page is a text-based document
that describes how to process a request to create
a response
20Java Servlet
Servlet Class wasnt loaded into System
Class Loader
Load Servlet class Into System
HTTP Request
Browser
Servlet Class was loaded
Web Services
Invoker
HTTP Response
Services
21Java Servlet
- Java Servlet is the bridge for user to use Java
solution in Web Server. - Java Servlet has better performance than
CGI(Common Gateway Interface). - Java Servlet can use session to replace cookie
and enhance security. - J2EE Server maintains the session for Java
Servlets.
22JavaServer Pages (JSP)
Compiler
Java Source Code
Java Bytecode
Load Servlet class Into System
New JSP Page JSP was modified
Class Loader
JSP isnt loaded yet.
HTTP Request (.jsp)
Browser
Web Services
Invoker
HTTP Response
jspServices
23JavaServer Pages (JSP)
- JSP has all features of Servlet.
- JSP is a HTML like document.
- JSP is designed for Web Page Developer.
- JSP will change to Java Servlet source.
- JSP is ran via Servlet mode.
24JavaServer PagesObjects
- JSP has 9 objects which developer can use
directly without new it.
JSP Object java class scope request javax.serv
let.ServletRequest request response javax.servlet
.ServletResponse pag pageContext javax.servlet.js
p. PageContext page session javax.servlet.http.H
ttpSession session application javax.servlet.Serv
letContext application out javax.servlet.jsp.Jsp
Writer page config javax.servlet.ServletConfig
page page java.lang.Object page exception java.
lang.Throwable page
25Portlet and Portal
- JSR168
- Java portlet standard
- WSRP
- Remote portlet communication protocol
- Portals aggregate remote portlets
Portal Server
Browser
HTTP
WSRP
(Web Services for Remote Portlets)
26The Reason For JDBC
- Despite almost all databases supporting SQL,
database vendors (Microsoft Access, Oracle etc.)
provide proprietary (no standard) Application
Programming Interfaces for sending SQL to the
server and receiving results from it! - Languages such as C/C can make use of these
proprietary APIs directly - High performance
- Can make use of non standard features of the
database - All the database code needs to be rewritten if
you change database vendor or product - JDBC (Java DataBase Connectivity) is a vendor
independent API for accessing relational data
from different database vendors in a consistent
way
CCTM Course material developed by James King
(james.king_at_londonmet.ac.uk)
27JDBC
- JDBC provides an API that hides the vendor
specific APIs by inserting a driver between the
Java application and the database API - JDBC requires a vendor-specific driver
- The driver converts calls from JDBC API to
vendors API gt performance penalty - The driver does not provide access to vendor
specific functionality - The same Java application can be used with a
different vendors database by simply switching
JDBC driver and changing one line of Java code. - JDBC 1.0 is included inside JDK 1.1 or higher in
a package java.sql - JDBC 2.0 and 3.0 require updated drivers and an
additional package javax.sql
CCTM Course material developed by James King
(james.king_at_londonmet.ac.uk)
28Rollback and Commit
- By default connections to the database commit
each update as soon as it is completed. - If you want to make a set of changes and only
commit the aggregate result if nothing goes wrong
auto commit needs to be switched off - connection.setAutoCommit(false)
- You can then use
- connection.commit() to apply the changes
- connection.rollback() to undo changes since the
last commit - You can switch auto commit back on using
- connection.setAutoCommit(true)
CCTM Course material developed by James King
(james.king_at_londonmet.ac.uk)
29J2EE Compoent (1/2)EJB Component
- Enterprise JavaBean (EJB)
- The Enterprise JavaBeans (EJB) architecture is a
server-side technology for developing and
deploying components containing the business
logic of an enterprise application. - Enterprise JavaBeans components, termed
enterprise beans, are scalable, transactional,
and multi-user secure. - EJB is an architecture for component-based
transactional distributed computing.
30EJB Component (2/2)
- An enterprise bean contains business logic that
operates on the enterprises data. - Client access is mediated by a Container.
- There are three kinds of enterprise beans
session beans, entity beans, and message-driven
beans.
31Enterprise Bean Objects
- Session objects for a single client,
short-lived, Stateful, Stateless - Entity objects object view of data in the
database, shared by multiple clients, long-lived,
- Message-driven objects triggered by a single
client message, short-lived, stateless,
32Stateful vs. Stateless Session Beans
- Stateful
- Possess Internal State
- One per client
- Need to handle activation/ passivation
- Stateless
- Do not possess state
- Can be pooled to handle multiple clients
- Do not need to be passivated
33Entity Beans CMP vs. BMP
- Container Manager Persistence
- Container responsible for database accesses/
controls - Developer focuses on data use
- Bean Managed Persistence
- Developer must write code to handle database
accesses/ controls - Used for more specialized data mapping strategies
34Entity Bean Characteristics
- Provides an object view of data in the underlying
database - Shared across multiple users
- Long-lived
- Survives container crash
35To Implement an Enterprise Bean (1/2)
- Any enterprise bean must define two interfaces
and one or two classes - Remote interface
- defines a beans external interface
- must extend javax.ejb.EJBObject (which in turn
extends java.rmi.Remote) - Home interface
- The home interface defines a beans life cycle
methods, eg. create bean, remove bean, find bean,
etc. - must extend javax.ejb.EJBHome which also extends
java.rmi.Remote
36To Implement an EJB (2/2)
- Bean Class
- The java class that actually implements the
beans external interface, e.g. the bean class
provides implementations for the beans business
methods - An entity bean must implement the
javax.ejb.EntityBean interface, while a session
bean must implement the (you guessed it)
javax.ejb.SessionBean. Both of these interfaces
extend javax.ejb.EnterpriseBean - Primary Key
- The primary key is a very simple class that
provides a pointer into a database Only entity
beans need a primary key. This class must
implment java.io.Serializable (so the entity bean
can automatically be sent to persistent storage)
37EJB Container
- A container is provided by the Application Server
vendor to provide basic services that are
required by J2EE specification. - An EJB programmer places their code here, and is
assured a variety of basic services are available - This means the developer doesnt have to code
these services from scratch - Specification states which services must be
supported but not how
38Basic Services Supplied by the EJB Container
- Security
- Transaction management
- Remote Client Connectivity
- Life Cycle Management
- Database Connection Pooling
39More Services provided by container
- The following basic services will be supported by
all J2EE compliant products - RMI/RMI-IIOP
- Resource Pooling
- Thread Control
- Presentation Logic
- Persistence
- Messaging
- And more
IIOP Internet Inter-ORB Protocol
ORB Object Request Broker
40Cant Do in an EJB
- Cant use threads
- Cant use the AWT
- Cant act as network server
- Cant use java.io package
- Cant load native libray
- Cant use this as an argument or return value
41EJB Benefits Summary
- Developing distributed applications in Java
- Application developer is spared from following
details - Transaction management
- State management
- Multi-threading
- Connection pooling
- Write once, run anywhere
- Interoperability with other languages
- Compatible with CORBA protocols
42J2EE Containers (1/2) Web
Containers
- Web Component Containers
- 1. Servlet Containers
- A servlet container provides network services (by
which requests and responses are sent), decodes
requests, and formats responses. All servlet
containers must support HTTP as a protocol for
requests and responses, but may also support
additional request-response protocols such as
HTTPS. - 2. JSP Containers
- A JSP container provides the same services as a
servlet container and an engine that interprets
and processes a JSP page into a servlet. - 3. Web Containers
- A Web container provides the same services as a
JSP container and access to the J2EE service and
communication APIs.
43J2EE Containers (2/2)
EJB Containers
- EJB Container
- Enterprise beans are hosted by an EJB container.
In addition to standard container services, an
EJB container provides a range of transaction and
persistence services and access to the J2EE
service and communication APIs.
44Tomcat
- Tomcat Java-based web server servlet container
w/ JSP environment - Execution modes
- Standalone default mode for Tomcat
- Out-of-process add-on web server plugin opens
JVM outside web server plugin and JVM
communicate using IPC mechanism (TCP/IP sockets
and special protocol)
45Tomcat and Apache
- Communication mechanism between Tomcat and
Apache web server adapter or named as
connector - Implemented as shared library (e.g.,
mod_jserv.so, mod_jk.so) - Uses/manages TCP connections
- Uses the AJPV12/AJPV13 communication protocol
46J2EE Connectors
- Contract between container and Enterprise
Information Systems (EIS) - Proprietary and under the hood
- Implementation is available with J2EE
specification version 1.3 / 1.4
47J2EE Standard Services
- HTTP/HTTPS
- Java Transaction API (JTA)
- Java Database Connection (JDBC)
- Java Message Service (JMS)
- Java Authentication and Authorization Service
(JAAS) - J2EE Connector Architecture (JCA)
- Others RMI-IIOP, JavaIDL, JavaMail, JavaBeans
Activation Framework (JAF), Java API for XML
Parsing (JAXP)
IIOP Internet Inter-ORB Protocol
48The Solution J2EE Application Model
- J2EE application model partitions the work needed
to implement a multi-tier service into two parts - the business and presentation logic (implemented
by the application developer) - the standard system services provided by the J2EE
platform. - The developer can rely on the platform to provide
the solutions for the hard systems level problems
of developing a middle-tier service.
49J2EE Application Model
Source Sun Microsystems, Inc.,
http//java.sun.com/j2ee/overview2.html
50Benefits of J2EE Application Model
- The J2EE application model provides the benefits
of Write Once, Run Anywhere portability and
scalability for multi-tier applications. - This standard model minimizes the cost of
developer training while providing the enterprise
with a broad choice of J2EE servers and
development tools.
51J2EE Platform Roles
- J2EE Product Provider
- Application Component Provider
- Application Assembler
- Deployer
- System Administrator
- Tool Provider
52The Connector Architecture
- Integration of J2EE servers with Enterprise
Information Systems (EIS) - EIS vendor-provided resource adaptors
- Resource adaptor-permitting application servers
53J2EE Connector
- J2EE Connector
- The J2EE Connector architecture defines a
standard architecture for connecting the J2EE
platform to heterogeneous EISs. Examples of EISs
include ERP, mainframe transaction processing,
database systems, and legacy applications not
written in the Java programming language. By
defining a a set of scalable, secure, and
transactional mechanisms, the J2EE Connector
architecture enables the integration of EISs with
application servers and enterprise applications.
54System Level Pluggability
Source Sun Microsystems, Inc., J2EE Connector
Architecture Specification
55Connector Architecture Overview
Source Sun Microsystems, Inc., J2EE Connector
Architecture Specification
56Connector Architecture Overview (cont.)
Source Sun Microsystems, Inc., J2EE Connector
Architecture Specification
57Connector Architecture in B2B Scenario
Source Sun Microsystems, Inc., J2EE Connector
Architecture Specification
58Client View of an Enterprise Bean
- Home Interface methods for creating, removing,
and finding bean instances - Remote Interface methods callable by the client
- Object Identity
- Metadata Interface mainly for dynamic invocation
- Handle
59Client View of Session Beans
Source Sun Microsystems, Inc., Enterprise
JavaBeans 2.0
60Accessing Enterprise Beans from
Servlets/JavaServer Pages
Source Sun Microsystems, Inc., J2EE
Specification, v1.3
61J2EE Deployment
Source Sun Microsystems, Inc., J2EE
Specification, v1.3
62J2EE Application Life Cycle
Source Sun Microsystems, Inc., J2EE Connector
Architecture Specification
63Overview of Enterprise Applications Integration
(EAI)
Source P.J. Perrone and V.S.R.R. Chaganti,
Building Java Enterprise Systems with J2EE
64Overview of Enterprise Applications Integration
(EAI)
Source P.J. Perrone and V.S.R.R. Chaganti,
Building Java Enterprise Systems with J2EE
65EAI with XML
Source P.J. Perrone and V.S.R.R. Chaganti,
Building Java Enterprise Systems with J2EE
66Enterprise Beans of the Example Design
Source Sun Microsystems, Inc., The J2EE Tutorial
67J2EE Platform Technologies 1/3
- Servlets and JSP
- Java technology servlets and JavaServer Pages are
server components that run in a web server that
supports dynamic HTML generation and session
management for browser clients. - EJB
- Enterprise JavaBeans is a server component model
that provides protability across application
servers and implements automatic services on
behalf of the application components. - JTA
- Java Transaction API provides a transaction
demarcation API. - JTS
- Java transaction Service defines a distributed
transaction management service based on the CORBA
Object Transaction Service.
68J2EE Platform Technologies 2/3
- JNDI
- Java Naming and Directory Interface provides
access to naming and directory services, such as
DNS, LDAP, NDS, and CORBA Naming. - RMI-IIOP
- Remote Method Invocation(RMI) creates remote
interfaces for Java-to-Java communication. This
extension uses the CORBA standard IIOP
communication protocol. - Java IDL
- Java Interface Definition Language creates remote
interfaces to support java-to-CORBA
communications.
69J2EE Platform Technologies 3/3
- JDBC
- JDBC database access API provides uniform access
to relational databases. - JMS
- Java Messaging Service supports asynchronous
communication using either a reliable queuing or
publish/subscribe model. - JavaMail
- JavaMail provides a protocol-independent
framework to build mail and messaging
applications. - JAF
- JavaBeans Activation Framework provides standard
services to determine the type of an arbitrary
piece of data and activate an appropriate
JavaBeans component to manipulate the data.
70History of J2EE Technologies
- Distributed Objects
- CORBA, DCOM, etc.
- Three-tier scenario presentation, business
logic, and backend databases - Hard to get right without the proper
infrastructure - Server-Side Components
- Focuses on encapsulating business rules into
objects in the middle tier - Component Transaction Monitors
- Descendant of CORBAs Object Request Broker
- provides discovery, persistence, event
notification, transactions, etc. for three-tier
or n-tier applications
71Server Technology Timeline
MDB
J2EE
J2EE
1996
1997
1998
1999
2000
2001
Microsoft
QC
MMC
LCE
VS .NET
.NET
WinDNA
72J2EE Platform Services
- Naming Services
- Provide application clients, EJB and Web
components with access to a JNDI naming
environment. - Deployment Services
- Allow components and applications to be
customized at the time they are packaged and
deployed. - Transaction Services
- Devide an application into a series of
indivisible or atomic units of work. - Security Services
- Designed to ensure that resources are accessed
only by users authorized to use them.
73J2EE Platform Benefits
- Simplified architecture and development
- Scalability to meet demand variations
- Integration with existing information systems
- Choices of servers, tools, components
- Flexible security model
- The J2EE reduces the cost and complexity of
developing these multi-tier services, resulting
in services that can be rapidly deployed and
easily enhanced as the enterprise responds to
competitive pressures.
74J2EE Platform
- The J2EE platform is the standard environment for
running J2EE applications. The J2EE platform is
composed of the following elements - J2EE deployment specification - a standard that
defines a common way of packaging applications
for deployment on any J2EE compatible platform. - Java technology standards for the J2EE platform -
a set of standards that all J2EE platform
products must support (JMS , JNDI etc) - IETF standards for the J2EE platform - a set of
standards defined by the Internet Engineering
Task Force that all J2EE platform products must
support.(eg XML, HTTP, HTML) - CORBA standards for the J2EE platform - a set of
CORBA standards upon which the J2EE platform
bases its middle-tier interoperability.
75J2EE Application Assembly
- A J2EE application is packaged into one or more
standard units for deployment to any J2EE
platform-compliant system. - Each unit contains a functional component or
components (enterprise bean, JSP page, servlet,
applet, etc.), a standard deployment descriptor
that describes its content, and the J2EE
declarations which have been specified by the
application developer and assembler. - Once deployed, theses components can then be run.
76J2EE Reference Implementation
- Its primary role is as an operational definition
of the J2EE platform. - Most importantly, it is used as the standard
platform for running the J2EE Compatibility Test
Suite. - A secondary role for the reference implementation
is as a freely available platform for
popularizing Java 2 platform, Enterprise Edition.
77J2EE Reference Implementation
- Latest version available for download
- JavaTM 2 SDK, Enterprise Edition Version 1.3
- Downloadable at
- http//java.sun.com/j2ee/
- NOTE
- This version will require Java 2 SDK, Standard
Edition (J2SE) Version 1.3.1 or higher. -
78Application Servers
- Consists of
- EJB server
- Web server (HTTP)
- Secured web server (HTTPS)
- J2EE Compliance Test
- Brings vendor neutrality to your applications
- Consists of more than 5000 tests
- Currently 9 application servers have been
certified - BEA WebLogic (BEA)
- iPlanet (Sun Netscape)
- Websphere (IBM)
- (check out www.javasoft.com/j2ee for latest
update)
79The BEA WebLogic Server
- All Java, clean-room implementation of the J2EE
- Shipping basic APIs since 1997
- One of the most widely-used Application Servers
on the market - Over 12,000 customers
- Associated BEA product TUXEDO
- Distributed TP Monitor
- Originally developed at Bell Labs in 1984
- Influenced the design of WebLogic
80Sun ONE Application Server 7
- Provides a comprehensive overview of the Sun ONE
Application Server. Please note - the tour may
take up to 1 minute to complete testing your
system before starting to load. - Sun is the first software vendor to deliver a
fully J2EEtm platform-certified, commercial
application server, free of charge, on all
leading OS platforms. - The new Sun ONE Application Server 7 includes the
world's fastest, secure http server, and new
"Always On" technology.
81J2SE Component Links
- Assistive Technologies
- Drag and Drop
- Java Access Bridge
- JavaBeansTM Technology
- Javadoc Tool
- Java Foundation Classes (JFC)/Swing
- Java HotSpotTM Virtual Machine
- Java Platform Debugger Architecture (JPDA)
- Java Plug-in for Windows XP
- Java 2DTM API product page
- Java Web Start
- JDBCTM Technology
- Pluggable Look and Feel
- Remote Method Invocation (RMI)
- Security
82List of J2ME Technologies
- Personal Profile
- Personal Basis Profile
- Java CardTM Technology
- Java Embedded ServerTM Technology
- JavaPhoneTM API
- Java Telematics Technology (JTT)
- Java TVTM API
- J2ME Wireless Toolkit
- PersonalJavaTM Technology
- Wireless Developer web site
- Connected Limited Device Configuration (CLDC)
- Mobile Information Device Profile (MIDP)
- Connected Device Configuration (CDC)
- Foundation Profile
83JBoss Application Server
- JBoss is a simply powerful J2EE application
server. - JBoss Application Server is the 1 most widely
used Java application server on the market. A
J2EE certified platform for developing and
deploying enterprise Java applications, Web
applications, and Portals, JBoss Application
Server provides the full range of J2EE 1.4
features as well as extended enterprise services
including clustering, caching, and persistence. - EJB3.0
- JBoss Application Server includes support for
Enterprise Java Beans (EJB) 3.0 which is designed
to dramatically simplify the enterprise Java
programming model. - Service Oriented Architecture
- JBoss AS is founded on a service oriented
microkernel architecture with an extremely small
in footprint that ensures all services are
accessed, managed, and integrated in a unified
and consistent manner.
84Introduction to Apache Ant
- What is Ant?
- Java-based build tool
- Why use Ant?
- Cross-platform
- Java domain smart
- Fast, extensible, integrated
- Alternatives?
- Analogy
- Factory automation
85Typical Things to Build
JARs
classes
Javadoc
EAR
Documentation HTML/PDF
WAR
86Designing a Build
- What are you building?
- What does it take to build it?
- How are the steps related?
87High-level Model
HTML / Text files
Source Code
"The Build"
Index
Application (EAR)
88Examples of Commercially Used AOP Tools
- AspectWerkz
- Supported by BEA
- Spring AOP framework
- JBoss AOP
- CME (Concern Manipulation Environment)
- Supported by IBM
89Technical Architecture
content
Web Tier
Ant build ltindexgt task
EJB Container
index
90AOP Aspect Oriented Programming
- Which tools are suitable for commercial dev?
- Over a dozen tools are listed on aosd.net
- Early adopters harden new technologies
- How active are the user communities of each?
project posts list (november04 posts) url
AspectJ 150..210each aspectj-users at eclipse.org eclipse.org/aspectj
AspectWerkz 150..210each user at aspectwerkz.codehaus.org aspectwerkz.codehaus.org
JBoss AOP 150..210each aspects/jboss forum jboss.org/products/aop
Spring AOP 150..210each springframework-user www.springframework.org
abc 1..30 abc-users at comlab.ox.ac.uk abc.comlab.ox.ac.uk
aspect 1..30 aspectsharp-users aspectsharp.sourceforge.net
AspectC 1..30 aspectc-user at aspect.org aspectc.org
JAC 1..30 jac-users at objectweb.org jac.objectweb.org
91IDE support, libs, and docs
ide editor views debugger other libs docs
AspectJ eclipse, jdeveloper, jbuilder, netbeans highlighting, content assist, advice links outline, visualizer, cross references plain Java ajdoc, ajbrowser -
AspectWerkz eclipse advice links - plain Java - -
JBoss AOP eclipse advice links, UI for pointcut creation aspect manager,advised members plain Java dynamic deployment UI, jboss framework integration
Spring AOP eclipse - - plain Java spring framework integration
92Building AOP programs
- Whats it like to adopt AOP on an existing
project?
source compiler checking weaving deployment run
AspectJ extended .java, or .aj incremental aspectj compile full static checking compile and load-time, produce bytecode static deployment plain Java program
AspectWerkz plain .java, .xml java compile, post processing minor static checking, none of pointcuts compile and load-time, produce bytecode hot deployable plain Java program
JBoss AOP plain .java, .xml java compile, post processing minor static checking, none of pointcuts runtime interception and proxies hot deployable framework invoked managed
Spring AOP plain .java, .xml java compile - runtime interception and proxies hot deployable framework invoked managed
93AOP features
- AspectJ and AspectWerkz
- AspectJ 5 will feature support for generics in
pointcuts. The _at_AspectJ syntax will support the
AspectWerkz annotation style - JBoss AOP
- Static typing for parameters, performance
improvements, libraries, and more IDE support
features - Spring AOP
- Performance improvements, interoperability with
AspectJ's pointcuts, and packaging of some Spring
AOP services as AspectJ aspects
94JBoss AOP (1/2)
- Lack of static checking for pointcuts
- Advanced IDE features not yet supported
- Rich set of enterprise aspects libraries are
available and integrated with JBoss and JEMS - IDE support lowers adoption and reduces need to
hand-code XML - Support for dynamic deployment of aspects
http//jboss.org/products/aop
95JBoss AOP (2/2)
96Web services in JBoss Overview JBoss.net
- Specifies how JBoss server components are exposed
as Web service - Stateless Session Beans
- Web components
- POJO as servlet
97JBoss Hibernate
- Hibernate IS EJB 3.0 CMP
- CMP is an API and XML mappings
- Hibernate is the actual persistence engine
- Hibernate caches are being integrated with
JBossCache - Full distributed data with OR backend on one
node
98Hibernate
- Part of JBoss full-time
- Gavin King and Christian Bauer on board
- Persistence for POJOs (JavaBeans)
- Flexible and intuitive mapping
- Support for fine-grained object models
- Powerful, high performance queries
- Dual-Layer Caching Architecture (HDLCA)
- Support for detached objects (no DTOs)
- Transparent Persistence
- Automatic dirty checking
- Transitive Persistence
- Smart fetching and caching
- Smooth migration to EJB3.0
- Consulting and support available as part of JBoss
inc
99Tomcat 5.0.x improvements
- Tomcats Remy Maucherat is on JBoss inc staff
- Performance optimizations and reduced garbage
collection - Optional standalone deployer (validation and
precompilation of webapps) - Scalability and reliability enhancements
- Complete server monitoring using JMX
- Improved Taglibs handling, including advanced
pooling and tag plugins - Embedding of Tomcat using JMX
- Enhanced Security Manager support (now allows
very restrictive policies) - Expanded documentation
- Consulting and support available as part of JBoss
inc
100Tomcat standalone or Tomcat inside JBoss ?
- Better JBoss deployer
- Hot deployment
- Deployment of nested archives (EARs, SARs)
- Redeployment
- Automatic undeployment
- Advanced clustering
- Integrated J2EE stack within one VM
- Deployment descriptor
- Optimized local calls
- Integrated security
- AOP in JBoss 4.0 available in Tomcat components
and webapps - Easy to use classloader
- Nukes
101JBoss IDE
- JBoss IDE is based on Eclipse.
- Series of plugins for Eclipse
-
- The debugging and monitoring of JBoss servers and
the control of their life cycle (start/stop). - A very comfortable and sophisticated support for
XDoclet - Support completion and generation
- Support for AOP (completion and generation).
- An easy way to configure and deploy the packaging
layout of archives (packed or exploded)
102What Is JBossCache?
- What is JBossCache?
- A transactional replicated cache for JBoss with
and without AOP (aspect-oriented programming) - A cache for frequently accessed elements
- Stateful Session Beans, HTTPSession
- Caches are used in a number of places in JBoss
- This one provides a central cache service (MBean
interface) - All access goes through the cache
- Write-through (lazy or eager)
- Reads only access the cache (very fast on cache
hits) - Items not in the cache are loaded (e.g. from
database) - Bounded size old items are removed by eviction
policy - Local (non-replicated) and replicated caches
- Replicated caches are the interesting part
103Feature
- Transactions
- All modifications done within TX, replication at
TX commit. No replication on rollback - Locking
- Access to nodes serialized by locks
- Lock acquisition timeouts used for deadlock
prevention - Replication
- local in-VM, no replication
- repl-async replication done on separate thread
- repl-sync replication done on user's thread,
wait for all acks - All combinations supported
- From local/no-tx/no-locking to repl/tx/locking
- Ex repl-async/no-locking/TX
104Nukes on JBoss
- Nukes on JBoss is a port of PHP postnukes
- Scalability problems with Zend engine
- Full port to EJB/J2EE.
- Leverage the vast library of nukes modules
- Most of PN modules are ported
- Core offers the core functionalities to other
modules - Security, lifecycle management, parameterization
- User enables user management
- Html stores files, filesystem is abstracted,
stored in DB - Sections edit/publish articles
- FORUMS!!!!
105CMS ease of update for non-techies
106Nukes components
107How to Deploy on JBoss (1/3)
- Write your beans and package them in an ejb-jar
file. - Write your servlets/JSPs and package them in a
war file. - Add a Class-Path attribute to your war files
MANIFEST.MF file to reference your beans package.
for detailed information on that see J2EE
Deployment specification.
http//www.jboss.org
http//www.jboss.com
108How to Deploy in JBoss (2/3)
- 4. Package your application in an ear file.
- An ear file is a jar archive which contains
- Your jar files
- Your war files
- A deployment descriptor for your application.
- This file must be named "application.xml", and
must be - located in the META-INF directory in the ear
archive. This - file tells JBoss which modules are EJBs, which
ones are - web modules, and the context paths for the
web-modules.
109Sample Application.xml file
- lt?xml version"1.0" encoding"ISO-8859-1"?gt
- ltapplicationgt ltdisplay-namegtMy applicationlt/displa
y-namegt - ltmodulegt
- ltwebgt
- ltweb-urigtwebmodule.warlt/web-urigt ltcontext
- rootgt/servletslt/context-rootgt
- lt/webgt
- lt/modulegt
- ltmodulegt
- ltejbgtbeans.jarlt/ejbgt
- lt/modulegt
- lt/applicationgt
110How to Deploy in JBoss (3/3)
- 5. Deploy your ear file.
- Option 1 Copy your ear file to JBOSS_HOME/deploy
(wow!) - Write once Deploy AnyWhere!!
111Thank you!
- ????
- http//www.csie.nctu.edu.tw/tsaiwn/java/
- ???
112(No Transcript)