Open Source Java/XML Application Server Building Java/XML Web Applications with Enhydra David H....

34
Open Source Java/XML Application Server Open Source Java/XML Application Server Building Java/XML Web Applications with Enhydra David H. Young [email protected] Lutris Technologies & Enhydra.org 30 March 2000 Session: Open Source Java Servers @

Transcript of Open Source Java/XML Application Server Building Java/XML Web Applications with Enhydra David H....

Page 1: Open Source Java/XML Application Server Building Java/XML Web Applications with Enhydra David H. Young david.young@lutris.com Lutris Technologies & Enhydra.org.

Open Source Java/XML Application ServerOpen Source Java/XML Application Server

Building Java/XML

Web Applications with Enhydra

David H. [email protected]

Lutris Technologies& Enhydra.org

30 March 2000Session:

Open Source Java Servers

Building Java/XML

Web Applications with Enhydra

David H. [email protected]

Lutris Technologies& Enhydra.org

30 March 2000Session:

Open Source Java Servers

@

Page 2: Open Source Java/XML Application Server Building Java/XML Web Applications with Enhydra David H. Young david.young@lutris.com Lutris Technologies & Enhydra.org.

My Assumptions

• You know Java

• You know the value of an application server strategy for building Web applications

• You know the value of Open Source strategies

• You want to see something that solves a problem with building Web applications

– e.g., JSP not the best for a real product life cycle

Page 3: Open Source Java/XML Application Server Building Java/XML Web Applications with Enhydra David H. Young david.young@lutris.com Lutris Technologies & Enhydra.org.

Enhydra: #1 Open Source Java Application Server

• Lutris is sponsor of Enhydra.org, an Open Source Java/XML Application Server

• www.enhydra.org

• Enhydra is a true Open Source Java/XML Application Server

• Over 1000 known developers worldwide

• J2EE Enhydra available today.

Page 4: Open Source Java/XML Application Server Building Java/XML Web Applications with Enhydra David H. Young david.young@lutris.com Lutris Technologies & Enhydra.org.

Open Source Enhydra Technology• Enhydra Multiserver

– Servlet runner

– Web Server & Web Server Connection Manager

– Management console

• Enhydra Debugger

– Graphical Servlet Monitor

• Enhydra XMLC– XML/DOM Presentations

• Enhydra Director

– Failover/Cluster Support

• Enhydra Application Framework

– “Superservlet Strategy”

• Enhydra Application Wizard (“Newapp”)

– Instant application to jumpstart development

• Enhydra DODS

– Graphical Object-to-SQL mapping application

Page 5: Open Source Java/XML Application Server Building Java/XML Web Applications with Enhydra David H. Young david.young@lutris.com Lutris Technologies & Enhydra.org.

Enhydra Architecture

Page 6: Open Source Java/XML Application Server Building Java/XML Web Applications with Enhydra David H. Young david.young@lutris.com Lutris Technologies & Enhydra.org.

www.enhydra.orgfor the Enhydra Community

• Mail lists & Working Groups– [email protected]

• Mail Archive/Search

• Case studies, News

• On-line Demos– Shopping Cart,

Chat Room, Poker

• 3rd party Services and Products

Working Groups:EJB ContainerWeb Container

I18NWireless

ArchitectureJMX

Rocks/XMLCDODS

Working Groups:EJB ContainerWeb Container

I18NWireless

ArchitectureJMX

Rocks/XMLCDODS

Page 7: Open Source Java/XML Application Server Building Java/XML Web Applications with Enhydra David H. Young david.young@lutris.com Lutris Technologies & Enhydra.org.

www.earthlink.com (The Mall)

www.wnet.org/newyork/game/index2.html

Deployed Enhydra

Page 8: Open Source Java/XML Application Server Building Java/XML Web Applications with Enhydra David H. Young david.young@lutris.com Lutris Technologies & Enhydra.org.

Wizshop/Earthlink/Mindspring

Cisco LocalDirector

Cisco LocalDirector

