Introduc*on to UML-‐B, UML-‐B Class Diagrams, UML-‐B Context ...
g22 3033 007 c101 - nyu.edu · 3 5 XML Support for UML Modeling QMeta Object Facility (MOF) QCORBA...
Transcript of g22 3033 007 c101 - nyu.edu · 3 5 XML Support for UML Modeling QMeta Object Facility (MOF) QCORBA...
1
1
Extreme JavaG22.3033-007
Session 10 - Main ThemeJava Enterprise Web and Application Enabling (Part II)
Dr. Jean-Claude Franchitti
New York UniversityComputer Science Department
Courant Institute of Mathematical Sciences
2
Agenda
Summary of Previous SessionJava Web-Enabling Technology
Traditional Web Programming and JavaWeb and Proxy Servers
Java and XMLJava and XML Tools for CLDC ApplicationsJava Servlets and Java Server PagesJava-Based Application Server TechnologyClass Project & Assignment #4b
2
3
Part I
Previous Session Review
4
Summary of Previous Session
AppletsConnected DevicesJava SecurityManaging MetaDataReadingsClass Project & Assignment #4a
3
5
XML Support for UML Modeling
Meta Object Facility (MOF)CORBA Common Facility for the Management of MetaInformation such as UML Models, Database Schemas,Programming Language Types, etc.
XML Metadata Interchange (XMI)Enables interchange of metadata between modeling toolsDevelop models using Rational Rose or Java, and the XMI toolkitUse Objects by Design xmi-to-html.xsl style sheet and Cocoonframework to present the resulting model
6
MDA Development Approach
4
7
Sample MOF MetaModel
8
Sample MOF MetaModel(continued)
5
9
MOF to XML Mapping
10
Simplified UML XMI DTD
6
11
XML Information ModelingSteps
Documenting the Information StructureRepresenting the Information Structure in XML FormDefining XML DTDs and/or Schemas
Modeling TechniquesUML: object modelingXML: content modelingORM: data modeling
UML, MOF and XMISee Session 9 handout
12
Using UML to Model MLs
Query Glossaries
Translator
glossary_request
<<communicate>>
<<communicate>>
+reply_recipient
glossary_reply
+reply_supplier
+request_supplier
+request_recipient
7
13
Using UML to Model MLs(continued)
Gl os sar ies<<XSDs chem a>>XSD Datatypes XHTML
string(from XSD D atatypes)
<<XSDsim pleT ype>>
Di alectCode<<X SDsim p leTy pe>>
S ignedEn try
authorNam e : stringcreationDate : date
<<XSD com plex Type>>
DialectInfo
frenchCanadian : stringdia lectCode : Dia lectCode
<<XSD choic e>>
Glossaries<<XSDcom plexT ype>>
Entry
engl ish [0..1] : stringfrench [0..1] : string
<<XSDcom plexT ype>>
0..n0..n
Glossary
<<XSDelem ent>> topic : string<<XSDattribute>> creationDate : date
<<XS Dcomplex Ty pe>>
0..n
+g lossary
0..n
0..n
1
+en try 0..n
1
0..n
PlaceHolder( fro m XH T ML)0..2
+d escription
0..2
+sub-g lossary 0..n
14
Practical XML Metadata ManagementPractical Use of XMI:
Develop a model using Rational Rose or Java, and the XMItoolkitUse Objects by Design xmi-to-html.xsl style sheet andCocoon framework to present the resulting model
Current State of Tools:Forward-Engineering of UML into XML Schemas is possible
Can export .mdl files from Rational Rose, and convert theminto XMI using SoftModeler (www.softera.com)SoftModeler can convert UML into XML W3C Schemas
Reverse-Engineering of XML Schemas into UML is more difficultNot supported by current tools
8
15
Part II
Java Web-Enabling Technology
16
Traditional Web Programming & Java
HTMLCGIScripting LanguagesSee Session 10 Demo Programs:
Sample Traditional Application Parts I & II underDemo Programs on the course web site
9
17
Web Servers and Servlet Engines
Apache + TomCathttp://www.apache.org
Apache + Jrunhttp://www.macromedia.com
Apache + Jettyhttp://jetty.mortbay.org/jetty/index.html
18
CORBA Web-Enabling(Gatekeeper, Wonderwall, etc.)
CORBA 3 includes a firewall spec. for IIOP support
10
19
VisiBroker Gatekeeper’s Features
Extends location transparency past the Web server
Gatekeeper acts as a proxy object for all incoming requests from
client applets
Allows callbacks to functions of the server objectsGatekeeper’s proxy objects allows communication back to specificclients
IIOP proxy serverGatekeeper proxys requests and callbacks through a single port on thefirewall
HTTP tunnelingNo additional code required when firewalls do not allow IIOP trafficto pass
20
VisiBroker Gatekeeper’s Features(continued)
SSL supportGatekeeper + SSL Pack ensures privacy and integrity of information
Broad flexibility in security configuration (clientcommunication, server callbacks, all communications)Authentication + encryption support
Easy graphical configuration
11
21
VisiBroker’s Gatekeeper
22
Part III
Java and XML
12
23
Java & XMLJava XML Pack
Java API for XML Messaging (JAXM) v1.0.1 EA2Java API for XML Processing (JAXP) v1.2 EA2Java API for XML Registries (JAXR) v1.0 EA2Java API for XML-based RPC (JAX-RPC) v1.0 EA2
Java Architecture for XML Binding (JAXB)XML Parsers
Xerces-JCrimsonOracle XML parser
XML Server-Side POP FrameworksXML P2P/B2B/EAI (MOM) Frameworks
24
Java and Web Services
Java Web Services Developer PackJava XML PackJavaServer Pages Standard Tag Library (JSTL)Ant Build ToolJava WSDP Registry ServerWeb Application Deployment ToolApache Tomcat Container
13
25
Java-enabled XML TechnologiesXML provides a universal syntax for Java semantics(behavior)
Portable, reusable data descriptions in XMLPortable Java code that makes the data behave invarious ways
XML standard extensionBasic plumbing that translates XML into Java
parser, namespace support in the parser, simple API forXML (SAX), and document object model (DOM)
XML data binding standard extension (JAXB)
26
XML and Java StandardsXML includes is a family of technologies
XSL, XML Schema, XML Query, XPath, XPointer,XLink, DOM, RDF, CSS, XSL, XHTML, XMLSignature, MathML, SMIL, SVG, etc.
Review the current state of the XML standards athttp://www.w3c.org/XMLReview the current state of Java Technology andXML (JAXP) standards athttp://java.sun.com/XMLReview the Java binding to DOM 2.0 athttp://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/java-binding.zip
15
29
XML on Lightweight Clients
Support Lightweight client-side developmentProcess and generate XML documents
Client-side transformation of generic XMLPeer-to-peer networkingInformation appliance interoperabilityLeverage powerful lightweights
30
Key Java XML Technologies forLightweight Clients
Lightweight parsers and document generatorsXSLT compilersCLDC and KVM
16
31
Myriads of Client Formats
Compact HTML (cHTML)Used in NTT DoCoMo iNode network in Japanhttp://www.w3.org/TR/1998/NOTE-compactHTML-19980209
Wireless Markup Language and WMLScriptfor WAP networksHTML
HTML 4.0 Guidelines for Mobile Accesshttp://www.w3.org/TR/1999/NOTE-html40-mobile-19990315
32
Myriads of Client Formats(continued)
Handeld Device Markup Language (HDML)Created by Unwired Planet (Phone.com /Openwave -http://www.openwave.com) in 1995Scripting capabilities similar to WMLScriptOpenwave WAP Edition browser displaysWML/WMLScript as well as HDMLOpenwave Universal Edition browser displaysWML/WMLScript, xHTML, and cHTML
Proprietary Format (e.g., Xircom Rex)XHTML Basic
http://www.w3.org/TR/2000/REC-xhtml-basic-20001219
17
33
XML Document ServersConjecture:
Publish content and data in HTML, cHTML,WML and WMLScript, HDML, Web ClippingApplication format, etc.
Alternative 1: Publish content data in oneformat (e.g., WML)
Relies on infrastructure providers for upgradepath (WAP server)
Alternative 2: Publish content data in XMLwith an associated DTD or XML Schema
Transformation process belongs to client
34
Peer to Peer NetworksSample Networks
Napster / Jabber (have centralized directory svc.)GnuTella (no centralized directory svc.)
P2P Networks are supported by Jini and theJXTA project (http://www.jxta.org) in theinformation appliance world
Jini connects distributed services via a directory serviceJXTA connects distributed services without requiring adirectory service
Based on generic XML data referred to as “codat”Provides InstantP2P for instant messaging with “peer groups” andP2P file sharingNot very well supported by single threaded device OSs
18
35
Information Appliance InteroperabilityExample
Mobile phone application dialing a number stored in aPDA
Typical SolutionBoth devices are Bluetooth-enabledMobile phone application uses the Java API for Bluetooth(JSR-000082,http://java.sun.com/aboutJava/communityprocess/jsr/jsr_082_bluetooth.html)PDS address book application exposes directory servicesin a standard wayWould be great is the PDA could generate XML ascommon message format ...
36
Powerful LightweightsCompaq iPaq 3670 !!!
64MB RAM expandable to 128MB with anoptional CompactFlash cardBuilt-in microphone, speaker, and light sensorOptional IBM Microdrive for up to 1GB storageDual-Slot PC Card Expansion Pack for up to twoType-II PCMCIA cards
Novatel Wireless Merlin for Richocet enables128 kbpswireless Internet accessOther slot can be used for another 16MB of RAM orperhaps a GPS receiver
19
37
Available VMs(not all J2ME-compliant)
IBM J9 (http://www.embedded.oti.com/)Kada Mobile http://www.kadasystems.com/)Esmertec Jbed (http://www.esmertec.com/)SuperWaba (http://www.superwaba.org/)Waba (http://www.wabasoft.com/)Symbian (http://www.symbian.com/)
includes both an operating system and VMSun KVM (http://java.sun.com/products/cldc/)
38
J2ME Compliance(review)
Configuration LayerClass of information appliance
Device Profile LayerPDA Profile for CLDCMobile Information Device Profile for CLDCFoundation Profile for CDCPersonal Profile for CDC
Application Layer
20
39
XML Parsers
NanoXML (http://nanoxml.sourceforge.net/)slower parser with a DOM-style interface that offers documentgeneration and optional SAX 1.0 support
MinML (http://www.wilson.co.uk/xml/minml.htm)lean, fast SAX 1.0 parser without support for document generation
kXML (http://kxml.enhydra.org/)TinyXML(http://www.gibaradunn.srac.org/tiny/index.shtml)XPP (http://www.extreme.indiana.edu/soap/xpp/)
40
Different Types of XML ParsersPush parsers (SAX)
publish a set of interfaces, implemented by applications,through which the parser relays document information.application code nust maintain state within callbackclass(es), and to evaluate that state at each event.
Object model parsers (DOM)build in-memory representations of XML documentsusing tree-like data structuresEither all-at-once or lazy parsers
Pull parsers (similar to java.io.Reader)Parsing is based on application needsExamples: kXML and XPP
21
41
Sample Palm ApplicationBeaming contact information from a custom Palm database
42
Part V
Servlets and Java Server Pages (JSPs) Also See Session 6 Handout on:
“Applets, Servlets, and Java Server Pages”and Session 10 Handout on:
“Servlets”
22
43
Second Generation Client/Server Architectures(needing to be Web-enabled)
44
J2EE Web-Enabling Component Models(revisited)
Javasoft’s Applet Tutorial:http://java.sun.com/docs/books/tutorial/applet/TOC.html
Swing Applets:http://java.sun.com/docs/books/tutorial/uiswing/start/swingApplet.html
Java Web Start:http://www.javasoft.com/products/javawebstart/index.html
Servlets, Servlet filters, Cocoon/XSPsSee related Session 6 and Session 10 handouts
Connected DevicesSee related session 9 handout on the Palm PlatformSee http://webdev.apl.jhu.edu/~rbe/kvm/
23
45
Java Servlets & Java Server PagesSee Session 6 Handout:
Applets, Servlets, and Java Server Pages
See Javasoft’s Documentation on Servlets:http://java.sun.com/products/servlet/index.html
See Javasoft’s Documentation on JSPs:http://java.sun.com/products/jsp/
Servlet Example: Cocoonhttp://xml.apache.org
Need Domain Boundary Controllerse.g., www.xtradyne.comUntil HTTP-NG / CORBA 3 firewall spec. gets implemented
46
Introduction to Servlets and JSPsSee http://www.java-shop.com/jsp.htmServlets (http://java.sun.com/products/servlet/)
Java’s standard mechanism for writing code that runs and extends thefunctionality of a servlet engineA servlet is to a server what an applet is to a browserHTTP servlets
Replacement for CGIStandard mechanisms for handling cookies, sessions, session/application contextsAdvantages over CGI: performance, platform and web-server independence
Servlet filters are new in the Java Servlet Specification 2.3
Java Server Pages (http://java.sun.com/products/jsp/)Answer to Microsoft’s Active Server PagesProvide mechanism for including tags/scriptlets into an HTML or XML pageJSPs have .jsp extension and are processed using a special servlet
JSP page is compiled into a servlet upon first access or after each modificationAbility to instantiate and access JavaBeans within JSP pages
24
47
MVC or Model 2 Design PatternUsed to implement Modern Web Applications as a combination of
Servlets/Servlet filtersController receiving/filtering requests from the userUpdates the application’s model composed of JavaBeansPasses the page request to a view JSP
Java Server PagesDisplay information based on the current state of the application’s model
JavaBeansEnable component reuse
Custom Tag LibrariesMake it possible to move source code out of the JSP where it is difficult to maintainand into reusable JavaBeans
Rich array of Java APIs
See http://www.mhsoftware.com/resources/iisjserv.html for acomparison of IIS/ASP and Servlet/JSP technology
48
Servlets and JSPs ExamplesJSP displaying a banner image based on who is referring the user tothe site:
<%@ page import="com.ibm.jspredbook.*;”errorPage="error.jsp" %>
<body bgcolor="#FFFFFF">
<!--the referrer header is used to trap the url the useris coming from -->
<IMGSRC="/servlets/ImgServlet?from=<%=request.getHeader("Referer")%>">
</body>
</html>
25
49
Servlets and JSPs Examples(continued)
Servlet referenced in the IMG tag of the previous slide (partial):package com.ibm.projsp;import javax.servlet.*;import javax.servlet.http.*;import java.util.*;import java.io.*;public class ImageServlet extends HttpServlet {
private String docHome = ".";public void service( HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException {HttpSession session = request.getSession(true);ServletConfig config = getServletConfig();ServletContext application = config.getServletContext();File file = findFile(request, response);if (file == null) { return; } else {
response.setContentType(application.getMimeType(file.getName()));response.setContentLength((int) file.length());sendFile(file, response);}}
50
Architectural ConsiderationsPage-Centric v.s. Dispatcher Type
Page-Centric architectures have a JSP handling therequest directlyDispatcher architectures include a Servlet that handlesthe request and delegates to a JSPSample architectural patterns:
Page-View (Page-Centric)Page-View with Bean (Page-Centric)Mediator-View (Dispatcher)Mediator-Composite View (Dispatcher)Service-to-Workers (Dispatcher)
26
51
Cocoon 2Web Publishing framework implemented as a servletRequires a servlet engine to operateCocoon 2 has been rearchitected to truly support the MVC patternCocoon processor:
Cocoon Java type that takes a DOM tree as an input and produces another
Cocoon producer:Cocoon Java type used to feed the initial XML content to the Cocoon processingpipelinee.g., Cocoon serves static XML documents using its built-in FileProducer
Cocoon processing instructions act upon a whole document, whichgenerates a result document
<?cocoon-process type="xsp"?>Result document is passed to the next Cocoon processorSimilar to servlet chaining
Alternatives: Rocket, CPan’s, http://xmlsoftware.com/publishing/
52
Introduction to XSPsSee:
Apache Cocoon technology: http://xml.apache.org/cocoon/xsp.htmlXSP / JSP differences: http://www.onjava.com/lpt/a/620Publishing Frameworks:http://www.oreilly.com/catalog/javaxml/chapter/ch09.html#69379
XSP:Core technology available in Apache Cocoon 2Approach separates content, style, and logic as XML files and uses XSL tomerge them
XSP engineImplemented as a Cocoon processor that accepts an XSP as inputTranslates XSP into equivalent source program, compiles, loads and executes itXSP generates producers while JSP technology generates servletsAll XSP producers are derived from an abstract base class XSPPage
27
53
Minimal XSP PageXML document that has the following characteristics:
Processing instruction invoking the XSP processor:<?cocoon-process type="xsp"?>
Document root element must be:<xsp: page>
All language and Taglib declarations must appear as attributes inthe root element tag:
e.g., <xsp:page language="java" xmlns:xsp="http://www.apache.org/1999/XSP/Core”>
Optional elements:<xsp:logic> (procedural logic embedding) and <xsp:expr> (programexpression inlining)
Optional processing of the resulting page via a style sheet forviewing purpose
<?cocoon-process type="xslt"?><?xml-stylesheet href="sample.xsl" type="text/xsl"?>
Note: Minimal JSP page is an HTML document
54
XSP ExampleXSP logic tag:. . .<p> Good <xsp:logic> String timeOfDay = ( new SimpleDateFormat("aa") ).format(new Date());
if (timeOfDay.equals("AM")) { <xsp:content>Morning</xsp:content> } else { <xsp:content>Afternoon</xsp:content> } </xsp:logic>!</p>. . .
May be rephrased using a library tag as:...<p>Good <util:time-of-day/>!</p>...
28
55
XSP v.s. JSPXSP
Tailored to maximize code reuse
Allows separation of content from presentationDevelopers handle content generation (content can be static or generatedvia servlets or Java code)
XML/XSL authors handle style/presentation via style sheet modifications
As XSP processing occurs prior to styling, the content can be presentedin various waysKeep development teams well isolatedCan use IBM's Bean Scripting Framework (BSF) to support otherscripting languages in addition to Java
JSPPopular and widely understoodRequires tight collaboration between application developers andpresentation designersAt best presentation designers must understand how to use tag libraries
56
Part VI
Java-Based Application Server Technology
29
57
Java-Based Application Servers
Third-Party Vendorshttp://www.app-serv.com/contend.html
See links mentioned in earlier announcements on thecourse web site.
58
Java and Application ServersApplication Servers for Enhanced HTML (traditional)
a.k.a., Page-Based Application ServersMostly Used to Support Standalone Web Applications
New Generation Page-Based Script-Oriented App. ServersFirst Generation Extensions (e.g., Microsoft IIS with COM+/ASP)Servlet/JSP EnvironmentsXSP EnvironmentCan now be used as front-end to enterprise applicationsHybrid development environments
Distributed Object Computing PlatformsProvide an infrastructure for distributed communications enablingStill need to merge traditional web-oriented computing with object computing
Object Management ArchitecturesDOC Platform + APIs to reusable services and facilities
OMAs + Component Models -> J2EE, CCM, DNA
30
59
Part VII
Conclusion
60
Architecture Frameworks (ongoing)CORBA & Applets (e.g., VisiBroker, and ORBacus)Web Servers (e.g., Apache), Servlet & JSP Engines(e.g., Tomcat, JRun)J2EE Application Servers (e.g., WebLogic)J2ME CLDC MIDP/PADP configuration and profilesXML Parsers (e.g., Xerces J)XML server-side POP frameworks (e.g., Cocoon)XML EAI frameworks (e.g., WebMethods)IDEs (e.g., JBuilder), and JavaBeans Development Kit(e.g., BDK)
31
61
AssignmentReadings
Building Java Enterprise Systems: Part VI, 29-33Using Java 2 Enterprise Edition: Parts II, IV, and XSlides and handouts posted on the course web site
Assignment #4b:Derive a model for the chat room application developed aspart of project 3 using the MOF MetaModeling capabilities.You may use the XMI tools provided on the IBM alphaworksweb siteAttach object implementation(s) to the chat room distributedapplication to supports the viewing of the chat room artifactsand/or application model via a Cocoon servlet