From 18ac6f87499d59dd81c2195017dc74a088aecd1c Mon Sep 17 00:00:00 2001 From: Mathieu Baudier Date: Mon, 22 Feb 2010 09:44:55 +0000 Subject: [PATCH] Improve JCR DAO git-svn-id: https://svn.argeo.org/slc/trunk@3382 4cfe0d0a-d680-48aa-b62c-e0a02a3f76cc --- demo/agent.properties | 5 ++- demo/pom.xml | 1 + .../org.argeo.slc.demo.minimal/slc/main.xml | 4 +- .../OsgiBootEquinoxLaunchConfiguration.java | 12 ++++- .../META-INF/spring/db-osgi.xml | 5 ++- .../META-INF/MANIFEST.MF | 10 +++++ .../META-INF/spring/jcr-osgi.xml | 23 ++++++++++ .../META-INF/spring/jcr.xml | 45 +++++++++++++++++++ .../build.properties | 4 ++ .../argeo/slc/jcr/dao/SlcExecutionDaoJcr.java | 16 +++++++ 10 files changed, 117 insertions(+), 8 deletions(-) create mode 100644 modules/server/org.argeo.slc.server.jcr/META-INF/spring/jcr-osgi.xml create mode 100644 modules/server/org.argeo.slc.server.jcr/META-INF/spring/jcr.xml diff --git a/demo/agent.properties b/demo/agent.properties index 52e27bcfd..7bc17a29f 100644 --- a/demo/agent.properties +++ b/demo/agent.properties @@ -2,5 +2,6 @@ argeo.osgi.start=\ org.springframework.osgi.extender,\ org.argeo.slc.support.equinox,\ org.argeo.slc.agent,\ -org.argeo.slc.agent.jmx -com.sun.management.jmxremote= +org.argeo.slc.agent.jms +#org.argeo.slc.agent.jmx +#com.sun.management.jmxremote= diff --git a/demo/pom.xml b/demo/pom.xml index 5859b7206..d3a3da759 100644 --- a/demo/pom.xml +++ b/demo/pom.xml @@ -42,6 +42,7 @@ org.springframework.osgi.extender, org.argeo.server.ads.server, org.argeo.slc.server.hsqldb, + org.argeo.slc.server.jcr, org.argeo.slc.server.main, org.argeo.slc.ria diff --git a/demo/site/org.argeo.slc.demo.minimal/slc/main.xml b/demo/site/org.argeo.slc.demo.minimal/slc/main.xml index e0e35d072..3ae529331 100644 --- a/demo/site/org.argeo.slc.demo.minimal/slc/main.xml +++ b/demo/site/org.argeo.slc.demo.minimal/slc/main.xml @@ -4,7 +4,7 @@ xmlns:aop="http://www.springframework.org/schema/aop" xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd - http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd"> + http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd"> \ No newline at end of file diff --git a/eclipse/plugins/org.argeo.slc.ide.ui/src/main/java/org/argeo/slc/ide/ui/launch/osgi/OsgiBootEquinoxLaunchConfiguration.java b/eclipse/plugins/org.argeo.slc.ide.ui/src/main/java/org/argeo/slc/ide/ui/launch/osgi/OsgiBootEquinoxLaunchConfiguration.java index e619e44f1..cbd84cbe7 100644 --- a/eclipse/plugins/org.argeo.slc.ide.ui/src/main/java/org/argeo/slc/ide/ui/launch/osgi/OsgiBootEquinoxLaunchConfiguration.java +++ b/eclipse/plugins/org.argeo.slc.ide.ui/src/main/java/org/argeo/slc/ide/ui/launch/osgi/OsgiBootEquinoxLaunchConfiguration.java @@ -36,8 +36,8 @@ public class OsgiBootEquinoxLaunchConfiguration extends IFile propertiesFile = (IFile) configuration.getMappedResources()[0]; propertiesFile.getParent().refreshLocal(IResource.DEPTH_INFINITE, monitor); -// propertiesFile.getProject().refreshLocal(IResource.DEPTH_INFINITE, -// monitor); + // propertiesFile.getProject().refreshLocal(IResource.DEPTH_INFINITE, + // monitor); } @Override @@ -83,6 +83,14 @@ public class OsgiBootEquinoxLaunchConfiguration extends wc.doSave(); super.preLaunchCheck(configuration, launch, monitor); + + // Note that if a Java project contains a build.properties it has to + // declare the sources otherwise it will be skipped in the generation of + // the dev.properties file! + + // for(Object bundleId:fAllBundles.keySet()){ + // System.out.println(bundleId+"="+fAllBundles.get(bundleId)); + // } } } diff --git a/modules/server/org.argeo.slc.server.hibernate/META-INF/spring/db-osgi.xml b/modules/server/org.argeo.slc.server.hibernate/META-INF/spring/db-osgi.xml index 381fae864..d17489ba3 100644 --- a/modules/server/org.argeo.slc.server.hibernate/META-INF/spring/db-osgi.xml +++ b/modules/server/org.argeo.slc.server.hibernate/META-INF/spring/db-osgi.xml @@ -6,14 +6,15 @@ http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd"> + + - diff --git a/modules/server/org.argeo.slc.server.jcr/META-INF/MANIFEST.MF b/modules/server/org.argeo.slc.server.jcr/META-INF/MANIFEST.MF index 4b2524ddf..01f566091 100644 --- a/modules/server/org.argeo.slc.server.jcr/META-INF/MANIFEST.MF +++ b/modules/server/org.argeo.slc.server.jcr/META-INF/MANIFEST.MF @@ -2,3 +2,13 @@ Manifest-Version: 1.0 Bundle-Version: 0.12.2.SNAPSHOT Bundle-SymbolicName: org.argeo.slc.server.jcr Bundle-Name: Server JCR +Import-Package: javax.jcr, + org.argeo.jcr, + org.argeo.server.jackrabbit, + org.argeo.slc.core.execution, + org.argeo.slc.dao.process, + org.argeo.slc.execution, + org.argeo.slc.jcr.dao, + org.argeo.slc.process, + org.springframework.beans.factory.config, + org.springframework.osgi.util diff --git a/modules/server/org.argeo.slc.server.jcr/META-INF/spring/jcr-osgi.xml b/modules/server/org.argeo.slc.server.jcr/META-INF/spring/jcr-osgi.xml new file mode 100644 index 000000000..f47df14ae --- /dev/null +++ b/modules/server/org.argeo.slc.server.jcr/META-INF/spring/jcr-osgi.xml @@ -0,0 +1,23 @@ + + + + + + \ No newline at end of file diff --git a/modules/server/org.argeo.slc.server.jcr/META-INF/spring/jcr.xml b/modules/server/org.argeo.slc.server.jcr/META-INF/spring/jcr.xml new file mode 100644 index 000000000..ecba7b537 --- /dev/null +++ b/modules/server/org.argeo.slc.server.jcr/META-INF/spring/jcr.xml @@ -0,0 +1,45 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/runtime/org.argeo.slc.support.jcr/build.properties b/runtime/org.argeo.slc.support.jcr/build.properties index ba373b6d7..db3216bdb 100644 --- a/runtime/org.argeo.slc.support.jcr/build.properties +++ b/runtime/org.argeo.slc.support.jcr/build.properties @@ -5,4 +5,8 @@ additional.bundles = org.springframework.core,\ org.argeo.slc.support.castor,\ com.springsource.javax.xml.stream,\ com.springsource.org.apache.xerces +source.. = src/main/java/,\ + src/main/resources/,\ + src/test/java/,\ + src/test/resources/ \ No newline at end of file diff --git a/runtime/org.argeo.slc.support.jcr/src/main/java/org/argeo/slc/jcr/dao/SlcExecutionDaoJcr.java b/runtime/org.argeo.slc.support.jcr/src/main/java/org/argeo/slc/jcr/dao/SlcExecutionDaoJcr.java index f57102d32..2cc32b0a3 100644 --- a/runtime/org.argeo.slc.support.jcr/src/main/java/org/argeo/slc/jcr/dao/SlcExecutionDaoJcr.java +++ b/runtime/org.argeo.slc.support.jcr/src/main/java/org/argeo/slc/jcr/dao/SlcExecutionDaoJcr.java @@ -15,6 +15,8 @@ import javax.jcr.query.Query; import javax.jcr.query.QueryManager; import javax.jcr.query.QueryResult; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import org.argeo.jcr.BeanNodeMapper; import org.argeo.jcr.JcrUtils; import org.argeo.slc.SlcException; @@ -23,6 +25,7 @@ import org.argeo.slc.process.SlcExecution; import org.argeo.slc.process.SlcExecutionStep; public class SlcExecutionDaoJcr implements SlcExecutionDao { + private final static Log log = LogFactory.getLog(SlcExecutionDaoJcr.class); private Session session; private Workspace workspace; private QueryManager queryManager; @@ -48,6 +51,9 @@ public class SlcExecutionDaoJcr implements SlcExecutionDao { } public void create(SlcExecution slcExecution) { + if (log.isDebugEnabled()) + log.debug("create"); + try { beanNodeMapper.save(getSession(), basePath(slcExecution), slcExecution); @@ -66,6 +72,9 @@ public class SlcExecutionDaoJcr implements SlcExecutionDao { } public SlcExecution getSlcExecution(String uuid) { + if (log.isDebugEnabled()) + log.debug("getSlcExecution"); + try { // TODO: optimize query String queryString = "//process[@uuid='" + uuid + "']"; @@ -80,6 +89,9 @@ public class SlcExecutionDaoJcr implements SlcExecutionDao { } public List listSlcExecutions() { + if (log.isDebugEnabled()) + log.debug("listSlcExecutions"); + List res = new ArrayList(); // TODO: optimize query String queryString = "//process"; @@ -104,6 +116,9 @@ public class SlcExecutionDaoJcr implements SlcExecutionDao { } public void update(SlcExecution slcExecution) { + if (log.isDebugEnabled()) + log.debug("update"); + // TODO: optimize query String queryString = "//process[@uuid='" + slcExecution.getUuid() + "']"; @@ -111,6 +126,7 @@ public class SlcExecutionDaoJcr implements SlcExecutionDao { Query query = queryManager.createQuery(queryString, Query.XPATH); Node node = JcrUtils.querySingleNode(query); beanNodeMapper.update(node, slcExecution); + session.save(); } catch (Exception e) { throw new SlcException("Cannot update " + slcExecution, e); } -- 2.39.2