Download Java 2 Enterprise Edition

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts
no text concepts found
Transcript
An architecture for webb
applications, J2EE
A quick look at Java 2 Enterprise Edition
J2EE Overview

A framework for Enterprise Applications








Scalable
Distributed
Transactional
Losely coupled
Multi-tired
Portable
Secure
Access to different systems
J2EE Overview

Built on top of Java 2 Standard Edition, J2SE


Access to all of J2SE-APIs
100% Java
J2EE Overview

J2EE is a specifaction, not a produkt


No vendor lock in
Several implementations






BEA (Weblogic)
IBM (Websphere)
Oracle (Oracle9iAS and OC4J)
JBoss
Ironflare (Orion)
Jakarta Tomcat
J2EE Overview – Content of J2EE








Enterprise Java Beans, EJB
Java Servlets
Java Server Pages, JSP
Java Messaging Service, JMS
Java Database Connectivity, JDBC
JavaMail
Java Transaction API, JTA
Connector Architecture
J2EE Overview – Content of J2EE



RMI/IIOP
Java Naming and Directory Interface, JNDI
Webservices, in version 1.4
J2EE Overview – Benefits of J2EE







Separates business logic from system code
Separates busines logic from presentation
Deploy-time configuration
Scalable from start
Distributed from start
Component model on the server = easier
team work
Declarative security and transactions
Containers and Components
Containers and Components



A J2EE Application server provides
containers for all components of J2EE
There is one container per J2EE component
The Application server runs the entire J2EE
solution
Containers and Components

The Application server handles all system level
programming

Security








Authorization – Is the user allowed to do this operation?
Authentication – Is the user who he says? Validate credentials
Transactions
Threading
Object life time management
Caching
Object persistence
Database Connection pooling
Containers and Components

Several clients – one system
Enterprise Java Beans



The core of J2EE
Server side components
Three base types of EJB




Transactional components


Session Beans
Entity Beans
Message Driven Beans
Bean managed or Container managed
Deploy time configuration of security and
transactions
Enterprise Java Beans - Architecture
Enterprise Java Beans – Session Beans



Stateless and statefull beans
Handles busines logic
Acts as frontend for Entity beans
Enterprise Java Beans – Entity Beans



Handels data
Mapped on Database tables
Container managed (CMP) and Bean
Managed Persistence (BMP)



CMP releaves the developer from writing SQL
code
Minimizes the risk for database lock-in.
EJB-QL – a query language for EJBs
Enterprise Java Beans – Message Driven
Beans



Activated by a JMS queue
Asynchronous execution
No need for the client to wait for an answer
Java Messaging Service, JMS





A messaging API for Java
A Sender sends a message to a JMS Queue
A Listener listens for messages on a Queue
Guarantied delivery
Asynchronous processing



After the Sender has sent its message there is no need to
wait for the Listener to get it
Great for scalability
Good for operations that doesn’t have to occur at once, for
example logging
JavaMail

A high level API for sending and receiving
mail


No need to know everything about the underlying
protocolls
Support for IMAP, POP and SMTP
Java Transaction API, JTA


The easy way to handle complex transactions
You can have transactions between different
components



A mailserver, a database and a JMS system can
participate in the same transaction, given that they
support it
Based on XA
The mechanism behind the transactions of
EJBs
Java Connector Architecture, JCA




Hook into existing legacy systems
You can write a connector for basically
anything
Anything with a Connector can be plugged
into the J2EE Server
Simplifies system integration
RMI/IIOP


Integration with other systems through Corba
Call your J2EE Components from Visual
Basic, Delphi, C++ and C

Java might not be the best or only choice for your
clients
Java Naming and Directory Interface,
JNDI





Very fundamental functionality in J2EE
The way that distributed objects are located
Any kind of objects can be stored in JNDI
All objects are stored in a hierarchical way
The way the Home interface for EJBs are
located
Java Naming and Directory Interface,
JNDI


Used to store connection pools for JDBC
Context.lookup(“java:comp/env/jdbc/Pool1”)



Private context from within components
Defined with a <resource-ref> in deployment
descriptors
Context.lookup(“Pool1”)

Global context from the outside
Web Development

The web is static by nature



Based on HTTP
A stateless network environment
The stateless nature is what have made the
Internet into what it is today
HTTP

A very simple and readable protocol


Text based
Several methods

GET


POST



The basic request to get a page
Used from forms in the web pages
DELETE
HEAD
HTTP

A typical browser request for
www.dn.se/index.html



Connect to www.dn.se
GET /index.html HTTP/1.0
Disconnect
CGI

Common Gateway Interface



An early interface for making the web more
dynamic
Executes programs on the server
Cumbersome programming and bad resource
management

Basically each request starts a new process on the
server
Java Servlets







Extensions of the web server
One of the front ends to the J2EE system
Generates HTML with print statements
Good for implementing control logic
Support for sessions
Multithreaded by nature
Not so good for generation nice layout
Java Server Pages (JSP)





HTML with embedded Java code
Good for presentation
Compiled to a Servlet at runtime
Easy for web designers to use
Support for Java Beans and Custom tags
Servlets and JSP






Servlets and JSPs are often used together
The Servlet handles the request
The Servlets calls Java Beans or EJBs to
handle the business logic
The Servlest forwards to a JSP
The JSP handles the Presentation
Model View Controller, MVS
Other technologies for the web

Microsoft Active Server Pages



PHP




Embed VB code in your HTML
Similar to JSPs
Quite like ASP, but open source and available on
all platform. Used at many sites today
Coldfusion
Webobjects (Mac)
Zope
Next time

The next session will be all about Servlet
programming