XML Registries Source: Java TM API for XML Registries Specification.
Open Source Java/XML Application Server Building Java/XML Web Applications with Enhydra David H....
-
Upload
grace-jensen -
Category
Documents
-
view
219 -
download
1
Transcript of Open Source Java/XML Application Server Building Java/XML Web Applications with Enhydra David H....
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
@
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
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.
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
Enhydra Architecture
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
www.earthlink.com (The Mall)
www.wnet.org/newyork/game/index2.html
Deployed Enhydra
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
A Best PracticeLeveraging Enhydra XMLC
Java Server Pages
Enhydra XMLC
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
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
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>
An HTML Example
<TABLE> <TBODY> <TR> <TH>Name</TH> <TH>City</TH> </TR> <TR> <TD>John Doe</TD> <TD>Atlanta</TD> </TR> </TBODY> </TABLE>
DOM Representation
ID=custName ID=city
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>
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
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
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…
Enhydra XMLC
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
...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.
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());
Development with Enhydra XMLC
welcome.html
xmlc -class myapp.WelcomeHTML welcome.html
javac
myapp.WelcomeHTML
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
… 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
…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
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
...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
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();
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
Enhydra Roadmap
Toward J2EE Enhydra
Other Open Source contributions,including on-going Enhydra evolution
JOnAS,BullSoft
Jonathan,France Telecom
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.
Open Source Java/XML Application ServerOpen Source Java/XML Application Server