Introduction
This article summarizes the main features of the grepo framework v1.5 release. For a full list of changes see the Jira Release Notes.
New features
Custom grepo spring namespaces
Grepo now provides custom namespace(s) which should make configuration of repository beans (DAOs) easier.
query-hibernate namespace
In order to use the grepo query-hibernate namespace your spring configuration file has to declare the query-hibernate namspace as follows:
repository-factory
You can define an abstract factory bean like this:
This is the equal to the following configuration:
repository
You can define concrete repository beans like this:
This is equal to the following configuration:
repository-scan
You can also let grepo automatically detect concrete repository beans using the repository scanning feature. This feature is similar (based on) Spring's component-scan feature. You would use it like this:
Using the configuration above, grepo will scan the package (and all sub-packages) demo.repository and automatically create repository beans which are based on the abstract factory bean 'repositoryFactory'.
Note: The repository interfaces (or implementations) have to be annotated with Spring's Repository annotation and furthermore must extend/implement from the GenericQueryRepository interface in order to be detected by the repository-scanner.
Similar to spring's component-scan feature you can use the include-filter/exclude-filter elements to refine repository scanning. For example:
query-jpa namespace
In order to use the grepo query-jpa namespace in your spring configuration file has to declare the query-jpa namspace as follows:
repository-factory
You can define an abstract factory bean like this:
This is the equal to the following configuration:
repository
You can define concrete repository beans like this:
This is equal to the following configuration:
repository-scan
You can also let grepo automatically detect concrete repository beans using the repository scanning feature. This feature is similar (based on) Spring's component-scan feature. You would use it like this:
Using the configuration above, grepo will scan the package (and all sub-packages) demo.repository and automatically create repository beans which are based on the abstract factory bean 'repositoryFactory'.
Note: The repository interfaces (or implementations) have to be annotated with Spring's Repository annotation and furthermore must extend/implement from the GenericQueryRepository interface in order to be detected by the repository-scanner.
Similar to spring's component-scan feature you can use the include-filter/exclude-filter elements to refine repository scanning. For example:
procedure namespace
In order to use the grepo procedure namespace in your spring configuration file has to declare the procedure namspace as follows:
repository-factory
You can define an abstract factory bean like this:
This is the equal to the following configuration:
repository
You can define concrete repository beans like this:
This is equal to the following configuration:
repository-scan
You can also let grepo automatically detect concrete repository beans using the repository scanning feature. This feature is similar (based on) Spring's component-scan feature. You would use it like this:
Using the configuration above, grepo will scan the package (and all sub-packages) demo.repository and automatically create repository beans which are based on the abstract factory bean 'repositoryFactory'.
Note: The repository interfaces (or implementations) have to be annotated with Spring's Repository annotation and furthermore must extend/implement from the GenericProcedureRepository interface in order to be detected by the repository-scanner.
Similar to spring's component-scan feature you can use the include-filter/exclude-filter elements to refine repository scanning. For example:
OSGI artifacts
Grepo artifacts (jars) now include osgi relevant information in it's MANIFEST.MF file. The following is an example of the MANIFEST.MF of the grepo-core artifact:
Manifest-Version: 1.0 Archiver-Version: Plexus Archiver Created-By: Apache Maven Built-By: dguggi Build-Jdk: 1.5.0_17 Bundle-Name: grepo-core Import-Package: org.aopalliance.aop;version="[1.0.0,2.0.0)",org.aopall iance.intercept;version="[1.0.0,2.0.0)",org.apache.commons.lang;versi on="[2.0.0,3.0.0)",org.slf4j;version="[1.5.0,2.0.0)",org.springframew ork.aop.framework;version="[2.5.0,4.0.0)",org.springframework.beans;v ersion="[2.5.0,4.0.0)",org.springframework.beans.factory;version="[2. 5.0,4.0.0)",org.springframework.beans.factory.annotation;version="[2. 5.0,4.0.0)",org.springframework.beans.factory.config;version="[2.5.0, 4.0.0)",org.springframework.beans.factory.parsing;version="[2.5.0,4.0 .0)",org.springframework.beans.factory.support;version="[2.5.0,4.0.0) ",org.springframework.beans.factory.xml;version="[2.5.0,4.0.0)",org.s pringframework.context;version="[2.5.0,4.0.0)",org.springframework.co ntext.annotation;version="[2.5.0,4.0.0)",org.springframework.core.io; version="[2.5.0,4.0.0)",org.springframework.core.type;version="[2.5.0 ,4.0.0)",org.springframework.core.type.classreading;version="[2.5.0,4 .0.0)",org.springframework.core.type.filter;version="[2.5.0,4.0.0)",o rg.springframework.dao;version="[2.5.0,4.0.0)",org.springframework.st ereotype;version="[2.5.0,4.0.0)",org.springframework.transaction.supp ort;version="[2.5.0,4.0.0)",org.springframework.util;version="[2.5.0, 4.0.0)",org.w3c.dom;version="0.0.0" Bundle-ManifestVersion: 2 Bundle-RequiredExecutionEnvironment: J2SE-1.5 Bundle-Vendor: Generic Repository Framework Bundle-SymbolicName: org.codehaus.grepo.core Tool: Bundlor 1.0.0.RELEASE Export-Package: org.codehaus.grepo.core.annotation;version="1.5.0",org .codehaus.grepo.core.aop;version="1.5.0",org.codehaus.grepo.core.conf ig;version="1.5.0";uses:="org.springframework.beans.factory.annotatio n,org.springframework.beans.factory.config,org.springframework.beans. factory.support,org.springframework.beans.factory.xml,org.springframe work.context.annotation,org.springframework.core.type.classreading,or g.springframework.core.type.filter,org.w3c.dom",org.codehaus.grepo.co re.converter;version="1.5.0";uses:="org.codehaus.grepo.core.aop,org.c odehaus.grepo.core.exception,org.codehaus.grepo.core.registry",org.co dehaus.grepo.core.exception;version="1.5.0";uses:="org.springframewor k.dao",org.codehaus.grepo.core.executor;version="1.5.0";uses:="org.sp ringframework.context",org.codehaus.grepo.core.registry;version="1.5. 0";uses:="org.springframework.dao",org.codehaus.grepo.core.repository ;version="1.5.0";uses:="org.aopalliance.intercept,org.codehaus.grepo. core.converter,org.codehaus.grepo.core.exception,org.springframework. beans,org.springframework.beans.factory,org.springframework.context,o rg.springframework.transaction.support",org.codehaus.grepo.core.util; version="1.5.0";uses:="org.codehaus.grepo.core.exception",org.codehau s.grepo.core.validator;version="1.5.0";uses:="org.codehaus.grepo.core .aop,org.codehaus.grepo.core.exception,org.slf4j" Bundle-Version: 1.5.0
Simple Logging Facade for Java (slf4j)
Grepo now uses the slf4j logging api - so the commons-logging api is not required anymore by the framework.
Generic Statistics (gstatistics) component
The "Generic Statistics" component allows to collect runtime statistics of software layers. The component is easily extensible in order to fit custom needs. The gquery and gprocedure components provide out of the box support to collect statistics for dao layer(s) using this component. Because of its extensibility collecting statistics is not only limited to class methods but can also be used to track entire business processes and the like.
The following image shows a statistics summary view of an application using gstatistics (via jboss jmx-console):
![]()
The following image shows a statistics detail view of an application using gstatistics (via jboss jmx-console):
![]()
Upgrading from v1.0
Version 1.5.x is not fully compatible with Version 1.0.x - the following has to be considered when upgrading from grepo version 1.0.x to grepo version 1.5.x:
Location of default config files has changed
The location for the default config files of the grepo framework has changed.
grepo-query-hibernate-default.cfg.xml
grepo-query-jpa-default.cfg.xml
grepo-procedure-default.cfg.xml
Procedure repositories must extend from GenericProcedureRepository
Procedure repositories must extend from GenericProcedureRepository as follows: