Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | Related Pages

outerPages.xml

00001 <?xml version="1.0" encoding="ISO-8859-1"?>
00002 
00003 <!-- The JWAA Outer Pages contain the website documentation; the pages
00004 that must be accessible without going through the login portal. 
00005 xmlns="http://www.w3.org/1999/xhtml"
00006 xmlns:jwaa="http://virtualschool.edu/jwaa.dtd"
00007 -->
00008 <pages 
00009   title="JWAA Web Application Architecture"
00010 >
00011 
00012 <page id="OUTER" name="JWAA" requiresRole="none"
00013   title="Java Web Application Architecture (JWAA)"
00014 >
00015   <child idref="INSTALLATION"/>
00016   <child idref="DOCUMENTATION"/>
00017   <child idref="SOURCE"/> 
00018   <child idref="CHANGES"/> 
00019   <child idref="LICENSE"/> 
00020   <child idref="PORTAL"/>
00021 
00022   <img align="right" src="/jwaa/pix/mvc.gif" alt="" width="117" height="114"/>
00023 
00024   <p>
00025     JWAA is a small but powerful architecture for writing web-based 
00026     applications in 
00027     <a idref="XHTML">XHTML</a>,
00028     <a idref="Velocity">Velocity</a> and <a idref="Java">Java</a>.
00029     JWAA is portable, <a idref="LICENSE">open source</a> (free) 
00030     code that is available for <a href="#download">download here</a>.
00031   </p>
00032 
00033   <p>
00034     JWAA features a fully object-oriented approach.  Applications 
00035     are networks of <i>page</i> objects that reference other pages 
00036     via standard object referencing semantics, not with text strings 
00037     buried in HTML text. JWAA brings the power of object-oriented 
00038     programming to bear on the web.
00039   </p>
00040 
00041   <br clear="all"/>
00042 
00043 <h2>Reduced Navigation</h2>
00044 
00045   <p>
00046     JWAA represents pages as XML files, not as conventional HTML files.
00047     XML's well-known abilities as a general purpose data representation 
00048     language are used to express entire web applications in only a few 
00049     files.  For example, the JWAA website is defined by three XML files: 
00050     <a idref="application.xml">application.xml</a>,
00051     <a idref="outerPages.xml">outerPages.xml</a> and
00052     <a idref="innerPages.xml">innerPages.xml</a>.
00053     The number of files is determined your application.xml 
00054     file, not by HTML-imposed restrictions.
00055   </p>
00056 
00057 <h2>Automatic reloading</h2>
00058 
00059   <p>
00060     JWAA monitors all input files for changes and automatically 
00061     reloads them when they change. Any errors are reported via 
00062     the browser when the XML file is first loaded, not buried 
00063     in an obscure log file.
00064   </p>
00065 
00066 <h2>Invalid link detection</h2>
00067 
00068   <p>
00069     Invalid links are automatically detected and reported when each
00070     application is first loaded. The id of each page is automatically 
00071     recorded in a dictionary and can be referenced by idref attributes
00072     as described below.  The dictionary can be expanded to add links to 
00073     external pages via dictionary elements in the application.xml file.  
00074     Dictionary entries are referenced by providing idref attributes 
00075     to the usual &lt;a&gt; and &lt;img&gt; XHTML commands.
00076   </p>
00077     
00078 <h2>Persistent forms</h2>
00079 
00080   <p>
00081     HTML lets you define forms that the user can type information into,
00082     but no way to store or process this information. That requires
00083     installing and learning languages, tools and environments that 
00084     bear no resemblance to HTML. The learning process is <i>discontinuous</i>.
00085   </p>
00086 
00087   <p>
00088     JWAA supports <a idref="FORMS">persistent forms</a> by default.  
00089     Like blackboards or paper, forms retain what the user writes 
00090     in them until it is explicitly changed or erased. Persistent forms 
00091     are a key building block for building form-based database-centric 
00092     applications such as wikis, quizzes, interview forms, and 
00093     so forth, often without any custom programming at all.  
00094     The default behavior is easily overridden.
00095   </p>
00096     
00097   <p>
00098     This feature was developed within the <a idref="ALE">Action Learning 
00099     Environment</a>, a JWAA application. It has been ported to JWAA on 
00100     as an experiment to investigate whether it makes sense to support
00101     persistent forms at a lower level.
00102   </p>
00103 
00104 <h2>Self documenting</h2>
00105 
00106   <p>
00107     Other environments provide a bare foundation to build on from
00108     first principles.  JWAA provides a finished environment to live 
00109     in and learn from while you remodel it to suit. Building a new
00110     application is a matter of copying the application that provides
00111     this tutorial and changing it to suit, learning new skills as you go.
00112   </p>
00113 
00114 <h2>Continuous learning</h2>
00115 
00116   <p>
00117     Ordinary HTML pages are static data files that are served 
00118     by a separate program such as Apache. That's fine until 
00119     the pages must support dynamic features when the learning 
00120     curve becomes discontinuous since new and unfamilar tools 
00121     must be installed and learned (perl or java, servlet 
00122     engines, etc).  
00123   </p>
00124 
00125   <p>
00126     JWAA provides a uniform and comprehensive XML-based environment 
00127     in which the transition from static to dynamic pages is continuous. 
00128     Simple static pages differ from advanced dynamic ones only in that 
00129     they don't use features that the same environment provides.
00130   </p>
00131 
00132 <h2>Automatic session management via cookies and/or URL rewriting</h2>
00133 
00134   <p>
00135     If the browser supports cookies, JWAA uses them to support session
00136     management. Otherwise JWAA will automatically rewrite all URLs 
00137     so that session information is retained when the user clicks 
00138     a URL. The code that rewrites URLs is actually provided by 
00139     the servlet engine. JWAA's contribution is to guarantee that 
00140     all URLs are subject to URL-rewriting, even those that 
00141     are buried in hardcoded &lt;a href="..."&gt; strings.
00142   </p>
00143 
00144 <h2>Integration <i>and</i> Separation of Concerns</h2>
00145 
00146   <p>
00147     JWAA supports both. When used with the 
00148     <a idref="Java+">Java+ preprocessor</a>, HTML is written as
00149     Java+ strings so that presentation and logic are combined
00150     and executable inclusions are expressed in plain Java. 
00151     The HTML can also be written as XML (XHTML) files and 
00152     automatically reloaded when they change, with executable 
00153     inclusions written in <a idref="Velocity">Velocity</a>.
00154     Since <a idref="Java+">Java+</a> now has its own web site, 
00155     this site will emphasize the XML-based approach.
00156   </p>
00157 
00158 <h2>Consistent Look and Feel</h2>
00159 
00160   <p>
00161     Navigation bars, background colors, and headers/footer 
00162     information on this and all other pages in this website 
00163     constitute this application's look and feel.  The look 
00164     and feel is defined by <a idref="Velocity">Velocity</a> 
00165     macros such that the look and feel is centrally defined
00166     and easily changed.  These macros are, by default, 
00167     automatically reloaded when the file that defines
00168     them is changed.
00169   </p>
00170 
00171 <h2>Model-View-Controller Paradigm plus Fields</h2>
00172 
00173   <p>
00174     JWAA pages are objects that supports a user's interaction with 
00175     internal objects, called Models (or JavaBeans). Model objects
00176     manage the application's persistent state, typically but not 
00177     necessarily as records in a database. By convention, model 
00178     objects' fields are not primitive Java datatypes like Strings. 
00179     Rather <b>fields</b> are the atoms from which models are composed.  
00180     Fields encapsulate the logic for validating user inputs, reporting 
00181     any problems by collaborating via the user interface. Fields are an 
00182     unusually powerful unit of reuse because they are tangible, concrete 
00183     and highly visible right in the application's user interface. 
00184     JWAA includes a comprehensive library of ready-to-use fields for
00185     building model objects in Java.
00186   </p>
00187 
00188 <h2>Small, Fast, Secure</h2>
00189 
00190   <p>
00191     With Java+, applications are constructed entirely at compile
00192     time and are remarkably small. JWAA's core functionality (minus 
00193     documentation and demos) is only 67kb while JSP is many times 
00194     larger. No compilers are needed on deployment servers, so speed,
00195     space and security are substantially improved.
00196   </p>
00197 
00198 <h2>Open Source</h2>
00199 
00200   <p>
00201     JWAA is <a idref="LICENSE">open source</a> (free) software, written 
00202     entirely in Java so it is automatically portable to any platform.
00203   </p>
00204 
00205 <a name="download"></a>
00206 <h2>Download Instructions</h2>
00207 
00208   <p>
00209     The JWAA distribution is <a href="/jwaa/jwaa.tgz">jwaa.tgz</a>.
00210     This is a gzipped tar file with the documentation, sources, compiled 
00211     binary, plus all required libraries except for four prerequisites
00212     that can be downloaded from the provided links.
00213   </p>
00214   
00215   <ul>
00216     <li>Web server (<a idref="Apache">Apache</a>)</li>
00217     <li>Relational Database (<a idref="MySQL">MySQL</a>)</li>
00218     <li>Java Software Development Kit (<a idref="Java">java.sun.com</a>)</li>
00219     <li>Servlet engine (<a idref="Jetty">Jetty</a> or <a idref="Tomcat">Tomcat</a>).</li>
00220   </ul>
00221 
00222   <p>
00223     See the <a idref="INSTALLATION">installation instructions</a>
00224     for how to proceed once you have the prerequisite software.
00225   </p>
00226 
00227 <h2>JWAA Applications</h2>
00228 
00229   <p>
00230     <a idref="Mybank">Mybank</a> is an ambitious digital rights
00231     management system based on <a idref="JWAA">JWAA</a> and 
00232     <a idref="Java+">Java+</a>.  
00233   </p>
00234     
00235   <p>
00236     <a idref="ALE">ALE</a> (Action Learing Environment) pioneered the 
00237     XML-based approach that was subsequently absorbed into its JWAA 
00238     substrate.  
00239   </p>
00240 
00241   <p>
00242     <a idref="ILE">ILE</a> (Interactive Learning Environment) is
00243     an ancestor of ALE that involved porting JWAA from Java to Ruby.  
00244     This project is now inactive because a servlet engine problem 
00245     that surfaced during the move to a new collocation provider.
00246   </p>
00247 
00248 </page>
00249 
00250 <page id="DOCUMENTATION" name="Documentation" requiresRole="none"
00251 title="Building web applications with JWAA" >
00252 <child idref="APPLICATIONS"/>
00253 <child idref="LOOKANDFEEL"/>
00254 <child idref="FORMS"/>
00255 <child idref="VELOCITY"/>
00256 <child idref="JAVA"/>
00257 
00258 <p>
00259   This documentation is divided into sections according to
00260   different levels of programming expertise:
00261 </p>
00262 
00263   <ol>
00264 
00265     <li>
00266       <a idref="APPLICATIONS">Application Builders</a> write the 
00267       static HTML content of an application by authoring them
00268       in XHTML gathered into Jwaa's XML format.
00269     </li>
00270 
00271     <li>
00272       <a idref="LOOKANDFEEL">Look and Feel Specialists</a> 
00273       define the look and feel for an application by revising the Velocity 
00274       macros and CSS (Cascading Style Sheets) that are provided.
00275     </li>
00276 
00277     <li>
00278       <a idref="VELOCITY">Interaction Specialists</a>
00279       make pages interactive by adding statements in the Velocity 
00280       programming language.
00281     </li>
00282 
00283     <li>
00284       <a idref="JAVA">Java Programmers</a> 
00285       use this section for extending the Java backend of this system.
00286     </li>
00287 
00288   </ol>
00289 
00290 </page>
00291 
00292 <page id="APPLICATIONS" name="Applications" requiresRole="none"
00293   title="Building a new JWAA Application" >
00294 
00295   <p>
00296     JWAA is capable of running multiple applications simultaneously.  
00297     Each application is defined by its own sub-directory of the 
00298     jwaa/root directory. Each application directory is required to
00299     provide a <a idref="application.xml">application.xml</a> file
00300     that points to the other files that make up that application.
00301   </p>
00302 
00303 <h2>The root/applicationName directory</h2>
00304 
00305   <p>
00306     For example, the pages you're reading now are provided by a JWAA
00307     application named "jwaa". This application is defined by the 
00308     root/jwaa directory. To build a new application, you simply 
00309     copy the root/jwaa directory to a new name and modify its contents 
00310     to be what you need. Don't change the jwaa directory.  Leave that 
00311     as it is to keep it is available for reference.
00312   </p>
00313 
00314   <p>
00315     The directory name determines the internal id of the application
00316     which determines the applicaton's URL. The first two components of 
00317     the url are defined by WEB-INF/web.xml as jwaa/xml. The third 
00318     component is application id, which is determined by the root 
00319     subdirectory name.  This tutorial is stored in root/jwaa, so the 
00320     tutorial application's id is jwaa.  Thus the jwaa tutorial's full
00321     URL is http://localhost/jwaa/xml/jwaa.
00322   </p>
00323 
00324   <p>
00325     These conventions are entirely governed by configuration files
00326     (typically etc/httpd/conf/httpd.conf and jwaa/WEB-INF/web.xml)
00327     so they can be easily changed according to the usual web server 
00328     and servlet engine conventions. To simplify this discussion, 
00329     these documents assume that the default settings are used.
00330   </p>
00331 
00332 <h2>application.xml</h2>
00333 
00334   <p>
00335     Right click on <a idref="application.xml">this link</a> 
00336     to open jwaa/root/jwaa/application.xml in a new browser window. 
00337     Notice that it specifies other files in the application's root 
00338     directory. 
00339   </p>
00340 
00341   <p>
00342     Notice that application.xml specifies two pages elements 
00343     with the ids outer and inner. The path attribute of these 
00344     elements specify the two files that define the jwaa application,
00345     outerPages.xml and innerPages.xml.  This discussion will be 
00346     concerned with outerPages.xml which defines the pages
00347     you're reading now. The other involves interactive features 
00348     that will be described separately.
00349   </p>
00350 
00351   <p>
00352     Each application's directory is contains an 
00353     <a idref="application.xml">application.xml</a> file that 
00354     specifies where other application components are stored. Open 
00355     that file now (right click to open it in a separate browser window). 
00356     Notice that three lines at the top specify the files that define 
00357     the JWAA documentation and the tutorial demonstration application.
00358   </p>
00359 
00360   <p>
00361     The macros element specifies the name of the file that defines
00362     the velocity macros (we'll be concerned with these in the
00363     next section), and the role element(s) designate the login ids
00364     that are able to access special administrative pages that
00365     are invisible (and unreachable) by ordinary users. We'll 
00366     describe those after we cover how ordinary static HTML
00367     content pages are defined.
00368   </p>
00369 
00370 <h2>Content Pages</h2>
00371 
00372   <p>
00373     Traditional pages are HTML files.  Jwaa pages, by contrast, are
00374     defined as elements inside XML files. Unlike HTML, each XML file
00375     file can define any number of pages.  The jwaa tutorial application 
00376     is defined by precisely two such files:
00377   </p>
00378 
00379   <ul>
00380 
00381     <li>
00382       <a idref="outerPages.xml">outerPages.xml</a> defines 
00383       the pages you're reading now. They are "outer" in the sense that they 
00384       lie outside of the demonstration application's login procedure.
00385     </li>
00386 
00387     <li>
00388       <a idref="innerPages.xml">innerPages.xml</a> defines 
00389       the pages of the demonstration application.  These are "inner" 
00390       in the sense that they cannot be accessed without registering 
00391       and logging in to the demonstration application. Most of these
00392       pages involve forms processing and will be described separately,
00393       under <a idref="FORMS">Forms Processing</a>.
00394     </li>
00395 
00396   </ul>
00397 
00398   <p>
00399     Which pages are defined in which files is arbitrary and entirely 
00400     up to the author's discretion. There is no significance to which 
00401     XML file a page is defined in. Page identifiers are maintained in 
00402     a single name space for each application, and the pages of that 
00403     application can reference each other freely, without concern for 
00404     which file they originated in.
00405   </p>
00406 
00407   <p>
00408     For example, open <a idref="outerPages.xml">outerPages.xml</a> 
00409     (right-click to open it in a separate window so you can continue
00410     reading these instructions).
00411     Notice that consists of a single large &lt;pages&gt;...&lt;/pages&gt; 
00412     (plural) element, that contains many &lt;page&gt;...&lt;/page&gt; 
00413     (singular) elements, each of which defines three attributes: 
00414   </p>
00415 
00416   <ul>
00417 
00418     <li>
00419       id: This is a string that will identifies the page to other pages.
00420       I recommend using uppercase identifiers to make them easy to find 
00421       with string searches.  
00422     </li>
00423 
00424     <li>
00425       name: This is the short name of the page as far as the end-user
00426       is concerned. It is visible in navigational menus, so keep it short 
00427       and meaningful.
00428     </li>
00429 
00430     <li>
00431       title: A longer string that will be presented at the top of each
00432       page as a &lt;h1&gt; header, and also as a title="" attribute in
00433       menu bars (which some browsers will present as a non-standard but
00434       useful rollover effect).
00435     </li>
00436 
00437   </ul>
00438 
00439   <p>
00440     The text within each page element is what'd normally goes in an 
00441     XHTML &lt;body&gt; element. The main difference is that they are 
00442     XHTML commands, not HTML commands.  They must comply with the 
00443     XHTML syntax requirements which are similar to HTML, but far 
00444     more strict. These differences are described <a idref="XHTML">here</a>.
00445   </p>
00446 
00447 <h2>Building a new application</h2>
00448 
00449   <p>
00450     To build a new application, copy an existing one and modify it 
00451     to suit. So begin by copying jwaa/root/jwaa to jwaa/root/myapp. 
00452     In your browser's location bar, replace the second jwaa with myapp 
00453     and click reload.  There will be a short delay as Jwaa loads the XML 
00454     files into memory, the page you're reading now will appear.  
00455     Click reload and notice that the page reloads much faster.
00456     The JWAA servlet continually watches the root directory for 
00457     new arrivals, so new arrivals are automatically on the air.
00458   </p>
00459 
00460   <p>
00461     Open jwaa/root/myapp/outerPages.xml in your text editor
00462     and search for the string <code>id="APPLICATIONS"</code>, which
00463     defines the page you're reading now. Insert a word or two in the 
00464     first paragraph, save the file, and click reload.  Notice that 
00465     the change appears in your browser window after a much shorter delay
00466     since only one file had to be reloaded for this change.
00467   </p>
00468 
00469 <h2>Correcting errors</h2>
00470 
00471   <p>
00472     The biggest difference between HTML and XHTML is that XHTML
00473     imposes strict syntax requirements. To see this in action,
00474     use your text editor to damage the file slightly (for example, by
00475     deleting the opening &lt;p&gt;). Save the result (but don't exit
00476     your text editor), and click reload in your browser. The browser 
00477     provides an error message pinpointing the error and requiring
00478     you to fix it.  Use your editor's undo function to repair
00479     the damage and reload the page in your browser to verify that
00480     the page now loads fine.
00481   </p>
00482 
00483 <h2>Required Pages</h2>
00484 
00485   <p>
00486     The only requirement JWAA does impose is that each application
00487     must define certain pages that the hard-coded part of the system
00488     refers to. These required identifiers are:
00489   </p>
00490 
00491   <ol>
00492 
00493     <li>
00494       OuterHomePage: The outer home page for the application as a whole.</li>
00495 
00496     <li>
00497       InnerHomePage: The inner home page. The first page a visitor
00498       sees when they pass the login procedure.
00499     </li>
00500 
00501     <li>
00502       PortalPage: The login and registration initiation page.
00503     </li>
00504 
00505     <li>
00506       NotFoundPage: A page to be displayed if a requested page is not
00507       found, for example, if the user mistyped the URL.
00508     </li>
00509 
00510     <li>
00511       RefusePage: A page to be displayed if the user requests a page
00512       their role doesn't allow them to see.
00513     </li>
00514 
00515   </ol>
00516 
00517     <p>
00518       Workable versions of these pages are all defined in innerPages.xml
00519       and will not concern us further here.
00520     </p>
00521 
00522   <h2>Optimizing for Production</h2>
00523 
00524     <p>
00525     The outer pages of an application don't usually change very often
00526     after they've been tested and installed, certainly not compared to 
00527     inner pages that might be computed almost entirely on the fly. 
00528     Furthermore outer pages are typically the ones you want to be 
00529     picked up and cataloged by search engines, unlike the inner ones.
00530   </p>
00531 
00532   <p>
00533     There are no firm rules as to which pages should be served dynamically,
00534     via the JWAA/Jetty servlet engine, versus which should be served
00535     statically by a web server. The practice I follow is to periodically
00536     save the application's OuterHomePage (dynamically generated) into
00537     an index.html file in the application's root directory, and to have
00538     all other pages refer to this static page instead of its dynamic
00539     address.
00540   </p>
00541 
00542   <p>
00543     For example, the dynamic version of JWAA's own home page is
00544     http://virtualschool.edu/jwaa/index.html. This is the page that
00545     is picked up by search engines, and is served as a static web 
00546     page by the apache web server. The same page is also accessible
00547     as a dynamically generated page at 
00548     http://virtualschool.edu/jwaa/xml/jwaa/OuterHomePage. The static
00549     version (index.html) is derived from the dynamic version by
00550     simply using the browser's saveAs function to update the static
00551     version when the dynamic version changes.
00552   </p>
00553 
00554 </page>
00555 
00556 <page id="LOOKANDFEEL" name="Look And Feel" requiresRole="none"
00557 title="Defining the application's Look and Feel"
00558 >
00559 
00560   <p>
00561     An application's look and feel is governed by the velocity.macros 
00562     file in the top level directory
00563     of your application, plus any the CSS (Cascading Style Sheet)
00564     definitions that the macros use, which are typically stored in
00565     your application's css directory in the same location. 
00566   </p>
00567 
00568   <p>
00569     For example, see the \#defaultLogic() and \#header macros in
00570     <a idref="velocity.macros">velocity.macros</a>. 
00571     Controller automatically inserts calls to these at the
00572     beginning of each page's text and a call to the \#footer()
00573     macro at the end. Velocity simply replaces the call statements 
00574     with the text defined in the macros.
00575   </p>
00576 
00577   <p>
00578     Make experimental changes to these macros (keep them simple for
00579     now) and reload the browser to observe the effect. Then browse
00580     several pages and notice that changes to these macros have global 
00581     effects, automatically propagating to every page in your application.
00582   </p>
00583 
00584   <p>
00585     Notice that the \#header() macro includes a &lt;link command
00586     that tells the browser to load css/innerPage.css and
00587     css/print.css. These define additional page markup conventions
00588     that I also rely on to further adjust the application's look and
00589     feel. CSS markup is a separate topic that I'm still learning 
00590     myself. See the Reference list for more information on CSS.
00591   </p>
00592 
00593 <h2>References</h2>
00594 
00595   <ol>
00596 
00597     <li>
00598       <a href="http://jakarta.apache.org/velocity/user-guide.html"> 
00599       Velocity User's Guide</a> is the most relevant.
00600     </li>
00601 
00602     <li>
00603       <a href="http://www.w3schools.com/css/default.asp">CSS 
00604       Tutorial</a> by W3Schools.
00605       </li>
00606 
00607   </ol>
00608 
00609 </page>
00610 
00611 <page id="FORMS" name="Forms" requiresRole="none"
00612   title="Persistent Forms" >
00613 
00614   <p>
00615     Forms are defined with the usual XHTML form, input and select
00616     statements... with important differences stemming from the
00617     need to not only define the form presentation (as in XHTML),
00618     but also logic for processing that form once submitted.
00619   </p>
00620 
00621   <p>
00622     Persistent form support is under development and rapidly changing.  
00623     I'll upgrade this documentation as the design stabilizes.  See the 
00624     PORTAL and UPDATE pages of <a idref="innerPages.xml">innerPages.xml</a> 
00625     for how to code forms in the traditional (manual) way within JWAA.
00626   </p>
00627 
00628 <h2>Persistent Form Example</h2>
00629 
00630   <p>
00631     See the FORMS element in <a idref="outerPages.xml">outerPages.xml</a>
00632     for this test case for the persistent forms feature.
00633   </p>
00634 
00635   <form id="DEMO_FORM">
00636     <logic>
00637 #set($op = $form.getValue("op"))
00638 #if ($op)
00639     $form.save()
00640     #if ($op eq "Prev")
00641       $self.gotoPage($self.getPrevPage().getId())
00642     #elseif ($op eq "Next")
00643       $self.gotoPage($self.getNextPage().getId())
00644     #end
00645 #end
00646     </logic>
00647 
00648     <table align="center">
00649       <tr>
00650         <td>Text Fields </td>
00651         <td>
00652           <input name="textField" type="text" />
00653         </td>
00654       </tr>
00655       <tr>
00656         <td>Password Fields </td>
00657         <td>
00658           <input name="passwordField" type="password" />
00659         </td>
00660       </tr>
00661       <tr>
00662         <td>Radio Selection Fields </td>
00663         <td>
00664           <input name="radioFieldName" value="Yes" type="radio"/> Yes
00665           <input name="radioFieldName" value="No" type="radio"/> No
00666           <input name="radioFieldName" value="Maybe" type="radio"/> Maybe
00667         </td>
00668       </tr>
00669       <tr>
00670         <td>Checkbox Fields </td>
00671         <td>
00672           <input name="checkboxField" value="Yes" type="checkbox"/> Yes
00673           <input name="checkboxField" value="No" type="checkbox"/> No
00674           <input name="checkboxField" value="Maybe" type="checkbox"/> Maybe
00675         </td>
00676       </tr>
00677       <tr>
00678         <td>Single Selection Fields</td>
00679         <td>
00680           <select name="singleSelectionField">
00681             <option>Yes</option>
00682             <option>No</option>
00683             <option>Maybe</option>
00684           </select>
00685         </td>
00686       </tr>
00687       <tr>
00688         <td>Multiple Selection Fields </td>
00689         <td>
00690           <select name="multipleSelectionField" multiple="multiple">
00691             <option>Yes</option>
00692             <option>No</option>
00693             <option>Maybe</option>
00694           </select>
00695         </td>
00696       </tr>
00697       <tr>
00698         <td> Text Area Fields </td>
00699         <td>
00700           <textarea name="textareaField" rows="2" cols="15"></textarea>
00701         </td>
00702       </tr>
00703       <tr>
00704         <td>Submit Buttons </td>
00705         <td>
00706           <input name="op" value="Prev" type="submit"/>
00707           <input name="op" value="Save" type="submit"/>
00708           <input name="op" value="Next" type="submit"/>
00709         </td>
00710       </tr>
00711     </table>
00712 
00713   </form>
00714 
00715   <p>
00716     To try it, change the field contents, click one of the Submit 
00717     buttons and notice that the changes persist when you return,
00718     just as the information on paper remains when you look at it later. 
00719   </p>
00720 
00721   <p>
00722     If the server is heavily loaded, what you see depends on 
00723     whether you've logged (via the <a idref="PORTAL">Demo login screen</a>).  
00724     Visitors who haven't logged in share the same account and 
00725     their modifications to persistent forms affect the same
00726     database records, so persistent form contents will be as 
00727     the last visitor set them.  So if you're not logged in, 
00728     persistent forms behaves like blackboards that can be 
00729     read, written on, or erased by anyone that walks by. 
00730     If you have logged in, forms behave like paper that is
00731     under your sole control.  We assume both cases are 
00732     potentially useful.
00733   </p>
00734 
00735   <p>
00736     The contents of each field persist as records in a relational 
00737     database (MySQL) keyed with the page id, the field name, and
00738     the user's ID. Users who have not logged in via the 
00739     <a idref="PORTAL">Demo login screen</a> share the same account
00740     and have concurrent access to the same database fields.  JWAA
00741     does not prevent such users from overwriting each other's work
00742     on the grounds that blackboards and paper have the same liability
00743     but are still useful in education.
00744   </p>
00745 
00746   <p>
00747     The persistence feature applies only to form elements that
00748     do <i>not</i> define explicit values. It does not apply
00749     to text or password fields with value attributes, to checkbox,
00750     radio, and select fields with checked attributes and so forth).
00751     It can be turned off in forms that should not be persistent 
00752     (login screens and so forth) by simply defining explicit values.
00753   </p>
00754 
00755 <h2>Unresolved Issues</h2>
00756 
00757   <p>
00758     I'm eager to support persistence at the lowest architectural 
00759     level because persistent forms are such a powerful unit of 
00760     reuse... for exactly the same reasons that paper and blackboards
00761     are so useful in education. They are lowest-level building blocks 
00762     that support many concrete interactive applications. I've 
00763     supported them experimentally to validate the truth of this
00764     claim in practice.
00765   </p>
00766 
00767   <p>
00768     By contrast, <a idref="ALE">ALE</a> provides workflow features 
00769     that model the paper workflow in classrooms. The instructor develops
00770     quizzes and passes them to students, who write answers on them and 
00771     return them to the teacher, who grades them and returns them to students
00772     to read the teacher's feedback.  ALE's support for such workflow 
00773     has not been ported to JWAA because that is clearly inappropriate
00774     at JWAA's level.  
00775   </p>
00776 
00777   <p>
00778     I'm not sure of where to draw this boundary. So the persistent
00779     forms feature has been added provisionally. The goal is to 
00780     investigate whether persistent forms belong at the JWAA level 
00781     in the absence of ALE's workflow support. If not, I'll 
00782     remove it from JWAA and support it only within ALE.
00783   </p>
00784 
00785   <p>
00786     I'm not entirely satisfied with how navigational controls (the Prev,
00787     Save, and Next buttons in this example) are handled. ALE provides 
00788     these automatically and consistently as part of its workflow 
00789     support, so no effort is needed to present them everywhere they 
00790     are needed.  This can't be done at JWAA's level since the default 
00791     navigational controls would clash with the user's page design.
00792   </p>
00793 
00794   <p>
00795     I welcome other opinions on these issues.  Share them via email with
00796     <a href="mailto:bcox@virtualschool.edu">bcox@virtualschool.edu</a>.
00797   </p>
00798 
00799 </page>
00800 
00801 <page id="VELOCITY" name="Velocity" requiresRole="none"
00802   title="Programming with Velocity">
00803 
00804   <p>
00805     Velocity is a language for accessing objects provided
00806     to it by the Java part of the system. The following objects 
00807     are automatically available to velocity code via velocity's
00808     "context".  For further information see the 
00809     <a idref="ObjectReferenceManual">ObjectReferenceManual</a>.
00810   </p>
00811 
00812   <dl>
00813 
00814     <dt>\$self</dt>
00815 
00816     <dd>
00817       \$self provides access to the <a idref="Controller">Controller</a>
00818       for the page that is currently being displayed. The controller 
00819       provides methods that velocity scripts use to access other objects 
00820       in the page's neighborhood, such as 
00821       the <a idref="PageElement">PageElement</a> that defines this page,
00822       the <a idref="PagesElement">PagesElement</a> in which this page
00823       was defined, 
00824       the page's <a idref="ApplicationElement">ApplicationElement</a>, 
00825       and more. 
00826     </dd>
00827 
00828     <dt>\$account</dt>
00829 
00830     <dd>
00831       \$account provides access to information about the account
00832       that is currently logged in. From this you can determine
00833       their name, address, phone number, and similar information 
00834       from the registration procedure.
00835     </dd>
00836 
00837     <dt>\$dbms</dt>
00838 
00839     <dd>
00840       Each application maintains a pool of connections to the
00841       application's database as a <a idref="DBPool">DBPool</a> 
00842       instance. The controller automatically withdraws a database 
00843       connection (a <a idref="DB">DB</a> instance) from the pool 
00844       and makes that instance available to velocity code as the 
00845       $dbms context variable. 
00846     </dd>
00847       
00848     <dd>
00849       Your code can use this variable to access the database by 
00850       calling the public methods that DB provides for this purpose. 
00851       The controller automatically either commits any transactions 
00852       that finish successfully (and rolls back those those that 
00853       fail; i.e. those that throw exceptions). Finally it returns
00854       the DB instance to the pool for reuse.
00855     </dd>
00856 
00857     <dt>$form</dt>
00858 
00859     <dd>
00860       The $form variable is null if the page contains no &lt;form&gt;
00861       element and an instance of <a idref="FormElement">FormElement</a>
00862       if it does. This may change in future releases such that form
00863       elements can be accessed via the \$self or \$self.page variables.
00864     </dd>
00865 
00866   </dl>
00867 
00868 <h2>Velocity Hints</h2>
00869 
00870   <p>
00871     Velocity statements like \$self.application don't access 
00872     the Controller's "application" field directly. Velocity 
00873     automatically treats such statements as if written
00874     \$self.getApplication(), which calls the Controller's 
00875     getApplication() method to return the value.  In other 
00876     words, fields are never accessed by Velocity code, 
00877     only methods, and then only those methods that 
00878     are explicitly public.
00879   </p>
00880 
00881   <p>
00882     But always remember that methods are general-purpose functions
00883     that can (and often do) make permanent changes to their environment.
00884     Such methods are said to have <i>side-effects</i>. This is actually
00885     quite useful, for it is how velocity scripts affect their environment.
00886   </p>
00887 
00888 </page>
00889 
00890 
00891 <page id="JAVA" name="Java" requiresRole="none" title="Java Programmer's Guide" >
00892   <child idref="OVERVIEW" />
00893   <child idref="MODELS" />
00894   <child idref="FIELDS" />
00895   <child idref="ROLES" />
00896 
00897 <p>
00898   Simple JWAA websites can be built entirely in XML and Velocity, without 
00899   exploring the Java end of this system more deeply than reading the
00900   <a idref="ObjectReferenceManual">ObjectReferenceManual</a> for Java 
00901   class descriptions.  However the Java source code must be documented 
00902   for those who wish to explore it.  And some things, such as extending 
00903   the system with new persistent objects, are only really practical in 
00904   Java.
00905 </p>
00906 
00907 <h2>Prerequisites</h2>
00908 
00909 <p>
00910   Begin by downloading and installing the following tools from the
00911   specified links:
00912 </p>
00913 
00914 <ol>
00915 
00916   <li>
00917     <a idref="Eclipse">Eclipse</a>: Eclipse is the main tool for
00918     reading Java source code, making changes, correcting mistakes,
00919     compiling source code to executable class files, debugging 
00920     running programs, and viewing data structures 
00921     while the program is running. The best version to download
00922     is version 2.1.1: the later "milestone" versions are too 
00923     buggy to count on in my experience. Also avoid plugins:
00924     they are even more problematic than eclipse.
00925   </li>
00926 
00927   <li>
00928     <a idref="Ant">Ant</a>: Ant is a command line tool that is
00929     used for everything Eclipse doesn't do: compiling documentation
00930     from source code (via doxygen), building jar files from 
00931     individual class files, copying files from the build directory
00932     to the deployment directory, maintaining backup copies, 
00933     building distribution (.tgz) files, and so forth. 
00934   </li>
00935 
00936 </ol>
00937 
00938 <p>
00939   Install ant and eclipse where ever you please (I use /opt)
00940   and make scripts to launch them conveniently. Here's the script 
00941   I use for launching eclipse (the Fixme comment marks
00942   two lines to edit to suit your system).
00943 </p>
00944 
00945 <pre>
00946 #!/bin/sh
00947 
00948 # Fixme
00949 ECLIPSE_DIR=/opt/eclipse-2.1.1
00950 WORKSPACE_DIR=~/workspace
00951 
00952 # Launch eclipse
00953 cd $WORKSPACE_DIR
00954 $ECLIPSE_DIR/eclipse -data $WORKSPACE_DIR $* &amp;
00955 echo $ECLIPSE_DIR starting ... 
00956 </pre>
00957 
00958 <p>
00959   The WORKSPACE_DIR line overrides eclipse's annoying behavior
00960   of creating a default workspace inside eclipse's program 
00961   directory. "Workspace" in eclipse's term for the directory
00962   that it uses to store <b>your</b> source code. Its not eclipse's
00963   code, its <b>yours</b>, and you want to control where its stored
00964   rather than leaving that up to eclipse. My preference is for the
00965   workspace to be in my home directory which is where the default
00966   settings in the above script puts it.
00967 </p>
00968 
00969 <h2>Importing JWAA into Eclipse</h2>
00970 
00971 <p>
00972   Launch eclipse, pull down the Window menu, and choose 
00973   Preferences. Click the triangle by Java in the left panel
00974   to open it, click Compiler, and select the "Folders" option
00975   under "Source and output folder". Leave the default source
00976   folder name ("src") and output folder name ("bin") as they
00977   are.  Click "OK". Eclipse will now create new projects with 
00978   src and bin folders, which matches the convention I'll use in 
00979   this document.
00980 </p>
00981 
00982 <p>
00983   Right click in the left panel (Package Explorer) and click
00984   "New Project". Choose "Java" in the popup panel and click Next.
00985   Type "JWAA" as the project name and click Finish. JWAA will now
00986   appear in the left panel as a new but empty project.
00987 </p>
00988 
00989 <p>
00990   Right click on the JWAA project in the left pane and choose
00991   Import. Browse to the installed copy of JWAA, double-click it
00992   and JWAA should appear in the left pane with an empty checkbox.
00993   Eclipse is somewhat unreliable here; often the left pane doesn't
00994   change when you select a directory. Clicking the back button and
00995   advancing with the Next button appears to resolve it. Once JWAA
00996   appears in the left panel with the empty checkbox, click the 
00997   checkbox to select it and click finish. A red checkbox signifying
00998   compile errors will appear in the left panel. The errors are OK:
00999   you haven't defined libraries yet.
01000 </p>
01001 
01002 <p>
01003   Right-click on the imported project and choose Properties. In the
01004   left panel of the window that appears, click "Java Build Path".
01005   Select the Libraries pane and click "Add Jars". Click JWAA,
01006   then WEB-INF, then lib, and drag-select all of the jar files 
01007   that are offered there. Click OK. A few errors will remain
01008   because you've not provided the servlet engine's libraries yet.
01009 </p>
01010 
01011 <h2>Importing Jetty into Eclipse</h2>
01012 
01013 <p>
01014   Repeat all of the above steps to import Jetty into a separate
01015   "Jetty" project in your workspace. Use "Add Jars" in the Jetty
01016   project until Jetty compiles without errors. Right-click on your 
01017   JWAA project, choose Properties again, and this time select the
01018   "Projects" tab. Checkboxes for the JWAA and Jetty projects should
01019   appear there. Select the checkbox next to the Jetty project to
01020   specifies that Eclipse should use the bin directory of the Jetty
01021   project to resolve unsatisfied references in addition to the jar
01022   files you specified earlier.  JWAA should build now without errors 
01023   and the red mark in the left pane will disappear.
01024 </p>
01025 
01026 <p>
01027   Recall that Jetty refers to symbolic links (or outright copies)
01028   in its webapps subdirectory to determine which servlets it should
01029   load, and it expects each such link (or copy) to contain a WEB-INF
01030   directory.  When Eclipse copied Jetty to its workspace, it copied 
01031   Jetty's webapps directory along with the symbolic link you made earlier.
01032   This link points to the original copy of JWAA in the document root 
01033   directory. You want this copy of Jetty to load files from the
01034   copy of JWAA in your workspace. So delete the jwaa copy and replace 
01035   it with a new symbolic link to the JWAA in your workspace 
01036   directory, like this:
01037 </p>
01038 
01039 <pre>
01040 cd ~/workspace/Jetty/webapps
01041 # notice the old jwaa copy
01042 ls -l                         
01043 # remove the old jwaa copy
01044 rm -rf jwaa                   
01045 # create a symbolic link to workspace/jwaa
01046 ln -s ~/workspace/jwaa/ jwaa  
01047 </pre>
01048 
01049 <p>
01050   Jetty will load jar files from the WEB-INF/lib directory and 
01051   individual class files from the WEB-INF/classes directory.
01052   The WEB-INF/lib directory already contains a copy of the 
01053   jwaa.jar that came with the distribution. Since you'll be
01054   making changes to the jwaa source code, you want the changed
01055   versions to be loaded, not the original distributed version.
01056   The simplest way to ensure this is to create a symbolic link,
01057   named classes, in the WEB-INF directory that points to the
01058   bin directory in which Eclipse stores its generated files,
01059   like this:
01060 </p>
01061 
01062 <pre>
01063 cd ~/workspace/jwaa/WEB-INF
01064 ln -s ../bin classes
01065 </pre>
01066 
01067 <h2>Launching Jetty from inside Eclipse</h2>
01068 
01069 <p>
01070   Back to Eclipse now. Pull down the Run menu, choose
01071   Debug, and a window will appear. Under Main, in the
01072   Project area, click the Browse button and select the 
01073   Jetty project. In the "Main class" area, choose Search,
01074   and select org.mortbay.start.Main as the main routine
01075   Eclipse should invoke to launch Jetty.
01076 </p>
01077 
01078 <p>
01079   In the Arguments tab, type the full path to the jetty.xml
01080   file in Jetty's etc directory. This is 
01081   /home/bcox/workspace/jetty/etc/jetty.xml in my case.
01082 </p>
01083 
01084 <p>
01085   In the Classpath tab, use Add Jars to add all of the jars
01086   in Jetty's lib directory. Then use Add Projects to add
01087   all of the projects that you'll be working with, just jwaa
01088   in this case. 
01089 </p>
01090 
01091 <p>
01092   Finally, click Apply, then Debug. Jetty should launch 
01093   without errors and display its normal startup dialog 
01094   in the console window at the bottom of the screen. 
01095   If any errors are displayed, it is probably because these
01096   instructions missed a required jar. Another common problem
01097   is trying to run muliple copies of jetty, which won't work.
01098   You must shut down any external copies for the new one
01099   to launch.
01100 </p>
01101 
01102 <p>
01103   Jetty is now running within Eclipse, and JWAA is running as
01104   a servlet within Jetty, and all facilities of both are accessible
01105   to the Eclipse debugger. Confirm that JWAA is accessible within
01106   Jetty by opening a browser window on http://localhost/jwaa and
01107   confirming that browsing to subpages work as before.
01108 </p>
01109 
01110 <p>
01111   Now let's set a breakpoint. In the Java Source browser (click the
01112   J icon on the left edge, open the jwaa project (click the triangle),
01113   open its src folder, and open the edu.virtualschool.jwaa.xml folder.
01114   Double-click on Controller.java and view the source code in the middle 
01115   pane. In the right pane, click on the run() method, which is the
01116   code that services each page request. Find the line that reads
01117   "send(evalText)" near the end of this method, and double-click in
01118   the blue margin next to this method. A blue dot will appear, signifying
01119   that a breakpoint has been set on this statement. 
01120 </p>
01121 
01122 <p>
01123   In your browser, click any link to request a new page. Eclipse will
01124   switch automatically to its Debug view with the selected statement
01125   highlighted in a smaller source window. The window above that will
01126   show a backtrace of the method calls that led to this point. Click
01127   on these and observe that the source code shown in the bottom window
01128   changes to show the clicked method. Click on the run method again
01129   and notice that all variables that were scope at the point of the 
01130   breakpoint is available for browsing. For example, pageText shows
01131   the XML code for the selected page before it was processed by
01132   velocity, and evalText shows the text as processed by velocity
01133   just before the send() method sends it to the browser.
01134 </p>
01135 
01136 <p>
01137   In other words, every aspect of the program is exposed to view
01138   and subject to modification: not just the source code but the
01139   actual run-time data while the code is running. It can't be
01140   any easier than that!
01141 </p>
01142 
01143 </page>
01144 
01145 <page id="OVERVIEW" name="Overview" requiresRole="none" 
01146   title="Overview of the Java side of this system" >
01147 
01148 <p>
01149   See the <a idref="ObjectReferenceManual">ObjectReferenceManual</a> 
01150   for Java class descriptions.  This section provides an overview of 
01151   and suggestions for modifing and extending these classes.
01152 </p>
01153 
01154 <h2>Startup-time Processing</h2>
01155 
01156 <p>
01157   JWAA's main entry point is the init() method of 
01158   <a idref="JwaaServlet">JwaaServlet</a>, a subclass of 
01159   <a idref="GenericServlet">GenericServlet</a> from which it 
01160   inherits most of its methods.
01161 </p>
01162 
01163 <p>
01164   The JwaaServlet constructor initializes a dispatch
01165   table with a list of <a idref="MetaPage">MetaPage</a> 
01166   instances, one for each GenericServlet instance in the system. 
01167   With Java+, each page is an instance of Page and each defines 
01168   a MetaPage as a reference point for other pages to use when 
01169   emitting links to that page. When the XML feature of JWAA is 
01170   used, this table contains only a single instance; an instance of 
01171   <a idref="Controller">Controller</a> that is shared by all pages.  
01172   This instance serves as the controller for all JWAA pages, 
01173   dispatching requests in a manner similar to the usual JWAA 
01174   dispatching machinery, but based on the id defined for each
01175   page in the XML files.
01176 </p>
01177 
01178 <p>
01179   The init method retrieves several init parameters defined in
01180   the jwaa/WEB-INF/web.xml file and that locate the other parts
01181   of the system:
01182 </p>
01183 
01184 <ul>
01185 
01186   <li>
01187     url.prefix: This makes the application aware the URL prefix string. 
01188     This parameter should be hand-constructed by concatenating the 
01189     servlet name and url pattern (defined elsewhere in this file).
01190     By default, the servlet name is /jwaa and the url pattern is /xml/*,
01191     so the url.prefix is /jwaa/xml. Like all settings in this file,
01192     this can be changed if desired.
01193   </li>
01194 
01195   <li>
01196     home.directory: The absolute path to jwaa's installation directory.
01197     By default, this refers to a symbolic link in the system root
01198     directory, /jwaa, that points to the real installation directory.
01199   </li>
01200 
01201   <li>
01202     root.directory: The absolute path to jwaa's root directory.
01203     By default, /jwaa/root.
01204   </li>
01205 
01206   <li>
01207     properties.directory: The absolute path to the directory the
01208     class loader will load properties files from. By default,
01209     /jwaa/WEB-INF/classes.
01210   </li>
01211 
01212 </ul>
01213 
01214 <p>
01215   The init() method passes root.directory as an argument to
01216   the <a idref="RootDirectory">RootDirectory</a> class's constructor. Each 
01217   subdirectory of the jwaa/root directory is required to contain an
01218   application.xml file that locates any other files used
01219   by that application. The application.xml files are
01220   not loaded at init time. It and the files it refers to 
01221   are loaded when they are first referenced so that any 
01222   errors can be reported via the browser, not hidden in 
01223   log files.
01224 </p>
01225 
01226 <h2>Load-time Processing</h2>
01227 
01228 <p>
01229   The directory names in jwaa/root determine the id's for
01230   each application. Browser requests are of the form
01231   /jwaa/xml/applicationID/pageID.  The JwaaServlet doRequest
01232   method (inherited from GenericServlet) uses the /jwaa/xml 
01233   component as the key for a dispatch table lookup, which
01234   selects the (sole) dispatch table entry for Controller.
01235   If the search fails, the search returns 
01236   JwaaServlet.getDefaultPage(), which specifies the same
01237   class, so the MetaPage entry for Controller has no real
01238   signficance.
01239 </p>
01240 
01241 <p>
01242   The doRequest() method creates an instance of Controller
01243   calls that instance's init() method to initialize
01244   the instance with the MetaPage instance, servlet, 
01245   HttpRequest and HttpResponse, and calls the instance's
01246   run() method to handle the request.
01247 </p>
01248 
01249 <p>
01250   The instance's run method retrieves the servlet from its init 
01251   parameters and calls its getRoot() method to retrieve the root 
01252   object for that servlet. The rest of the request string
01253   (/applicationID/pageID) is passed to the root's findPath()
01254   method to determine the application and the page within
01255   that application. If the application is not found, an error
01256   is reported.
01257 </p>
01258 
01259 <p>
01260   XML loading is triggered from within the root object's findPath() 
01261   method. The <a idref="RootDirectory">RootDirectory</a> class maintains a HashMap
01262   of the application instances that it built when it last scanned
01263   the root directory and a <a idref="FileField">FileField</a>
01264   instance that records the root directory's path and last modification 
01265   time. If the current modtime is greater than the last modtime,
01266   the directory is rescanned, ensuring that new applicaions will be 
01267   noticed and added to the HashMap.
01268 </p>
01269 
01270 <p>
01271   The HashMap entries are instances of <a idref="ApplicationElement">ApplicationElement</a>
01272   each of which maintains the information specified in a specific application.xml
01273   file along, a FileField that records when that file was last changed, 
01274   and a list of <a idref="PagesElement">PagesElement</a> instances, one for each pages
01275   element in that file.  The FileField is examined each time that 
01276   instance's update() method is called. If the FileField is out of date, 
01277   Otherwise, the file is reloaded to pick up any changes. Either way, the
01278   update() request is conveyed to each PagesElement instance.
01279 </p>
01280 
01281 <p>
01282   Each PagesElement instance also maintains a FileField for its XML file
01283   and a list of the Page instances specified in that file. If the
01284   FileField is up to date, the update() request returns immediately.
01285   Otherwise the file is reloaded and the list of Page instances is
01286   rebuilt.
01287 </p>
01288 
01289 <p>
01290   XML file loading at all levels involves using JDOM in the usual
01291   manner to populate instance variables with the information conveyed
01292   in the file.
01293 </p>
01294 
01295 <h2>Dispatch-time Processing</h2>
01296 
01297 <p>
01298   Jetty calls JwaaServlet's (inherited) doRequest() method for
01299   each URL request that makes its way to the servlet engine from
01300   Apache. This includes only those that match the servlet-name
01301   and url-mapping defined in web.xml; all others are by 
01302   definition intercepted by Apache.
01303 </p>
01304 
01305 <p>
01306   The doRequest() method calls request.getRequestURI() to
01307   obtain the request URI from the request parameters. This is
01308   looked up in the (empty) dispatch table, which always fails, so
01309   JwaaServlet's getDefaultPage() method is called which always
01310   returns the metapage of Controller. JwaaServlet constructs an 
01311   instance of Controller and initializes it with the Controller's 
01312   metapage, the JwaaServlet instance, and the request/response 
01313   parameter objects). Finally the Controller's run method is called 
01314   to service the request.
01315 </p>
01316 
01317 <h2>Controller</h2>
01318 
01319 <p>
01320   Controller is the primary interface between the
01321   Java and Velocity sides of the system. It holds the execution
01322   state that governs communication with the browser
01323   (request/response and servlet parameters) and links to the page
01324   being served in this transaction. The page instance in turn
01325   references its container, a pages instance, which in turn
01326   references its parent, and so on, until the parent links
01327   converge on the application and thereby the parent of all applications,
01328   the RootDirectory object. In other words, the page instance can be
01329   traversed (via methods the Controller provides to make this
01330   convenient) to reach the other objects in the system.
01331 </p>
01332 
01333 <p>
01334   The Controller processes each request by passing the
01335   pathInfo string to the getPath() method of the RootDirectory instance,
01336   expecting a page instance in return. The RootDirectory instance breaks
01337   each request into (up to) three slash-separated identifiers;
01338   application, pages, and page. The application id specifies a
01339   application, the pages id is looked up in its pagesMap to
01340   determine a PagesElement instance, and the page id is looked
01341   up in its pageMap to determine the Page instance. If all three
01342   lookups succeed, the resulting Page instance is returned, else
01343   various shorthands and defaults are employed to ensure that a
01344   valid Page instance is always returned (although not 
01345   necessarily the one that the user requested).
01346 </p>
01347 
01348 <h2>XML Loading/Reloading</h2>
01349 
01350 <p>
01351   RootDirectory's getPath() method calls its update() method which
01352   handles loading of XML pages and reloading them when they are
01353   changed. Only four JWAA classes manage files directly: RootDirectory
01354   (which monitors application directory names, not files), 
01355   <a idref="ApplicationElement">ApplicationElement</a>
01356   <a idref="PagesElement">PagesElement</a> and 
01357   <a idref="PageElement">PageElement</a>.
01358   All others are derived from elements of the
01359   above files. These four classes each maintain a FileField
01360   instance that contains the path to the file and the last
01361   modification time of that file. Each update() compares this
01362   with the file's current modtime and reloads that object from 
01363   XML if the current modtime is greater than the stored one.
01364 </p>
01365 
01366 <p>
01367   The XML loading process is straightforward. The XML parsing
01368   involves using JDOM and the libraries that support it to
01369   parameterize constuctors for each of the Java model classes
01370   from XML attributes. The Page class's constructor walks the
01371   element tree completely, rewriting JDOM's question-and-answer
01372   elements into Velocity macro calls, then call's JDOM's
01373   Outputter class to convert its DOM tree to an ordinary string,
01374   which is mainted thereafter in an instance variable. No XML
01375   parsing occurs thereafter; its all done once when JWAA first 
01376   notices the file has changed.
01377 </p>
01378 
01379 <h2>Permission Checking</h2>
01380 
01381 <p>
01382   Once the Controller receives a Page instance from the RootDirectory
01383   lookup process, it compares the pages requiredCapability
01384   instance variable (it is set in the XML file) with the
01385   capabilities of the account requesting that page. If the account
01386   has the required capability, the access is allowed. Otherwise
01387   the page is replaced with the application's refuse page. (as
01388   shipped, JWAA's refuse page silently forwards the user to the
01389   login page, which I find less offensive than the usual "access 
01390   refused" alert and has much the same effect.)
01391 </p>
01392 
01393 <h2>Database Access</h2>
01394 
01395 <p>
01396   The Controller initializes an instance variable with a JDBC
01397   database connection from the connection pool (inside a try
01398   block with a finally clause to return it to the pool when
01399   finished with it). Then it uses that connection to initialize
01400   two HashMap variables, answerMap and reviewMap, with the
01401   answers to each question asked on that page, and the reviews of
01402   each answer, for the convience of the velocity macros that 
01403   present questions, answers, and reviews to the student.
01404 </p>
01405 
01406 <h2>Velocity Context</h2>
01407 
01408 <p>
01409   The Controller builds an instance of VelocityContext for
01410   each request and initializes it with (1) \$self: the Controller
01411   instance, (2) \$account: the account that is currently logged
01412   in, and (3) any form parameters.
01413 </p>
01414 
01415 <h2>Velocity Dispatching</h2>
01416 
01417 <p>
01418   Finally the page's text is retrieved from the Page instance
01419   and passed (with the context object) to an instance of
01420   VelocityEngine. Each application manages separate VelocityEngine
01421   instances so that each can have its own directory, 
01422   velocity.macros files, and so forth.
01423 </p>
01424 
01425 <p>
01426   The VelocityEngine essentially transforms the string passed
01427   to it by processing velocity commands embedded therein against
01428   the context information according to well-defined rules,
01429   returning a new string as the result. The Controller simply
01430   sends this string to the browser as (X)HTML text where it gets 
01431   handled as usual.
01432 </p>
01433 
01434 <h2>Database (Bean or Model) Objects</h2>
01435 
01436 <p>
01437   The JWAA demo uses a single persistent object,
01438   <a idref="DemoAccountBean">DemoAccountBean</a>, which manages account
01439   information in a single table, Account, in the
01440   JWAA database.  Each row manages the name and address
01441   information of a specific user. This table is populated by
01442   the login/registration process and modifed thereafter 
01443   by the account update service.  
01444 </p>
01445 
01446 </page>
01447 
01448 <page id="MODELS" name="Models" requiresRole="none"
01449   title="Models are an application's persistent memory" >
01450 
01451 <p>
01452   Model (aka "Bean") classes manage an application's data 
01453   as database tables. The demo's model class is <a
01454     idref="DemoAccountBean">DemoAccountBean</a>.  
01455   <i>Fields are to models as atoms are to molecules.</i>. This 
01456   means that models are not defined in terms of raw Java types 
01457   such as Strings. Rather the models' instance variables and method
01458   arguments are declared in terms of objects that abide by the
01459   <a idref="Validatable">Validatable</a> interface. Since Validatable objects are
01460   typically implemented as subclasses of <a idref="GenericField">GenericField</a>, 
01461   they are called <i>Field</i> classes.
01462 </p>
01463 
01464 </page>
01465 
01466 <page id="FIELDS" name="Fields" requiresRole="none"
01467   title="Fields are the atoms; models the molecules" >
01468 
01469   <p>
01470     Models are made of Fields not Strings. Strings are avoided 
01471       because:
01472   </p>
01473 
01474 <ul>
01475 
01476   <li>
01477     Fields are uniquely reusable units of reuse because they
01478     are so concrete, immediately tangible and visible to everyone 
01479     in the application's user interface
01480   </li>
01481 
01482   <li>
01483     Fields encapsulate the rules for determining whether
01484     user-provided inputs comply with the syntactical validity
01485     constraints of that field. Centralizing this logic in
01486     reusable field classes makes applications much simpler than
01487     the traditional approach of distributing this logic 
01488     throughout the application.
01489   </li>
01490 
01491   <li>
01492     Each field can enforce DBMS-specific constraints, such as 
01493     the maximum length of fixed-length fields.
01494   </li>
01495 
01496 </ul>
01497 
01498 <p>
01499   The JWAA package provides a <a idref="Validatable">Validatable</a> interface,
01500   which defines the protocol that all field implementations
01501   adhere to. It also provides an abstract <a idref="GenericField">GenericField</a> that 
01502   defines methods for subclasses to inherit.
01503 </p>
01504 
01505 <p>
01506   Typically you'd define your database to use the field
01507   lengths specified by these classes. If not you should edit the
01508   classes to match. Only U.S. address and phone numbers are
01509   provided. Revisions to support international usage would 
01510   be gratefully accepted.
01511 </p>
01512 
01513 </page>
01514 
01515 <page id="ROLES" name="Roles" requiresRole="none"
01516 title="Roles determine who can see what pages" >
01517 
01518 <p>
01519   Since each application is likely to have unique requirements
01520   for determining who is allowed to access each page, JWAA
01521   capability system is extendible. The demonstration uses the 
01522   simple three-level role system defined in 
01523   <a idref="GenericRole">GenericRole</a> and
01524   <a idref="RoleAbstraction">RoleAbstraction</a>.
01525 </p>
01526 
01527 <ul>
01528 
01529   <li>
01530     Visitor: for visitors whose identity is unknown because 
01531     they've not registered and logged on.
01532   </li>
01533 
01534   <li>
01535     Registered: for visitors that have registered and logged on.
01536   </li>
01537 
01538   <li>
01539     Admin: a privileged account permitted to access 
01540     administrative functions.
01541   </li>
01542 
01543 </ul>
01544 
01545 <p>
01546   The pages of a web application can be thought of as an outer 
01547   lobby with pages that everyone is welcome to read (logged in or not)
01548   plus an inner sanctum with pages that can only be accessed by those 
01549   who have logged in. The "portal" is the passage between them; the 
01550   guard station through which visitors pass to be identified by 
01551   the login procedure.  
01552 </p>
01553 
01554 <p>
01555   The demo application's inner sanctum consists of only three pages 
01556   to keep the demo as simple as possible: <a idref="UPDATE">UPDATE</a> 
01557   supports editing an account's registration information, 
01558   <a idref="LOGOUT">LOGOUT</a>, supports logging out, and 
01559   <a idref="ADMIN">ADMIN</a> lets administrative users view the database.
01560 </p>
01561 
01562 <p>
01563   <a idref="PORTAL">PORTAL</a> is the doorway between the two regions.
01564   If a visitor has not logged in, they browse as the account 
01565   AccountAbstraction.Null, the account for unknown visitors.
01566 </p>
01567 
01568 <p>
01569   When the visitor identifies themselves to the login
01570   procedure (in the demo, by providing a previously registered
01571   email address, but more typically, by also providing the
01572   corresponding password), <a idref="PORTAL">PORTAL</a> loads the account's
01573   persistent information from the database as an instance of
01574   <a idref="AccountAbstraction">AccountAbstraction</a> and stores a reference to this
01575   instance as a specially named session attribute. The session
01576   attribute persists as the user browses from page to page. It
01577   will only be erased by the LogoutPage, if the session times 
01578   out, or if the server itself is restarted.
01579 </p>
01580 
01581 <p>
01582   Notice that <a idref="DemoAccountBean">DemoAccountBean</a> implements the
01583   <a idref="AccountAbstraction">AccountAbstraction</a> interface, which requires that all
01584   subclasses provide a isCapable(Capability c) method. The system
01585   calls this method to determine if a given account has the 
01586   capability level in the method's argument.
01587 </p>
01588 
01589 <ul>
01590 
01591   <li>
01592     <a idref="LOOKANDFEEL">LookAndFeel</a> will refuse to show links to that
01593     page in the navigation bar. This lets the page hierarchy,
01594     which governs the navigation bar, be specified without
01595     concern for account capabilities, since the navigation bar
01596     will offer only the links that the viewer is allowed to 
01597     access.
01598   </li>
01599 
01600   <li>
01601     <a idref="GenericServlet">GenericServlet</a> redirects requests from viewers
01602     with inadequate capabilities by redirecting them to the page
01603     specified by the servlet's getRefusePage() method. This is a
01604     second line of defense to ensure that unauthorized visitors 
01605     can't bypass the protection by editing requests by hand.
01606   </li>
01607 
01608 </ul>
01609 
01610 </page>
01611 
01612 <page id="LICENSE" name="License" requiresRole="none"
01613   title="JWAA Open Source License" >
01614 
01615 <h2><a href="http://www.opensource.org">Open Source</a> Artistic License</h2>
01616 
01617 <p>
01618   This states the conditions under which JWAA may be copied,
01619     such that the Copyright Holder maintains artistic control over 
01620     its development while giving its users the right to use and 
01621     distribute the Package and the right to make reasonable modifications.
01622 </p>
01623 
01624 <h2>Definitions:</h2>
01625 
01626 <ul>
01627 
01628   <li>
01629     "Package" refers to the collection of files distributed by
01630     the Copyright Holder as the 
01631 
01632     <a idref="JWAA">Java Web Application Architecture (JWAA)</a> and 
01633     derivatives of that collection created through textual modification.
01634   </li>
01635 
01636   <li>
01637     "Copyright Holder" is Brad J. Cox, Ph.D., 9940 Bent Tree
01638 
01639         Lane, Manassas VA 20111.
01640     </li>
01641 
01642     <li>
01643       "Standard Version" refers to such a Package if it has not
01644     been modified, or has been modified in accordance with the
01645 
01646     wishes of the Copyright Holder.
01647   </li>
01648 
01649   <li>
01650     "You" is you, if you're thinking about copying or
01651 
01652         distributing this Package.
01653     </li>
01654 
01655     <li>
01656       "Reasonable copying fee" is whatever you can justify on the
01657     basis of media cost, duplication charges, time of people
01658     involved, and so on. (You will not be required to justify it to
01659     the Copyright Holder, but only to the computing community at
01660 
01661     large as a market that must bear the fee.)
01662   </li>
01663 
01664   <li>
01665     "Freely Available" means that no fee is charged for the
01666     item itself, though there may be fees involved in handling the
01667     item. It also means that recipients of the item may
01668     redistribute it under the same conditions they received
01669 
01670     it.
01671   </li>
01672 
01673 </ul>
01674 
01675 <h2>Terms</h2>
01676 
01677 <p>
01678   1. You may make and give away verbatim copies of the source
01679   form of the Standard Version of this Package without restriction,
01680   provided that you duplicate all of the original copyright notices
01681 
01682   and associated disclaimers.
01683 </p>
01684 
01685 <p>
01686   2. You may apply bug fixes, portability fixes and other
01687   modifications derived from the Public Domain or from the
01688   Copyright Holder. A Package modified in such a way shall still be
01689 
01690   considered the Standard Version.
01691 </p>
01692 
01693 <p>
01694   3. You may otherwise modify your copy of this Package in any
01695   way, provided that you insert a prominent notice in each changed
01696   file stating how and when you changed that file, and provided
01697 
01698   that you do at least ONE of the following:
01699 </p>
01700 
01701 <ul>
01702 
01703   <li>
01704     place your modifications in the Public Domain or otherwise
01705     make them Freely Available, such as by posting said
01706     modifications to Usenet or an equivalent medium, or placing the
01707     modifications on a major archive site such as ftp.uu.net, or by
01708     allowing the Copyright Holder to include your modifications in
01709 
01710     the Standard Version of the Package.
01711   </li>
01712 
01713   <li>
01714     use the modified Package only within your corporation or
01715 
01716         organization.
01717     </li>
01718 
01719     <li>
01720       rename any non-standard executables so the names do not
01721     conflict with standard executables, which must also be
01722     provided, and provide a separate manual page for each
01723     non-standard executable that clearly documents how it differs
01724 
01725     from the Standard Version.
01726   </li>
01727 
01728   <li>
01729     make other distribution arrangements with the Copyright
01730 
01731         Holder.
01732     </li>
01733 
01734 </ul>
01735 
01736 <p>
01737   4. You may distribute the programs of this Package in object
01738   code or executable form, provided that you do at least ONE of the
01739 
01740   following:
01741 </p>
01742 
01743 <ul>
01744 
01745   <li>
01746     distribute a Standard Version of the executables and
01747     library files, together with instructions (in the manual page 
01748     or equivalent) on where to get the Standard Version.
01749   </li>
01750 
01751   <li>
01752     accompany the distribution with the machine-readable source 
01753         of the Package with your modifications.
01754     </li>
01755 
01756     <li>
01757       accompany any non-standard executables with their
01758     corresponding Standard Version executables, giving the
01759     non-standard executables non-standard names, and clearly
01760     documenting the differences in manual pages (or equivalent),
01761     together with instructions on where to get the Standard 
01762     Version.
01763   </li>
01764 
01765   <li>
01766     make other distribution arrangements with the Copyright 
01767         Holder.
01768     </li>
01769 
01770 </ul>
01771 
01772 <p>
01773   5. You may charge a reasonable copying fee for any
01774   distribution of this Package. You may charge any fee you choose
01775   for support of this Package. You may not charge a fee for this
01776   Package itself. However, you may distribute this Package in
01777   aggregate with other (possibly commercial) programs as part of a
01778   larger (possibly commercial) software distribution provided that
01779 
01780   you do not advertise this Package as a product of your own.
01781 </p>
01782 
01783 <p>
01784   6. The scripts and library files supplied as input to or
01785   produced as output from the programs of this Package do not
01786   automatically fall under the copyright of this Package, but
01787   belong to whomever generated them, and may be sold commercially,
01788 
01789   and may be aggregated with this Package.
01790 </p>
01791 
01792 <p>
01793   7. C or perl subroutines supplied by you and linked into this
01794 
01795     Package shall not be considered part of this Package.
01796 </p>
01797 
01798 <p>
01799   8. The name of the Copyright Holder may not be used to endorse
01800   or promote products derived from this software without specific
01801 
01802   prior written permission.
01803 </p>
01804 
01805 <p>
01806   9.Aggregation of this Package with a commercial distribution
01807   is always permitted provided that the use of this Package is
01808   embedded; that is, when no overt attempt is made to make this
01809   Package's interfaces visible to the end user of the commercial
01810   distribution. Such use shall not be construed as a distribution
01811 
01812   of this Package.
01813 </p>
01814 
01815 <p>
01816   10. THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS
01817   OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
01818   WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR 
01819   PURPOSE.
01820 </p>
01821 </page>
01822 
01823 <page id="SOURCE" name="Source" requiresRole="none"
01824   title="JWAA Source Browser">
01825 
01826   <p>
01827     These links lead to documentation for configuration files and 
01828     Java classes as generated by <a idref="Doxygen">doxygen</a>.
01829   </p>
01830 
01831 <dl>
01832 
01833 <dt>Configuration Files (jwaa/root/jwaa)</dt> 
01834 
01835 <dd>#foreach($f in ["application.xml", "innerPages.xml", "outerPages.xml", "velocity.macros"])
01836 <a href="$self.link($f)">$f</a>
01837 #end
01838 </dd>
01839 
01840 <dt>Core (edu.virtualschool.jwaa) </dt> 
01841 
01842 <dd>#foreach($f in ["Config", "Fault", "GenericIdentifiable",
01843   "GenericLookAndFeel", "GenericPage", "GenericAccount", "GenericServlet",
01844   "GenericURI", "IgnorableFault", "Image", "IntervalTimer", "IOFault",
01845   "MetaPage", "AccountAbstraction", "RoleAbstraction", "Role", "RuntimeFault", "ServletFault", "StreamUtil", "StringUtil", "TimeUtil", "TreeNode", "UnixUtil", "UserFault", "Visitor"])
01846 <a href="$self.link($f)">$f</a>
01847 #end
01848 </dd>
01849 
01850 <dt>XML (edu.virtualschool.jwaa.xml)</dt> 
01851 
01852 <dd>#foreach($f in [ "ApplicationElement", "FormElement", 
01853   "FileNotFoundFault", "IOFault",
01854   "PageElement", "PagesElement",
01855   "RootElement", "PageNotFoundFault", "ValidationFault", "VelocityEngine", "XMLFault", "Controller", "JwaaServlet", "XMLUtil"])
01856 <a href="$self.link($f)">$f</a>
01857 #end
01858 </dd>
01859 
01860 <dt>DBMS (edu.virtualschool.jwaa.dbms)</dt> 
01861 
01862 <dd>#foreach($f in ["DB", "DBPool", "DBQuery", "DBUpdate", "DBUtil"])
01863 <a href="$self.link($f)">$f</a>
01864 #end
01865 </dd>
01866 
01867 <dt>Fields (edu.virtualschool.jwaa.field)</dt> 
01868 <dd>#foreach ($f in ["FileField", "CityField", "ClassField", "CommaSeparatedField", "CountryField", "DoubleField", "EmailField", "FieldUtil", "GenericField", "IdentifierField", "IDField", "IntegerField", "LongField", "NameField", "OpField", "PassField", "PathField", "PhoneField", "StreetField", "TextField", "UrlField", "USStateField", "Validatable", "YesNoField", "ZipcodeField"]) 
01869 <a href="$self.link($f)">$f</a>
01870 #end
01871 </dd>
01872 
01873 </dl>
01874 </page>
01875 
01876 <page id="INSTALLATION" name="Installation" requiresRole="none"
01877   title="Installation and Configuration Instructions" >
01878   <child idref="CONFIGURATION"/>
01879   <child idref="TROUBLESHOOTING"/>
01880 
01881 <h2>Prerequisite Software</h2>
01882 
01883   <p>
01884     We'll assume this prerequisite software is already installed
01885     and propertly configured. Each comes with its own instructions,
01886     which won't be repeated here.
01887   </p>
01888 
01889   <ol>
01890 
01891     <li>
01892       <a idref="Apache">Apache</a> (or equivalent) web server.
01893     </li>
01894 
01895     <li>
01896       <a idref="MySQL">MySQL</a>: Any recent version that supports 
01897       transactions (InnoDB) will do. Other relational databases may work 
01898       with minor changes but this has not been tested.  Be sure to 
01899       assign a root password as described in its instructions. Confirm 
01900       that it is working properly before proceeding.
01901     </li>
01902 
01903     <li>
01904       <a idref="Java">Java</a>: Download a recent version of the
01905       Java Software Development Kit (SDK). Avoid the Java Runtime 
01906       Environment version (JRE) which is significantly smaller but 
01907       only capable of running Java, not compiling it.
01908     </li>
01909 
01910     <li>
01911       <a idref="Jetty">Jetty</a> or <a idref="Tomcat">Tomcat</a>:
01912       Jetty is smaller and faster. Either will do.
01913     </li>
01914 
01915   </ol>
01916 
01917   <p>
01918     You will need these installed on the private computer you'll use 
01919     to test your work privately and also on the public server you'll
01920     copy your work to so others can see it.  I'll refer to the first
01921     machine as your <i>development</i> or <i>private</i> machine and 
01922     the other as your <i>deployment</i> or <i>public</i>machine.
01923   </p>
01924 
01925 <h2>The JWAA Distribution Directory Structure</h2>
01926 
01927   <p>
01928     Unpack the distribution archive in your web server's document root 
01929     directory.  If this is /var/www/html, you'd type:
01930   </p>
01931 
01932   <pre>
01933   cd /var/www/html
01934   tar zxf path/to/jwaa.tgz 
01935   </pre>
01936 
01937   <p>
01938     This will create a new directory, /var/www/html/jwaa,
01939     that will be called the <i>installation</i> directory
01940     or simply <i>jwaa</i> for brevity. This directory contains:
01941   </p>
01942 
01943   <dl>
01944 
01945   <dt>root, root/jwaa</dt>
01946 
01947   <dd>
01948     The subdirectories of the jwaa/root directory define each JWAA 
01949     application.  JWAA is intially distributed with one such 
01950     subdirectory, jwaa/root/jwaa. This defines the pages you're
01951     reading now as three XML files.  
01952     <a idref="application.xml">application.xml</a> 
01953     defines the application as a whole, 
01954     <a idref="outerPages.xml">outerPages.xml</a>
01955     defines the external pages (the pages that are accessible
01956     without logging in) and 
01957     <a idref="innerPages.xml">innerPages.xml</a> 
01958     defines the inner pages (the demo application which requires
01959     logging in via the <a idref="PORTAL">Demo</a> link at the top 
01960     right of each page.).
01961   </dd>
01962 
01963   <dd>
01964     The root directory can be moved if you want by changing the line
01965     that defines its location in WEB-INF/web.xml.
01966   </dd>
01967 
01968   <dt>WEB-INF</dt>
01969 
01970   <dd>
01971     The servlet deployment directory contains a web.xml file
01972     for the JWAA servlet and a lib directory.  The lib directory 
01973     contains jwaa.jar with jwaa's java components plus the libraries
01974     that jwaa.jar depends on. These include the latest versions of
01975     commons-collections.jar, gnu-regexp-1.1.4.jar, jaxen-core.jar, 
01976     jaxen-jdom.jar, jdom.jar, junit.jar, jwaa.jar, log4j-1.2.8.jar, 
01977     mysql-connector-java-3.0.10-stable-bin.jar, saxpath.jar,
01978     velocity-1.5-dev.jar, xerces.jar, and xml-apis.jar. All are
01979     standard packages except for velocity. The a pre-release 
01980     version is included which repairs an incompatibility between
01981     Velocity and XML entity syntax by accepting "and" as a synonym
01982     for the problematic &amp;&amp;.
01983   </dd>
01984 
01985   <dt>sql</dt>
01986 
01987   <dd>
01988     This directory contains a MySQL script that you'll use to define
01989     the JWAA database.
01990   </dd>
01991 
01992   <dt>src</dt>
01993 
01994   <dd>
01995     This directory contains the source for the Java components of the
01996     JWAA distribution
01997   </dd>
01998 
01999   <dt>index.html</dt>
02000 
02001   <dd>
02002     The JWAA home page is distributed as a conventional static html
02003     file, index.html. Confirm that this page is accessible at the url
02004     <a href="http://localhost/jwaa">http://localhost/jwaa</a>. The
02005     links inside this page will not be accessible until Apache has
02006     been configured to route them to the servlet engine and the servlet
02007     engine has been configured to route them to the JWAA servlet.
02008   </dd>
02009 
02010   <dd>
02011     Once these configuration steps have been completed, the JWAA home
02012     page will also be accessible as a dynamic page at the URL
02013     <a href="http://localhost/jwaa/xml/jwaa/OUTER">http://localhost/jwaa/xml/jwaa/OUTER</a>.
02014     The index.html file is periodically generated by browsing the dynamic
02015     URL and saving the result as index.html. This ensures that the
02016     home page is accessible even when the servlet engine is down
02017     and makes this page accessible to search engines that might be 
02018     unable to access servlet-based pages.
02019   </dd>
02020 
02021   </dl>
02022 
02023 <h2>MySQL Initialization</h2>
02024 
02025   <p>
02026     These instructions assume that MySQL has been installed by
02027     following its own instructions and is working propertly. 
02028     All that remains is defining a database for JWAA to use,
02029     defining a MySQL user with ownership rights for that
02030     database, assigning that user a secure password, and 
02031     conveying this information to JWAA by editing jwaa's
02032     application.xml file.
02033   </p>
02034 
02035   <p>
02036     The sql directory contains a sql script, initialize_jwaa_database.sql.
02037     This script initializes the jwaa database (dropping any existing one; 
02038     careful!) and creates a user, jwaa, with full permissions on that 
02039     database.  Edit the script before using it. AT THE VERY LEAST change 
02040     the password to something secret! Then run the script by typing:
02041   </p>
02042 
02043   <pre>
02044   mysql &lt;sql/initialize_jwaa_database.sql 
02045   </pre>
02046 
02047   <p>
02048     Then specify the same password in the jdbc section of 
02049     root/jwaa/application.xml. JWAA uses JDBC and should work 
02050     with any database but this has not been tested. 
02051   </p>
02052 
02053   <p>
02054     See <a href="CONFIGURATION">the configuration instructions</a>
02055     for how to configure these systems to work together properly.
02056   </p>
02057 
02058   </page>
02059 
02060   <page id="CONFIGURATION" name="Configuration" requiresRole="none"
02061     title="Configuring Apache, Servlet Engine, and JWAA" >
02062 
02063   <p>
02064     Jetty contains its own HTTP server so Apache isn't actually necessary.
02065     However many installations will prefer to let Apache's C code service 
02066     static web pages and route only the specific URLs that require dynamic 
02067     behavior to Jetty, which being written in Java, is arguably not as fast.
02068   </p>
02069 
02070   <p>
02071     Apache's world consists of an incoming stream of slash-delimited names 
02072     which Apache treats as pathnames to files within its document root 
02073     directory. If the requested file exists, Apache returns that file to 
02074     the browser, else it returns an error message. 
02075   </p>
02076 
02077   <p>
02078     This is an oversimplification because Apache is (almost) infinitely 
02079     configurable.  Our first task is to configure Apache to treat URLs 
02080     beginning with a specially designated prefix differently, passing 
02081     URLs that begin with that prefix to the Java servlet engine 
02082     for processing. Then we'll do the same thing with the servlet
02083     engine by choosing an additional segment of URL prefix that tells
02084     the servlet engine to route those URLs to JWAA. JWAA will handle
02085     the rest, mapping the next URL segment to an application and the
02086     final one to a specific page within that application.
02087   </p>
02088 
02089   <p>
02090     For example, the URL of the page you're viewing now is
02091     http://virtualschool.edu/jwaa/xml/jwaa/INSTALLATION.
02092     Ignore the initial piece, http://virtualschool.edu, and
02093     focus on the remainder: /jwaa/xml/jwaa/INSTALLATION.
02094     We will configure Apache to route all URLs beginning
02095     with the first two pieces, /jwaa/xml, to the servlet engine. 
02096     Then we'll configure the servlet engine to route URLs
02097     beginning with the third piece, /jwaa, to a specific
02098     JWAA servlet. This servlet uses the remainder, 
02099     /jwaa/INSTALLATION to pick a specific application
02100     and a specific page within that application.
02101   </p>
02102 
02103   <p>
02104     All of these choices are arbitrary and can be changed
02105     by the appropriate configuration file changes. We'll omit
02106     this flexibility in what follows to make the discussion
02107     as concrete as possible.
02108   </p>
02109 
02110 <h2>Define fixed virtual locations for jetty, html and jwaa</h2>
02111 
02112   <p>
02113     Since the jetty, html and jwaa directories are often in 
02114     different locations on private vs public machines, I 
02115     recommend using symbolic links to define fixed locations 
02116     for them in the system root directory. These instructions 
02117     will assume the following symbolic links are in place. 
02118     The instructions for tomcat in lieu of jetty are exactly 
02119     the same; just change names as appropriate.
02120   </p>
02121 
02122   <pre>
02123 cd / # as root
02124 ln -s path/to/jetty /jetty
02125 ln -s path/to/document/root /html
02126 ln -s path/to/jwaa /jwaa
02127   </pre>
02128 
02129 <h2>Configure Apache to delegate JWAA urls to Jetty</h2>
02130 
02131   <p>
02132     You'll need root (supervisor) privileges for this step.
02133     Open Apache's main configuration file (/etc/httpd/conf/httpd.conf 
02134     on Linux) in a text editor. Be sure that mod_proxy is enabled in 
02135     the LoadModule section. Then go to the very end of the file and 
02136     add the following lines:
02137   </p>
02138 
02139   <pre>
02140   ProxyPass /jwaa/xml/ http://localhost:8085/jwaa/xml/
02141   ProxyPassReverse / http://localhost:8085/ 
02142   </pre>
02143 
02144   <p>
02145     This tells apache to treat all urls beginning with
02146     /jwaa/xml/ specially, by routing them to the url 
02147     localhost:8085/jwaa/xml. The second line sets up an inverse
02148     routing in a fashion I don't understand well enough to explain.
02149     Both are required. We'll be configuring jetty to handle
02150     requests at this address. The 8085 is the port number
02151     we'll configure Jetty to use.  It can be any port that 
02152     is not otherwise used.
02153   </p>
02154 
02155   <p>
02156     Another way of doing the same thing is described in the
02157     apache documentation as "Enabling mod-jk" or similar. I've
02158     tried this way repeatedly and have always derailed in a maze 
02159     of broken links, "file not found" errors, and demands to
02160     recompile Apache. The technique I've described works reliably
02161     for every servlet engine I've tried without the pain so I 
02162     use it for all my work. If the mod-jk technique works for 
02163     you, by all means use it.
02164   </p>
02165 
02166   <p>
02167     Restart the server so that the configuration file changes 
02168     are recognized.  If errors are reported, fix them before proceeding.
02169   </p>
02170 
02171   <pre>
02172   apachectl graceful
02173   </pre>
02174 
02175 <h2>Configure Jetty (or Tomcat) to handle delegated urls</h2>
02176 
02177   <p>
02178     Go to jetty's installation directory and open etc/jetty.xml
02179     in your text editor. Search for the string "addListener". Note
02180     that the existing code installs a Jetty listener on port 8080. 
02181     I recommend changing this port number to free 8080 up for other
02182     servlet engines to use. So change all occurrences of 8080 to
02183     8085, the port we instructed Apache to delegate Jetty urls to
02184     above.
02185   </p>
02186 
02187   <p>
02188     Ensure that the home.directory and root.directory init
02189     parameters in jwaa/WEB-INF/web.xml are suitable for your
02190     system. They will be if you followed the advice above.
02191   </p>
02192 
02193   <p>
02194     Install JWAA as a jetty servlet by creating a symbolic link 
02195     to /jwaa in jetty's webapps directory:
02196   </p>
02197 
02198   <pre> 
02199   cd /jetty/webapps
02200   ln -s /jwaa jwaa
02201   </pre>
02202 
02203   <p>
02204     Restart jetty to load the jwaa servlet.
02205   </p>
02206 
02207   <pre>
02208   jetty supervise
02209   </pre>
02210 
02211   <p>
02212     These instructions should now be browseable at the
02213     URL http://localhost:8080/jwaa. 
02214   </p>
02215 
02216 <h2>Initialize the JWAA Tutorial Database</h2>
02217 
02218   <p>
02219     JWAA's convention is that each application has its own database,
02220     and each database is owned by a user whose name is the same as
02221     the database. So the database for the JWAA tutorial is named jwaa
02222     and its owned by a user named jwaa. The sql directory contains a
02223     mysql script, initialize_ale_database.sql for creating this
02224     database and defining this user with the correct 
02225     privileges.
02226   </p>
02227 
02228   <p>
02229     Open initialize_jwaa_database.sql with a text editor and
02230     review it carefully before using. The only change you MUST make
02231     is to change the password to something secret. Make the
02232     corresponding change in jwaa/root/jwaa/application.xml. When
02233     all is correct tell mysql to execute the edited script.
02234   </p>
02235 
02236   <pre>
02237   edit jwaa/sql/initialize_jwaa_database.sql 
02238   edit jwaa/root/jwaa/application.xml
02239   mysql &lt;sql/initialize_jwaa_database.sql 
02240   </pre>
02241 
02242   <p>
02243     You'll need to do this for each application that you create. Its
02244     a good idea to keep these scripts in the sql directory, and to 
02245     give each one a unique application name.
02246   </p>
02247 
02248 <h2>Start (or restart) Jetty</h2>
02249 
02250   <p>
02251     Jetty's bin directory contains a script (jetty.sh) for
02252     starting and resetarting the servlet engine. This script
02253     requires you to be in Jetty's root directory which is not
02254     convenient. I copy this script to my bin directory and
02255     modify it to add a <code>cd ${JETTY_HOME}</code>line at the 
02256     beginning. Make the copied script executable and change its 
02257     name from jetty.sh to jetty.
02258   </p>
02259 
02260   <pre>
02261   cp jetty/bin/jetty.sh ~/bin/jetty 
02262   chmod a+rx ~/bin/jetty
02263   </pre>
02264 
02265   <p>
02266     Stop jetty if its already running and restart it in
02267     supervise mode. This will send its log messages to your
02268     terminal (instead of hiding them in a log file, typically
02269     jetty/logs) which is more convenient when you're not sure what 
02270     to expect.
02271   </p>
02272 
02273   <pre>
02274   jetty stop
02275   jetty supervise
02276   </pre>
02277 
02278   <p>
02279     Observe the log and ensure that the output is normal as shown below.
02280     If errors are reported fix them before proceeding.
02281   </p>
02282 
02283   <pre>
02284 # jetty supervise
02285   12:28:22.512 EVENT  Checking Resource aliases
02286   12:28:27.129 EVENT  Statistics on = false for org.mortbay.jetty.Server@9ced8e
02287   12:28:27.138 EVENT  Starting Jetty/4.2.x
02288   12:28:27.193 EVENT  Started org.mortbay.http.NCSARequestLog@1fd6bea
02289   12:28:28.016 EVENT  Started WebApplicationContext[/template,RootDirectory WebApp]
02290   12:28:28.327 WARN!! Delete existing temp dir /tmp/Jetty__8085__template for WebA
02291   pplicationContext[/template,RootDirectory WebApp]
02292   12:28:29.003 EVENT  file:/home/bcox/workspace/jetty/webapps/jwaa/ anti-aliased t
02293   o file:/home/bcox/workspace/jwaa/
02294   12:28:29.353 EVENT  Started WebApplicationContext[/jwaa,JWAA Servlet]
02295   12:28:29.359 WARN!! Delete existing temp dir /tmp/Jetty__8085__jwaa for WebAppli
02296   cationContext[/jwaa,JWAA Servlet]
02297   1 [main] INFO edu.virtualschool.jwaa.xml.JwaaServlet  - Initializing Jwaa/XML ser
02298   vlet
02299   10 [main] INFO edu.virtualschool.jwaa.xml.JwaaServlet  - watching log4j propertie
02300   s = /jwaa/WEB-INF/classes/log4j.properties
02301   12:28:31.002 WARN!! Delete existing temp dir /tmp/Jetty__8085__javadoc for WebAp
02302   plicationContext[/javadoc,jar:file:/home/bcox/workspace/jetty/webapps/javadoc.wa
02303   r!/]
02304   12:28:31.449 EVENT  Extract jar:file:/home/bcox/workspace/jetty/webapps/javadoc.
02305   war!/ to /tmp/Jetty__8085__javadoc/webapp
02306   12:28:33.581 EVENT  Started WebApplicationContext[/javadoc,jar:file:/home/bcox/w
02307   orkspace/jetty/webapps/javadoc.war!/]
02308   12:28:33.613 EVENT  Started SocketListener on 0.0.0.0:8085
02309   12:28:33.614 EVENT  Started org.mortbay.jetty.Server@9ced8e
02310   </pre>
02311 
02312   <p>
02313     The log4j warning is useless and should be ignored. The rest 
02314     is normal jetty blather.
02315   </p>
02316 
02317 </page>
02318 
02319 <page id="TROUBLESHOOTING" name="Trouble Shooting" requiresRole="none"
02320   title="Troubleshooting Installation/Configuration Problems" >
02321 
02322   <p>
02323     Getting Apache, Jetty, and JWAA to cooperate can be like pushing
02324     a rope. They put flexibility for experts well ahead of stiffness, 
02325     the no-excuses reliability everyone else values above all. Here 
02326     are a few off-the-cuff tips for diagnosing problems.
02327   </p>
02328 
02329 <dl>
02330 
02331   <dt>Log Files</dt>
02332 
02333   <dd>
02334     Apache, Jetty, Mysql and JWAA all provide log files. These
02335     are your main tool for diagnosing problems. Unfortunately the
02336     log files have wildly different names and are stored at
02337     wildly different locations in your file system so finding
02338     them can be an exercise in itself. For example, on my linux
02339     system, apache's logs are at /var/log/httpd, mysql's are at
02340     /var/lib/mysql, jetty's are at /opt/jetty/logs, and JWAA's are
02341     at /var/www/html/jwaa/logs. Track them down and create
02342     symbolic links so you can find them them all without having 
02343     to rummage around.
02344   </dd>
02345 
02346   <dd>
02347     Hint: the unix <code>tail -f path/to/log/file</code>command is 
02348     invaluable for keeping an eye on important logfiles as they change.  
02349     Learn it and use it!
02350   </dd>
02351 
02352 <dt>URL not found errors</dt>
02353 
02354   <dd>
02355     The hardest part is getting apache, jetty and jwaa to route the right
02356     urls to each other.  Approach it step by step.  If http://localhost/jwaa 
02357     works, apache is finding the index.html file in the jwaa directory of 
02358     apache's document root directory.  If http://localhost/jwaa/xml/jwaa 
02359     works, the proxy line changes in apache's httpd.conf file are routing 
02360     urls with that prefix to jetty.  Beyond that, its a matter of studying 
02361     the log files to see who is dropping the ball.
02362   </dd>
02363 
02364 </dl>
02365 
02366 </page>
02367 
02368 <page id="CHANGES" name="Changes" requiresRole="none"
02369 title="Change History" >
02370 
02371 <p>
02372   An informal running diary of recent changes with indications 
02373   of things to come (as time allows).
02374 </p>
02375 
02376 <dl>
02377 
02378 <dt>Unreleased</dt>
02379 
02380   <dd>
02381     Started development of DTD. Application.dtd completed, but
02382     pages.dtd is not. The W3C "Modularation of XHTML" notion 
02383     is almost impossible to understand, and absolutely so in
02384     the case of XSchema. DTD seems more feasible, but just barely.
02385   </dd>
02386 
02387   <dd>
02388     Cleaned up generated XML to pass w3c's validator. 100%
02389     solid now except for three problems that seem to be caused
02390     by the use of privoxy on the development machine. These
02391     should affect only those who validate privoxied output.
02392   </dd>
02393 
02394   <dd>
02395     Moved all XPath instances to private static variables
02396     on the chance that XPath allocations are expensive. 
02397     The documentation implies that they are.
02398   </dd>
02399 
02400 <dt>Version 2.0: Mar 2004</dt>
02401 
02402   <dd>
02403     Major revision to convert the demo and cover pages to feature 
02404     XML-based HTML in lieu of the Java+ precompiler technique used 
02405     to date.  Java+ support is still in place (several of my 
02406     applications rely on it). It is not featured in the JWAA 
02407     documentation because <a idref="Java+">Java+</a> now has 
02408     its own web page. 
02409   </dd>
02410 
02411   <dd>
02412     Support for persistent forms has been ported from ALE to JWAA 
02413     on a provisional (experimental) basis. Further changes in
02414     this area are likely. See <a idref="FORMS">Persistent
02415     Forms</a> for more information.
02416   </dd>
02417 
02418   <dd>
02419     I'm very satisfied with the XML code but dissatisfied
02420     with Velocity as the embedded programming language. I don't like 
02421     the culture (Jakarta) that produced it (too many opinions, too 
02422     little maturity, inept sense of software style, etc). The Velocity 
02423     code seems ad-hoc and poorly thought out. Its macro support 
02424     is inept and is incompatible with the XML approach because 
02425     velocity output does not pass through the XML handling code. 
02426     Velocity error reporting strategy is inconsistent, ignoring errors
02427     in places, throwing exceptions in others. There is no way to 
02428     access constructors or static methods, which makes it almost 
02429     impossible to use Fields in any reasonable way. Velocity sticks 
02430     out like a sore thumb. I'm sick of it.
02431   </dd>
02432 
02433   <dd>
02434     The only stuck with it this long because I've been unable to 
02435     find a suitable replacement. I investigated FreeMarker but
02436     its input syntax is explicitly incompatible with XML and they
02437     are committed to it regardless.  I've tried using JRuby and 
02438     JPython as alternatives, but these were too buggy at the time 
02439     and imposed severe performance and size implications. 
02440   </dd>
02441 
02442   <dd>
02443     All of these "embedded language" approaches violate the XML
02444     spirit by "hiding" executable code as XML text strings. I might
02445     wind up taking "purist" approach by defining XML elements for 
02446     if, foreach, set, etc. The syntax implications of trying to
02447     wedge programming statements into a data representation language
02448     are sufficiently nasty that I've avoided this approach.
02449     It might well turn out to be the best road in the end.
02450   </dd>
02451 
02452   <dd>
02453     I temporarily removed the XPATH("..//@href") logic that
02454     automatically subjects all href attributes to URL-rewriting.
02455     Interference with the URLs in the Source page. There was a
02456     conflict between the XML and Velocity views of the world no
02457     doubt. To be revisited when I get this release out the door.
02458   </dd>
02459 
02460   <dd>
02461     Need more work to ensure that we're emitting pure XHTML; i.e.
02462     that we're catching all JWAA additions and replacing all of them 
02463     with compliant XHTML code. May have missed some here and there.
02464   </dd>
02465 
02466 <dt>Feb 2004</dt>
02467 
02468   <dd>
02469     As a hint of things to come, I'm considering moving support
02470     pioneered in <a idref="ALE">Action Learing Environment</a> into 
02471     JWAA so all applications can inherit it. Although JWAA's explicit
02472     goal is to make web applications as easy to build as conventional 
02473     ones, a thorny problem has remained: web applications exist in two
02474     worlds; one containing the program and the other, the html
02475     data.
02476   </dd>
02477 
02478   <dd>
02479     The first shot at repairing this difference was the 
02480     <a idref="Java+">Java+ Preprocessor</a>, which provided a
02481     simple syntax for maintaining html data right inside program
02482     space. Although the whole idea is abhorrent to separation of
02483     concern zealots, this actually worked well in single-developer
02484     shops such as mine and is far more efficient in both space and
02485     time. I'd probably be doing it this way yet were it not for one 
02486     single snag: eclipse integration.
02487   </dd>
02488 
02489   <dd>
02490     The JWAA system came at it from an entirely different
02491     direction that worked so well I'm considering adopting it
02492     throughout. This is to express the HTML data as XML files.
02493     Markup commands are written in XHTML to adapt to XML syntax
02494     requirements, with programmatic content (executable inclusions)
02495     written in the Velocity template language. JWAA's MetaPage
02496     information can then be expressed via ordinary XML syntax, 
02497     which is parsed and removed when the XML file is loaded.
02498   </dd>
02499 
02500   <dd>
02501     Although XML loading is <b>many</b>orders of magnitude slower 
02502     than the Java+ technique and requires megabytes of XML parsing 
02503     code, the cost of the former is only incurred when XML files 
02504     are loaded or changed and the cost of latter is probably 
02505     incurred already, since servlet engines like Jetty are 
02506     increasingly XML intensive; a 
02507     trend that is certain to continue.
02508   </dd>
02509 
02510   <dd>
02511     With the new system, <b>all</b>of an application's
02512     data content can be gathered into a single XML
02513     file (or multiple ones if you prefer). This
02514     simplifies editing since there is no need to
02515     navigate to multiple tiny HTML pages. This is
02516     more convenient than the Java+ technique because
02517     the server can automatically reload this file
02518     when it changes.
02519   </dd>
02520 
02521   <dd>
02522     Database handling completely reworked to support (and
02523     require) ACID transactions. The earlier collection of database
02524     handling routines (ConnectionPool, Query, SQLUtil, etc) have
02525     been rewritten and moved to their own package,
02526     edu.virtualschool.jwaa.dbms. ConnectionPool is now DBPool and a
02527     new class, DB, was added with the functionality of Connection.
02528     DB wraps a JDBC connection and a pointer to the DBPool instance
02529     from which it was obtained so that it can automatically return
02530     the DB to that pool when the DB is closed. DB provides two new
02531     methods, commit and rollback, for transactional locking. MySQL
02532     users should convert their tables to one of the types that 
02533     support transactions, currently InnoDB and BDB.
02534   </dd>
02535 
02536   <dd>
02537     Removed all JCBC handling from GenericPage to support
02538     servlets that manage multiple applications, each with their own
02539     database.
02540   </dd>
02541 
02542   <dd>
02543     The term, capability, was replaced by the new term, Role,
02544     throughout.
02545   </dd>
02546 
02547   <dd>
02548     The interface name, Account, was replaced by
02549     AccountAbstraction throughout, to reduce the confusion between
02550     interface and class names for a widely used name like this 
02551     one.
02552   </dd>
02553 
02554   <dd>
02555     Split the demo and documentation classes into several
02556     packages to make them easier to follow.
02557   </dd>
02558 
02559   <dd>
02560     Adopted log4j as the logging engine throughout.
02561   </dd>
02562 
02563   <dd>
02564     Internal design stabilized. Released as major version
02565     upgrade to bring public site up to date with development
02566     version.
02567   </dd>
02568 
02569 <dt>Version 1.3.5: Unreleased</dt>
02570 
02571   <dd>
02572     Enhanced MLS with a graphical interface and to support
02573     localization and released it as an independent project, 
02574     <a idref="Java+">Java+ Preprocessor</a> and removed all 
02575     references to MLS per se.
02576   </dd>
02577 
02578 <dt>Version 1.3.4: Aug 2002</dt>
02579 
02580   <dd>
02581     Added syntax color coding to BrowserPage
02582   </dd> 
02583 
02584 <dt>Version 1.3.4: Jan 2003</dt>
02585 
02586   <dd>
02587     Released the <a idref="Java+">Java+ Preprocessor</a> as an independent project
02588     by adding a graphical interface and support for localization to 
02589     the older MLS component of JWAA.  
02590   </dd>
02591 
02592 <dt>Version 1.3.3: Jun 2002</dt>
02593 
02594 
02595   <dd>
02596     Adopted consistent naming scheme for all Field classes.
02597   </dd>
02598 
02599   <dd>
02600     API changes to bring JWAA up to date with the 
02601     XML-based architecture pioneered by ALE.
02602   </dd>
02603 
02604   <dd>
02605     Name changes: Query instead of SQLResults, QueryIterator 
02606     instead of SQLIterator and SQLEnumeration.
02607   </dd>
02608 
02609   <dd>
02610     Use CSS (Cascading Style Sheets) instead of tables for look and feel.
02611   </dd>
02612 
02613   <dd>
02614     Eliminated the Ctx/JdbcCtx/Ctx lashup. Page instances now
02615     represent pages while they're executing and hold the old Ctx
02616     information as instance variables. MetaPage instances represent
02617     the static state of a page and represent the page hierarchy,
02618     anchor, title, capability level, and so forth.
02619   </dd>
02620 
02621   <dd>
02622     Improved the demo application
02623   </dd>
02624 
02625 <dt>Version 1.3.2: Jan 2002</dt>
02626 
02627   <dd>
02628     Added a modified time check to Mls so that it will only
02629     convert a file if File(input)modifiedTime() &gt;
02630     File(output).modifiedTime(). Works Before this change, all
02631     .java files were rewritten by the precompiler which required 
02632     that they all be checked out for edit.  
02633   </dd>
02634 
02635 
02636 <dt>Version 1.3.1: Nov 2001</dt>
02637 
02638 
02639   <dd>
02640     Refactored Fault handling system-wide. See JavaDox for
02641     edu.virtualschool.fault.Fault for write up.
02642   </dd>
02643 
02644   <dd>
02645     Repaired recursion error in Fault.printStackTrace().
02646   </dd>
02647 
02648   <dd>
02649     Major (all day) website outage caused by JDK1.1 versus
02650     JDK1.2 versus JDK1.3 inconsistency in
02651     java.security.interface.RSAKey. The deployment server runs
02652     Blackdown Linux JDK 1.2.2 since modern versions don't exist for
02653     FreeBSD. My development server (Linux) runs IBM JDK 1.3.x. It
02654     seems java.security packages differ, causing one of the mybank
02655     servlets to hang solid while initializing the JCE, preventing
02656     the JWAA servlets from starting. Diagnosed by reverting to the
02657     same JDK version on the development and recompiling everything
02658     to generate compiler diagnostics. Sigh.
02659   </dd>
02660 
02661 <dt>Version 1.3: Nov 2001</dt>
02662 
02663 
02664   <dd>
02665     Miscellaneous source fixups, improved Makefile and JavaDox.
02666   </dd>
02667 
02668   <dd>
02669     Build into /jwaa/src/classes, not /jwaa/WEB-INF/classes, so 
02670     that servlet engines use /jwaa/WEB-INF/lib exclusively.
02671   </dd>
02672 
02673   <dd>
02674     Moved jwaa and demo into separate jars, jwaa.jar and
02675     jwaaDemo.jar, to more easily document the claims mad in the
02676     documentation re: the small size of the jwaa kernel
02677     classes.
02678   </dd>
02679 
02680   <dd>
02681     Added manifest to jwaa.jar so mls will be launched by java
02682     -jar jwaa.jar. Indexed in same in case servlet engines actually 
02683     take advantage of this.
02684   </dd>
02685 
02686   <dd>
02687     Added preController and postController methods to Servlet.
02688     Pages can override these to generate per-page boilerplate, do 
02689     logging, and so forth. Radically simplifies page dispatch.
02690   </dd>
02691 
02692   <dd>
02693     Replaced boolean acquires(GenericAccount) with the more 
02694     general filterAccess(GenericAccount) method.
02695   </dd>
02696 
02697   <dd>
02698     Eliminated SessionExpiredFault in favor of ctx.getViewer(),
02699     which returns the viewing account if one exists, otherwise
02700     null, which plays well with the filterAccess() change mentioned
02701     above.
02702   </dd>
02703 
02704   <dd>
02705     Removed SessionExpiredException which is no longer needed 
02706     or used.
02707   </dd>
02708 
02709   <dd>
02710     Logout no longer invalidates the session but replaces the
02711     accountID of the user in the current session with null. This is
02712     to remove lingering doubts about how invalidating the session
02713     interacts with other parts of the runtime, particular 
02714     redirect() and forward, on various servlet engines.
02715   </dd>
02716 
02717 <dt>Version 1.2: Jul 12 2001</dt>
02718 
02719   <dd>
02720     Added &lt;&lt;fileName&gt;&gt; feature to Java+ as the
02721     initial basis for compile-time template language support. 
02722     I hope to extend this idea someday into a carefully designed
02723     implementation that fully supports Velocity's template language 
02724     within JWAA's precompile-time approach.
02725   </dd>
02726 
02727   <dd>
02728     Replaced Ctx.DoNotReturnException by FakeReturnException to 
02729     reduce the number of inner classes.
02730   </dd>
02731 
02732   <dd>
02733     Started an attempt to integrate Velocity within JWAA, then
02734     abandoned it for reasons described in the documentation. Made
02735     several changes to JWAA behavior while backing out from this 
02736     attempt
02737   </dd>
02738 
02739   <dd>
02740     Various cleanups to Mls.java. No externally visible changes 
02741     except in error messages, etc.
02742   </dd>
02743 
02744 <dt>Version 1.1: Jun 28 2001</dt>
02745 
02746   <dd>
02747     Renamed from JWAP to JWAA to eliminate confusion with the
02748     wireless protocol, WAP.
02749   </dd>
02750 
02751   <dd>
02752     Moved all/most static Vectors/Hashtables from the
02753     architectural JWAA classes out to the application level to
02754     eliminate concerns over how they're behaving in tomcat's 
02755     classloading environment.
02756   </dd>
02757 
02758   <dd>
02759     Deployment server down all day Thursday Jun 21 with a
02760     mysterious JServ failure. Ultimately gave up on JServ and
02761     converted to mod_jk. No source changes were needed; the changes 
02762     were confined to the config files in the etc directories.
02763   </dd>
02764 
02765   <dd>
02766     Modified JdbcCtx's constructor to not throw PoolFault if
02767     the driver list couldn't be loaded by deferring the loading 
02768     until the first connection is requested.
02769   </dd>
02770 
02771   <dd>
02772     Renamed Fault -&gt; Fault and used that throughout JWAA as
02773     a SoftwareFault replacement.
02774   </dd>
02775 
02776   <dd>
02777     Moved MailSender and the libraries it depends on
02778     (activation, javamail) to the application level to reduce
02779     download size, since MailSender isn't used in the JWAA demo.
02780   </dd>
02781 
02782 
02783 <dt>Version 1.0: Jun 1 2001</dt>
02784 
02785   <dd>
02786     Began maintaining versions and change histories with this release.
02787   </dd>
02788 
02789   <dd>
02790     Changed page.redirect() semantics to throw
02791     Ctx.DoNotReturnException instead of returning to the caller to
02792     repair a problem that is only apparent with the MacOS X OmiWeb
02793     browser. The exception is automatically caught and handled by
02794     the dispatch logic and should not be apparent to 
02795     application.
02796   </dd>
02797 
02798   <dd>
02799     Extended the Ctx object to manage an application's entire
02800     execution context instead of just the application to browser
02801     context. In particular, an application's logfile and database
02802     connectivity are now managed by the Ctx object. This radically
02803     cuts down on the need to pass many different context objects
02804     (PrintWriters, Connections, HttpServletRequest, etc) as 
02805     arguments to low-level routines.
02806   </dd>
02807 
02808   <dd>
02809     Eliminated log4j throughout the system by incorporating 
02810     logging commands into the servlet context (Ctx) object.
02811   </dd>
02812 
02813   <dd>
02814     Moved connection pool handling into Ctx. Now relies on the
02815     connection pool to handle connections instead of retaining them
02816     in the session structure. Moving the whole responsibility into
02817     Ctx should eliminate lingering concerns that poorly written 
02818     applications might cause connection pool leaks.
02819   </dd>
02820 
02821   <dd>
02822     Tightened security. Most inherited methods are now final.
02823     Replaced Node's <code>Vector getChildren()</code>method with 
02824     <code>Enumeration children()</code>to inhibit malicious or 
02825     accidental abuse.
02826   </dd>
02827 
02828   <dd>
02829     Adopted Doxygen for Java dox. Nice!
02830   </dd>
02831 
02832   <dd>
02833     Refinements and bug fixes too numerous to list.
02834   </dd>
02835 
02836 <dt>Version 0.1: May 2001</dt>
02837 
02838   <dd>
02839     Started maintaining the change history.
02840   </dd>
02841 
02842 
02843 <dt>Version 0.0: April 2001</dt>
02844 
02845   <dd>
02846     The prerelease software was released with the May 2001 Dr.
02847     Dobb's Journal and is still on their website. The details have
02848     changed considerably since then, but the fundamental 
02849     architecture is essentially unchanged.
02850   </dd>
02851 
02852 </dl>
02853 
02854 </page>
02855 
02856 <page id="SUPPORT" name="Support" requiresRole="none"
02857   title="JWAA Mailing List" >
02858 
02859   <p>
02860     There is a low traffic mailing list for announcing new releases 
02861     and discussing problems and solutions. To subscribe or unsubscribe, 
02862     type your email address and password and click the subscribe or 
02863     unsubscribe button.
02864 </p>
02865 
02866 <table align="center"> 
02867 <tr> 
02868   <th>Email Address</th> 
02869   <th><input name="email" value="$!account.email" type="text"/></th> 
02870 </tr> 
02871 <tr> 
02872   <th>Password</th> 
02873   <th><input name="password" value="$!account.password" type="password"/></th> 
02874 </tr> 
02875 <tr> 
02876   <th><input name="op" value="Subscribe" type="submit"/></th> 
02877   <th><input name="op" value="Unsubscribe" type="submit"/></th> 
02878 </tr> 
02879 </table>
02880 </page>
02881 
02882 <page id="SUBSCRIBE_ACK" name="SubscribeAck" requiresRole="none"
02883   title="Mailing List Subscription Acknowledgement" >
02884   <p>
02885     You are now subscribed to the mailing list with the address 
02886       and password you specified.
02887   </p> 
02888 </page>
02889 
02890 <page id="UNSUBSCRIBE_ACK" name="UnsubscribeAck" requiresRole="none"
02891   title="Mailing List Unsubscribe Acknowledgement" >
02892 
02893   <p>
02894     Your email address has been removed from the JWAA community mailing list.</p> 
02895 </page>
02896 
02897 </pages>