Alistair Miles

Category: java

On the OAIS Information Model as a Platform-Independent Model (PIM) in a Model-Driven Software Architecture

Abstract

This short paper summarises some work done on the possibility of using OAIS information model as a basis for the model-driven design and implementation of components within a digital preservation software architecture. Two model transformations were defined using the Enterprise Architect template language. The first model-transformation transforms a platform-independent UML class model (PIM) into a set of UML interfaces specific to the Java 1.5 platform (here called a Java API model). The second model-transformation transforms a platform-independent UML class model (PIM) into set of UML classes specific to the Java 1.5 platform, implementing the interfaces generated by the first model-transformation (here called a Java implementation model). Both were applied to the OAIS information model as PIM, and the generated models are presented here with discussion.

Read the rest of this entry »

Using UML 2 & Model Driven Architecture (MDA) Transforms to Generate a Persistence Layer for Java Web Applications and Web Services

Agile Development and Rapid Prototyping

I’m doing some rapid prototyping of Web applications and Web services in Java, and because I need to redesign often, I want the design and implementation processes to be as agile and lightweight as possible. I.e. each change I make to the design should take little or no effort to implement & deploy.

Persistent Data

The biggest problem I’ve encountered so far is persistence. I need to implement applications with persistent data. However, I’m coding (at least on the server side) in Java. Implementing persistence for Java applications typically requires an object-relational mapping, which if coded by hand, costs effort. There are alternatives for handling persistence more-or-less automatically, like J2EE’s annotations. However, I’m also very much in favour of coding with POJOs, injecting dependencies wherever possible, and decoupling application code from any implementation-specific considerations to do with persistence.

Data Access Objects (DAOs)

A popular design pattern for persistence is the use of Data Access Objects (DAOs) which abstract the data access and manipulation operations from the implementation-specific details, allowing the persistence platform to be swapped out without affecting application logic.

UML 2 & MDA Transforms

I’ve also been working recently with UML 2 and Model Driven Architecture (MDA) transforms. The tool I’ve been using is Enterprise Architect, which encourages the development of a Platform Independent Model (PIM), which can then be transformed into class models tailored to various programming languages (Java, C# etc.). A PIM can also be transformed into database models tailored to various database platforms (Oracle, Postgres, MySQL etc.). From these platform-specific models, you can then generate actual code or DDL scripts.

The Dream

So the dream is this: I design the data model for my application in a totally platform-independent way, using UML; I then use MDA transforms to generate a database model, a Java class model, and at least the interfaces for a set of Java DAOs (ideally the implementations as well); I then use code generation to automatically generate the DDL scripts and Java class/interface definitions.

I.e. I want to go from a PIM to a fully-implemented persistence layer at the press of one or two buttons.

Oh, and I don’t want to pay any money for any of this 🙂

This where I’ve got to so far…

Read the rest of this entry »

Using UML 2 & Model Driven Architecture (MDA) Transforms to Generate a Persistence Layer for Java Web Applications and Web Services

Agile Development and Rapid Prototyping

I’m doing some rapid prototyping of Web applications and Web services in Java, and because I need to redesign often, I want the design and implementation processes to be as agile and lightweight as possible. I.e. each change I make to the design should take little or no effort to implement & deploy.

Persistent Data

The biggest problem I’ve encountered so far is persistence. I need to implement applications with persistent data. However, I’m coding (at least on the server side) in Java. Implementing persistence for Java applications typically requires an object-relational mapping, which if coded by hand, costs effort. There are alternatives for handling persistence more-or-less automatically, like J2EE’s annotations. However, I’m also very much in favour of coding with POJOs, injecting dependencies wherever possible, and decoupling application code from any implementation-specific considerations to do with persistence.

Data Access Objects (DAOs)

A popular design pattern for persistence is the use of Data Access Objects (DAOs) which abstract the data access and manipulation operations from the implementation-specific details, allowing the persistence platform to be swapped out without affecting application logic.

UML 2 & MDA Transforms

I’ve also been working recently with UML 2 and Model Driven Architecture (MDA) transforms. The tool I’ve been using is Enterprise Architect, which encourages the development of a Platform Independent Model (PIM), which can then be transformed into class models tailored to various programming languages (Java, C# etc.). A PIM can also be transformed into database models tailored to various database platforms (Oracle, Postgres, MySQL etc.). From these platform-specific models, you can then generate actual code or DDL scripts.

The Dream

So the dream is this: I design the data model for my application in a totally platform-independent way, using UML; I then use MDA transforms to generate a database model, a Java class model, and at least the interfaces for a set of Java DAOs (ideally the implementations as well); I then use code generation to automatically generate the DDL scripts and Java class/interface definitions.

I.e. I want to go from a PIM to a fully-implemented persistence layer at the press of one or two buttons.

Oh, and I don’t want to pay any money for any of this 🙂

This where I’ve got to so far…

Read the rest of this entry »

RDFOO – Convert RDF Graphs into JSON Objects

I’ve written a small Java utility for converting any node in an RDF graph into a JSON object. You can download RDFOO 0.1 alpha or alternatively go to the RDFOO web page which has links to more documentation.

RDFOO is (more or less) an implementation of JDIL, using Jena and the Java classes for JSON from json.org. Given a resource in an RDF graph, RDFOO by default performs a shallow mapping to a JSON object, capturing only literal value properties. RDFOO can also be told to follow specific properties to a given (or unlimited) depth, to capture nested objects, and handles circular references.

If you find any bugs or have any comments I’d love to hear from you. I think the implementation is sensible, and it passes a reasonably complete test case, but then I’m no Java guru – you have been warned 🙂