Mizar

Cayahoga County

Cayahoga County

Cuyahoga County, Ohio exemplifies the many issues of enterprise databases, spatial or otherwise. Stakeholders include over 80 local governments and autonomous agencies using almost every current GIS product. The challenge has been to create a central spatial database that allows stakeholders to continue with their chosen GIS product while providing a framework for the development of county wide enterprise applications meeting required security, scalability, and reliability objectives.

The County Enterprise GIS (CEGIS) project utilized Oracle's newest Fusion 11g web technologies together with Oracle Spatial and Maps to meet these challenges. Working with Oracle's ADF Faces Rich Client JavaServer Faces (JSF) components, and Open Source tools such as EclipseLink and Trinidad four applications have been built serving the Public, Planning, County Auditor, and Sanitary Sewer using a common database and business code base.

Project Overview

Cuyahoga is the most populous county in Ohio (1.4 million) and includes Cleveland and fifty-nine other cities, villages, and townships covering an area of about 460 square miles (1,191 sq.km.). In addition, Cuyahoga includes numerous independent public agencies. Many of these use some form of GIS and non-mapping database technologies but there wasn't a County-wide standard GIS. In 2005 the County issued an RFP seeking a "partner to assist the county in developing a comprehensive countywide plan along with a pilot implementation" Mizar, LLC provided the database design and systems development component of for the winning team led by Baker and Associates.

The project was executed in three phases:

  1. Phase One — The development of a Preliminary Design document based on an outreach campaign to document requirements of a wide variety of participants;
  2. Phase Two — A proof-of-concept pilot; and
  3. Phase Three — Implementation of three applications supporting a Public site, a Planning site, and a secured Kiosk for use within the Auditor's department. Subsequently, a fourth project was initiated to create a Work Order Management system for the Sanitary Engineering department.

The goal was to integrate spatial data into the County's enterprise information repository, which is largely managed with Oracle's RDBMS and to do so in a GIS vendor agnostic fashion. The system supports various user communities who manage their own data using a variety of GIS including: Intergraph, MapInfo, Bentley, Autodesk, and ESRI products. By using the Oracle RDBMS as an information hub, spatial data is not only available to other GIS users but to the entire County. The applications are managed by the County's Information Services Center (ISC) with expertise in Oracle, Networks, Java EE, and a variety of operating systems. See http://isc.cuyahogacounty.us

In order to avoid creating a system that was obsolete on deployment, the County made the bold decision to proceed with family of emerging Oracle technologies including Oracle Maps and ADF Faces Rich Client JavaServer Faces components. While working through the beta cycle required additional effort during development, the County now has a state-of-the-art system leveraging Oracle's latest Fusion 11g technology.

While leveraging the power of Oracle, the decision was also made to build an open system that avoided proprietary dependencies and made use of open source components . This Open Oracle strategy is facilitated by Oracle's strong commitment to Open Source communities. Most of the middle-tier architecture was based on Open Source (or soon to be) technologies. We used Eclipselink for the Java Persistence Architecture (JPA) bridge between Java. Oracle's ADF Faces Rich Client provided the JavaServer Faces implementation. ADF Faces Rich Client is based on MyFaces Trinidad, which Oracle donated to the Apache Software Foundation. Oracle has announced that ADF Faces Rich Client itself will be donated to an Open Source community in the near future. All the supporting Mizar resources were delivered in source code under the GNU Lesser General Public License (LGPL). Thus, most of the middle-tier architecture was based on Open Source (or soon to be) technologies.

Enterprise Information Systems

Enterprise information systems are first and foremost systems and have requirements that are independent of functionality. These core requirements include:



Most Enterprise Information Systems are based on either Java EE (formerly J2EE) or .NET and there are significant advantages to committing to one or the other. In reality most larger organizations are faced with the dilemma that Oracle dominates the database world and is becoming the dominant player in the Java EE realm although Microsoft's easy-to-use .NET architecture remains an important part of the desktop reality. The larger the organization, the more likely a Java EE solution is sought; the smaller, the more likely a Microsoft .NET solution. While we do not see this generalization changing in the near future, we are seeing more organizations shifting their attention to Oracle and Java EE for larger strategic projects while continuing to use Microsoft solutions for tactical and department based projects.

While there are many good things to say about Microsoft's .NET architecture, limiting one's IT infrastructure to Windows and Intel is a serious constraint. This is compounded by the small application and rapid development focus of Microsoft's framework and development environments. While this focus has many advantages, the complexities of Java EE and Oracle are not arbitrary: they are designed to handle big problems and to meet the enterprise requirements for scalability, security, reliability, and maintainability.

