XX Framework - PowerPoint PPT Presentation

1 / 51
About This Presentation
Title:

XX Framework

Description:

endpoint http:// www.xxframework.org /guestbook/HelloWorld.html /endpoint /class ... Example - Guestbook. 8/29/2006. http://www.xxframework.org. Example: ... – PowerPoint PPT presentation

Number of Views:203
Avg rating:3.0/5.0
Slides: 52
Provided by: davidmo5
Category:

less

Transcript and Presenter's Notes

Title: XX Framework


1
XX Framework
  • XML-Centric Java Web Development Framework

David Moskowitz President, Infoblazer
LLC http//www.xxframework.org
2
What is XX?
  • XML-centric implementation of the MVC development
  • End to End Java-based Web Framework
  • Built around open web standards
  • J2EE, XHTML, XML, XSL, CSS
  • CRUD with little or no Java programming
  • Other features
  • Security
  • Configurable data caching
  • Thread pooling
  • Web service integration

3
XX Phases
  • XX Foundation (2001-2005)
  • Implement function to return XML
  • XSL Transformations
  • Config file driven
  • XX Automation (2005-2006)
  • Automated Crud Handler
  • Builds on foundation
  • XX Generation (2007)
  • Generate fully functioning application
  • XML, XSL,CSS

4
Type 1 Architecture
5
Type 2 (MVC) Architecture
6
XX Architecture Foundation
7
XX Architecture - Automation
8
Programming against XML
  • Decouples application layers for easy inspected
    at development time
  • For debugging and testing, may be developed in
    isolation from the rest of the system (e.g.. In
    XML Spy)
  • Serve as a Contract between components
  • DTD- Validation plus code completion
  • Easily Serializable
  • Utilize XML Based technologies (XSL,XPath, SOAP)
  • Inherently Stateful. Good for stateless / SOA
    architectures.
  • Single data type- no method signature issues /
    local stubs
  • Cross Platform XML available on most platforms
  • Web Services / Remoting
  • Firewall-friendly over http//80

9
What is XSL
  • Language for transforming XML
  • Declarative (what) not Procedural (how)
  • Matching/Template based
  • Includes small subset of programming language
    functions

10
XSLT Example - The XML
  • Contact Object

ltcontactgt ltidgt1lt/idgt ltfirstnamegtSitelt/firstnamegt
ltlastnamegtAdminlt/lastnamegt ltuseridgtadminlt/useri
dgt ltpasswordgtadminlt/passwordgt ltemailgtadmin_at_admin
.comlt/emailgt lt/contactgt
11
XSLT Example- The XSL
ltxslstylesheet version"1.0" xmlnsxsl"http//ww
w.w3.org/1999/XSL/Transform" xmlnsfo"http//www.
w3.org/1999/XSL/Format"gtltxsloutput
method"html"/gt ltxsltemplate match"/contact"gt lth
tmlgt ltheadgtlttitlegtltxslvalue-of
select"firstname"/gt160ltxslvalue-of
select"lastname"/gtlt/titlegt lt/headgt ltbodygtlth1gtUser
Detailslt/h1gt First Nameltinput type"text"
name"firstname"gt ltxslattribute
name"value"gtltxslvalue-of select"firstname"/gtlt/x
slattributegtlt/inputgt ltbr/gt Last Nameltinput
type"text" name"lastname"gt ltxslattribute
name"value"gtltxslvalue-of select"lastname"/gtlt/xs
lattributegtlt/inputgt ltbr/gt Emailltinput
type"text" name"email"gt ltxslattribute
name"value"gtltxslvalue-of select"email"/gtlt/xsla
ttributegtlt/inputgt ltbr/gt User IDltinput
type"text" name"userid"gt ltxslattribute
name"value"gtltxslvalue-of select"userid"/gtlt/xsl
attributegtlt/inputgt ltbr/gt Passwordltinput
type"password" name"password"gt ltxslattribute
name"value"gtltxslvalue-of select"password"/gtlt/xs
lattributegtlt/inputgt lt/bodygtlt/htmlgt lt/xsltemplate
gt lt/xslstylesheetgt
12
XSLT Example - The Result
13
XSL as the View
  • Advantages
  • Best separation of presentation from back-end
    logic!
  • Declarative/Template approach simpler to
    understand
  • Performance advantages for some types of
    processing
  • Native language for Web Services
  • Cross Platform Approach
  • Utilize new XML Technologies (new parsers, FOP)
  • Overcoming the Disadvantages
  • Performance issues
  • use caching, small transforms, Client-side
    transforms
  • Extra steps to convert non-XML data
  • Use automated tools like Castor
  • Page per transform may be too coarse
  • Break up using portal approach

