duminică, 9 ianuarie 2011

Java Web Application Architecture (JWAA)

JWAA is a small but powerful architecture for writing web-based applications in XHTML, Velocity and Java. JWAA is portable, open source (free) code that is available for download here.

JWAA features a fully object-oriented approach. Applications are networks of page objects that reference other pages via standard object referencing semantics, not with text strings buried in HTML text. JWAA brings the power of object-oriented programming to bear on the web.


Reduced Navigation

JWAA represents pages as XML files, not as conventional HTML files. XML's well-known abilities as a general purpose data representation language are used to express entire web applications in only a few files. For example, the JWAA website is defined by three XML files: application.xml, outerPages.xml and innerPages.xml. The number of files is determined your application.xml file, not by HTML-imposed restrictions.

Automatic reloading

JWAA monitors all input files for changes and automatically reloads them when they change. Any errors are reported via the browser when the XML file is first loaded, not buried in an obscure log file.

Invalid link detection

Invalid links are automatically detected and reported when each application is first loaded. The id of each page is automatically recorded in a dictionary and can be referenced by idref attributes as described below. The dictionary can be expanded to add links to external pages via dictionary elements in the application.xml file. Dictionary entries are referenced by providing idref attributes to the usual and XHTML commands.

Persistent forms

HTML lets you define forms that the user can type information into, but no way to store or process this information. That requires installing and learning languages, tools and environments that bear no resemblance to HTML. The learning process is discontinuous.

JWAA supports persistent forms by default. Like blackboards or paper, forms retain what the user writes in them until it is explicitly changed or erased. Persistent forms are a key building block for building form-based database-centric applications such as wikis, quizzes, interview forms, and so forth, often without any custom programming at all. The default behavior is easily overridden.

This feature was developed within the Action Learning Environment, a JWAA application. It has been ported to JWAA on as an experiment to investigate whether it makes sense to support persistent forms at a lower level.

Self documenting

Other environments provide a bare foundation to build on from first principles. JWAA provides a finished environment to live in and learn from while you remodel it to suit. Building a new application is a matter of copying the application that provides this tutorial and changing it to suit, learning new skills as you go.

Continuous learning

Ordinary HTML pages are static data files that are served by a separate program such as Apache. That's fine until the pages must support dynamic features when the learning curve becomes discontinuous since new and unfamilar tools must be installed and learned (perl or java, servlet engines, etc).

JWAA provides a uniform and comprehensive XML-based environment in which the transition from static to dynamic pages is continuous. Simple static pages differ from advanced dynamic ones only in that they don't use features that the same environment provides.

Automatic session management via cookies and/or URL rewriting

If the browser supports cookies, JWAA uses them to support session management. Otherwise JWAA will automatically rewrite all URLs so that session information is retained when the user clicks a URL. The code that rewrites URLs is actually provided by the servlet engine. JWAA's contribution is to guarantee that all URLs are subject to URL-rewriting, even those that are buried in hardcoded strings.

Integration and Separation of Concerns

JWAA supports both. When used with the Java+ preprocessor, HTML is written as Java+ strings so that presentation and logic are combined and executable inclusions are expressed in plain Java. The HTML can also be written as XML (XHTML) files and automatically reloaded when they change, with executable inclusions written in Velocity. Since Java+ now has its own web site, this site will emphasize the XML-based approach.

Consistent Look and Feel

Navigation bars, background colors, and headers/footer information on this and all other pages in this website constitute this application's look and feel. The look and feel is defined by Velocity macros such that the look and feel is centrally defined and easily changed. These macros are, by default, automatically reloaded when the file that defines them is changed.

Model-View-Controller Paradigm plus Fields

JWAA pages are objects that supports a user's interaction with internal objects, called Models (or JavaBeans). Model objects manage the application's persistent state, typically but not necessarily as records in a database. By convention, model objects' fields are not primitive Java datatypes like Strings. Rather fields are the atoms from which models are composed. Fields encapsulate the logic for validating user inputs, reporting any problems by collaborating via the user interface. Fields are an unusually powerful unit of reuse because they are tangible, concrete and highly visible right in the application's user interface. JWAA includes a comprehensive library of ready-to-use fields for building model objects in Java.

Small, Fast, Secure

With Java+, applications are constructed entirely at compile time and are remarkably small. JWAA's core functionality (minus documentation and demos) is only 67kb while JSP is many times larger. No compilers are needed on deployment servers, so speed, space and security are substantially improved.

Niciun comentariu:

Trimiteți un comentariu