Universal Data Repository

A universal data repository is a single source for all information; structured and unstructured. Structured data includes the conventional scalar data types common all databases and complex data types such as Oracle's SDO_GEOMETRY. Unstructured data includes XML (unstructured from the perspective of SQL), audio, images, video, documents and more. There are two common methods for implementing such a solution: a Service Oriented Architecture (SOA) and a Federated Database.

SOA

Service orientation is a set of loosely coupled techniques designed to enable interoperability between applications and data sources. Most GIS vendors and open source communities favor SOA protocols to discover and share information for a variety of reasons:


There are downsides to SOA however, especially for enterprise datasets. SOA is an indicated strategy for integrating loosely-coupled independent data sources, but it comes at a price.

Federated Databases

A federated database integrates a variety of data sources within the persistence layer providing a single universal data repository. Oracle provides a number of means to construct a federated database.

Model-View-Controller (MVC)

MVC

The Model-View-Controller (MVC) pattern isolates the persistence and business logic (model layer) from the presentation (view) layer and the plumbing (controller layer). Successful use of the MVC pattern is an expression of modularization and achieves the goals of separating areas of expertise, improving maintainability and maximizing reusability.

While modern AJAX techniques strain the principals of MVC, thoughtful design of the JavaScript components can maintain the fundamentals.

JavaServer Faces (JSF) provides the greater part of the Control component at Cuyahoga. Through a collection of Managed Beans server side Java classes are exposed through Java Server Pages (JSP) containing JSF components using the JSF Expression Language. The application programmer requires only a limited understanding of the complexities of the Servlet/JSP plumbing and can concentrate almost exclusively on the business model and user interface. JSF also provides the majority of the tools required to manage the user interface experience, augmented by extensions provided by the ADF Rich Client component set.

The persistence component of the Model is managed using Java Persistence API (JPA) which provides Object Relational Mapping between the database and Java beans. Application programmers work in pure a Java context with a limited need to concern themselves with the underlying database.

Technologies

Oracle RDBMS Spatial extensions

Oracle Spatial is not a Geographic Information System and does not attempt to be. Oracle Spatial is a set of RDBMS extensions that allow Oracle to manage and manipulate multi-dimensional data and is part of a family of extensions that support a variety of non-scalar data such as XML, audio, video, image, and a wide variety of document types. In many ways Oracle Spatial is to GIS as Content Management is to Word Processing. GIS is a content provider to Oracle's universal data repository.

With the release of Oracle 11g, Spatial gained a number of new capabilities and increased performance. Some of these are specific to Spatial but many are the result of enhancements to the Oracle RDBMS core. The following are features of Oracle 11g Spatial. Those used in Cuyahoga are marked with a † symbol.

  • The SDO_GEOMETRY data type †
  • A powerful set of spatial query operators †
  • A comprehensive coordinate projection system †
  • A Geocoder
  • Routing engine †
  • Network Data Model
  • Linear Referencing System
  • Topology Data Model,
  • GeoRaster Imaging †
  • 3D Geometry
  • Point Cloud
  • Triangulated Irregular Network (TIN)
  • High performance SecureFiles option providing a ten-fold improvement in many LOB operations enhancing most Spatial operations but especially important for GeoRaster †

Pro Oracle Spatial: for Oracle Database 11g by Ravi Kothuri, Albert Godfrind, and Euro Beinat published by APRESS is an excellent introduction to Oracle Spatial.

Java Persistence API (JPA)