14
Portal Approach to XSL
  • Divide page into independent sections
  • Simpler / quicker transformations
  • Simpler Implementation / Design
  • Data Caching Possibilities

15
CSS
  • Developer just deals with content
  • Further separation of content from presentation
  • Commonly used for formatting
  • Can also be used for positioning
  • More powerful that non-CSS approaches in latest
    specs
  • Inconsistently implemented by browsers
  • CSS only developers hard to find

16
Example - Table-Based Site
17
And the HTML
ltTABLE BORDER0 CELLSPACING0 CELLPADDING0
WIDTH566 NOFLYgt ltTR
VALIGNTOP ALIGNLEFTgt
ltTD WIDTH31 HEIGHT1gtltIMG SRC"./assets/images/au
togen/clearpixel.gif" WIDTH31 HEIGHT1 BORDER0
ALT""gtlt/TDgt ltTD
WIDTH99gtltIMG SRC"./assets/images/autogen/clearpi
xel.gif" WIDTH99 HEIGHT1 BORDER0 ALT""gtlt/TDgt
ltTD WIDTH395gtltIMG
SRC"./assets/images/autogen/clearpixel.gif"
WIDTH395 HEIGHT1 BORDER0 ALT""gtlt/TDgt
ltTD WIDTH41gtltIMG
SRC"./assets/images/autogen/clearpixel.gif"
WIDTH41 HEIGHT1 BORDER0 ALT""gtlt/TDgt
lt/TRgt ltTR
VALIGNTOP ALIGNLEFTgt
ltTD COLSPAN2gtlt/TDgt ltTD
WIDTH395gt ltPgtltFONT
FACE"Arial,Helvetica,Geneva,Sans-serif,sans-serif
"gtnbspnbsp nbsp nbsp lt/FONTgtltFONT
SIZE"1" FACE"Arial,Helvetica,Geneva,Sans-serif,
sans-serif"gt ltBgtltIgt nbsp Experience You Can
Count Onlt/Igtlt/Bgtlt/FONTgtltBgtltIgtlt/Igtlt/Bgtlt/Pgt
lt/TDgt
ltTDgtlt/TDgt lt/TRgt
ltTR VALIGNTOP ALIGNLEFTgt
ltTD COLSPAN4 HEIGHT16gtlt/TDgt
lt/TRgt ltTR VALIGNTOP
ALIGNLEFTgt ltTDgtlt/TDgt
ltTD COLSPAN3 WIDTH535gt
ltPgtltFONT
FACE"Arial,Helvetica,Geneva,Sans-serif,sans-serif
"gtSarasota is a great place to live, work and
enjoy life.nbsp I can help you search for the
right home -- with advice on where to look, and
how to get the most value for your
purchase.lt/FONTgtlt/Pgt
lt/TDgt lt/TRgt
lt/TABLEgt
18
CSS Approach
  • XHTML for content
  • CSS for presentation
  • Yields Simpler DOM model
  • For client-side scripting

ltdivgt ltdiv id"pagesubheader"gtExperience You Can
Count Onlt/divgt ltdiv id"main_content"gt ltpgt Sa
rasota is a great place to live, work and enjoy
life. I can help you search for the right home
-- with advice on where to look, and how to get
the most value for your purchase lt/pgt lt/divgt lt/
divgt
19
The XX Framework
  • Standards based- Limited new tools or languages
    to learn
  • XX uses standard servlets
  • XX uses standard html form fields
  • XX uses standard hyperlinks
  • XX uses standard XSL

20
Example - Hello World
21
Hello World
  • Step 1 Add a web servlet to web.xml

