The Foundation Framework provides utilities and fine-grained components that can be shared across layers and tiers of a system. Version 1.0 introduces several major new features based on Semblance's new XML and XHTML templating capabilities. Perhaps the most exciting of these is the abililty to use XHTML templates as an alternative to, or in combination with, JSP for dynamic content. This facility allows Java object properties to be bound to XHTML attributes directly in the markup. It also defines a set of custom elements and attributes that enable iteration, conditional rendering, and other dynamic behaviors to be configured in the XHTML as well.
These components can be easily nested inside one another (as well as in JSP, via a provided tag), and they are far easier to reuse than JSP files, lending themselves to a more modular style of UI development. They also provide a cleaner separation of concerns, since unlike with JSP there's no mixing of code or custom tag libraries with the XHTML markup. That also makes them much friendlier to HTML designers, eliminating expensive translations back and forth between HTML design templates and implementation JSPs.
XMLCoder decodes Java objects from XML. (Encoding capabilities will be added in a future release.) During decoding, XMLCoder creates instances of Java classes to contain the attributes and (possibly) nested objects of each XML element it encounters. It uses reflection where possible to obtain type information, as well as consulting an internal registry that allows you to associate XML element names with Java types. You can do so either by calling APIs provided for that purpose, or else declaratively, by adding the definitions directly in the XML document. If no type information is found using either means, XMLCoder creates an instance of HashMap to contain the values for the current element, and continues processing.
XMLCoder uses the Sun Java Streaming XML Parser (SJSXP) to perform low-level XML parsing, resulting in highly efficient runtime performance. Sometimes referred to as StAX (Streaming Asynchronous XML) or 'XML Pull,' this technology combines the reduced memory consumption usually associated with SAX parsers with execution speed more characteristic of a DOM parser. It also provides a more flexible API that affords the calling code more control over processing
A subclass of XMLCoder that provides generalized support for parsing XHTML documents. Decodes a graph of Element instances from an XHTML template that can contain custom markup, denoted by a namespace.
A pluggable implementation of the SLPersistenceServiceAdaptor interface that can be substituted for other persistence service adaptors. Implements the interface's fetchObjects(FetchSpecification) and fetchObject(String primaryKey, Object primaryKeyValue) methods by using XMLCoder to decode an XML file at a provided filepath, and then using the provided FetchSpecification to filter the resulting list of objects. Since objects parsed by XMLCoder can be strongly typed (strings are coerced to other types automatically) and deeply nested, XMLServiceAdaptor allows real model objects, DTOs, etc. to, in effect, be 'fetched' from XML.
The new listview package contains a set of controllers that collaborate with one another to provide the various behaviors needed to manage paginated ListViews, including navigation; sorting and filtering; manipulating selected objects; and coordinating the actions of business service adaptors to retrieve data automatically whenever needed.
Also new in this release are a set of classes that help to automate the management of selections typically presented in dropdowns and multi-selects, chores handled respectively by DynamicTypeCode and its superclass, SelectionGroup. These classes encapsulate a list of all possible values along with references to the currently selected value (DynamicTypeCode) or values (SelectionGroup). Instances can be ganged together to synchronize their selections and their currently allowable values.
DynamicTypeCode and SelectionGroup instances obtain their value lists dynamically from subclasses of ValueGroupServiceAdaptor. Subclasses of DynamicTypeCode and SelectionGroup can be configured to use the provided ValueGroupXMLServiceAdaptor which looks parses value lists from XML, or to use custom subclasses that obtain their value lists from other sources, such as a database table or a flat file.