Project

General

Profile

Actions

CDM Library » History » Revision 72

« Previous | Revision 72/120 (diff) | Next »
Markus Döring, 03/03/2008 04:49 PM


CDM Java Library

The CDM Library is meant to be a shared library for the between several applications which can be of any kind, i.e. J2EE having an application container, simple command line tools or swing desktop applications.

The library defines a persistent domain model, EDITs CommonDataModel, that can be serialsed and read in XML. Business logic shared between applications should be part of this library as much as possible, while application specific logic has to stay out. We hope to develop this library in collaboration with the CATE project initially.

Implementation

Maven, Seperation of Concerns

We use http://maven.apache.org/ Maven 2 for this project.

The CDM library itself is devided into several maven subprojects which can be found here:

Maven Project Sites

  • cdmlib-commons

  • cdmlib-model

  • cdmlib-persistence

  • cdmlib-services

  • cdmlib-remote

  • cdmlib-io

Maven repository

To integrate the cdmlibray into your personal Maven project pelase add our Maven repository to your POM: http://wp5.e-taxonomy.eu/cdmlib/mavenrepo/

Domain Model - cdmlib-model

Domain objects (also called business objects sometimes) are directly taken as POJOs from the CommonDataModel. The logic inherent to the domain objects are restricted to their own object graph, i.e. their own properties and related objects. But not unrelated objects available through DAOs only. Typical logic includes validation and calculations.

Property change support

We have implemented java.bean propertyChangeSupport methods for the entire cdm domain classes to send change events to registered listeners.

The TaxonomicEditor makes use of these through a data binding framework. See wiki:JavaResources#DataBinding for more.

Validation

Validation primarily in setter methods. Implement separate Rule classes too?

XML binding

using JAXB

Persistence Layer - cdmlib-persistence

we use Hibernate for persistence. We run unit and integration tests for MySQL, Hypersonic, Postgres and MS SQL Server on a regular basis.

API - cdmlib-services

Work in progress. see "CdmLibrary#Servicelayer" or wiki:CdmAPI for now.

CDM Server - cdmlib-remote

That is the CdmServer community store.

Import/Export - cdmlib-io

Supported import formats:

Planned:

  • TCS+DarwinCOre+SDD

  • TaxonX

Using the CDM Library

Eclipse setup

After installing the jar to your local repository copy the local files to the javaLibrary folder in the svn just as they are

Spring applications with cdmlib

In your own applicationContext.xml you can simply import the cdm spring beans together with

a jdbc datasource bean that reads a property file. A basic mysql cdm store would look like this:

applicationContext.xml

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.springframework.org/schema/beans   http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">

    <import resource="classpath:cdm-services.xml" />
    <import resource="classpath:cdm-jdbc-datasource.xml" />

</beans>

db.properties

hibernate.hbm2ddl.auto=update
hibernate.show_sql=true

hibernate.dialect=org.hibernate.dialect.MySQLDialect
db.driver_class=com.mysql.jdbc.Driver
db.url=jdbc:mysql://192.168.2.10/cdm_store
db.username=your_username
db.password=your_password

Background

Hibernate

Spring 2.0 Framework

We use the Spring 2.0 framework to develop the library and keep the coupling of components low.

Domain Models

Useful Patterns

Aspect Oriented Programming

We use AspectJ to implement the change property crosscutting concern:

Updated by Markus Döring over 16 years ago · 72 revisions