ltservletgt ltservlet-namegtHelloWorldlt/servlet-namegt
ltservlet-classgtorg.xxframework.Baselt/servlet-cla
ssgt ltinit-paramgt ltparam-namegtconfigFilelt/param-
namegt ltparam-valuegtHelloWorld.xmllt/param-valuegt
lt/init-paramgt lt/servletgt
Step 2- Create the XX Config File
lt?xml version"1.0" encoding"UTF-8"?gt lt!DOCTYPE
xx_config SYSTEM "http//www.xxframework.org/dtd/x
x_config.dtd"gt ltxx_configgt ltclassesgt ltclass
id"1" use"xsl" scope"application"
applyxsl"false"gt ltclassnamegtorg.xxframework.tu
torial.HelloWorldlt/classnamegt ltmethodgtSayHellolt
/methodgt lt/classgt lt/classesgt ltjspgtsimple.jsplt/
jspgt lt/xx_configgt
22
Hello World - Continued
Step 3- Create JSP Page
lt xxOutput(request.getAttribute("html_"(String)
request.getAttribute("configfile")"_1")) gt
Step 4- Java Implementation function
public class HelloWorld implements
org.xxframework.BaseFlow // BaseFlow
Implementation methods go here
public String SayHello(Document document)
return "Hello World"
23
Hello World The Result
24
Hello World Web
Step 1- Add Servlet to web.xml
Step 2- Create XX Config file
lt?xml version"1.0" encoding"UTF-8"?gt lt!DOCTYPE
xx_config SYSTEM "http//www.xxframework.org/dtd/x
x_config.dtd"gt ltxx_configgt ltclassesgt ltclass
id"1" scope"application" use"web"
applyxsl"false"gt ltendpointgthttp//
www.xxframework.org /guestbook/HelloWorld.html
lt/endpointgt lt/classgt lt/classesgt ltjspgtsimple.js
plt/jspgt lt/xx_configgt
25
Hello World XML
XX Config File
lt?xml version"1.0" encoding"UTF-8"?gt lt!DOCTYPE
xx_config SYSTEM "http//www.xxframework.org/dtd/x
x_config.dtd"gt ltxx_configgt ltclassesgt ltclass
id"1" use"xsl" scope"page" applyxsl"true"gt
ltclassnamegtorg.xxframework.tutorial.HelloWorldlt/cl
assnamegt ltmethodgtSayHelloXMLlt/methodgt ltxsl_f
ilegtHelloWorld.xsllt/xsl_filegt lt/classgt lt/classe
sgt ltjspgtsimple.jsplt/jspgt lt/xx_configgt
Implementation Function
public String SayHelloXML(Document document)
Document resultDocument DocumentHelper.createD
ocument() resultDocument.addElement("say_hello")
resultDocument.getRootElement().addElement("greet
ing") .addText ("Hello World") return
resultDocument.asXML()
26
Hello World XML - Continued
XML Response
ltsay_hellogt ltgreetinggtHello Worldlt/greetinggt lt/sa
y_hellogt
HelloWorld.xsl
lt?xml version"1.0" encoding"UTF-8"?gt ltxslstyles
heet version"1.0" xmlnsxsl"http//www.w3.org/19
99/XSL/Transform" xmlnsfo"http//www.w3.org/199
9/XSL/Format"gt ltxsltemplate match"/"gt ltxslva
lue-of select"say_hello/greeting"/gt lt/xsltempla
tegt lt/xslstylesheetgt
27
XX Automation
  • CRUD Implementation
  • Uses Hibernate Model
  • Click URLs defined as servlets
  • use base xx servlet
  • specify config file to describe desired action
  • Standard CRUD Actions
  • Set
  • Get
  • Delete
  • List
  • Custom
  • HTML form elements/XML configuration provide the
    rest of the details for these actions

28
Example - Guestbook
29
Example List Organizations
30
Example List Organizations
XX Configuration
lt?xml version"1.0" encoding"UTF-8"?gt lt!DOCTYPE
xx_config SYSTEM "http//www.xxframework.org/dtd/x
x_config.dtd"gt ltxx_configgt ltclassesgt ltclass
id"1" scope"page" applyxsl"true"
use"xsl"gt ltclassnamegtorg.xxframework.control.R
ecordControllt/classnamegt ltmethodgtlistlt/methodgt
lthb_classnamegtorg.xxframework.guestbook.entity.
Organization lt/hb_classnamegt ltsecurity
secure"false"/gt lt/classgt ltclass id"99"
scope"application" use"file" applyxsl"false"gt
ltendpointgtxmlroot/../../ListOrganizationsNotes
.htmllt/endpointgt ltcache_context
use"string"/gt lt/classgt lt/classesgt ltjspgtmain.j
splt/jspgt lttitlegtOrganization Listlt/titlegt lt/xx_co
nfiggt
31
The JSP File
  • Divs for page specific content
  • Positioned by CSS
  • Page is very reusable - one JSP per application
    possible
  • ltjspincludegt for repeating content

ltdiv idguestbook_menugtltjspinclude
page"guestbookmenu.html"/gtlt/divgt ltdiv
idlogin_formgtltjspinclude pageloginform"/gtlt/d
ivgt ltdivgt lt xxOutput(request.getAttribute("html
_"(String)request.getAttribute("configfile")"_99
")) gtlt/divgt ltdivgt lt xxOutput(request.getAttribu
te("html_"(String)request.getAttribute("configfil
e")"_1")) gt lt/divgt ltdivgt lt xxOutput(request.ge
tAttribute("html_"(String)request.getAttribute("c
onfigfile")"_2")) gt lt/divgt ltdivgt lt
xxOutput(request.getAttribute("html_"(String)requ
est.getAttribute("configfile")"_3")) gt lt/divgt
ltdivgt lt xxOutput(request.getAttribute("html_"(S
tring)request.getAttribute("configfile")"_4"))
gtlt/divgt ltdivgt lt xxOutput(request.getAttribute("
html_"(String)request.getAttribute("configfile")
"_5")) gt lt/divgt
32
Example Show Organization
33
Example- Show Organization
ltclass id"1" use"xsl" scope"page"
applyxsl"true"gt ltclassnamegtorg.xxframework.contr
ol.RecordControllt/classnamegt ltmethodgtgetlt/methodgt
lthb_classname master"true"gtorg.xxframework.gues
tbook.entity.Organizationlt/hb_classnamegt ltxsl_fil
egtShowOrganization.xsllt/xsl_filegt ltsecurity
secure"true"gtltrole name"Administrator"
mode"any"/gt ltrole name"" mode"any"/gt lt/sec
uritygt lt/classgt ltclass id"2" scope"application"
applyxsl"true" use"xsl"gt ltclassnamegtorg.xxframe
work.control.RecordControllt/classnamegt ltmethodgtli
stlt/methodgt lthb_classname detail"true"gtorg.xxfra
mework.guestbook.entity.Contactlt/hb_classnamegt ltx
sl_filegtListUsers.xsllt/xsl_filegt lt/classgt ltclass
id"99" scope"application" use"file"
applyxsl"false"gt ltendpointgtxmlroot/../../ShowO
rganizationNotes.htmllt/endpointgt ltcache_context
use"string"/gt lt/classgt
34
Example Save Organization
35
Example Save Organization
  • ltxx_configgtltclassesgt
  • ltclass id"1" use"xsl" scope"page"
    applyxsl"true"gt
  • ltclassnamegtorg.xxframework.control.RecordContro
    llt/classnamegt
  • ltmethodgtsetlt/methodgt
  • lthb_classnamegtorg.xxframework.guestbook.entity.O
    rganizationlt/hb_classnamegt
  • lterror_patterngtltxx_errorlt/error_patterngt
  • lterror_jspgtmain.jsplt/error_jspgt
  • lterror_xslgtreply.xsllt/error_xslgt
  • ltsecurity secure"true"gt
  • ltrole name"Administrator" mode"any"/gt
  • ltrole name"" modeedit"/gt
  • lt/securitygt
  • ltcache_controlgt
  • ltcached_page name"ListOrganizations.xml"/gt
  • ltcached_page name"ShowOrganization.xml"gt
  • ltidgt1lt/idgt
  • ltcache_context context"message"gt
  • ltelementgtidlt/elementgt
  • lt/cache_contextgt

36
CRUD Mapping Save Organization
ltform xmlnsfo"http//www.w3.org/1999/XSL/Format"
class"dataentry" name"SetOrganization"
action"SetOrganization" method"POST"gt ltinput
name"organization/id" type"hidden"
value"1"/gt ltdivgtltlabel for"name"gtNamelt/labelgt
ltinput xmlnsdt"http//xsltsl.org/date-time"
xmlnsstr"http//xsltsl.org/string" size"30"
name"organization/organizationname"
value"Microsoft" id"name" type"text"/gt lt/divgt
ltdivgtltlabel for"organization_type"gtType
lt/labelgt ltselect size"1" name"organization/org
anizationtype/id"gt ltoption value""/gt ltoptio
n value"2" selected"true"gtCorporationlt/optiongt
ltoption value"1"gtLLClt/optiongt ltoption
value"3"gtNon-Profitlt/optiongt lt/selectgt lt/divgt
37
XML Request
  • XX parses HTTP Request into XML
  • XML gets passed into Implementation function

ltroot sid"CDDEFBDC1767E710E55CEBE4F580F8C4"gt ltreq
uestgt ltorganizationgt ltidgt1lt/idgt ltorganizatio
nnamegtMicrosoftlt/organizationnamegt ltorganization
typegtltidgt1lt/idgtlt/organizationtypegt lt/organization
gt lt/requestgt ltInitializationgtltInit-paramsgtltconfigF
ilegtSetOrganization.xmllt/configFilegtlt/Init-paramsgt
ltEnv-paramsgtltDevelgttruelt/Develgt lthibernate_con
fig_filegt/org/xxframework/website/entity/hibernate
.cfg.xmllt/hibernate_config_filegtltxml_pathgtC\proje
cts\xxguestbook\WebRoot\WEB-INF\xml\lt/xml_pathgtlt/E
nv-paramsgt lt/Initializationgt ltUrl-params/gt lt/rootgt
38
Example List Guestbook
39
Example List Guestbook
  • ltclass id"1" scope"session" use"xsl"
    applyxsl"true"gt
  • ltclassnamegtorg.xxframework.control.RecordControllt
    /classnamegt
  • ltmethodgtgetlt/methodgt
  • lthb_classnamegtorg.xxframework.searchfilter.Dummylt
    /hb_classnamegt
  • ltxsl_filegtAddMessage.xsllt/xsl_filegt
  • lt/classgt
  • ltclass id"2" scope"page" applyxsl"true"
    use"xsl"gt
  • ltclassnamegtorg.xxframework.control.RecordControllt
    /classnamegt
  • ltmethodgtgetlt/methodgt
  • lthb_classnamegtorg.xxframework.searchfilter.Guestb
    ookFilterlt/hb_classnamegt
  • ltxsl_filegtListGuestbookFilter.xsllt/xsl_filegt
  • ltcache_context use"string"/gt
  • lt/classgt
  • ltclass id"3" scope"application" applyxsl"true"
    use"xsl" timeout"20000"gt
  • ltclassnamegtorg.xxframework.control.RecordControllt
    /classnamegt
  • ltmethodgtlistlt/methodgt
  • lthb_classnamegtorg.xxframework.guestbook.entity.Me
    ssagelt/hb_classnamegt
  • ltxsl_filegtListGuestbook.xsllt/xsl_filegt
  • lt/classgt

40
Filtering and Sorting List Guestbook
ltform class"dataentry" name"ListGuestbook"
method"post" action"ListGuestbook"gt ltinput
value"desc" name"sort/dateadded"
type"hidden"gt lth2gtGuestbook Searchlt/h2gt ltdivgt ltla
bel for"author"gtAuthorlt/labelgtltinput size"30"
name"filter/author" value"" id"author"
type"text"gt lt/divgt ltdivgt ltlabel for"title"gt
Titlelt/labelgtltinput size"30" name"filter/title"
value"" id"title" type"text"gt lt/divgt ltdivgt ltlab
el for"message"gtMessagelt/labelgtltinput size"30"
name"filter/message" value"" id"message"
type"text"gt lt/divgt ltdivgt ltlabel
for"recordcount"gtRows/Pagelt/labelgtltinput
size"30" name"recordcount" value"50"
id"recordcount" type"text"gt lt/divgt ltdivgt ltlabel
for"start"gtStart Rowlt/labelgtltinput size"30"
name"start" value"" id"start"
type"text"gt lt/divgt lt/formgt
41
Guestbook Summary
  • One Java function - check for duplicate User ID
  • Could leave validation to the database, but error
    message may not be that friendly
  • Source code and descriptive tutorial available
    online

42
Example XX Pet Store
43
Example XX Pet Store
  • Implementation of Sun Pet Store
  • More realistic application than Guestbook
  • All features of Pet Store implemented except
    admin component
  • Three Java functions
  • Delete cart on order save
  • Check security on cart update and delete
  • (Session based security not yet supported)

44
Other Features- Select Lists
  • Show Organizations

45
Automated Select List Population
  • XX_References.xml

lt!DOCTYPE references SYSTEM "http//www.xxframewor
k.org/dtd/xx_references.dtd"gt ltreferencesgt ltgenera
te_selectgt ltclass name"Organization"
package"org.xxframework.guestbook.entity"gt ltpro
perty name"organizationtype" package"org.x
xframework.guestbook.entity" add_blank"true
class"Organizationtype" display_field"typen
ame"gt ltbuild mode"edit" operation"get"/gt lt/
propertygt lt/classgt lt/generate_selectgt lt/reference
sgt
46
Other Features- Caching
  • Per Class caching
  • Cache at session or application level
  • Clear cache, declarative
  • Example- EditAccount.xml

ltxx_configgtltclassesgt ltclass id"1"
scope"session" applyxsl"true"
use"xsl"gt ltclassnamegtorg.xxframework.control.Rec
ordControllt/classnamegt ltmethodgtgetlt/methodgt lth
b_classnamegt org.xxframework.petstore.entity.Use
raccountlt/hb_classnamegt ltxsl_filegteditaccount.x
sllt/xsl_filegt ltxsl_file_pregttransform_editaccou
nt.xsllt/xsl_file_pregt ltcache_contextgt ltelemen
tgtidlt/elementgt lt/cache_contextgt lt/classgt lt/cla
ssesgt ltjspgtmainnobanner.jsplt/jspgt lttitlegtAccoun
t Detaillt/titlegt lt/xx_configgt
47
Clearing Cache
Example- SaveAccount.xml
  • ltxx_configgt
  • ltclassesgt
  • ltclass id"1" scope"page" applyxsl"true"
    use"xsl"gt
  • ltclassnamegtorg.xxframework.control.RecordControl
    lt/classnamegt
  • ltmethodgtsetlt/methodgt
  • lthb_classnamegtorg.xxframework.petstore.entity.U
    seraccount
  • lt/hb_classnamegt
  • lterror_patterngtltxx_errorlt/error_patterngt
  • lterror_jspgtmain.jsplt/error_jspgt
  • lterror_xslgtreply.xsllt/error_xslgt
  • ltcache_controlgt
  • ltcached_page name"editaccount.xml"gt
  • lt/cached_pagegt
  • lt/cache_controlgt
  • lt/classgt
  • lt/classesgt
  • ltjspgtEditAccountlt/jspgt
  • lttitlegtAccount Detaillt/titlegt
  • lt/xx_configgt

48
Other Features - Threading
  • Each page component treated independently
  • Can specify components executed in parallel
  • Can specify new thread or use thread pool
  • Limited value on multi-threaded web container

49
Other Frameworks Comparison
  • MVC Request/Response (Action) vs. Event Driven
    (Component)
  • Service Oriented vs. Object Oriented
  • Simple vs. Complex?
  • Exposes web infrastructure vs. hide it
  • Hyperlinks, response, request, web.xml, etc
  • Java programming vs. XSL
  • Portal vs. Page-Centric approach

50
Roadmap
  • Web service integration
  • Expose Implementation functions as Web Services
  • Enhance/validate threading
  • Disk based caching
  • Improved data validation
  • Hibernate 3 support
  • Spring IOC/AOP integration?
  • XDoclet/Ant config file and XSL generation
  • Client-Side Transformations (AJAXSLT)
  • Better User Documentation
  • XXDoc

51
Closing Thoughts
  • XX Framework is a work in progress!
  • Looking for feedback and suggestions!!
  • Looking for developers!!!
  • Questions?

Thank You
Write a Comment
User Comments (0)
About PowerShow.com