Object Integration Framework

This document describes the basic architecture and usage of the JLense Object Integration Framework. It also demonstrates how the JLedger GUI uses the JLense Object Integration Framework to access and change objects provided by the JLedger engine.

Introduction

The Object Integration Framework...

  • isolates clients from the details of the technologies used to implement business objects and services.
  • provides cross-technogy connectivity to a wide range of object-based services such as databases, EJBs, CORBA, and web services.
  • enables a JLense application to easily connect to all corporate data and services, even in a heterogeneous environment.

The Object Integration Framework consists of two APIs:

  • The Object Integration Client API defines an abstract, interface-based, API which plugins can be used to get data from external enterprise systems. The Client API also provides a generic way to receive notifications from enterprise systems when data is changed.
  • The Object Integration Provider API defines an abstract, interface-based, API and a set of plugin extension points which other plugins can use to publish enterprise data for use by other plugins. The Object Integration Provider API is used to integrate external enterprise systems with JLense.

In addition, the org.jlense.zone plugin also defines extention points for registering connection factories.

What Does the Object Integration Client API Do?

In simplest terms, the Object Integration Client API makes it possible to do three things:

  • Establish a connection with an enterprise data source.
  • Send queries to the data source that return sets of objects.
  • Receive notification of object insertions, deletions, and updates.

This list of capabilities is really no different than what is normally provided by a traditional object-oriented storage mechanism, like an ODMG-compliant object database or an object-relational mapping tool like TopLink.

What makes the Object Integration Client API different is:

  • The Object Integration Client API is not an interface to a particular technology or persistence mechanism. The Object Integration Client API does for object based data stores and services what the Java JDBC API does for databases, it provides a generic API used to access any objects across a wide range of technologies and products. The Object Integration Client API is designed to be compatible with a wide range of databases and distributed object technologies such as CORBA, SOAP web services, EJBs, RMI, etc.

  • The ability to receive notification of object insertions, deletions, and updates by other entities. Not only can a plugin register for notification of these events after the fact but they can also register for notification before events take place and veto these events. These features are crucial to be able to actually integrate plugins and make them behave as a tightly coupled unit.

  • Multiple ways to query data. Queries are not limited to any particular syntax but may be specified in any syntax that can be understood by the back-end provider. So for instance, if the zone permits it, queries may be specified as OQL, XQuery, XPath, or whatever.

Concepts

Zone Architecture

The basic purpose of the JLense Application Framework core is to provide an environment in which applications may be assembled from plugins. In order to achieve this vision is is necessary to provide a framework in which plugins may share thier data and services without being tightly coupled to each other. For instance, one plugin may be responsible for creating and managing Account objects while another plugin may be responsible for creating a user interface for manipulating Account objects. The plugin that creates a user interface for manipulating Account objects should be reusable in any application that shares the same notion of what an Account object is, regardless of how Account objects are actually implemented, persisted, or transmitted. The Object Integration Framework helps us do that.

Conceptually, data clients and data providers are integrated together into an Object Integration Zone. An object integration zone is a central hub where clients and providers can hook up with each other. The JLense Application Framework serves as this hub where data clients and data providers meet.

The concept of a is central to the Object Integration Framework and the word "Zone" is used frequently in the interface names in the Object Integration Framework package. For instance there is ZoneConnection which conveys the idea of connecting to an object zone where many objects of different types are being served up by object providers.

Data Model

The data/objects that can be exchanged via the Object Integration Framework are defined as Java interfaces. Object clients query for instance of these interfaces and can set and get objects properties using methods defined by the object interfaces.

Example

The following code fragment gives a simple example of these five steps:

/*
Get a connection, select all accounts and add an 'X' to the
end of all thier names.  
*/
ZoneConnection connection=
    ZoneConnections.getZoneConnection("org.jledger", new Properties());
Properties queryProperties= new Properties();
queryProperties.put(ZoneConstants.PROP_QUERY_TYPE, ZoneConstants.QUERY_TYPE_OQL);
ZoneQuery query= connection.createQuery(queryProperties);
query.create("select a from org.jledger.model.IAccount");
Collection allAccounts= connection.getCollectionByQuery(query);

connection.beginTransaction();
for (Iterator i= allAcounts.iterator(); i.hasNext(); ) {
    IAccount account= (IAccount)i.next();
    System.out.println("Account Selected:" + account.getName());
    account.setName(account.getName()+'X');
    connection.store(account);
}
connection.commitTransaction();

/* listen for new accounts */
ZoneListener listener= new ZoneNotificationListener {
    public void onNotificationMessage(ZoneEvent e) {
        if (e.getAction().equals(ZoneConstants.ACTION_ADD)) {
            IAccount account= (IAccount)e.getValue();
            System.out.println("Account Added:" + account.getName());
        }
    }
};
connection.addZoneListener("org.jledger.model.IAccount", listener);

/* invoke a remote service call to create an entire chart of accounts */
query.create("call org.jledger.model.IChartOfAccounts.createChartOfAccounts($1)");
query.bind(IChartOfAccount.DEFAULT_CHART_FOR_SERVICE_PROVIDERS);
IChartOfAccounts chart= (IChartOfAccounts)connection.getObjectByQuery(query);