The Java Persistence API is a Java EE component that provides a light-weight Plain Old Java Beans (POJO) approach to Object Relational Mapping (ORM). Relationships between tables are described using simple Java Annotations and information can be traversed using object properties rather than embedding JDBC directly in the application. Java Annotations can be superseded or replaced by XML mapping permitting the configuration to entirely managed outside of the Java code layer.

  • @Entity
  • public class Site {
  • @Id
  • Long id;
  • Long number;
  • @ManyToOne
  • @JoinColumn(name="ST_ID")
  • Street street;
  • @Convert ("JGeometry")
  • JGeometry shape;
  • String jpql = "select a from Site a
  • where a.street.name like '%Hastings%' and a.number
  • between 100 and 199";
  • Query q = em.createQuery(jpql);
  • q.setMaxResults(200);
  • List sites = q.getResultList();
  • String streetName =
  • sites.get(0).getStreet().getName();

Once configured with a relationship, the Java code can access and even update the database by referencing bean properties. This vastly reduces the amount of code and avoids cluttering the application logic with references to SQL and JDBC required to traverse between related tables.

JPA requires an implementing engine and for this purpose we used Eclipselink. Eclipselink began as Toplink, which Oracle contributed to the Eclipselink Foundation. A Oracle development team centered in Ottawa, Canada continues to support and extend Eclipselink. Of particular importance to this project was the support of Spatial data. Eclipselink provides protocols to support the oracle.spatial.geometry.JGeometry data type which is the Java representation for SDO_GEOMETRY.

Eclipselink also provides a SpatialExpressionFactory. The Eclipselink Expression class is particularly useful for creating queries from an abstracted context. The Cuyahoga sites make use of a generic query builder that only requires the application programmer to identify which class properties should be considered. The query builder is able to use Java reflection to determine the data type, construe which types of query relationships are meaningful, and use the Expression factory to construct the SQL.

Even more important than minimizing code, JPA enforces good RDBMS practices and intrinsically manages RDBMS constraints within the Java object scope. With over twenty-five years of RDBMS programming experience and having written a JDBC bean wrapper himself this author can comfortably assert that JPA significantly improved his database design and programming skill set.

JPA provides a powerful cache management system that facilitates memory conservation, improves performance and shares context. The system effectively prevents duplicate references to a row. If an application makes multiple references to the same row — perhaps a Street referenced in a list of Streets, as an owner of a Site address, of the location of a Man Hole, and a face of a Parcel —they all refer to the same Java object. If one instance of the Street is modified the modification is visible to all references.

Java Persistence API (JPA)

JavaServer Faces was developed through the Java Community Process and establishes the standard for building server-side user interfaces for Java EE applications. In many ways JSF is analogous to ASP.NET; it may also be thought of as Swing for the Net.

Components of a JSF application include:

JSF components are extensible, so you can create your own component libraries. However powerful Open Source libraries such as MyFaces Trinidad and Oracle ADF Faces RichClient provide hundreds of powerful gadget and layout components that significantly reduce the need to do so.

Google JavaServer Faces for 1,600,000 references; something to keep you busy for a weekend.

MyFaces Trinidad

MyFaces

Oracle's first JSF effort, ADF Faces, was donated to the Apache MyFaces Open Source community in 2006. After more than a year of improvements by Oracle and other's in the MyFaces community it was rebranded as MyFaces Trinidad.

Trinidad extends core JSF with:

See http://myfaces.apache.org/trinidad/index.html for more details.

Oracle ADF Faces Rich Client


ADF Faces Rich Client builds on MyFaces Trinidad to provide an even richer user interface by adding:

ADF Faces Rich Client extends core JSF and Trinidad functionality with attractive new AJAX behaviors within an overall framework that enables good programming practices, adherence to an MVC pattern and easy modularization. While the new move to AJAX techniques enabled through client-side scripting languages such as JavaScript is unavoidably compelling, it introduces the risk of falling back into poor programming practices that typified much of the early internet development era. ADF Faces Rich Client goes a long way to furthering the JSF goal of creating a maintainable Java EE development environment.

See http://www.oracle.com/technology/products/adf/adffaces/index.html for more details.

Ajax and JavaScript


Ajax is not a technology but an approach to web development that has taken the web development world by storm. The once stateless nature of web-pages has become increasingly stateful as asynchronous Ajax communication techniques permit clandestine communication between your page and the server. Ajax introduces the appearance of improved performance —in this case appearance is everything — and a power channel for communication between Model code existing in the JavaScript and the server-side Java realms.

Ajax has re-invigororated the much maligned JavaScript language which was in great need of better IDE support and programmer respect. JavaScript is an important component of the Cuyahoga project and we approached it with the same care and attention we did the server-side Java code.

Oracle MapViewer

MapViewer

Oracle MapViewer is a Java EE service that provides map rendering services for Oracle Spatial data. MapViewer includes:

  • a core rendering library and a servlet to expose this functionality to web applications;
  • a suite of application programming interfaces (APIs) based on XML, Java, and PL/SQL; and
  • a graphical metadata utility called MapBuilder useful to define styles, annotation, themes, and maps.

In addition to Oracle Spatial data, MapViewer supports Web Map Service(WMS), Web Feature Service (WFS) and custom external spatial data providers.

Oracle MapViewer and Maps are not actually part of the Oracle Spatial kit but are part of the Oracle Application Server and Oracle WebLogic Server products.

Oracle Maps

Oracle Maps

While technically part of the MapViewer package, Oracle Maps is largely a JavaScript client to MapViewer that communicates through two servlets.

  • A Feature of Interest (FOI) server renders objects that are displayed by the Maps JavaScript layer. FOIs provide fly-over text and clickable HTML popups. The Maps JavaScript API includes a powerful suite of functions for interacting with and dynamically creating FOIs. The Cuyahoga sites support over thirty-five different Features of Interest.
  • A Map Cache server provides Google-like pan and zoom supported by Ajax look-ahead tile fetching. Using MapBuilder multiple layers can be defined as JPEG (most useful for ortho-photo base layers) or PNG, which enable transparency. The Cuyahoga sites have over twenty different layers that can be turned on or off over three, and soon to be seven, different base maps.

Oracle Maps includes a well documented API and a comprehensive set of online tutorials that provide practical examples of almost every feature. The API includes a very powerful Redline tool that is used in the Cuyahoga applications to describe search areas and to provide measurement tools. In other applications these tools are used to provide light-weight spatial editing tools.

Mizar Packages

The Mizar packages include over 500 Java classes arranged into nine master packages; eight JavaScript collections providing 163 functions, and numerous JSPX pageTemplates . These packages are carefully organized to maintain appropriate independence and modularity; there are no circular dependencies.

  • MizarCommon — The base library provides packages supporting extensions to apache and java.utils commons; credential interfaces; a set of Form/Field annotations; independent geodesy, geometry, and graph theory classes; and other utility classes.
  • MizarPersistence — Persistence classes provide JDBC and JPA beans, facades, customizers, and query builders. JPA beans are provided for many Oracle data dictionary tables and views. Abstract classes are provided for a GenericBean and a GeometryBean which map through interfaces to presentation layer classes in the MizarTrinidad packages.
  • MizarMetadata — The Metadata package includes JPA beans, facades, and utilities to interface to the core Oracle Spatial MDSYS classes.
  • MizarAddressing — The Addressing package includes JPA beans, facades, and utilities for a powerful Street-Site model; U.S.Census population and MAF/Tiger data, a Geocoder built on the Street-Site model, and a Routing package that interfaces to the Oracle Spatial routing API; and NAVTEQ Points of Interest beans.
  • MizarFaces — The Faces packages include classes and interfaces with JSF awareness including a PhaseListener and a Servlet listener to service Ajax requests. Application- and Session-Constants classes provide a base set of properties that can be set through the faces-config.xml file to affect customization of the application without modifying Java.
  • MizarTrinidad — The Trinidad packages extend MizarFaces with Trinidad dependencies. This package includes a family of abstract classes to service tables and JPA beans belonging to the Persistence, Metadata, and Addressing packages.
  • MizarAdfRichFaces — This package includes a small set of classes dependent on ADF Faces Rich Client, as much as possible dependencies are based on the Open Source Trinidad classes.
  • MizarSecurity — The security classes provide an LDAP-like credential manager supporting Users, Groups, Roles, Permissions, and Properties. The system provides a secure database repository but is designed to optionally plug into an LDAP manager.
  • MizarTest — The MizarTest package includes a JUnit test framework and tests for the other packages.

The goal of the Mizar packages is to provide an open source API that facilitates the creation of Trinidad or ADF Faces Rich Client applications leveraging Oracle RDBMS, including Spatial and other multi-media data types. Using these packages in concert with a custom CuyahogaCommon library, the vast majority of the functionality of the four Cuyahoga sites is shared. The four sites are just tips of a common iceberg of shared code.

  • Abstract classes guarantee consistent and testable behavior.
  • By implementing as much functionality in common abstract classes as possible a consistent and power user interface is assured.
  • By rigorously enforcing modularity circular references are avoided facilitating migration to JavaScript and application of large parts of the libraries in non-Faces applications.
  • Less code is easier to maintain than more code. We have upgraded the libraries from ADF Faces to Trinidad, from Trinidad to ADF Faces Rich Client, from JSP 1.2 to JSP 2.1, JSF 1.0 to JSF 1.2, and from Oracle OC4J to Oracle WebLogic. Each upgrade is easier and makes us confident that the application we have developed for Cuyahoga are as future-proof as possible.

The Mizar Java packages, JavaScript, JSPX, and other Utilities are provided as free source-code under the GNU Lesser General Public License (LGPL).