•Sun E250/2CPU•500M Memory•400Mhz•Enhydra•Apache/Jserv

•Sun E250/2CPU•500M Memory•400Mhz•Enhydra•Apache/Jserv

The

Int

erne

t

•Sun E450•Oracle DB

•Sun E450•Oracle DB•Sun

E250/2CPU•500M Memory•400Mhz•Enhydra•Apache/Jserv

•Sun E250/2CPU•500M Memory•400Mhz•Enhydra•Apache/Jserv

Page 9: Open Source Java/XML Application Server Building Java/XML Web Applications with Enhydra David H. Young david.young@lutris.com Lutris Technologies & Enhydra.org.

A Best PracticeLeveraging Enhydra XMLC

Java Server Pages

Enhydra XMLC

Page 10: Open Source Java/XML Application Server Building Java/XML Web Applications with Enhydra David H. Young david.young@lutris.com Lutris Technologies & Enhydra.org.

Embedded Page Languages: Bad Idea!• HTML is developed by graphic artists

– Authoring programs can break the code

– Pages with mocked data is not final mockup

– Most graphic artists cannot program

• Code is developed by programmers

– They use source code editors

– Code added to HTML is difficult to maintain

– Most programmers cannot draw

Page 11: Open Source Java/XML Application Server Building Java/XML Web Applications with Enhydra David H. Young david.young@lutris.com Lutris Technologies & Enhydra.org.

Embedded Page Languages: Bad Idea!• Embedded page languages are not legal

HTML

– Can’t parse the pages with standard parsers

– Standards are a good thing.

• Flow-of-control is obscured

• Little compile-time type checking available

• Does not integrate well with debuggers, profilers

• Poor support for I18N

Page 12: Open Source Java/XML Application Server Building Java/XML Web Applications with Enhydra David H. Young david.young@lutris.com Lutris Technologies & Enhydra.org.

JSP Example

<HTML><%@ page language==“java”

imports==“com.wombat.JSP.*” %><H1>Welcome</H1><P>Today is </P><jsp:useBean id==“clock”

class==“calendar.jspCalendar” /><UL><LI>Day: <%==clock.getDayOfMonth() %><LI>Year: <%==clock.getYear() %></UL><% if (Calendar.getInstance().get(Calendar.AM_PM)

== Calendar.AM) { %>Good Morning<% } else { %>Good Afternoon<% } %><%@ include file==“copyright.html” %></HTML>

Page 13: Open Source Java/XML Application Server Building Java/XML Web Applications with Enhydra David H. Young david.young@lutris.com Lutris Technologies & Enhydra.org.

An HTML Example

<TABLE> <TBODY> <TR> <TH>Name</TH> <TH>City</TH> </TR> <TR> <TD>John Doe</TD> <TD>Atlanta</TD> </TR> </TBODY> </TABLE>

Page 14: Open Source Java/XML Application Server Building Java/XML Web Applications with Enhydra David H. Young david.young@lutris.com Lutris Technologies & Enhydra.org.

DOM Representation

ID=custName ID=city

Page 15: Open Source Java/XML Application Server Building Java/XML Web Applications with Enhydra David H. Young david.young@lutris.com Lutris Technologies & Enhydra.org.

Adding ID Attributes

<TABLE> <TBODY> <TR> <TH>Name</TH> <TH>City</TH> </TR> <TR> <TD ID=“custName”>John Doe</TD> <TD ID=“city”>Atlanta</TD> </TR> </TBODY> </TABLE>

Page 16: Open Source Java/XML Application Server Building Java/XML Web Applications with Enhydra David H. Young david.young@lutris.com Lutris Technologies & Enhydra.org.

What is the DOM?

• Document Object Model

• A W3C specification (www.w3c.org/DOM)

• A standard API to represent a structured document as a tree with branches, nodes, and leaves

• Each markup element in the document is a node with nested markup elements as child nodes

• Allows documents to be traversed as a tree where nodes are visited, added, removed, replaced, or cloned

