32
An architecture for webb applications, J2EE A quick look at Java 2 Enterprise Edition

An architecture for webb applications, J2EE A quick look at Java 2 Enterprise Edition

  • View
    215

  • Download
    2

Embed Size (px)

Citation preview

Page 1: An architecture for webb applications, J2EE A quick look at Java 2 Enterprise Edition

An architecture for webb applications, J2EE

A quick look at Java 2 Enterprise Edition

Page 2: 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

Page 3: An architecture for webb applications, J2EE A quick look at Java 2 Enterprise Edition

J2EE Overview

Built on top of Java 2 Standard Edition, J2SE Access to all of J2SE-APIs 100% Java

Page 4: An architecture for webb applications, J2EE A quick look at Java 2 Enterprise Edition

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

Page 5: An architecture for webb applications, J2EE A quick look at Java 2 Enterprise Edition

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

Page 6: An architecture for webb applications, J2EE A quick look at Java 2 Enterprise Edition

J2EE Overview – Content of J2EE RMI/IIOP Java Naming and Directory Interface, JNDI Webservices, in version 1.4

Page 7: An architecture for webb applications, J2EE A quick look at Java 2 Enterprise Edition

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

Page 8: An architecture for webb applications, J2EE A quick look at Java 2 Enterprise Edition

Containers and Components

Page 9: An architecture for webb applications, J2EE A quick look at Java 2 Enterprise Edition

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

Page 10: An architecture for webb applications, J2EE A quick look at Java 2 Enterprise Edition

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

Page 11: An architecture for webb applications, J2EE A quick look at Java 2 Enterprise Edition

Containers and Components

Several clients – one system

Page 12: An architecture for webb applications, J2EE A quick look at Java 2 Enterprise Edition

Enterprise Java Beans

The core of J2EE Server side components Three base types of EJB

Session Beans Entity Beans Message Driven Beans

Transactional components Bean managed or Container managed

Deploy time configuration of security and transactions

Page 13: An architecture for webb applications, J2EE A quick look at Java 2 Enterprise Edition

Enterprise Java Beans - Architecture

Page 14: An architecture for webb applications, J2EE A quick look at Java 2 Enterprise Edition

Enterprise Java Beans – Session Beans Stateless and statefull beans Handles busines logic Acts as frontend for Entity beans

Page 15: An architecture for webb applications, J2EE A quick look at Java 2 Enterprise Edition

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

Page 16: An architecture for webb applications, J2EE A quick look at Java 2 Enterprise Edition

Enterprise Java Beans – Message Driven Beans Activated by a JMS queue Asynchronous execution No need for the client to wait for an answer

Page 17: An architecture for webb applications, J2EE A quick look at Java 2 Enterprise Edition

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

Page 18: An architecture for webb applications, J2EE A quick look at Java 2 Enterprise Edition

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

Page 19: An architecture for webb applications, J2EE A quick look at Java 2 Enterprise Edition

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

Page 20: An architecture for webb applications, J2EE A quick look at Java 2 Enterprise Edition

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

Page 21: An architecture for webb applications, J2EE A quick look at Java 2 Enterprise Edition

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

Page 22: An architecture for webb applications, J2EE A quick look at Java 2 Enterprise Edition

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

Page 23: An architecture for webb applications, J2EE A quick look at Java 2 Enterprise Edition

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

Page 24: An architecture for webb applications, J2EE A quick look at Java 2 Enterprise Edition

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

Page 25: An architecture for webb applications, J2EE A quick look at Java 2 Enterprise Edition

HTTP

A very simple and readable protocol Text based

Several methods GET

The basic request to get a page POST

Used from forms in the web pages DELETE HEAD

Page 26: An architecture for webb applications, J2EE A quick look at Java 2 Enterprise Edition

HTTP

A typical browser request for www.dn.se/index.html Connect to www.dn.se GET /index.html HTTP/1.0 Disconnect

Page 27: An architecture for webb applications, J2EE A quick look at Java 2 Enterprise Edition

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

Page 28: An architecture for webb applications, J2EE A quick look at Java 2 Enterprise Edition

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

Page 29: An architecture for webb applications, J2EE A quick look at Java 2 Enterprise Edition

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

Page 30: An architecture for webb applications, J2EE A quick look at Java 2 Enterprise Edition

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

Page 31: An architecture for webb applications, J2EE A quick look at Java 2 Enterprise Edition

Other technologies for the web Microsoft Active Server Pages

Embed VB code in your HTML Similar to JSPs

PHP Quite like ASP, but open source and available on

all platform. Used at many sites today Coldfusion Webobjects (Mac) Zope

Page 32: An architecture for webb applications, J2EE A quick look at Java 2 Enterprise Edition

Next time

The next session will be all about Servlet programming