Pushing data into an external datasource on generation
Author: mariomueller
Publication Date: 2/7/2011 12:03
Hi folks,
I'm trying to hook on the generation (full and partly) to push some entities to a CouchDB instance. I've created a library module and some classes to ease the work and keep the script task small and simple. I've exposed both classes (a Configuration and an Activator Class) in a <public> componentent and added all required jars in a library component. Unfortunately I get a ClassNotFound Exception on execution of the script as additional task of the "Generate full" or "Generate partly" jobs.
Anybody any clues?
This is the script, which is to be executed after the generate task:
//! groovy
def activatorCls = Class.forName("de.mario.firstspirit.publisher.couchdb.Activator")
def configurationCls = Class.forName("de.mario.firstspirit.publisher.couchdb.Configuration")
def cfg = configurationCls.newInstance();
cfg.setCouchHost("localhost");
cfg.setCouchPort(5984);
cfg.setCouchUser("admin");
cfg.setCouchPass("admin");
cfg.setCouchDbName("test");
cfg.setUseHttps(false);
def act = activatorCls.newInstance();
act.setGc(context);
act.setConnection(connection);
act.createCouchDBServerFromConfiguration(cfg);
act.runDataSourceExport();
This is a part of my module.xml
<components>
<public>
<name>CouchDBActivator</name>
<description>ActivatorImpl</description>
<version>1</version>
<class>de.mario.firstspirit.publisher.couchdb.Activator</class>
</public>
<public>
<name>CouchDBConfiguration</name>
<description>ConfigurationImpl</description>
<version>1</version>
<class>de.mario.firstspirit.publisher.couchdb.Configuration</class>
</public>
<library>
<name>CouchDBPublisher</name>
<scope>server</scope>
<hidden>false</hidden>
<resources>
<resource>lib/couchdb.jar</resource>
<resource>lib/slf4j-api-1.6.1.jar</resource>
<resource>lib/svenson-1.3.8.jar</resource>
<resource>lib/jcouchdb-1.0.1-1.jar</resource>
<resource>lib/httpclient-4.0.jar</resource>
<resource>lib/httpcore-4.0.1.jar</resource>
<resource>lib/commons-codec-1.3.jar</resource>
<resource>lib/commons-beanutils-1.8.0.jar</resource>
</resources>
</library>
</components>
Tags: couchdb, generation, publishing
-
Author: Peter_Jodeleit - 2/7/2011 12:12
Could you try "classLoader.loadClass(..)" instead of "Class.forName(..)"?
0
Vous devez vous connecter pour laisser un commentaire.
Commentaires
1 commentaire