Page 17: Open Source Java/XML Application Server Building Java/XML Web Applications with Enhydra David H. Young david.young@lutris.com Lutris Technologies & Enhydra.org.

Java DOM Package

• Node: Base class of all DOM tree objects

– Contains children and parent links

– Provides methods for manipulating the tree

• Document: Root of tree

– Provides factory methods for other DOM classes

• Element: Interface for XML tag classes

– Implements Node

– Specific XML applications may define classes that extend element

• Text: Nodes that contain the document text

Page 18: Open Source Java/XML Application Server Building Java/XML Web Applications with Enhydra David H. Young david.young@lutris.com Lutris Technologies & Enhydra.org.

Java DOM HTML Package

• org.w3c.dom.html

– DOM Interfaces for HTML

• HTMLDocument - Root of the HTML hierarchy• HTMLHeadElement - <HEAD>• HTMLBodyElement - <BODY>• HTMLParagraphElement - <P>• HTMLAnchorElement - <A>• HTMLTableElement - <TABLE>• HTMLFontElement - <FONT>• …more…

Page 19: Open Source Java/XML Application Server Building Java/XML Web Applications with Enhydra David H. Young david.young@lutris.com Lutris Technologies & Enhydra.org.

Enhydra XMLC

Page 20: Open Source Java/XML Application Server Building Java/XML Web Applications with Enhydra David H. Young david.young@lutris.com Lutris Technologies & Enhydra.org.

Enhydra XMLC Overview• Compiles HTML and XML documents into Java

classes

• An instance of of the XMLC-generated class is a DOM that contains the original document

• Access methods are generated for elements with ID attributes

– Return type of method is DOM class for that element

– If the element is deleted from the document, the code will quit compiling

– Isolates change in the structure of the document

Page 21: Open Source Java/XML Application Server Building Java/XML Web Applications with Enhydra David H. Young david.young@lutris.com Lutris Technologies & Enhydra.org.

...Enhydra XMLC Overview

• Programmer adds dynamic content to the document by adding and manipulating DOM objects

• Static page URLs can be replaced with dynamic ones

• Prototype table row can be template for other rows.

Page 22: Open Source Java/XML Application Server Building Java/XML Web Applications with Enhydra David H. Young david.young@lutris.com Lutris Technologies & Enhydra.org.

Simple XMLC ExampleHTML

<H1><FONT ID=“HeadFont” SIZE=“4” COLOR=“red”>Hello World</FONT></H1><P>Hello, my name is <SPAN ID=“CustName”>John Doe</SPAN>

Generated Classpublic class HelloHTML extends HTMLObject {

public HTMLFontElement getElementHeadFont();public HTMLElement getElementName();public void setTextCustName(String text);

}

Using the Generated ClassHelloHTML hello = new HelloHTML();HTMLFontElement hfont = hello.getElementHeadFont();hfont.setColor(“Green”);hello.setTextCustName(“Barney Blake”);out.println(hello.toDocument());

Page 23: Open Source Java/XML Application Server Building Java/XML Web Applications with Enhydra David H. Young david.young@lutris.com Lutris Technologies & Enhydra.org.

Development with Enhydra XMLC

welcome.html

xmlc -class myapp.WelcomeHTML welcome.html

javac

myapp.WelcomeHTML

Page 24: Open Source Java/XML Application Server Building Java/XML Web Applications with Enhydra David H. Young david.young@lutris.com Lutris Technologies & Enhydra.org.

Work Flow using Enhydra XMLC

• HTML designer creates a working storyboard/demo page

• The designer tags dynamic elements with HTML 4.0 ID tags, e.g.,

<TD ID=“CustName”>…</TD>

and hands off the page to the programmer

• The programmer compiles the page into a java class which is a DOM tree that can reproduce the document

Page 25: Open Source Java/XML Application Server Building Java/XML Web Applications with Enhydra David H. Young david.young@lutris.com Lutris Technologies & Enhydra.org.

… Work Flow ...

• XMLC generates “getElement<IDName>()” methods in the document object, e.g.

getElementCustName()

for each ID-tagged HTML page element

• At run-time the programmer instantiates the HTML page as an object and manipulates its properties

Page 26: Open Source Java/XML Application Server Building Java/XML Web Applications with Enhydra David H. Young david.young@lutris.com Lutris Technologies & Enhydra.org.

…Work Flow

• The programmer can use the XMLC-generated methods like getElementCustName()to manipulate page elements

• The programmer can also traverse the DOM tree to manipulate its other nodes directly if desired

• Finally toDocument() is called on the page object to stream the page to the web client as a string

Page 27: Open Source Java/XML Application Server Building Java/XML Web Applications with Enhydra David H. Young david.young@lutris.com Lutris Technologies & Enhydra.org.

Advantages of XMLC

• Object-oriented control of documents

• Layout and flow of control are completely separated

• Page designers and programmers only intersect on defining the dynamic page elements

• Programmers are largely unaware of page layout

Page 28: Open Source Java/XML Application Server Building Java/XML Web Applications with Enhydra David H. Young david.young@lutris.com Lutris Technologies & Enhydra.org.

...Advantages

• HTML storyboard can be demo’d and changed in parallel with the server-side code

• Business logic and user interface can be developed and tested completely independently of each other

• Enhydra XMLC can serve the presentation layer in any multi-tier environment, such as BEA WebLogic

Page 29: Open Source Java/XML Application Server Building Java/XML Web Applications with Enhydra David H. Young david.young@lutris.com Lutris Technologies & Enhydra.org.

XMLC for Skins

<TABLE ID=users...<TABLE ID=users...

Pages/de/userList.html

<TABLE ID=users...<TABLE ID=users...

Pages/en/userList.html

<TABLE ID=users...<TABLE ID=users...

Pages/fr/userList.html

getElementUsers()...getElementUsers()...

pages.de.UserListImpl

getElementUsers()...getElementUsers()...

pages.en.UserListImpl

getElementUsers()...getElementUsers()...

pages.fr.UserListImpl

XMLCXMLC

Interface UserListHTMLTableElementgetElementUsers();

Interface UserListHTMLTableElementgetElementUsers();

Page 30: Open Source Java/XML Application Server Building Java/XML Web Applications with Enhydra David H. Young david.young@lutris.com Lutris Technologies & Enhydra.org.

XMLC for XML

• XMLC compiles any XML document

– Generic DOMs

– DTD-specific DOMs

• XML intended for display

• XML as data interchange format

• WML - Wireless Markup Language

– HTML-like DTDs for wireless devices

– Many companies using Enhydra XMLC for developing WML applications

Page 31: Open Source Java/XML Application Server Building Java/XML Web Applications with Enhydra David H. Young david.young@lutris.com Lutris Technologies & Enhydra.org.

Enhydra Roadmap

Page 32: Open Source Java/XML Application Server Building Java/XML Web Applications with Enhydra David H. Young david.young@lutris.com Lutris Technologies & Enhydra.org.

Toward J2EE Enhydra

Other Open Source contributions,including on-going Enhydra evolution

JOnAS,BullSoft

Jonathan,France Telecom

Page 33: Open Source Java/XML Application Server Building Java/XML Web Applications with Enhydra David H. Young david.young@lutris.com Lutris Technologies & Enhydra.org.

The Enhydra Near-Term Future

• Enhydra 3.0 (beta: Today, FCS: TBA)

– Servlet 2.2 (JSP) Support

– Enhydra Director for Cluster/Failover

– Enhydra Rocks

• Enhydra Enterprise (beta: Today, FCS: TBA)

– J2EE Enhydra

– Jonas/EJB Server

– Jonathan/CORBA

– JMS, JMX, etc.

Page 34: Open Source Java/XML Application Server Building Java/XML Web Applications with Enhydra David H. Young david.young@lutris.com Lutris Technologies & Enhydra.org.

Open Source Java/XML Application ServerOpen Source Java/XML Application Server