CDM Library » History » Revision 65
« Previous |
Revision 65/120
(diff)
| Next »
Markus Döring, 02/04/2008 02:46 PM
CDM Java Library¶
- Table of contents
- 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.
Maven¶
We use Maven 2 for this project. The CDM library itself is devided into several maven subprojects which can be found here:
cdmlib-model
cdmlib-commons
cdmlib-persistence
cdmlib-services
cdmlib-remote
Release¶
We are currently debating whether OSGi bundles and/or JAR archives are our preferred form of a CDM library release.
Source Code¶
The source:trunk/cdm can be found in the EDIT subversion repository:
http://dev.e-taxonomy.eu/trac/browser/trunk/cdmlib/cdmlibrary
For building Apache Ant must be installed as well Java JDK.
API¶
Work in progress. see "CdmLibrary#Servicelayer" or wiki:CdmAPI for now.
Library Architecture¶
Spring 2.0 Framework¶
We use the Spring 2.0 framework to develop the library and keep the coupling of components low.
Maven 2.x¶
As a project management tool we use Maven 2.0.7, which is an extension to the ant tool.
How to install it¶
Maven: http://maven.apache.org/download.html (be sure to have JDK in your JAVA_HOME, jre is not enough !)
Eclipse-IDE: http://m2eclipse.codehaus.org/index.html
Sun's jars: http://maven.apache.org/guides/mini/guide-coping-with-sun-jars.html
After installing the jar to your local repository copy the local files to the javaLibrary folder in the svn just as they are
- AspectJ plugin: http://mojo.codehaus.org/aspectj-maven-plugin/usage.html
Domain Model POJOs¶
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 plan to implement java.bean propertyChangeSupport methods to send change events to registered listeners.
The TaxonomicEditor makes use of these through a data binding framework. See wiki:JavaResources#DataBinding for more.
AOP might help in implementing the bean change property crosscutting concern:
AspectJ
JBoss AOP
Spring AOP
Validation¶
Validation primarily in setter methods. Implement separate Rule classes too?
XML binding¶
using JAXB
Persistence Layer¶
DAO¶
Every domain class has a DAO for at least CRUD operations, a generic HQL query filter as well as some specific methods for searching.
O/RM¶
Currently we use EJB3/JPA specs w/ Hibernate . The library will use some native Hibernate APIs, so porting to other ORM framework will be non trivial. On the other hand this allows us to exploit all additional features Hibernate has to offer, such as:
Query by Criteria, Query By Example
FullTextSearching
Custom Types (hibernate has usertypes)
Filters
RDBMS¶
Using OR/M frees us from choosing a particular database system. Hibernate works with most current RDBMS. See supported databases
Service layer¶
The service layer defines the primary public exposed interface for other applications. Every DAO is also exposed as a service, but more complex services can be offered too. Complex validation is part of the service layer as well as import/export of XML files using the XML binding of the domain objects.
XML (Un)Marshalling¶
Services to read and write xml data into domain objects using the JAXB annotations in the domain model
Validation¶
Validation across unrelated domain objects needs to be implemented outside of the domain model. The service layer takes care of this. Validation rules could (should?) be implemented as separate Rule classes
How To¶
Releases¶
run ant:distAsZip from build.xml in project edit_cdm
upack dist\zip\cdmLibrary.zip
put cdmLibrary.jar and all jars from dist\zip\lib into project eu.etaxonomy.cdmLibrary
refresh project and add all unknown libraries to the project classpath
update classpath in plugin.xml\Runtime
test with project eu.etaxonomy.taxeditor
Background¶
Updated by Markus Döring over 16 years ago · 65 revisions