From: Mathieu Baudier Date: Tue, 17 Jul 2012 13:52:08 +0000 (+0000) Subject: Move to SLC legacy X-Git-Tag: argeo-slc-2.1.7~656 X-Git-Url: http://git.argeo.org/?a=commitdiff_plain;h=868102c0f0220e12eca836b6ec9b3a2b9a3441e4;p=gpl%2Fargeo-slc.git Move to SLC legacy git-svn-id: https://svn.argeo.org/slc/trunk@5492 4cfe0d0a-d680-48aa-b62c-e0a02a3f76cc --- diff --git a/legacy/modules/org.argeo.slc.agent.ext.jdbc/pom.xml b/legacy/modules/org.argeo.slc.agent.ext.jdbc/pom.xml new file mode 100644 index 000000000..929dc59cd --- /dev/null +++ b/legacy/modules/org.argeo.slc.agent.ext.jdbc/pom.xml @@ -0,0 +1,30 @@ + + 4.0.0 + + org.argeo.slc.modules + agent + 1.1.3-SNAPSHOT + .. + + org.argeo.slc.agent.ext.jdbc + SLC Agent JDBC Extension + + + + org.apache.felix + maven-bundle-plugin + + + org.springframework.jdbc + + *, + com.mysql.jdbc;resolution:=optional, + net.sourceforge.jtds.jdbc;resolution:=optional, + org.hsqldb;resolution:=optional + + + + + + + \ No newline at end of file diff --git a/legacy/modules/org.argeo.slc.agent.ext.xalan/pom.xml b/legacy/modules/org.argeo.slc.agent.ext.xalan/pom.xml new file mode 100644 index 000000000..cb8bf1e8c --- /dev/null +++ b/legacy/modules/org.argeo.slc.agent.ext.xalan/pom.xml @@ -0,0 +1,29 @@ + + 4.0.0 + + org.argeo.slc.modules + agent + 1.1.3-SNAPSHOT + .. + + org.argeo.slc.agent.ext.xalan + SLC Agent Xalan Extension + + + + org.apache.felix + maven-bundle-plugin + + + org.argeo.slc.agent.ext.xalan + + *, + com.sun.org.apache.xml.internal.dtm;resolution:=optional, + org.w3c.dom.traversal;resolution:=optional + + + + + + + \ No newline at end of file diff --git a/legacy/modules/org.argeo.slc.agent.jms/.project b/legacy/modules/org.argeo.slc.agent.jms/.project new file mode 100644 index 000000000..f9cc4f057 --- /dev/null +++ b/legacy/modules/org.argeo.slc.agent.jms/.project @@ -0,0 +1,22 @@ + + + org.argeo.slc.agent.jms + + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.pde.PluginNature + + diff --git a/legacy/modules/org.argeo.slc.agent.jms/META-INF/spring/common.xml b/legacy/modules/org.argeo.slc.agent.jms/META-INF/spring/common.xml new file mode 100644 index 000000000..c0ce5e076 --- /dev/null +++ b/legacy/modules/org.argeo.slc.agent.jms/META-INF/spring/common.xml @@ -0,0 +1,17 @@ + + + + + + + osgibundle:agent.properties + + + + + + \ No newline at end of file diff --git a/legacy/modules/org.argeo.slc.agent.jms/META-INF/spring/jms.xml b/legacy/modules/org.argeo.slc.agent.jms/META-INF/spring/jms.xml new file mode 100644 index 000000000..7924dfe2d --- /dev/null +++ b/legacy/modules/org.argeo.slc.agent.jms/META-INF/spring/jms.xml @@ -0,0 +1,86 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ${slc.server.jms.url} + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/legacy/modules/org.argeo.slc.agent.jms/META-INF/spring/osgi.xml b/legacy/modules/org.argeo.slc.agent.jms/META-INF/spring/osgi.xml new file mode 100644 index 000000000..6020ed85b --- /dev/null +++ b/legacy/modules/org.argeo.slc.agent.jms/META-INF/spring/osgi.xml @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/legacy/modules/org.argeo.slc.agent.jms/agent.properties b/legacy/modules/org.argeo.slc.agent.jms/agent.properties new file mode 100644 index 000000000..d688a7450 --- /dev/null +++ b/legacy/modules/org.argeo.slc.agent.jms/agent.properties @@ -0,0 +1,5 @@ +slc.server.jms.url=tcp://localhost:61616 + +# Customization +slc.agent.jms.disableMarshalling=false +slc.agent.jms.resultListener.onlyOnClose=false diff --git a/legacy/modules/org.argeo.slc.agent.jms/build.properties b/legacy/modules/org.argeo.slc.agent.jms/build.properties new file mode 100644 index 000000000..7594fab8d --- /dev/null +++ b/legacy/modules/org.argeo.slc.agent.jms/build.properties @@ -0,0 +1,2 @@ +bin.includes = META-INF/,\ + . diff --git a/legacy/modules/org.argeo.slc.agent.jms/pom.xml b/legacy/modules/org.argeo.slc.agent.jms/pom.xml new file mode 100644 index 000000000..d6d154ff5 --- /dev/null +++ b/legacy/modules/org.argeo.slc.agent.jms/pom.xml @@ -0,0 +1,26 @@ + + 4.0.0 + + org.argeo.slc.modules + agent + 1.1.3-SNAPSHOT + .. + + org.argeo.slc.agent.jms + SLC Agent JMS + + + + org.apache.felix + maven-bundle-plugin + + + + *, + + + + + + + \ No newline at end of file diff --git a/legacy/modules/org.argeo.slc.ext.activemq/.project b/legacy/modules/org.argeo.slc.ext.activemq/.project new file mode 100644 index 000000000..c8e5c7da6 --- /dev/null +++ b/legacy/modules/org.argeo.slc.ext.activemq/.project @@ -0,0 +1,22 @@ + + + org.argeo.slc.ext.activemq + + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.pde.PluginNature + + diff --git a/legacy/modules/org.argeo.slc.ext.activemq/pom.xml b/legacy/modules/org.argeo.slc.ext.activemq/pom.xml new file mode 100644 index 000000000..b1241927b --- /dev/null +++ b/legacy/modules/org.argeo.slc.ext.activemq/pom.xml @@ -0,0 +1,51 @@ + + 4.0.0 + + org.argeo.slc.modules + agent + 1.1.3-SNAPSHOT + .. + + org.argeo.slc.ext.activemq + SLC ActiveMQ Extension + + + + org.apache.felix + maven-bundle-plugin + + + org.apache.activemq + + *, + org.argeo.slc.runtime, + org.argeo.slc.execution, + org.argeo.slc.msg, + org.argeo.slc.build, + org.argeo.slc.core.execution, + org.argeo.slc.core.attachment, + org.argeo.slc.core.structure, + org.argeo.slc.core.structure.tree, + org.argeo.slc.core.test, + org.argeo.slc.core.test.tree, + org.argeo.slc.deploy, + org.argeo.slc.detached;resolution:=optional, + org.argeo.slc.execution, + org.argeo.slc.msg, + org.argeo.slc.msg.build, + org.argeo.slc.msg.event, + org.argeo.slc.msg.process, + org.argeo.slc.msg.test.tree, + org.argeo.slc.process, + org.argeo.slc.runtime, + org.argeo.slc.test, + org.argeo.slc.xml.process;resolution:=optional, + org.argeo.slc.xml.test.tree;resolution:=optional, + org.hibernate.collection;resolution:=optional + + + + + + + \ No newline at end of file diff --git a/legacy/modules/org.argeo.slc.server.activemq/.project b/legacy/modules/org.argeo.slc.server.activemq/.project new file mode 100644 index 000000000..872d152ec --- /dev/null +++ b/legacy/modules/org.argeo.slc.server.activemq/.project @@ -0,0 +1,22 @@ + + + org.argeo.slc.server.activemq + + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.pde.PluginNature + + diff --git a/legacy/modules/org.argeo.slc.server.activemq/.settings/org.eclipse.pde.core.prefs b/legacy/modules/org.argeo.slc.server.activemq/.settings/org.eclipse.pde.core.prefs new file mode 100644 index 000000000..f0ef2f954 --- /dev/null +++ b/legacy/modules/org.argeo.slc.server.activemq/.settings/org.eclipse.pde.core.prefs @@ -0,0 +1,4 @@ +#Sun Feb 14 20:09:09 CET 2010 +eclipse.preferences.version=1 +pluginProject.extensions=false +resolve.requirebundle=false diff --git a/legacy/modules/org.argeo.slc.server.activemq/META-INF/MANIFEST.MF b/legacy/modules/org.argeo.slc.server.activemq/META-INF/MANIFEST.MF new file mode 100644 index 000000000..4f2283fcc --- /dev/null +++ b/legacy/modules/org.argeo.slc.server.activemq/META-INF/MANIFEST.MF @@ -0,0 +1,11 @@ +Manifest-Version: 1.0 +Bundle-Version: 1.1.3.SNAPSHOT +Bundle-SymbolicName: org.argeo.slc.server.activemq +Import-Package: javax.jms, + org.apache.activemq, + org.argeo.slc.jms, + org.springframework.beans.factory.config, + org.springframework.jms.connection, + org.springframework.jms.support.converter, + org.springframework.oxm +Bundle-Name: Active MQ Server diff --git a/legacy/modules/org.argeo.slc.server.activemq/META-INF/spring/activemq-osgi.xml b/legacy/modules/org.argeo.slc.server.activemq/META-INF/spring/activemq-osgi.xml new file mode 100644 index 000000000..1c63302d2 --- /dev/null +++ b/legacy/modules/org.argeo.slc.server.activemq/META-INF/spring/activemq-osgi.xml @@ -0,0 +1,17 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/legacy/modules/org.argeo.slc.server.activemq/META-INF/spring/activemq.xml b/legacy/modules/org.argeo.slc.server.activemq/META-INF/spring/activemq.xml new file mode 100644 index 000000000..ef5f43ceb --- /dev/null +++ b/legacy/modules/org.argeo.slc.server.activemq/META-INF/spring/activemq.xml @@ -0,0 +1,33 @@ + + + + + + + osgibundle:activemq.properties + + + + + + + + + ${slc.server.jms.url} + + + + + + + + + + + + + \ No newline at end of file diff --git a/legacy/modules/org.argeo.slc.server.activemq/activemq.properties b/legacy/modules/org.argeo.slc.server.activemq/activemq.properties new file mode 100644 index 000000000..0e524d438 --- /dev/null +++ b/legacy/modules/org.argeo.slc.server.activemq/activemq.properties @@ -0,0 +1,3 @@ +slc.server.jms.url=tcp://localhost:61616 + +slc.server.jms.disableMarshalling=false \ No newline at end of file diff --git a/legacy/modules/org.argeo.slc.server.activemq/build.properties b/legacy/modules/org.argeo.slc.server.activemq/build.properties new file mode 100644 index 000000000..5f22cdd44 --- /dev/null +++ b/legacy/modules/org.argeo.slc.server.activemq/build.properties @@ -0,0 +1 @@ +bin.includes = META-INF/ diff --git a/legacy/modules/org.argeo.slc.server.agentproxy/.project b/legacy/modules/org.argeo.slc.server.agentproxy/.project new file mode 100644 index 000000000..b2a0bb1dc --- /dev/null +++ b/legacy/modules/org.argeo.slc.server.agentproxy/.project @@ -0,0 +1,22 @@ + + + org.argeo.slc.server.agentproxy + + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.pde.PluginNature + + diff --git a/legacy/modules/org.argeo.slc.server.agentproxy/META-INF/MANIFEST.MF b/legacy/modules/org.argeo.slc.server.agentproxy/META-INF/MANIFEST.MF new file mode 100644 index 000000000..599022d9d --- /dev/null +++ b/legacy/modules/org.argeo.slc.server.agentproxy/META-INF/MANIFEST.MF @@ -0,0 +1,12 @@ +Manifest-Version: 1.0 +Bundle-Version: 1.1.3.SNAPSHOT +Bundle-SymbolicName: org.argeo.slc.server.agentproxy +Import-Package: javax.jms, + org.apache.activemq.command, + org.argeo.slc.activemq, + org.argeo.slc.jms, + org.argeo.slc.runtime, + org.springframework.beans.factory.config, + org.springframework.jms.core, + org.springframework.jms.support.converter +Bundle-Name: Agent Proxy diff --git a/legacy/modules/org.argeo.slc.server.agentproxy/META-INF/spring/agentProxy-osgi.xml b/legacy/modules/org.argeo.slc.server.agentproxy/META-INF/spring/agentProxy-osgi.xml new file mode 100644 index 000000000..874a92a80 --- /dev/null +++ b/legacy/modules/org.argeo.slc.server.agentproxy/META-INF/spring/agentProxy-osgi.xml @@ -0,0 +1,16 @@ + + + + + + + + + + \ No newline at end of file diff --git a/legacy/modules/org.argeo.slc.server.agentproxy/META-INF/spring/agentProxy.xml b/legacy/modules/org.argeo.slc.server.agentproxy/META-INF/spring/agentProxy.xml new file mode 100644 index 000000000..e67283c5f --- /dev/null +++ b/legacy/modules/org.argeo.slc.server.agentproxy/META-INF/spring/agentProxy.xml @@ -0,0 +1,32 @@ + + + + + + + + + osgibundle:agentproxy.properties + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/legacy/modules/org.argeo.slc.server.agentproxy/agentproxy.properties b/legacy/modules/org.argeo.slc.server.agentproxy/agentproxy.properties new file mode 100644 index 000000000..b003c434a --- /dev/null +++ b/legacy/modules/org.argeo.slc.server.agentproxy/agentproxy.properties @@ -0,0 +1 @@ +slc.server.jms.agentProxy.timeout=20000 \ No newline at end of file diff --git a/legacy/modules/org.argeo.slc.server.agentproxy/build.properties b/legacy/modules/org.argeo.slc.server.agentproxy/build.properties new file mode 100644 index 000000000..7594fab8d --- /dev/null +++ b/legacy/modules/org.argeo.slc.server.agentproxy/build.properties @@ -0,0 +1,2 @@ +bin.includes = META-INF/,\ + . diff --git a/legacy/modules/org.argeo.slc.server.castor/.project b/legacy/modules/org.argeo.slc.server.castor/.project new file mode 100644 index 000000000..f40b28645 --- /dev/null +++ b/legacy/modules/org.argeo.slc.server.castor/.project @@ -0,0 +1,22 @@ + + + org.argeo.slc.server.castor + + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.pde.PluginNature + + diff --git a/legacy/modules/org.argeo.slc.server.castor/META-INF/MANIFEST.MF b/legacy/modules/org.argeo.slc.server.castor/META-INF/MANIFEST.MF new file mode 100644 index 000000000..b11b44993 --- /dev/null +++ b/legacy/modules/org.argeo.slc.server.castor/META-INF/MANIFEST.MF @@ -0,0 +1,7 @@ +Manifest-Version: 1.0 +Bundle-Version: 1.1.3.SNAPSHOT +Bundle-SymbolicName: org.argeo.slc.server.castor +Import-Package: org.springframework.oxm, + org.argeo.slc.castor, + org.springframework.oxm.castor +Bundle-Name: Server Castor diff --git a/legacy/modules/org.argeo.slc.server.castor/META-INF/spring/castor-osgi.xml b/legacy/modules/org.argeo.slc.server.castor/META-INF/spring/castor-osgi.xml new file mode 100644 index 000000000..aaacff8cc --- /dev/null +++ b/legacy/modules/org.argeo.slc.server.castor/META-INF/spring/castor-osgi.xml @@ -0,0 +1,19 @@ + + + + + + + + org.springframework.oxm.Marshaller + + org.springframework.oxm.Unmarshaller + + + + \ No newline at end of file diff --git a/legacy/modules/org.argeo.slc.server.h2/.project b/legacy/modules/org.argeo.slc.server.h2/.project new file mode 100644 index 000000000..431324bb0 --- /dev/null +++ b/legacy/modules/org.argeo.slc.server.h2/.project @@ -0,0 +1,22 @@ + + + org.argeo.slc.server.h2 + + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.pde.PluginNature + + diff --git a/legacy/modules/org.argeo.slc.server.h2/.settings/org.eclipse.pde.core.prefs b/legacy/modules/org.argeo.slc.server.h2/.settings/org.eclipse.pde.core.prefs new file mode 100644 index 000000000..eb0a4dc66 --- /dev/null +++ b/legacy/modules/org.argeo.slc.server.h2/.settings/org.eclipse.pde.core.prefs @@ -0,0 +1,4 @@ +#Tue Jul 13 15:43:47 CEST 2010 +eclipse.preferences.version=1 +pluginProject.extensions=false +resolve.requirebundle=false diff --git a/legacy/modules/org.argeo.slc.server.h2/META-INF/MANIFEST.MF b/legacy/modules/org.argeo.slc.server.h2/META-INF/MANIFEST.MF new file mode 100644 index 000000000..a84864a9d --- /dev/null +++ b/legacy/modules/org.argeo.slc.server.h2/META-INF/MANIFEST.MF @@ -0,0 +1,31 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: Server H2 +Bundle-SymbolicName: org.argeo.slc.server.h2 +Bundle-Version: 1.1.3.SNAPSHOT +Bundle-Vendor: Argeo +Import-Package: net.sf.ehcache.hibernate, + org.aopalliance.aop, + org.argeo.slc.core.attachment, + org.argeo.slc.core.structure, + org.argeo.slc.core.structure.tree, + org.argeo.slc.core.test, + org.argeo.slc.core.test.tree, + org.argeo.slc.hibernate, + org.argeo.slc.hibernate.attachment, + org.argeo.slc.hibernate.process, + org.argeo.slc.hibernate.runtime, + org.argeo.slc.hibernate.structure, + org.argeo.slc.hibernate.test, + org.argeo.slc.hibernate.test.tree, + org.argeo.slc.process, + org.argeo.slc.runtime, + org.argeo.slc.test, + org.h2, + org.h2.jdbcx, + org.hibernate, + org.hibernate.hql.ast, + org.springframework.beans.factory.config, + org.springframework.cache.ehcache, + org.springframework.jdbc.datasource, + org.springframework.orm.hibernate3 diff --git a/legacy/modules/org.argeo.slc.server.h2/META-INF/spring/h2-osgi.xml b/legacy/modules/org.argeo.slc.server.h2/META-INF/spring/h2-osgi.xml new file mode 100644 index 000000000..6d7b0e6f1 --- /dev/null +++ b/legacy/modules/org.argeo.slc.server.h2/META-INF/spring/h2-osgi.xml @@ -0,0 +1,11 @@ + + + + + + \ No newline at end of file diff --git a/legacy/modules/org.argeo.slc.server.h2/META-INF/spring/h2.xml b/legacy/modules/org.argeo.slc.server.h2/META-INF/spring/h2.xml new file mode 100644 index 000000000..fa26f335e --- /dev/null +++ b/legacy/modules/org.argeo.slc.server.h2/META-INF/spring/h2.xml @@ -0,0 +1,49 @@ + + + + + + + + + + osgibundle:h2.properties + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/legacy/modules/org.argeo.slc.server.h2/build.properties b/legacy/modules/org.argeo.slc.server.h2/build.properties new file mode 100644 index 000000000..5f22cdd44 --- /dev/null +++ b/legacy/modules/org.argeo.slc.server.h2/build.properties @@ -0,0 +1 @@ +bin.includes = META-INF/ diff --git a/legacy/modules/org.argeo.slc.server.h2/h2.properties b/legacy/modules/org.argeo.slc.server.h2/h2.properties new file mode 100644 index 000000000..0877043d7 --- /dev/null +++ b/legacy/modules/org.argeo.slc.server.h2/h2.properties @@ -0,0 +1 @@ +slc.server.h2.url=jdbc:h2:mem:test;DB_CLOSE_DELAY=-1 \ No newline at end of file diff --git a/legacy/modules/org.argeo.slc.server.hibernate/.project b/legacy/modules/org.argeo.slc.server.hibernate/.project new file mode 100644 index 000000000..cade579ca --- /dev/null +++ b/legacy/modules/org.argeo.slc.server.hibernate/.project @@ -0,0 +1,22 @@ + + + org.argeo.slc.server.hibernate + + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.pde.PluginNature + + diff --git a/legacy/modules/org.argeo.slc.server.hibernate/META-INF/MANIFEST.MF b/legacy/modules/org.argeo.slc.server.hibernate/META-INF/MANIFEST.MF new file mode 100644 index 000000000..f9dc2f0b5 --- /dev/null +++ b/legacy/modules/org.argeo.slc.server.hibernate/META-INF/MANIFEST.MF @@ -0,0 +1,31 @@ +Manifest-Version: 1.0 +Bundle-Version: 1.1.3.SNAPSHOT +Bundle-SymbolicName: org.argeo.slc.server.hibernate +Import-Package: org.aopalliance.aop, + org.argeo.slc.core.attachment, + org.argeo.slc.core.structure, + org.argeo.slc.core.structure.tree, + org.argeo.slc.core.test, + org.argeo.slc.core.test.tree, + org.argeo.slc.dao.process, + org.argeo.slc.dao.runtime, + org.argeo.slc.dao.test, + org.argeo.slc.dao.test.tree, + org.argeo.slc.hibernate, + org.argeo.slc.hibernate.process, + org.argeo.slc.hibernate.runtime, + org.argeo.slc.hibernate.test, + org.argeo.slc.hibernate.test.tree, + org.argeo.slc.process, + org.argeo.slc.runtime, + org.argeo.slc.test, + org.hibernate, + org.hibernate.hql.ast, + org.hibernate.jdbc, + org.springframework.aop, + org.springframework.aop.framework, + org.springframework.orm.hibernate3, + org.springframework.orm.hibernate3.support, + org.springframework.transaction, + org.springframework.web.context.request +Bundle-Name: Server Hibernate diff --git a/legacy/modules/org.argeo.slc.server.hibernate/META-INF/spring/db-osgi.xml b/legacy/modules/org.argeo.slc.server.hibernate/META-INF/spring/db-osgi.xml new file mode 100644 index 000000000..c85ccd5a2 --- /dev/null +++ b/legacy/modules/org.argeo.slc.server.hibernate/META-INF/spring/db-osgi.xml @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/legacy/modules/org.argeo.slc.server.hibernate/META-INF/spring/db.xml b/legacy/modules/org.argeo.slc.server.hibernate/META-INF/spring/db.xml new file mode 100644 index 000000000..a5d4329dd --- /dev/null +++ b/legacy/modules/org.argeo.slc.server.hibernate/META-INF/spring/db.xml @@ -0,0 +1,43 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/legacy/modules/org.argeo.slc.server.hibernate/META-INF/spring/transaction-osgi.xml b/legacy/modules/org.argeo.slc.server.hibernate/META-INF/spring/transaction-osgi.xml new file mode 100644 index 000000000..f9513808c --- /dev/null +++ b/legacy/modules/org.argeo.slc.server.hibernate/META-INF/spring/transaction-osgi.xml @@ -0,0 +1,14 @@ + + + + + + + + \ No newline at end of file diff --git a/legacy/modules/org.argeo.slc.server.hibernate/META-INF/spring/transaction.xml b/legacy/modules/org.argeo.slc.server.hibernate/META-INF/spring/transaction.xml new file mode 100644 index 000000000..7d03b64e1 --- /dev/null +++ b/legacy/modules/org.argeo.slc.server.hibernate/META-INF/spring/transaction.xml @@ -0,0 +1,64 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/legacy/modules/org.argeo.slc.server.jcr/.project b/legacy/modules/org.argeo.slc.server.jcr/.project new file mode 100644 index 000000000..f2310ab21 --- /dev/null +++ b/legacy/modules/org.argeo.slc.server.jcr/.project @@ -0,0 +1,22 @@ + + + org.argeo.slc.server.jcr + + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.pde.PluginNature + + diff --git a/legacy/modules/org.argeo.slc.server.jcr/META-INF/MANIFEST.MF b/legacy/modules/org.argeo.slc.server.jcr/META-INF/MANIFEST.MF new file mode 100644 index 000000000..a3de4b26e --- /dev/null +++ b/legacy/modules/org.argeo.slc.server.jcr/META-INF/MANIFEST.MF @@ -0,0 +1,32 @@ +Manifest-Version: 1.0 +Bundle-Version: 1.1.3.SNAPSHOT +Bundle-SymbolicName: org.argeo.slc.server.jcr +Bundle-Name: Server JCR +Import-Package: javax.jcr, + org.argeo.jcr, + org.argeo.jcr.mvc, + org.argeo.jcr.spring, + org.argeo.security, + org.argeo.security.core, + org.argeo.security.jcr, + org.argeo.slc.core.attachment, + org.argeo.slc.core.execution, + org.argeo.slc.core.structure, + org.argeo.slc.core.structure.tree, + org.argeo.slc.core.test, + org.argeo.slc.core.test.tree, + org.argeo.slc.dao.process, + org.argeo.slc.dao.runtime, + org.argeo.slc.dao.test, + org.argeo.slc.dao.test.tree, + org.argeo.slc.execution, + org.argeo.slc.jcr, + org.argeo.slc.jcr.dao, + org.argeo.slc.jcr.execution, + org.argeo.slc.process, + org.argeo.slc.runtime, + org.argeo.slc.test, + org.springframework.beans.factory.config, + org.springframework.osgi.util, + org.springframework.security;specification-version="2.0.6.RELEASE", + org.springframework.web.context.request diff --git a/legacy/modules/org.argeo.slc.server.jcr/META-INF/spring/jcr-osgi.xml b/legacy/modules/org.argeo.slc.server.jcr/META-INF/spring/jcr-osgi.xml new file mode 100644 index 000000000..1bf180908 --- /dev/null +++ b/legacy/modules/org.argeo.slc.server.jcr/META-INF/spring/jcr-osgi.xml @@ -0,0 +1,51 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/legacy/modules/org.argeo.slc.server.jcr/META-INF/spring/jcr.xml b/legacy/modules/org.argeo.slc.server.jcr/META-INF/spring/jcr.xml new file mode 100644 index 000000000..ba5e1e161 --- /dev/null +++ b/legacy/modules/org.argeo.slc.server.jcr/META-INF/spring/jcr.xml @@ -0,0 +1,92 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/legacy/modules/org.argeo.slc.server.jcr/build.properties b/legacy/modules/org.argeo.slc.server.jcr/build.properties new file mode 100644 index 000000000..7594fab8d --- /dev/null +++ b/legacy/modules/org.argeo.slc.server.jcr/build.properties @@ -0,0 +1,2 @@ +bin.includes = META-INF/,\ + . diff --git a/legacy/modules/org.argeo.slc.server.jms/.project b/legacy/modules/org.argeo.slc.server.jms/.project new file mode 100644 index 000000000..34ade0272 --- /dev/null +++ b/legacy/modules/org.argeo.slc.server.jms/.project @@ -0,0 +1,22 @@ + + + org.argeo.slc.server.jms + + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.pde.PluginNature + + diff --git a/legacy/modules/org.argeo.slc.server.jms/META-INF/MANIFEST.MF b/legacy/modules/org.argeo.slc.server.jms/META-INF/MANIFEST.MF new file mode 100644 index 000000000..a7a76c126 --- /dev/null +++ b/legacy/modules/org.argeo.slc.server.jms/META-INF/MANIFEST.MF @@ -0,0 +1,22 @@ +Manifest-Version: 1.0 +Bundle-Version: 1.1.3.SNAPSHOT +Bundle-SymbolicName: org.argeo.slc.server.jms +Import-Package: javax.jms, + javax.management.j2ee.statistics, + org.apache.activemq, + org.apache.activemq.command, + org.apache.commons.logging, + org.argeo.security, + org.argeo.security.core, + org.argeo.slc.activemq, + org.argeo.slc.core.attachment, + org.argeo.slc.jms, + org.argeo.slc.msg.event, + org.argeo.slc.services, + org.springframework.beans.factory.config, + org.springframework.jms.core, + org.springframework.jms.listener, + org.springframework.jms.listener.adapter, + org.springframework.jms.support.converter, + org.springframework.transaction +Bundle-Name: Server JMS diff --git a/legacy/modules/org.argeo.slc.server.jms/META-INF/spring/jms-osgi.xml b/legacy/modules/org.argeo.slc.server.jms/META-INF/spring/jms-osgi.xml new file mode 100644 index 000000000..0f900ba78 --- /dev/null +++ b/legacy/modules/org.argeo.slc.server.jms/META-INF/spring/jms-osgi.xml @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/legacy/modules/org.argeo.slc.server.jms/META-INF/spring/jms.xml b/legacy/modules/org.argeo.slc.server.jms/META-INF/spring/jms.xml new file mode 100644 index 000000000..b7e379129 --- /dev/null +++ b/legacy/modules/org.argeo.slc.server.jms/META-INF/spring/jms.xml @@ -0,0 +1,110 @@ + + + + + + + + + osgibundle:jms.properties + + + + + + + + + + + + + + + + + + + + ${slc.server.jms.url} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/legacy/modules/org.argeo.slc.server.jms/build.properties b/legacy/modules/org.argeo.slc.server.jms/build.properties new file mode 100644 index 000000000..7594fab8d --- /dev/null +++ b/legacy/modules/org.argeo.slc.server.jms/build.properties @@ -0,0 +1,2 @@ +bin.includes = META-INF/,\ + . diff --git a/legacy/modules/org.argeo.slc.server.jms/jms.properties b/legacy/modules/org.argeo.slc.server.jms/jms.properties new file mode 100644 index 000000000..8244f4bcb --- /dev/null +++ b/legacy/modules/org.argeo.slc.server.jms/jms.properties @@ -0,0 +1,2 @@ +# TODO: duplicated with activemq bundle! +slc.server.jms.url=tcp://localhost:61616 diff --git a/legacy/modules/org.argeo.slc.server.main/.project b/legacy/modules/org.argeo.slc.server.main/.project new file mode 100644 index 000000000..9b86d4427 --- /dev/null +++ b/legacy/modules/org.argeo.slc.server.main/.project @@ -0,0 +1,22 @@ + + + org.argeo.slc.server.main + + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.pde.PluginNature + + diff --git a/legacy/modules/org.argeo.slc.server.main/META-INF/MANIFEST.MF b/legacy/modules/org.argeo.slc.server.main/META-INF/MANIFEST.MF new file mode 100644 index 000000000..4dc489ff5 --- /dev/null +++ b/legacy/modules/org.argeo.slc.server.main/META-INF/MANIFEST.MF @@ -0,0 +1,6 @@ +Manifest-Version: 1.0 +Require-Bundle: org.argeo.slc.specs,org.argeo.slc.support.equinox +Bundle-Version: 1.1.3.SNAPSHOT +Bundle-Name: SLC Server Main +Bundle-SymbolicName: org.argeo.slc.server.main +Import-Package: org.argeo.slc.build,org.argeo.slc.osgi.build diff --git a/legacy/modules/org.argeo.slc.server.main/META-INF/spring/eclipseUpdateSite.xml b/legacy/modules/org.argeo.slc.server.main/META-INF/spring/eclipseUpdateSite.xml new file mode 100644 index 000000000..6e8775c18 --- /dev/null +++ b/legacy/modules/org.argeo.slc.server.main/META-INF/spring/eclipseUpdateSite.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/legacy/modules/org.argeo.slc.server.main/META-INF/spring/main.xml b/legacy/modules/org.argeo.slc.server.main/META-INF/spring/main.xml new file mode 100644 index 000000000..5a763ad7e --- /dev/null +++ b/legacy/modules/org.argeo.slc.server.main/META-INF/spring/main.xml @@ -0,0 +1,43 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/legacy/modules/org.argeo.slc.server.main/META-INF/spring/manager.xml b/legacy/modules/org.argeo.slc.server.main/META-INF/spring/manager.xml new file mode 100644 index 000000000..bf342bb6c --- /dev/null +++ b/legacy/modules/org.argeo.slc.server.main/META-INF/spring/manager.xml @@ -0,0 +1,11 @@ + + + + + + + + \ No newline at end of file diff --git a/legacy/modules/org.argeo.slc.server.main/META-INF/spring/osgi.xml b/legacy/modules/org.argeo.slc.server.main/META-INF/spring/osgi.xml new file mode 100644 index 000000000..50237f47d --- /dev/null +++ b/legacy/modules/org.argeo.slc.server.main/META-INF/spring/osgi.xml @@ -0,0 +1,11 @@ + + + + + + \ No newline at end of file diff --git a/legacy/modules/org.argeo.slc.server.main/build.properties b/legacy/modules/org.argeo.slc.server.main/build.properties new file mode 100644 index 000000000..7594fab8d --- /dev/null +++ b/legacy/modules/org.argeo.slc.server.main/build.properties @@ -0,0 +1,2 @@ +bin.includes = META-INF/,\ + . diff --git a/legacy/modules/org.argeo.slc.server.mysql/.project b/legacy/modules/org.argeo.slc.server.mysql/.project new file mode 100644 index 000000000..a45bb024e --- /dev/null +++ b/legacy/modules/org.argeo.slc.server.mysql/.project @@ -0,0 +1,22 @@ + + + org.argeo.slc.server.mysql + + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.pde.PluginNature + + diff --git a/legacy/modules/org.argeo.slc.server.mysql/META-INF/MANIFEST.MF b/legacy/modules/org.argeo.slc.server.mysql/META-INF/MANIFEST.MF new file mode 100644 index 000000000..29ddc6009 --- /dev/null +++ b/legacy/modules/org.argeo.slc.server.mysql/META-INF/MANIFEST.MF @@ -0,0 +1,14 @@ +Manifest-Version: 1.0 +Require-Bundle: org.argeo.slc.specs,org.argeo.slc.core +Bundle-Version: 1.1.3.SNAPSHOT +Bundle-Name: Argeo SLC MySQL +Bundle-SymbolicName: org.argeo.slc.server.mysql +Import-Package: com.mysql.jdbc, + net.sf.ehcache.hibernate, + org.apache.commons.dbcp, + org.hibernate, + org.hibernate.hql.ast, + org.springframework.beans.factory.config, + org.springframework.cache.ehcache, + org.springframework.jdbc.datasource, + org.springframework.orm.hibernate3 diff --git a/legacy/modules/org.argeo.slc.server.mysql/META-INF/spring/mysql.xml b/legacy/modules/org.argeo.slc.server.mysql/META-INF/spring/mysql.xml new file mode 100644 index 000000000..4f85f569e --- /dev/null +++ b/legacy/modules/org.argeo.slc.server.mysql/META-INF/spring/mysql.xml @@ -0,0 +1,58 @@ + + + + + + + + + osgibundle:mysql.properties + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/legacy/modules/org.argeo.slc.server.mysql/META-INF/spring/osgi.xml b/legacy/modules/org.argeo.slc.server.mysql/META-INF/spring/osgi.xml new file mode 100644 index 000000000..6d7b0e6f1 --- /dev/null +++ b/legacy/modules/org.argeo.slc.server.mysql/META-INF/spring/osgi.xml @@ -0,0 +1,11 @@ + + + + + + \ No newline at end of file diff --git a/legacy/modules/org.argeo.slc.server.mysql/mysql.properties b/legacy/modules/org.argeo.slc.server.mysql/mysql.properties new file mode 100644 index 000000000..11a0d5544 --- /dev/null +++ b/legacy/modules/org.argeo.slc.server.mysql/mysql.properties @@ -0,0 +1,3 @@ +jdbc.url=jdbc:mysql://localhost/slc +jdbc.username=root +jdbc.password= diff --git a/legacy/modules/org.argeo.slc.server.services/.project b/legacy/modules/org.argeo.slc.server.services/.project new file mode 100644 index 000000000..21e00d813 --- /dev/null +++ b/legacy/modules/org.argeo.slc.server.services/.project @@ -0,0 +1,22 @@ + + + org.argeo.slc.server.services + + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.pde.PluginNature + + diff --git a/legacy/modules/org.argeo.slc.server.services/META-INF/MANIFEST.MF b/legacy/modules/org.argeo.slc.server.services/META-INF/MANIFEST.MF new file mode 100644 index 000000000..54cab2c93 --- /dev/null +++ b/legacy/modules/org.argeo.slc.server.services/META-INF/MANIFEST.MF @@ -0,0 +1,21 @@ +Manifest-Version: 1.0 +Bundle-Version: 1.1.3.SNAPSHOT +Bundle-Name: SLC Server Services +Bundle-SymbolicName: org.argeo.slc.server.services +Import-Package: org.aopalliance.aop, + org.argeo.security, + org.argeo.slc.core.attachment, + org.argeo.slc.dao.process, + org.argeo.slc.dao.runtime, + org.argeo.slc.dao.test, + org.argeo.slc.dao.test.tree, + org.argeo.slc.msg.event, + org.argeo.slc.msg.process, + org.argeo.slc.process, + org.argeo.slc.runtime, + org.argeo.slc.services, + org.argeo.slc.services.impl, + org.hibernate.jdbc, + org.springframework.aop, + org.springframework.aop.framework, + org.springframework.beans.factory.config diff --git a/legacy/modules/org.argeo.slc.server.services/META-INF/spring/services-osgi.xml b/legacy/modules/org.argeo.slc.server.services/META-INF/spring/services-osgi.xml new file mode 100644 index 000000000..0b80c6e96 --- /dev/null +++ b/legacy/modules/org.argeo.slc.server.services/META-INF/spring/services-osgi.xml @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + + + + + + + + + + org.argeo.slc.core.attachment.AttachmentsStorage + + org.argeo.slc.core.attachment.AttachmentUploader + + + + + + \ No newline at end of file diff --git a/legacy/modules/org.argeo.slc.server.services/META-INF/spring/services.xml b/legacy/modules/org.argeo.slc.server.services/META-INF/spring/services.xml new file mode 100644 index 000000000..39f318f72 --- /dev/null +++ b/legacy/modules/org.argeo.slc.server.services/META-INF/spring/services.xml @@ -0,0 +1,49 @@ + + + + + + + + osgibundle:services.properties + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/legacy/modules/org.argeo.slc.server.services/build.properties b/legacy/modules/org.argeo.slc.server.services/build.properties new file mode 100644 index 000000000..7594fab8d --- /dev/null +++ b/legacy/modules/org.argeo.slc.server.services/build.properties @@ -0,0 +1,2 @@ +bin.includes = META-INF/,\ + . diff --git a/legacy/modules/org.argeo.slc.server.services/services.properties b/legacy/modules/org.argeo.slc.server.services/services.properties new file mode 100644 index 000000000..2814c6d17 --- /dev/null +++ b/legacy/modules/org.argeo.slc.server.services/services.properties @@ -0,0 +1 @@ +slc.server.services.pingCycle=60000 \ No newline at end of file diff --git a/legacy/modules/org.argeo.slc.webapp/.project b/legacy/modules/org.argeo.slc.webapp/.project new file mode 100644 index 000000000..edfa86a11 --- /dev/null +++ b/legacy/modules/org.argeo.slc.webapp/.project @@ -0,0 +1,22 @@ + + + org.argeo.slc.webapp.war + + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.pde.PluginNature + + diff --git a/legacy/modules/org.argeo.slc.webapp/META-INF/MANIFEST.MF b/legacy/modules/org.argeo.slc.webapp/META-INF/MANIFEST.MF new file mode 100644 index 000000000..ce1a34d90 --- /dev/null +++ b/legacy/modules/org.argeo.slc.webapp/META-INF/MANIFEST.MF @@ -0,0 +1,59 @@ +Manifest-Version: 1.0 +Bundle-ClassPath: WEB-INF/classes +Bundle-Version: 1.1.3.SNAPSHOT +Bundle-Name: SLC Webapp +Web-ContextPath: org.argeo.slc.webapp +Bundle-SymbolicName: org.argeo.slc.webapp +Import-Package: javax.jcr, + net.sf.cglib.core, + net.sf.cglib.proxy, + net.sf.cglib.reflect, + org.aopalliance.aop, + org.argeo.jackrabbit.remote, + org.argeo.security.mvc, + org.argeo.server, + org.argeo.jcr.mvc, + org.argeo.server.json, + org.argeo.server.mvc, + org.argeo.slc.build, + org.argeo.slc.core.attachment, + org.argeo.slc.core.test.tree, + org.argeo.slc.dao.process, + org.argeo.slc.dao.runtime, + org.argeo.slc.dao.test, + org.argeo.slc.dao.test.tree, + org.argeo.slc.deploy, + org.argeo.slc.msg.event, + org.argeo.slc.runtime, + org.argeo.slc.services, + org.argeo.slc.web.ajaxplorer.file, + org.argeo.slc.web.ajaxplorer.mvc, + org.argeo.slc.web.mvc, + org.argeo.slc.web.mvc.controllers, + org.argeo.slc.web.mvc.provisioning, + org.hibernate.hql.ast;resolution:=optional, + org.hibernate.jdbc;resolution:=optional, + org.springframework.aop, + org.springframework.aop.framework, + org.springframework.aop.scope, + org.springframework.beans.factory.support, + org.springframework.osgi.web.context.support, + org.springframework.oxm, + org.springframework.security, + org.springframework.security.config, + org.springframework.security.context, + org.springframework.security.providers, + org.springframework.security.ui, + org.springframework.security.ui.webapp, + org.springframework.security.userdetails, + org.springframework.security.userdetails.memory, + org.springframework.transaction, + org.springframework.web.context, + org.springframework.web.context.request, + org.springframework.web.context.support, + org.springframework.web.filter, + org.springframework.web.servlet, + org.springframework.web.servlet.handler, + org.springframework.web.servlet.mvc, + org.springframework.web.servlet.mvc.annotation, + org.springframework.web.servlet.view diff --git a/legacy/modules/org.argeo.slc.webapp/WEB-INF/ajaxplorer-servlet.xml b/legacy/modules/org.argeo.slc.webapp/WEB-INF/ajaxplorer-servlet.xml new file mode 100644 index 000000000..a706606b2 --- /dev/null +++ b/legacy/modules/org.argeo.slc.webapp/WEB-INF/ajaxplorer-servlet.xml @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + + + + + ajxpDriverHandler + + + + + \ No newline at end of file diff --git a/legacy/modules/org.argeo.slc.webapp/WEB-INF/applicationContext.xml b/legacy/modules/org.argeo.slc.webapp/WEB-INF/applicationContext.xml new file mode 100644 index 000000000..1b9c09502 --- /dev/null +++ b/legacy/modules/org.argeo.slc.webapp/WEB-INF/applicationContext.xml @@ -0,0 +1,46 @@ + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/legacy/modules/org.argeo.slc.webapp/WEB-INF/doc-servlet.xml b/legacy/modules/org.argeo.slc.webapp/WEB-INF/doc-servlet.xml new file mode 100644 index 000000000..0576d0ccf --- /dev/null +++ b/legacy/modules/org.argeo.slc.webapp/WEB-INF/doc-servlet.xml @@ -0,0 +1,46 @@ + + + + + + + + + + + + + + + + + + org.argeo.slc.web.mvc.XsltMarshallerView + + + + WEB-INF/xslt/ + + + .xsl + + + + + + + + + + + + + \ No newline at end of file diff --git a/legacy/modules/org.argeo.slc.webapp/WEB-INF/jcr-manager-servlet.xml b/legacy/modules/org.argeo.slc.webapp/WEB-INF/jcr-manager-servlet.xml new file mode 100644 index 000000000..78670a61a --- /dev/null +++ b/legacy/modules/org.argeo.slc.webapp/WEB-INF/jcr-manager-servlet.xml @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/legacy/modules/org.argeo.slc.webapp/WEB-INF/jcr-servlet.xml b/legacy/modules/org.argeo.slc.webapp/WEB-INF/jcr-servlet.xml new file mode 100644 index 000000000..61c886765 --- /dev/null +++ b/legacy/modules/org.argeo.slc.webapp/WEB-INF/jcr-servlet.xml @@ -0,0 +1,51 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/legacy/modules/org.argeo.slc.webapp/WEB-INF/osgi.xml b/legacy/modules/org.argeo.slc.webapp/WEB-INF/osgi.xml new file mode 100644 index 000000000..25dee67fd --- /dev/null +++ b/legacy/modules/org.argeo.slc.webapp/WEB-INF/osgi.xml @@ -0,0 +1,51 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/legacy/modules/org.argeo.slc.webapp/WEB-INF/provisioning-servlet.xml b/legacy/modules/org.argeo.slc.webapp/WEB-INF/provisioning-servlet.xml new file mode 100644 index 000000000..bc2df745c --- /dev/null +++ b/legacy/modules/org.argeo.slc.webapp/WEB-INF/provisioning-servlet.xml @@ -0,0 +1,94 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + /*/*/modules.html=availableModulesHtml + /*/*/modules=availableModulesPlain + /*/*/modularDistribution=availableModulesOsgiBoot + /*/*/site.xml=updateSiteHandler + + + + + + + + + + + + + + /*/*/plugins/*=getBundleHandler + /*/*/features/*=getBundleHandler + + + + + + + + + + + + + + /*/*/*.jar=getBundleHandler + + + + + + + + + + + + /distributions=availableDistributions + + + + + + + + + + + + \ No newline at end of file diff --git a/legacy/modules/org.argeo.slc.webapp/WEB-INF/security.xml b/legacy/modules/org.argeo.slc.webapp/WEB-INF/security.xml new file mode 100644 index 000000000..9ae3de4a8 --- /dev/null +++ b/legacy/modules/org.argeo.slc.webapp/WEB-INF/security.xml @@ -0,0 +1,43 @@ + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/legacy/modules/org.argeo.slc.webapp/WEB-INF/slc-service-servlet.xml b/legacy/modules/org.argeo.slc.webapp/WEB-INF/slc-service-servlet.xml new file mode 100644 index 000000000..73d854d7c --- /dev/null +++ b/legacy/modules/org.argeo.slc.webapp/WEB-INF/slc-service-servlet.xml @@ -0,0 +1,77 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/legacy/modules/org.argeo.slc.webapp/WEB-INF/web.xml b/legacy/modules/org.argeo.slc.webapp/WEB-INF/web.xml new file mode 100644 index 000000000..a8a404215 --- /dev/null +++ b/legacy/modules/org.argeo.slc.webapp/WEB-INF/web.xml @@ -0,0 +1,143 @@ + + + + SLC Web Application + + + + slc-service + org.springframework.web.servlet.DispatcherServlet + + contextClass + org.springframework.osgi.web.context.support.OsgiBundleXmlWebApplicationContext + + 1 + + + slc-service + *.service + + + + + doc + org.springframework.web.servlet.DispatcherServlet + + contextClass + org.springframework.osgi.web.context.support.OsgiBundleXmlWebApplicationContext + + + + + doc + *.xls + + + doc + *.pdf + + + doc + *.xslt + + + doc + *.xml + + + + + provisioning + org.springframework.web.servlet.DispatcherServlet + + contextClass + org.springframework.osgi.web.context.support.OsgiBundleXmlWebApplicationContext + + 1 + + + provisioning + /dist/* + + + + + jcr + org.springframework.web.servlet.DispatcherServlet + + contextClass + org.springframework.osgi.web.context.support.OsgiBundleXmlWebApplicationContext + + 1 + + + jcr + *.jcr + + + + + jcr-manager + org.springframework.web.servlet.DispatcherServlet + + contextClass + org.springframework.osgi.web.context.support.OsgiBundleXmlWebApplicationContext + + 1 + + + + jcr-manager + /jcr-manager/* + + + + + ajaxplorer + org.springframework.web.servlet.DispatcherServlet + + contextClass + org.springframework.osgi.web.context.support.OsgiBundleXmlWebApplicationContext + + 1 + + + + ajaxplorer + /ajaxplorer/* + + + + + contextConfigLocation + /WEB-INF/applicationContext.xml + + + + Spring Context + org.springframework.web.context.ContextLoaderListener + + + contextClass + org.springframework.osgi.web.context.support.OsgiBundleXmlWebApplicationContext + + + + diff --git a/legacy/modules/org.argeo.slc.webapp/WEB-INF/webdav-config.xml b/legacy/modules/org.argeo.slc.webapp/WEB-INF/webdav-config.xml new file mode 100644 index 000000000..f562d766e --- /dev/null +++ b/legacy/modules/org.argeo.slc.webapp/WEB-INF/webdav-config.xml @@ -0,0 +1,197 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + nt:file + nt:resource + + + + + + + + + + + + + rep + jcr + + + + + + + diff --git a/legacy/modules/org.argeo.slc.webapp/WEB-INF/webdav-servlet.xml b/legacy/modules/org.argeo.slc.webapp/WEB-INF/webdav-servlet.xml new file mode 100644 index 000000000..4aa318128 --- /dev/null +++ b/legacy/modules/org.argeo.slc.webapp/WEB-INF/webdav-servlet.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + + webdavServlet + + + + + \ No newline at end of file diff --git a/legacy/modules/org.argeo.slc.webapp/WEB-INF/xslt/resultView.xsl b/legacy/modules/org.argeo.slc.webapp/WEB-INF/xslt/resultView.xsl new file mode 100644 index 000000000..e9989bdbe --- /dev/null +++ b/legacy/modules/org.argeo.slc.webapp/WEB-INF/xslt/resultView.xsl @@ -0,0 +1,51 @@ + + + + + + + + + + Result + + +

+ Result + +

+ +

+ +

+ + + + + + + + + + + + + +
+ + + +
+
+ + +
+
\ No newline at end of file diff --git a/legacy/modules/org.argeo.slc.webapp/WEB-INF/xslt/resultXmlView.xsl b/legacy/modules/org.argeo.slc.webapp/WEB-INF/xslt/resultXmlView.xsl new file mode 100644 index 000000000..87d63716f --- /dev/null +++ b/legacy/modules/org.argeo.slc.webapp/WEB-INF/xslt/resultXmlView.xsl @@ -0,0 +1,10 @@ + + + + + + + \ No newline at end of file diff --git a/legacy/modules/org.argeo.slc.webapp/WEB-INF/xslt/resultXsltView.xsl b/legacy/modules/org.argeo.slc.webapp/WEB-INF/xslt/resultXsltView.xsl new file mode 100644 index 000000000..e9989bdbe --- /dev/null +++ b/legacy/modules/org.argeo.slc.webapp/WEB-INF/xslt/resultXsltView.xsl @@ -0,0 +1,51 @@ + + + + + + + + + + Result + + +

+ Result + +

+ +

+ +

+ + + + + + + + + + + + + +
+ + + +
+
+ + +
+
\ No newline at end of file diff --git a/legacy/modules/org.argeo.slc.webapp/WEB-INF/xslt/viewXml.xsl b/legacy/modules/org.argeo.slc.webapp/WEB-INF/xslt/viewXml.xsl new file mode 100644 index 000000000..87d63716f --- /dev/null +++ b/legacy/modules/org.argeo.slc.webapp/WEB-INF/xslt/viewXml.xsl @@ -0,0 +1,10 @@ + + + + + + + \ No newline at end of file diff --git a/legacy/runtime/org.argeo.slc.support.activemq/.classpath b/legacy/runtime/org.argeo.slc.support.activemq/.classpath new file mode 100644 index 000000000..581598319 --- /dev/null +++ b/legacy/runtime/org.argeo.slc.support.activemq/.classpath @@ -0,0 +1,8 @@ + + + + + >> + + + diff --git a/legacy/runtime/org.argeo.slc.support.activemq/.project b/legacy/runtime/org.argeo.slc.support.activemq/.project new file mode 100644 index 000000000..c1292c0e6 --- /dev/null +++ b/legacy/runtime/org.argeo.slc.support.activemq/.project @@ -0,0 +1,28 @@ + + + org.argeo.slc.support.activemq + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.jdt.core.javanature + org.eclipse.pde.PluginNature + + diff --git a/legacy/runtime/org.argeo.slc.support.activemq/.settings/org.eclipse.jdt.core.prefs b/legacy/runtime/org.argeo.slc.support.activemq/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 000000000..8bd7b109a --- /dev/null +++ b/legacy/runtime/org.argeo.slc.support.activemq/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,12 @@ +#Sat Jan 10 17:12:41 CET 2009 +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.compiler.compliance=1.5 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.5 diff --git a/legacy/runtime/org.argeo.slc.support.activemq/.settings/org.maven.ide.eclipse.prefs b/legacy/runtime/org.argeo.slc.support.activemq/.settings/org.maven.ide.eclipse.prefs new file mode 100644 index 000000000..9b6b74ee9 --- /dev/null +++ b/legacy/runtime/org.argeo.slc.support.activemq/.settings/org.maven.ide.eclipse.prefs @@ -0,0 +1,8 @@ +#Sat Jan 10 17:11:12 CET 2009 +activeProfiles= +eclipse.preferences.version=1 +fullBuildGoals=process-test-resources +includeModules=false +resolveWorkspaceProjects=true +resourceFilterGoals=process-resources resources\:testResources +version=1 diff --git a/legacy/runtime/org.argeo.slc.support.activemq/build.properties b/legacy/runtime/org.argeo.slc.support.activemq/build.properties new file mode 100644 index 000000000..f0cc4f1b4 --- /dev/null +++ b/legacy/runtime/org.argeo.slc.support.activemq/build.properties @@ -0,0 +1,2 @@ +source.. = src/main/java/,\ + src/main/resources/ diff --git a/legacy/runtime/org.argeo.slc.support.activemq/pom.xml b/legacy/runtime/org.argeo.slc.support.activemq/pom.xml new file mode 100644 index 000000000..6b3c1db5e --- /dev/null +++ b/legacy/runtime/org.argeo.slc.support.activemq/pom.xml @@ -0,0 +1,95 @@ + + + 4.0.0 + + org.argeo.slc + runtime + 1.1.3-SNAPSHOT + .. + + org.argeo.slc.runtime + org.argeo.slc.support.activemq + SLC Support ActiveMQ + + + + org.apache.felix + maven-bundle-plugin + + + + + org.argeo.slc.jms.*,org.argeo.slc.activemq + + + javax.xml.transform;version="0.0.0", + * + + + + + + + + + + org.argeo.slc.runtime + org.argeo.slc.core + 1.1.3-SNAPSHOT + + + + + org.argeo.tp + org.springframework.jms + + + org.argeo.tp + org.springframework.oxm + + + org.argeo.tp + org.springframework.transaction + + + + + org.argeo.tp + org.aspectj.weaver + + + + + org.argeo.tp + javax.jms + + + + + org.argeo.tp + org.apache.activemq + + + org.argeo.tp + org.apache.commons.pool + + + + + org.argeo.tp + javax.management.j2ee + + + org.argeo.tp + javax.ejb + + + org.argeo.tp + javax.xml.rpc + + + org.argeo.tp + javax.servlet + + + \ No newline at end of file diff --git a/legacy/runtime/org.argeo.slc.support.activemq/src/main/java/org/argeo/slc/jms/JmsAgent.java b/legacy/runtime/org.argeo.slc.support.activemq/src/main/java/org/argeo/slc/jms/JmsAgent.java new file mode 100644 index 000000000..3851a2a9c --- /dev/null +++ b/legacy/runtime/org.argeo.slc.support.activemq/src/main/java/org/argeo/slc/jms/JmsAgent.java @@ -0,0 +1,198 @@ +/* + * Copyright (C) 2007-2012 Mathieu Baudier + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.argeo.slc.jms; + +import java.util.List; + +import javax.jms.Destination; +import javax.jms.JMSException; +import javax.jms.Message; +import javax.jms.MessageListener; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.argeo.slc.SlcException; +import org.argeo.slc.core.runtime.DefaultAgent; +import org.argeo.slc.execution.ExecutionModuleDescriptor; +import org.argeo.slc.msg.ExecutionAnswer; +import org.argeo.slc.msg.MsgConstants; +import org.argeo.slc.msg.ReferenceList; +import org.argeo.slc.process.SlcExecution; +import org.argeo.slc.runtime.SlcAgentDescriptor; +import org.springframework.jms.JmsException; +import org.springframework.jms.core.JmsTemplate; +import org.springframework.jms.core.MessagePostProcessor; + +/** JMS based implementation of an SLC Agent. */ +public class JmsAgent extends DefaultAgent implements MessageListener { + public final static String PROPERTY_QUERY = "query"; + public final static String QUERY_PING_ALL = "pingAll"; + + private final static Log log = LogFactory.getLog(JmsAgent.class); + + private JmsTemplate jmsTemplate; + private Destination agentRegister; + private Destination agentUnregister; + + private Destination responseDestination; + + public void init() { + super.init(); + try { + jmsTemplate.convertAndSend(agentRegister, getAgentDescriptor()); + log.info("Agent #" + getAgentUuid() + " registered to " + + agentRegister); + } catch (JmsException e) { + log.warn("Could not register agent " + + getAgentDescriptor().getUuid() + + " to server: " + + e.getMessage() + + ". The agent will stay offline but will keep listening for a ping all sent by server."); + if (log.isTraceEnabled()) + log.debug("Original error.", e); + } + } + + @Override + public void destroy() { + try { + jmsTemplate.convertAndSend(agentUnregister, getAgentDescriptor()); + log.info("Agent #" + getAgentUuid() + " unregistered from " + + agentUnregister); + } catch (JmsException e) { + log.warn("Could not unregister agent " + getAgentUuid() + ": " + + e.getMessage()); + if (log.isTraceEnabled()) + log.debug("Original error.", e); + } + super.destroy(); + } + + public void setAgentRegister(Destination agentRegister) { + this.agentRegister = agentRegister; + } + + public void setAgentUnregister(Destination agentUnregister) { + this.agentUnregister = agentUnregister; + } + + public String getMessageSelector() { + String messageSelector = "slc_agentId='" + getAgentUuid() + "'"; + // if (log.isDebugEnabled()) + // log.debug("Message selector: " + messageSelector); + return messageSelector; + } + + public void onMessage(final Message message) { + final String query; + final String correlationId; + try { + query = message.getStringProperty(PROPERTY_QUERY); + correlationId = message.getJMSCorrelationID(); + } catch (JMSException e1) { + throw new SlcException("Cannot analyze incoming message " + message); + } + + final Object response; + final Destination destinationSend; + if (QUERY_PING_ALL.equals(query)) { + ReferenceList refList = (ReferenceList) convertFrom(message); + if (!refList.getReferences().contains(getAgentUuid())) { + response = getAgentDescriptor(); + destinationSend = agentRegister; + log.info("Agent #" + getAgentUuid() + " registering to " + + agentRegister + " in reply to a " + QUERY_PING_ALL + + " query"); + } else { + return; + } + } else { + response = process(query, message); + destinationSend = responseDestination; + } + + // Send response + if (log.isTraceEnabled()) + log.trace("About to send response " + response.getClass()); + jmsTemplate.convertAndSend(destinationSend, response, + new MessagePostProcessor() { + public Message postProcessMessage(Message messageToSend) + throws JMSException { + messageToSend.setStringProperty(PROPERTY_QUERY, query); + messageToSend.setStringProperty( + MsgConstants.PROPERTY_SLC_AGENT_ID, + getAgentUuid()); + messageToSend.setJMSCorrelationID(correlationId); + return messageToSend; + } + }); + if (log.isTraceEnabled()) + log.debug("Sent response to query '" + query + + "' with correlationId " + correlationId); + } + + /** @return response */ + public Object process(String query, Message message) { + try { + if ("getExecutionModuleDescriptor".equals(query)) { + String moduleName = message.getStringProperty("moduleName"); + String version = message.getStringProperty("version"); + return getExecutionModuleDescriptor(moduleName, version); + } else if ("listExecutionModuleDescriptors".equals(query)) { + + List lst = listExecutionModuleDescriptors(); + SlcAgentDescriptor agentDescriptorToSend = new SlcAgentDescriptor( + getAgentDescriptor()); + agentDescriptorToSend.setModuleDescriptors(lst); + return agentDescriptorToSend; + } else if ("runSlcExecution".equals(query)) { + final SlcExecution slcExecution = (SlcExecution) convertFrom(message); + new Thread() { + public void run() { + process(slcExecution); + } + }.start(); + return ExecutionAnswer.ok("Execution started on agent " + + getAgentUuid()); + } else if ("ping".equals(query)) { + return ExecutionAnswer.ok("Agent " + getAgentUuid() + + " is alive."); + } else { + throw new SlcException("Unsupported query " + query); + } + } catch (Exception e) { + log.error("Processing of query " + query + " failed", e); + return ExecutionAnswer.error(e); + } + } + + protected Object convertFrom(Message message) { + try { + return jmsTemplate.getMessageConverter().fromMessage(message); + } catch (JMSException e) { + throw new SlcException("Cannot convert message", e); + } + } + + public void setResponseDestination(Destination responseDestination) { + this.responseDestination = responseDestination; + } + + public void setJmsTemplate(JmsTemplate jmsTemplate) { + this.jmsTemplate = jmsTemplate; + } + +} diff --git a/legacy/runtime/org.argeo.slc.support.activemq/src/main/java/org/argeo/slc/jms/JmsAgentProxy.java b/legacy/runtime/org.argeo.slc.support.activemq/src/main/java/org/argeo/slc/jms/JmsAgentProxy.java new file mode 100644 index 000000000..3b0129fc7 --- /dev/null +++ b/legacy/runtime/org.argeo.slc.support.activemq/src/main/java/org/argeo/slc/jms/JmsAgentProxy.java @@ -0,0 +1,245 @@ +/* + * Copyright (C) 2007-2012 Mathieu Baudier + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.argeo.slc.jms; + +import java.util.List; +import java.util.UUID; + +import javax.jms.Destination; +import javax.jms.JMSException; +import javax.jms.Message; +import javax.jms.Session; +import javax.jms.TextMessage; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.argeo.slc.SlcException; +import org.argeo.slc.execution.ExecutionModuleDescriptor; +import org.argeo.slc.execution.ExecutionProcess; +import org.argeo.slc.msg.ExecutionAnswer; +import org.argeo.slc.msg.MsgConstants; +import org.argeo.slc.process.SlcExecution; +import org.argeo.slc.runtime.SlcAgent; +import org.argeo.slc.runtime.SlcAgentDescriptor; +import org.springframework.jms.core.JmsTemplate; +import org.springframework.jms.core.MessageCreator; + +public class JmsAgentProxy implements SlcAgent { + private final static Log log = LogFactory.getLog(JmsAgentProxy.class); + + private final String agentUuid; + private final Destination requestDestination; + private final Destination responseDestination; + private final JmsTemplate jmsTemplate; + + public JmsAgentProxy(String agentUuid, Destination requestDestination, + Destination responseDestination, JmsTemplate jmsTemplate) { + this.agentUuid = agentUuid; + this.requestDestination = requestDestination; + this.responseDestination = responseDestination; + this.jmsTemplate = jmsTemplate; + } + + public String getAgentUuid() { + return agentUuid; + } + + public ExecutionModuleDescriptor getExecutionModuleDescriptor( + final String moduleName, final String version) { + return (ExecutionModuleDescriptor) sendReceive(new AgentMC( + "getExecutionModuleDescriptor") { + public void setArguments(Message message) throws JMSException { + message.setStringProperty("moduleName", moduleName); + message.setStringProperty("version", version); + } + }); + } + + public List listExecutionModuleDescriptors() { + return ((SlcAgentDescriptor) sendReceive(new AgentMC( + "listExecutionModuleDescriptors"))).getModuleDescriptors(); + } + + public void runSlcExecution(SlcExecution slcExecution) { + process(slcExecution); + } + + public void process(ExecutionProcess executionProcess) { + if (!(executionProcess instanceof SlcExecution)) + throw new SlcException("Unsupported process type " + + executionProcess.getClass()); + sendReceive(new AgentMC("runSlcExecution", + (SlcExecution) executionProcess)); + } + + public boolean ping() { + Object response = sendReceive(new AgentMC("ping"), false); + if (response == null) + return false; + else { + ExecutionAnswer answer = (ExecutionAnswer) response; + return ExecutionAnswer.OK.equals(answer.getStatus()); + } + } + + public void kill(ExecutionProcess process) { + throw new UnsupportedOperationException(); + } + + protected Object sendReceive(AgentMC messageCreator) { + long begin = System.currentTimeMillis(); + Object res; + try { + res = sendReceive(messageCreator, true); + } finally { + if (log.isTraceEnabled()) + log.trace("To agent #" + agentUuid + " in " + + (System.currentTimeMillis() - begin) + " ms, query '" + + messageCreator.getQuery() + "', correlationId " + + messageCreator.getCorrelationId()); + } + return res; + } + + /** + * @param timeoutException + * if true throws an exception if reception timeouted, else + * return null + */ + protected Object sendReceive(AgentMC messageCreator, + boolean timeoutException) { + String correlationId = UUID.randomUUID().toString(); + messageCreator.setCorrelationId(correlationId); + send(messageCreator); + + Object response = processResponse(messageCreator, timeoutException); + + if (response instanceof ExecutionAnswer) { + ExecutionAnswer answer = (ExecutionAnswer) response; + if (ExecutionAnswer.ERROR.equals(answer.getStatus())) + throw new SlcException("Execution of '" + + messageCreator.getQuery() + "' failed on the agent " + + agentUuid + ": " + answer.getMessage() + + " (correlationId=" + correlationId + ")"); + else + return answer; + } else { + return response; + } + } + + protected void send(AgentMC messageCreator) { + jmsTemplate.send(requestDestination, messageCreator); + } + + protected Object processResponse(AgentMC messageCreator, + boolean timeoutException) { + String correlationId = messageCreator.getCorrelationId(); + String query = messageCreator.getQuery(); + Message responseMsg = null; + try { + responseMsg = jmsTemplate.receiveSelected(responseDestination, + "JMSCorrelationID='" + correlationId + "'"); + } catch (Exception e) { + throw new SlcException("Could not receive response from agent " + + agentUuid + " with correlationId " + correlationId + + " (query '" + query + "')", e); + } + + if (responseMsg == null) {// timeout + if (timeoutException) + throw new SlcException("TIMEOUT: Query '" + query + "'" + + " with correlationId " + correlationId + + " sent to agent " + agentUuid + " timed out."); + else + return null; + } + + try { + return fromMessage(responseMsg); + } catch (Exception e) { + throw new SlcException("Could not convert response from agent " + + agentUuid + " with correlationId " + correlationId + + " (query '" + query + "')", e); + } + } + + protected Object fromMessage(Message message) throws JMSException { + return jmsTemplate.getMessageConverter().fromMessage(message); + } + + protected Message toMessage(Object obj, Session session) + throws JMSException { + return jmsTemplate.getMessageConverter().toMessage(obj, session); + } + + protected class AgentMC implements MessageCreator { + private final String query; + private Object body = null; + private String correlationId; + + public AgentMC(String query) { + this.query = query; + } + + public AgentMC(String query, Object body) { + this.query = query; + this.body = body; + } + + public final Message createMessage(Session session) throws JMSException { + if (agentUuid == null) + throw new SlcException("Agent UUID not set"); + if (correlationId == null) + throw new SlcException("JMSCorrelationID not set"); + final Message msg; + if (body == null) + msg = session.createTextMessage(); + else + msg = toMessage(body, session); + msg.setStringProperty(MsgConstants.PROPERTY_SLC_AGENT_ID, agentUuid); + msg.setStringProperty(JmsAgent.PROPERTY_QUERY, query); + msg.setJMSCorrelationID(correlationId); + setArguments(msg); + if (msg instanceof TextMessage) { + TextMessage textMessage = (TextMessage) msg; + if (textMessage.getText() == null) { + // TODO: remove workaround when upgrading to ActiveMQ 5.3 + // Workaround for + // https://issues.apache.org/activemq/browse/AMQ-2046 + textMessage.setText(""); + } + } + return msg; + } + + protected void setArguments(Message message) throws JMSException { + } + + public String getQuery() { + return query; + } + + public String getCorrelationId() { + return correlationId; + } + + public void setCorrelationId(String correlationId) { + this.correlationId = correlationId; + } + + } +} diff --git a/legacy/runtime/org.argeo.slc.support.activemq/src/main/java/org/argeo/slc/jms/JmsAgentProxyFactory.java b/legacy/runtime/org.argeo.slc.support.activemq/src/main/java/org/argeo/slc/jms/JmsAgentProxyFactory.java new file mode 100644 index 000000000..683077257 --- /dev/null +++ b/legacy/runtime/org.argeo.slc.support.activemq/src/main/java/org/argeo/slc/jms/JmsAgentProxyFactory.java @@ -0,0 +1,74 @@ +/* + * Copyright (C) 2007-2012 Mathieu Baudier + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.argeo.slc.jms; + +import java.util.List; +import java.util.UUID; + +import javax.jms.Destination; +import javax.jms.JMSException; +import javax.jms.Message; + +import org.argeo.slc.msg.ReferenceList; +import org.argeo.slc.runtime.SlcAgent; +import org.argeo.slc.runtime.SlcAgentFactory; +import org.springframework.jms.core.JmsTemplate; +import org.springframework.jms.core.MessagePostProcessor; + +public class JmsAgentProxyFactory implements SlcAgentFactory { + private Destination requestDestination; + private Destination responseDestination; + private Destination pingAllDestination; + private JmsTemplate jmsTemplate; + + public SlcAgent getAgent(String uuid) { + return new JmsAgentProxy(uuid, requestDestination, responseDestination, + jmsTemplate); + } + + public void pingAll(List activeAgentIds) { + ReferenceList referenceList = new ReferenceList(activeAgentIds); + jmsTemplate.convertAndSend(pingAllDestination, referenceList, + new MessagePostProcessor() { + + public Message postProcessMessage(Message message) + throws JMSException { + message.setJMSCorrelationID(UUID.randomUUID() + .toString()); + message.setStringProperty(JmsAgent.PROPERTY_QUERY, + JmsAgent.QUERY_PING_ALL); + return message; + } + }); + } + + public void setRequestDestination(Destination requestDestination) { + this.requestDestination = requestDestination; + } + + public void setResponseDestination(Destination responseDestination) { + this.responseDestination = responseDestination; + } + + public void setJmsTemplate(JmsTemplate jmsTemplate) { + this.jmsTemplate = jmsTemplate; + } + + public void setPingAllDestination(Destination pingAllDestination) { + this.pingAllDestination = pingAllDestination; + } + +} diff --git a/legacy/runtime/org.argeo.slc.support.activemq/src/main/java/org/argeo/slc/jms/JmsAttachmentListener.java b/legacy/runtime/org.argeo.slc.support.activemq/src/main/java/org/argeo/slc/jms/JmsAttachmentListener.java new file mode 100644 index 000000000..57725fc95 --- /dev/null +++ b/legacy/runtime/org.argeo.slc.support.activemq/src/main/java/org/argeo/slc/jms/JmsAttachmentListener.java @@ -0,0 +1,71 @@ +/* + * Copyright (C) 2007-2012 Mathieu Baudier + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.argeo.slc.jms; + +import java.io.ByteArrayInputStream; +import java.io.InputStream; + +import javax.jms.BytesMessage; +import javax.jms.JMSException; +import javax.jms.Message; +import javax.jms.MessageListener; + +import org.apache.commons.io.IOUtils; +import org.argeo.slc.SlcException; +import org.argeo.slc.core.attachment.AttachmentsStorage; +import org.argeo.slc.core.attachment.SimpleAttachment; + +public class JmsAttachmentListener implements MessageListener { + private AttachmentsStorage attachmentsStorage; + + public void onMessage(Message msg) { + BytesMessage message = (BytesMessage) msg; + + InputStream in = null; + try { + SimpleAttachment attachment = new SimpleAttachment(); + attachment.setUuid(msg + .getStringProperty(JmsAttachmentUploader.ATTACHMENT_ID)); + attachment.setName(msg + .getStringProperty(JmsAttachmentUploader.ATTACHMENT_NAME)); + attachment + .setContentType(msg + .getStringProperty(JmsAttachmentUploader.ATTACHMENT_CONTENT_TYPE)); + + // Check body length + Long bodyLength = message.getBodyLength(); + if (bodyLength > Integer.MAX_VALUE) + throw new SlcException("Attachment cannot be bigger than " + + Integer.MAX_VALUE + + " bytes with this transport. Use another transport."); + + byte[] buffer = new byte[bodyLength.intValue()]; + message.readBytes(buffer); + in = new ByteArrayInputStream(buffer); + attachmentsStorage.storeAttachment(attachment, in); + } catch (JMSException e) { + throw new SlcException("Could not process attachment message " + + msg, e); + } finally { + IOUtils.closeQuietly(in); + } + } + + public void setAttachmentsStorage(AttachmentsStorage attachmentsStorage) { + this.attachmentsStorage = attachmentsStorage; + } + +} diff --git a/legacy/runtime/org.argeo.slc.support.activemq/src/main/java/org/argeo/slc/jms/JmsAttachmentUploader.java b/legacy/runtime/org.argeo.slc.support.activemq/src/main/java/org/argeo/slc/jms/JmsAttachmentUploader.java new file mode 100644 index 000000000..740826675 --- /dev/null +++ b/legacy/runtime/org.argeo.slc.support.activemq/src/main/java/org/argeo/slc/jms/JmsAttachmentUploader.java @@ -0,0 +1,99 @@ +/* + * Copyright (C) 2007-2012 Mathieu Baudier + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.argeo.slc.jms; + +import java.io.IOException; +import java.io.InputStream; + +import javax.jms.BytesMessage; +import javax.jms.Destination; +import javax.jms.JMSException; +import javax.jms.Message; +import javax.jms.Session; + +import org.apache.commons.io.IOUtils; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.argeo.slc.SlcException; +import org.argeo.slc.core.attachment.Attachment; +import org.argeo.slc.core.attachment.AttachmentUploader; +import org.springframework.core.io.Resource; +import org.springframework.jms.JmsException; +import org.springframework.jms.core.JmsTemplate; +import org.springframework.jms.core.MessageCreator; + +public class JmsAttachmentUploader implements AttachmentUploader { + private final static Log log = LogFactory + .getLog(JmsAttachmentUploader.class); + + public final static String ATTACHMENT_ID = "slc_attachmentId"; + public final static String ATTACHMENT_NAME = "slc_attachmentName"; + public final static String ATTACHMENT_CONTENT_TYPE = "slc_attachmentContentType"; + + private JmsTemplate jmsTemplate; + private Destination destination; + + public void upload(final Attachment attachment, final Resource resource) { + try { + jmsTemplate.send(destination, new MessageCreator() { + + public Message createMessage(Session session) + throws JMSException { + BytesMessage message = session.createBytesMessage(); + message.setStringProperty(ATTACHMENT_ID, attachment + .getUuid()); + message.setStringProperty(ATTACHMENT_NAME, attachment + .getName()); + message.setStringProperty(ATTACHMENT_CONTENT_TYPE, + attachment.getContentType()); + + InputStream in = null; + try { + in = resource.getInputStream(); + byte[] buffer = new byte[1024 * 1024]; + int read = -1; + while ((read = in.read(buffer)) > 0) { + message.writeBytes(buffer, 0, read); + } + } catch (IOException e) { + throw new SlcException( + "Cannot write into byte message for attachment " + + attachment + " and resource " + + resource, e); + } finally { + IOUtils.closeQuietly(in); + } + return message; + } + }); + } catch (JmsException e) { + if (log.isTraceEnabled()) + log.debug("Cannot upload", e); + else if (log.isDebugEnabled()) + log.debug("Cannot upload: " + e.getMessage()); + } + + } + + public void setJmsTemplate(JmsTemplate jmsTemplate) { + this.jmsTemplate = jmsTemplate; + } + + public void setDestination(Destination destination) { + this.destination = destination; + } + +} diff --git a/legacy/runtime/org.argeo.slc.support.activemq/src/main/java/org/argeo/slc/jms/JmsExecutionHandler.java b/legacy/runtime/org.argeo.slc.support.activemq/src/main/java/org/argeo/slc/jms/JmsExecutionHandler.java new file mode 100644 index 000000000..9239c7a33 --- /dev/null +++ b/legacy/runtime/org.argeo.slc.support.activemq/src/main/java/org/argeo/slc/jms/JmsExecutionHandler.java @@ -0,0 +1,47 @@ +/* + * Copyright (C) 2007-2012 Mathieu Baudier + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.argeo.slc.jms; + +import javax.jms.JMSException; +import javax.jms.Message; +import javax.jms.MessageListener; + +import org.argeo.slc.SlcException; +import org.argeo.slc.msg.MsgHandler; +import org.springframework.jms.support.converter.MessageConverter; + +public class JmsExecutionHandler implements MessageListener { + + private MessageConverter messageConverter; + private MsgHandler serviceMsgHandler; + + public void onMessage(Message message) { + try { + serviceMsgHandler.handleMsg(messageConverter.fromMessage(message)); + } catch (JMSException e) { + throw new SlcException("Could not interpret message " + message, e); + } + } + + public void setMessageConverter(MessageConverter messageConverter) { + this.messageConverter = messageConverter; + } + + public void setServiceMsgHandler(MsgHandler serviceMsgHandler) { + this.serviceMsgHandler = serviceMsgHandler; + } + +} diff --git a/legacy/runtime/org.argeo.slc.support.activemq/src/main/java/org/argeo/slc/jms/JmsSlcEventListener.java b/legacy/runtime/org.argeo.slc.support.activemq/src/main/java/org/argeo/slc/jms/JmsSlcEventListener.java new file mode 100644 index 000000000..35cbc70d8 --- /dev/null +++ b/legacy/runtime/org.argeo.slc.support.activemq/src/main/java/org/argeo/slc/jms/JmsSlcEventListener.java @@ -0,0 +1,234 @@ +/* + * Copyright (C) 2007-2012 Mathieu Baudier + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.argeo.slc.jms; + +import java.util.ArrayList; +import java.util.List; +import java.util.UUID; + +import javax.jms.Connection; +import javax.jms.ConnectionFactory; +import javax.jms.JMSException; +import javax.jms.Message; +import javax.jms.Session; +import javax.jms.Topic; +import javax.jms.TopicSubscriber; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.argeo.slc.SlcException; +import org.argeo.slc.msg.event.SlcEvent; +import org.argeo.slc.msg.event.SlcEventListener; +import org.argeo.slc.msg.event.SlcEventListenerDescriptor; +import org.springframework.jms.connection.ConnectionFactoryUtils; +import org.springframework.jms.support.JmsUtils; +import org.springframework.jms.support.converter.MessageConverter; + +public class JmsSlcEventListener implements SlcEventListener { + private final static Log log = LogFactory.getLog(JmsSlcEventListener.class); + + // IoC + private Topic eventsDestination; + private ConnectionFactory jmsConnectionFactory; + private MessageConverter messageConverter; + + // Initialized with init() method, released with close() + private Connection connection = null; + + // One by instance + private String connectionClientId = getClass() + "#" + + UUID.randomUUID().toString(); + private Boolean isClosed = false; + + private List subscriberIds = new ArrayList(); + + // private Map clients = Collections + // .synchronizedMap(new HashMap()); + + public SlcEvent listen(String subscriberId, + List descriptors, Long timeout) { + if (descriptors.size() == 0) { + // No listener, just waiting + try { + if (log.isTraceEnabled()) + log.trace("No event listener registered, sleeping..."); + Thread.sleep(timeout); + } catch (InterruptedException e) { + // silent + } + return null; + } else { + Object obj = null; + synchronized (subscriberIds) { + while (subscriberIds.contains(subscriberId)) { + try { + subscriberIds.wait(500); + if (isClosed) + return null; + } catch (InterruptedException e) { + // silent + } + } + subscriberIds.add(subscriberId); + Session session = null; + TopicSubscriber topicSubscriber = null; + try { + // ListeningClient client = (ListeningClient) + // getClient(clientId); + session = connection.createSession(false, + Session.AUTO_ACKNOWLEDGE); + topicSubscriber = session.createDurableSubscriber( + eventsDestination, subscriberId, + createSelector(descriptors), true); + Message message = topicSubscriber.receive(timeout); + obj = messageConverter.fromMessage(message); + } catch (JMSException e) { + throw new SlcException("Cannot poll events for subscriber " + + subscriberId, e); + } finally { + JmsUtils.closeMessageConsumer(topicSubscriber); + JmsUtils.closeSession(session); + subscriberIds.remove(subscriberId); + subscriberIds.notifyAll(); + } + + } + + if (obj == null) + return null; + else + return (SlcEvent) obj; + } + } + + /** Returns null if no filter */ + protected String createSelector(List descriptors) { + if (descriptors.size() == 0) + throw new SlcException("No listeners, cannot generate JMS selector"); + + StringBuffer buf = new StringBuffer(256); + Boolean first = true; + for (SlcEventListenerDescriptor descriptor : descriptors) { + if (first) + first = false; + else + buf.append(" OR "); + + buf.append('('); + buf.append(SlcEvent.EVENT_TYPE).append("=").append('\'').append( + descriptor.getEventType()).append('\''); + if (descriptor.getFilter() != null) { + buf.append(" AND "); + buf.append('(').append(descriptor.getFilter()).append(')'); + } + buf.append(')'); + } + if (log.isTraceEnabled()) + log.trace("selector created : " + buf.toString()); + return buf.toString(); + } + + public boolean isClosed() { + return isClosed; + } + + // Ioc + public void setEventsDestination(Topic eventsDestination) { + this.eventsDestination = eventsDestination; + } + + public void setJmsConnectionFactory(ConnectionFactory jmsConnectionFactory) { + this.jmsConnectionFactory = jmsConnectionFactory; + } + + public void setMessageConverter(MessageConverter messageConverter) { + this.messageConverter = messageConverter; + } + + // Life Cycle + public void init() { + try { + connection = jmsConnectionFactory.createConnection(); + connection.setClientID(connectionClientId); + connection.start(); + } catch (JMSException e) { + throw new SlcException("Could not init connection", e); + } + } + + public void close() { + ConnectionFactoryUtils.releaseConnection(connection, + jmsConnectionFactory, true); + isClosed = true; + synchronized (subscriberIds) { + subscriberIds.notifyAll(); + } + } + + // public void close(String clientId) { + // // Session session = null; + // // // ListeningClient client = getClient(clientId); + // // // Connection connection = client.getConnection(); + // // try { + // // session = client.getSession(); + // // session.unsubscribe(clientId); + // // } catch (JMSException e) { + // // log.warn("Could not unsubscribe client " + clientId, e); + // // } finally { + // // JmsUtils.closeSession(session); + // // } + // // + // // // synchronized (client) { + // // // clients.remove(clientId); + // // // client.notify(); + // // // } + // } + + // protected ListeningClient getClient(String clientId) { + // ListeningClient client = clients.get(clientId); + // if (client == null) { + // // Lazy init + // client = new ListeningClient(connection); + // clients.put(clientId, client); + // } + // return client; + // } + + // protected class ListeningClient { + // private final Connection connection; + // private final Session session; + // + // public ListeningClient(Connection connection) { + // super(); + // this.connection = connection; + // try { + // session = connection.createSession(false, + // Session.AUTO_ACKNOWLEDGE); + // } catch (JMSException e) { + // throw new SlcException("Cannot create session"); + // } + // } + // + // public Connection getConnection() { + // return connection; + // } + // + // public Session getSession() { + // return session; + // } + // + // } +} diff --git a/legacy/runtime/org.argeo.slc.support.activemq/src/main/java/org/argeo/slc/jms/JmsSlcEventPublisher.java b/legacy/runtime/org.argeo.slc.support.activemq/src/main/java/org/argeo/slc/jms/JmsSlcEventPublisher.java new file mode 100644 index 000000000..a95ffc810 --- /dev/null +++ b/legacy/runtime/org.argeo.slc.support.activemq/src/main/java/org/argeo/slc/jms/JmsSlcEventPublisher.java @@ -0,0 +1,71 @@ +/* + * Copyright (C) 2007-2012 Mathieu Baudier + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.argeo.slc.jms; + +import java.util.Map; + +import javax.jms.DeliveryMode; +import javax.jms.Destination; +import javax.jms.JMSException; +import javax.jms.Message; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.argeo.slc.SlcException; +import org.argeo.slc.msg.event.SlcEvent; +import org.argeo.slc.msg.event.SlcEventPublisher; +import org.springframework.jms.core.JmsTemplate; +import org.springframework.jms.core.MessagePostProcessor; + +public class JmsSlcEventPublisher implements SlcEventPublisher { + private static final Log log = LogFactory + .getLog(JmsSlcEventPublisher.class); + private Destination eventsDestination; + private JmsTemplate jmsTemplate; + + public void publish(final SlcEvent event) { + if (jmsTemplate.getDeliveryMode() != DeliveryMode.PERSISTENT) + throw new SlcException( + "Delivery mode has to be persistent in order to have durable subscription"); + + jmsTemplate.convertAndSend(eventsDestination, event, + new MessagePostProcessor() { + + public Message postProcessMessage(Message message) + throws JMSException { + Map headers = event.getHeaders(); + for (String key : headers.keySet()) { + message.setStringProperty(key, headers.get(key)); + } + return message; + } + }); + if (log.isTraceEnabled()) { + log.trace("Event " + event.toString() + " sent to " + + eventsDestination.toString()); + } + + } + + public void setEventsDestination(Destination eventsDestination) { + this.eventsDestination = eventsDestination; + } + + public void setJmsTemplate(JmsTemplate jmsTemplate) { + this.jmsTemplate = jmsTemplate; + } + +} diff --git a/legacy/runtime/org.argeo.slc.support.activemq/src/main/java/org/argeo/slc/jms/JmsSlcExecutionNotifier.java b/legacy/runtime/org.argeo.slc.support.activemq/src/main/java/org/argeo/slc/jms/JmsSlcExecutionNotifier.java new file mode 100644 index 000000000..4e68db35e --- /dev/null +++ b/legacy/runtime/org.argeo.slc.support.activemq/src/main/java/org/argeo/slc/jms/JmsSlcExecutionNotifier.java @@ -0,0 +1,87 @@ +/* + * Copyright (C) 2007-2012 Mathieu Baudier + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.argeo.slc.jms; + +import java.util.List; + +import javax.jms.Destination; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.argeo.slc.UnsupportedException; +import org.argeo.slc.execution.ExecutionProcess; +import org.argeo.slc.execution.ExecutionStep; +import org.argeo.slc.msg.process.SlcExecutionStatusRequest; +import org.argeo.slc.msg.process.SlcExecutionStepsRequest; +import org.argeo.slc.process.SlcExecution; +import org.argeo.slc.process.SlcExecutionNotifier; +import org.argeo.slc.process.SlcExecutionStep; +import org.springframework.jms.JmsException; +import org.springframework.jms.core.JmsTemplate; + +@SuppressWarnings("deprecation") +public class JmsSlcExecutionNotifier implements SlcExecutionNotifier { + private final static Log log = LogFactory + .getLog(JmsSlcExecutionNotifier.class); + + private JmsTemplate jmsTemplate; + + private Destination executionEventDestination; + + // private Destination updateStatusDestination; + + public void updateStatus(ExecutionProcess slcExecution, String oldStatus, + String newStatus) { + SlcExecutionStatusRequest req = new SlcExecutionStatusRequest( + slcExecution.getUuid(), newStatus); + convertAndSend(req); + } + + public void addSteps(ExecutionProcess slcExecution, + List additionalSteps) { + SlcExecutionStepsRequest req = new SlcExecutionStepsRequest( + slcExecution.getUuid(), additionalSteps); + convertAndSend(req); + } + + public void newExecution(SlcExecution slcExecution) { + throw new UnsupportedException(); + } + + public void updateExecution(SlcExecution slcExecution) { + throw new UnsupportedException(); + } + + public void setJmsTemplate(JmsTemplate jmsTemplate) { + this.jmsTemplate = jmsTemplate; + } + + public void setExecutionEventDestination( + Destination executionEventDestination) { + this.executionEventDestination = executionEventDestination; + } + + protected void convertAndSend(Object req) { + try { + jmsTemplate.convertAndSend(executionEventDestination, req); + } catch (JmsException e) { + log.warn("Send request " + req.getClass() + " to server: " + + e.getMessage()); + if (log.isTraceEnabled()) + log.debug("Original error.", e); + } + } +} diff --git a/legacy/runtime/org.argeo.slc.support.activemq/src/main/java/org/argeo/slc/jms/JmsTreeTestResultListener.java b/legacy/runtime/org.argeo.slc.support.activemq/src/main/java/org/argeo/slc/jms/JmsTreeTestResultListener.java new file mode 100644 index 000000000..2cd88c490 --- /dev/null +++ b/legacy/runtime/org.argeo.slc.support.activemq/src/main/java/org/argeo/slc/jms/JmsTreeTestResultListener.java @@ -0,0 +1,148 @@ +/* + * Copyright (C) 2007-2012 Mathieu Baudier + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.argeo.slc.jms; + +import javax.jms.Destination; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.argeo.slc.SlcException; +import org.argeo.slc.core.attachment.Attachment; +import org.argeo.slc.core.attachment.SimpleAttachment; +import org.argeo.slc.core.test.tree.TreeTestResult; +import org.argeo.slc.core.test.tree.TreeTestResultListener; +import org.argeo.slc.msg.test.tree.AddTreeTestResultAttachmentRequest; +import org.argeo.slc.msg.test.tree.CloseTreeTestResultRequest; +import org.argeo.slc.msg.test.tree.CreateTreeTestResultRequest; +import org.argeo.slc.msg.test.tree.ResultPartRequest; +import org.argeo.slc.test.TestResultPart; +import org.springframework.jms.JmsException; +import org.springframework.jms.core.JmsTemplate; + +/** JMS based tree test result listener implementation. */ +public class JmsTreeTestResultListener implements TreeTestResultListener { + private final Log log = LogFactory.getLog(getClass()); + + private Boolean onlyOnClose = false; + private JmsTemplate jmsTemplate; + + private Destination executionEventDestination; + + public void resultPartAdded(TreeTestResult testResult, + TestResultPart testResultPart) { + if (onlyOnClose) + return; + + try { + if (testResult.getResultParts().size() == 1 + && testResult.getResultParts().values().iterator().next() + .getParts().size() == 1) { + CreateTreeTestResultRequest req = new CreateTreeTestResultRequest( + testResult); + + if (log.isTraceEnabled()) + log.trace("Send create result request for result " + + testResult.getUuid()); + + jmsTemplate.convertAndSend(executionEventDestination, req); + } else { + ResultPartRequest req = new ResultPartRequest(testResult); + + if (log.isTraceEnabled()) + log.trace("Send result parts for result " + + testResult.getUuid()); + + jmsTemplate.convertAndSend(executionEventDestination, req); + } + } catch (JmsException e) { + log.warn("Could not notify result part to server: " + + e.getMessage()); + if (log.isTraceEnabled()) + log.debug("Original error.", e); + } catch (Exception e) { + throw new SlcException("Could not notify to JMS", e); + } + } + + public void close(TreeTestResult testResult) { + try { + if (onlyOnClose) { + CreateTreeTestResultRequest req = new CreateTreeTestResultRequest( + testResult); + + if (log.isTraceEnabled()) + log.trace("Send onClose create result request for result " + + testResult.getUuid()); + + jmsTemplate.convertAndSend(executionEventDestination, req); + } else { + CloseTreeTestResultRequest req = new CloseTreeTestResultRequest( + testResult); + + if (log.isTraceEnabled()) + log.trace("Send close result request for result " + + testResult.getUuid()); + + jmsTemplate.convertAndSend(executionEventDestination, req); + + } + } catch (JmsException e) { + log.warn("Could not notify result close to server: " + + e.getMessage()); + if (log.isTraceEnabled()) + log.debug("Original error.", e); + } catch (Exception e) { + throw new SlcException("Could not notify to JMS", e); + } + } + + public void addAttachment(TreeTestResult testResult, Attachment attachment) { + if (onlyOnClose) + return; + + try { + AddTreeTestResultAttachmentRequest req = new AddTreeTestResultAttachmentRequest(); + req.setResultUuid(testResult.getUuid()); + req.setAttachment((SimpleAttachment) attachment); + jmsTemplate.convertAndSend(executionEventDestination, req); + + } catch (JmsException e) { + log + .warn("Could not notify attachment to server: " + + e.getMessage()); + if (log.isTraceEnabled()) + log.debug("Original error.", e); + } catch (Exception e) { + throw new SlcException("Could not notify to JMS", e); + } + + } + + /** Publishes the test result only when it gets closed. */ + public void setOnlyOnClose(Boolean onlyOnClose) { + this.onlyOnClose = onlyOnClose; + } + + public void setJmsTemplate(JmsTemplate jmsTemplate) { + this.jmsTemplate = jmsTemplate; + } + + public void setExecutionEventDestination( + Destination executionEventDestination) { + this.executionEventDestination = executionEventDestination; + } + +} diff --git a/legacy/runtime/org.argeo.slc.support.activemq/src/main/java/org/argeo/slc/jms/MarshallerMessageConverter.java b/legacy/runtime/org.argeo.slc.support.activemq/src/main/java/org/argeo/slc/jms/MarshallerMessageConverter.java new file mode 100644 index 000000000..797abb910 --- /dev/null +++ b/legacy/runtime/org.argeo.slc.support.activemq/src/main/java/org/argeo/slc/jms/MarshallerMessageConverter.java @@ -0,0 +1,123 @@ +/* + * Copyright (C) 2007-2012 Mathieu Baudier + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.argeo.slc.jms; + +import java.io.Serializable; +import java.util.Enumeration; + +import javax.jms.JMSException; +import javax.jms.Message; +import javax.jms.ObjectMessage; +import javax.jms.Session; +import javax.jms.TextMessage; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.argeo.slc.SlcException; +import org.springframework.jms.support.converter.MessageConversionException; +import org.springframework.jms.support.converter.MessageConverter; +import org.springframework.oxm.Marshaller; +import org.springframework.oxm.Unmarshaller; +import org.springframework.xml.transform.StringResult; +import org.springframework.xml.transform.StringSource; + +public class MarshallerMessageConverter implements MessageConverter { + private final static Log log = LogFactory + .getLog(MarshallerMessageConverter.class); + + private Marshaller marshaller; + private Unmarshaller unmarshaller; + + /** Use unmarshalled ObjectMessages instead of TextMessages */ + private Boolean disableMarshalling = false; + + /** @return the converted message or null if the message itself is null */ + @SuppressWarnings("unchecked") + public Object fromMessage(Message message) throws JMSException, + MessageConversionException { + long begin = System.currentTimeMillis(); + if (message == null) + return null; + if (log.isTraceEnabled()) { + Enumeration names = message.getPropertyNames(); + while (names.hasMoreElements()) { + String name = names.nextElement(); + log.trace("JMS Property: " + name + "=" + + message.getObjectProperty(name)); + } + } + + Object res; + if (message instanceof TextMessage) { + String text = ((TextMessage) message).getText(); + if (text == null) + throw new SlcException( + "Cannot unmarshall message without body: " + message); + try { + res = unmarshaller.unmarshal(new StringSource(text)); + } catch (Exception e) { + throw new SlcException("Could not unmarshall " + text, e); + } + } else if (message instanceof ObjectMessage) { + res = ((ObjectMessage) message).getObject(); + if (res == null) + throw new SlcException("Message without body: " + message); + } else { + throw new SlcException("This type of messages is not supported: " + + message); + } + if (log.isTraceEnabled()) + log.trace("'From' message processed in " + (System.currentTimeMillis() - begin) + + " ms"); + return res; + } + + public Message toMessage(Object object, Session session) + throws JMSException, MessageConversionException { + long begin = System.currentTimeMillis(); + Message msg; + if (disableMarshalling) { + msg = session.createObjectMessage(); + ((ObjectMessage) msg).setObject((Serializable) object); + } else { + StringResult result = new StringResult(); + try { + marshaller.marshal(object, result); + } catch (Exception e) { + throw new SlcException("Could not marshall " + object, e); + } + msg = session.createTextMessage(); + ((TextMessage) msg).setText(result.toString()); + } + if (log.isTraceEnabled()) + log.trace("'To' message processed in " + (System.currentTimeMillis() - begin) + + " ms"); + return msg; + } + + public void setMarshaller(Marshaller marshaller) { + this.marshaller = marshaller; + } + + public void setUnmarshaller(Unmarshaller unmarshaller) { + this.unmarshaller = unmarshaller; + } + + public void setDisableMarshalling(Boolean disableMarshalling) { + this.disableMarshalling = disableMarshalling; + } + +} diff --git a/legacy/runtime/org.argeo.slc.support.activemq/src/main/java/org/argeo/slc/jms/ServiceMessageListenerAdapter.java b/legacy/runtime/org.argeo.slc.support.activemq/src/main/java/org/argeo/slc/jms/ServiceMessageListenerAdapter.java new file mode 100644 index 000000000..b35034041 --- /dev/null +++ b/legacy/runtime/org.argeo.slc.support.activemq/src/main/java/org/argeo/slc/jms/ServiceMessageListenerAdapter.java @@ -0,0 +1,140 @@ +/* + * Copyright (C) 2007-2012 Mathieu Baudier + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.argeo.slc.jms; + +import java.io.PrintWriter; +import java.io.StringWriter; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.jms.JMSException; +import javax.jms.Message; +import javax.jms.Session; + +import org.argeo.slc.SlcException; +import org.argeo.slc.msg.ExecutionAnswer; +import org.springframework.jms.listener.adapter.MessageListenerAdapter; + +public class ServiceMessageListenerAdapter extends MessageListenerAdapter { + public final static String DEFAULT_METHOD_NAME_PARAMETER = "action"; + public final static String BODY_ARGUMENT = "BODY"; + + private Map> methodArguments = new HashMap>(); + + private static String methodNameParameter = DEFAULT_METHOD_NAME_PARAMETER; + + @Override + protected Object extractMessage(Message message) throws JMSException { + return new ExtractedMessage(message); + } + + @Override + protected String getListenerMethodName(Message originalMessage, + Object extractedMessage) throws JMSException { + return ((ExtractedMessage) extractedMessage).methodName; + } + + @Override + protected Object[] buildListenerArguments(Object extractedMessage) { + return ((ExtractedMessage) extractedMessage).arguments; + } + + @Override + public void onMessage(Message message, Session session) throws JMSException { + try {// hacked and simplified from parent class + // Regular case: find a handler method reflectively. + Object convertedMessage = extractMessage(message); + String methodName = getListenerMethodName(message, convertedMessage); + + // Invoke the handler method with appropriate arguments. + Object[] listenerArguments = buildListenerArguments(convertedMessage); + Object result = invokeListenerMethod(methodName, listenerArguments); + if (result != null) { + handleResult(result, message, session); + } else { + ExecutionAnswer answer = ExecutionAnswer.ok("Execution of " + + methodName + " on " + getDelegate() + " succeeeded."); + Message okMessage = getMessageConverter().toMessage(answer, + session); + sendResponse(session, getResponseDestination(message, + okMessage, session), okMessage); + } + } catch (Exception e) { + if (session == null) + return; + + StringWriter writer = new StringWriter(); + e.printStackTrace(new PrintWriter(writer)); + ExecutionAnswer answer = ExecutionAnswer.error(writer.toString()); + Message errorMessage = getMessageConverter().toMessage(answer, + session); + sendResponse(session, getResponseDestination(message, errorMessage, + session), errorMessage); + } + } + + protected class ExtractedMessage { + private final String methodName; + private final Object[] arguments; +// private final Message originalMessage; + + public ExtractedMessage(Message originalMessage) throws JMSException { +// this.originalMessage = originalMessage; + + if (!originalMessage.propertyExists(methodNameParameter)) + throw new SlcException("No property " + methodNameParameter + + " in incoming message," + + " cannot determine service method"); + + methodName = originalMessage.getStringProperty(methodNameParameter); + + if (!methodArguments.containsKey(methodName)) {// no arg specified + arguments = new Object[0]; + } else { + List parameterNames = methodArguments.get(methodName); + List arguments = new ArrayList(); + int count = 0; + for (String name : parameterNames) { + if (name.equals(BODY_ARGUMENT)) { + Object body = getMessageConverter().fromMessage( + originalMessage); + arguments.add(body); + } else { + if (!originalMessage.propertyExists(name)) + throw new SlcException("No property " + name + + " in incoming message," + + " cannot determine argument #" + count); + arguments.add(originalMessage.getObjectProperty(name)); + } + count++; + } + this.arguments = arguments.toArray(); + } + } + } + + public void setMethodArguments(Map> methodArguments) { + this.methodArguments = methodArguments; + } + + public static void setMethodNameParameter(String methodNameParameter) { + ServiceMessageListenerAdapter.methodNameParameter = methodNameParameter; + } + + +} diff --git a/legacy/runtime/org.argeo.slc.support.activemq/src/main/resources/org/argeo/slc/activemq/destinations.xml b/legacy/runtime/org.argeo.slc.support.activemq/src/main/resources/org/argeo/slc/activemq/destinations.xml new file mode 100644 index 000000000..4a27b6330 --- /dev/null +++ b/legacy/runtime/org.argeo.slc.support.activemq/src/main/resources/org/argeo/slc/activemq/destinations.xml @@ -0,0 +1,53 @@ + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/legacy/runtime/org.argeo.slc.support.castor/.classpath b/legacy/runtime/org.argeo.slc.support.castor/.classpath new file mode 100644 index 000000000..238982686 --- /dev/null +++ b/legacy/runtime/org.argeo.slc.support.castor/.classpath @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/legacy/runtime/org.argeo.slc.support.castor/.project b/legacy/runtime/org.argeo.slc.support.castor/.project new file mode 100644 index 000000000..c0bc103dd --- /dev/null +++ b/legacy/runtime/org.argeo.slc.support.castor/.project @@ -0,0 +1,28 @@ + + + org.argeo.slc.support.castor + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.jdt.core.javanature + org.eclipse.pde.PluginNature + + diff --git a/legacy/runtime/org.argeo.slc.support.castor/.settings/org.eclipse.jdt.core.prefs b/legacy/runtime/org.argeo.slc.support.castor/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 000000000..93d31747f --- /dev/null +++ b/legacy/runtime/org.argeo.slc.support.castor/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,12 @@ +#Fri Aug 29 11:10:18 CEST 2008 +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.compiler.compliance=1.5 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.5 diff --git a/legacy/runtime/org.argeo.slc.support.castor/build.properties b/legacy/runtime/org.argeo.slc.support.castor/build.properties new file mode 100644 index 000000000..a3d626614 --- /dev/null +++ b/legacy/runtime/org.argeo.slc.support.castor/build.properties @@ -0,0 +1,8 @@ +additional.bundles = org.argeo.slc.unit,\ + junit,\ + org.apache.xml.serializer,\ + org.apache.xerces +source.. = src/main/java/,\ + src/main/resources/,\ + src/test/java/,\ + src/test/resources/ diff --git a/legacy/runtime/org.argeo.slc.support.castor/pom.xml b/legacy/runtime/org.argeo.slc.support.castor/pom.xml new file mode 100644 index 000000000..9ba9f6b90 --- /dev/null +++ b/legacy/runtime/org.argeo.slc.support.castor/pom.xml @@ -0,0 +1,98 @@ + + 4.0.0 + + org.argeo.slc + runtime + 1.1.3-SNAPSHOT + .. + + org.argeo.slc.runtime + org.argeo.slc.support.castor + SLC Support Castor + Implementations of SLC Specs using Castor + + + + org.apache.felix + maven-bundle-plugin + + + + + org.argeo.slc.* + + + org.argeo.slc.*;resolution:=optional, + org.argeo.slc.deploy;resolution:=optional, + org.argeo.slc.build;resolution:=optional, + org.argeo.slc.execution;resolution:=optional, + org.argeo.slc.core.attachment;resolution:=optional, + org.argeo.slc.core.structure;resolution:=optional, + org.argeo.slc.core.structure.tree;resolution:=optional, + org.argeo.slc.core.test;resolution:=optional, + org.argeo.slc.core.test.tree;resolution:=optional, + org.argeo.slc.runtime;resolution:=optional, + org.argeo.slc.core.execution;resolution:=optional, + org.argeo.slc.msg;resolution:=optional, + org.argeo.slc.msg.build;resolution:=optional, + org.argeo.slc.msg.process;resolution:=optional, + org.argeo.slc.msg.event;resolution:=optional, + org.argeo.slc.msg.test.tree;resolution:=optional, + org.argeo.slc.detached;resolution:=optional, + org.apache.xml.serialize;resolution:=optional, + org.apache.xerces.jaxp;resolution:=optional, + org.w3c.dom.*;version="0.0.0";resolution:=optional, + org.xml.sax.*;version="0.0.0";resolution:=optional, + javax.xml.transform.*;version="0.0.0";resolution:=optional, + javax.xml.parsers.*;version="0.0.0";resolution:=optional, + org.springframework.xml.validation;resolution:=optional, + org.apache.commons.io, + org.springframework.oxm, + org.springframework.core, + org.springframework.xml.transform, + org.springframework.core.io, + * + + org.castor + + + + + + + + + org.argeo.slc.runtime + org.argeo.slc.core + 1.1.3-SNAPSHOT + + + + org.argeo.tp + org.springframework.oxm + + + + org.argeo.tp + org.castor + + + + org.argeo.tp + org.apache.xerces + + + + org.argeo.tp + org.apache.xalan + + + + + org.argeo.slc.runtime + org.argeo.slc.unit + test + 1.1.3-SNAPSHOT + + + \ No newline at end of file diff --git a/legacy/runtime/org.argeo.slc.support.castor/src/main/java/org/argeo/slc/castor/execution/PrimitiveFieldHandler.java b/legacy/runtime/org.argeo.slc.support.castor/src/main/java/org/argeo/slc/castor/execution/PrimitiveFieldHandler.java new file mode 100644 index 000000000..4a250e4cf --- /dev/null +++ b/legacy/runtime/org.argeo.slc.support.castor/src/main/java/org/argeo/slc/castor/execution/PrimitiveFieldHandler.java @@ -0,0 +1,58 @@ +/* + * Copyright (C) 2007-2012 Mathieu Baudier + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.argeo.slc.castor.execution; + +import org.argeo.slc.core.execution.PrimitiveAccessor; +import org.argeo.slc.core.execution.PrimitiveUtils; +import org.exolab.castor.mapping.AbstractFieldHandler; + +public class PrimitiveFieldHandler extends AbstractFieldHandler { + + @Override + public Object getValue(Object object) throws IllegalStateException { + if (object == null) + return null; + + Object value = ((PrimitiveAccessor) object).getValue(); + return value != null ? value.toString() : null; + } + + @Override + public Object newInstance(Object parent, Object[] args) + throws IllegalStateException { + return null; + } + + @Override + public Object newInstance(Object parent) throws IllegalStateException { + return null; + } + + @Override + public void resetValue(Object object) throws IllegalStateException, + IllegalArgumentException { + } + + @Override + public void setValue(Object object, Object value) + throws IllegalStateException, IllegalArgumentException { + PrimitiveAccessor primitiveAccessor = (PrimitiveAccessor) object; + String type = primitiveAccessor.getType(); + String str = value.toString(); + primitiveAccessor.setValue(PrimitiveUtils.convert(type, str)); + } + +} diff --git a/legacy/runtime/org.argeo.slc.support.castor/src/main/java/org/argeo/slc/castor/structure/tree/TreeSPathFieldHandler.java b/legacy/runtime/org.argeo.slc.support.castor/src/main/java/org/argeo/slc/castor/structure/tree/TreeSPathFieldHandler.java new file mode 100644 index 000000000..5d56fb99f --- /dev/null +++ b/legacy/runtime/org.argeo.slc.support.castor/src/main/java/org/argeo/slc/castor/structure/tree/TreeSPathFieldHandler.java @@ -0,0 +1,56 @@ +/* + * Copyright (C) 2007-2012 Mathieu Baudier + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.argeo.slc.castor.structure.tree; + +import org.exolab.castor.mapping.AbstractFieldHandler; +import org.exolab.castor.mapping.MapItem; + +import org.argeo.slc.core.structure.tree.TreeSPath; + +public class TreeSPathFieldHandler extends AbstractFieldHandler { + + @Override + public Object getValue(Object object) throws IllegalStateException { + MapItem part = (MapItem) object; + return ((TreeSPath) part.getKey()).getAsUniqueString(); + } + + @Override + public Object newInstance(Object parent) throws IllegalStateException { + return null; + } + + @Override + public Object newInstance(Object parent, Object[] args) + throws IllegalStateException { + return null; + } + + @Override + public void resetValue(Object object) throws IllegalStateException, + IllegalArgumentException { + MapItem part = (MapItem) object; + part.setKey(null); + } + + @Override + public void setValue(Object object, Object value) + throws IllegalStateException, IllegalArgumentException { + MapItem part = (MapItem) object; + part.setKey(new TreeSPath(value.toString())); + } + +} diff --git a/legacy/runtime/org.argeo.slc.support.castor/src/main/java/org/argeo/slc/castor/test/tree/StatusFieldHandler.java b/legacy/runtime/org.argeo.slc.support.castor/src/main/java/org/argeo/slc/castor/test/tree/StatusFieldHandler.java new file mode 100644 index 000000000..a69eb87da --- /dev/null +++ b/legacy/runtime/org.argeo.slc.support.castor/src/main/java/org/argeo/slc/castor/test/tree/StatusFieldHandler.java @@ -0,0 +1,58 @@ +/* + * Copyright (C) 2007-2012 Mathieu Baudier + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.argeo.slc.castor.test.tree; + +import org.argeo.slc.core.test.SimpleResultPart; +import org.argeo.slc.core.test.SlcTestUtils; +import org.argeo.slc.test.TestStatus; +import org.exolab.castor.mapping.AbstractFieldHandler; + +public class StatusFieldHandler extends AbstractFieldHandler { + + @Override + public Object getValue(Object object) throws IllegalStateException { + SimpleResultPart part = (SimpleResultPart) object; + return SlcTestUtils.statusToString(part.getStatus()); + } + + @Override + public Object newInstance(Object parent) throws IllegalStateException { + return null; + } + + @Override + public Object newInstance(Object parent, Object[] args) + throws IllegalStateException { + return null; + } + + @Override + public void resetValue(Object object) throws IllegalStateException, + IllegalArgumentException { + SimpleResultPart part = (SimpleResultPart) object; + // ERROR by default since it should be explicitely set + part.setStatus(TestStatus.ERROR); + } + + @Override + public void setValue(Object object, Object value) + throws IllegalStateException, IllegalArgumentException { + SimpleResultPart part = (SimpleResultPart) object; + Integer status = SlcTestUtils.stringToStatus((String) value); + part.setStatus(status); + } + +} diff --git a/legacy/runtime/org.argeo.slc.support.castor/src/main/java/org/argeo/slc/xml/process/FileSlcExecutionNotifier.java b/legacy/runtime/org.argeo.slc.support.castor/src/main/java/org/argeo/slc/xml/process/FileSlcExecutionNotifier.java new file mode 100644 index 000000000..ad6bcdc24 --- /dev/null +++ b/legacy/runtime/org.argeo.slc.support.castor/src/main/java/org/argeo/slc/xml/process/FileSlcExecutionNotifier.java @@ -0,0 +1,90 @@ +/* + * Copyright (C) 2007-2012 Mathieu Baudier + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.argeo.slc.xml.process; + +import java.io.File; +import java.io.FileWriter; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.xml.transform.stream.StreamResult; + +import org.apache.commons.io.IOUtils; +import org.argeo.slc.SlcException; +import org.argeo.slc.execution.ExecutionProcess; +import org.argeo.slc.process.SlcExecution; +import org.argeo.slc.process.SlcExecutionNotifier; +import org.argeo.slc.execution.ExecutionStep; +import org.argeo.slc.process.SlcExecutionStep; +import org.springframework.oxm.Marshaller; + +/** @deprecated Probably not even working anymore */ +public class FileSlcExecutionNotifier implements SlcExecutionNotifier { + // private final static SimpleDateFormat sdf = new SimpleDateFormat( + // "yyyyMMdd-HHmmss"); + // + // private String basePath; + private Marshaller marshaller; + + private Map uuidToDir = new HashMap(); + + public void addSteps(ExecutionProcess slcExecution, + List additionalSteps) { + writeSlcExecution(slcExecution); + } + + public void updateStatus(ExecutionProcess slcExecution, String oldStatus, + String newStatus) { + writeSlcExecution(slcExecution); + } + + protected void writeSlcExecution(ExecutionProcess process) { + if (!(process instanceof SlcExecution)) + throw new SlcException("Unsupported process type " + + process.getClass()); + SlcExecution slcExecution = (SlcExecution) process; + FileWriter out = null; + try { + out = new FileWriter(getFilePath(slcExecution)); + marshaller.marshal(slcExecution, new StreamResult(out)); + } catch (Exception e) { + throw new SlcException("Cannot marshall SlcExecution to " + + getFilePath(slcExecution), e); + } finally { + IOUtils.closeQuietly(out); + } + } + + protected String getFileName(SlcExecution slcExecution) { + return "SlcExecution-" + slcExecution.getUuid() + ".xml"; + } + + protected String getFilePath(SlcExecution slcExecution) { + String dirPath = uuidToDir.get(slcExecution.getUuid()); + return dirPath + File.separator + "SlcExecution-" + + slcExecution.getUuid() + ".xml"; + } + + public void setBasePath(String basePath) { + // this.basePath = basePath; + } + + public void setMarshaller(Marshaller marshaller) { + this.marshaller = marshaller; + } + +} diff --git a/legacy/runtime/org.argeo.slc.support.castor/src/main/java/org/argeo/slc/xml/test/tree/XsltReportGenerator.java b/legacy/runtime/org.argeo.slc.support.castor/src/main/java/org/argeo/slc/xml/test/tree/XsltReportGenerator.java new file mode 100644 index 000000000..0a99356df --- /dev/null +++ b/legacy/runtime/org.argeo.slc.support.castor/src/main/java/org/argeo/slc/xml/test/tree/XsltReportGenerator.java @@ -0,0 +1,188 @@ +/* + * Copyright (C) 2007-2012 Mathieu Baudier + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.argeo.slc.xml.test.tree; + +import java.io.File; +import java.io.FileOutputStream; +import java.io.InputStream; +import java.io.OutputStream; +import java.util.HashMap; +import java.util.Map; + +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; +import javax.xml.transform.Templates; +import javax.xml.transform.Transformer; +import javax.xml.transform.TransformerFactory; +import javax.xml.transform.dom.DOMResult; +import javax.xml.transform.dom.DOMSource; +import javax.xml.transform.stream.StreamResult; +import javax.xml.transform.stream.StreamSource; + +import org.springframework.core.io.Resource; +import org.springframework.oxm.Marshaller; +import org.springframework.xml.transform.StringResult; +import org.w3c.dom.Document; + +import org.apache.commons.io.IOUtils; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +import org.argeo.slc.SlcException; +import org.argeo.slc.core.test.tree.TreeTestResult; +import org.argeo.slc.test.TestResultListener; +import org.argeo.slc.test.TestResultPart; + +/** Build a report based on a tree test result using an XSLT stylesheet. */ +public class XsltReportGenerator implements TestResultListener { + private final static Log log = LogFactory.getLog(XsltReportGenerator.class); + + private DocumentBuilder documentBuilder = null; + + private Resource xsltStyleSheet; + + private Templates templates; + + private Marshaller marshaller; + + private String outputDir; + private String outputFileExtension = "html"; + + private Boolean logXml = false; + + private Map xsltParameters = new HashMap(); + + public void init() { + if (templates != null) + return; + + if (xsltStyleSheet == null) + throw new SlcException("XSLT style sheet not specified."); + + InputStream in = null; + try { + TransformerFactory transformerFactory = TransformerFactory + .newInstance(); + in = xsltStyleSheet.getInputStream(); + StreamSource xsltSource = new StreamSource(in); + templates = transformerFactory.newTemplates(xsltSource); + } catch (Exception e) { + throw new SlcException("Could not initialize templates", e); + } finally { + IOUtils.closeQuietly(in); + } + } + + public void resultPartAdded(TreeTestResult testResult, + TestResultPart testResultPart) { + + } + + public void close(TreeTestResult testResult) { + if (templates == null) + throw new SlcException("XSLT template not initialized"); + + File file = getFile(testResult); + OutputStream out = null; + + try { + Transformer transformer = templates.newTransformer(); + for (String paramKey : xsltParameters.keySet()) { + transformer + .setParameter(paramKey, xsltParameters.get(paramKey)); + if (log.isTraceEnabled()) + log.trace("Set XSLT parameter " + paramKey + " to " + + xsltParameters.get(paramKey)); + } + + if (documentBuilder == null) + documentBuilder = DocumentBuilderFactory.newInstance() + .newDocumentBuilder(); + + Document document = documentBuilder.newDocument(); + DOMResult marshallResult = new DOMResult(document); + marshaller.marshal(testResult, marshallResult); + + if (logXml) { + Transformer identityTransformer = TransformerFactory + .newInstance().newTransformer(); + StringResult xmlResult = new StringResult(); + identityTransformer.transform(new DOMSource(marshallResult + .getNode()), xmlResult); + log.info("Marshalled XML:\n" + xmlResult); + } + + DOMSource transfoSource = new DOMSource(marshallResult.getNode()); + + if (outputDir != null) { + File dir = new File(outputDir); + dir.mkdirs(); + out = new FileOutputStream(file); + StreamResult outputResult = new StreamResult(out); + transformer.transform(transfoSource, outputResult); + } else { + // print on console if no output dir + StringResult result = new StringResult(); + transformer.transform(transfoSource, result); + log.info("Generated report:\n" + result); + } + } catch (Exception e) { + throw new SlcException( + "Could not transform test result to " + file, e); + } finally { + IOUtils.closeQuietly(out); + } + } + + public Resource getXsltStyleSheet() { + return xsltStyleSheet; + } + + public void setXsltStyleSheet(Resource xsltStyleSheet) { + this.xsltStyleSheet = xsltStyleSheet; + } + + public void setTemplates(Templates templates) { + this.templates = templates; + } + + public void setMarshaller(Marshaller marshaller) { + this.marshaller = marshaller; + } + + public void setOutputDir(String outputDir) { + this.outputDir = outputDir; + } + + public void setOutputFileExtension(String outputFileExtension) { + this.outputFileExtension = outputFileExtension; + } + + protected File getFile(TreeTestResult result) { + Long time = System.currentTimeMillis(); + return new File(outputDir + File.separator + time + "-" + + result.getUuid() + "." + outputFileExtension); + } + + public void setLogXml(Boolean logXml) { + this.logXml = logXml; + } + + public void setXsltParameters(Map xsltParameters) { + this.xsltParameters = xsltParameters; + } + +} diff --git a/legacy/runtime/org.argeo.slc.support.castor/src/main/resources/org/argeo/slc/castor/attachment.xml b/legacy/runtime/org.argeo.slc.support.castor/src/main/resources/org/argeo/slc/castor/attachment.xml new file mode 100644 index 000000000..774e1bf07 --- /dev/null +++ b/legacy/runtime/org.argeo.slc.support.castor/src/main/resources/org/argeo/slc/castor/attachment.xml @@ -0,0 +1,32 @@ + + + + + + Attachment objects XML mapping + + + + + + + + + \ No newline at end of file diff --git a/legacy/runtime/org.argeo.slc.support.castor/src/main/resources/org/argeo/slc/castor/common.xml b/legacy/runtime/org.argeo.slc.support.castor/src/main/resources/org/argeo/slc/castor/common.xml new file mode 100644 index 000000000..ae97e3465 --- /dev/null +++ b/legacy/runtime/org.argeo.slc.support.castor/src/main/resources/org/argeo/slc/castor/common.xml @@ -0,0 +1,32 @@ + + + + Build objects XML mapping + + + + + + + + + + + \ No newline at end of file diff --git a/legacy/runtime/org.argeo.slc.support.castor/src/main/resources/org/argeo/slc/castor/execution.xml b/legacy/runtime/org.argeo.slc.support.castor/src/main/resources/org/argeo/slc/castor/execution.xml new file mode 100644 index 000000000..662cbe6af --- /dev/null +++ b/legacy/runtime/org.argeo.slc.support.castor/src/main/resources/org/argeo/slc/castor/execution.xml @@ -0,0 +1,172 @@ + + + + + + Execution objects XML mapping + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/legacy/runtime/org.argeo.slc.support.castor/src/main/resources/org/argeo/slc/castor/msg.xml b/legacy/runtime/org.argeo.slc.support.castor/src/main/resources/org/argeo/slc/castor/msg.xml new file mode 100644 index 000000000..269903113 --- /dev/null +++ b/legacy/runtime/org.argeo.slc.support.castor/src/main/resources/org/argeo/slc/castor/msg.xml @@ -0,0 +1,217 @@ + + + + + + + Message objects XML mapping + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/legacy/runtime/org.argeo.slc.support.castor/src/main/resources/org/argeo/slc/castor/process.xml b/legacy/runtime/org.argeo.slc.support.castor/src/main/resources/org/argeo/slc/castor/process.xml new file mode 100644 index 000000000..67bba2743 --- /dev/null +++ b/legacy/runtime/org.argeo.slc.support.castor/src/main/resources/org/argeo/slc/castor/process.xml @@ -0,0 +1,82 @@ + + + + + + Process objects XML mapping + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/legacy/runtime/org.argeo.slc.support.castor/src/main/resources/org/argeo/slc/castor/runtime.xml b/legacy/runtime/org.argeo.slc.support.castor/src/main/resources/org/argeo/slc/castor/runtime.xml new file mode 100644 index 000000000..9b1a1c07b --- /dev/null +++ b/legacy/runtime/org.argeo.slc.support.castor/src/main/resources/org/argeo/slc/castor/runtime.xml @@ -0,0 +1,36 @@ + + + + + + Runtime objects XML mapping + + + + + + + + + + + + \ No newline at end of file diff --git a/legacy/runtime/org.argeo.slc.support.castor/src/main/resources/org/argeo/slc/castor/spring.xml b/legacy/runtime/org.argeo.slc.support.castor/src/main/resources/org/argeo/slc/castor/spring.xml new file mode 100644 index 000000000..0b73dee77 --- /dev/null +++ b/legacy/runtime/org.argeo.slc.support.castor/src/main/resources/org/argeo/slc/castor/spring.xml @@ -0,0 +1,64 @@ + + + + + + + + + + classpath:org/argeo/slc/castor/common.xml + classpath:org/argeo/slc/castor/msg.xml + classpath:org/argeo/slc/castor/process.xml + classpath:org/argeo/slc/castor/runtime.xml + classpath:org/argeo/slc/castor/structure.xml + classpath:org/argeo/slc/castor/test.xml + classpath:org/argeo/slc/castor/execution.xml + classpath:org/argeo/slc/castor/attachment.xml + + + + + + + + + + + + + + + + + + + diff --git a/legacy/runtime/org.argeo.slc.support.castor/src/main/resources/org/argeo/slc/castor/structure.xml b/legacy/runtime/org.argeo.slc.support.castor/src/main/resources/org/argeo/slc/castor/structure.xml new file mode 100644 index 000000000..ad63a7a3f --- /dev/null +++ b/legacy/runtime/org.argeo.slc.support.castor/src/main/resources/org/argeo/slc/castor/structure.xml @@ -0,0 +1,51 @@ + + + + Structure related objects XML mapping + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/legacy/runtime/org.argeo.slc.support.castor/src/main/resources/org/argeo/slc/castor/test.xml b/legacy/runtime/org.argeo.slc.support.castor/src/main/resources/org/argeo/slc/castor/test.xml new file mode 100644 index 000000000..45b9bbe0a --- /dev/null +++ b/legacy/runtime/org.argeo.slc.support.castor/src/main/resources/org/argeo/slc/castor/test.xml @@ -0,0 +1,123 @@ + + + + Test objects XML mapping + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/legacy/runtime/org.argeo.slc.support.castor/src/site/apt/index.apt b/legacy/runtime/org.argeo.slc.support.castor/src/site/apt/index.apt new file mode 100644 index 000000000..f414460db --- /dev/null +++ b/legacy/runtime/org.argeo.slc.support.castor/src/site/apt/index.apt @@ -0,0 +1 @@ +Argeo SLC Site \ No newline at end of file diff --git a/legacy/runtime/org.argeo.slc.support.castor/src/test/java/org/argeo/slc/castor/AbstractCastorTestCase.java b/legacy/runtime/org.argeo.slc.support.castor/src/test/java/org/argeo/slc/castor/AbstractCastorTestCase.java new file mode 100644 index 000000000..f91ad0b6e --- /dev/null +++ b/legacy/runtime/org.argeo.slc.support.castor/src/test/java/org/argeo/slc/castor/AbstractCastorTestCase.java @@ -0,0 +1,76 @@ +/* + * Copyright (C) 2007-2012 Mathieu Baudier + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.argeo.slc.castor; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.argeo.slc.unit.AbstractSpringTestCase; +import org.argeo.slc.unit.UnitXmlUtils; +import org.springframework.oxm.Marshaller; +import org.springframework.oxm.Unmarshaller; +import org.springframework.xml.transform.StringResult; +import org.springframework.xml.transform.StringSource; +import org.springframework.xml.validation.XmlValidator; + +public abstract class AbstractCastorTestCase extends AbstractSpringTestCase { + protected Log log = LogFactory.getLog(getClass()); + + private Marshaller marshaller; + private Unmarshaller unmarshaller; + + @Override + public void setUp() { + marshaller = getBean(Marshaller.class); + unmarshaller = getBean(Unmarshaller.class); + } + + protected StringResult marshal(Object obj) throws Exception { + return marshal(obj, false); + } + + protected StringResult marshalAndValidate(Object obj) throws Exception { + return marshal(obj, true); + } + + protected StringResult marshal(Object obj, boolean validate) + throws Exception { + StringResult xml = new StringResult(); + marshaller.marshal(obj, xml); + + log.info("Marshalled " + obj.getClass() + ": " + xml + "\n"); + + if (validate) + UnitXmlUtils.assertXmlValidation(getBean(XmlValidator.class), + new StringSource(xml.toString())); + return xml; + } + + @SuppressWarnings("unchecked") + protected T unmarshal(StringResult xml) throws Exception { + return (T) unmarshaller.unmarshal(new StringSource(xml.toString())); + } + + @SuppressWarnings("unchecked") + protected T marshUnmarsh(Object obj, boolean validate) throws Exception { + StringResult xml = marshal(obj, validate); + return (T) unmarshal(xml); + } + + @SuppressWarnings("unchecked") + protected T marshUnmarsh(Object obj) throws Exception { + return (T) marshUnmarsh(obj, true); + } +} diff --git a/legacy/runtime/org.argeo.slc.support.castor/src/test/java/org/argeo/slc/castor/ExecutionAnswerCastorTest.java b/legacy/runtime/org.argeo.slc.support.castor/src/test/java/org/argeo/slc/castor/ExecutionAnswerCastorTest.java new file mode 100644 index 000000000..ea3b55012 --- /dev/null +++ b/legacy/runtime/org.argeo.slc.support.castor/src/test/java/org/argeo/slc/castor/ExecutionAnswerCastorTest.java @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2007-2012 Mathieu Baudier + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.argeo.slc.castor; + +import org.argeo.slc.msg.ExecutionAnswer; + +public class ExecutionAnswerCastorTest extends AbstractCastorTestCase { + public void testMarshUnmarshOk() throws Exception { + ExecutionAnswer answer = new ExecutionAnswer(ExecutionAnswer.OK, + "No problem!"); + ExecutionAnswer answerUnm = marshUnmarsh(answer); + assertExecutionAnswer(answer, answerUnm); + } + + public void testMarshUnmarshError() throws Exception { + ExecutionAnswer answer = new ExecutionAnswer(ExecutionAnswer.ERROR, + "Oooops..."); + ExecutionAnswer answerUnm = marshUnmarsh(answer); + assertExecutionAnswer(answer, answerUnm); + } + + public static void assertExecutionAnswer(ExecutionAnswer expected, + ExecutionAnswer reached) { + assertEquals(expected.getStatus(), reached.getStatus()); + assertEquals(expected.getMessage(), reached.getMessage()); + } +} diff --git a/legacy/runtime/org.argeo.slc.support.castor/src/test/java/org/argeo/slc/castor/ExecutionModuleDescriptorCastorTest.java b/legacy/runtime/org.argeo.slc.support.castor/src/test/java/org/argeo/slc/castor/ExecutionModuleDescriptorCastorTest.java new file mode 100644 index 000000000..b25f52b7b --- /dev/null +++ b/legacy/runtime/org.argeo.slc.support.castor/src/test/java/org/argeo/slc/castor/ExecutionModuleDescriptorCastorTest.java @@ -0,0 +1,55 @@ +/* + * Copyright (C) 2007-2012 Mathieu Baudier + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.argeo.slc.castor; + +import java.util.ArrayList; +import java.util.List; + +import org.argeo.slc.execution.ExecutionFlowDescriptor; +import org.argeo.slc.execution.ExecutionModuleDescriptor; +import org.argeo.slc.execution.ExecutionSpec; +import org.argeo.slc.unit.execution.ExecutionFlowDescriptorTestUtils; + +public class ExecutionModuleDescriptorCastorTest extends AbstractCastorTestCase { + public void testMarshUnmarsh() throws Exception { + ExecutionModuleDescriptor moduleDescriptor = new ExecutionModuleDescriptor(); + moduleDescriptor.setName("test.module"); + moduleDescriptor.setVersion("1.0.0"); + moduleDescriptor.setLabel("Test Module"); + moduleDescriptor.setDescription("module descriptor"); + + ExecutionFlowDescriptor flowDescriptor = ExecutionFlowDescriptorTestUtils + .createSimpleExecutionFlowDescriptor(); + + List flows = new ArrayList(); + flows.add(flowDescriptor); + moduleDescriptor.setExecutionFlows(flows); + + List specs = new ArrayList(); + specs.add(flowDescriptor.getExecutionSpec()); + moduleDescriptor.setExecutionSpecs(specs); + + marshUnmarsh(moduleDescriptor, false); + } + + public void testMarshUnmarshMini() throws Exception { + ExecutionModuleDescriptor moduleDescriptor = new ExecutionModuleDescriptor(); + moduleDescriptor.setName("test.moodule"); + moduleDescriptor.setVersion("1.0.0"); + marshUnmarsh(moduleDescriptor, false); + } + +} diff --git a/legacy/runtime/org.argeo.slc.support.castor/src/test/java/org/argeo/slc/castor/ModularDistributionCastorTest.java b/legacy/runtime/org.argeo.slc.support.castor/src/test/java/org/argeo/slc/castor/ModularDistributionCastorTest.java new file mode 100644 index 000000000..317d01993 --- /dev/null +++ b/legacy/runtime/org.argeo.slc.support.castor/src/test/java/org/argeo/slc/castor/ModularDistributionCastorTest.java @@ -0,0 +1,58 @@ +/* + * Copyright (C) 2007-2012 Mathieu Baudier + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.argeo.slc.castor; + +import org.argeo.slc.msg.ObjectList; +import org.argeo.slc.msg.build.ModularDistributionDescriptor; + +public class ModularDistributionCastorTest extends AbstractCastorTestCase { + public void testModularDistributionDescriptor() throws Exception { + ModularDistributionDescriptor mdd = new ModularDistributionDescriptor(); + mdd.setName("name"); + mdd.setVersion("0.1.0"); + mdd.getModulesDescriptors().put("eclipse", + "http://localhost/updateSite"); + mdd.getModulesDescriptors().put("modularDistribution", + "http://localhost/modularDistribution"); + + marshUnmarsh(mdd, false); + } + + public void testModularDistributionDescriptorList() throws Exception { + ModularDistributionDescriptor mdd = new ModularDistributionDescriptor(); + mdd.setName("name"); + mdd.setVersion("0.1.0"); + mdd.getModulesDescriptors().put("eclipse", + "http://localhost/updateSite"); + mdd.getModulesDescriptors().put("modularDistribution", + "http://localhost/modularDistribution"); + + ModularDistributionDescriptor mdd2 = new ModularDistributionDescriptor(); + mdd2.setName("name2"); + mdd2.setVersion("0.1.1"); + mdd2.getModulesDescriptors().put("eclipse", + "http://localhost/updateSite2"); + mdd2.getModulesDescriptors().put("modularDistribution", + "http://localhost/modularDistribution2"); + + ObjectList ol = new ObjectList(); + ol.getObjects().add(mdd); + ol.getObjects().add(mdd2); + + marshUnmarsh(ol, false); + } + +} diff --git a/legacy/runtime/org.argeo.slc.support.castor/src/test/java/org/argeo/slc/castor/ObjectListCastorTest.java b/legacy/runtime/org.argeo.slc.support.castor/src/test/java/org/argeo/slc/castor/ObjectListCastorTest.java new file mode 100644 index 000000000..b01d9a7de --- /dev/null +++ b/legacy/runtime/org.argeo.slc.support.castor/src/test/java/org/argeo/slc/castor/ObjectListCastorTest.java @@ -0,0 +1,31 @@ +/* + * Copyright (C) 2007-2012 Mathieu Baudier + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.argeo.slc.castor; + +import org.argeo.slc.msg.ObjectList; +import org.argeo.slc.runtime.SlcAgentDescriptor; + +public class ObjectListCastorTest extends AbstractCastorTestCase { + + public void testAgentDescriptorList() throws Exception { + SlcAgentDescriptor agentDescriptor = SlcAgentDescriptorCastorTest + .createMiniAgentDescriptor(); + ObjectList lst = new ObjectList(); + lst.getObjects().add(agentDescriptor); + ObjectList lstUnm = (ObjectList) marshUnmarsh(lst, false); + assertEquals(1, lstUnm.getObjects().size()); + } +} diff --git a/legacy/runtime/org.argeo.slc.support.castor/src/test/java/org/argeo/slc/castor/SlcAgentDescriptorCastorTest.java b/legacy/runtime/org.argeo.slc.support.castor/src/test/java/org/argeo/slc/castor/SlcAgentDescriptorCastorTest.java new file mode 100644 index 000000000..0367da70f --- /dev/null +++ b/legacy/runtime/org.argeo.slc.support.castor/src/test/java/org/argeo/slc/castor/SlcAgentDescriptorCastorTest.java @@ -0,0 +1,62 @@ +/* + * Copyright (C) 2007-2012 Mathieu Baudier + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.argeo.slc.castor; + +import java.util.ArrayList; +import java.util.List; + +import org.argeo.slc.execution.ExecutionModuleDescriptor; +import org.argeo.slc.runtime.SlcAgentDescriptor; + +public class SlcAgentDescriptorCastorTest extends AbstractCastorTestCase { + public void testMarshUnmarshMini() throws Exception { + SlcAgentDescriptor agentDescriptor = createMiniAgentDescriptor(); + SlcAgentDescriptor agentDescriptorUnm = marshUnmarsh(agentDescriptor, + false); + assertSlcAgentDescriptor(agentDescriptor, agentDescriptorUnm); + } + + public void testMarshUnmarshWithModuleDescriptor() throws Exception { + SlcAgentDescriptor agentDescriptor = createMiniAgentDescriptor(); + + List lst = new ArrayList(); + ExecutionModuleDescriptor moduleDescriptor = new ExecutionModuleDescriptor(); + moduleDescriptor.setName("test.moodule"); + moduleDescriptor.setVersion("1.0.0"); + lst.add(moduleDescriptor); + agentDescriptor.setModuleDescriptors(lst); + + SlcAgentDescriptor agentDescriptorUnm = marshUnmarsh(agentDescriptor, + false); + assertSlcAgentDescriptor(agentDescriptor, agentDescriptorUnm); + } + + protected static SlcAgentDescriptor createMiniAgentDescriptor() { + SlcAgentDescriptor agentDescriptor = new SlcAgentDescriptor(); + agentDescriptor.setHost("localhost"); + agentDescriptor.setUuid("555"); + return agentDescriptor; + } + + protected static void assertSlcAgentDescriptor(SlcAgentDescriptor expected, + SlcAgentDescriptor reached) { + assertNotNull(reached); + assertEquals(expected.getHost(), reached.getHost()); + assertEquals(expected.getUuid(), expected.getUuid()); + assertEquals(expected.getModuleDescriptors().size(), reached + .getModuleDescriptors().size()); + } +} diff --git a/legacy/runtime/org.argeo.slc.support.castor/src/test/java/org/argeo/slc/castor/SlcExecutionCastorTest.java b/legacy/runtime/org.argeo.slc.support.castor/src/test/java/org/argeo/slc/castor/SlcExecutionCastorTest.java new file mode 100644 index 000000000..44794e163 --- /dev/null +++ b/legacy/runtime/org.argeo.slc.support.castor/src/test/java/org/argeo/slc/castor/SlcExecutionCastorTest.java @@ -0,0 +1,87 @@ +/* + * Copyright (C) 2007-2012 Mathieu Baudier + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.argeo.slc.castor; + +import java.text.SimpleDateFormat; +import java.util.UUID; + +import org.argeo.slc.msg.process.SlcExecutionRequest; +import org.argeo.slc.msg.process.SlcExecutionStepsRequest; +import org.argeo.slc.process.SlcExecution; +import org.argeo.slc.process.SlcExecutionStep; +import org.argeo.slc.unit.process.SlcExecutionTestUtils; +import org.springframework.xml.transform.StringResult; + +public class SlcExecutionCastorTest extends AbstractCastorTestCase { + public void testMarshalling() throws Exception { + SlcExecution slcExec = SlcExecutionTestUtils.createSimpleSlcExecution(); + + SlcExecutionRequest msgSave = new SlcExecutionRequest(); + msgSave.setSlcExecution(slcExec); + + StringResult msgSaveXml = marshalAndValidate(msgSave); + + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm"); + SlcExecutionStep step0 = new SlcExecutionStep(); + step0.setUuid(UUID.randomUUID().toString()); + step0.setTimestamp(sdf.parse("2008-04-17 18:21")); + step0.setType("LOG"); + step0.addLog("A log message\nand another line"); + + SlcExecutionStep step1 = new SlcExecutionStep(); + step1.setUuid(UUID.randomUUID().toString()); + step1.setTimestamp(sdf.parse("2008-04-17 18:25")); + step1.setType("LOG"); + step1.addLog("A nother log message"); + + SlcExecutionStepsRequest msgNotif = new SlcExecutionStepsRequest(); + msgNotif.addStep(step0); + msgNotif.addStep(step1); + msgNotif.setSlcExecutionUuid(slcExec.getUuid()); + + StringResult msgNotifXml = marshalAndValidate(msgNotif); + + SlcExecutionRequest msgSaveUnm = unmarshal(msgSaveXml); + assertNotNull(msgSaveUnm); + SlcExecutionTestUtils.assertSlcExecution(slcExec, msgSaveUnm + .getSlcExecution()); + + SlcExecutionStepsRequest msgNotifUnm = unmarshal(msgNotifXml); + assertNotNull(msgNotifUnm); + assertEquals(slcExec.getUuid(), msgNotifUnm.getSlcExecutionUuid()); + assertEquals(2, msgNotifUnm.getSteps().size()); + SlcExecutionTestUtils.assertSlcExecutionStep(step0, msgNotifUnm + .getSteps().get(0)); + SlcExecutionTestUtils.assertSlcExecutionStep(step1, msgNotifUnm + .getSteps().get(1)); + + SlcExecution slcExecUnm = msgSaveUnm.getSlcExecution(); + slcExecUnm.getSteps().addAll(msgNotifUnm.getSteps()); + + SlcExecutionRequest msgUpdate = new SlcExecutionRequest(); + msgUpdate.setSlcExecution(slcExecUnm); + StringResult msgUpdateXml = marshalAndValidate(msgUpdate); + + SlcExecutionRequest msgUpdateUnm = unmarshal(msgUpdateXml); + assertNotNull(msgUpdateUnm); + } + + public void testMarshUnmarsh() throws Exception { + SlcExecution slcExec = SlcExecutionTestUtils + .createSlcExecutionWithRealizedFlows(); + marshUnmarsh(slcExec, false); + } +} diff --git a/legacy/runtime/org.argeo.slc.support.castor/src/test/java/org/argeo/slc/castor/TreeTestResultCastorTest.java b/legacy/runtime/org.argeo.slc.support.castor/src/test/java/org/argeo/slc/castor/TreeTestResultCastorTest.java new file mode 100644 index 000000000..7d6d6e961 --- /dev/null +++ b/legacy/runtime/org.argeo.slc.support.castor/src/test/java/org/argeo/slc/castor/TreeTestResultCastorTest.java @@ -0,0 +1,78 @@ +/* + * Copyright (C) 2007-2012 Mathieu Baudier + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.argeo.slc.castor; + +import static org.argeo.slc.unit.UnitUtils.assertDateSec; +import static org.argeo.slc.unit.test.tree.TreeTestResultTestUtils.createCompleteTreeTestResult; +import static org.argeo.slc.unit.test.tree.TreeTestResultTestUtils.createSimpleResultPartRequest; + +import org.argeo.slc.core.test.tree.TreeTestResult; +import org.argeo.slc.msg.test.tree.CloseTreeTestResultRequest; +import org.argeo.slc.msg.test.tree.CreateTreeTestResultRequest; +import org.argeo.slc.msg.test.tree.ResultPartRequest; +import org.argeo.slc.unit.test.tree.UnitTestTreeUtil; +import org.springframework.xml.transform.StringResult; + +public class TreeTestResultCastorTest extends AbstractCastorTestCase { + public void testMarshUnmarsh() throws Exception { + TreeTestResult ttr = createCompleteTreeTestResult(); + + StringResult xml = marshalAndValidate(ttr); + + TreeTestResult ttrUnm = unmarshal(xml); + + UnitTestTreeUtil.assertTreeTestResult(ttr, ttrUnm); + } + + public void testCreateTreeTestResultRequest() throws Exception { + CreateTreeTestResultRequest req = new CreateTreeTestResultRequest(); + req.setTreeTestResult(createCompleteTreeTestResult()); + + StringResult xml = marshalAndValidate(req); + + CreateTreeTestResultRequest reqUnm = unmarshal(xml); + + UnitTestTreeUtil.assertTreeTestResult(req.getTreeTestResult(), reqUnm + .getTreeTestResult()); + } + + public void testResultPartRequest() throws Exception { + TreeTestResult ttr = createCompleteTreeTestResult(); + ResultPartRequest req = createSimpleResultPartRequest(ttr); + + StringResult xml = marshalAndValidate(req); + + ResultPartRequest reqUnm = unmarshal(xml); + + UnitTestTreeUtil + .assertPart(req.getResultPart(), reqUnm.getResultPart()); + } + + public void testCloseTreeTestResultRequest() throws Exception { + TreeTestResult ttr = createCompleteTreeTestResult(); + ttr.close(); + + CloseTreeTestResultRequest req = new CloseTreeTestResultRequest(ttr + .getUuid(), ttr.getCloseDate()); + + StringResult xml = marshalAndValidate(req); + + CloseTreeTestResultRequest reqUnm = unmarshal(xml); + + assertEquals(ttr.getUuid(), reqUnm.getResultUuid()); + assertDateSec(ttr.getCloseDate(), ttr.getCloseDate()); + } +} diff --git a/legacy/runtime/org.argeo.slc.support.castor/src/test/java/org/argeo/slc/castor/TreeTestResultCollectionCastorTest.java b/legacy/runtime/org.argeo.slc.support.castor/src/test/java/org/argeo/slc/castor/TreeTestResultCollectionCastorTest.java new file mode 100644 index 000000000..46fc836e1 --- /dev/null +++ b/legacy/runtime/org.argeo.slc.support.castor/src/test/java/org/argeo/slc/castor/TreeTestResultCollectionCastorTest.java @@ -0,0 +1,48 @@ +/* + * Copyright (C) 2007-2012 Mathieu Baudier + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.argeo.slc.castor; + +import static org.argeo.slc.unit.test.tree.TreeTestResultTestUtils.createCompleteTreeTestResult; + +import org.argeo.slc.core.test.tree.TreeTestResult; +import org.argeo.slc.core.test.tree.TreeTestResultCollection; +import org.argeo.slc.unit.test.tree.UnitTestTreeUtil; +import org.springframework.xml.transform.StringResult; + +public class TreeTestResultCollectionCastorTest extends AbstractCastorTestCase { + public void testMarshUnmarsh() throws Exception { + TreeTestResult ttr = createCompleteTreeTestResult(); + TreeTestResult ttr2 = createCompleteTreeTestResult(); + + TreeTestResultCollection ttrc = new TreeTestResultCollection(); + ttrc.setId("testCollection"); + ttrc.getResults().add(ttr); + ttrc.getResults().add(ttr2); + + StringResult xml = marshalAndValidate(ttrc); + + TreeTestResultCollection ttrcUnm = unmarshal(xml); + + assertEquals(ttrc.getId(), ttrcUnm.getId()); + assertEquals(ttrc.getResults().size(), ttrcUnm.getResults().size()); + for (TreeTestResult ttrT : ttrc.getResults()) { + if (ttrT.getUuid().equals(ttr.getUuid())) + UnitTestTreeUtil.assertTreeTestResult(ttr, ttrT); + else + UnitTestTreeUtil.assertTreeTestResult(ttr2, ttrT); + } + } +} diff --git a/legacy/runtime/org.argeo.slc.support.castor/src/test/resources/log4j.properties b/legacy/runtime/org.argeo.slc.support.castor/src/test/resources/log4j.properties new file mode 100644 index 000000000..0133bab88 --- /dev/null +++ b/legacy/runtime/org.argeo.slc.support.castor/src/test/resources/log4j.properties @@ -0,0 +1,22 @@ +# Set root logger level to DEBUG and its only appender to A1. +log4j.rootLogger=WARN, console + +## Levels +# Slc +log4j.logger.org.argeo=DEBUG + +# Castor +log4j.logger.org.exolab.castor=WARN + +# Spring +log4j.logger.org.springframework=WARN + + +## Appenders +# A1 is set to be a ConsoleAppender. +log4j.appender.console=org.apache.log4j.ConsoleAppender + +# A1 uses PatternLayout. +log4j.appender.console.layout=org.apache.log4j.PatternLayout +log4j.appender.console.layout.ConversionPattern= %-5p %d{ISO8601} %m - %c%n + diff --git a/legacy/runtime/org.argeo.slc.support.castor/src/test/resources/org/argeo/slc/castor/applicationContext.xml b/legacy/runtime/org.argeo.slc.support.castor/src/test/resources/org/argeo/slc/castor/applicationContext.xml new file mode 100644 index 000000000..c479075b8 --- /dev/null +++ b/legacy/runtime/org.argeo.slc.support.castor/src/test/resources/org/argeo/slc/castor/applicationContext.xml @@ -0,0 +1,26 @@ + + + + + + + + \ No newline at end of file diff --git a/legacy/runtime/org.argeo.slc.support.hibernate/.classpath b/legacy/runtime/org.argeo.slc.support.hibernate/.classpath new file mode 100644 index 000000000..26b349477 --- /dev/null +++ b/legacy/runtime/org.argeo.slc.support.hibernate/.classpath @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/legacy/runtime/org.argeo.slc.support.hibernate/.project b/legacy/runtime/org.argeo.slc.support.hibernate/.project new file mode 100644 index 000000000..080510172 --- /dev/null +++ b/legacy/runtime/org.argeo.slc.support.hibernate/.project @@ -0,0 +1,28 @@ + + + org.argeo.slc.support.hibernate + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.jdt.core.javanature + org.eclipse.pde.PluginNature + + diff --git a/legacy/runtime/org.argeo.slc.support.hibernate/.settings/org.eclipse.jdt.core.prefs b/legacy/runtime/org.argeo.slc.support.hibernate/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 000000000..b5feaf2d2 --- /dev/null +++ b/legacy/runtime/org.argeo.slc.support.hibernate/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,12 @@ +#Fri Aug 29 11:24:23 CEST 2008 +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.compiler.compliance=1.5 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.5 diff --git a/legacy/runtime/org.argeo.slc.support.hibernate/.settings/org.eclipse.pde.core.prefs b/legacy/runtime/org.argeo.slc.support.hibernate/.settings/org.eclipse.pde.core.prefs new file mode 100644 index 000000000..0572a4a46 --- /dev/null +++ b/legacy/runtime/org.argeo.slc.support.hibernate/.settings/org.eclipse.pde.core.prefs @@ -0,0 +1,3 @@ +#Mon Feb 14 20:13:33 CET 2011 +eclipse.preferences.version=1 +selfhosting.binExcludes=/org.argeo.slc.support.hibernate/target/test-classes,/org.argeo.slc.support.hibernate/target/test-classes diff --git a/legacy/runtime/org.argeo.slc.support.hibernate/build.properties b/legacy/runtime/org.argeo.slc.support.hibernate/build.properties new file mode 100644 index 000000000..0f69dad3b --- /dev/null +++ b/legacy/runtime/org.argeo.slc.support.hibernate/build.properties @@ -0,0 +1,21 @@ +additional.bundles = org.springframework.transaction,\ + org.argeo.slc.unit,\ + junit,\ + org.springframework.oxm,\ + org.springframework.xml,\ + org.dom4j,\ + org.springframework.jdbc,\ + org.springframework.context.support,\ + net.sf.ehcache,\ + org.hsqldb,\ + org.apache.commons.collections,\ + antlr,\ + org.argeo.slc.support.castor,\ + org.castor,\ + org.apache.xml.serializer,\ + org.apache.xerces,\ + org.h2 +source.. = src/main/java/,\ + src/main/resources/,\ + src/test/java/,\ + src/test/resources/ diff --git a/legacy/runtime/org.argeo.slc.support.hibernate/pom.xml b/legacy/runtime/org.argeo.slc.support.hibernate/pom.xml new file mode 100644 index 000000000..d996e2f16 --- /dev/null +++ b/legacy/runtime/org.argeo.slc.support.hibernate/pom.xml @@ -0,0 +1,102 @@ + + + 4.0.0 + + org.argeo.slc + runtime + 1.1.3-SNAPSHOT + .. + + org.argeo.slc.runtime + org.argeo.slc.support.hibernate + SLC Support Hibernate + + + + org.apache.felix + maven-bundle-plugin + + + org.argeo.slc.core + !org.argeo.slc.core.*,org.hibernate.proxy,javassist.util.proxy,* + + + + + org.apache.maven.plugins + maven-surefire-plugin + + + true + + + + + + + org.argeo.slc.runtime + org.argeo.slc.core + 1.1.3-SNAPSHOT + + + + org.argeo.tp + org.hibernate + + + org.argeo.tp + net.sf.ehcache + + + org.argeo.tp + edu.emory.mathcs.backport + + + org.argeo.tp + org.springframework.orm + + + org.argeo.tp + org.springframework.jdbc + + + org.argeo.tp + org.springframework.context.support + + + org.argeo.tp + org.springframework.transaction + + + + org.argeo.tp + org.apache.commons.dbcp + + + + + org.argeo.slc.runtime + org.argeo.slc.unit + test + 1.1.3-SNAPSHOT + + + + org.argeo.slc.runtime + org.argeo.slc.support.castor + test + 1.1.3-SNAPSHOT + + + + org.argeo.tp + org.hsqldb + test + + + org.argeo.tp + org.h2 + test + + + \ No newline at end of file diff --git a/legacy/runtime/org.argeo.slc.support.hibernate/src/assembly/base.xml b/legacy/runtime/org.argeo.slc.support.hibernate/src/assembly/base.xml new file mode 100644 index 000000000..c135b91e5 --- /dev/null +++ b/legacy/runtime/org.argeo.slc.support.hibernate/src/assembly/base.xml @@ -0,0 +1,32 @@ + + + base + false + + zip + + + + src/base + + + + \ No newline at end of file diff --git a/legacy/runtime/org.argeo.slc.support.hibernate/src/base/bin/slc b/legacy/runtime/org.argeo.slc.support.hibernate/src/base/bin/slc new file mode 100644 index 000000000..bcc63c85a --- /dev/null +++ b/legacy/runtime/org.argeo.slc.support.hibernate/src/base/bin/slc @@ -0,0 +1,326 @@ +#! /bin/sh + +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Extract launch and ant arguments, (see details below). +ant_exec_args= +no_config=false +use_jikes_default=false +ant_exec_debug=false +show_help=false +for arg in "$@" ; do + if [ "$arg" = "--noconfig" ] ; then + no_config=true + elif [ "$arg" = "--usejikes" ] ; then + use_jikes_default=true + elif [ "$arg" = "--execdebug" ] ; then + ant_exec_debug=true + elif [ my"$arg" = my"--h" -o my"$arg" = my"--help" ] ; then + show_help=true + ant_exec_args="$ant_exec_args -h" + else + if [ my"$arg" = my"-h" -o my"$arg" = my"-help" ] ; then + show_help=true + fi + ant_exec_args="$ant_exec_args \"$arg\"" + fi +done + +# Source/default ant configuration +if $no_config ; then + rpm_mode=false + usejikes=$use_jikes_default +else + # load system-wide ant configuration (ONLY if ANT_HOME has NOT been set) + if [ -z "$ANT_HOME" -o "$ANT_HOME" = "/usr/share/ant" ]; then + if [ -f "/etc/ant.conf" ] ; then + . /etc/ant.conf + fi + fi + + # load user ant configuration + if [ -f "$HOME/.ant/ant.conf" ] ; then + . $HOME/.ant/ant.conf + fi + if [ -f "$HOME/.antrc" ] ; then + . "$HOME/.antrc" + fi + + # provide default configuration values + if [ -z "$rpm_mode" ] ; then + rpm_mode=false + fi + if [ -z "$usejikes" ] ; then + usejikes=$use_jikes_default + fi +fi + +# Setup Java environment in rpm mode +if $rpm_mode ; then + if [ -f /usr/share/java-utils/java-functions ] ; then + . /usr/share/java-utils/java-functions + set_jvm + set_javacmd + fi +fi + +# OS specific support. $var _must_ be set to either true or false. +cygwin=false; +darwin=false; +case "`uname`" in + CYGWIN*) cygwin=true ;; + Darwin*) darwin=true + if [ -z "$JAVA_HOME" ] ; then + JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Home + fi + ;; +esac + +if [ -z "$ANT_HOME" -o ! -d "$ANT_HOME" ] ; then + ## resolve links - $0 may be a link to ant's home + PRG="$0" + progname=`basename "$0"` + + # need this for relative symlinks + while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi + done + + ANT_HOME=`dirname "$PRG"`/.. + + # make it fully qualified + ANT_HOME=`cd "$ANT_HOME" && pwd` +fi + +# For Cygwin, ensure paths are in UNIX format before anything is touched +if $cygwin ; then + [ -n "$ANT_HOME" ] && + ANT_HOME=`cygpath --unix "$ANT_HOME"` + [ -n "$JAVA_HOME" ] && + JAVA_HOME=`cygpath --unix "$JAVA_HOME"` +fi + +# set ANT_LIB location +ANT_LIB="${ANT_HOME}/lib" + +if [ -z "$JAVACMD" ] ; then + if [ -n "$JAVA_HOME" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + JAVACMD="$JAVA_HOME/jre/sh/java" + elif [ -x "$JAVA_HOME/jre/bin/java" ] ; then + JAVACMD="$JAVA_HOME/jre/bin/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + else + JAVACMD=`which java 2> /dev/null ` + if [ -z "$JAVACMD" ] ; then + JAVACMD=java + fi + fi +fi + +if [ ! -x "$JAVACMD" ] ; then + echo "Error: JAVA_HOME is not defined correctly." + echo " We cannot execute $JAVACMD" + exit 1 +fi + +# Build local classpath using just the launcher in non-rpm mode or +# use the Jpackage helper in rpm mode with basic and default jars +# specified in the ant.conf configuration. Because the launcher is +# used, libraries linked in ANT_HOME/lib will also be included, but this +# is discouraged as it is not java-version safe. A user should +# request optional jars and their dependencies via the OPT_JAR_LIST +# variable +if $rpm_mode && [ -x /usr/bin/build-classpath ] ; then + LOCALCLASSPATH="$(/usr/bin/build-classpath ant ant-launcher jaxp_parser_impl xml-commons-apis)" + + # If no optional jars have been specified then build the default list + if [ -z "$OPT_JAR_LIST" ] ; then + for file in /etc/ant.d/*; do + if [ -f "$file" ]; then + case "$file" in + *~) ;; + *#*) ;; + *.rpmsave) ;; + *.rpmnew) ;; + *) + for dep in `cat "$file"`; do + case "$OPT_JAR_LIST" in + *"$dep"*) ;; + *) OPT_JAR_LIST="$OPT_JAR_LIST${OPT_JAR_LIST:+ }$dep" + esac + done + esac + fi + done + fi + + # If the user requested to try to add some other jars to the classpath + if [ -n "$OPT_JAR_LIST" ] ; then + _OPTCLASSPATH="$(/usr/bin/build-classpath $OPT_JAR_LIST 2> /dev/null)" + if [ -n "$_OPTCLASSPATH" ] ; then + LOCALCLASSPATH="$LOCALCLASSPATH:$_OPTCLASSPATH" + fi + fi + + # Explicitly add javac path to classpath, assume JAVA_HOME set + # properly in rpm mode + if [ -f "$JAVA_HOME/lib/tools.jar" ] ; then + LOCALCLASSPATH="$LOCALCLASSPATH:$JAVA_HOME/lib/tools.jar" + fi + if [ -f "$JAVA_HOME/lib/classes.zip" ] ; then + LOCALCLASSPATH="$LOCALCLASSPATH:$JAVA_HOME/lib/classes.zip" + fi + + # if CLASSPATH_OVERRIDE env var is set, LOCALCLASSPATH will be + # user CLASSPATH first and ant-found jars after. + # In that case, the user CLASSPATH will override ant-found jars + # + # if CLASSPATH_OVERRIDE is not set, we'll have the normal behaviour + # with ant-found jars first and user CLASSPATH after + if [ -n "$CLASSPATH" ] ; then + # merge local and specified classpath + if [ -z "$LOCALCLASSPATH" ] ; then + LOCALCLASSPATH="$CLASSPATH" + elif [ -n "$CLASSPATH_OVERRIDE" ] ; then + LOCALCLASSPATH="$CLASSPATH:$LOCALCLASSPATH" + else + LOCALCLASSPATH="$LOCALCLASSPATH:$CLASSPATH" + fi + + # remove class path from launcher -cp option + CLASSPATH="" + fi +else + # not using rpm_mode; use launcher to determine classpaths + if [ -z "$LOCALCLASSPATH" ] ; then + LOCALCLASSPATH=$ANT_LIB/ant-launcher.jar + else + LOCALCLASSPATH=$ANT_LIB/ant-launcher.jar:$LOCALCLASSPATH + fi +fi + +if [ -n "$JAVA_HOME" ] ; then + # OSX hack to make Ant work with jikes + if $darwin ; then + OSXHACK="${JAVA_HOME}/../Classes" + if [ -d "${OSXHACK}" ] ; then + for i in "${OSXHACK}"/*.jar + do + JIKESPATH="$JIKESPATH:$i" + done + fi + fi +fi + +# Allow Jikes support (off by default) +if $usejikes; then + ANT_OPTS="$ANT_OPTS -Dbuild.compiler=jikes" +fi + +# For Cygwin, switch paths to appropriate format before running java +# For PATHs convert to unix format first, then to windows format to ensure +# both formats are supported. Probably this will fail on directories with ; +# in the name in the path. Let's assume that paths containing ; are more +# rare than windows style paths on cygwin. +if $cygwin; then + if [ "$OS" = "Windows_NT" ] && cygpath -m .>/dev/null 2>/dev/null ; then + format=mixed + else + format=windows + fi + ANT_HOME=`cygpath --$format "$ANT_HOME"` + ANT_LIB=`cygpath --$format "$ANT_LIB"` + JAVA_HOME=`cygpath --$format "$JAVA_HOME"` + LCP_TEMP=`cygpath --path --unix "$LOCALCLASSPATH"` + LOCALCLASSPATH=`cygpath --path --$format "$LCP_TEMP"` + if [ -n "$CLASSPATH" ] ; then + CP_TEMP=`cygpath --path --unix "$CLASSPATH"` + CLASSPATH=`cygpath --path --$format "$CP_TEMP"` + fi + CYGHOME=`cygpath --$format "$HOME"` +fi + +# Show script help if requested +if $show_help ; then + echo $0 '[script options] [options] [target [target2 [target3] ..]]' + echo 'Script Options:' + echo ' --help, --h print this message and ant help' + echo ' --noconfig suppress sourcing of /etc/ant.conf,' + echo ' $HOME/.ant/ant.conf, and $HOME/.antrc' + echo ' configuration files' + echo ' --usejikes enable use of jikes by default, unless' + echo ' set explicitly in configuration files' + echo ' --execdebug print ant exec line generated by this' + echo ' launch script' + echo ' ' +fi +# add a second backslash to variables terminated by a backslash under cygwin +if $cygwin; then + case "$ANT_HOME" in + *\\ ) + ANT_HOME="$ANT_HOME\\" + ;; + esac + case "$CYGHOME" in + *\\ ) + CYGHOME="$CYGHOME\\" + ;; + esac + case "$JIKESPATH" in + *\\ ) + JIKESPATH="$JIKESPATH\\" + ;; + esac + case "$LOCALCLASSPATH" in + *\\ ) + LOCALCLASSPATH="$LOCALCLASSPATH\\" + ;; + esac + case "$CLASSPATH" in + *\\ ) + CLASSPATH="$CLASSPATH\\" + ;; + esac +fi +# Execute ant using eval/exec to preserve spaces in paths, +# java options, and ant args +ant_sys_opts= +if [ -n "$CYGHOME" ]; then + if [ -n "$JIKESPATH" ]; then + ant_sys_opts="-Djikes.class.path=\"$JIKESPATH\" -Dcygwin.user.home=\"$CYGHOME\"" + else + ant_sys_opts="-Dcygwin.user.home=\"$CYGHOME\"" + fi +else + if [ -n "$JIKESPATH" ]; then + ant_sys_opts="-Djikes.class.path=\"$JIKESPATH\"" + fi +fi +ant_exec_command="exec \"$JAVACMD\" $ANT_OPTS -classpath \"$LOCALCLASSPATH\" -Dant.home=\"$ANT_HOME\" -Dant.library.dir=\"$ANT_LIB\" $ant_sys_opts org.apache.tools.ant.launch.Launcher $ANT_ARGS -cp \"$CLASSPATH\" $ant_exec_args" +if $ant_exec_debug ; then + echo $ant_exec_command +fi +eval $ant_exec_command diff --git a/legacy/runtime/org.argeo.slc.support.hibernate/src/base/bin/slc.bat b/legacy/runtime/org.argeo.slc.support.hibernate/src/base/bin/slc.bat new file mode 100644 index 000000000..f8fb7d5da --- /dev/null +++ b/legacy/runtime/org.argeo.slc.support.hibernate/src/base/bin/slc.bat @@ -0,0 +1,226 @@ +@echo off + +REM Licensed to the Apache Software Foundation (ASF) under one or more +REM contributor license agreements. See the NOTICE file distributed with +REM this work for additional information regarding copyright ownership. +REM The ASF licenses this file to You under the Apache License, Version 2.0 +REM (the "License"); you may not use this file except in compliance with +REM the License. You may obtain a copy of the License at +REM +REM http://www.apache.org/licenses/LICENSE-2.0 +REM +REM Unless required by applicable law or agreed to in writing, software +REM distributed under the License is distributed on an "AS IS" BASIS, +REM WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +REM See the License for the specific language governing permissions and +REM limitations under the License. + +REM This is an inordinately troublesome piece of code, particularly because it +REM tries to work on both Win9x and WinNT-based systems. If we could abandon '9x +REM support, things would be much easier, but sadly, it is not yet time. +REM Be cautious about editing this, and only add WinNT specific stuff in code that +REM only runs on WinNT. + +if "%HOME%"=="" goto homeDrivePathPre +if exist "%HOME%\antrc_pre.bat" call "%HOME%\antrc_pre.bat" + +:homeDrivePathPre +if "%HOMEDRIVE%%HOMEPATH%"=="" goto userProfilePre +if "%HOMEDRIVE%%HOMEPATH%"=="%HOME%" goto userProfilePre +if exist "%HOMEDRIVE%%HOMEPATH%\antrc_pre.bat" call "%HOMEDRIVE%%HOMEPATH%\antrc_pre.bat" + +:userProfilePre +if "%USERPROFILE%"=="" goto alpha +if "%USERPROFILE%"=="%HOME%" goto alpha +if "%USERPROFILE%"=="%HOMEDRIVE%%HOMEPATH%" goto alpha +if exist "%USERPROFILE%\antrc_pre.bat" call "%USERPROFILE%\antrc_pre.bat" + +:alpha + +if "%OS%"=="Windows_NT" @setlocal +if "%OS%"=="WINNT" @setlocal + +if "%ANT_HOME%"=="" goto setDefaultAntHome + +:stripAntHome +if not _%ANT_HOME:~-1%==_\ goto checkClasspath +set ANT_HOME=%ANT_HOME:~0,-1% +goto stripAntHome + +:setDefaultAntHome +rem %~dp0 is expanded pathname of the current script under NT +set ANT_HOME=%~dp0.. + +:checkClasspath +set _USE_CLASSPATH=yes +rem CLASSPATH must not be used if it is equal to "" +if "%CLASSPATH%"=="""" set _USE_CLASSPATH=no +if "%CLASSPATH%"=="" set _USE_CLASSPATH=no + +rem Slurp the command line arguments. This loop allows for an unlimited number +rem of arguments (up to the command line limit, anyway). +set ANT_CMD_LINE_ARGS=%1 +if ""%1""=="""" goto doneStart +shift +:setupArgs +if ""%1""=="""" goto doneStart +if ""%1""==""-noclasspath"" goto clearclasspath +set ANT_CMD_LINE_ARGS=%ANT_CMD_LINE_ARGS% %1 +shift +goto setupArgs + +rem here is there is a -noclasspath in the options +:clearclasspath +set _USE_CLASSPATH=no +shift +goto setupArgs + +rem This label provides a place for the argument list loop to break out +rem and for NT handling to skip to. + +:doneStart + +if _USE_CLASSPATH==no goto findAntHome + +:stripClasspath +if not _%CLASSPATH:~-1%==_\ goto findAntHome +set CLASSPATH=%CLASSPATH:~0,-1% +goto stripClasspath + +:findAntHome +rem find ANT_HOME if it does not exist due to either an invalid value passed +rem by the user or the %0 problem on Windows 9x +if exist "%ANT_HOME%\lib\ant.jar" goto checkJava + +rem check for ant in Program Files +if not exist "%ProgramFiles%\ant" goto checkSystemDrive +set ANT_HOME=%ProgramFiles%\ant +goto checkJava + +:checkSystemDrive +rem check for ant in root directory of system drive +if not exist %SystemDrive%\ant\lib\ant.jar goto checkCDrive +set ANT_HOME=%SystemDrive%\ant +goto checkJava + +:checkCDrive +rem check for ant in C:\ant for Win9X users +if not exist C:\ant\lib\ant.jar goto noAntHome +set ANT_HOME=C:\ant +goto checkJava + +:noAntHome +echo ANT_HOME is set incorrectly or ant could not be located. Please set ANT_HOME. +goto end + +:checkJava +set _JAVACMD=%JAVACMD% + +if "%JAVA_HOME%" == "" goto noJavaHome +if not exist "%JAVA_HOME%\bin\java.exe" goto noJavaHome +if "%_JAVACMD%" == "" set _JAVACMD=%JAVA_HOME%\bin\java.exe +goto checkJikes + +:noJavaHome +if "%_JAVACMD%" == "" set _JAVACMD=java.exe + +:checkJikes +if not "%JIKESPATH%"=="" goto runAntWithJikes + +:runAnt +if "%_USE_CLASSPATH%"=="no" goto runAntNoClasspath +:runAntWithClasspath +"%_JAVACMD%" %ANT_OPTS% -classpath "%ANT_HOME%\lib\ant-launcher.jar" "-Dant.home=%ANT_HOME%" org.apache.tools.ant.launch.Launcher %ANT_ARGS% -cp "%CLASSPATH%" %ANT_CMD_LINE_ARGS% +rem Check the error code of the Ant build +if not "%OS%"=="Windows_NT" goto onError +set ANT_ERROR=%ERRORLEVEL% +goto end + +:runAntNoClasspath +"%_JAVACMD%" %ANT_OPTS% -classpath "%ANT_HOME%\lib\ant-launcher.jar" "-Dant.home=%ANT_HOME%" org.apache.tools.ant.launch.Launcher %ANT_ARGS% %ANT_CMD_LINE_ARGS% +rem Check the error code of the Ant build +if not "%OS%"=="Windows_NT" goto onError +set ANT_ERROR=%ERRORLEVEL% +goto end + +:runAntWithJikes + +if not _%JIKESPATH:~-1%==_\ goto checkJikesAndClasspath +set JIKESPATH=%JIKESPATH:~0,-1% +goto runAntWithJikes + +:checkJikesAndClasspath + +if "%_USE_CLASSPATH%"=="no" goto runAntWithJikesNoClasspath + +:runAntWithJikesAndClasspath +"%_JAVACMD%" %ANT_OPTS% -classpath "%ANT_HOME%\lib\ant-launcher.jar" "-Dant.home=%ANT_HOME%" "-Djikes.class.path=%JIKESPATH%" org.apache.tools.ant.launch.Launcher %ANT_ARGS% -cp "%CLASSPATH%" %ANT_CMD_LINE_ARGS% +rem Check the error code of the Ant build +if not "%OS%"=="Windows_NT" goto onError +set ANT_ERROR=%ERRORLEVEL% +goto end + +:runAntWithJikesNoClasspath +"%_JAVACMD%" %ANT_OPTS% -classpath "%ANT_HOME%\lib\ant-launcher.jar" "-Dant.home=%ANT_HOME%" "-Djikes.class.path=%JIKESPATH%" org.apache.tools.ant.launch.Launcher %ANT_ARGS% %ANT_CMD_LINE_ARGS% +rem Check the error code of the Ant build +if not "%OS%"=="Windows_NT" goto onError +set ANT_ERROR=%ERRORLEVEL% +goto end + +:onError +rem Windows 9x way of checking the error code. It matches via brute force. +for %%i in (1 10 100) do set err%%i= +for %%i in (0 1 2) do if errorlevel %%i00 set err100=%%i +if %err100%==2 goto onError200 +if %err100%==0 set err100= +for %%i in (0 1 2 3 4 5 6 7 8 9) do if errorlevel %err100%%%i0 set err10=%%i +if "%err100%"=="" if %err10%==0 set err10= +:onError1 +for %%i in (0 1 2 3 4 5 6 7 8 9) do if errorlevel %err100%%err10%%%i set err1=%%i +goto onErrorEnd +:onError200 +for %%i in (0 1 2 3 4 5) do if errorlevel 2%%i0 set err10=%%i +if err10==5 for %%i in (0 1 2 3 4 5) do if errorlevel 25%%i set err1=%%i +if not err10==5 goto onError1 +:onErrorEnd +set ANT_ERROR=%err100%%err10%%err1% +for %%i in (1 10 100) do set err%%i= + +:end +rem bug ID 32069: resetting an undefined env variable changes the errorlevel. +if not "%_JAVACMD%"=="" set _JAVACMD= +if not "%_ANT_CMD_LINE_ARGS%"=="" set ANT_CMD_LINE_ARGS= + +if "%ANT_ERROR%"=="0" goto mainEnd + +rem Set the return code if we are not in NT. We can only set +rem a value of 1, but it's better than nothing. +if not "%OS%"=="Windows_NT" echo 1 > nul | choice /n /c:1 + +rem Set the ERRORLEVEL if we are running NT. +if "%OS%"=="Windows_NT" color 00 + +goto omega + +:mainEnd + +rem If there were no errors, we run the post script. +if "%OS%"=="Windows_NT" @endlocal +if "%OS%"=="WINNT" @endlocal + +if "%HOME%"=="" goto homeDrivePathPost +if exist "%HOME%\antrc_post.bat" call "%HOME%\antrc_post.bat" + +:homeDrivePathPost +if "%HOMEDRIVE%%HOMEPATH%"=="" goto userProfilePost +if "%HOMEDRIVE%%HOMEPATH%"=="%HOME%" goto userProfilePost +if exist "%HOMEDRIVE%%HOMEPATH%\antrc_post.bat" call "%HOMEDRIVE%%HOMEPATH%\antrc_post.bat" + +:userProfilePost +if "%USERPROFILE%"=="" goto omega +if "%USERPROFILE%"=="%HOME%" goto omega +if "%USERPROFILE%"=="%HOMEDRIVE%%HOMEPATH%" goto omega +if exist "%USERPROFILE%\antrc_post.bat" call "%USERPROFILE%\antrc_post.bat" + +:omega + diff --git a/legacy/runtime/org.argeo.slc.support.hibernate/src/main/java/org/argeo/slc/hibernate/process/SlcExecutionDaoHibernate.java b/legacy/runtime/org.argeo.slc.support.hibernate/src/main/java/org/argeo/slc/hibernate/process/SlcExecutionDaoHibernate.java new file mode 100644 index 000000000..f581f9261 --- /dev/null +++ b/legacy/runtime/org.argeo.slc.support.hibernate/src/main/java/org/argeo/slc/hibernate/process/SlcExecutionDaoHibernate.java @@ -0,0 +1,130 @@ +/* + * Copyright (C) 2007-2012 Mathieu Baudier + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.argeo.slc.hibernate.process; + +import java.sql.SQLException; +import java.util.List; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.argeo.slc.SlcException; +import org.argeo.slc.dao.process.SlcExecutionDao; +import org.argeo.slc.process.SlcExecution; +import org.argeo.slc.process.SlcExecutionStep; +import org.hibernate.HibernateException; +import org.hibernate.Session; +import org.springframework.orm.hibernate3.HibernateCallback; +import org.springframework.orm.hibernate3.support.HibernateDaoSupport; + +public class SlcExecutionDaoHibernate extends HibernateDaoSupport implements + SlcExecutionDao { + private final static Log log = LogFactory + .getLog(SlcExecutionDaoHibernate.class); + + public void create(SlcExecution slcExecution) { + getHibernateTemplate().save(slcExecution); + } + + public void update(final SlcExecution slcExecution) { + getHibernateTemplate().update(slcExecution); + } + + public void merge(final SlcExecution slcExecution) { + getHibernateTemplate().merge(slcExecution); + } + + public SlcExecution getSlcExecution(String uuid) { + return (SlcExecution) getHibernateTemplate().get(SlcExecution.class, + uuid); + } + + @SuppressWarnings("unchecked") + public List listSlcExecutions() { + return (List) getHibernateTemplate().loadAll( + SlcExecution.class); + } + + public void addSteps(final String slcExecutionId, + final List additionalSteps) { + getHibernateTemplate().execute(new HibernateCallback() { + + public Object doInHibernate(Session session) + throws HibernateException, SQLException { + SlcExecution slcExecution = getSlcExecution(session, + slcExecutionId); + slcExecution.getSteps().addAll(additionalSteps); + session.update(slcExecution); + return slcExecution; + } + }); + + } + + @SuppressWarnings("unchecked") + public List tailSteps(final String slcExecutionId, + final Integer nbrOfSteps) { + return (List) getHibernateTemplate().execute( + new HibernateCallback() { + + public Object doInHibernate(Session session) + throws HibernateException, SQLException { + SlcExecution slcExecution = getSlcExecution(session, + slcExecutionId); + // TODO: do a query count() instead? + int stepCount = slcExecution.getSteps().size(); + if (stepCount > nbrOfSteps) { + return session.createFilter( + slcExecution.getSteps(), "") + .setFirstResult(stepCount - nbrOfSteps) + .setMaxResults(nbrOfSteps).list(); + } else { + return slcExecution.getSteps(); + } + } + }); + } + + @SuppressWarnings("unchecked") + public List tailSteps(final String slcExecutionId, + final String slcExecutionStepId) { + Object[] values = { slcExecutionStepId, slcExecutionId }; + List indexes = getHibernateTemplate().findByNamedQuery( + SlcExecutionStep.class.getName() + ".stepIndex", values); + + Integer index = indexes.get(0); + if (log.isTraceEnabled()){ + log.trace(indexes.size()); + log.trace("Index " + index + " for step " + slcExecutionStepId + + " in process " + slcExecutionId); + } + Object[] values2 = { slcExecutionId, index }; + return getHibernateTemplate().findByNamedQuery( + SlcExecutionStep.class.getName() + ".stepsAfter", values2); + } + + protected SlcExecution getSlcExecution(Session session, + String slcExecutionId) { + SlcExecution slcExecution = (SlcExecution) session.get( + SlcExecution.class, slcExecutionId); + + if (slcExecution == null) + throw new SlcException("Could not find SLC execution " + + slcExecutionId); + + return slcExecution; + } + +} diff --git a/legacy/runtime/org.argeo.slc.support.hibernate/src/main/java/org/argeo/slc/hibernate/runtime/SlcAgentDescriptorDaoHibernate.java b/legacy/runtime/org.argeo.slc.support.hibernate/src/main/java/org/argeo/slc/hibernate/runtime/SlcAgentDescriptorDaoHibernate.java new file mode 100644 index 000000000..5e090598f --- /dev/null +++ b/legacy/runtime/org.argeo.slc.support.hibernate/src/main/java/org/argeo/slc/hibernate/runtime/SlcAgentDescriptorDaoHibernate.java @@ -0,0 +1,54 @@ +/* + * Copyright (C) 2007-2012 Mathieu Baudier + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.argeo.slc.hibernate.runtime; + +import java.util.List; + +import org.argeo.slc.dao.runtime.SlcAgentDescriptorDao; +import org.argeo.slc.runtime.SlcAgentDescriptor; +import org.springframework.orm.hibernate3.support.HibernateDaoSupport; + +public class SlcAgentDescriptorDaoHibernate extends HibernateDaoSupport + implements SlcAgentDescriptorDao { + + public void create(SlcAgentDescriptor slcAgentDescriptor) { + getHibernateTemplate().save(slcAgentDescriptor); + } + + public void delete(SlcAgentDescriptor slcAgentDescriptor) { + getHibernateTemplate().delete(slcAgentDescriptor); + } + + public void delete(String agentId) { + Object obj = getHibernateTemplate().get(SlcAgentDescriptor.class, + agentId); + if (obj != null) + getHibernateTemplate().delete(obj); + } + + public SlcAgentDescriptor getAgentDescriptor(String agentId) { + + return (SlcAgentDescriptor) getHibernateTemplate().get( + SlcAgentDescriptor.class, agentId); + } + + @SuppressWarnings("unchecked") + public List listSlcAgentDescriptors() { + return (List) getHibernateTemplate().loadAll( + SlcAgentDescriptor.class); + } + +} diff --git a/legacy/runtime/org.argeo.slc.support.hibernate/src/main/java/org/argeo/slc/hibernate/test/TestRunDescriptorDaoHibernate.java b/legacy/runtime/org.argeo.slc.support.hibernate/src/main/java/org/argeo/slc/hibernate/test/TestRunDescriptorDaoHibernate.java new file mode 100644 index 000000000..3ddf0e18e --- /dev/null +++ b/legacy/runtime/org.argeo.slc.support.hibernate/src/main/java/org/argeo/slc/hibernate/test/TestRunDescriptorDaoHibernate.java @@ -0,0 +1,35 @@ +/* + * Copyright (C) 2007-2012 Mathieu Baudier + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.argeo.slc.hibernate.test; + +import org.springframework.orm.hibernate3.support.HibernateDaoSupport; + +import org.argeo.slc.dao.test.TestRunDescriptorDao; +import org.argeo.slc.test.TestRunDescriptor; + +public class TestRunDescriptorDaoHibernate extends HibernateDaoSupport + implements TestRunDescriptorDao { + + public TestRunDescriptor getTestRunDescriptor(String id) { + return (TestRunDescriptor) getHibernateTemplate().get( + TestRunDescriptor.class, id); + } + + public void saveOrUpdate(TestRunDescriptor testRunDescriptor) { + getHibernateTemplate().saveOrUpdate(testRunDescriptor); + } + +} diff --git a/legacy/runtime/org.argeo.slc.support.hibernate/src/main/java/org/argeo/slc/hibernate/test/tree/TreeTestResultCollectionDaoHibernate.java b/legacy/runtime/org.argeo.slc.support.hibernate/src/main/java/org/argeo/slc/hibernate/test/tree/TreeTestResultCollectionDaoHibernate.java new file mode 100644 index 000000000..dc99deecf --- /dev/null +++ b/legacy/runtime/org.argeo.slc.support.hibernate/src/main/java/org/argeo/slc/hibernate/test/tree/TreeTestResultCollectionDaoHibernate.java @@ -0,0 +1,154 @@ +/* + * Copyright (C) 2007-2012 Mathieu Baudier + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.argeo.slc.hibernate.test.tree; + +import java.sql.SQLException; +import java.util.List; +import java.util.Map; +import java.util.SortedSet; +import java.util.TreeSet; + +import org.argeo.slc.SlcException; +import org.argeo.slc.core.test.tree.ResultAttributes; +import org.argeo.slc.core.test.tree.TreeTestResult; +import org.argeo.slc.core.test.tree.TreeTestResultCollection; +import org.argeo.slc.dao.test.tree.TreeTestResultCollectionDao; +import org.hibernate.HibernateException; +import org.hibernate.LockMode; +import org.hibernate.Session; +import org.springframework.orm.hibernate3.HibernateCallback; +import org.springframework.orm.hibernate3.support.HibernateDaoSupport; + +/** Hibernate implementation of collections DAO. */ +public class TreeTestResultCollectionDaoHibernate extends HibernateDaoSupport + implements TreeTestResultCollectionDao { + + public void create(TreeTestResultCollection ttrCollection) { + getHibernateTemplate().save(ttrCollection); + } + + public TreeTestResultCollection getTestResultCollection(String id) { + return (TreeTestResultCollection) getHibernateTemplate().get( + TreeTestResultCollection.class, id); + } + + public void update(TreeTestResultCollection ttrCollection) { + getHibernateTemplate().update(ttrCollection); + } + + public void delete(TreeTestResultCollection ttrCollection) { + getHibernateTemplate().delete(ttrCollection); + } + + @SuppressWarnings("unchecked") + public SortedSet listCollections() { + return new TreeSet(getHibernateTemplate() + .find("from TreeTestResultCollection")); + } + + public void addResultToCollection(final TreeTestResultCollection ttrc, + final String resultUuid) { + getHibernateTemplate().execute(new HibernateCallback() { + public Object doInHibernate(Session session) + throws HibernateException, SQLException { + session.lock(ttrc, LockMode.NONE); + TreeTestResult ttr = (TreeTestResult) session.get( + TreeTestResult.class, resultUuid); + ttrc.getResults().add(ttr); + session.update(ttrc); + return ttrc; + } + }); + } + + public void removeResultFromCollection(final TreeTestResultCollection ttrc, + final String resultUuid) { + getHibernateTemplate().execute(new HibernateCallback() { + public Object doInHibernate(Session session) + throws HibernateException, SQLException { + session.lock(ttrc, LockMode.NONE); + TreeTestResult ttr = (TreeTestResult) session.get( + TreeTestResult.class, resultUuid); + if (ttrc.getResults().remove(ttr)) + session.update(ttrc); + return ttrc; + } + }); + } + + @SuppressWarnings("unchecked") + public List listResultAttributes(String collectionId) { + List list; + if (collectionId == null) + list = getHibernateTemplate().find( + "select new org.argeo.slc.core.test.tree.ResultAttributes(ttr)" + + " from TreeTestResult ttr"); + else + list = getHibernateTemplate() + .find( + "select new org.argeo.slc.core.test.tree.ResultAttributes(ttr) " + + " from TreeTestResult ttr, TreeTestResultCollection ttrc " + + " where ttr in elements(ttrc.results) and ttrc.id=?", + collectionId); + + return list; + } + + @SuppressWarnings("unchecked") + public List listResults(String collectionId, + Map attributes) { + List list; + + if (collectionId == null) { + if (attributes == null || attributes.size() == 0) + list = getHibernateTemplate().find("from TreeTestResult"); + else if (attributes.size() == 1) { + Map.Entry entry = attributes.entrySet() + .iterator().next(); + Object[] args = { entry.getKey(), entry.getValue() }; + list = getHibernateTemplate().find( + "select ttr from TreeTestResult ttr" + + " where attributes[?]=?", args); + } else { + throw new SlcException( + "Multiple attributes filter are currently not supported."); + } + } else { + if (attributes == null || attributes.size() == 0) + list = getHibernateTemplate() + .find( + "select ttr " + + " from TreeTestResult ttr, TreeTestResultCollection ttrc " + + " where ttr in elements(ttrc.results) and ttrc.id=?", + collectionId); + else if (attributes.size() == 1) { + Map.Entry entry = attributes.entrySet() + .iterator().next(); + Object[] args = { collectionId, entry.getKey(), + entry.getValue() }; + list = getHibernateTemplate() + .find( + "select ttr from TreeTestResult ttr, TreeTestResultCollection ttrc " + + " where ttr in elements(ttrc.results) and ttrc.id=?" + + " and attributes[?]=?", args); + } else { + throw new SlcException( + "Multiple attributes filter are currently not supported."); + } + } + return list; + } +} diff --git a/legacy/runtime/org.argeo.slc.support.hibernate/src/main/java/org/argeo/slc/hibernate/test/tree/TreeTestResultDaoHibernate.java b/legacy/runtime/org.argeo.slc.support.hibernate/src/main/java/org/argeo/slc/hibernate/test/tree/TreeTestResultDaoHibernate.java new file mode 100644 index 000000000..c25a156ef --- /dev/null +++ b/legacy/runtime/org.argeo.slc.support.hibernate/src/main/java/org/argeo/slc/hibernate/test/tree/TreeTestResultDaoHibernate.java @@ -0,0 +1,172 @@ +/* + * Copyright (C) 2007-2012 Mathieu Baudier + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.argeo.slc.hibernate.test.tree; + +import java.sql.SQLException; +import java.util.Date; +import java.util.List; +import java.util.Map; +import java.util.SortedMap; + +import org.argeo.slc.SlcException; +import org.argeo.slc.core.attachment.SimpleAttachment; +import org.argeo.slc.core.structure.tree.TreeSPath; +import org.argeo.slc.core.test.SimpleResultPart; +import org.argeo.slc.core.test.tree.PartSubList; +import org.argeo.slc.core.test.tree.TreeTestResult; +import org.argeo.slc.dao.test.tree.TreeTestResultDao; +import org.argeo.slc.structure.StructureElement; +import org.argeo.slc.test.TestResult; +import org.hibernate.HibernateException; +import org.hibernate.Session; +import org.springframework.orm.hibernate3.HibernateCallback; +import org.springframework.orm.hibernate3.support.HibernateDaoSupport; +import org.springframework.util.Assert; + +/** + * The Hibernate implementation for tree-based result of the test result dao. + * + * @see TreeTestResult + */ +public class TreeTestResultDaoHibernate extends HibernateDaoSupport implements + TreeTestResultDao { + + public void create(TestResult testResult) { + getHibernateTemplate().save(testResult); + } + + public void update(TestResult testResult) { + getHibernateTemplate().saveOrUpdate(testResult); + } + + public TreeTestResult getTestResult(String uuid) { + List list = getHibernateTemplate().find( + "from TreeTestResult where uuid=?", uuid); + if (list.size() == 0) { + return null; + } else { + return (TreeTestResult) list.get(0); + } + + } + + @SuppressWarnings("unchecked") + public List listTestResults() { + return (List) getHibernateTemplate().find( + "from TreeTestResult"); + } + + @SuppressWarnings("unchecked") + public List listResults(TreeSPath path) { + List list = getHibernateTemplate().find( + "from TreeTestResult res where ? in indices(res.resultParts)", + path.getAsUniqueString()); + return list; + } + + public void close(final String testResultId, final Date closeDate) { + getHibernateTemplate().execute(new HibernateCallback() { + + public Object doInHibernate(Session session) + throws HibernateException, SQLException { + TreeTestResult treeTestResult = getTreeTestResult(session, + testResultId); + treeTestResult.setCloseDate(closeDate); + session.update(treeTestResult); + return treeTestResult; + } + }); + } + + public void addResultPart(final String testResultId, final TreeSPath path, + final SimpleResultPart resultPart, + final Map relatedElements) { + + getHibernateTemplate().execute(new HibernateCallback() { + + public Object doInHibernate(Session session) + throws HibernateException, SQLException { + TreeTestResult treeTestResult = getTreeTestResult(session, + testResultId); + PartSubList lst = treeTestResult.getResultParts().get(path); + if (lst == null) { + lst = new PartSubList(); + treeTestResult.getResultParts().put(path, lst); + } + lst.getParts().add(resultPart); + if (relatedElements != null) + treeTestResult.getElements().putAll(relatedElements); + + session.update(treeTestResult); + return treeTestResult; + } + }); + + } + + public void addAttachment(final String testResultId, + final SimpleAttachment attachment) { + getHibernateTemplate().execute(new HibernateCallback() { + + public Object doInHibernate(Session session) + throws HibernateException, SQLException { + TreeTestResult treeTestResult = getTreeTestResult(session, + testResultId); + + // Check is there is already such an attachment + Assert.notNull(attachment, "attachment is null"); + Assert.notNull(session, "session is null"); + SimpleAttachment att = (SimpleAttachment) session.get( + attachment.getClass(), attachment.getUuid()); + if (att != null) + throw new SlcException( + "There is already an attachement with id " + + attachment.getUuid()); + + treeTestResult.getAttachments().add(attachment); + session.update(treeTestResult); + return treeTestResult; + } + }); + + } + + protected TreeTestResult getTreeTestResult(Session session, + String testResultId) { + TreeTestResult treeTestResult = (TreeTestResult) session.get( + TreeTestResult.class, testResultId); + if (treeTestResult == null) + throw new SlcException("No result with id " + testResultId); + return treeTestResult; + } + + public void updateAttributes(final String testResultId, + final SortedMap attributes) { + getHibernateTemplate().execute(new HibernateCallback() { + + public Object doInHibernate(Session session) + throws HibernateException, SQLException { + TreeTestResult treeTestResult = getTreeTestResult(session, + testResultId); + treeTestResult.setAttributes(attributes); + + session.update(treeTestResult); + return treeTestResult; + } + }); + } + +} diff --git a/legacy/runtime/org.argeo.slc.support.hibernate/src/main/java/org/argeo/slc/hibernate/test/tree/package.html b/legacy/runtime/org.argeo.slc.support.hibernate/src/main/java/org/argeo/slc/hibernate/test/tree/package.html new file mode 100644 index 000000000..6042b0789 --- /dev/null +++ b/legacy/runtime/org.argeo.slc.support.hibernate/src/main/java/org/argeo/slc/hibernate/test/tree/package.html @@ -0,0 +1,6 @@ + + + +Hibernate based DAO implementations for tree-based SLC Test. + + \ No newline at end of file diff --git a/legacy/runtime/org.argeo.slc.support.hibernate/src/main/resources/org/argeo/slc/hibernate/attachment/SimpleAttachment.hbm.xml b/legacy/runtime/org.argeo.slc.support.hibernate/src/main/resources/org/argeo/slc/hibernate/attachment/SimpleAttachment.hbm.xml new file mode 100644 index 000000000..d35d9ff98 --- /dev/null +++ b/legacy/runtime/org.argeo.slc.support.hibernate/src/main/resources/org/argeo/slc/hibernate/attachment/SimpleAttachment.hbm.xml @@ -0,0 +1,29 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/legacy/runtime/org.argeo.slc.support.hibernate/src/main/resources/org/argeo/slc/hibernate/dao.xml b/legacy/runtime/org.argeo.slc.support.hibernate/src/main/resources/org/argeo/slc/hibernate/dao.xml new file mode 100644 index 000000000..baac4036e --- /dev/null +++ b/legacy/runtime/org.argeo.slc.support.hibernate/src/main/resources/org/argeo/slc/hibernate/dao.xml @@ -0,0 +1,48 @@ + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/legacy/runtime/org.argeo.slc.support.hibernate/src/main/resources/org/argeo/slc/hibernate/ehcache.xml b/legacy/runtime/org.argeo.slc.support.hibernate/src/main/resources/org/argeo/slc/hibernate/ehcache.xml new file mode 100644 index 000000000..b09747786 --- /dev/null +++ b/legacy/runtime/org.argeo.slc.support.hibernate/src/main/resources/org/argeo/slc/hibernate/ehcache.xml @@ -0,0 +1,71 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/legacy/runtime/org.argeo.slc.support.hibernate/src/main/resources/org/argeo/slc/hibernate/process/RealizedFlow.hbm.xml b/legacy/runtime/org.argeo.slc.support.hibernate/src/main/resources/org/argeo/slc/hibernate/process/RealizedFlow.hbm.xml new file mode 100644 index 000000000..c56231d83 --- /dev/null +++ b/legacy/runtime/org.argeo.slc.support.hibernate/src/main/resources/org/argeo/slc/hibernate/process/RealizedFlow.hbm.xml @@ -0,0 +1,31 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/legacy/runtime/org.argeo.slc.support.hibernate/src/main/resources/org/argeo/slc/hibernate/process/SlcExecution.hbm.xml b/legacy/runtime/org.argeo.slc.support.hibernate/src/main/resources/org/argeo/slc/hibernate/process/SlcExecution.hbm.xml new file mode 100644 index 000000000..526d6bf0c --- /dev/null +++ b/legacy/runtime/org.argeo.slc.support.hibernate/src/main/resources/org/argeo/slc/hibernate/process/SlcExecution.hbm.xml @@ -0,0 +1,51 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/legacy/runtime/org.argeo.slc.support.hibernate/src/main/resources/org/argeo/slc/hibernate/process/SlcExecutionStep.hbm.xml b/legacy/runtime/org.argeo.slc.support.hibernate/src/main/resources/org/argeo/slc/hibernate/process/SlcExecutionStep.hbm.xml new file mode 100644 index 000000000..0a1ce76dc --- /dev/null +++ b/legacy/runtime/org.argeo.slc.support.hibernate/src/main/resources/org/argeo/slc/hibernate/process/SlcExecutionStep.hbm.xml @@ -0,0 +1,54 @@ + + + + + + + + + + + + + + + + + + + + + ? + ]]> + + \ No newline at end of file diff --git a/legacy/runtime/org.argeo.slc.support.hibernate/src/main/resources/org/argeo/slc/hibernate/runtime/SlcAgentDescriptor.hbm.xml b/legacy/runtime/org.argeo.slc.support.hibernate/src/main/resources/org/argeo/slc/hibernate/runtime/SlcAgentDescriptor.hbm.xml new file mode 100644 index 000000000..90ada75f3 --- /dev/null +++ b/legacy/runtime/org.argeo.slc.support.hibernate/src/main/resources/org/argeo/slc/hibernate/runtime/SlcAgentDescriptor.hbm.xml @@ -0,0 +1,39 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/legacy/runtime/org.argeo.slc.support.hibernate/src/main/resources/org/argeo/slc/hibernate/sessionFactories.xml b/legacy/runtime/org.argeo.slc.support.hibernate/src/main/resources/org/argeo/slc/hibernate/sessionFactories.xml new file mode 100644 index 000000000..48544ecb9 --- /dev/null +++ b/legacy/runtime/org.argeo.slc.support.hibernate/src/main/resources/org/argeo/slc/hibernate/sessionFactories.xml @@ -0,0 +1,74 @@ + + + + + + + + + org/argeo/slc/hibernate/structure/SimpleSElement.hbm.xml + + + org/argeo/slc/hibernate/test/SimpleResultPart.hbm.xml + + + org/argeo/slc/hibernate/test/tree/TreeTestResult.hbm.xml + + + org/argeo/slc/hibernate/test/tree/TreeTestResultCollection.hbm.xml + + + org/argeo/slc/hibernate/test/tree/PartSubList.hbm.xml + + + org/argeo/slc/hibernate/test/TestRunDescriptor.hbm.xml + + + org/argeo/slc/hibernate/process/SlcExecution.hbm.xml + + + org/argeo/slc/hibernate/process/SlcExecutionStep.hbm.xml + + + org/argeo/slc/hibernate/runtime/SlcAgentDescriptor.hbm.xml + + + org/argeo/slc/hibernate/attachment/SimpleAttachment.hbm.xml + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/legacy/runtime/org.argeo.slc.support.hibernate/src/main/resources/org/argeo/slc/hibernate/spring.xml b/legacy/runtime/org.argeo.slc.support.hibernate/src/main/resources/org/argeo/slc/hibernate/spring.xml new file mode 100644 index 000000000..240aa921a --- /dev/null +++ b/legacy/runtime/org.argeo.slc.support.hibernate/src/main/resources/org/argeo/slc/hibernate/spring.xml @@ -0,0 +1,26 @@ + + + + + + + \ No newline at end of file diff --git a/legacy/runtime/org.argeo.slc.support.hibernate/src/main/resources/org/argeo/slc/hibernate/structure/SimpleSElement.hbm.xml b/legacy/runtime/org.argeo.slc.support.hibernate/src/main/resources/org/argeo/slc/hibernate/structure/SimpleSElement.hbm.xml new file mode 100644 index 000000000..2244d49c6 --- /dev/null +++ b/legacy/runtime/org.argeo.slc.support.hibernate/src/main/resources/org/argeo/slc/hibernate/structure/SimpleSElement.hbm.xml @@ -0,0 +1,37 @@ + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/legacy/runtime/org.argeo.slc.support.hibernate/src/main/resources/org/argeo/slc/hibernate/test/SimpleResultPart.hbm.xml b/legacy/runtime/org.argeo.slc.support.hibernate/src/main/resources/org/argeo/slc/hibernate/test/SimpleResultPart.hbm.xml new file mode 100644 index 000000000..b84cfd679 --- /dev/null +++ b/legacy/runtime/org.argeo.slc.support.hibernate/src/main/resources/org/argeo/slc/hibernate/test/SimpleResultPart.hbm.xml @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/legacy/runtime/org.argeo.slc.support.hibernate/src/main/resources/org/argeo/slc/hibernate/test/TestRunDescriptor.hbm.xml b/legacy/runtime/org.argeo.slc.support.hibernate/src/main/resources/org/argeo/slc/hibernate/test/TestRunDescriptor.hbm.xml new file mode 100644 index 000000000..a0ba08c9b --- /dev/null +++ b/legacy/runtime/org.argeo.slc.support.hibernate/src/main/resources/org/argeo/slc/hibernate/test/TestRunDescriptor.hbm.xml @@ -0,0 +1,35 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/legacy/runtime/org.argeo.slc.support.hibernate/src/main/resources/org/argeo/slc/hibernate/test/tree/PartSubList.hbm.xml b/legacy/runtime/org.argeo.slc.support.hibernate/src/main/resources/org/argeo/slc/hibernate/test/tree/PartSubList.hbm.xml new file mode 100644 index 000000000..08fc99203 --- /dev/null +++ b/legacy/runtime/org.argeo.slc.support.hibernate/src/main/resources/org/argeo/slc/hibernate/test/tree/PartSubList.hbm.xml @@ -0,0 +1,37 @@ + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/legacy/runtime/org.argeo.slc.support.hibernate/src/main/resources/org/argeo/slc/hibernate/test/tree/TreeTestResult.hbm.xml b/legacy/runtime/org.argeo.slc.support.hibernate/src/main/resources/org/argeo/slc/hibernate/test/tree/TreeTestResult.hbm.xml new file mode 100644 index 000000000..6144656e7 --- /dev/null +++ b/legacy/runtime/org.argeo.slc.support.hibernate/src/main/resources/org/argeo/slc/hibernate/test/tree/TreeTestResult.hbm.xml @@ -0,0 +1,68 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/legacy/runtime/org.argeo.slc.support.hibernate/src/main/resources/org/argeo/slc/hibernate/test/tree/TreeTestResultCollection.hbm.xml b/legacy/runtime/org.argeo.slc.support.hibernate/src/main/resources/org/argeo/slc/hibernate/test/tree/TreeTestResultCollection.hbm.xml new file mode 100644 index 000000000..7988d2bd9 --- /dev/null +++ b/legacy/runtime/org.argeo.slc.support.hibernate/src/main/resources/org/argeo/slc/hibernate/test/tree/TreeTestResultCollection.hbm.xml @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/legacy/runtime/org.argeo.slc.support.hibernate/src/site/apt/index.apt b/legacy/runtime/org.argeo.slc.support.hibernate/src/site/apt/index.apt new file mode 100644 index 000000000..f414460db --- /dev/null +++ b/legacy/runtime/org.argeo.slc.support.hibernate/src/site/apt/index.apt @@ -0,0 +1 @@ +Argeo SLC Site \ No newline at end of file diff --git a/legacy/runtime/org.argeo.slc.support.hibernate/src/test/java/org/argeo/slc/hibernate/process/CastorSlcExecutionHibernateTest.java b/legacy/runtime/org.argeo.slc.support.hibernate/src/test/java/org/argeo/slc/hibernate/process/CastorSlcExecutionHibernateTest.java new file mode 100644 index 000000000..d2698c2ed --- /dev/null +++ b/legacy/runtime/org.argeo.slc.support.hibernate/src/test/java/org/argeo/slc/hibernate/process/CastorSlcExecutionHibernateTest.java @@ -0,0 +1,76 @@ +/* + * Copyright (C) 2007-2012 Mathieu Baudier + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.argeo.slc.hibernate.process; + +import java.sql.SQLException; + +import org.argeo.slc.dao.process.SlcExecutionDao; +import org.argeo.slc.hibernate.unit.HibernateTestCase; +import org.argeo.slc.msg.ObjectList; +import org.argeo.slc.process.SlcExecution; +import org.argeo.slc.unit.process.SlcExecutionTestUtils; +import org.hibernate.HibernateException; +import org.hibernate.Session; +import org.springframework.orm.hibernate3.HibernateCallback; +import org.springframework.oxm.Marshaller; +import org.springframework.oxm.Unmarshaller; +import org.springframework.xml.transform.StringResult; +import org.springframework.xml.transform.StringSource; + +public class CastorSlcExecutionHibernateTest extends HibernateTestCase { + + public void testSaveWithRealizedFlowsXml() throws Exception { + SlcExecutionDao dao = getBean(SlcExecutionDao.class); + + SlcExecution slcExec = SlcExecutionTestUtils + .createSlcExecutionWithRealizedFlows(); + + ObjectList ol = new ObjectList(slcExec.getRealizedFlows()); + StringResult result = new StringResult(); + getBean(Marshaller.class).marshal(ol, result); + slcExec.setRealizedFlowsXml(result.toString()); + + dao.create(slcExec); + + SlcExecution slcExecPersisted = dao.getSlcExecution(slcExec.getUuid()); + assertSlcExecution(slcExec, slcExecPersisted); + + StringSource source = new StringSource(slcExecPersisted + .getRealizedFlowsXml()); + ObjectList ol2 = (ObjectList) getBean(Unmarshaller.class).unmarshal( + source); + ol2.fill(slcExec.getRealizedFlows()); + + } + + public void assertSlcExecution(final SlcExecution expected, + final SlcExecution persisted) { + getHibernateTemplate().execute(new HibernateCallback() { + + public Object doInHibernate(Session session) + throws HibernateException, SQLException { + session.refresh(persisted); + SlcExecutionTestUtils.assertSlcExecution(expected, persisted); + return null; + } + }); + } + + @Override + protected String getApplicationContextLocation() { + return "org/argeo/slc/hibernate/withCastor.xml"; + } +} diff --git a/legacy/runtime/org.argeo.slc.support.hibernate/src/test/java/org/argeo/slc/hibernate/process/SlcExecutionHibernateTest.java b/legacy/runtime/org.argeo.slc.support.hibernate/src/test/java/org/argeo/slc/hibernate/process/SlcExecutionHibernateTest.java new file mode 100644 index 000000000..b4798ce60 --- /dev/null +++ b/legacy/runtime/org.argeo.slc.support.hibernate/src/test/java/org/argeo/slc/hibernate/process/SlcExecutionHibernateTest.java @@ -0,0 +1,133 @@ +/* + * Copyright (C) 2007-2012 Mathieu Baudier + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.argeo.slc.hibernate.process; + +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.List; + +import org.argeo.slc.dao.process.SlcExecutionDao; +import org.argeo.slc.hibernate.unit.HibernateTestCase; +import org.argeo.slc.process.SlcExecution; +import org.argeo.slc.process.SlcExecutionStep; +import org.argeo.slc.unit.process.SlcExecutionTestUtils; +import org.hibernate.HibernateException; +import org.hibernate.Session; +import org.springframework.orm.hibernate3.HibernateCallback; + +public class SlcExecutionHibernateTest extends HibernateTestCase { + + public void testSave() { + SlcExecutionDao dao = getBean(SlcExecutionDao.class); + + SlcExecution slcExec = SlcExecutionTestUtils.createSimpleSlcExecution(); + slcExec.getSteps().add(new SlcExecutionStep("A log line")); + slcExec.getSteps().add(new SlcExecutionStep("Two log\nlines")); + + dao.create(slcExec); + + SlcExecution slcExecPersisted = dao.getSlcExecution(slcExec.getUuid()); + assertSlcExecution(slcExec, slcExecPersisted); + } + + public void testTailSteps() { + SlcExecutionDao dao = getBean(SlcExecutionDao.class); + + SlcExecution slcExec = SlcExecutionTestUtils.createSimpleSlcExecution(); + int totalStepCount = 20; + for (int i = 0; i < totalStepCount; i++) { + slcExec.getSteps().add(new SlcExecutionStep("Log " + i)); + } + dao.create(slcExec); + + int lastStepsCount = 7; + List firstSteps = dao.tailSteps(slcExec.getUuid(), + lastStepsCount); + assertEquals(lastStepsCount, firstSteps.size()); + + SlcExecutionStep lastStep = firstSteps.get(lastStepsCount - 1); + + List additionalSteps = new ArrayList(); + int additionalStepsCount = 13; + for (int i = 0; i < additionalStepsCount; i++) { + additionalSteps.add(new SlcExecutionStep("Additonal log " + i)); + } + dao.addSteps(slcExec.getUuid(), additionalSteps); + + List lastSteps = dao.tailSteps(slcExec.getUuid(), + lastStep.getUuid()); + assertEquals(additionalStepsCount, lastSteps.size()); + } + + public void testModify() { + SlcExecutionDao dao = getBean(SlcExecutionDao.class); + + // slcExecution Creation + SlcExecution slcExec = SlcExecutionTestUtils.createSimpleSlcExecution(); + slcExec.getSteps().add(new SlcExecutionStep("A log line")); + slcExec.getSteps().add(new SlcExecutionStep("Two log\nlines")); + + dao.create(slcExec); + + // slcExecution retrieval and update + final SlcExecution slcExecRetrieved = dao.getSlcExecution(slcExec + .getUuid()); + + getHibernateTemplate().execute(new HibernateCallback() { + + public Object doInHibernate(Session session) + throws HibernateException, SQLException { + session.refresh(slcExecRetrieved); + List logLineListStep0 = slcExecRetrieved.getSteps() + .get(0).getLogLines(); + for (String logLine : logLineListStep0) + logLine = logLine + "appended Log text"; + + slcExecRetrieved.getSteps().get(0) + .setLogLines(logLineListStep0); + slcExecRetrieved.getSteps().add( + new SlcExecutionStep("Three \n log \n lines")); + return null; + } + }); + + dao.update(slcExecRetrieved); + + // updated slcExecution retrieval and comparison + SlcExecution slcExecUpdated = dao.getSlcExecution(slcExec.getUuid()); + + assertSlcExecution(slcExecRetrieved, slcExecUpdated); + } + + public void assertSlcExecution(final SlcExecution expected, + final SlcExecution persisted) { + getHibernateTemplate().execute(new HibernateCallback() { + + public Object doInHibernate(Session session) + throws HibernateException, SQLException { + session.refresh(persisted); + SlcExecutionTestUtils.assertSlcExecution(expected, persisted); + return null; + } + }); + } + + @Override + protected String getApplicationContextLocation() { + return "org/argeo/slc/hibernate/applicationContext.xml"; + } + +} diff --git a/legacy/runtime/org.argeo.slc.support.hibernate/src/test/java/org/argeo/slc/hibernate/test/tree/CastorTestResultDaoHibernateTest.java b/legacy/runtime/org.argeo.slc.support.hibernate/src/test/java/org/argeo/slc/hibernate/test/tree/CastorTestResultDaoHibernateTest.java new file mode 100644 index 000000000..c922809b7 --- /dev/null +++ b/legacy/runtime/org.argeo.slc.support.hibernate/src/test/java/org/argeo/slc/hibernate/test/tree/CastorTestResultDaoHibernateTest.java @@ -0,0 +1,58 @@ +/* + * Copyright (C) 2007-2012 Mathieu Baudier + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.argeo.slc.hibernate.test.tree; + +import org.argeo.slc.core.structure.tree.TreeSPath; +import org.argeo.slc.core.test.tree.TreeTestResult; +import org.argeo.slc.dao.test.tree.TreeTestResultDao; +import org.argeo.slc.hibernate.unit.HibernateTestCase; +import org.argeo.slc.unit.test.tree.TreeTestResultTestUtils; +import org.springframework.oxm.Marshaller; +import org.springframework.oxm.Unmarshaller; +import org.springframework.xml.transform.StringResult; +import org.springframework.xml.transform.StringSource; + +public class CastorTestResultDaoHibernateTest extends HibernateTestCase { + + public void testUnmarshallAndCreate() throws Exception { + TreeTestResult ttr = TreeTestResultTestUtils + .createCompleteTreeTestResult(); + + StringResult result = new StringResult(); + getBean(Marshaller.class).marshal(ttr, result); + + StringSource source = new StringSource(result.toString()); + TreeTestResult ttrUnm = (TreeTestResult) getBean(Unmarshaller.class) + .unmarshal(source); + + for (TreeSPath path : ttrUnm.getResultParts().keySet()) { + log.debug("Path: " + path.getClass() + ": " + path); + } + + TreeTestResultDao ttrDao = getBean(TreeTestResultDao.class); + ttrDao.create(ttrUnm); + TreeTestResult ttrPersist = ttrDao.getTestResult(ttr.getUuid()); + + TreeTestResultDaoHibernateTest.assertInHibernate( + getHibernateTemplate(), ttr, ttrPersist); + } + + @Override + protected String getApplicationContextLocation() { + return "org/argeo/slc/hibernate/withCastor.xml"; + } + +} diff --git a/legacy/runtime/org.argeo.slc.support.hibernate/src/test/java/org/argeo/slc/hibernate/test/tree/TreeTestResultCollectionDaoHibernateTest.java b/legacy/runtime/org.argeo.slc.support.hibernate/src/test/java/org/argeo/slc/hibernate/test/tree/TreeTestResultCollectionDaoHibernateTest.java new file mode 100644 index 000000000..de9aa1685 --- /dev/null +++ b/legacy/runtime/org.argeo.slc.support.hibernate/src/test/java/org/argeo/slc/hibernate/test/tree/TreeTestResultCollectionDaoHibernateTest.java @@ -0,0 +1,122 @@ +/* + * Copyright (C) 2007-2012 Mathieu Baudier + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.argeo.slc.hibernate.test.tree; + +import java.sql.SQLException; +import java.util.Date; + +import org.argeo.slc.core.test.tree.TreeTestResult; +import org.argeo.slc.core.test.tree.TreeTestResultCollection; +import org.argeo.slc.dao.test.tree.TreeTestResultCollectionDao; +import org.argeo.slc.dao.test.tree.TreeTestResultDao; +import org.argeo.slc.hibernate.unit.HibernateTestCase; +import org.argeo.slc.unit.test.tree.TreeTestResultTestUtils; +import org.argeo.slc.unit.test.tree.UnitTestTreeUtil; +import org.hibernate.HibernateException; +import org.hibernate.Session; +import org.springframework.orm.hibernate3.HibernateCallback; + +public class TreeTestResultCollectionDaoHibernateTest extends HibernateTestCase { + + public void testScenario() { + TreeTestResultDao ttrDao = getBean(TreeTestResultDao.class); + TreeTestResultCollectionDao ttrcDao = getBean(TreeTestResultCollectionDao.class); + + String ttrcName = "testCollection"; + + TreeTestResult ttr1 = TreeTestResultTestUtils + .createCompleteTreeTestResult(); + ttrDao.create(ttr1); + + TreeTestResultCollection ttrc = new TreeTestResultCollection(ttrcName); + ttrcDao.create(ttrc); + + ttrc.getResults().add(ttr1); + ttrcDao.update(ttrc); + + final TreeTestResult ttr2 = TreeTestResultTestUtils + .createCompleteTreeTestResult(); + ttrDao.create(ttr2); + + ttrc.getResults().add(ttr2); + ttrcDao.update(ttrc); + + ttrc.getResults().remove(ttr1); + ttrcDao.update(ttrc); + + final TreeTestResultCollection ttrcPersist = ttrcDao + .getTestResultCollection(ttrcName); + + // Because of lazy initialization + getHibernateTemplate().execute(new HibernateCallback() { + + public Object doInHibernate(Session session) + throws HibernateException, SQLException { + session.refresh(ttrcPersist); + assertEquals(1, ttrcPersist.getResults().size()); + UnitTestTreeUtil.assertTreeTestResult(ttr2, ttrcPersist + .getResults().iterator().next()); + return null; + } + }); + } + + public void testResultsWithSameCloseDate() { + TreeTestResultDao ttrDao = getBean(TreeTestResultDao.class); + TreeTestResultCollectionDao ttrcDao = getBean(TreeTestResultCollectionDao.class); + + String ttrcName = "testCollection"; + + Date closeDate = new Date(); + + // TTR1 + TreeTestResult ttr1 = TreeTestResultTestUtils + .createCompleteTreeTestResult(); + ttr1.setCloseDate(closeDate); + ttrDao.create(ttr1); + + // TTR2 + TreeTestResult ttr2 = TreeTestResultTestUtils + .createCompleteTreeTestResult(); + ttr2.setCloseDate(closeDate); + ttrDao.create(ttr2); + + // TTRC + TreeTestResultCollection ttrc = new TreeTestResultCollection(ttrcName); + ttrc.getResults().add(ttr1); + ttrc.getResults().add(ttr2); + ttrcDao.create(ttrc); + + final TreeTestResultCollection ttrcPersist = ttrcDao + .getTestResultCollection(ttrcName); + // Because of lazy initialization + getHibernateTemplate().execute(new HibernateCallback() { + + public Object doInHibernate(Session session) + throws HibernateException, SQLException { + session.refresh(ttrcPersist); + assertEquals(2, ttrcPersist.getResults().size()); + return null; + } + }); + } + + @Override + protected String getApplicationContextLocation() { + return "org/argeo/slc/hibernate/applicationContext.xml"; + } + +} diff --git a/legacy/runtime/org.argeo.slc.support.hibernate/src/test/java/org/argeo/slc/hibernate/test/tree/TreeTestResultDaoHibernateTest.java b/legacy/runtime/org.argeo.slc.support.hibernate/src/test/java/org/argeo/slc/hibernate/test/tree/TreeTestResultDaoHibernateTest.java new file mode 100644 index 000000000..4c5baa6fa --- /dev/null +++ b/legacy/runtime/org.argeo.slc.support.hibernate/src/test/java/org/argeo/slc/hibernate/test/tree/TreeTestResultDaoHibernateTest.java @@ -0,0 +1,175 @@ +/* + * Copyright (C) 2007-2012 Mathieu Baudier + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.argeo.slc.hibernate.test.tree; + +import java.sql.SQLException; + +import org.argeo.slc.core.structure.SimpleSElement; +import org.argeo.slc.core.structure.tree.TreeSPath; +import org.argeo.slc.core.structure.tree.TreeSRegistry; +import org.argeo.slc.core.test.SimpleResultPart; +import org.argeo.slc.core.test.tree.TreeTestResult; +import org.argeo.slc.dao.test.tree.TreeTestResultDao; +import org.argeo.slc.hibernate.unit.HibernateTestCase; +import org.argeo.slc.test.TestStatus; +import org.argeo.slc.unit.test.tree.TreeTestResultTestUtils; +import org.argeo.slc.unit.test.tree.UnitTestTreeUtil; +import org.hibernate.HibernateException; +import org.hibernate.Session; +import org.springframework.orm.hibernate3.HibernateCallback; +import org.springframework.orm.hibernate3.HibernateTemplate; + +public class TreeTestResultDaoHibernateTest extends HibernateTestCase { + private TreeTestResultDao testResultDao = null; + + @Override + public void setUp() { + testResultDao = getBean(TreeTestResultDao.class); + } + + public void testCreate() { + + TreeTestResult ttr = TreeTestResultTestUtils + .createCompleteTreeTestResult(); + testResultDao.create(ttr); + + TreeTestResult ttrPersisted = (TreeTestResult) testResultDao + .getTestResult(ttr.getUuid()); + + assertInHibernate(ttr, ttrPersisted); + } + + public void testUpdate() { + TreeTestResult ttr = TreeTestResultTestUtils + .createCompleteTreeTestResult(); + testResultDao.create(ttr); + + final TreeTestResult ttrUpdated = (TreeTestResult) testResultDao + .getTestResult(ttr.getUuid()); + + // Modifying ttrUpdated + + /** + * this closeDate update commented because the assertTreeTestResult will + * find a unexpected discrepancy in the date. + * ttrUpdated.setCloseDate(new Date()); + */ + + String pathStr = "/test"; + final TreeSPath path = new TreeSPath(pathStr); + + final TreeSRegistry registry = new TreeSRegistry(); + SimpleSElement elem = new SimpleSElement("Unit Test"); + elem.getTags().put("myTag", "myTagValue"); + registry.register(path, elem); + + getHibernateTemplate().execute(new HibernateCallback() { + + public Object doInHibernate(Session session) + throws HibernateException, SQLException { + session.refresh(ttrUpdated); + ttrUpdated.notifyCurrentPath(registry, path); + + ttrUpdated.addResultPart(TreeTestResultTestUtils + .createSimpleResultPartPassed()); + ttrUpdated.addResultPart(TreeTestResultTestUtils + .createSimpleResultPartFailed()); + ttrUpdated.addResultPart(TreeTestResultTestUtils + .createSimpleResultPartError()); + return null; + } + }); + + testResultDao.update(ttrUpdated); + + // comparison of ttrUpdated and ttrRetrieved + TreeTestResult ttrRetrieved = (TreeTestResult) testResultDao + .getTestResult(ttr.getUuid()); + + assertInHibernate(ttrUpdated, ttrRetrieved); + } + + public void testMultipleUpdateScenario() throws Exception { + TreeSRegistry registry = new TreeSRegistry(); + + TreeSPath path = new TreeSPath("/root/test"); + SimpleSElement elem = new SimpleSElement("Unit Test"); + elem.getTags().put("myTag", "myTagValue"); + registry.register(path, elem); + + TreeTestResult ttr = TreeTestResultTestUtils + .createSimpleTreeTestResult(); + ttr.notifyCurrentPath(registry, path); + ttr + .addResultPart(new SimpleResultPart(TestStatus.PASSED, + "First test")); + + testResultDao.create(ttr); + + path = new TreeSPath("/root/test2/subtest"); + elem = new SimpleSElement("Sub Test"); + elem.getTags().put("myTag", "myTagValue"); + registry.register(path, elem); + + ttr.notifyCurrentPath(registry, path); + ttr + .addResultPart(new SimpleResultPart(TestStatus.PASSED, + "Second test")); + + testResultDao.update(ttr); + + ttr.notifyCurrentPath(registry, path); + ttr.addResultPart(new SimpleResultPart(TestStatus.PASSED, + "Third test with same path")); + + testResultDao.update(ttr); + + ttr.close(); + + testResultDao.close(ttr.getUuid(), ttr.getCloseDate()); + + TreeTestResult ttrRetrieved = (TreeTestResult) testResultDao + .getTestResult(ttr.getUuid()); + + assertInHibernate(ttr, ttrRetrieved); + + } + + @Override + protected String getApplicationContextLocation() { + return "org/argeo/slc/hibernate/applicationContext.xml"; + } + + public static void assertInHibernate(HibernateTemplate template, + final TreeTestResult ttrExpected, final TreeTestResult ttrPersisted) { + template.execute(new HibernateCallback() { + public Object doInHibernate(Session session) { + session.refresh(ttrPersisted); + UnitTestTreeUtil + .assertTreeTestResult(ttrExpected, ttrPersisted); + return null; + } + + }); + + } + + public void assertInHibernate(final TreeTestResult ttrExpected, + final TreeTestResult ttrPersisted) { + assertInHibernate(getHibernateTemplate(), ttrExpected, ttrPersisted); + } + +} diff --git a/legacy/runtime/org.argeo.slc.support.hibernate/src/test/resources/log4j.properties b/legacy/runtime/org.argeo.slc.support.hibernate/src/test/resources/log4j.properties new file mode 100644 index 000000000..4a97ea611 --- /dev/null +++ b/legacy/runtime/org.argeo.slc.support.hibernate/src/test/resources/log4j.properties @@ -0,0 +1,28 @@ +# Set root logger level to DEBUG and its only appender to A1. +log4j.rootLogger=WARN, console + +## Levels +# Slc +log4j.logger.org.argeo=DEBUG +log4j.logger.org.argeo.slc.hibernate.process=TRACE + +# Castor +log4j.logger.org.exolab.castor=WARN + +# Spring +#log4j.logger.org.springframework=INFO +# Hibernate +log4j.logger.org.hibernate=WARN +#log4j.logger.org.hibernate.SQL=TRACE +#log4j.logger.org.hibernate.tool.hbm2ddl=TRACE +#log4j.logger.org.hibernate.type=TRACE + + +## Appenders +# A1 is set to be a ConsoleAppender. +log4j.appender.console=org.apache.log4j.ConsoleAppender + +# A1 uses PatternLayout. +log4j.appender.console.layout=org.apache.log4j.PatternLayout +log4j.appender.console.layout.ConversionPattern= %-5p %d{ISO8601} %m - %c%n + diff --git a/legacy/runtime/org.argeo.slc.support.hibernate/src/test/resources/org/argeo/slc/hibernate/applicationContext.xml b/legacy/runtime/org.argeo.slc.support.hibernate/src/test/resources/org/argeo/slc/hibernate/applicationContext.xml new file mode 100644 index 000000000..739eb09bb --- /dev/null +++ b/legacy/runtime/org.argeo.slc.support.hibernate/src/test/resources/org/argeo/slc/hibernate/applicationContext.xml @@ -0,0 +1,74 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/legacy/runtime/org.argeo.slc.support.hibernate/src/test/resources/org/argeo/slc/hibernate/withCastor.xml b/legacy/runtime/org.argeo.slc.support.hibernate/src/test/resources/org/argeo/slc/hibernate/withCastor.xml new file mode 100644 index 000000000..48bc9dcfb --- /dev/null +++ b/legacy/runtime/org.argeo.slc.support.hibernate/src/test/resources/org/argeo/slc/hibernate/withCastor.xml @@ -0,0 +1,25 @@ + + + + + + + \ No newline at end of file diff --git a/legacy/runtime/org.argeo.slc.support.ws.client/.classpath b/legacy/runtime/org.argeo.slc.support.ws.client/.classpath new file mode 100644 index 000000000..a002fffa3 --- /dev/null +++ b/legacy/runtime/org.argeo.slc.support.ws.client/.classpath @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/legacy/runtime/org.argeo.slc.support.ws.client/.project b/legacy/runtime/org.argeo.slc.support.ws.client/.project new file mode 100644 index 000000000..142bb4ada --- /dev/null +++ b/legacy/runtime/org.argeo.slc.support.ws.client/.project @@ -0,0 +1,28 @@ + + + org.argeo.slc.support.ws.client + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.jdt.core.javanature + org.eclipse.pde.PluginNature + + diff --git a/legacy/runtime/org.argeo.slc.support.ws.client/.settings/org.eclipse.jdt.core.prefs b/legacy/runtime/org.argeo.slc.support.ws.client/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 000000000..964778b0e --- /dev/null +++ b/legacy/runtime/org.argeo.slc.support.ws.client/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,12 @@ +#Fri Aug 29 11:31:46 CEST 2008 +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.compiler.compliance=1.5 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.5 diff --git a/legacy/runtime/org.argeo.slc.support.ws.client/pom.xml b/legacy/runtime/org.argeo.slc.support.ws.client/pom.xml new file mode 100644 index 000000000..db1b5b66d --- /dev/null +++ b/legacy/runtime/org.argeo.slc.support.ws.client/pom.xml @@ -0,0 +1,57 @@ + + 4.0.0 + + org.argeo.slc + runtime + 1.1.3-SNAPSHOT + .. + + org.argeo.slc.runtime + org.argeo.slc.support.ws.client + jar + SLC Support Web Services Client (deprecated) + + + + org.apache.felix + maven-bundle-plugin + + + + + org.argeo.slc.ws.* + + org.w3c.dom;version="0.0.0", + javax.xml.*;version="0.0.0", + org.xml.*;version="0.0.0", + org.springframework.ws.*;resolution:="optional", + org.springframework.core;resolution:="optional", + * + + + + + + + + + org.argeo.slc.runtime + org.argeo.slc.support.simple + 1.1.3-SNAPSHOT + + + org.argeo.slc.runtime + org.argeo.slc.support.castor + 1.1.3-SNAPSHOT + + + + org.argeo.tp + org.springframework.ws + + + org.argeo.tp + com.sun.xml.messaging.saaj + + + \ No newline at end of file diff --git a/legacy/runtime/org.argeo.slc.support.ws.client/src/main/java/org/argeo/slc/ws/client/ValidatingClientInterceptor.java b/legacy/runtime/org.argeo.slc.support.ws.client/src/main/java/org/argeo/slc/ws/client/ValidatingClientInterceptor.java new file mode 100644 index 000000000..84c4b193c --- /dev/null +++ b/legacy/runtime/org.argeo.slc.support.ws.client/src/main/java/org/argeo/slc/ws/client/ValidatingClientInterceptor.java @@ -0,0 +1,103 @@ +/* + * Copyright (C) 2007-2012 Mathieu Baudier + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.argeo.slc.ws.client; + +import java.io.IOException; + +import javax.xml.transform.Source; + +import org.springframework.ws.client.WebServiceClientException; +import org.springframework.ws.client.WebServiceIOException; +import org.springframework.ws.client.support.interceptor.ClientInterceptor; +import org.springframework.ws.context.MessageContext; +import org.springframework.xml.validation.XmlValidator; +import org.xml.sax.SAXParseException; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +public class ValidatingClientInterceptor implements ClientInterceptor { + private final static Log log = LogFactory + .getLog(ValidatingClientInterceptor.class); + + private Boolean validateRequest = true; + private Boolean validateResponse = false; + private XmlValidator validator = null; + + public boolean handleFault(MessageContext messageContext) + throws WebServiceClientException { + return true; + } + + public boolean handleRequest(MessageContext messageContext) + throws WebServiceClientException { + if (validateRequest) { + if (messageContext.getRequest() == null) + return true; + + Source source = messageContext.getRequest().getPayloadSource(); + try { + return validate(source); + } catch (IOException e) { + throw new WebServiceIOException("Cannot validate request", e); + } + } else { + return true; + } + } + + public boolean handleResponse(MessageContext messageContext) + throws WebServiceClientException { + if (validateResponse) { + if (messageContext.getResponse() == null) + return true; + + Source source = messageContext.getResponse().getPayloadSource(); + try { + return validate(source); + } catch (IOException e) { + throw new WebServiceIOException("Cannot validate response", e); + } + } else { + return true; + } + } + + protected boolean validate(Source source) throws IOException { + SAXParseException[] exceptions = validator.validate(source); + if (exceptions.length != 0) { + for (SAXParseException ex : exceptions) { + log.error(ex.getMessage()); + } + return false; + } else { + return true; + } + } + + public void setValidateRequest(Boolean validateRequest) { + this.validateRequest = validateRequest; + } + + public void setValidateResponse(Boolean validateResponse) { + this.validateResponse = validateResponse; + } + + public void setValidator(XmlValidator validator) { + this.validator = validator; + } + +} diff --git a/legacy/runtime/org.argeo.slc.support.ws.client/src/main/java/org/argeo/slc/ws/client/WebServiceUtils.java b/legacy/runtime/org.argeo.slc.support.ws.client/src/main/java/org/argeo/slc/ws/client/WebServiceUtils.java new file mode 100644 index 000000000..02502306f --- /dev/null +++ b/legacy/runtime/org.argeo.slc.support.ws.client/src/main/java/org/argeo/slc/ws/client/WebServiceUtils.java @@ -0,0 +1,99 @@ +/* + * Copyright (C) 2007-2012 Mathieu Baudier + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.argeo.slc.ws.client; + +import java.util.Iterator; + +import javax.xml.transform.Source; +import javax.xml.transform.dom.DOMSource; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.springframework.ws.client.core.WebServiceTemplate; +import org.springframework.ws.soap.SoapFaultDetail; +import org.springframework.ws.soap.SoapFaultDetailElement; +import org.springframework.ws.soap.client.SoapFaultClientException; +import org.springframework.xml.transform.StringResult; +import org.w3c.dom.Node; + +public abstract class WebServiceUtils { + private final static Log log = LogFactory.getLog(WebServiceUtils.class); + + public static Object marshalSendAndReceiveSafe(WebServiceTemplate template, + Object req) { + try { + Object resp = marshalSendAndReceive(template, req); + return resp; + } catch (Exception e) { + log.error("Cannot send web servicerequest: " + e.getMessage()); + if (log.isDebugEnabled()) { + log.debug("Webservice exception details: ", e); + } + return null; + } + } + + public static Object marshalSendAndReceive(WebServiceTemplate template, + Object req) { + if (log.isTraceEnabled()) { + try { + StringResult result = new StringResult(); + template.getMarshaller().marshal(req, result); + log.trace("About to send " + result); + } catch (Exception e) { + log.error("Cannot marshall " + req + " for logging", e); + } + } + Object resp = template.marshalSendAndReceive(req); + return resp; + } + + public static void manageSoapException(SoapFaultClientException e) { + log + .error("WS root cause: " + + e.getSoapFault().getFaultStringOrReason()); + if (log.isTraceEnabled()) { + StringBuffer stack = new StringBuffer(""); + SoapFaultDetail detail = e.getSoapFault().getFaultDetail(); + if (detail != null) { + Iterator it = (Iterator) detail + .getDetailEntries(); + while (it.hasNext()) { + SoapFaultDetailElement elem = it.next(); + if (elem.getName().getLocalPart().equals("StackElement")) { + Source source = elem.getSource(); + if (source instanceof DOMSource) { + Node node = ((DOMSource) source).getNode(); + // stack.append(node.getTextContent()).append('\n'); + stack + .append( + node.getChildNodes().item(0) + .getNodeValue()).append( + '\n'); + } + } + } + + if (stack.length() > 0) + log.error("WS root cause stack: " + stack); + } + } + } + + private WebServiceUtils() { + + } +} diff --git a/legacy/runtime/org.argeo.slc.support.ws.client/src/main/java/org/argeo/slc/ws/process/WebServiceSlcExecutionNotifier.java b/legacy/runtime/org.argeo.slc.support.ws.client/src/main/java/org/argeo/slc/ws/process/WebServiceSlcExecutionNotifier.java new file mode 100644 index 000000000..d341a63a3 --- /dev/null +++ b/legacy/runtime/org.argeo.slc.support.ws.client/src/main/java/org/argeo/slc/ws/process/WebServiceSlcExecutionNotifier.java @@ -0,0 +1,131 @@ +/* + * Copyright (C) 2007-2012 Mathieu Baudier + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.argeo.slc.ws.process; + +import java.util.List; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.argeo.slc.msg.process.SlcExecutionRequest; +import org.argeo.slc.msg.process.SlcExecutionStatusRequest; +import org.argeo.slc.msg.process.SlcExecutionStepsRequest; +import org.argeo.slc.execution.ExecutionStep; +import org.argeo.slc.execution.ExecutionProcess; +import org.argeo.slc.process.SlcExecution; +import org.argeo.slc.process.SlcExecutionNotifier; +import org.argeo.slc.process.SlcExecutionStep; +import org.argeo.slc.ws.client.WebServiceUtils; +import org.springframework.ws.client.WebServiceIOException; +import org.springframework.ws.client.core.WebServiceTemplate; +import org.springframework.ws.soap.client.SoapFaultClientException; + +public class WebServiceSlcExecutionNotifier implements SlcExecutionNotifier { + private WebServiceTemplate template; + + private Log log = LogFactory.getLog(getClass()); + + private Boolean cannotConnect = false; + + public void newExecution(ExecutionProcess process) { + SlcExecution slcExecution = (SlcExecution) process; + if (cannotConnect) + return; + + SlcExecutionRequest req = new SlcExecutionRequest(); + req.setSlcExecution(slcExecution); + try { + WebServiceUtils.marshalSendAndReceive(template, req); + if (log.isTraceEnabled()) + log.trace("Notified creation of slc execution " + + slcExecution.getUuid()); + } catch (SoapFaultClientException e) { + WebServiceUtils.manageSoapException(e); + } catch (WebServiceIOException e) { + manageIoException(e); + } + } + + public void updateExecution(SlcExecution slcExecution) { + if (cannotConnect) + return; + + SlcExecutionRequest req = new SlcExecutionRequest(); + req.setSlcExecution(slcExecution); + try { + WebServiceUtils.marshalSendAndReceive(template, req); + if (log.isTraceEnabled()) + log.trace("Notified update of slc execution " + + slcExecution.getUuid()); + } catch (SoapFaultClientException e) { + WebServiceUtils.manageSoapException(e); + } catch (WebServiceIOException e) { + manageIoException(e); + } + } + + public void updateStatus(ExecutionProcess process, String oldStatus, + String newStatus) { + SlcExecution slcExecution = (SlcExecution) process; + if (cannotConnect) + return; + + SlcExecutionStatusRequest req = new SlcExecutionStatusRequest( + slcExecution.getUuid(), newStatus); + try { + WebServiceUtils.marshalSendAndReceive(template, req); + if (log.isTraceEnabled()) + log.trace("Notified status update of slc execution " + + slcExecution.getUuid()); + } catch (SoapFaultClientException e) { + WebServiceUtils.manageSoapException(e); + } catch (WebServiceIOException e) { + manageIoException(e); + } + } + + public void addSteps(ExecutionProcess process, + List additionalSteps) { + SlcExecution slcExecution = (SlcExecution) process; + if (cannotConnect) + return; + + SlcExecutionStepsRequest req = new SlcExecutionStepsRequest( + slcExecution.getUuid(), additionalSteps); + try { + WebServiceUtils.marshalSendAndReceive(template, req); + if (log.isTraceEnabled()) + log.trace("Added steps to slc execution " + + slcExecution.getUuid()); + } catch (SoapFaultClientException e) { + WebServiceUtils.manageSoapException(e); + } catch (WebServiceIOException e) { + manageIoException(e); + } + } + + public void setTemplate(WebServiceTemplate template) { + this.template = template; + } + + protected void manageIoException(WebServiceIOException e) { + if (!cannotConnect) { + log.error("Cannot connect to " + template.getDefaultUri() + + ". Won't try again.", e); + cannotConnect = true; + } + } + +} diff --git a/legacy/runtime/org.argeo.slc.support.ws.client/src/main/java/org/argeo/slc/ws/test/tree/WebServiceTreeTestResultNotifier.java b/legacy/runtime/org.argeo.slc.support.ws.client/src/main/java/org/argeo/slc/ws/test/tree/WebServiceTreeTestResultNotifier.java new file mode 100644 index 000000000..cefbcd138 --- /dev/null +++ b/legacy/runtime/org.argeo.slc.support.ws.client/src/main/java/org/argeo/slc/ws/test/tree/WebServiceTreeTestResultNotifier.java @@ -0,0 +1,124 @@ +/* + * Copyright (C) 2007-2012 Mathieu Baudier + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.argeo.slc.ws.test.tree; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.argeo.slc.core.test.tree.TreeTestResult; +import org.argeo.slc.msg.test.tree.CloseTreeTestResultRequest; +import org.argeo.slc.msg.test.tree.CreateTreeTestResultRequest; +import org.argeo.slc.msg.test.tree.ResultPartRequest; +import org.argeo.slc.test.TestResultListener; +import org.argeo.slc.test.TestResultPart; +import org.argeo.slc.ws.client.WebServiceUtils; +import org.springframework.ws.client.WebServiceIOException; +import org.springframework.ws.client.core.WebServiceTemplate; +import org.springframework.ws.soap.client.SoapFaultClientException; + +public class WebServiceTreeTestResultNotifier implements + TestResultListener { + private WebServiceTemplate template; + private Boolean onlyOnClose = false; + + private Log log = LogFactory.getLog(getClass()); + + private Boolean cannotConnect = false; + + public void resultPartAdded(TreeTestResult testResult, + TestResultPart testResultPart) { + if (onlyOnClose) + return; + + if (cannotConnect) + return; + + try { + if (testResult.getResultParts().size() == 1 + && testResult.getResultParts().values().iterator().next() + .getParts().size() == 1) { + CreateTreeTestResultRequest req = new CreateTreeTestResultRequest( + testResult); + + if (log.isDebugEnabled()) + log.debug("Send create result request for result " + + testResult.getUuid()); + + WebServiceUtils.marshalSendAndReceive(template, req); + } else { + ResultPartRequest req = new ResultPartRequest(testResult); + + if (log.isDebugEnabled()) + log.debug("Send result parts for result " + + testResult.getUuid()); + + WebServiceUtils.marshalSendAndReceive(template, req); + } + } catch (SoapFaultClientException e) { + WebServiceUtils.manageSoapException(e); + + } catch (WebServiceIOException e) { + manageIoException(e); + } + } + + public void close(TreeTestResult testResult) { + if (cannotConnect) + return; + + try { + if (onlyOnClose) { + CreateTreeTestResultRequest req = new CreateTreeTestResultRequest( + testResult); + + if (log.isDebugEnabled()) + log.debug("Send create result request for result " + + testResult.getUuid()); + + WebServiceUtils.marshalSendAndReceive(template, req); + } else { + CloseTreeTestResultRequest req = new CloseTreeTestResultRequest( + testResult); + + if (log.isDebugEnabled()) + log.debug("Send close result request for result " + + testResult.getUuid()); + + WebServiceUtils.marshalSendAndReceive(template, req); + + } + } catch (SoapFaultClientException e) { + WebServiceUtils.manageSoapException(e); + } catch (WebServiceIOException e) { + manageIoException(e); + } + } + + public void setTemplate(WebServiceTemplate template) { + this.template = template; + } + + public void setOnlyOnClose(Boolean onlyOnClose) { + this.onlyOnClose = onlyOnClose; + } + + protected void manageIoException(WebServiceIOException e) { + if (!cannotConnect) { + log.error("Cannot connect to " + template.getDefaultUri() + + ". Won't try again.", e); + cannotConnect = true; + } + } +} diff --git a/legacy/runtime/org.argeo.slc.support.ws.client/src/main/resources/org/argeo/slc/ws/client/spring/applicationContext.xml b/legacy/runtime/org.argeo.slc.support.ws.client/src/main/resources/org/argeo/slc/ws/client/spring/applicationContext.xml new file mode 100644 index 000000000..2cf78df6a --- /dev/null +++ b/legacy/runtime/org.argeo.slc.support.ws.client/src/main/resources/org/argeo/slc/ws/client/spring/applicationContext.xml @@ -0,0 +1,82 @@ + + + + + + + + + + + + + + + + + + http://localhost:9090/org.argeo.slc.webapp/slcService/ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/modules/agent/org.argeo.slc.agent.ext.bsf/pom.xml b/modules/agent/org.argeo.slc.agent.ext.bsf/pom.xml deleted file mode 100644 index 280c1ec5e..000000000 --- a/modules/agent/org.argeo.slc.agent.ext.bsf/pom.xml +++ /dev/null @@ -1,29 +0,0 @@ - - 4.0.0 - - org.argeo.slc.modules - agent - 1.1.3-SNAPSHOT - .. - - org.argeo.slc.agent.ext.bsf - SLC Agent BSF Extension - - - - org.apache.felix - maven-bundle-plugin - - - org.apache.bsf - - *, - bsh.util;resolution:=optional, - org.codehaus.groovy.bsf;resolution:=optional - - - - - - - \ No newline at end of file diff --git a/modules/agent/org.argeo.slc.agent.ext.jdbc/pom.xml b/modules/agent/org.argeo.slc.agent.ext.jdbc/pom.xml deleted file mode 100644 index 929dc59cd..000000000 --- a/modules/agent/org.argeo.slc.agent.ext.jdbc/pom.xml +++ /dev/null @@ -1,30 +0,0 @@ - - 4.0.0 - - org.argeo.slc.modules - agent - 1.1.3-SNAPSHOT - .. - - org.argeo.slc.agent.ext.jdbc - SLC Agent JDBC Extension - - - - org.apache.felix - maven-bundle-plugin - - - org.springframework.jdbc - - *, - com.mysql.jdbc;resolution:=optional, - net.sourceforge.jtds.jdbc;resolution:=optional, - org.hsqldb;resolution:=optional - - - - - - - \ No newline at end of file diff --git a/modules/agent/org.argeo.slc.agent.ext.xalan/pom.xml b/modules/agent/org.argeo.slc.agent.ext.xalan/pom.xml deleted file mode 100644 index cb8bf1e8c..000000000 --- a/modules/agent/org.argeo.slc.agent.ext.xalan/pom.xml +++ /dev/null @@ -1,29 +0,0 @@ - - 4.0.0 - - org.argeo.slc.modules - agent - 1.1.3-SNAPSHOT - .. - - org.argeo.slc.agent.ext.xalan - SLC Agent Xalan Extension - - - - org.apache.felix - maven-bundle-plugin - - - org.argeo.slc.agent.ext.xalan - - *, - com.sun.org.apache.xml.internal.dtm;resolution:=optional, - org.w3c.dom.traversal;resolution:=optional - - - - - - - \ No newline at end of file diff --git a/modules/agent/org.argeo.slc.agent.jms/.project b/modules/agent/org.argeo.slc.agent.jms/.project deleted file mode 100644 index f9cc4f057..000000000 --- a/modules/agent/org.argeo.slc.agent.jms/.project +++ /dev/null @@ -1,22 +0,0 @@ - - - org.argeo.slc.agent.jms - - - - - - org.eclipse.pde.ManifestBuilder - - - - - org.eclipse.pde.SchemaBuilder - - - - - - org.eclipse.pde.PluginNature - - diff --git a/modules/agent/org.argeo.slc.agent.jms/META-INF/spring/common.xml b/modules/agent/org.argeo.slc.agent.jms/META-INF/spring/common.xml deleted file mode 100644 index c0ce5e076..000000000 --- a/modules/agent/org.argeo.slc.agent.jms/META-INF/spring/common.xml +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - osgibundle:agent.properties - - - - - - \ No newline at end of file diff --git a/modules/agent/org.argeo.slc.agent.jms/META-INF/spring/jms.xml b/modules/agent/org.argeo.slc.agent.jms/META-INF/spring/jms.xml deleted file mode 100644 index 7924dfe2d..000000000 --- a/modules/agent/org.argeo.slc.agent.jms/META-INF/spring/jms.xml +++ /dev/null @@ -1,86 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ${slc.server.jms.url} - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/modules/agent/org.argeo.slc.agent.jms/META-INF/spring/osgi.xml b/modules/agent/org.argeo.slc.agent.jms/META-INF/spring/osgi.xml deleted file mode 100644 index 6020ed85b..000000000 --- a/modules/agent/org.argeo.slc.agent.jms/META-INF/spring/osgi.xml +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/modules/agent/org.argeo.slc.agent.jms/agent.properties b/modules/agent/org.argeo.slc.agent.jms/agent.properties deleted file mode 100644 index d688a7450..000000000 --- a/modules/agent/org.argeo.slc.agent.jms/agent.properties +++ /dev/null @@ -1,5 +0,0 @@ -slc.server.jms.url=tcp://localhost:61616 - -# Customization -slc.agent.jms.disableMarshalling=false -slc.agent.jms.resultListener.onlyOnClose=false diff --git a/modules/agent/org.argeo.slc.agent.jms/build.properties b/modules/agent/org.argeo.slc.agent.jms/build.properties deleted file mode 100644 index 7594fab8d..000000000 --- a/modules/agent/org.argeo.slc.agent.jms/build.properties +++ /dev/null @@ -1,2 +0,0 @@ -bin.includes = META-INF/,\ - . diff --git a/modules/agent/org.argeo.slc.agent.jms/pom.xml b/modules/agent/org.argeo.slc.agent.jms/pom.xml deleted file mode 100644 index d6d154ff5..000000000 --- a/modules/agent/org.argeo.slc.agent.jms/pom.xml +++ /dev/null @@ -1,26 +0,0 @@ - - 4.0.0 - - org.argeo.slc.modules - agent - 1.1.3-SNAPSHOT - .. - - org.argeo.slc.agent.jms - SLC Agent JMS - - - - org.apache.felix - maven-bundle-plugin - - - - *, - - - - - - - \ No newline at end of file diff --git a/modules/agent/org.argeo.slc.ext.activemq/.project b/modules/agent/org.argeo.slc.ext.activemq/.project deleted file mode 100644 index c8e5c7da6..000000000 --- a/modules/agent/org.argeo.slc.ext.activemq/.project +++ /dev/null @@ -1,22 +0,0 @@ - - - org.argeo.slc.ext.activemq - - - - - - org.eclipse.pde.ManifestBuilder - - - - - org.eclipse.pde.SchemaBuilder - - - - - - org.eclipse.pde.PluginNature - - diff --git a/modules/agent/org.argeo.slc.ext.activemq/pom.xml b/modules/agent/org.argeo.slc.ext.activemq/pom.xml deleted file mode 100644 index b1241927b..000000000 --- a/modules/agent/org.argeo.slc.ext.activemq/pom.xml +++ /dev/null @@ -1,51 +0,0 @@ - - 4.0.0 - - org.argeo.slc.modules - agent - 1.1.3-SNAPSHOT - .. - - org.argeo.slc.ext.activemq - SLC ActiveMQ Extension - - - - org.apache.felix - maven-bundle-plugin - - - org.apache.activemq - - *, - org.argeo.slc.runtime, - org.argeo.slc.execution, - org.argeo.slc.msg, - org.argeo.slc.build, - org.argeo.slc.core.execution, - org.argeo.slc.core.attachment, - org.argeo.slc.core.structure, - org.argeo.slc.core.structure.tree, - org.argeo.slc.core.test, - org.argeo.slc.core.test.tree, - org.argeo.slc.deploy, - org.argeo.slc.detached;resolution:=optional, - org.argeo.slc.execution, - org.argeo.slc.msg, - org.argeo.slc.msg.build, - org.argeo.slc.msg.event, - org.argeo.slc.msg.process, - org.argeo.slc.msg.test.tree, - org.argeo.slc.process, - org.argeo.slc.runtime, - org.argeo.slc.test, - org.argeo.slc.xml.process;resolution:=optional, - org.argeo.slc.xml.test.tree;resolution:=optional, - org.hibernate.collection;resolution:=optional - - - - - - - \ No newline at end of file diff --git a/modules/agent/org.argeo.slc.lib.build/.project b/modules/agent/org.argeo.slc.lib.build/.project deleted file mode 100644 index 6e7c038dc..000000000 --- a/modules/agent/org.argeo.slc.lib.build/.project +++ /dev/null @@ -1,22 +0,0 @@ - - - org.argeo.slc.lib.build - - - - - - org.eclipse.pde.ManifestBuilder - - - - - org.eclipse.pde.SchemaBuilder - - - - - - org.eclipse.pde.PluginNature - - diff --git a/modules/agent/org.argeo.slc.lib.build/META-INF/MANIFEST.MF b/modules/agent/org.argeo.slc.lib.build/META-INF/MANIFEST.MF deleted file mode 100644 index ba036e508..000000000 --- a/modules/agent/org.argeo.slc.lib.build/META-INF/MANIFEST.MF +++ /dev/null @@ -1,7 +0,0 @@ -Manifest-Version: 1.0 -Bundle-ManifestVersion: 2 -Bundle-Name: SLC Build -Bundle-SymbolicName: org.argeo.slc.lib.build -Bundle-Version: 1.1.3.SNAPSHOT -Bundle-Vendor: Argeo -Bundle-RequiredExecutionEnvironment: J2SE-1.5 diff --git a/modules/agent/org.argeo.slc.lib.build/build.properties b/modules/agent/org.argeo.slc.lib.build/build.properties deleted file mode 100644 index 5fc538bc8..000000000 --- a/modules/agent/org.argeo.slc.lib.build/build.properties +++ /dev/null @@ -1,4 +0,0 @@ -source.. = src/main/java/ -output.. = target/classes/ -bin.includes = META-INF/,\ - . diff --git a/modules/server/org.argeo.slc.server.activemq/.project b/modules/server/org.argeo.slc.server.activemq/.project deleted file mode 100644 index 872d152ec..000000000 --- a/modules/server/org.argeo.slc.server.activemq/.project +++ /dev/null @@ -1,22 +0,0 @@ - - - org.argeo.slc.server.activemq - - - - - - org.eclipse.pde.ManifestBuilder - - - - - org.eclipse.pde.SchemaBuilder - - - - - - org.eclipse.pde.PluginNature - - diff --git a/modules/server/org.argeo.slc.server.activemq/.settings/org.eclipse.pde.core.prefs b/modules/server/org.argeo.slc.server.activemq/.settings/org.eclipse.pde.core.prefs deleted file mode 100644 index f0ef2f954..000000000 --- a/modules/server/org.argeo.slc.server.activemq/.settings/org.eclipse.pde.core.prefs +++ /dev/null @@ -1,4 +0,0 @@ -#Sun Feb 14 20:09:09 CET 2010 -eclipse.preferences.version=1 -pluginProject.extensions=false -resolve.requirebundle=false diff --git a/modules/server/org.argeo.slc.server.activemq/META-INF/MANIFEST.MF b/modules/server/org.argeo.slc.server.activemq/META-INF/MANIFEST.MF deleted file mode 100644 index 4f2283fcc..000000000 --- a/modules/server/org.argeo.slc.server.activemq/META-INF/MANIFEST.MF +++ /dev/null @@ -1,11 +0,0 @@ -Manifest-Version: 1.0 -Bundle-Version: 1.1.3.SNAPSHOT -Bundle-SymbolicName: org.argeo.slc.server.activemq -Import-Package: javax.jms, - org.apache.activemq, - org.argeo.slc.jms, - org.springframework.beans.factory.config, - org.springframework.jms.connection, - org.springframework.jms.support.converter, - org.springframework.oxm -Bundle-Name: Active MQ Server diff --git a/modules/server/org.argeo.slc.server.activemq/META-INF/spring/activemq-osgi.xml b/modules/server/org.argeo.slc.server.activemq/META-INF/spring/activemq-osgi.xml deleted file mode 100644 index 1c63302d2..000000000 --- a/modules/server/org.argeo.slc.server.activemq/META-INF/spring/activemq-osgi.xml +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/modules/server/org.argeo.slc.server.activemq/META-INF/spring/activemq.xml b/modules/server/org.argeo.slc.server.activemq/META-INF/spring/activemq.xml deleted file mode 100644 index ef5f43ceb..000000000 --- a/modules/server/org.argeo.slc.server.activemq/META-INF/spring/activemq.xml +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - - osgibundle:activemq.properties - - - - - - - - - ${slc.server.jms.url} - - - - - - - - - - - - - \ No newline at end of file diff --git a/modules/server/org.argeo.slc.server.activemq/activemq.properties b/modules/server/org.argeo.slc.server.activemq/activemq.properties deleted file mode 100644 index 0e524d438..000000000 --- a/modules/server/org.argeo.slc.server.activemq/activemq.properties +++ /dev/null @@ -1,3 +0,0 @@ -slc.server.jms.url=tcp://localhost:61616 - -slc.server.jms.disableMarshalling=false \ No newline at end of file diff --git a/modules/server/org.argeo.slc.server.activemq/build.properties b/modules/server/org.argeo.slc.server.activemq/build.properties deleted file mode 100644 index 5f22cdd44..000000000 --- a/modules/server/org.argeo.slc.server.activemq/build.properties +++ /dev/null @@ -1 +0,0 @@ -bin.includes = META-INF/ diff --git a/modules/server/org.argeo.slc.server.agentproxy/.project b/modules/server/org.argeo.slc.server.agentproxy/.project deleted file mode 100644 index b2a0bb1dc..000000000 --- a/modules/server/org.argeo.slc.server.agentproxy/.project +++ /dev/null @@ -1,22 +0,0 @@ - - - org.argeo.slc.server.agentproxy - - - - - - org.eclipse.pde.ManifestBuilder - - - - - org.eclipse.pde.SchemaBuilder - - - - - - org.eclipse.pde.PluginNature - - diff --git a/modules/server/org.argeo.slc.server.agentproxy/META-INF/MANIFEST.MF b/modules/server/org.argeo.slc.server.agentproxy/META-INF/MANIFEST.MF deleted file mode 100644 index 599022d9d..000000000 --- a/modules/server/org.argeo.slc.server.agentproxy/META-INF/MANIFEST.MF +++ /dev/null @@ -1,12 +0,0 @@ -Manifest-Version: 1.0 -Bundle-Version: 1.1.3.SNAPSHOT -Bundle-SymbolicName: org.argeo.slc.server.agentproxy -Import-Package: javax.jms, - org.apache.activemq.command, - org.argeo.slc.activemq, - org.argeo.slc.jms, - org.argeo.slc.runtime, - org.springframework.beans.factory.config, - org.springframework.jms.core, - org.springframework.jms.support.converter -Bundle-Name: Agent Proxy diff --git a/modules/server/org.argeo.slc.server.agentproxy/META-INF/spring/agentProxy-osgi.xml b/modules/server/org.argeo.slc.server.agentproxy/META-INF/spring/agentProxy-osgi.xml deleted file mode 100644 index 874a92a80..000000000 --- a/modules/server/org.argeo.slc.server.agentproxy/META-INF/spring/agentProxy-osgi.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - - - - \ No newline at end of file diff --git a/modules/server/org.argeo.slc.server.agentproxy/META-INF/spring/agentProxy.xml b/modules/server/org.argeo.slc.server.agentproxy/META-INF/spring/agentProxy.xml deleted file mode 100644 index e67283c5f..000000000 --- a/modules/server/org.argeo.slc.server.agentproxy/META-INF/spring/agentProxy.xml +++ /dev/null @@ -1,32 +0,0 @@ - - - - - - - - - osgibundle:agentproxy.properties - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/modules/server/org.argeo.slc.server.agentproxy/agentproxy.properties b/modules/server/org.argeo.slc.server.agentproxy/agentproxy.properties deleted file mode 100644 index b003c434a..000000000 --- a/modules/server/org.argeo.slc.server.agentproxy/agentproxy.properties +++ /dev/null @@ -1 +0,0 @@ -slc.server.jms.agentProxy.timeout=20000 \ No newline at end of file diff --git a/modules/server/org.argeo.slc.server.agentproxy/build.properties b/modules/server/org.argeo.slc.server.agentproxy/build.properties deleted file mode 100644 index 7594fab8d..000000000 --- a/modules/server/org.argeo.slc.server.agentproxy/build.properties +++ /dev/null @@ -1,2 +0,0 @@ -bin.includes = META-INF/,\ - . diff --git a/modules/server/org.argeo.slc.server.castor/.project b/modules/server/org.argeo.slc.server.castor/.project deleted file mode 100644 index f40b28645..000000000 --- a/modules/server/org.argeo.slc.server.castor/.project +++ /dev/null @@ -1,22 +0,0 @@ - - - org.argeo.slc.server.castor - - - - - - org.eclipse.pde.ManifestBuilder - - - - - org.eclipse.pde.SchemaBuilder - - - - - - org.eclipse.pde.PluginNature - - diff --git a/modules/server/org.argeo.slc.server.castor/META-INF/MANIFEST.MF b/modules/server/org.argeo.slc.server.castor/META-INF/MANIFEST.MF deleted file mode 100644 index b11b44993..000000000 --- a/modules/server/org.argeo.slc.server.castor/META-INF/MANIFEST.MF +++ /dev/null @@ -1,7 +0,0 @@ -Manifest-Version: 1.0 -Bundle-Version: 1.1.3.SNAPSHOT -Bundle-SymbolicName: org.argeo.slc.server.castor -Import-Package: org.springframework.oxm, - org.argeo.slc.castor, - org.springframework.oxm.castor -Bundle-Name: Server Castor diff --git a/modules/server/org.argeo.slc.server.castor/META-INF/spring/castor-osgi.xml b/modules/server/org.argeo.slc.server.castor/META-INF/spring/castor-osgi.xml deleted file mode 100644 index aaacff8cc..000000000 --- a/modules/server/org.argeo.slc.server.castor/META-INF/spring/castor-osgi.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - - org.springframework.oxm.Marshaller - - org.springframework.oxm.Unmarshaller - - - - \ No newline at end of file diff --git a/modules/server/org.argeo.slc.server.h2/.project b/modules/server/org.argeo.slc.server.h2/.project deleted file mode 100644 index 431324bb0..000000000 --- a/modules/server/org.argeo.slc.server.h2/.project +++ /dev/null @@ -1,22 +0,0 @@ - - - org.argeo.slc.server.h2 - - - - - - org.eclipse.pde.ManifestBuilder - - - - - org.eclipse.pde.SchemaBuilder - - - - - - org.eclipse.pde.PluginNature - - diff --git a/modules/server/org.argeo.slc.server.h2/.settings/org.eclipse.pde.core.prefs b/modules/server/org.argeo.slc.server.h2/.settings/org.eclipse.pde.core.prefs deleted file mode 100644 index eb0a4dc66..000000000 --- a/modules/server/org.argeo.slc.server.h2/.settings/org.eclipse.pde.core.prefs +++ /dev/null @@ -1,4 +0,0 @@ -#Tue Jul 13 15:43:47 CEST 2010 -eclipse.preferences.version=1 -pluginProject.extensions=false -resolve.requirebundle=false diff --git a/modules/server/org.argeo.slc.server.h2/META-INF/MANIFEST.MF b/modules/server/org.argeo.slc.server.h2/META-INF/MANIFEST.MF deleted file mode 100644 index a84864a9d..000000000 --- a/modules/server/org.argeo.slc.server.h2/META-INF/MANIFEST.MF +++ /dev/null @@ -1,31 +0,0 @@ -Manifest-Version: 1.0 -Bundle-ManifestVersion: 2 -Bundle-Name: Server H2 -Bundle-SymbolicName: org.argeo.slc.server.h2 -Bundle-Version: 1.1.3.SNAPSHOT -Bundle-Vendor: Argeo -Import-Package: net.sf.ehcache.hibernate, - org.aopalliance.aop, - org.argeo.slc.core.attachment, - org.argeo.slc.core.structure, - org.argeo.slc.core.structure.tree, - org.argeo.slc.core.test, - org.argeo.slc.core.test.tree, - org.argeo.slc.hibernate, - org.argeo.slc.hibernate.attachment, - org.argeo.slc.hibernate.process, - org.argeo.slc.hibernate.runtime, - org.argeo.slc.hibernate.structure, - org.argeo.slc.hibernate.test, - org.argeo.slc.hibernate.test.tree, - org.argeo.slc.process, - org.argeo.slc.runtime, - org.argeo.slc.test, - org.h2, - org.h2.jdbcx, - org.hibernate, - org.hibernate.hql.ast, - org.springframework.beans.factory.config, - org.springframework.cache.ehcache, - org.springframework.jdbc.datasource, - org.springframework.orm.hibernate3 diff --git a/modules/server/org.argeo.slc.server.h2/META-INF/spring/h2-osgi.xml b/modules/server/org.argeo.slc.server.h2/META-INF/spring/h2-osgi.xml deleted file mode 100644 index 6d7b0e6f1..000000000 --- a/modules/server/org.argeo.slc.server.h2/META-INF/spring/h2-osgi.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/modules/server/org.argeo.slc.server.h2/META-INF/spring/h2.xml b/modules/server/org.argeo.slc.server.h2/META-INF/spring/h2.xml deleted file mode 100644 index fa26f335e..000000000 --- a/modules/server/org.argeo.slc.server.h2/META-INF/spring/h2.xml +++ /dev/null @@ -1,49 +0,0 @@ - - - - - - - - - - osgibundle:h2.properties - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/modules/server/org.argeo.slc.server.h2/build.properties b/modules/server/org.argeo.slc.server.h2/build.properties deleted file mode 100644 index 5f22cdd44..000000000 --- a/modules/server/org.argeo.slc.server.h2/build.properties +++ /dev/null @@ -1 +0,0 @@ -bin.includes = META-INF/ diff --git a/modules/server/org.argeo.slc.server.h2/h2.properties b/modules/server/org.argeo.slc.server.h2/h2.properties deleted file mode 100644 index 0877043d7..000000000 --- a/modules/server/org.argeo.slc.server.h2/h2.properties +++ /dev/null @@ -1 +0,0 @@ -slc.server.h2.url=jdbc:h2:mem:test;DB_CLOSE_DELAY=-1 \ No newline at end of file diff --git a/modules/server/org.argeo.slc.server.hibernate/.project b/modules/server/org.argeo.slc.server.hibernate/.project deleted file mode 100644 index cade579ca..000000000 --- a/modules/server/org.argeo.slc.server.hibernate/.project +++ /dev/null @@ -1,22 +0,0 @@ - - - org.argeo.slc.server.hibernate - - - - - - org.eclipse.pde.ManifestBuilder - - - - - org.eclipse.pde.SchemaBuilder - - - - - - org.eclipse.pde.PluginNature - - diff --git a/modules/server/org.argeo.slc.server.hibernate/META-INF/MANIFEST.MF b/modules/server/org.argeo.slc.server.hibernate/META-INF/MANIFEST.MF deleted file mode 100644 index f9dc2f0b5..000000000 --- a/modules/server/org.argeo.slc.server.hibernate/META-INF/MANIFEST.MF +++ /dev/null @@ -1,31 +0,0 @@ -Manifest-Version: 1.0 -Bundle-Version: 1.1.3.SNAPSHOT -Bundle-SymbolicName: org.argeo.slc.server.hibernate -Import-Package: org.aopalliance.aop, - org.argeo.slc.core.attachment, - org.argeo.slc.core.structure, - org.argeo.slc.core.structure.tree, - org.argeo.slc.core.test, - org.argeo.slc.core.test.tree, - org.argeo.slc.dao.process, - org.argeo.slc.dao.runtime, - org.argeo.slc.dao.test, - org.argeo.slc.dao.test.tree, - org.argeo.slc.hibernate, - org.argeo.slc.hibernate.process, - org.argeo.slc.hibernate.runtime, - org.argeo.slc.hibernate.test, - org.argeo.slc.hibernate.test.tree, - org.argeo.slc.process, - org.argeo.slc.runtime, - org.argeo.slc.test, - org.hibernate, - org.hibernate.hql.ast, - org.hibernate.jdbc, - org.springframework.aop, - org.springframework.aop.framework, - org.springframework.orm.hibernate3, - org.springframework.orm.hibernate3.support, - org.springframework.transaction, - org.springframework.web.context.request -Bundle-Name: Server Hibernate 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 deleted file mode 100644 index c85ccd5a2..000000000 --- a/modules/server/org.argeo.slc.server.hibernate/META-INF/spring/db-osgi.xml +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/modules/server/org.argeo.slc.server.hibernate/META-INF/spring/db.xml b/modules/server/org.argeo.slc.server.hibernate/META-INF/spring/db.xml deleted file mode 100644 index a5d4329dd..000000000 --- a/modules/server/org.argeo.slc.server.hibernate/META-INF/spring/db.xml +++ /dev/null @@ -1,43 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/modules/server/org.argeo.slc.server.hibernate/META-INF/spring/transaction-osgi.xml b/modules/server/org.argeo.slc.server.hibernate/META-INF/spring/transaction-osgi.xml deleted file mode 100644 index f9513808c..000000000 --- a/modules/server/org.argeo.slc.server.hibernate/META-INF/spring/transaction-osgi.xml +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/modules/server/org.argeo.slc.server.hibernate/META-INF/spring/transaction.xml b/modules/server/org.argeo.slc.server.hibernate/META-INF/spring/transaction.xml deleted file mode 100644 index 7d03b64e1..000000000 --- a/modules/server/org.argeo.slc.server.hibernate/META-INF/spring/transaction.xml +++ /dev/null @@ -1,64 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/modules/server/org.argeo.slc.server.jcr/.project b/modules/server/org.argeo.slc.server.jcr/.project deleted file mode 100644 index f2310ab21..000000000 --- a/modules/server/org.argeo.slc.server.jcr/.project +++ /dev/null @@ -1,22 +0,0 @@ - - - org.argeo.slc.server.jcr - - - - - - org.eclipse.pde.ManifestBuilder - - - - - org.eclipse.pde.SchemaBuilder - - - - - - org.eclipse.pde.PluginNature - - 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 deleted file mode 100644 index a3de4b26e..000000000 --- a/modules/server/org.argeo.slc.server.jcr/META-INF/MANIFEST.MF +++ /dev/null @@ -1,32 +0,0 @@ -Manifest-Version: 1.0 -Bundle-Version: 1.1.3.SNAPSHOT -Bundle-SymbolicName: org.argeo.slc.server.jcr -Bundle-Name: Server JCR -Import-Package: javax.jcr, - org.argeo.jcr, - org.argeo.jcr.mvc, - org.argeo.jcr.spring, - org.argeo.security, - org.argeo.security.core, - org.argeo.security.jcr, - org.argeo.slc.core.attachment, - org.argeo.slc.core.execution, - org.argeo.slc.core.structure, - org.argeo.slc.core.structure.tree, - org.argeo.slc.core.test, - org.argeo.slc.core.test.tree, - org.argeo.slc.dao.process, - org.argeo.slc.dao.runtime, - org.argeo.slc.dao.test, - org.argeo.slc.dao.test.tree, - org.argeo.slc.execution, - org.argeo.slc.jcr, - org.argeo.slc.jcr.dao, - org.argeo.slc.jcr.execution, - org.argeo.slc.process, - org.argeo.slc.runtime, - org.argeo.slc.test, - org.springframework.beans.factory.config, - org.springframework.osgi.util, - org.springframework.security;specification-version="2.0.6.RELEASE", - org.springframework.web.context.request 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 deleted file mode 100644 index 1bf180908..000000000 --- a/modules/server/org.argeo.slc.server.jcr/META-INF/spring/jcr-osgi.xml +++ /dev/null @@ -1,51 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ 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 deleted file mode 100644 index ba5e1e161..000000000 --- a/modules/server/org.argeo.slc.server.jcr/META-INF/spring/jcr.xml +++ /dev/null @@ -1,92 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/modules/server/org.argeo.slc.server.jcr/build.properties b/modules/server/org.argeo.slc.server.jcr/build.properties deleted file mode 100644 index 7594fab8d..000000000 --- a/modules/server/org.argeo.slc.server.jcr/build.properties +++ /dev/null @@ -1,2 +0,0 @@ -bin.includes = META-INF/,\ - . diff --git a/modules/server/org.argeo.slc.server.jms/.project b/modules/server/org.argeo.slc.server.jms/.project deleted file mode 100644 index 34ade0272..000000000 --- a/modules/server/org.argeo.slc.server.jms/.project +++ /dev/null @@ -1,22 +0,0 @@ - - - org.argeo.slc.server.jms - - - - - - org.eclipse.pde.ManifestBuilder - - - - - org.eclipse.pde.SchemaBuilder - - - - - - org.eclipse.pde.PluginNature - - diff --git a/modules/server/org.argeo.slc.server.jms/META-INF/MANIFEST.MF b/modules/server/org.argeo.slc.server.jms/META-INF/MANIFEST.MF deleted file mode 100644 index a7a76c126..000000000 --- a/modules/server/org.argeo.slc.server.jms/META-INF/MANIFEST.MF +++ /dev/null @@ -1,22 +0,0 @@ -Manifest-Version: 1.0 -Bundle-Version: 1.1.3.SNAPSHOT -Bundle-SymbolicName: org.argeo.slc.server.jms -Import-Package: javax.jms, - javax.management.j2ee.statistics, - org.apache.activemq, - org.apache.activemq.command, - org.apache.commons.logging, - org.argeo.security, - org.argeo.security.core, - org.argeo.slc.activemq, - org.argeo.slc.core.attachment, - org.argeo.slc.jms, - org.argeo.slc.msg.event, - org.argeo.slc.services, - org.springframework.beans.factory.config, - org.springframework.jms.core, - org.springframework.jms.listener, - org.springframework.jms.listener.adapter, - org.springframework.jms.support.converter, - org.springframework.transaction -Bundle-Name: Server JMS diff --git a/modules/server/org.argeo.slc.server.jms/META-INF/spring/jms-osgi.xml b/modules/server/org.argeo.slc.server.jms/META-INF/spring/jms-osgi.xml deleted file mode 100644 index 0f900ba78..000000000 --- a/modules/server/org.argeo.slc.server.jms/META-INF/spring/jms-osgi.xml +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/modules/server/org.argeo.slc.server.jms/META-INF/spring/jms.xml b/modules/server/org.argeo.slc.server.jms/META-INF/spring/jms.xml deleted file mode 100644 index b7e379129..000000000 --- a/modules/server/org.argeo.slc.server.jms/META-INF/spring/jms.xml +++ /dev/null @@ -1,110 +0,0 @@ - - - - - - - - - osgibundle:jms.properties - - - - - - - - - - - - - - - - - - - - ${slc.server.jms.url} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/modules/server/org.argeo.slc.server.jms/build.properties b/modules/server/org.argeo.slc.server.jms/build.properties deleted file mode 100644 index 7594fab8d..000000000 --- a/modules/server/org.argeo.slc.server.jms/build.properties +++ /dev/null @@ -1,2 +0,0 @@ -bin.includes = META-INF/,\ - . diff --git a/modules/server/org.argeo.slc.server.jms/jms.properties b/modules/server/org.argeo.slc.server.jms/jms.properties deleted file mode 100644 index 8244f4bcb..000000000 --- a/modules/server/org.argeo.slc.server.jms/jms.properties +++ /dev/null @@ -1,2 +0,0 @@ -# TODO: duplicated with activemq bundle! -slc.server.jms.url=tcp://localhost:61616 diff --git a/modules/server/org.argeo.slc.server.main/.project b/modules/server/org.argeo.slc.server.main/.project deleted file mode 100644 index 9b86d4427..000000000 --- a/modules/server/org.argeo.slc.server.main/.project +++ /dev/null @@ -1,22 +0,0 @@ - - - org.argeo.slc.server.main - - - - - - org.eclipse.pde.ManifestBuilder - - - - - org.eclipse.pde.SchemaBuilder - - - - - - org.eclipse.pde.PluginNature - - diff --git a/modules/server/org.argeo.slc.server.main/META-INF/MANIFEST.MF b/modules/server/org.argeo.slc.server.main/META-INF/MANIFEST.MF deleted file mode 100644 index 4dc489ff5..000000000 --- a/modules/server/org.argeo.slc.server.main/META-INF/MANIFEST.MF +++ /dev/null @@ -1,6 +0,0 @@ -Manifest-Version: 1.0 -Require-Bundle: org.argeo.slc.specs,org.argeo.slc.support.equinox -Bundle-Version: 1.1.3.SNAPSHOT -Bundle-Name: SLC Server Main -Bundle-SymbolicName: org.argeo.slc.server.main -Import-Package: org.argeo.slc.build,org.argeo.slc.osgi.build diff --git a/modules/server/org.argeo.slc.server.main/META-INF/spring/eclipseUpdateSite.xml b/modules/server/org.argeo.slc.server.main/META-INF/spring/eclipseUpdateSite.xml deleted file mode 100644 index 6e8775c18..000000000 --- a/modules/server/org.argeo.slc.server.main/META-INF/spring/eclipseUpdateSite.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/modules/server/org.argeo.slc.server.main/META-INF/spring/main.xml b/modules/server/org.argeo.slc.server.main/META-INF/spring/main.xml deleted file mode 100644 index 5a763ad7e..000000000 --- a/modules/server/org.argeo.slc.server.main/META-INF/spring/main.xml +++ /dev/null @@ -1,43 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/modules/server/org.argeo.slc.server.main/META-INF/spring/manager.xml b/modules/server/org.argeo.slc.server.main/META-INF/spring/manager.xml deleted file mode 100644 index bf342bb6c..000000000 --- a/modules/server/org.argeo.slc.server.main/META-INF/spring/manager.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/modules/server/org.argeo.slc.server.main/META-INF/spring/osgi.xml b/modules/server/org.argeo.slc.server.main/META-INF/spring/osgi.xml deleted file mode 100644 index 50237f47d..000000000 --- a/modules/server/org.argeo.slc.server.main/META-INF/spring/osgi.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/modules/server/org.argeo.slc.server.main/build.properties b/modules/server/org.argeo.slc.server.main/build.properties deleted file mode 100644 index 7594fab8d..000000000 --- a/modules/server/org.argeo.slc.server.main/build.properties +++ /dev/null @@ -1,2 +0,0 @@ -bin.includes = META-INF/,\ - . diff --git a/modules/server/org.argeo.slc.server.mysql/.project b/modules/server/org.argeo.slc.server.mysql/.project deleted file mode 100644 index a45bb024e..000000000 --- a/modules/server/org.argeo.slc.server.mysql/.project +++ /dev/null @@ -1,22 +0,0 @@ - - - org.argeo.slc.server.mysql - - - - - - org.eclipse.pde.ManifestBuilder - - - - - org.eclipse.pde.SchemaBuilder - - - - - - org.eclipse.pde.PluginNature - - diff --git a/modules/server/org.argeo.slc.server.mysql/META-INF/MANIFEST.MF b/modules/server/org.argeo.slc.server.mysql/META-INF/MANIFEST.MF deleted file mode 100644 index 29ddc6009..000000000 --- a/modules/server/org.argeo.slc.server.mysql/META-INF/MANIFEST.MF +++ /dev/null @@ -1,14 +0,0 @@ -Manifest-Version: 1.0 -Require-Bundle: org.argeo.slc.specs,org.argeo.slc.core -Bundle-Version: 1.1.3.SNAPSHOT -Bundle-Name: Argeo SLC MySQL -Bundle-SymbolicName: org.argeo.slc.server.mysql -Import-Package: com.mysql.jdbc, - net.sf.ehcache.hibernate, - org.apache.commons.dbcp, - org.hibernate, - org.hibernate.hql.ast, - org.springframework.beans.factory.config, - org.springframework.cache.ehcache, - org.springframework.jdbc.datasource, - org.springframework.orm.hibernate3 diff --git a/modules/server/org.argeo.slc.server.mysql/META-INF/spring/mysql.xml b/modules/server/org.argeo.slc.server.mysql/META-INF/spring/mysql.xml deleted file mode 100644 index 4f85f569e..000000000 --- a/modules/server/org.argeo.slc.server.mysql/META-INF/spring/mysql.xml +++ /dev/null @@ -1,58 +0,0 @@ - - - - - - - - - osgibundle:mysql.properties - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/modules/server/org.argeo.slc.server.mysql/META-INF/spring/osgi.xml b/modules/server/org.argeo.slc.server.mysql/META-INF/spring/osgi.xml deleted file mode 100644 index 6d7b0e6f1..000000000 --- a/modules/server/org.argeo.slc.server.mysql/META-INF/spring/osgi.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/modules/server/org.argeo.slc.server.mysql/mysql.properties b/modules/server/org.argeo.slc.server.mysql/mysql.properties deleted file mode 100644 index 11a0d5544..000000000 --- a/modules/server/org.argeo.slc.server.mysql/mysql.properties +++ /dev/null @@ -1,3 +0,0 @@ -jdbc.url=jdbc:mysql://localhost/slc -jdbc.username=root -jdbc.password= diff --git a/modules/server/org.argeo.slc.server.services/.project b/modules/server/org.argeo.slc.server.services/.project deleted file mode 100644 index 21e00d813..000000000 --- a/modules/server/org.argeo.slc.server.services/.project +++ /dev/null @@ -1,22 +0,0 @@ - - - org.argeo.slc.server.services - - - - - - org.eclipse.pde.ManifestBuilder - - - - - org.eclipse.pde.SchemaBuilder - - - - - - org.eclipse.pde.PluginNature - - diff --git a/modules/server/org.argeo.slc.server.services/META-INF/MANIFEST.MF b/modules/server/org.argeo.slc.server.services/META-INF/MANIFEST.MF deleted file mode 100644 index 54cab2c93..000000000 --- a/modules/server/org.argeo.slc.server.services/META-INF/MANIFEST.MF +++ /dev/null @@ -1,21 +0,0 @@ -Manifest-Version: 1.0 -Bundle-Version: 1.1.3.SNAPSHOT -Bundle-Name: SLC Server Services -Bundle-SymbolicName: org.argeo.slc.server.services -Import-Package: org.aopalliance.aop, - org.argeo.security, - org.argeo.slc.core.attachment, - org.argeo.slc.dao.process, - org.argeo.slc.dao.runtime, - org.argeo.slc.dao.test, - org.argeo.slc.dao.test.tree, - org.argeo.slc.msg.event, - org.argeo.slc.msg.process, - org.argeo.slc.process, - org.argeo.slc.runtime, - org.argeo.slc.services, - org.argeo.slc.services.impl, - org.hibernate.jdbc, - org.springframework.aop, - org.springframework.aop.framework, - org.springframework.beans.factory.config diff --git a/modules/server/org.argeo.slc.server.services/META-INF/spring/services-osgi.xml b/modules/server/org.argeo.slc.server.services/META-INF/spring/services-osgi.xml deleted file mode 100644 index 0b80c6e96..000000000 --- a/modules/server/org.argeo.slc.server.services/META-INF/spring/services-osgi.xml +++ /dev/null @@ -1,42 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - org.argeo.slc.core.attachment.AttachmentsStorage - - org.argeo.slc.core.attachment.AttachmentUploader - - - - - - \ No newline at end of file diff --git a/modules/server/org.argeo.slc.server.services/META-INF/spring/services.xml b/modules/server/org.argeo.slc.server.services/META-INF/spring/services.xml deleted file mode 100644 index 39f318f72..000000000 --- a/modules/server/org.argeo.slc.server.services/META-INF/spring/services.xml +++ /dev/null @@ -1,49 +0,0 @@ - - - - - - - - osgibundle:services.properties - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/modules/server/org.argeo.slc.server.services/build.properties b/modules/server/org.argeo.slc.server.services/build.properties deleted file mode 100644 index 7594fab8d..000000000 --- a/modules/server/org.argeo.slc.server.services/build.properties +++ /dev/null @@ -1,2 +0,0 @@ -bin.includes = META-INF/,\ - . diff --git a/modules/server/org.argeo.slc.server.services/services.properties b/modules/server/org.argeo.slc.server.services/services.properties deleted file mode 100644 index 2814c6d17..000000000 --- a/modules/server/org.argeo.slc.server.services/services.properties +++ /dev/null @@ -1 +0,0 @@ -slc.server.services.pingCycle=60000 \ No newline at end of file diff --git a/modules/server/org.argeo.slc.webapp/.project b/modules/server/org.argeo.slc.webapp/.project deleted file mode 100644 index edfa86a11..000000000 --- a/modules/server/org.argeo.slc.webapp/.project +++ /dev/null @@ -1,22 +0,0 @@ - - - org.argeo.slc.webapp.war - - - - - - org.eclipse.pde.ManifestBuilder - - - - - org.eclipse.pde.SchemaBuilder - - - - - - org.eclipse.pde.PluginNature - - diff --git a/modules/server/org.argeo.slc.webapp/META-INF/MANIFEST.MF b/modules/server/org.argeo.slc.webapp/META-INF/MANIFEST.MF deleted file mode 100644 index ce1a34d90..000000000 --- a/modules/server/org.argeo.slc.webapp/META-INF/MANIFEST.MF +++ /dev/null @@ -1,59 +0,0 @@ -Manifest-Version: 1.0 -Bundle-ClassPath: WEB-INF/classes -Bundle-Version: 1.1.3.SNAPSHOT -Bundle-Name: SLC Webapp -Web-ContextPath: org.argeo.slc.webapp -Bundle-SymbolicName: org.argeo.slc.webapp -Import-Package: javax.jcr, - net.sf.cglib.core, - net.sf.cglib.proxy, - net.sf.cglib.reflect, - org.aopalliance.aop, - org.argeo.jackrabbit.remote, - org.argeo.security.mvc, - org.argeo.server, - org.argeo.jcr.mvc, - org.argeo.server.json, - org.argeo.server.mvc, - org.argeo.slc.build, - org.argeo.slc.core.attachment, - org.argeo.slc.core.test.tree, - org.argeo.slc.dao.process, - org.argeo.slc.dao.runtime, - org.argeo.slc.dao.test, - org.argeo.slc.dao.test.tree, - org.argeo.slc.deploy, - org.argeo.slc.msg.event, - org.argeo.slc.runtime, - org.argeo.slc.services, - org.argeo.slc.web.ajaxplorer.file, - org.argeo.slc.web.ajaxplorer.mvc, - org.argeo.slc.web.mvc, - org.argeo.slc.web.mvc.controllers, - org.argeo.slc.web.mvc.provisioning, - org.hibernate.hql.ast;resolution:=optional, - org.hibernate.jdbc;resolution:=optional, - org.springframework.aop, - org.springframework.aop.framework, - org.springframework.aop.scope, - org.springframework.beans.factory.support, - org.springframework.osgi.web.context.support, - org.springframework.oxm, - org.springframework.security, - org.springframework.security.config, - org.springframework.security.context, - org.springframework.security.providers, - org.springframework.security.ui, - org.springframework.security.ui.webapp, - org.springframework.security.userdetails, - org.springframework.security.userdetails.memory, - org.springframework.transaction, - org.springframework.web.context, - org.springframework.web.context.request, - org.springframework.web.context.support, - org.springframework.web.filter, - org.springframework.web.servlet, - org.springframework.web.servlet.handler, - org.springframework.web.servlet.mvc, - org.springframework.web.servlet.mvc.annotation, - org.springframework.web.servlet.view diff --git a/modules/server/org.argeo.slc.webapp/WEB-INF/ajaxplorer-servlet.xml b/modules/server/org.argeo.slc.webapp/WEB-INF/ajaxplorer-servlet.xml deleted file mode 100644 index a706606b2..000000000 --- a/modules/server/org.argeo.slc.webapp/WEB-INF/ajaxplorer-servlet.xml +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - - - - - - - - - - - - - ajxpDriverHandler - - - - - \ No newline at end of file diff --git a/modules/server/org.argeo.slc.webapp/WEB-INF/applicationContext.xml b/modules/server/org.argeo.slc.webapp/WEB-INF/applicationContext.xml deleted file mode 100644 index 1b9c09502..000000000 --- a/modules/server/org.argeo.slc.webapp/WEB-INF/applicationContext.xml +++ /dev/null @@ -1,46 +0,0 @@ - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/modules/server/org.argeo.slc.webapp/WEB-INF/doc-servlet.xml b/modules/server/org.argeo.slc.webapp/WEB-INF/doc-servlet.xml deleted file mode 100644 index 0576d0ccf..000000000 --- a/modules/server/org.argeo.slc.webapp/WEB-INF/doc-servlet.xml +++ /dev/null @@ -1,46 +0,0 @@ - - - - - - - - - - - - - - - - - - org.argeo.slc.web.mvc.XsltMarshallerView - - - - WEB-INF/xslt/ - - - .xsl - - - - - - - - - - - - - \ No newline at end of file diff --git a/modules/server/org.argeo.slc.webapp/WEB-INF/jcr-manager-servlet.xml b/modules/server/org.argeo.slc.webapp/WEB-INF/jcr-manager-servlet.xml deleted file mode 100644 index 78670a61a..000000000 --- a/modules/server/org.argeo.slc.webapp/WEB-INF/jcr-manager-servlet.xml +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/modules/server/org.argeo.slc.webapp/WEB-INF/jcr-servlet.xml b/modules/server/org.argeo.slc.webapp/WEB-INF/jcr-servlet.xml deleted file mode 100644 index 61c886765..000000000 --- a/modules/server/org.argeo.slc.webapp/WEB-INF/jcr-servlet.xml +++ /dev/null @@ -1,51 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/modules/server/org.argeo.slc.webapp/WEB-INF/osgi.xml b/modules/server/org.argeo.slc.webapp/WEB-INF/osgi.xml deleted file mode 100644 index 25dee67fd..000000000 --- a/modules/server/org.argeo.slc.webapp/WEB-INF/osgi.xml +++ /dev/null @@ -1,51 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/modules/server/org.argeo.slc.webapp/WEB-INF/provisioning-servlet.xml b/modules/server/org.argeo.slc.webapp/WEB-INF/provisioning-servlet.xml deleted file mode 100644 index bc2df745c..000000000 --- a/modules/server/org.argeo.slc.webapp/WEB-INF/provisioning-servlet.xml +++ /dev/null @@ -1,94 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - /*/*/modules.html=availableModulesHtml - /*/*/modules=availableModulesPlain - /*/*/modularDistribution=availableModulesOsgiBoot - /*/*/site.xml=updateSiteHandler - - - - - - - - - - - - - - /*/*/plugins/*=getBundleHandler - /*/*/features/*=getBundleHandler - - - - - - - - - - - - - - /*/*/*.jar=getBundleHandler - - - - - - - - - - - - /distributions=availableDistributions - - - - - - - - - - - - \ No newline at end of file diff --git a/modules/server/org.argeo.slc.webapp/WEB-INF/security.xml b/modules/server/org.argeo.slc.webapp/WEB-INF/security.xml deleted file mode 100644 index 9ae3de4a8..000000000 --- a/modules/server/org.argeo.slc.webapp/WEB-INF/security.xml +++ /dev/null @@ -1,43 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/modules/server/org.argeo.slc.webapp/WEB-INF/slc-service-servlet.xml b/modules/server/org.argeo.slc.webapp/WEB-INF/slc-service-servlet.xml deleted file mode 100644 index 73d854d7c..000000000 --- a/modules/server/org.argeo.slc.webapp/WEB-INF/slc-service-servlet.xml +++ /dev/null @@ -1,77 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/modules/server/org.argeo.slc.webapp/WEB-INF/web.xml b/modules/server/org.argeo.slc.webapp/WEB-INF/web.xml deleted file mode 100644 index a8a404215..000000000 --- a/modules/server/org.argeo.slc.webapp/WEB-INF/web.xml +++ /dev/null @@ -1,143 +0,0 @@ - - - - SLC Web Application - - - - slc-service - org.springframework.web.servlet.DispatcherServlet - - contextClass - org.springframework.osgi.web.context.support.OsgiBundleXmlWebApplicationContext - - 1 - - - slc-service - *.service - - - - - doc - org.springframework.web.servlet.DispatcherServlet - - contextClass - org.springframework.osgi.web.context.support.OsgiBundleXmlWebApplicationContext - - - - - doc - *.xls - - - doc - *.pdf - - - doc - *.xslt - - - doc - *.xml - - - - - provisioning - org.springframework.web.servlet.DispatcherServlet - - contextClass - org.springframework.osgi.web.context.support.OsgiBundleXmlWebApplicationContext - - 1 - - - provisioning - /dist/* - - - - - jcr - org.springframework.web.servlet.DispatcherServlet - - contextClass - org.springframework.osgi.web.context.support.OsgiBundleXmlWebApplicationContext - - 1 - - - jcr - *.jcr - - - - - jcr-manager - org.springframework.web.servlet.DispatcherServlet - - contextClass - org.springframework.osgi.web.context.support.OsgiBundleXmlWebApplicationContext - - 1 - - - - jcr-manager - /jcr-manager/* - - - - - ajaxplorer - org.springframework.web.servlet.DispatcherServlet - - contextClass - org.springframework.osgi.web.context.support.OsgiBundleXmlWebApplicationContext - - 1 - - - - ajaxplorer - /ajaxplorer/* - - - - - contextConfigLocation - /WEB-INF/applicationContext.xml - - - - Spring Context - org.springframework.web.context.ContextLoaderListener - - - contextClass - org.springframework.osgi.web.context.support.OsgiBundleXmlWebApplicationContext - - - - diff --git a/modules/server/org.argeo.slc.webapp/WEB-INF/webdav-config.xml b/modules/server/org.argeo.slc.webapp/WEB-INF/webdav-config.xml deleted file mode 100644 index f562d766e..000000000 --- a/modules/server/org.argeo.slc.webapp/WEB-INF/webdav-config.xml +++ /dev/null @@ -1,197 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - nt:file - nt:resource - - - - - - - - - - - - - rep - jcr - - - - - - - diff --git a/modules/server/org.argeo.slc.webapp/WEB-INF/webdav-servlet.xml b/modules/server/org.argeo.slc.webapp/WEB-INF/webdav-servlet.xml deleted file mode 100644 index 4aa318128..000000000 --- a/modules/server/org.argeo.slc.webapp/WEB-INF/webdav-servlet.xml +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - - - - - - - - - - webdavServlet - - - - - \ No newline at end of file diff --git a/modules/server/org.argeo.slc.webapp/WEB-INF/xslt/resultView.xsl b/modules/server/org.argeo.slc.webapp/WEB-INF/xslt/resultView.xsl deleted file mode 100644 index e9989bdbe..000000000 --- a/modules/server/org.argeo.slc.webapp/WEB-INF/xslt/resultView.xsl +++ /dev/null @@ -1,51 +0,0 @@ - - - - - - - - - - Result - - -

- Result - -

- -

- -

- - - - - - - - - - - - - -
- - - -
-
- - -
-
\ No newline at end of file diff --git a/modules/server/org.argeo.slc.webapp/WEB-INF/xslt/resultXmlView.xsl b/modules/server/org.argeo.slc.webapp/WEB-INF/xslt/resultXmlView.xsl deleted file mode 100644 index 87d63716f..000000000 --- a/modules/server/org.argeo.slc.webapp/WEB-INF/xslt/resultXmlView.xsl +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/modules/server/org.argeo.slc.webapp/WEB-INF/xslt/resultXsltView.xsl b/modules/server/org.argeo.slc.webapp/WEB-INF/xslt/resultXsltView.xsl deleted file mode 100644 index e9989bdbe..000000000 --- a/modules/server/org.argeo.slc.webapp/WEB-INF/xslt/resultXsltView.xsl +++ /dev/null @@ -1,51 +0,0 @@ - - - - - - - - - - Result - - -

- Result - -

- -

- -

- - - - - - - - - - - - - -
- - - -
-
- - -
-
\ No newline at end of file diff --git a/modules/server/org.argeo.slc.webapp/WEB-INF/xslt/viewXml.xsl b/modules/server/org.argeo.slc.webapp/WEB-INF/xslt/viewXml.xsl deleted file mode 100644 index 87d63716f..000000000 --- a/modules/server/org.argeo.slc.webapp/WEB-INF/xslt/viewXml.xsl +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/runtime/org.argeo.slc.support.activemq/.classpath b/runtime/org.argeo.slc.support.activemq/.classpath deleted file mode 100644 index 581598319..000000000 --- a/runtime/org.argeo.slc.support.activemq/.classpath +++ /dev/null @@ -1,8 +0,0 @@ - - - - - >> - - - diff --git a/runtime/org.argeo.slc.support.activemq/.project b/runtime/org.argeo.slc.support.activemq/.project deleted file mode 100644 index c1292c0e6..000000000 --- a/runtime/org.argeo.slc.support.activemq/.project +++ /dev/null @@ -1,28 +0,0 @@ - - - org.argeo.slc.support.activemq - - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.pde.ManifestBuilder - - - - - org.eclipse.pde.SchemaBuilder - - - - - - org.eclipse.jdt.core.javanature - org.eclipse.pde.PluginNature - - diff --git a/runtime/org.argeo.slc.support.activemq/.settings/org.eclipse.jdt.core.prefs b/runtime/org.argeo.slc.support.activemq/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 8bd7b109a..000000000 --- a/runtime/org.argeo.slc.support.activemq/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,12 +0,0 @@ -#Sat Jan 10 17:12:41 CET 2009 -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 -org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.compliance=1.5 -org.eclipse.jdt.core.compiler.debug.lineNumber=generate -org.eclipse.jdt.core.compiler.debug.localVariable=generate -org.eclipse.jdt.core.compiler.debug.sourceFile=generate -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.5 diff --git a/runtime/org.argeo.slc.support.activemq/.settings/org.maven.ide.eclipse.prefs b/runtime/org.argeo.slc.support.activemq/.settings/org.maven.ide.eclipse.prefs deleted file mode 100644 index 9b6b74ee9..000000000 --- a/runtime/org.argeo.slc.support.activemq/.settings/org.maven.ide.eclipse.prefs +++ /dev/null @@ -1,8 +0,0 @@ -#Sat Jan 10 17:11:12 CET 2009 -activeProfiles= -eclipse.preferences.version=1 -fullBuildGoals=process-test-resources -includeModules=false -resolveWorkspaceProjects=true -resourceFilterGoals=process-resources resources\:testResources -version=1 diff --git a/runtime/org.argeo.slc.support.activemq/build.properties b/runtime/org.argeo.slc.support.activemq/build.properties deleted file mode 100644 index f0cc4f1b4..000000000 --- a/runtime/org.argeo.slc.support.activemq/build.properties +++ /dev/null @@ -1,2 +0,0 @@ -source.. = src/main/java/,\ - src/main/resources/ diff --git a/runtime/org.argeo.slc.support.activemq/pom.xml b/runtime/org.argeo.slc.support.activemq/pom.xml deleted file mode 100644 index 6b3c1db5e..000000000 --- a/runtime/org.argeo.slc.support.activemq/pom.xml +++ /dev/null @@ -1,95 +0,0 @@ - - - 4.0.0 - - org.argeo.slc - runtime - 1.1.3-SNAPSHOT - .. - - org.argeo.slc.runtime - org.argeo.slc.support.activemq - SLC Support ActiveMQ - - - - org.apache.felix - maven-bundle-plugin - - - - - org.argeo.slc.jms.*,org.argeo.slc.activemq - - - javax.xml.transform;version="0.0.0", - * - - - - - - - - - - org.argeo.slc.runtime - org.argeo.slc.core - 1.1.3-SNAPSHOT - - - - - org.argeo.tp - org.springframework.jms - - - org.argeo.tp - org.springframework.oxm - - - org.argeo.tp - org.springframework.transaction - - - - - org.argeo.tp - org.aspectj.weaver - - - - - org.argeo.tp - javax.jms - - - - - org.argeo.tp - org.apache.activemq - - - org.argeo.tp - org.apache.commons.pool - - - - - org.argeo.tp - javax.management.j2ee - - - org.argeo.tp - javax.ejb - - - org.argeo.tp - javax.xml.rpc - - - org.argeo.tp - javax.servlet - - - \ No newline at end of file diff --git a/runtime/org.argeo.slc.support.activemq/src/main/java/org/argeo/slc/jms/JmsAgent.java b/runtime/org.argeo.slc.support.activemq/src/main/java/org/argeo/slc/jms/JmsAgent.java deleted file mode 100644 index 3851a2a9c..000000000 --- a/runtime/org.argeo.slc.support.activemq/src/main/java/org/argeo/slc/jms/JmsAgent.java +++ /dev/null @@ -1,198 +0,0 @@ -/* - * Copyright (C) 2007-2012 Mathieu Baudier - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.argeo.slc.jms; - -import java.util.List; - -import javax.jms.Destination; -import javax.jms.JMSException; -import javax.jms.Message; -import javax.jms.MessageListener; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.argeo.slc.SlcException; -import org.argeo.slc.core.runtime.DefaultAgent; -import org.argeo.slc.execution.ExecutionModuleDescriptor; -import org.argeo.slc.msg.ExecutionAnswer; -import org.argeo.slc.msg.MsgConstants; -import org.argeo.slc.msg.ReferenceList; -import org.argeo.slc.process.SlcExecution; -import org.argeo.slc.runtime.SlcAgentDescriptor; -import org.springframework.jms.JmsException; -import org.springframework.jms.core.JmsTemplate; -import org.springframework.jms.core.MessagePostProcessor; - -/** JMS based implementation of an SLC Agent. */ -public class JmsAgent extends DefaultAgent implements MessageListener { - public final static String PROPERTY_QUERY = "query"; - public final static String QUERY_PING_ALL = "pingAll"; - - private final static Log log = LogFactory.getLog(JmsAgent.class); - - private JmsTemplate jmsTemplate; - private Destination agentRegister; - private Destination agentUnregister; - - private Destination responseDestination; - - public void init() { - super.init(); - try { - jmsTemplate.convertAndSend(agentRegister, getAgentDescriptor()); - log.info("Agent #" + getAgentUuid() + " registered to " - + agentRegister); - } catch (JmsException e) { - log.warn("Could not register agent " - + getAgentDescriptor().getUuid() - + " to server: " - + e.getMessage() - + ". The agent will stay offline but will keep listening for a ping all sent by server."); - if (log.isTraceEnabled()) - log.debug("Original error.", e); - } - } - - @Override - public void destroy() { - try { - jmsTemplate.convertAndSend(agentUnregister, getAgentDescriptor()); - log.info("Agent #" + getAgentUuid() + " unregistered from " - + agentUnregister); - } catch (JmsException e) { - log.warn("Could not unregister agent " + getAgentUuid() + ": " - + e.getMessage()); - if (log.isTraceEnabled()) - log.debug("Original error.", e); - } - super.destroy(); - } - - public void setAgentRegister(Destination agentRegister) { - this.agentRegister = agentRegister; - } - - public void setAgentUnregister(Destination agentUnregister) { - this.agentUnregister = agentUnregister; - } - - public String getMessageSelector() { - String messageSelector = "slc_agentId='" + getAgentUuid() + "'"; - // if (log.isDebugEnabled()) - // log.debug("Message selector: " + messageSelector); - return messageSelector; - } - - public void onMessage(final Message message) { - final String query; - final String correlationId; - try { - query = message.getStringProperty(PROPERTY_QUERY); - correlationId = message.getJMSCorrelationID(); - } catch (JMSException e1) { - throw new SlcException("Cannot analyze incoming message " + message); - } - - final Object response; - final Destination destinationSend; - if (QUERY_PING_ALL.equals(query)) { - ReferenceList refList = (ReferenceList) convertFrom(message); - if (!refList.getReferences().contains(getAgentUuid())) { - response = getAgentDescriptor(); - destinationSend = agentRegister; - log.info("Agent #" + getAgentUuid() + " registering to " - + agentRegister + " in reply to a " + QUERY_PING_ALL - + " query"); - } else { - return; - } - } else { - response = process(query, message); - destinationSend = responseDestination; - } - - // Send response - if (log.isTraceEnabled()) - log.trace("About to send response " + response.getClass()); - jmsTemplate.convertAndSend(destinationSend, response, - new MessagePostProcessor() { - public Message postProcessMessage(Message messageToSend) - throws JMSException { - messageToSend.setStringProperty(PROPERTY_QUERY, query); - messageToSend.setStringProperty( - MsgConstants.PROPERTY_SLC_AGENT_ID, - getAgentUuid()); - messageToSend.setJMSCorrelationID(correlationId); - return messageToSend; - } - }); - if (log.isTraceEnabled()) - log.debug("Sent response to query '" + query - + "' with correlationId " + correlationId); - } - - /** @return response */ - public Object process(String query, Message message) { - try { - if ("getExecutionModuleDescriptor".equals(query)) { - String moduleName = message.getStringProperty("moduleName"); - String version = message.getStringProperty("version"); - return getExecutionModuleDescriptor(moduleName, version); - } else if ("listExecutionModuleDescriptors".equals(query)) { - - List lst = listExecutionModuleDescriptors(); - SlcAgentDescriptor agentDescriptorToSend = new SlcAgentDescriptor( - getAgentDescriptor()); - agentDescriptorToSend.setModuleDescriptors(lst); - return agentDescriptorToSend; - } else if ("runSlcExecution".equals(query)) { - final SlcExecution slcExecution = (SlcExecution) convertFrom(message); - new Thread() { - public void run() { - process(slcExecution); - } - }.start(); - return ExecutionAnswer.ok("Execution started on agent " - + getAgentUuid()); - } else if ("ping".equals(query)) { - return ExecutionAnswer.ok("Agent " + getAgentUuid() - + " is alive."); - } else { - throw new SlcException("Unsupported query " + query); - } - } catch (Exception e) { - log.error("Processing of query " + query + " failed", e); - return ExecutionAnswer.error(e); - } - } - - protected Object convertFrom(Message message) { - try { - return jmsTemplate.getMessageConverter().fromMessage(message); - } catch (JMSException e) { - throw new SlcException("Cannot convert message", e); - } - } - - public void setResponseDestination(Destination responseDestination) { - this.responseDestination = responseDestination; - } - - public void setJmsTemplate(JmsTemplate jmsTemplate) { - this.jmsTemplate = jmsTemplate; - } - -} diff --git a/runtime/org.argeo.slc.support.activemq/src/main/java/org/argeo/slc/jms/JmsAgentProxy.java b/runtime/org.argeo.slc.support.activemq/src/main/java/org/argeo/slc/jms/JmsAgentProxy.java deleted file mode 100644 index 3b0129fc7..000000000 --- a/runtime/org.argeo.slc.support.activemq/src/main/java/org/argeo/slc/jms/JmsAgentProxy.java +++ /dev/null @@ -1,245 +0,0 @@ -/* - * Copyright (C) 2007-2012 Mathieu Baudier - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.argeo.slc.jms; - -import java.util.List; -import java.util.UUID; - -import javax.jms.Destination; -import javax.jms.JMSException; -import javax.jms.Message; -import javax.jms.Session; -import javax.jms.TextMessage; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.argeo.slc.SlcException; -import org.argeo.slc.execution.ExecutionModuleDescriptor; -import org.argeo.slc.execution.ExecutionProcess; -import org.argeo.slc.msg.ExecutionAnswer; -import org.argeo.slc.msg.MsgConstants; -import org.argeo.slc.process.SlcExecution; -import org.argeo.slc.runtime.SlcAgent; -import org.argeo.slc.runtime.SlcAgentDescriptor; -import org.springframework.jms.core.JmsTemplate; -import org.springframework.jms.core.MessageCreator; - -public class JmsAgentProxy implements SlcAgent { - private final static Log log = LogFactory.getLog(JmsAgentProxy.class); - - private final String agentUuid; - private final Destination requestDestination; - private final Destination responseDestination; - private final JmsTemplate jmsTemplate; - - public JmsAgentProxy(String agentUuid, Destination requestDestination, - Destination responseDestination, JmsTemplate jmsTemplate) { - this.agentUuid = agentUuid; - this.requestDestination = requestDestination; - this.responseDestination = responseDestination; - this.jmsTemplate = jmsTemplate; - } - - public String getAgentUuid() { - return agentUuid; - } - - public ExecutionModuleDescriptor getExecutionModuleDescriptor( - final String moduleName, final String version) { - return (ExecutionModuleDescriptor) sendReceive(new AgentMC( - "getExecutionModuleDescriptor") { - public void setArguments(Message message) throws JMSException { - message.setStringProperty("moduleName", moduleName); - message.setStringProperty("version", version); - } - }); - } - - public List listExecutionModuleDescriptors() { - return ((SlcAgentDescriptor) sendReceive(new AgentMC( - "listExecutionModuleDescriptors"))).getModuleDescriptors(); - } - - public void runSlcExecution(SlcExecution slcExecution) { - process(slcExecution); - } - - public void process(ExecutionProcess executionProcess) { - if (!(executionProcess instanceof SlcExecution)) - throw new SlcException("Unsupported process type " - + executionProcess.getClass()); - sendReceive(new AgentMC("runSlcExecution", - (SlcExecution) executionProcess)); - } - - public boolean ping() { - Object response = sendReceive(new AgentMC("ping"), false); - if (response == null) - return false; - else { - ExecutionAnswer answer = (ExecutionAnswer) response; - return ExecutionAnswer.OK.equals(answer.getStatus()); - } - } - - public void kill(ExecutionProcess process) { - throw new UnsupportedOperationException(); - } - - protected Object sendReceive(AgentMC messageCreator) { - long begin = System.currentTimeMillis(); - Object res; - try { - res = sendReceive(messageCreator, true); - } finally { - if (log.isTraceEnabled()) - log.trace("To agent #" + agentUuid + " in " - + (System.currentTimeMillis() - begin) + " ms, query '" - + messageCreator.getQuery() + "', correlationId " - + messageCreator.getCorrelationId()); - } - return res; - } - - /** - * @param timeoutException - * if true throws an exception if reception timeouted, else - * return null - */ - protected Object sendReceive(AgentMC messageCreator, - boolean timeoutException) { - String correlationId = UUID.randomUUID().toString(); - messageCreator.setCorrelationId(correlationId); - send(messageCreator); - - Object response = processResponse(messageCreator, timeoutException); - - if (response instanceof ExecutionAnswer) { - ExecutionAnswer answer = (ExecutionAnswer) response; - if (ExecutionAnswer.ERROR.equals(answer.getStatus())) - throw new SlcException("Execution of '" - + messageCreator.getQuery() + "' failed on the agent " - + agentUuid + ": " + answer.getMessage() - + " (correlationId=" + correlationId + ")"); - else - return answer; - } else { - return response; - } - } - - protected void send(AgentMC messageCreator) { - jmsTemplate.send(requestDestination, messageCreator); - } - - protected Object processResponse(AgentMC messageCreator, - boolean timeoutException) { - String correlationId = messageCreator.getCorrelationId(); - String query = messageCreator.getQuery(); - Message responseMsg = null; - try { - responseMsg = jmsTemplate.receiveSelected(responseDestination, - "JMSCorrelationID='" + correlationId + "'"); - } catch (Exception e) { - throw new SlcException("Could not receive response from agent " - + agentUuid + " with correlationId " + correlationId - + " (query '" + query + "')", e); - } - - if (responseMsg == null) {// timeout - if (timeoutException) - throw new SlcException("TIMEOUT: Query '" + query + "'" - + " with correlationId " + correlationId - + " sent to agent " + agentUuid + " timed out."); - else - return null; - } - - try { - return fromMessage(responseMsg); - } catch (Exception e) { - throw new SlcException("Could not convert response from agent " - + agentUuid + " with correlationId " + correlationId - + " (query '" + query + "')", e); - } - } - - protected Object fromMessage(Message message) throws JMSException { - return jmsTemplate.getMessageConverter().fromMessage(message); - } - - protected Message toMessage(Object obj, Session session) - throws JMSException { - return jmsTemplate.getMessageConverter().toMessage(obj, session); - } - - protected class AgentMC implements MessageCreator { - private final String query; - private Object body = null; - private String correlationId; - - public AgentMC(String query) { - this.query = query; - } - - public AgentMC(String query, Object body) { - this.query = query; - this.body = body; - } - - public final Message createMessage(Session session) throws JMSException { - if (agentUuid == null) - throw new SlcException("Agent UUID not set"); - if (correlationId == null) - throw new SlcException("JMSCorrelationID not set"); - final Message msg; - if (body == null) - msg = session.createTextMessage(); - else - msg = toMessage(body, session); - msg.setStringProperty(MsgConstants.PROPERTY_SLC_AGENT_ID, agentUuid); - msg.setStringProperty(JmsAgent.PROPERTY_QUERY, query); - msg.setJMSCorrelationID(correlationId); - setArguments(msg); - if (msg instanceof TextMessage) { - TextMessage textMessage = (TextMessage) msg; - if (textMessage.getText() == null) { - // TODO: remove workaround when upgrading to ActiveMQ 5.3 - // Workaround for - // https://issues.apache.org/activemq/browse/AMQ-2046 - textMessage.setText(""); - } - } - return msg; - } - - protected void setArguments(Message message) throws JMSException { - } - - public String getQuery() { - return query; - } - - public String getCorrelationId() { - return correlationId; - } - - public void setCorrelationId(String correlationId) { - this.correlationId = correlationId; - } - - } -} diff --git a/runtime/org.argeo.slc.support.activemq/src/main/java/org/argeo/slc/jms/JmsAgentProxyFactory.java b/runtime/org.argeo.slc.support.activemq/src/main/java/org/argeo/slc/jms/JmsAgentProxyFactory.java deleted file mode 100644 index 683077257..000000000 --- a/runtime/org.argeo.slc.support.activemq/src/main/java/org/argeo/slc/jms/JmsAgentProxyFactory.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Copyright (C) 2007-2012 Mathieu Baudier - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.argeo.slc.jms; - -import java.util.List; -import java.util.UUID; - -import javax.jms.Destination; -import javax.jms.JMSException; -import javax.jms.Message; - -import org.argeo.slc.msg.ReferenceList; -import org.argeo.slc.runtime.SlcAgent; -import org.argeo.slc.runtime.SlcAgentFactory; -import org.springframework.jms.core.JmsTemplate; -import org.springframework.jms.core.MessagePostProcessor; - -public class JmsAgentProxyFactory implements SlcAgentFactory { - private Destination requestDestination; - private Destination responseDestination; - private Destination pingAllDestination; - private JmsTemplate jmsTemplate; - - public SlcAgent getAgent(String uuid) { - return new JmsAgentProxy(uuid, requestDestination, responseDestination, - jmsTemplate); - } - - public void pingAll(List activeAgentIds) { - ReferenceList referenceList = new ReferenceList(activeAgentIds); - jmsTemplate.convertAndSend(pingAllDestination, referenceList, - new MessagePostProcessor() { - - public Message postProcessMessage(Message message) - throws JMSException { - message.setJMSCorrelationID(UUID.randomUUID() - .toString()); - message.setStringProperty(JmsAgent.PROPERTY_QUERY, - JmsAgent.QUERY_PING_ALL); - return message; - } - }); - } - - public void setRequestDestination(Destination requestDestination) { - this.requestDestination = requestDestination; - } - - public void setResponseDestination(Destination responseDestination) { - this.responseDestination = responseDestination; - } - - public void setJmsTemplate(JmsTemplate jmsTemplate) { - this.jmsTemplate = jmsTemplate; - } - - public void setPingAllDestination(Destination pingAllDestination) { - this.pingAllDestination = pingAllDestination; - } - -} diff --git a/runtime/org.argeo.slc.support.activemq/src/main/java/org/argeo/slc/jms/JmsAttachmentListener.java b/runtime/org.argeo.slc.support.activemq/src/main/java/org/argeo/slc/jms/JmsAttachmentListener.java deleted file mode 100644 index 57725fc95..000000000 --- a/runtime/org.argeo.slc.support.activemq/src/main/java/org/argeo/slc/jms/JmsAttachmentListener.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright (C) 2007-2012 Mathieu Baudier - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.argeo.slc.jms; - -import java.io.ByteArrayInputStream; -import java.io.InputStream; - -import javax.jms.BytesMessage; -import javax.jms.JMSException; -import javax.jms.Message; -import javax.jms.MessageListener; - -import org.apache.commons.io.IOUtils; -import org.argeo.slc.SlcException; -import org.argeo.slc.core.attachment.AttachmentsStorage; -import org.argeo.slc.core.attachment.SimpleAttachment; - -public class JmsAttachmentListener implements MessageListener { - private AttachmentsStorage attachmentsStorage; - - public void onMessage(Message msg) { - BytesMessage message = (BytesMessage) msg; - - InputStream in = null; - try { - SimpleAttachment attachment = new SimpleAttachment(); - attachment.setUuid(msg - .getStringProperty(JmsAttachmentUploader.ATTACHMENT_ID)); - attachment.setName(msg - .getStringProperty(JmsAttachmentUploader.ATTACHMENT_NAME)); - attachment - .setContentType(msg - .getStringProperty(JmsAttachmentUploader.ATTACHMENT_CONTENT_TYPE)); - - // Check body length - Long bodyLength = message.getBodyLength(); - if (bodyLength > Integer.MAX_VALUE) - throw new SlcException("Attachment cannot be bigger than " - + Integer.MAX_VALUE - + " bytes with this transport. Use another transport."); - - byte[] buffer = new byte[bodyLength.intValue()]; - message.readBytes(buffer); - in = new ByteArrayInputStream(buffer); - attachmentsStorage.storeAttachment(attachment, in); - } catch (JMSException e) { - throw new SlcException("Could not process attachment message " - + msg, e); - } finally { - IOUtils.closeQuietly(in); - } - } - - public void setAttachmentsStorage(AttachmentsStorage attachmentsStorage) { - this.attachmentsStorage = attachmentsStorage; - } - -} diff --git a/runtime/org.argeo.slc.support.activemq/src/main/java/org/argeo/slc/jms/JmsAttachmentUploader.java b/runtime/org.argeo.slc.support.activemq/src/main/java/org/argeo/slc/jms/JmsAttachmentUploader.java deleted file mode 100644 index 740826675..000000000 --- a/runtime/org.argeo.slc.support.activemq/src/main/java/org/argeo/slc/jms/JmsAttachmentUploader.java +++ /dev/null @@ -1,99 +0,0 @@ -/* - * Copyright (C) 2007-2012 Mathieu Baudier - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.argeo.slc.jms; - -import java.io.IOException; -import java.io.InputStream; - -import javax.jms.BytesMessage; -import javax.jms.Destination; -import javax.jms.JMSException; -import javax.jms.Message; -import javax.jms.Session; - -import org.apache.commons.io.IOUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.argeo.slc.SlcException; -import org.argeo.slc.core.attachment.Attachment; -import org.argeo.slc.core.attachment.AttachmentUploader; -import org.springframework.core.io.Resource; -import org.springframework.jms.JmsException; -import org.springframework.jms.core.JmsTemplate; -import org.springframework.jms.core.MessageCreator; - -public class JmsAttachmentUploader implements AttachmentUploader { - private final static Log log = LogFactory - .getLog(JmsAttachmentUploader.class); - - public final static String ATTACHMENT_ID = "slc_attachmentId"; - public final static String ATTACHMENT_NAME = "slc_attachmentName"; - public final static String ATTACHMENT_CONTENT_TYPE = "slc_attachmentContentType"; - - private JmsTemplate jmsTemplate; - private Destination destination; - - public void upload(final Attachment attachment, final Resource resource) { - try { - jmsTemplate.send(destination, new MessageCreator() { - - public Message createMessage(Session session) - throws JMSException { - BytesMessage message = session.createBytesMessage(); - message.setStringProperty(ATTACHMENT_ID, attachment - .getUuid()); - message.setStringProperty(ATTACHMENT_NAME, attachment - .getName()); - message.setStringProperty(ATTACHMENT_CONTENT_TYPE, - attachment.getContentType()); - - InputStream in = null; - try { - in = resource.getInputStream(); - byte[] buffer = new byte[1024 * 1024]; - int read = -1; - while ((read = in.read(buffer)) > 0) { - message.writeBytes(buffer, 0, read); - } - } catch (IOException e) { - throw new SlcException( - "Cannot write into byte message for attachment " - + attachment + " and resource " - + resource, e); - } finally { - IOUtils.closeQuietly(in); - } - return message; - } - }); - } catch (JmsException e) { - if (log.isTraceEnabled()) - log.debug("Cannot upload", e); - else if (log.isDebugEnabled()) - log.debug("Cannot upload: " + e.getMessage()); - } - - } - - public void setJmsTemplate(JmsTemplate jmsTemplate) { - this.jmsTemplate = jmsTemplate; - } - - public void setDestination(Destination destination) { - this.destination = destination; - } - -} diff --git a/runtime/org.argeo.slc.support.activemq/src/main/java/org/argeo/slc/jms/JmsExecutionHandler.java b/runtime/org.argeo.slc.support.activemq/src/main/java/org/argeo/slc/jms/JmsExecutionHandler.java deleted file mode 100644 index 9239c7a33..000000000 --- a/runtime/org.argeo.slc.support.activemq/src/main/java/org/argeo/slc/jms/JmsExecutionHandler.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright (C) 2007-2012 Mathieu Baudier - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.argeo.slc.jms; - -import javax.jms.JMSException; -import javax.jms.Message; -import javax.jms.MessageListener; - -import org.argeo.slc.SlcException; -import org.argeo.slc.msg.MsgHandler; -import org.springframework.jms.support.converter.MessageConverter; - -public class JmsExecutionHandler implements MessageListener { - - private MessageConverter messageConverter; - private MsgHandler serviceMsgHandler; - - public void onMessage(Message message) { - try { - serviceMsgHandler.handleMsg(messageConverter.fromMessage(message)); - } catch (JMSException e) { - throw new SlcException("Could not interpret message " + message, e); - } - } - - public void setMessageConverter(MessageConverter messageConverter) { - this.messageConverter = messageConverter; - } - - public void setServiceMsgHandler(MsgHandler serviceMsgHandler) { - this.serviceMsgHandler = serviceMsgHandler; - } - -} diff --git a/runtime/org.argeo.slc.support.activemq/src/main/java/org/argeo/slc/jms/JmsSlcEventListener.java b/runtime/org.argeo.slc.support.activemq/src/main/java/org/argeo/slc/jms/JmsSlcEventListener.java deleted file mode 100644 index 35cbc70d8..000000000 --- a/runtime/org.argeo.slc.support.activemq/src/main/java/org/argeo/slc/jms/JmsSlcEventListener.java +++ /dev/null @@ -1,234 +0,0 @@ -/* - * Copyright (C) 2007-2012 Mathieu Baudier - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.argeo.slc.jms; - -import java.util.ArrayList; -import java.util.List; -import java.util.UUID; - -import javax.jms.Connection; -import javax.jms.ConnectionFactory; -import javax.jms.JMSException; -import javax.jms.Message; -import javax.jms.Session; -import javax.jms.Topic; -import javax.jms.TopicSubscriber; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.argeo.slc.SlcException; -import org.argeo.slc.msg.event.SlcEvent; -import org.argeo.slc.msg.event.SlcEventListener; -import org.argeo.slc.msg.event.SlcEventListenerDescriptor; -import org.springframework.jms.connection.ConnectionFactoryUtils; -import org.springframework.jms.support.JmsUtils; -import org.springframework.jms.support.converter.MessageConverter; - -public class JmsSlcEventListener implements SlcEventListener { - private final static Log log = LogFactory.getLog(JmsSlcEventListener.class); - - // IoC - private Topic eventsDestination; - private ConnectionFactory jmsConnectionFactory; - private MessageConverter messageConverter; - - // Initialized with init() method, released with close() - private Connection connection = null; - - // One by instance - private String connectionClientId = getClass() + "#" - + UUID.randomUUID().toString(); - private Boolean isClosed = false; - - private List subscriberIds = new ArrayList(); - - // private Map clients = Collections - // .synchronizedMap(new HashMap()); - - public SlcEvent listen(String subscriberId, - List descriptors, Long timeout) { - if (descriptors.size() == 0) { - // No listener, just waiting - try { - if (log.isTraceEnabled()) - log.trace("No event listener registered, sleeping..."); - Thread.sleep(timeout); - } catch (InterruptedException e) { - // silent - } - return null; - } else { - Object obj = null; - synchronized (subscriberIds) { - while (subscriberIds.contains(subscriberId)) { - try { - subscriberIds.wait(500); - if (isClosed) - return null; - } catch (InterruptedException e) { - // silent - } - } - subscriberIds.add(subscriberId); - Session session = null; - TopicSubscriber topicSubscriber = null; - try { - // ListeningClient client = (ListeningClient) - // getClient(clientId); - session = connection.createSession(false, - Session.AUTO_ACKNOWLEDGE); - topicSubscriber = session.createDurableSubscriber( - eventsDestination, subscriberId, - createSelector(descriptors), true); - Message message = topicSubscriber.receive(timeout); - obj = messageConverter.fromMessage(message); - } catch (JMSException e) { - throw new SlcException("Cannot poll events for subscriber " - + subscriberId, e); - } finally { - JmsUtils.closeMessageConsumer(topicSubscriber); - JmsUtils.closeSession(session); - subscriberIds.remove(subscriberId); - subscriberIds.notifyAll(); - } - - } - - if (obj == null) - return null; - else - return (SlcEvent) obj; - } - } - - /** Returns null if no filter */ - protected String createSelector(List descriptors) { - if (descriptors.size() == 0) - throw new SlcException("No listeners, cannot generate JMS selector"); - - StringBuffer buf = new StringBuffer(256); - Boolean first = true; - for (SlcEventListenerDescriptor descriptor : descriptors) { - if (first) - first = false; - else - buf.append(" OR "); - - buf.append('('); - buf.append(SlcEvent.EVENT_TYPE).append("=").append('\'').append( - descriptor.getEventType()).append('\''); - if (descriptor.getFilter() != null) { - buf.append(" AND "); - buf.append('(').append(descriptor.getFilter()).append(')'); - } - buf.append(')'); - } - if (log.isTraceEnabled()) - log.trace("selector created : " + buf.toString()); - return buf.toString(); - } - - public boolean isClosed() { - return isClosed; - } - - // Ioc - public void setEventsDestination(Topic eventsDestination) { - this.eventsDestination = eventsDestination; - } - - public void setJmsConnectionFactory(ConnectionFactory jmsConnectionFactory) { - this.jmsConnectionFactory = jmsConnectionFactory; - } - - public void setMessageConverter(MessageConverter messageConverter) { - this.messageConverter = messageConverter; - } - - // Life Cycle - public void init() { - try { - connection = jmsConnectionFactory.createConnection(); - connection.setClientID(connectionClientId); - connection.start(); - } catch (JMSException e) { - throw new SlcException("Could not init connection", e); - } - } - - public void close() { - ConnectionFactoryUtils.releaseConnection(connection, - jmsConnectionFactory, true); - isClosed = true; - synchronized (subscriberIds) { - subscriberIds.notifyAll(); - } - } - - // public void close(String clientId) { - // // Session session = null; - // // // ListeningClient client = getClient(clientId); - // // // Connection connection = client.getConnection(); - // // try { - // // session = client.getSession(); - // // session.unsubscribe(clientId); - // // } catch (JMSException e) { - // // log.warn("Could not unsubscribe client " + clientId, e); - // // } finally { - // // JmsUtils.closeSession(session); - // // } - // // - // // // synchronized (client) { - // // // clients.remove(clientId); - // // // client.notify(); - // // // } - // } - - // protected ListeningClient getClient(String clientId) { - // ListeningClient client = clients.get(clientId); - // if (client == null) { - // // Lazy init - // client = new ListeningClient(connection); - // clients.put(clientId, client); - // } - // return client; - // } - - // protected class ListeningClient { - // private final Connection connection; - // private final Session session; - // - // public ListeningClient(Connection connection) { - // super(); - // this.connection = connection; - // try { - // session = connection.createSession(false, - // Session.AUTO_ACKNOWLEDGE); - // } catch (JMSException e) { - // throw new SlcException("Cannot create session"); - // } - // } - // - // public Connection getConnection() { - // return connection; - // } - // - // public Session getSession() { - // return session; - // } - // - // } -} diff --git a/runtime/org.argeo.slc.support.activemq/src/main/java/org/argeo/slc/jms/JmsSlcEventPublisher.java b/runtime/org.argeo.slc.support.activemq/src/main/java/org/argeo/slc/jms/JmsSlcEventPublisher.java deleted file mode 100644 index a95ffc810..000000000 --- a/runtime/org.argeo.slc.support.activemq/src/main/java/org/argeo/slc/jms/JmsSlcEventPublisher.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright (C) 2007-2012 Mathieu Baudier - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.argeo.slc.jms; - -import java.util.Map; - -import javax.jms.DeliveryMode; -import javax.jms.Destination; -import javax.jms.JMSException; -import javax.jms.Message; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.argeo.slc.SlcException; -import org.argeo.slc.msg.event.SlcEvent; -import org.argeo.slc.msg.event.SlcEventPublisher; -import org.springframework.jms.core.JmsTemplate; -import org.springframework.jms.core.MessagePostProcessor; - -public class JmsSlcEventPublisher implements SlcEventPublisher { - private static final Log log = LogFactory - .getLog(JmsSlcEventPublisher.class); - private Destination eventsDestination; - private JmsTemplate jmsTemplate; - - public void publish(final SlcEvent event) { - if (jmsTemplate.getDeliveryMode() != DeliveryMode.PERSISTENT) - throw new SlcException( - "Delivery mode has to be persistent in order to have durable subscription"); - - jmsTemplate.convertAndSend(eventsDestination, event, - new MessagePostProcessor() { - - public Message postProcessMessage(Message message) - throws JMSException { - Map headers = event.getHeaders(); - for (String key : headers.keySet()) { - message.setStringProperty(key, headers.get(key)); - } - return message; - } - }); - if (log.isTraceEnabled()) { - log.trace("Event " + event.toString() + " sent to " - + eventsDestination.toString()); - } - - } - - public void setEventsDestination(Destination eventsDestination) { - this.eventsDestination = eventsDestination; - } - - public void setJmsTemplate(JmsTemplate jmsTemplate) { - this.jmsTemplate = jmsTemplate; - } - -} diff --git a/runtime/org.argeo.slc.support.activemq/src/main/java/org/argeo/slc/jms/JmsSlcExecutionNotifier.java b/runtime/org.argeo.slc.support.activemq/src/main/java/org/argeo/slc/jms/JmsSlcExecutionNotifier.java deleted file mode 100644 index 4e68db35e..000000000 --- a/runtime/org.argeo.slc.support.activemq/src/main/java/org/argeo/slc/jms/JmsSlcExecutionNotifier.java +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Copyright (C) 2007-2012 Mathieu Baudier - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.argeo.slc.jms; - -import java.util.List; - -import javax.jms.Destination; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.argeo.slc.UnsupportedException; -import org.argeo.slc.execution.ExecutionProcess; -import org.argeo.slc.execution.ExecutionStep; -import org.argeo.slc.msg.process.SlcExecutionStatusRequest; -import org.argeo.slc.msg.process.SlcExecutionStepsRequest; -import org.argeo.slc.process.SlcExecution; -import org.argeo.slc.process.SlcExecutionNotifier; -import org.argeo.slc.process.SlcExecutionStep; -import org.springframework.jms.JmsException; -import org.springframework.jms.core.JmsTemplate; - -@SuppressWarnings("deprecation") -public class JmsSlcExecutionNotifier implements SlcExecutionNotifier { - private final static Log log = LogFactory - .getLog(JmsSlcExecutionNotifier.class); - - private JmsTemplate jmsTemplate; - - private Destination executionEventDestination; - - // private Destination updateStatusDestination; - - public void updateStatus(ExecutionProcess slcExecution, String oldStatus, - String newStatus) { - SlcExecutionStatusRequest req = new SlcExecutionStatusRequest( - slcExecution.getUuid(), newStatus); - convertAndSend(req); - } - - public void addSteps(ExecutionProcess slcExecution, - List additionalSteps) { - SlcExecutionStepsRequest req = new SlcExecutionStepsRequest( - slcExecution.getUuid(), additionalSteps); - convertAndSend(req); - } - - public void newExecution(SlcExecution slcExecution) { - throw new UnsupportedException(); - } - - public void updateExecution(SlcExecution slcExecution) { - throw new UnsupportedException(); - } - - public void setJmsTemplate(JmsTemplate jmsTemplate) { - this.jmsTemplate = jmsTemplate; - } - - public void setExecutionEventDestination( - Destination executionEventDestination) { - this.executionEventDestination = executionEventDestination; - } - - protected void convertAndSend(Object req) { - try { - jmsTemplate.convertAndSend(executionEventDestination, req); - } catch (JmsException e) { - log.warn("Send request " + req.getClass() + " to server: " - + e.getMessage()); - if (log.isTraceEnabled()) - log.debug("Original error.", e); - } - } -} diff --git a/runtime/org.argeo.slc.support.activemq/src/main/java/org/argeo/slc/jms/JmsTreeTestResultListener.java b/runtime/org.argeo.slc.support.activemq/src/main/java/org/argeo/slc/jms/JmsTreeTestResultListener.java deleted file mode 100644 index 2cd88c490..000000000 --- a/runtime/org.argeo.slc.support.activemq/src/main/java/org/argeo/slc/jms/JmsTreeTestResultListener.java +++ /dev/null @@ -1,148 +0,0 @@ -/* - * Copyright (C) 2007-2012 Mathieu Baudier - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.argeo.slc.jms; - -import javax.jms.Destination; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.argeo.slc.SlcException; -import org.argeo.slc.core.attachment.Attachment; -import org.argeo.slc.core.attachment.SimpleAttachment; -import org.argeo.slc.core.test.tree.TreeTestResult; -import org.argeo.slc.core.test.tree.TreeTestResultListener; -import org.argeo.slc.msg.test.tree.AddTreeTestResultAttachmentRequest; -import org.argeo.slc.msg.test.tree.CloseTreeTestResultRequest; -import org.argeo.slc.msg.test.tree.CreateTreeTestResultRequest; -import org.argeo.slc.msg.test.tree.ResultPartRequest; -import org.argeo.slc.test.TestResultPart; -import org.springframework.jms.JmsException; -import org.springframework.jms.core.JmsTemplate; - -/** JMS based tree test result listener implementation. */ -public class JmsTreeTestResultListener implements TreeTestResultListener { - private final Log log = LogFactory.getLog(getClass()); - - private Boolean onlyOnClose = false; - private JmsTemplate jmsTemplate; - - private Destination executionEventDestination; - - public void resultPartAdded(TreeTestResult testResult, - TestResultPart testResultPart) { - if (onlyOnClose) - return; - - try { - if (testResult.getResultParts().size() == 1 - && testResult.getResultParts().values().iterator().next() - .getParts().size() == 1) { - CreateTreeTestResultRequest req = new CreateTreeTestResultRequest( - testResult); - - if (log.isTraceEnabled()) - log.trace("Send create result request for result " - + testResult.getUuid()); - - jmsTemplate.convertAndSend(executionEventDestination, req); - } else { - ResultPartRequest req = new ResultPartRequest(testResult); - - if (log.isTraceEnabled()) - log.trace("Send result parts for result " - + testResult.getUuid()); - - jmsTemplate.convertAndSend(executionEventDestination, req); - } - } catch (JmsException e) { - log.warn("Could not notify result part to server: " - + e.getMessage()); - if (log.isTraceEnabled()) - log.debug("Original error.", e); - } catch (Exception e) { - throw new SlcException("Could not notify to JMS", e); - } - } - - public void close(TreeTestResult testResult) { - try { - if (onlyOnClose) { - CreateTreeTestResultRequest req = new CreateTreeTestResultRequest( - testResult); - - if (log.isTraceEnabled()) - log.trace("Send onClose create result request for result " - + testResult.getUuid()); - - jmsTemplate.convertAndSend(executionEventDestination, req); - } else { - CloseTreeTestResultRequest req = new CloseTreeTestResultRequest( - testResult); - - if (log.isTraceEnabled()) - log.trace("Send close result request for result " - + testResult.getUuid()); - - jmsTemplate.convertAndSend(executionEventDestination, req); - - } - } catch (JmsException e) { - log.warn("Could not notify result close to server: " - + e.getMessage()); - if (log.isTraceEnabled()) - log.debug("Original error.", e); - } catch (Exception e) { - throw new SlcException("Could not notify to JMS", e); - } - } - - public void addAttachment(TreeTestResult testResult, Attachment attachment) { - if (onlyOnClose) - return; - - try { - AddTreeTestResultAttachmentRequest req = new AddTreeTestResultAttachmentRequest(); - req.setResultUuid(testResult.getUuid()); - req.setAttachment((SimpleAttachment) attachment); - jmsTemplate.convertAndSend(executionEventDestination, req); - - } catch (JmsException e) { - log - .warn("Could not notify attachment to server: " - + e.getMessage()); - if (log.isTraceEnabled()) - log.debug("Original error.", e); - } catch (Exception e) { - throw new SlcException("Could not notify to JMS", e); - } - - } - - /** Publishes the test result only when it gets closed. */ - public void setOnlyOnClose(Boolean onlyOnClose) { - this.onlyOnClose = onlyOnClose; - } - - public void setJmsTemplate(JmsTemplate jmsTemplate) { - this.jmsTemplate = jmsTemplate; - } - - public void setExecutionEventDestination( - Destination executionEventDestination) { - this.executionEventDestination = executionEventDestination; - } - -} diff --git a/runtime/org.argeo.slc.support.activemq/src/main/java/org/argeo/slc/jms/MarshallerMessageConverter.java b/runtime/org.argeo.slc.support.activemq/src/main/java/org/argeo/slc/jms/MarshallerMessageConverter.java deleted file mode 100644 index 797abb910..000000000 --- a/runtime/org.argeo.slc.support.activemq/src/main/java/org/argeo/slc/jms/MarshallerMessageConverter.java +++ /dev/null @@ -1,123 +0,0 @@ -/* - * Copyright (C) 2007-2012 Mathieu Baudier - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.argeo.slc.jms; - -import java.io.Serializable; -import java.util.Enumeration; - -import javax.jms.JMSException; -import javax.jms.Message; -import javax.jms.ObjectMessage; -import javax.jms.Session; -import javax.jms.TextMessage; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.argeo.slc.SlcException; -import org.springframework.jms.support.converter.MessageConversionException; -import org.springframework.jms.support.converter.MessageConverter; -import org.springframework.oxm.Marshaller; -import org.springframework.oxm.Unmarshaller; -import org.springframework.xml.transform.StringResult; -import org.springframework.xml.transform.StringSource; - -public class MarshallerMessageConverter implements MessageConverter { - private final static Log log = LogFactory - .getLog(MarshallerMessageConverter.class); - - private Marshaller marshaller; - private Unmarshaller unmarshaller; - - /** Use unmarshalled ObjectMessages instead of TextMessages */ - private Boolean disableMarshalling = false; - - /** @return the converted message or null if the message itself is null */ - @SuppressWarnings("unchecked") - public Object fromMessage(Message message) throws JMSException, - MessageConversionException { - long begin = System.currentTimeMillis(); - if (message == null) - return null; - if (log.isTraceEnabled()) { - Enumeration names = message.getPropertyNames(); - while (names.hasMoreElements()) { - String name = names.nextElement(); - log.trace("JMS Property: " + name + "=" - + message.getObjectProperty(name)); - } - } - - Object res; - if (message instanceof TextMessage) { - String text = ((TextMessage) message).getText(); - if (text == null) - throw new SlcException( - "Cannot unmarshall message without body: " + message); - try { - res = unmarshaller.unmarshal(new StringSource(text)); - } catch (Exception e) { - throw new SlcException("Could not unmarshall " + text, e); - } - } else if (message instanceof ObjectMessage) { - res = ((ObjectMessage) message).getObject(); - if (res == null) - throw new SlcException("Message without body: " + message); - } else { - throw new SlcException("This type of messages is not supported: " - + message); - } - if (log.isTraceEnabled()) - log.trace("'From' message processed in " + (System.currentTimeMillis() - begin) - + " ms"); - return res; - } - - public Message toMessage(Object object, Session session) - throws JMSException, MessageConversionException { - long begin = System.currentTimeMillis(); - Message msg; - if (disableMarshalling) { - msg = session.createObjectMessage(); - ((ObjectMessage) msg).setObject((Serializable) object); - } else { - StringResult result = new StringResult(); - try { - marshaller.marshal(object, result); - } catch (Exception e) { - throw new SlcException("Could not marshall " + object, e); - } - msg = session.createTextMessage(); - ((TextMessage) msg).setText(result.toString()); - } - if (log.isTraceEnabled()) - log.trace("'To' message processed in " + (System.currentTimeMillis() - begin) - + " ms"); - return msg; - } - - public void setMarshaller(Marshaller marshaller) { - this.marshaller = marshaller; - } - - public void setUnmarshaller(Unmarshaller unmarshaller) { - this.unmarshaller = unmarshaller; - } - - public void setDisableMarshalling(Boolean disableMarshalling) { - this.disableMarshalling = disableMarshalling; - } - -} diff --git a/runtime/org.argeo.slc.support.activemq/src/main/java/org/argeo/slc/jms/ServiceMessageListenerAdapter.java b/runtime/org.argeo.slc.support.activemq/src/main/java/org/argeo/slc/jms/ServiceMessageListenerAdapter.java deleted file mode 100644 index b35034041..000000000 --- a/runtime/org.argeo.slc.support.activemq/src/main/java/org/argeo/slc/jms/ServiceMessageListenerAdapter.java +++ /dev/null @@ -1,140 +0,0 @@ -/* - * Copyright (C) 2007-2012 Mathieu Baudier - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.argeo.slc.jms; - -import java.io.PrintWriter; -import java.io.StringWriter; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import javax.jms.JMSException; -import javax.jms.Message; -import javax.jms.Session; - -import org.argeo.slc.SlcException; -import org.argeo.slc.msg.ExecutionAnswer; -import org.springframework.jms.listener.adapter.MessageListenerAdapter; - -public class ServiceMessageListenerAdapter extends MessageListenerAdapter { - public final static String DEFAULT_METHOD_NAME_PARAMETER = "action"; - public final static String BODY_ARGUMENT = "BODY"; - - private Map> methodArguments = new HashMap>(); - - private static String methodNameParameter = DEFAULT_METHOD_NAME_PARAMETER; - - @Override - protected Object extractMessage(Message message) throws JMSException { - return new ExtractedMessage(message); - } - - @Override - protected String getListenerMethodName(Message originalMessage, - Object extractedMessage) throws JMSException { - return ((ExtractedMessage) extractedMessage).methodName; - } - - @Override - protected Object[] buildListenerArguments(Object extractedMessage) { - return ((ExtractedMessage) extractedMessage).arguments; - } - - @Override - public void onMessage(Message message, Session session) throws JMSException { - try {// hacked and simplified from parent class - // Regular case: find a handler method reflectively. - Object convertedMessage = extractMessage(message); - String methodName = getListenerMethodName(message, convertedMessage); - - // Invoke the handler method with appropriate arguments. - Object[] listenerArguments = buildListenerArguments(convertedMessage); - Object result = invokeListenerMethod(methodName, listenerArguments); - if (result != null) { - handleResult(result, message, session); - } else { - ExecutionAnswer answer = ExecutionAnswer.ok("Execution of " - + methodName + " on " + getDelegate() + " succeeeded."); - Message okMessage = getMessageConverter().toMessage(answer, - session); - sendResponse(session, getResponseDestination(message, - okMessage, session), okMessage); - } - } catch (Exception e) { - if (session == null) - return; - - StringWriter writer = new StringWriter(); - e.printStackTrace(new PrintWriter(writer)); - ExecutionAnswer answer = ExecutionAnswer.error(writer.toString()); - Message errorMessage = getMessageConverter().toMessage(answer, - session); - sendResponse(session, getResponseDestination(message, errorMessage, - session), errorMessage); - } - } - - protected class ExtractedMessage { - private final String methodName; - private final Object[] arguments; -// private final Message originalMessage; - - public ExtractedMessage(Message originalMessage) throws JMSException { -// this.originalMessage = originalMessage; - - if (!originalMessage.propertyExists(methodNameParameter)) - throw new SlcException("No property " + methodNameParameter - + " in incoming message," - + " cannot determine service method"); - - methodName = originalMessage.getStringProperty(methodNameParameter); - - if (!methodArguments.containsKey(methodName)) {// no arg specified - arguments = new Object[0]; - } else { - List parameterNames = methodArguments.get(methodName); - List arguments = new ArrayList(); - int count = 0; - for (String name : parameterNames) { - if (name.equals(BODY_ARGUMENT)) { - Object body = getMessageConverter().fromMessage( - originalMessage); - arguments.add(body); - } else { - if (!originalMessage.propertyExists(name)) - throw new SlcException("No property " + name - + " in incoming message," - + " cannot determine argument #" + count); - arguments.add(originalMessage.getObjectProperty(name)); - } - count++; - } - this.arguments = arguments.toArray(); - } - } - } - - public void setMethodArguments(Map> methodArguments) { - this.methodArguments = methodArguments; - } - - public static void setMethodNameParameter(String methodNameParameter) { - ServiceMessageListenerAdapter.methodNameParameter = methodNameParameter; - } - - -} diff --git a/runtime/org.argeo.slc.support.activemq/src/main/resources/org/argeo/slc/activemq/destinations.xml b/runtime/org.argeo.slc.support.activemq/src/main/resources/org/argeo/slc/activemq/destinations.xml deleted file mode 100644 index 4a27b6330..000000000 --- a/runtime/org.argeo.slc.support.activemq/src/main/resources/org/argeo/slc/activemq/destinations.xml +++ /dev/null @@ -1,53 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/runtime/org.argeo.slc.support.castor/.classpath b/runtime/org.argeo.slc.support.castor/.classpath deleted file mode 100644 index 238982686..000000000 --- a/runtime/org.argeo.slc.support.castor/.classpath +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - diff --git a/runtime/org.argeo.slc.support.castor/.project b/runtime/org.argeo.slc.support.castor/.project deleted file mode 100644 index c0bc103dd..000000000 --- a/runtime/org.argeo.slc.support.castor/.project +++ /dev/null @@ -1,28 +0,0 @@ - - - org.argeo.slc.support.castor - - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.pde.ManifestBuilder - - - - - org.eclipse.pde.SchemaBuilder - - - - - - org.eclipse.jdt.core.javanature - org.eclipse.pde.PluginNature - - diff --git a/runtime/org.argeo.slc.support.castor/.settings/org.eclipse.jdt.core.prefs b/runtime/org.argeo.slc.support.castor/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 93d31747f..000000000 --- a/runtime/org.argeo.slc.support.castor/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,12 +0,0 @@ -#Fri Aug 29 11:10:18 CEST 2008 -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 -org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.compliance=1.5 -org.eclipse.jdt.core.compiler.debug.lineNumber=generate -org.eclipse.jdt.core.compiler.debug.localVariable=generate -org.eclipse.jdt.core.compiler.debug.sourceFile=generate -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.5 diff --git a/runtime/org.argeo.slc.support.castor/build.properties b/runtime/org.argeo.slc.support.castor/build.properties deleted file mode 100644 index a3d626614..000000000 --- a/runtime/org.argeo.slc.support.castor/build.properties +++ /dev/null @@ -1,8 +0,0 @@ -additional.bundles = org.argeo.slc.unit,\ - junit,\ - org.apache.xml.serializer,\ - org.apache.xerces -source.. = src/main/java/,\ - src/main/resources/,\ - src/test/java/,\ - src/test/resources/ diff --git a/runtime/org.argeo.slc.support.castor/pom.xml b/runtime/org.argeo.slc.support.castor/pom.xml deleted file mode 100644 index 9ba9f6b90..000000000 --- a/runtime/org.argeo.slc.support.castor/pom.xml +++ /dev/null @@ -1,98 +0,0 @@ - - 4.0.0 - - org.argeo.slc - runtime - 1.1.3-SNAPSHOT - .. - - org.argeo.slc.runtime - org.argeo.slc.support.castor - SLC Support Castor - Implementations of SLC Specs using Castor - - - - org.apache.felix - maven-bundle-plugin - - - - - org.argeo.slc.* - - - org.argeo.slc.*;resolution:=optional, - org.argeo.slc.deploy;resolution:=optional, - org.argeo.slc.build;resolution:=optional, - org.argeo.slc.execution;resolution:=optional, - org.argeo.slc.core.attachment;resolution:=optional, - org.argeo.slc.core.structure;resolution:=optional, - org.argeo.slc.core.structure.tree;resolution:=optional, - org.argeo.slc.core.test;resolution:=optional, - org.argeo.slc.core.test.tree;resolution:=optional, - org.argeo.slc.runtime;resolution:=optional, - org.argeo.slc.core.execution;resolution:=optional, - org.argeo.slc.msg;resolution:=optional, - org.argeo.slc.msg.build;resolution:=optional, - org.argeo.slc.msg.process;resolution:=optional, - org.argeo.slc.msg.event;resolution:=optional, - org.argeo.slc.msg.test.tree;resolution:=optional, - org.argeo.slc.detached;resolution:=optional, - org.apache.xml.serialize;resolution:=optional, - org.apache.xerces.jaxp;resolution:=optional, - org.w3c.dom.*;version="0.0.0";resolution:=optional, - org.xml.sax.*;version="0.0.0";resolution:=optional, - javax.xml.transform.*;version="0.0.0";resolution:=optional, - javax.xml.parsers.*;version="0.0.0";resolution:=optional, - org.springframework.xml.validation;resolution:=optional, - org.apache.commons.io, - org.springframework.oxm, - org.springframework.core, - org.springframework.xml.transform, - org.springframework.core.io, - * - - org.castor - - - - - - - - - org.argeo.slc.runtime - org.argeo.slc.core - 1.1.3-SNAPSHOT - - - - org.argeo.tp - org.springframework.oxm - - - - org.argeo.tp - org.castor - - - - org.argeo.tp - org.apache.xerces - - - - org.argeo.tp - org.apache.xalan - - - - - org.argeo.slc.runtime - org.argeo.slc.unit - test - 1.1.3-SNAPSHOT - - - \ No newline at end of file diff --git a/runtime/org.argeo.slc.support.castor/src/main/java/org/argeo/slc/castor/execution/PrimitiveFieldHandler.java b/runtime/org.argeo.slc.support.castor/src/main/java/org/argeo/slc/castor/execution/PrimitiveFieldHandler.java deleted file mode 100644 index 4a250e4cf..000000000 --- a/runtime/org.argeo.slc.support.castor/src/main/java/org/argeo/slc/castor/execution/PrimitiveFieldHandler.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright (C) 2007-2012 Mathieu Baudier - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.argeo.slc.castor.execution; - -import org.argeo.slc.core.execution.PrimitiveAccessor; -import org.argeo.slc.core.execution.PrimitiveUtils; -import org.exolab.castor.mapping.AbstractFieldHandler; - -public class PrimitiveFieldHandler extends AbstractFieldHandler { - - @Override - public Object getValue(Object object) throws IllegalStateException { - if (object == null) - return null; - - Object value = ((PrimitiveAccessor) object).getValue(); - return value != null ? value.toString() : null; - } - - @Override - public Object newInstance(Object parent, Object[] args) - throws IllegalStateException { - return null; - } - - @Override - public Object newInstance(Object parent) throws IllegalStateException { - return null; - } - - @Override - public void resetValue(Object object) throws IllegalStateException, - IllegalArgumentException { - } - - @Override - public void setValue(Object object, Object value) - throws IllegalStateException, IllegalArgumentException { - PrimitiveAccessor primitiveAccessor = (PrimitiveAccessor) object; - String type = primitiveAccessor.getType(); - String str = value.toString(); - primitiveAccessor.setValue(PrimitiveUtils.convert(type, str)); - } - -} diff --git a/runtime/org.argeo.slc.support.castor/src/main/java/org/argeo/slc/castor/structure/tree/TreeSPathFieldHandler.java b/runtime/org.argeo.slc.support.castor/src/main/java/org/argeo/slc/castor/structure/tree/TreeSPathFieldHandler.java deleted file mode 100644 index 5d56fb99f..000000000 --- a/runtime/org.argeo.slc.support.castor/src/main/java/org/argeo/slc/castor/structure/tree/TreeSPathFieldHandler.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (C) 2007-2012 Mathieu Baudier - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.argeo.slc.castor.structure.tree; - -import org.exolab.castor.mapping.AbstractFieldHandler; -import org.exolab.castor.mapping.MapItem; - -import org.argeo.slc.core.structure.tree.TreeSPath; - -public class TreeSPathFieldHandler extends AbstractFieldHandler { - - @Override - public Object getValue(Object object) throws IllegalStateException { - MapItem part = (MapItem) object; - return ((TreeSPath) part.getKey()).getAsUniqueString(); - } - - @Override - public Object newInstance(Object parent) throws IllegalStateException { - return null; - } - - @Override - public Object newInstance(Object parent, Object[] args) - throws IllegalStateException { - return null; - } - - @Override - public void resetValue(Object object) throws IllegalStateException, - IllegalArgumentException { - MapItem part = (MapItem) object; - part.setKey(null); - } - - @Override - public void setValue(Object object, Object value) - throws IllegalStateException, IllegalArgumentException { - MapItem part = (MapItem) object; - part.setKey(new TreeSPath(value.toString())); - } - -} diff --git a/runtime/org.argeo.slc.support.castor/src/main/java/org/argeo/slc/castor/test/tree/StatusFieldHandler.java b/runtime/org.argeo.slc.support.castor/src/main/java/org/argeo/slc/castor/test/tree/StatusFieldHandler.java deleted file mode 100644 index a69eb87da..000000000 --- a/runtime/org.argeo.slc.support.castor/src/main/java/org/argeo/slc/castor/test/tree/StatusFieldHandler.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright (C) 2007-2012 Mathieu Baudier - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.argeo.slc.castor.test.tree; - -import org.argeo.slc.core.test.SimpleResultPart; -import org.argeo.slc.core.test.SlcTestUtils; -import org.argeo.slc.test.TestStatus; -import org.exolab.castor.mapping.AbstractFieldHandler; - -public class StatusFieldHandler extends AbstractFieldHandler { - - @Override - public Object getValue(Object object) throws IllegalStateException { - SimpleResultPart part = (SimpleResultPart) object; - return SlcTestUtils.statusToString(part.getStatus()); - } - - @Override - public Object newInstance(Object parent) throws IllegalStateException { - return null; - } - - @Override - public Object newInstance(Object parent, Object[] args) - throws IllegalStateException { - return null; - } - - @Override - public void resetValue(Object object) throws IllegalStateException, - IllegalArgumentException { - SimpleResultPart part = (SimpleResultPart) object; - // ERROR by default since it should be explicitely set - part.setStatus(TestStatus.ERROR); - } - - @Override - public void setValue(Object object, Object value) - throws IllegalStateException, IllegalArgumentException { - SimpleResultPart part = (SimpleResultPart) object; - Integer status = SlcTestUtils.stringToStatus((String) value); - part.setStatus(status); - } - -} diff --git a/runtime/org.argeo.slc.support.castor/src/main/java/org/argeo/slc/xml/process/FileSlcExecutionNotifier.java b/runtime/org.argeo.slc.support.castor/src/main/java/org/argeo/slc/xml/process/FileSlcExecutionNotifier.java deleted file mode 100644 index ad6bcdc24..000000000 --- a/runtime/org.argeo.slc.support.castor/src/main/java/org/argeo/slc/xml/process/FileSlcExecutionNotifier.java +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Copyright (C) 2007-2012 Mathieu Baudier - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.argeo.slc.xml.process; - -import java.io.File; -import java.io.FileWriter; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import javax.xml.transform.stream.StreamResult; - -import org.apache.commons.io.IOUtils; -import org.argeo.slc.SlcException; -import org.argeo.slc.execution.ExecutionProcess; -import org.argeo.slc.process.SlcExecution; -import org.argeo.slc.process.SlcExecutionNotifier; -import org.argeo.slc.execution.ExecutionStep; -import org.argeo.slc.process.SlcExecutionStep; -import org.springframework.oxm.Marshaller; - -/** @deprecated Probably not even working anymore */ -public class FileSlcExecutionNotifier implements SlcExecutionNotifier { - // private final static SimpleDateFormat sdf = new SimpleDateFormat( - // "yyyyMMdd-HHmmss"); - // - // private String basePath; - private Marshaller marshaller; - - private Map uuidToDir = new HashMap(); - - public void addSteps(ExecutionProcess slcExecution, - List additionalSteps) { - writeSlcExecution(slcExecution); - } - - public void updateStatus(ExecutionProcess slcExecution, String oldStatus, - String newStatus) { - writeSlcExecution(slcExecution); - } - - protected void writeSlcExecution(ExecutionProcess process) { - if (!(process instanceof SlcExecution)) - throw new SlcException("Unsupported process type " - + process.getClass()); - SlcExecution slcExecution = (SlcExecution) process; - FileWriter out = null; - try { - out = new FileWriter(getFilePath(slcExecution)); - marshaller.marshal(slcExecution, new StreamResult(out)); - } catch (Exception e) { - throw new SlcException("Cannot marshall SlcExecution to " - + getFilePath(slcExecution), e); - } finally { - IOUtils.closeQuietly(out); - } - } - - protected String getFileName(SlcExecution slcExecution) { - return "SlcExecution-" + slcExecution.getUuid() + ".xml"; - } - - protected String getFilePath(SlcExecution slcExecution) { - String dirPath = uuidToDir.get(slcExecution.getUuid()); - return dirPath + File.separator + "SlcExecution-" - + slcExecution.getUuid() + ".xml"; - } - - public void setBasePath(String basePath) { - // this.basePath = basePath; - } - - public void setMarshaller(Marshaller marshaller) { - this.marshaller = marshaller; - } - -} diff --git a/runtime/org.argeo.slc.support.castor/src/main/java/org/argeo/slc/xml/test/tree/XsltReportGenerator.java b/runtime/org.argeo.slc.support.castor/src/main/java/org/argeo/slc/xml/test/tree/XsltReportGenerator.java deleted file mode 100644 index 0a99356df..000000000 --- a/runtime/org.argeo.slc.support.castor/src/main/java/org/argeo/slc/xml/test/tree/XsltReportGenerator.java +++ /dev/null @@ -1,188 +0,0 @@ -/* - * Copyright (C) 2007-2012 Mathieu Baudier - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.argeo.slc.xml.test.tree; - -import java.io.File; -import java.io.FileOutputStream; -import java.io.InputStream; -import java.io.OutputStream; -import java.util.HashMap; -import java.util.Map; - -import javax.xml.parsers.DocumentBuilder; -import javax.xml.parsers.DocumentBuilderFactory; -import javax.xml.transform.Templates; -import javax.xml.transform.Transformer; -import javax.xml.transform.TransformerFactory; -import javax.xml.transform.dom.DOMResult; -import javax.xml.transform.dom.DOMSource; -import javax.xml.transform.stream.StreamResult; -import javax.xml.transform.stream.StreamSource; - -import org.springframework.core.io.Resource; -import org.springframework.oxm.Marshaller; -import org.springframework.xml.transform.StringResult; -import org.w3c.dom.Document; - -import org.apache.commons.io.IOUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -import org.argeo.slc.SlcException; -import org.argeo.slc.core.test.tree.TreeTestResult; -import org.argeo.slc.test.TestResultListener; -import org.argeo.slc.test.TestResultPart; - -/** Build a report based on a tree test result using an XSLT stylesheet. */ -public class XsltReportGenerator implements TestResultListener { - private final static Log log = LogFactory.getLog(XsltReportGenerator.class); - - private DocumentBuilder documentBuilder = null; - - private Resource xsltStyleSheet; - - private Templates templates; - - private Marshaller marshaller; - - private String outputDir; - private String outputFileExtension = "html"; - - private Boolean logXml = false; - - private Map xsltParameters = new HashMap(); - - public void init() { - if (templates != null) - return; - - if (xsltStyleSheet == null) - throw new SlcException("XSLT style sheet not specified."); - - InputStream in = null; - try { - TransformerFactory transformerFactory = TransformerFactory - .newInstance(); - in = xsltStyleSheet.getInputStream(); - StreamSource xsltSource = new StreamSource(in); - templates = transformerFactory.newTemplates(xsltSource); - } catch (Exception e) { - throw new SlcException("Could not initialize templates", e); - } finally { - IOUtils.closeQuietly(in); - } - } - - public void resultPartAdded(TreeTestResult testResult, - TestResultPart testResultPart) { - - } - - public void close(TreeTestResult testResult) { - if (templates == null) - throw new SlcException("XSLT template not initialized"); - - File file = getFile(testResult); - OutputStream out = null; - - try { - Transformer transformer = templates.newTransformer(); - for (String paramKey : xsltParameters.keySet()) { - transformer - .setParameter(paramKey, xsltParameters.get(paramKey)); - if (log.isTraceEnabled()) - log.trace("Set XSLT parameter " + paramKey + " to " - + xsltParameters.get(paramKey)); - } - - if (documentBuilder == null) - documentBuilder = DocumentBuilderFactory.newInstance() - .newDocumentBuilder(); - - Document document = documentBuilder.newDocument(); - DOMResult marshallResult = new DOMResult(document); - marshaller.marshal(testResult, marshallResult); - - if (logXml) { - Transformer identityTransformer = TransformerFactory - .newInstance().newTransformer(); - StringResult xmlResult = new StringResult(); - identityTransformer.transform(new DOMSource(marshallResult - .getNode()), xmlResult); - log.info("Marshalled XML:\n" + xmlResult); - } - - DOMSource transfoSource = new DOMSource(marshallResult.getNode()); - - if (outputDir != null) { - File dir = new File(outputDir); - dir.mkdirs(); - out = new FileOutputStream(file); - StreamResult outputResult = new StreamResult(out); - transformer.transform(transfoSource, outputResult); - } else { - // print on console if no output dir - StringResult result = new StringResult(); - transformer.transform(transfoSource, result); - log.info("Generated report:\n" + result); - } - } catch (Exception e) { - throw new SlcException( - "Could not transform test result to " + file, e); - } finally { - IOUtils.closeQuietly(out); - } - } - - public Resource getXsltStyleSheet() { - return xsltStyleSheet; - } - - public void setXsltStyleSheet(Resource xsltStyleSheet) { - this.xsltStyleSheet = xsltStyleSheet; - } - - public void setTemplates(Templates templates) { - this.templates = templates; - } - - public void setMarshaller(Marshaller marshaller) { - this.marshaller = marshaller; - } - - public void setOutputDir(String outputDir) { - this.outputDir = outputDir; - } - - public void setOutputFileExtension(String outputFileExtension) { - this.outputFileExtension = outputFileExtension; - } - - protected File getFile(TreeTestResult result) { - Long time = System.currentTimeMillis(); - return new File(outputDir + File.separator + time + "-" - + result.getUuid() + "." + outputFileExtension); - } - - public void setLogXml(Boolean logXml) { - this.logXml = logXml; - } - - public void setXsltParameters(Map xsltParameters) { - this.xsltParameters = xsltParameters; - } - -} diff --git a/runtime/org.argeo.slc.support.castor/src/main/resources/org/argeo/slc/castor/attachment.xml b/runtime/org.argeo.slc.support.castor/src/main/resources/org/argeo/slc/castor/attachment.xml deleted file mode 100644 index 774e1bf07..000000000 --- a/runtime/org.argeo.slc.support.castor/src/main/resources/org/argeo/slc/castor/attachment.xml +++ /dev/null @@ -1,32 +0,0 @@ - - - - - - Attachment objects XML mapping - - - - - - - - - \ No newline at end of file diff --git a/runtime/org.argeo.slc.support.castor/src/main/resources/org/argeo/slc/castor/common.xml b/runtime/org.argeo.slc.support.castor/src/main/resources/org/argeo/slc/castor/common.xml deleted file mode 100644 index ae97e3465..000000000 --- a/runtime/org.argeo.slc.support.castor/src/main/resources/org/argeo/slc/castor/common.xml +++ /dev/null @@ -1,32 +0,0 @@ - - - - Build objects XML mapping - - - - - - - - - - - \ No newline at end of file diff --git a/runtime/org.argeo.slc.support.castor/src/main/resources/org/argeo/slc/castor/execution.xml b/runtime/org.argeo.slc.support.castor/src/main/resources/org/argeo/slc/castor/execution.xml deleted file mode 100644 index 662cbe6af..000000000 --- a/runtime/org.argeo.slc.support.castor/src/main/resources/org/argeo/slc/castor/execution.xml +++ /dev/null @@ -1,172 +0,0 @@ - - - - - - Execution objects XML mapping - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/runtime/org.argeo.slc.support.castor/src/main/resources/org/argeo/slc/castor/msg.xml b/runtime/org.argeo.slc.support.castor/src/main/resources/org/argeo/slc/castor/msg.xml deleted file mode 100644 index 269903113..000000000 --- a/runtime/org.argeo.slc.support.castor/src/main/resources/org/argeo/slc/castor/msg.xml +++ /dev/null @@ -1,217 +0,0 @@ - - - - - - - Message objects XML mapping - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/runtime/org.argeo.slc.support.castor/src/main/resources/org/argeo/slc/castor/process.xml b/runtime/org.argeo.slc.support.castor/src/main/resources/org/argeo/slc/castor/process.xml deleted file mode 100644 index 67bba2743..000000000 --- a/runtime/org.argeo.slc.support.castor/src/main/resources/org/argeo/slc/castor/process.xml +++ /dev/null @@ -1,82 +0,0 @@ - - - - - - Process objects XML mapping - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/runtime/org.argeo.slc.support.castor/src/main/resources/org/argeo/slc/castor/runtime.xml b/runtime/org.argeo.slc.support.castor/src/main/resources/org/argeo/slc/castor/runtime.xml deleted file mode 100644 index 9b1a1c07b..000000000 --- a/runtime/org.argeo.slc.support.castor/src/main/resources/org/argeo/slc/castor/runtime.xml +++ /dev/null @@ -1,36 +0,0 @@ - - - - - - Runtime objects XML mapping - - - - - - - - - - - - \ No newline at end of file diff --git a/runtime/org.argeo.slc.support.castor/src/main/resources/org/argeo/slc/castor/spring.xml b/runtime/org.argeo.slc.support.castor/src/main/resources/org/argeo/slc/castor/spring.xml deleted file mode 100644 index 0b73dee77..000000000 --- a/runtime/org.argeo.slc.support.castor/src/main/resources/org/argeo/slc/castor/spring.xml +++ /dev/null @@ -1,64 +0,0 @@ - - - - - - - - - - classpath:org/argeo/slc/castor/common.xml - classpath:org/argeo/slc/castor/msg.xml - classpath:org/argeo/slc/castor/process.xml - classpath:org/argeo/slc/castor/runtime.xml - classpath:org/argeo/slc/castor/structure.xml - classpath:org/argeo/slc/castor/test.xml - classpath:org/argeo/slc/castor/execution.xml - classpath:org/argeo/slc/castor/attachment.xml - - - - - - - - - - - - - - - - - - - diff --git a/runtime/org.argeo.slc.support.castor/src/main/resources/org/argeo/slc/castor/structure.xml b/runtime/org.argeo.slc.support.castor/src/main/resources/org/argeo/slc/castor/structure.xml deleted file mode 100644 index ad63a7a3f..000000000 --- a/runtime/org.argeo.slc.support.castor/src/main/resources/org/argeo/slc/castor/structure.xml +++ /dev/null @@ -1,51 +0,0 @@ - - - - Structure related objects XML mapping - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/runtime/org.argeo.slc.support.castor/src/main/resources/org/argeo/slc/castor/test.xml b/runtime/org.argeo.slc.support.castor/src/main/resources/org/argeo/slc/castor/test.xml deleted file mode 100644 index 45b9bbe0a..000000000 --- a/runtime/org.argeo.slc.support.castor/src/main/resources/org/argeo/slc/castor/test.xml +++ /dev/null @@ -1,123 +0,0 @@ - - - - Test objects XML mapping - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/runtime/org.argeo.slc.support.castor/src/site/apt/index.apt b/runtime/org.argeo.slc.support.castor/src/site/apt/index.apt deleted file mode 100644 index f414460db..000000000 --- a/runtime/org.argeo.slc.support.castor/src/site/apt/index.apt +++ /dev/null @@ -1 +0,0 @@ -Argeo SLC Site \ No newline at end of file diff --git a/runtime/org.argeo.slc.support.castor/src/test/java/org/argeo/slc/castor/AbstractCastorTestCase.java b/runtime/org.argeo.slc.support.castor/src/test/java/org/argeo/slc/castor/AbstractCastorTestCase.java deleted file mode 100644 index f91ad0b6e..000000000 --- a/runtime/org.argeo.slc.support.castor/src/test/java/org/argeo/slc/castor/AbstractCastorTestCase.java +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Copyright (C) 2007-2012 Mathieu Baudier - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.argeo.slc.castor; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.argeo.slc.unit.AbstractSpringTestCase; -import org.argeo.slc.unit.UnitXmlUtils; -import org.springframework.oxm.Marshaller; -import org.springframework.oxm.Unmarshaller; -import org.springframework.xml.transform.StringResult; -import org.springframework.xml.transform.StringSource; -import org.springframework.xml.validation.XmlValidator; - -public abstract class AbstractCastorTestCase extends AbstractSpringTestCase { - protected Log log = LogFactory.getLog(getClass()); - - private Marshaller marshaller; - private Unmarshaller unmarshaller; - - @Override - public void setUp() { - marshaller = getBean(Marshaller.class); - unmarshaller = getBean(Unmarshaller.class); - } - - protected StringResult marshal(Object obj) throws Exception { - return marshal(obj, false); - } - - protected StringResult marshalAndValidate(Object obj) throws Exception { - return marshal(obj, true); - } - - protected StringResult marshal(Object obj, boolean validate) - throws Exception { - StringResult xml = new StringResult(); - marshaller.marshal(obj, xml); - - log.info("Marshalled " + obj.getClass() + ": " + xml + "\n"); - - if (validate) - UnitXmlUtils.assertXmlValidation(getBean(XmlValidator.class), - new StringSource(xml.toString())); - return xml; - } - - @SuppressWarnings("unchecked") - protected T unmarshal(StringResult xml) throws Exception { - return (T) unmarshaller.unmarshal(new StringSource(xml.toString())); - } - - @SuppressWarnings("unchecked") - protected T marshUnmarsh(Object obj, boolean validate) throws Exception { - StringResult xml = marshal(obj, validate); - return (T) unmarshal(xml); - } - - @SuppressWarnings("unchecked") - protected T marshUnmarsh(Object obj) throws Exception { - return (T) marshUnmarsh(obj, true); - } -} diff --git a/runtime/org.argeo.slc.support.castor/src/test/java/org/argeo/slc/castor/ExecutionAnswerCastorTest.java b/runtime/org.argeo.slc.support.castor/src/test/java/org/argeo/slc/castor/ExecutionAnswerCastorTest.java deleted file mode 100644 index ea3b55012..000000000 --- a/runtime/org.argeo.slc.support.castor/src/test/java/org/argeo/slc/castor/ExecutionAnswerCastorTest.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (C) 2007-2012 Mathieu Baudier - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.argeo.slc.castor; - -import org.argeo.slc.msg.ExecutionAnswer; - -public class ExecutionAnswerCastorTest extends AbstractCastorTestCase { - public void testMarshUnmarshOk() throws Exception { - ExecutionAnswer answer = new ExecutionAnswer(ExecutionAnswer.OK, - "No problem!"); - ExecutionAnswer answerUnm = marshUnmarsh(answer); - assertExecutionAnswer(answer, answerUnm); - } - - public void testMarshUnmarshError() throws Exception { - ExecutionAnswer answer = new ExecutionAnswer(ExecutionAnswer.ERROR, - "Oooops..."); - ExecutionAnswer answerUnm = marshUnmarsh(answer); - assertExecutionAnswer(answer, answerUnm); - } - - public static void assertExecutionAnswer(ExecutionAnswer expected, - ExecutionAnswer reached) { - assertEquals(expected.getStatus(), reached.getStatus()); - assertEquals(expected.getMessage(), reached.getMessage()); - } -} diff --git a/runtime/org.argeo.slc.support.castor/src/test/java/org/argeo/slc/castor/ExecutionModuleDescriptorCastorTest.java b/runtime/org.argeo.slc.support.castor/src/test/java/org/argeo/slc/castor/ExecutionModuleDescriptorCastorTest.java deleted file mode 100644 index b25f52b7b..000000000 --- a/runtime/org.argeo.slc.support.castor/src/test/java/org/argeo/slc/castor/ExecutionModuleDescriptorCastorTest.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright (C) 2007-2012 Mathieu Baudier - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.argeo.slc.castor; - -import java.util.ArrayList; -import java.util.List; - -import org.argeo.slc.execution.ExecutionFlowDescriptor; -import org.argeo.slc.execution.ExecutionModuleDescriptor; -import org.argeo.slc.execution.ExecutionSpec; -import org.argeo.slc.unit.execution.ExecutionFlowDescriptorTestUtils; - -public class ExecutionModuleDescriptorCastorTest extends AbstractCastorTestCase { - public void testMarshUnmarsh() throws Exception { - ExecutionModuleDescriptor moduleDescriptor = new ExecutionModuleDescriptor(); - moduleDescriptor.setName("test.module"); - moduleDescriptor.setVersion("1.0.0"); - moduleDescriptor.setLabel("Test Module"); - moduleDescriptor.setDescription("module descriptor"); - - ExecutionFlowDescriptor flowDescriptor = ExecutionFlowDescriptorTestUtils - .createSimpleExecutionFlowDescriptor(); - - List flows = new ArrayList(); - flows.add(flowDescriptor); - moduleDescriptor.setExecutionFlows(flows); - - List specs = new ArrayList(); - specs.add(flowDescriptor.getExecutionSpec()); - moduleDescriptor.setExecutionSpecs(specs); - - marshUnmarsh(moduleDescriptor, false); - } - - public void testMarshUnmarshMini() throws Exception { - ExecutionModuleDescriptor moduleDescriptor = new ExecutionModuleDescriptor(); - moduleDescriptor.setName("test.moodule"); - moduleDescriptor.setVersion("1.0.0"); - marshUnmarsh(moduleDescriptor, false); - } - -} diff --git a/runtime/org.argeo.slc.support.castor/src/test/java/org/argeo/slc/castor/ModularDistributionCastorTest.java b/runtime/org.argeo.slc.support.castor/src/test/java/org/argeo/slc/castor/ModularDistributionCastorTest.java deleted file mode 100644 index 317d01993..000000000 --- a/runtime/org.argeo.slc.support.castor/src/test/java/org/argeo/slc/castor/ModularDistributionCastorTest.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright (C) 2007-2012 Mathieu Baudier - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.argeo.slc.castor; - -import org.argeo.slc.msg.ObjectList; -import org.argeo.slc.msg.build.ModularDistributionDescriptor; - -public class ModularDistributionCastorTest extends AbstractCastorTestCase { - public void testModularDistributionDescriptor() throws Exception { - ModularDistributionDescriptor mdd = new ModularDistributionDescriptor(); - mdd.setName("name"); - mdd.setVersion("0.1.0"); - mdd.getModulesDescriptors().put("eclipse", - "http://localhost/updateSite"); - mdd.getModulesDescriptors().put("modularDistribution", - "http://localhost/modularDistribution"); - - marshUnmarsh(mdd, false); - } - - public void testModularDistributionDescriptorList() throws Exception { - ModularDistributionDescriptor mdd = new ModularDistributionDescriptor(); - mdd.setName("name"); - mdd.setVersion("0.1.0"); - mdd.getModulesDescriptors().put("eclipse", - "http://localhost/updateSite"); - mdd.getModulesDescriptors().put("modularDistribution", - "http://localhost/modularDistribution"); - - ModularDistributionDescriptor mdd2 = new ModularDistributionDescriptor(); - mdd2.setName("name2"); - mdd2.setVersion("0.1.1"); - mdd2.getModulesDescriptors().put("eclipse", - "http://localhost/updateSite2"); - mdd2.getModulesDescriptors().put("modularDistribution", - "http://localhost/modularDistribution2"); - - ObjectList ol = new ObjectList(); - ol.getObjects().add(mdd); - ol.getObjects().add(mdd2); - - marshUnmarsh(ol, false); - } - -} diff --git a/runtime/org.argeo.slc.support.castor/src/test/java/org/argeo/slc/castor/ObjectListCastorTest.java b/runtime/org.argeo.slc.support.castor/src/test/java/org/argeo/slc/castor/ObjectListCastorTest.java deleted file mode 100644 index b01d9a7de..000000000 --- a/runtime/org.argeo.slc.support.castor/src/test/java/org/argeo/slc/castor/ObjectListCastorTest.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright (C) 2007-2012 Mathieu Baudier - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.argeo.slc.castor; - -import org.argeo.slc.msg.ObjectList; -import org.argeo.slc.runtime.SlcAgentDescriptor; - -public class ObjectListCastorTest extends AbstractCastorTestCase { - - public void testAgentDescriptorList() throws Exception { - SlcAgentDescriptor agentDescriptor = SlcAgentDescriptorCastorTest - .createMiniAgentDescriptor(); - ObjectList lst = new ObjectList(); - lst.getObjects().add(agentDescriptor); - ObjectList lstUnm = (ObjectList) marshUnmarsh(lst, false); - assertEquals(1, lstUnm.getObjects().size()); - } -} diff --git a/runtime/org.argeo.slc.support.castor/src/test/java/org/argeo/slc/castor/SlcAgentDescriptorCastorTest.java b/runtime/org.argeo.slc.support.castor/src/test/java/org/argeo/slc/castor/SlcAgentDescriptorCastorTest.java deleted file mode 100644 index 0367da70f..000000000 --- a/runtime/org.argeo.slc.support.castor/src/test/java/org/argeo/slc/castor/SlcAgentDescriptorCastorTest.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright (C) 2007-2012 Mathieu Baudier - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.argeo.slc.castor; - -import java.util.ArrayList; -import java.util.List; - -import org.argeo.slc.execution.ExecutionModuleDescriptor; -import org.argeo.slc.runtime.SlcAgentDescriptor; - -public class SlcAgentDescriptorCastorTest extends AbstractCastorTestCase { - public void testMarshUnmarshMini() throws Exception { - SlcAgentDescriptor agentDescriptor = createMiniAgentDescriptor(); - SlcAgentDescriptor agentDescriptorUnm = marshUnmarsh(agentDescriptor, - false); - assertSlcAgentDescriptor(agentDescriptor, agentDescriptorUnm); - } - - public void testMarshUnmarshWithModuleDescriptor() throws Exception { - SlcAgentDescriptor agentDescriptor = createMiniAgentDescriptor(); - - List lst = new ArrayList(); - ExecutionModuleDescriptor moduleDescriptor = new ExecutionModuleDescriptor(); - moduleDescriptor.setName("test.moodule"); - moduleDescriptor.setVersion("1.0.0"); - lst.add(moduleDescriptor); - agentDescriptor.setModuleDescriptors(lst); - - SlcAgentDescriptor agentDescriptorUnm = marshUnmarsh(agentDescriptor, - false); - assertSlcAgentDescriptor(agentDescriptor, agentDescriptorUnm); - } - - protected static SlcAgentDescriptor createMiniAgentDescriptor() { - SlcAgentDescriptor agentDescriptor = new SlcAgentDescriptor(); - agentDescriptor.setHost("localhost"); - agentDescriptor.setUuid("555"); - return agentDescriptor; - } - - protected static void assertSlcAgentDescriptor(SlcAgentDescriptor expected, - SlcAgentDescriptor reached) { - assertNotNull(reached); - assertEquals(expected.getHost(), reached.getHost()); - assertEquals(expected.getUuid(), expected.getUuid()); - assertEquals(expected.getModuleDescriptors().size(), reached - .getModuleDescriptors().size()); - } -} diff --git a/runtime/org.argeo.slc.support.castor/src/test/java/org/argeo/slc/castor/SlcExecutionCastorTest.java b/runtime/org.argeo.slc.support.castor/src/test/java/org/argeo/slc/castor/SlcExecutionCastorTest.java deleted file mode 100644 index 44794e163..000000000 --- a/runtime/org.argeo.slc.support.castor/src/test/java/org/argeo/slc/castor/SlcExecutionCastorTest.java +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Copyright (C) 2007-2012 Mathieu Baudier - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.argeo.slc.castor; - -import java.text.SimpleDateFormat; -import java.util.UUID; - -import org.argeo.slc.msg.process.SlcExecutionRequest; -import org.argeo.slc.msg.process.SlcExecutionStepsRequest; -import org.argeo.slc.process.SlcExecution; -import org.argeo.slc.process.SlcExecutionStep; -import org.argeo.slc.unit.process.SlcExecutionTestUtils; -import org.springframework.xml.transform.StringResult; - -public class SlcExecutionCastorTest extends AbstractCastorTestCase { - public void testMarshalling() throws Exception { - SlcExecution slcExec = SlcExecutionTestUtils.createSimpleSlcExecution(); - - SlcExecutionRequest msgSave = new SlcExecutionRequest(); - msgSave.setSlcExecution(slcExec); - - StringResult msgSaveXml = marshalAndValidate(msgSave); - - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm"); - SlcExecutionStep step0 = new SlcExecutionStep(); - step0.setUuid(UUID.randomUUID().toString()); - step0.setTimestamp(sdf.parse("2008-04-17 18:21")); - step0.setType("LOG"); - step0.addLog("A log message\nand another line"); - - SlcExecutionStep step1 = new SlcExecutionStep(); - step1.setUuid(UUID.randomUUID().toString()); - step1.setTimestamp(sdf.parse("2008-04-17 18:25")); - step1.setType("LOG"); - step1.addLog("A nother log message"); - - SlcExecutionStepsRequest msgNotif = new SlcExecutionStepsRequest(); - msgNotif.addStep(step0); - msgNotif.addStep(step1); - msgNotif.setSlcExecutionUuid(slcExec.getUuid()); - - StringResult msgNotifXml = marshalAndValidate(msgNotif); - - SlcExecutionRequest msgSaveUnm = unmarshal(msgSaveXml); - assertNotNull(msgSaveUnm); - SlcExecutionTestUtils.assertSlcExecution(slcExec, msgSaveUnm - .getSlcExecution()); - - SlcExecutionStepsRequest msgNotifUnm = unmarshal(msgNotifXml); - assertNotNull(msgNotifUnm); - assertEquals(slcExec.getUuid(), msgNotifUnm.getSlcExecutionUuid()); - assertEquals(2, msgNotifUnm.getSteps().size()); - SlcExecutionTestUtils.assertSlcExecutionStep(step0, msgNotifUnm - .getSteps().get(0)); - SlcExecutionTestUtils.assertSlcExecutionStep(step1, msgNotifUnm - .getSteps().get(1)); - - SlcExecution slcExecUnm = msgSaveUnm.getSlcExecution(); - slcExecUnm.getSteps().addAll(msgNotifUnm.getSteps()); - - SlcExecutionRequest msgUpdate = new SlcExecutionRequest(); - msgUpdate.setSlcExecution(slcExecUnm); - StringResult msgUpdateXml = marshalAndValidate(msgUpdate); - - SlcExecutionRequest msgUpdateUnm = unmarshal(msgUpdateXml); - assertNotNull(msgUpdateUnm); - } - - public void testMarshUnmarsh() throws Exception { - SlcExecution slcExec = SlcExecutionTestUtils - .createSlcExecutionWithRealizedFlows(); - marshUnmarsh(slcExec, false); - } -} diff --git a/runtime/org.argeo.slc.support.castor/src/test/java/org/argeo/slc/castor/TreeTestResultCastorTest.java b/runtime/org.argeo.slc.support.castor/src/test/java/org/argeo/slc/castor/TreeTestResultCastorTest.java deleted file mode 100644 index 7d6d6e961..000000000 --- a/runtime/org.argeo.slc.support.castor/src/test/java/org/argeo/slc/castor/TreeTestResultCastorTest.java +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Copyright (C) 2007-2012 Mathieu Baudier - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.argeo.slc.castor; - -import static org.argeo.slc.unit.UnitUtils.assertDateSec; -import static org.argeo.slc.unit.test.tree.TreeTestResultTestUtils.createCompleteTreeTestResult; -import static org.argeo.slc.unit.test.tree.TreeTestResultTestUtils.createSimpleResultPartRequest; - -import org.argeo.slc.core.test.tree.TreeTestResult; -import org.argeo.slc.msg.test.tree.CloseTreeTestResultRequest; -import org.argeo.slc.msg.test.tree.CreateTreeTestResultRequest; -import org.argeo.slc.msg.test.tree.ResultPartRequest; -import org.argeo.slc.unit.test.tree.UnitTestTreeUtil; -import org.springframework.xml.transform.StringResult; - -public class TreeTestResultCastorTest extends AbstractCastorTestCase { - public void testMarshUnmarsh() throws Exception { - TreeTestResult ttr = createCompleteTreeTestResult(); - - StringResult xml = marshalAndValidate(ttr); - - TreeTestResult ttrUnm = unmarshal(xml); - - UnitTestTreeUtil.assertTreeTestResult(ttr, ttrUnm); - } - - public void testCreateTreeTestResultRequest() throws Exception { - CreateTreeTestResultRequest req = new CreateTreeTestResultRequest(); - req.setTreeTestResult(createCompleteTreeTestResult()); - - StringResult xml = marshalAndValidate(req); - - CreateTreeTestResultRequest reqUnm = unmarshal(xml); - - UnitTestTreeUtil.assertTreeTestResult(req.getTreeTestResult(), reqUnm - .getTreeTestResult()); - } - - public void testResultPartRequest() throws Exception { - TreeTestResult ttr = createCompleteTreeTestResult(); - ResultPartRequest req = createSimpleResultPartRequest(ttr); - - StringResult xml = marshalAndValidate(req); - - ResultPartRequest reqUnm = unmarshal(xml); - - UnitTestTreeUtil - .assertPart(req.getResultPart(), reqUnm.getResultPart()); - } - - public void testCloseTreeTestResultRequest() throws Exception { - TreeTestResult ttr = createCompleteTreeTestResult(); - ttr.close(); - - CloseTreeTestResultRequest req = new CloseTreeTestResultRequest(ttr - .getUuid(), ttr.getCloseDate()); - - StringResult xml = marshalAndValidate(req); - - CloseTreeTestResultRequest reqUnm = unmarshal(xml); - - assertEquals(ttr.getUuid(), reqUnm.getResultUuid()); - assertDateSec(ttr.getCloseDate(), ttr.getCloseDate()); - } -} diff --git a/runtime/org.argeo.slc.support.castor/src/test/java/org/argeo/slc/castor/TreeTestResultCollectionCastorTest.java b/runtime/org.argeo.slc.support.castor/src/test/java/org/argeo/slc/castor/TreeTestResultCollectionCastorTest.java deleted file mode 100644 index 46fc836e1..000000000 --- a/runtime/org.argeo.slc.support.castor/src/test/java/org/argeo/slc/castor/TreeTestResultCollectionCastorTest.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (C) 2007-2012 Mathieu Baudier - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.argeo.slc.castor; - -import static org.argeo.slc.unit.test.tree.TreeTestResultTestUtils.createCompleteTreeTestResult; - -import org.argeo.slc.core.test.tree.TreeTestResult; -import org.argeo.slc.core.test.tree.TreeTestResultCollection; -import org.argeo.slc.unit.test.tree.UnitTestTreeUtil; -import org.springframework.xml.transform.StringResult; - -public class TreeTestResultCollectionCastorTest extends AbstractCastorTestCase { - public void testMarshUnmarsh() throws Exception { - TreeTestResult ttr = createCompleteTreeTestResult(); - TreeTestResult ttr2 = createCompleteTreeTestResult(); - - TreeTestResultCollection ttrc = new TreeTestResultCollection(); - ttrc.setId("testCollection"); - ttrc.getResults().add(ttr); - ttrc.getResults().add(ttr2); - - StringResult xml = marshalAndValidate(ttrc); - - TreeTestResultCollection ttrcUnm = unmarshal(xml); - - assertEquals(ttrc.getId(), ttrcUnm.getId()); - assertEquals(ttrc.getResults().size(), ttrcUnm.getResults().size()); - for (TreeTestResult ttrT : ttrc.getResults()) { - if (ttrT.getUuid().equals(ttr.getUuid())) - UnitTestTreeUtil.assertTreeTestResult(ttr, ttrT); - else - UnitTestTreeUtil.assertTreeTestResult(ttr2, ttrT); - } - } -} diff --git a/runtime/org.argeo.slc.support.castor/src/test/resources/log4j.properties b/runtime/org.argeo.slc.support.castor/src/test/resources/log4j.properties deleted file mode 100644 index 0133bab88..000000000 --- a/runtime/org.argeo.slc.support.castor/src/test/resources/log4j.properties +++ /dev/null @@ -1,22 +0,0 @@ -# Set root logger level to DEBUG and its only appender to A1. -log4j.rootLogger=WARN, console - -## Levels -# Slc -log4j.logger.org.argeo=DEBUG - -# Castor -log4j.logger.org.exolab.castor=WARN - -# Spring -log4j.logger.org.springframework=WARN - - -## Appenders -# A1 is set to be a ConsoleAppender. -log4j.appender.console=org.apache.log4j.ConsoleAppender - -# A1 uses PatternLayout. -log4j.appender.console.layout=org.apache.log4j.PatternLayout -log4j.appender.console.layout.ConversionPattern= %-5p %d{ISO8601} %m - %c%n - diff --git a/runtime/org.argeo.slc.support.castor/src/test/resources/org/argeo/slc/castor/applicationContext.xml b/runtime/org.argeo.slc.support.castor/src/test/resources/org/argeo/slc/castor/applicationContext.xml deleted file mode 100644 index c479075b8..000000000 --- a/runtime/org.argeo.slc.support.castor/src/test/resources/org/argeo/slc/castor/applicationContext.xml +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/runtime/org.argeo.slc.support.hibernate/.classpath b/runtime/org.argeo.slc.support.hibernate/.classpath deleted file mode 100644 index 26b349477..000000000 --- a/runtime/org.argeo.slc.support.hibernate/.classpath +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - diff --git a/runtime/org.argeo.slc.support.hibernate/.project b/runtime/org.argeo.slc.support.hibernate/.project deleted file mode 100644 index 080510172..000000000 --- a/runtime/org.argeo.slc.support.hibernate/.project +++ /dev/null @@ -1,28 +0,0 @@ - - - org.argeo.slc.support.hibernate - - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.pde.ManifestBuilder - - - - - org.eclipse.pde.SchemaBuilder - - - - - - org.eclipse.jdt.core.javanature - org.eclipse.pde.PluginNature - - diff --git a/runtime/org.argeo.slc.support.hibernate/.settings/org.eclipse.jdt.core.prefs b/runtime/org.argeo.slc.support.hibernate/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index b5feaf2d2..000000000 --- a/runtime/org.argeo.slc.support.hibernate/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,12 +0,0 @@ -#Fri Aug 29 11:24:23 CEST 2008 -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 -org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.compliance=1.5 -org.eclipse.jdt.core.compiler.debug.lineNumber=generate -org.eclipse.jdt.core.compiler.debug.localVariable=generate -org.eclipse.jdt.core.compiler.debug.sourceFile=generate -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.5 diff --git a/runtime/org.argeo.slc.support.hibernate/.settings/org.eclipse.pde.core.prefs b/runtime/org.argeo.slc.support.hibernate/.settings/org.eclipse.pde.core.prefs deleted file mode 100644 index 0572a4a46..000000000 --- a/runtime/org.argeo.slc.support.hibernate/.settings/org.eclipse.pde.core.prefs +++ /dev/null @@ -1,3 +0,0 @@ -#Mon Feb 14 20:13:33 CET 2011 -eclipse.preferences.version=1 -selfhosting.binExcludes=/org.argeo.slc.support.hibernate/target/test-classes,/org.argeo.slc.support.hibernate/target/test-classes diff --git a/runtime/org.argeo.slc.support.hibernate/build.properties b/runtime/org.argeo.slc.support.hibernate/build.properties deleted file mode 100644 index 0f69dad3b..000000000 --- a/runtime/org.argeo.slc.support.hibernate/build.properties +++ /dev/null @@ -1,21 +0,0 @@ -additional.bundles = org.springframework.transaction,\ - org.argeo.slc.unit,\ - junit,\ - org.springframework.oxm,\ - org.springframework.xml,\ - org.dom4j,\ - org.springframework.jdbc,\ - org.springframework.context.support,\ - net.sf.ehcache,\ - org.hsqldb,\ - org.apache.commons.collections,\ - antlr,\ - org.argeo.slc.support.castor,\ - org.castor,\ - org.apache.xml.serializer,\ - org.apache.xerces,\ - org.h2 -source.. = src/main/java/,\ - src/main/resources/,\ - src/test/java/,\ - src/test/resources/ diff --git a/runtime/org.argeo.slc.support.hibernate/pom.xml b/runtime/org.argeo.slc.support.hibernate/pom.xml deleted file mode 100644 index d996e2f16..000000000 --- a/runtime/org.argeo.slc.support.hibernate/pom.xml +++ /dev/null @@ -1,102 +0,0 @@ - - - 4.0.0 - - org.argeo.slc - runtime - 1.1.3-SNAPSHOT - .. - - org.argeo.slc.runtime - org.argeo.slc.support.hibernate - SLC Support Hibernate - - - - org.apache.felix - maven-bundle-plugin - - - org.argeo.slc.core - !org.argeo.slc.core.*,org.hibernate.proxy,javassist.util.proxy,* - - - - - org.apache.maven.plugins - maven-surefire-plugin - - - true - - - - - - - org.argeo.slc.runtime - org.argeo.slc.core - 1.1.3-SNAPSHOT - - - - org.argeo.tp - org.hibernate - - - org.argeo.tp - net.sf.ehcache - - - org.argeo.tp - edu.emory.mathcs.backport - - - org.argeo.tp - org.springframework.orm - - - org.argeo.tp - org.springframework.jdbc - - - org.argeo.tp - org.springframework.context.support - - - org.argeo.tp - org.springframework.transaction - - - - org.argeo.tp - org.apache.commons.dbcp - - - - - org.argeo.slc.runtime - org.argeo.slc.unit - test - 1.1.3-SNAPSHOT - - - - org.argeo.slc.runtime - org.argeo.slc.support.castor - test - 1.1.3-SNAPSHOT - - - - org.argeo.tp - org.hsqldb - test - - - org.argeo.tp - org.h2 - test - - - \ No newline at end of file diff --git a/runtime/org.argeo.slc.support.hibernate/src/assembly/base.xml b/runtime/org.argeo.slc.support.hibernate/src/assembly/base.xml deleted file mode 100644 index c135b91e5..000000000 --- a/runtime/org.argeo.slc.support.hibernate/src/assembly/base.xml +++ /dev/null @@ -1,32 +0,0 @@ - - - base - false - - zip - - - - src/base - - - - \ No newline at end of file diff --git a/runtime/org.argeo.slc.support.hibernate/src/base/bin/slc b/runtime/org.argeo.slc.support.hibernate/src/base/bin/slc deleted file mode 100644 index bcc63c85a..000000000 --- a/runtime/org.argeo.slc.support.hibernate/src/base/bin/slc +++ /dev/null @@ -1,326 +0,0 @@ -#! /bin/sh - -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Extract launch and ant arguments, (see details below). -ant_exec_args= -no_config=false -use_jikes_default=false -ant_exec_debug=false -show_help=false -for arg in "$@" ; do - if [ "$arg" = "--noconfig" ] ; then - no_config=true - elif [ "$arg" = "--usejikes" ] ; then - use_jikes_default=true - elif [ "$arg" = "--execdebug" ] ; then - ant_exec_debug=true - elif [ my"$arg" = my"--h" -o my"$arg" = my"--help" ] ; then - show_help=true - ant_exec_args="$ant_exec_args -h" - else - if [ my"$arg" = my"-h" -o my"$arg" = my"-help" ] ; then - show_help=true - fi - ant_exec_args="$ant_exec_args \"$arg\"" - fi -done - -# Source/default ant configuration -if $no_config ; then - rpm_mode=false - usejikes=$use_jikes_default -else - # load system-wide ant configuration (ONLY if ANT_HOME has NOT been set) - if [ -z "$ANT_HOME" -o "$ANT_HOME" = "/usr/share/ant" ]; then - if [ -f "/etc/ant.conf" ] ; then - . /etc/ant.conf - fi - fi - - # load user ant configuration - if [ -f "$HOME/.ant/ant.conf" ] ; then - . $HOME/.ant/ant.conf - fi - if [ -f "$HOME/.antrc" ] ; then - . "$HOME/.antrc" - fi - - # provide default configuration values - if [ -z "$rpm_mode" ] ; then - rpm_mode=false - fi - if [ -z "$usejikes" ] ; then - usejikes=$use_jikes_default - fi -fi - -# Setup Java environment in rpm mode -if $rpm_mode ; then - if [ -f /usr/share/java-utils/java-functions ] ; then - . /usr/share/java-utils/java-functions - set_jvm - set_javacmd - fi -fi - -# OS specific support. $var _must_ be set to either true or false. -cygwin=false; -darwin=false; -case "`uname`" in - CYGWIN*) cygwin=true ;; - Darwin*) darwin=true - if [ -z "$JAVA_HOME" ] ; then - JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Home - fi - ;; -esac - -if [ -z "$ANT_HOME" -o ! -d "$ANT_HOME" ] ; then - ## resolve links - $0 may be a link to ant's home - PRG="$0" - progname=`basename "$0"` - - # need this for relative symlinks - while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG=`dirname "$PRG"`"/$link" - fi - done - - ANT_HOME=`dirname "$PRG"`/.. - - # make it fully qualified - ANT_HOME=`cd "$ANT_HOME" && pwd` -fi - -# For Cygwin, ensure paths are in UNIX format before anything is touched -if $cygwin ; then - [ -n "$ANT_HOME" ] && - ANT_HOME=`cygpath --unix "$ANT_HOME"` - [ -n "$JAVA_HOME" ] && - JAVA_HOME=`cygpath --unix "$JAVA_HOME"` -fi - -# set ANT_LIB location -ANT_LIB="${ANT_HOME}/lib" - -if [ -z "$JAVACMD" ] ; then - if [ -n "$JAVA_HOME" ] ; then - # IBM's JDK on AIX uses strange locations for the executables - if [ -x "$JAVA_HOME/jre/sh/java" ] ; then - JAVACMD="$JAVA_HOME/jre/sh/java" - elif [ -x "$JAVA_HOME/jre/bin/java" ] ; then - JAVACMD="$JAVA_HOME/jre/bin/java" - else - JAVACMD="$JAVA_HOME/bin/java" - fi - else - JAVACMD=`which java 2> /dev/null ` - if [ -z "$JAVACMD" ] ; then - JAVACMD=java - fi - fi -fi - -if [ ! -x "$JAVACMD" ] ; then - echo "Error: JAVA_HOME is not defined correctly." - echo " We cannot execute $JAVACMD" - exit 1 -fi - -# Build local classpath using just the launcher in non-rpm mode or -# use the Jpackage helper in rpm mode with basic and default jars -# specified in the ant.conf configuration. Because the launcher is -# used, libraries linked in ANT_HOME/lib will also be included, but this -# is discouraged as it is not java-version safe. A user should -# request optional jars and their dependencies via the OPT_JAR_LIST -# variable -if $rpm_mode && [ -x /usr/bin/build-classpath ] ; then - LOCALCLASSPATH="$(/usr/bin/build-classpath ant ant-launcher jaxp_parser_impl xml-commons-apis)" - - # If no optional jars have been specified then build the default list - if [ -z "$OPT_JAR_LIST" ] ; then - for file in /etc/ant.d/*; do - if [ -f "$file" ]; then - case "$file" in - *~) ;; - *#*) ;; - *.rpmsave) ;; - *.rpmnew) ;; - *) - for dep in `cat "$file"`; do - case "$OPT_JAR_LIST" in - *"$dep"*) ;; - *) OPT_JAR_LIST="$OPT_JAR_LIST${OPT_JAR_LIST:+ }$dep" - esac - done - esac - fi - done - fi - - # If the user requested to try to add some other jars to the classpath - if [ -n "$OPT_JAR_LIST" ] ; then - _OPTCLASSPATH="$(/usr/bin/build-classpath $OPT_JAR_LIST 2> /dev/null)" - if [ -n "$_OPTCLASSPATH" ] ; then - LOCALCLASSPATH="$LOCALCLASSPATH:$_OPTCLASSPATH" - fi - fi - - # Explicitly add javac path to classpath, assume JAVA_HOME set - # properly in rpm mode - if [ -f "$JAVA_HOME/lib/tools.jar" ] ; then - LOCALCLASSPATH="$LOCALCLASSPATH:$JAVA_HOME/lib/tools.jar" - fi - if [ -f "$JAVA_HOME/lib/classes.zip" ] ; then - LOCALCLASSPATH="$LOCALCLASSPATH:$JAVA_HOME/lib/classes.zip" - fi - - # if CLASSPATH_OVERRIDE env var is set, LOCALCLASSPATH will be - # user CLASSPATH first and ant-found jars after. - # In that case, the user CLASSPATH will override ant-found jars - # - # if CLASSPATH_OVERRIDE is not set, we'll have the normal behaviour - # with ant-found jars first and user CLASSPATH after - if [ -n "$CLASSPATH" ] ; then - # merge local and specified classpath - if [ -z "$LOCALCLASSPATH" ] ; then - LOCALCLASSPATH="$CLASSPATH" - elif [ -n "$CLASSPATH_OVERRIDE" ] ; then - LOCALCLASSPATH="$CLASSPATH:$LOCALCLASSPATH" - else - LOCALCLASSPATH="$LOCALCLASSPATH:$CLASSPATH" - fi - - # remove class path from launcher -cp option - CLASSPATH="" - fi -else - # not using rpm_mode; use launcher to determine classpaths - if [ -z "$LOCALCLASSPATH" ] ; then - LOCALCLASSPATH=$ANT_LIB/ant-launcher.jar - else - LOCALCLASSPATH=$ANT_LIB/ant-launcher.jar:$LOCALCLASSPATH - fi -fi - -if [ -n "$JAVA_HOME" ] ; then - # OSX hack to make Ant work with jikes - if $darwin ; then - OSXHACK="${JAVA_HOME}/../Classes" - if [ -d "${OSXHACK}" ] ; then - for i in "${OSXHACK}"/*.jar - do - JIKESPATH="$JIKESPATH:$i" - done - fi - fi -fi - -# Allow Jikes support (off by default) -if $usejikes; then - ANT_OPTS="$ANT_OPTS -Dbuild.compiler=jikes" -fi - -# For Cygwin, switch paths to appropriate format before running java -# For PATHs convert to unix format first, then to windows format to ensure -# both formats are supported. Probably this will fail on directories with ; -# in the name in the path. Let's assume that paths containing ; are more -# rare than windows style paths on cygwin. -if $cygwin; then - if [ "$OS" = "Windows_NT" ] && cygpath -m .>/dev/null 2>/dev/null ; then - format=mixed - else - format=windows - fi - ANT_HOME=`cygpath --$format "$ANT_HOME"` - ANT_LIB=`cygpath --$format "$ANT_LIB"` - JAVA_HOME=`cygpath --$format "$JAVA_HOME"` - LCP_TEMP=`cygpath --path --unix "$LOCALCLASSPATH"` - LOCALCLASSPATH=`cygpath --path --$format "$LCP_TEMP"` - if [ -n "$CLASSPATH" ] ; then - CP_TEMP=`cygpath --path --unix "$CLASSPATH"` - CLASSPATH=`cygpath --path --$format "$CP_TEMP"` - fi - CYGHOME=`cygpath --$format "$HOME"` -fi - -# Show script help if requested -if $show_help ; then - echo $0 '[script options] [options] [target [target2 [target3] ..]]' - echo 'Script Options:' - echo ' --help, --h print this message and ant help' - echo ' --noconfig suppress sourcing of /etc/ant.conf,' - echo ' $HOME/.ant/ant.conf, and $HOME/.antrc' - echo ' configuration files' - echo ' --usejikes enable use of jikes by default, unless' - echo ' set explicitly in configuration files' - echo ' --execdebug print ant exec line generated by this' - echo ' launch script' - echo ' ' -fi -# add a second backslash to variables terminated by a backslash under cygwin -if $cygwin; then - case "$ANT_HOME" in - *\\ ) - ANT_HOME="$ANT_HOME\\" - ;; - esac - case "$CYGHOME" in - *\\ ) - CYGHOME="$CYGHOME\\" - ;; - esac - case "$JIKESPATH" in - *\\ ) - JIKESPATH="$JIKESPATH\\" - ;; - esac - case "$LOCALCLASSPATH" in - *\\ ) - LOCALCLASSPATH="$LOCALCLASSPATH\\" - ;; - esac - case "$CLASSPATH" in - *\\ ) - CLASSPATH="$CLASSPATH\\" - ;; - esac -fi -# Execute ant using eval/exec to preserve spaces in paths, -# java options, and ant args -ant_sys_opts= -if [ -n "$CYGHOME" ]; then - if [ -n "$JIKESPATH" ]; then - ant_sys_opts="-Djikes.class.path=\"$JIKESPATH\" -Dcygwin.user.home=\"$CYGHOME\"" - else - ant_sys_opts="-Dcygwin.user.home=\"$CYGHOME\"" - fi -else - if [ -n "$JIKESPATH" ]; then - ant_sys_opts="-Djikes.class.path=\"$JIKESPATH\"" - fi -fi -ant_exec_command="exec \"$JAVACMD\" $ANT_OPTS -classpath \"$LOCALCLASSPATH\" -Dant.home=\"$ANT_HOME\" -Dant.library.dir=\"$ANT_LIB\" $ant_sys_opts org.apache.tools.ant.launch.Launcher $ANT_ARGS -cp \"$CLASSPATH\" $ant_exec_args" -if $ant_exec_debug ; then - echo $ant_exec_command -fi -eval $ant_exec_command diff --git a/runtime/org.argeo.slc.support.hibernate/src/base/bin/slc.bat b/runtime/org.argeo.slc.support.hibernate/src/base/bin/slc.bat deleted file mode 100644 index f8fb7d5da..000000000 --- a/runtime/org.argeo.slc.support.hibernate/src/base/bin/slc.bat +++ /dev/null @@ -1,226 +0,0 @@ -@echo off - -REM Licensed to the Apache Software Foundation (ASF) under one or more -REM contributor license agreements. See the NOTICE file distributed with -REM this work for additional information regarding copyright ownership. -REM The ASF licenses this file to You under the Apache License, Version 2.0 -REM (the "License"); you may not use this file except in compliance with -REM the License. You may obtain a copy of the License at -REM -REM http://www.apache.org/licenses/LICENSE-2.0 -REM -REM Unless required by applicable law or agreed to in writing, software -REM distributed under the License is distributed on an "AS IS" BASIS, -REM WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -REM See the License for the specific language governing permissions and -REM limitations under the License. - -REM This is an inordinately troublesome piece of code, particularly because it -REM tries to work on both Win9x and WinNT-based systems. If we could abandon '9x -REM support, things would be much easier, but sadly, it is not yet time. -REM Be cautious about editing this, and only add WinNT specific stuff in code that -REM only runs on WinNT. - -if "%HOME%"=="" goto homeDrivePathPre -if exist "%HOME%\antrc_pre.bat" call "%HOME%\antrc_pre.bat" - -:homeDrivePathPre -if "%HOMEDRIVE%%HOMEPATH%"=="" goto userProfilePre -if "%HOMEDRIVE%%HOMEPATH%"=="%HOME%" goto userProfilePre -if exist "%HOMEDRIVE%%HOMEPATH%\antrc_pre.bat" call "%HOMEDRIVE%%HOMEPATH%\antrc_pre.bat" - -:userProfilePre -if "%USERPROFILE%"=="" goto alpha -if "%USERPROFILE%"=="%HOME%" goto alpha -if "%USERPROFILE%"=="%HOMEDRIVE%%HOMEPATH%" goto alpha -if exist "%USERPROFILE%\antrc_pre.bat" call "%USERPROFILE%\antrc_pre.bat" - -:alpha - -if "%OS%"=="Windows_NT" @setlocal -if "%OS%"=="WINNT" @setlocal - -if "%ANT_HOME%"=="" goto setDefaultAntHome - -:stripAntHome -if not _%ANT_HOME:~-1%==_\ goto checkClasspath -set ANT_HOME=%ANT_HOME:~0,-1% -goto stripAntHome - -:setDefaultAntHome -rem %~dp0 is expanded pathname of the current script under NT -set ANT_HOME=%~dp0.. - -:checkClasspath -set _USE_CLASSPATH=yes -rem CLASSPATH must not be used if it is equal to "" -if "%CLASSPATH%"=="""" set _USE_CLASSPATH=no -if "%CLASSPATH%"=="" set _USE_CLASSPATH=no - -rem Slurp the command line arguments. This loop allows for an unlimited number -rem of arguments (up to the command line limit, anyway). -set ANT_CMD_LINE_ARGS=%1 -if ""%1""=="""" goto doneStart -shift -:setupArgs -if ""%1""=="""" goto doneStart -if ""%1""==""-noclasspath"" goto clearclasspath -set ANT_CMD_LINE_ARGS=%ANT_CMD_LINE_ARGS% %1 -shift -goto setupArgs - -rem here is there is a -noclasspath in the options -:clearclasspath -set _USE_CLASSPATH=no -shift -goto setupArgs - -rem This label provides a place for the argument list loop to break out -rem and for NT handling to skip to. - -:doneStart - -if _USE_CLASSPATH==no goto findAntHome - -:stripClasspath -if not _%CLASSPATH:~-1%==_\ goto findAntHome -set CLASSPATH=%CLASSPATH:~0,-1% -goto stripClasspath - -:findAntHome -rem find ANT_HOME if it does not exist due to either an invalid value passed -rem by the user or the %0 problem on Windows 9x -if exist "%ANT_HOME%\lib\ant.jar" goto checkJava - -rem check for ant in Program Files -if not exist "%ProgramFiles%\ant" goto checkSystemDrive -set ANT_HOME=%ProgramFiles%\ant -goto checkJava - -:checkSystemDrive -rem check for ant in root directory of system drive -if not exist %SystemDrive%\ant\lib\ant.jar goto checkCDrive -set ANT_HOME=%SystemDrive%\ant -goto checkJava - -:checkCDrive -rem check for ant in C:\ant for Win9X users -if not exist C:\ant\lib\ant.jar goto noAntHome -set ANT_HOME=C:\ant -goto checkJava - -:noAntHome -echo ANT_HOME is set incorrectly or ant could not be located. Please set ANT_HOME. -goto end - -:checkJava -set _JAVACMD=%JAVACMD% - -if "%JAVA_HOME%" == "" goto noJavaHome -if not exist "%JAVA_HOME%\bin\java.exe" goto noJavaHome -if "%_JAVACMD%" == "" set _JAVACMD=%JAVA_HOME%\bin\java.exe -goto checkJikes - -:noJavaHome -if "%_JAVACMD%" == "" set _JAVACMD=java.exe - -:checkJikes -if not "%JIKESPATH%"=="" goto runAntWithJikes - -:runAnt -if "%_USE_CLASSPATH%"=="no" goto runAntNoClasspath -:runAntWithClasspath -"%_JAVACMD%" %ANT_OPTS% -classpath "%ANT_HOME%\lib\ant-launcher.jar" "-Dant.home=%ANT_HOME%" org.apache.tools.ant.launch.Launcher %ANT_ARGS% -cp "%CLASSPATH%" %ANT_CMD_LINE_ARGS% -rem Check the error code of the Ant build -if not "%OS%"=="Windows_NT" goto onError -set ANT_ERROR=%ERRORLEVEL% -goto end - -:runAntNoClasspath -"%_JAVACMD%" %ANT_OPTS% -classpath "%ANT_HOME%\lib\ant-launcher.jar" "-Dant.home=%ANT_HOME%" org.apache.tools.ant.launch.Launcher %ANT_ARGS% %ANT_CMD_LINE_ARGS% -rem Check the error code of the Ant build -if not "%OS%"=="Windows_NT" goto onError -set ANT_ERROR=%ERRORLEVEL% -goto end - -:runAntWithJikes - -if not _%JIKESPATH:~-1%==_\ goto checkJikesAndClasspath -set JIKESPATH=%JIKESPATH:~0,-1% -goto runAntWithJikes - -:checkJikesAndClasspath - -if "%_USE_CLASSPATH%"=="no" goto runAntWithJikesNoClasspath - -:runAntWithJikesAndClasspath -"%_JAVACMD%" %ANT_OPTS% -classpath "%ANT_HOME%\lib\ant-launcher.jar" "-Dant.home=%ANT_HOME%" "-Djikes.class.path=%JIKESPATH%" org.apache.tools.ant.launch.Launcher %ANT_ARGS% -cp "%CLASSPATH%" %ANT_CMD_LINE_ARGS% -rem Check the error code of the Ant build -if not "%OS%"=="Windows_NT" goto onError -set ANT_ERROR=%ERRORLEVEL% -goto end - -:runAntWithJikesNoClasspath -"%_JAVACMD%" %ANT_OPTS% -classpath "%ANT_HOME%\lib\ant-launcher.jar" "-Dant.home=%ANT_HOME%" "-Djikes.class.path=%JIKESPATH%" org.apache.tools.ant.launch.Launcher %ANT_ARGS% %ANT_CMD_LINE_ARGS% -rem Check the error code of the Ant build -if not "%OS%"=="Windows_NT" goto onError -set ANT_ERROR=%ERRORLEVEL% -goto end - -:onError -rem Windows 9x way of checking the error code. It matches via brute force. -for %%i in (1 10 100) do set err%%i= -for %%i in (0 1 2) do if errorlevel %%i00 set err100=%%i -if %err100%==2 goto onError200 -if %err100%==0 set err100= -for %%i in (0 1 2 3 4 5 6 7 8 9) do if errorlevel %err100%%%i0 set err10=%%i -if "%err100%"=="" if %err10%==0 set err10= -:onError1 -for %%i in (0 1 2 3 4 5 6 7 8 9) do if errorlevel %err100%%err10%%%i set err1=%%i -goto onErrorEnd -:onError200 -for %%i in (0 1 2 3 4 5) do if errorlevel 2%%i0 set err10=%%i -if err10==5 for %%i in (0 1 2 3 4 5) do if errorlevel 25%%i set err1=%%i -if not err10==5 goto onError1 -:onErrorEnd -set ANT_ERROR=%err100%%err10%%err1% -for %%i in (1 10 100) do set err%%i= - -:end -rem bug ID 32069: resetting an undefined env variable changes the errorlevel. -if not "%_JAVACMD%"=="" set _JAVACMD= -if not "%_ANT_CMD_LINE_ARGS%"=="" set ANT_CMD_LINE_ARGS= - -if "%ANT_ERROR%"=="0" goto mainEnd - -rem Set the return code if we are not in NT. We can only set -rem a value of 1, but it's better than nothing. -if not "%OS%"=="Windows_NT" echo 1 > nul | choice /n /c:1 - -rem Set the ERRORLEVEL if we are running NT. -if "%OS%"=="Windows_NT" color 00 - -goto omega - -:mainEnd - -rem If there were no errors, we run the post script. -if "%OS%"=="Windows_NT" @endlocal -if "%OS%"=="WINNT" @endlocal - -if "%HOME%"=="" goto homeDrivePathPost -if exist "%HOME%\antrc_post.bat" call "%HOME%\antrc_post.bat" - -:homeDrivePathPost -if "%HOMEDRIVE%%HOMEPATH%"=="" goto userProfilePost -if "%HOMEDRIVE%%HOMEPATH%"=="%HOME%" goto userProfilePost -if exist "%HOMEDRIVE%%HOMEPATH%\antrc_post.bat" call "%HOMEDRIVE%%HOMEPATH%\antrc_post.bat" - -:userProfilePost -if "%USERPROFILE%"=="" goto omega -if "%USERPROFILE%"=="%HOME%" goto omega -if "%USERPROFILE%"=="%HOMEDRIVE%%HOMEPATH%" goto omega -if exist "%USERPROFILE%\antrc_post.bat" call "%USERPROFILE%\antrc_post.bat" - -:omega - diff --git a/runtime/org.argeo.slc.support.hibernate/src/main/java/org/argeo/slc/hibernate/process/SlcExecutionDaoHibernate.java b/runtime/org.argeo.slc.support.hibernate/src/main/java/org/argeo/slc/hibernate/process/SlcExecutionDaoHibernate.java deleted file mode 100644 index f581f9261..000000000 --- a/runtime/org.argeo.slc.support.hibernate/src/main/java/org/argeo/slc/hibernate/process/SlcExecutionDaoHibernate.java +++ /dev/null @@ -1,130 +0,0 @@ -/* - * Copyright (C) 2007-2012 Mathieu Baudier - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.argeo.slc.hibernate.process; - -import java.sql.SQLException; -import java.util.List; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.argeo.slc.SlcException; -import org.argeo.slc.dao.process.SlcExecutionDao; -import org.argeo.slc.process.SlcExecution; -import org.argeo.slc.process.SlcExecutionStep; -import org.hibernate.HibernateException; -import org.hibernate.Session; -import org.springframework.orm.hibernate3.HibernateCallback; -import org.springframework.orm.hibernate3.support.HibernateDaoSupport; - -public class SlcExecutionDaoHibernate extends HibernateDaoSupport implements - SlcExecutionDao { - private final static Log log = LogFactory - .getLog(SlcExecutionDaoHibernate.class); - - public void create(SlcExecution slcExecution) { - getHibernateTemplate().save(slcExecution); - } - - public void update(final SlcExecution slcExecution) { - getHibernateTemplate().update(slcExecution); - } - - public void merge(final SlcExecution slcExecution) { - getHibernateTemplate().merge(slcExecution); - } - - public SlcExecution getSlcExecution(String uuid) { - return (SlcExecution) getHibernateTemplate().get(SlcExecution.class, - uuid); - } - - @SuppressWarnings("unchecked") - public List listSlcExecutions() { - return (List) getHibernateTemplate().loadAll( - SlcExecution.class); - } - - public void addSteps(final String slcExecutionId, - final List additionalSteps) { - getHibernateTemplate().execute(new HibernateCallback() { - - public Object doInHibernate(Session session) - throws HibernateException, SQLException { - SlcExecution slcExecution = getSlcExecution(session, - slcExecutionId); - slcExecution.getSteps().addAll(additionalSteps); - session.update(slcExecution); - return slcExecution; - } - }); - - } - - @SuppressWarnings("unchecked") - public List tailSteps(final String slcExecutionId, - final Integer nbrOfSteps) { - return (List) getHibernateTemplate().execute( - new HibernateCallback() { - - public Object doInHibernate(Session session) - throws HibernateException, SQLException { - SlcExecution slcExecution = getSlcExecution(session, - slcExecutionId); - // TODO: do a query count() instead? - int stepCount = slcExecution.getSteps().size(); - if (stepCount > nbrOfSteps) { - return session.createFilter( - slcExecution.getSteps(), "") - .setFirstResult(stepCount - nbrOfSteps) - .setMaxResults(nbrOfSteps).list(); - } else { - return slcExecution.getSteps(); - } - } - }); - } - - @SuppressWarnings("unchecked") - public List tailSteps(final String slcExecutionId, - final String slcExecutionStepId) { - Object[] values = { slcExecutionStepId, slcExecutionId }; - List indexes = getHibernateTemplate().findByNamedQuery( - SlcExecutionStep.class.getName() + ".stepIndex", values); - - Integer index = indexes.get(0); - if (log.isTraceEnabled()){ - log.trace(indexes.size()); - log.trace("Index " + index + " for step " + slcExecutionStepId - + " in process " + slcExecutionId); - } - Object[] values2 = { slcExecutionId, index }; - return getHibernateTemplate().findByNamedQuery( - SlcExecutionStep.class.getName() + ".stepsAfter", values2); - } - - protected SlcExecution getSlcExecution(Session session, - String slcExecutionId) { - SlcExecution slcExecution = (SlcExecution) session.get( - SlcExecution.class, slcExecutionId); - - if (slcExecution == null) - throw new SlcException("Could not find SLC execution " - + slcExecutionId); - - return slcExecution; - } - -} diff --git a/runtime/org.argeo.slc.support.hibernate/src/main/java/org/argeo/slc/hibernate/runtime/SlcAgentDescriptorDaoHibernate.java b/runtime/org.argeo.slc.support.hibernate/src/main/java/org/argeo/slc/hibernate/runtime/SlcAgentDescriptorDaoHibernate.java deleted file mode 100644 index 5e090598f..000000000 --- a/runtime/org.argeo.slc.support.hibernate/src/main/java/org/argeo/slc/hibernate/runtime/SlcAgentDescriptorDaoHibernate.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright (C) 2007-2012 Mathieu Baudier - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.argeo.slc.hibernate.runtime; - -import java.util.List; - -import org.argeo.slc.dao.runtime.SlcAgentDescriptorDao; -import org.argeo.slc.runtime.SlcAgentDescriptor; -import org.springframework.orm.hibernate3.support.HibernateDaoSupport; - -public class SlcAgentDescriptorDaoHibernate extends HibernateDaoSupport - implements SlcAgentDescriptorDao { - - public void create(SlcAgentDescriptor slcAgentDescriptor) { - getHibernateTemplate().save(slcAgentDescriptor); - } - - public void delete(SlcAgentDescriptor slcAgentDescriptor) { - getHibernateTemplate().delete(slcAgentDescriptor); - } - - public void delete(String agentId) { - Object obj = getHibernateTemplate().get(SlcAgentDescriptor.class, - agentId); - if (obj != null) - getHibernateTemplate().delete(obj); - } - - public SlcAgentDescriptor getAgentDescriptor(String agentId) { - - return (SlcAgentDescriptor) getHibernateTemplate().get( - SlcAgentDescriptor.class, agentId); - } - - @SuppressWarnings("unchecked") - public List listSlcAgentDescriptors() { - return (List) getHibernateTemplate().loadAll( - SlcAgentDescriptor.class); - } - -} diff --git a/runtime/org.argeo.slc.support.hibernate/src/main/java/org/argeo/slc/hibernate/test/TestRunDescriptorDaoHibernate.java b/runtime/org.argeo.slc.support.hibernate/src/main/java/org/argeo/slc/hibernate/test/TestRunDescriptorDaoHibernate.java deleted file mode 100644 index 3ddf0e18e..000000000 --- a/runtime/org.argeo.slc.support.hibernate/src/main/java/org/argeo/slc/hibernate/test/TestRunDescriptorDaoHibernate.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (C) 2007-2012 Mathieu Baudier - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.argeo.slc.hibernate.test; - -import org.springframework.orm.hibernate3.support.HibernateDaoSupport; - -import org.argeo.slc.dao.test.TestRunDescriptorDao; -import org.argeo.slc.test.TestRunDescriptor; - -public class TestRunDescriptorDaoHibernate extends HibernateDaoSupport - implements TestRunDescriptorDao { - - public TestRunDescriptor getTestRunDescriptor(String id) { - return (TestRunDescriptor) getHibernateTemplate().get( - TestRunDescriptor.class, id); - } - - public void saveOrUpdate(TestRunDescriptor testRunDescriptor) { - getHibernateTemplate().saveOrUpdate(testRunDescriptor); - } - -} diff --git a/runtime/org.argeo.slc.support.hibernate/src/main/java/org/argeo/slc/hibernate/test/tree/TreeTestResultCollectionDaoHibernate.java b/runtime/org.argeo.slc.support.hibernate/src/main/java/org/argeo/slc/hibernate/test/tree/TreeTestResultCollectionDaoHibernate.java deleted file mode 100644 index dc99deecf..000000000 --- a/runtime/org.argeo.slc.support.hibernate/src/main/java/org/argeo/slc/hibernate/test/tree/TreeTestResultCollectionDaoHibernate.java +++ /dev/null @@ -1,154 +0,0 @@ -/* - * Copyright (C) 2007-2012 Mathieu Baudier - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.argeo.slc.hibernate.test.tree; - -import java.sql.SQLException; -import java.util.List; -import java.util.Map; -import java.util.SortedSet; -import java.util.TreeSet; - -import org.argeo.slc.SlcException; -import org.argeo.slc.core.test.tree.ResultAttributes; -import org.argeo.slc.core.test.tree.TreeTestResult; -import org.argeo.slc.core.test.tree.TreeTestResultCollection; -import org.argeo.slc.dao.test.tree.TreeTestResultCollectionDao; -import org.hibernate.HibernateException; -import org.hibernate.LockMode; -import org.hibernate.Session; -import org.springframework.orm.hibernate3.HibernateCallback; -import org.springframework.orm.hibernate3.support.HibernateDaoSupport; - -/** Hibernate implementation of collections DAO. */ -public class TreeTestResultCollectionDaoHibernate extends HibernateDaoSupport - implements TreeTestResultCollectionDao { - - public void create(TreeTestResultCollection ttrCollection) { - getHibernateTemplate().save(ttrCollection); - } - - public TreeTestResultCollection getTestResultCollection(String id) { - return (TreeTestResultCollection) getHibernateTemplate().get( - TreeTestResultCollection.class, id); - } - - public void update(TreeTestResultCollection ttrCollection) { - getHibernateTemplate().update(ttrCollection); - } - - public void delete(TreeTestResultCollection ttrCollection) { - getHibernateTemplate().delete(ttrCollection); - } - - @SuppressWarnings("unchecked") - public SortedSet listCollections() { - return new TreeSet(getHibernateTemplate() - .find("from TreeTestResultCollection")); - } - - public void addResultToCollection(final TreeTestResultCollection ttrc, - final String resultUuid) { - getHibernateTemplate().execute(new HibernateCallback() { - public Object doInHibernate(Session session) - throws HibernateException, SQLException { - session.lock(ttrc, LockMode.NONE); - TreeTestResult ttr = (TreeTestResult) session.get( - TreeTestResult.class, resultUuid); - ttrc.getResults().add(ttr); - session.update(ttrc); - return ttrc; - } - }); - } - - public void removeResultFromCollection(final TreeTestResultCollection ttrc, - final String resultUuid) { - getHibernateTemplate().execute(new HibernateCallback() { - public Object doInHibernate(Session session) - throws HibernateException, SQLException { - session.lock(ttrc, LockMode.NONE); - TreeTestResult ttr = (TreeTestResult) session.get( - TreeTestResult.class, resultUuid); - if (ttrc.getResults().remove(ttr)) - session.update(ttrc); - return ttrc; - } - }); - } - - @SuppressWarnings("unchecked") - public List listResultAttributes(String collectionId) { - List list; - if (collectionId == null) - list = getHibernateTemplate().find( - "select new org.argeo.slc.core.test.tree.ResultAttributes(ttr)" - + " from TreeTestResult ttr"); - else - list = getHibernateTemplate() - .find( - "select new org.argeo.slc.core.test.tree.ResultAttributes(ttr) " - + " from TreeTestResult ttr, TreeTestResultCollection ttrc " - + " where ttr in elements(ttrc.results) and ttrc.id=?", - collectionId); - - return list; - } - - @SuppressWarnings("unchecked") - public List listResults(String collectionId, - Map attributes) { - List list; - - if (collectionId == null) { - if (attributes == null || attributes.size() == 0) - list = getHibernateTemplate().find("from TreeTestResult"); - else if (attributes.size() == 1) { - Map.Entry entry = attributes.entrySet() - .iterator().next(); - Object[] args = { entry.getKey(), entry.getValue() }; - list = getHibernateTemplate().find( - "select ttr from TreeTestResult ttr" - + " where attributes[?]=?", args); - } else { - throw new SlcException( - "Multiple attributes filter are currently not supported."); - } - } else { - if (attributes == null || attributes.size() == 0) - list = getHibernateTemplate() - .find( - "select ttr " - + " from TreeTestResult ttr, TreeTestResultCollection ttrc " - + " where ttr in elements(ttrc.results) and ttrc.id=?", - collectionId); - else if (attributes.size() == 1) { - Map.Entry entry = attributes.entrySet() - .iterator().next(); - Object[] args = { collectionId, entry.getKey(), - entry.getValue() }; - list = getHibernateTemplate() - .find( - "select ttr from TreeTestResult ttr, TreeTestResultCollection ttrc " - + " where ttr in elements(ttrc.results) and ttrc.id=?" - + " and attributes[?]=?", args); - } else { - throw new SlcException( - "Multiple attributes filter are currently not supported."); - } - } - return list; - } -} diff --git a/runtime/org.argeo.slc.support.hibernate/src/main/java/org/argeo/slc/hibernate/test/tree/TreeTestResultDaoHibernate.java b/runtime/org.argeo.slc.support.hibernate/src/main/java/org/argeo/slc/hibernate/test/tree/TreeTestResultDaoHibernate.java deleted file mode 100644 index c25a156ef..000000000 --- a/runtime/org.argeo.slc.support.hibernate/src/main/java/org/argeo/slc/hibernate/test/tree/TreeTestResultDaoHibernate.java +++ /dev/null @@ -1,172 +0,0 @@ -/* - * Copyright (C) 2007-2012 Mathieu Baudier - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.argeo.slc.hibernate.test.tree; - -import java.sql.SQLException; -import java.util.Date; -import java.util.List; -import java.util.Map; -import java.util.SortedMap; - -import org.argeo.slc.SlcException; -import org.argeo.slc.core.attachment.SimpleAttachment; -import org.argeo.slc.core.structure.tree.TreeSPath; -import org.argeo.slc.core.test.SimpleResultPart; -import org.argeo.slc.core.test.tree.PartSubList; -import org.argeo.slc.core.test.tree.TreeTestResult; -import org.argeo.slc.dao.test.tree.TreeTestResultDao; -import org.argeo.slc.structure.StructureElement; -import org.argeo.slc.test.TestResult; -import org.hibernate.HibernateException; -import org.hibernate.Session; -import org.springframework.orm.hibernate3.HibernateCallback; -import org.springframework.orm.hibernate3.support.HibernateDaoSupport; -import org.springframework.util.Assert; - -/** - * The Hibernate implementation for tree-based result of the test result dao. - * - * @see TreeTestResult - */ -public class TreeTestResultDaoHibernate extends HibernateDaoSupport implements - TreeTestResultDao { - - public void create(TestResult testResult) { - getHibernateTemplate().save(testResult); - } - - public void update(TestResult testResult) { - getHibernateTemplate().saveOrUpdate(testResult); - } - - public TreeTestResult getTestResult(String uuid) { - List list = getHibernateTemplate().find( - "from TreeTestResult where uuid=?", uuid); - if (list.size() == 0) { - return null; - } else { - return (TreeTestResult) list.get(0); - } - - } - - @SuppressWarnings("unchecked") - public List listTestResults() { - return (List) getHibernateTemplate().find( - "from TreeTestResult"); - } - - @SuppressWarnings("unchecked") - public List listResults(TreeSPath path) { - List list = getHibernateTemplate().find( - "from TreeTestResult res where ? in indices(res.resultParts)", - path.getAsUniqueString()); - return list; - } - - public void close(final String testResultId, final Date closeDate) { - getHibernateTemplate().execute(new HibernateCallback() { - - public Object doInHibernate(Session session) - throws HibernateException, SQLException { - TreeTestResult treeTestResult = getTreeTestResult(session, - testResultId); - treeTestResult.setCloseDate(closeDate); - session.update(treeTestResult); - return treeTestResult; - } - }); - } - - public void addResultPart(final String testResultId, final TreeSPath path, - final SimpleResultPart resultPart, - final Map relatedElements) { - - getHibernateTemplate().execute(new HibernateCallback() { - - public Object doInHibernate(Session session) - throws HibernateException, SQLException { - TreeTestResult treeTestResult = getTreeTestResult(session, - testResultId); - PartSubList lst = treeTestResult.getResultParts().get(path); - if (lst == null) { - lst = new PartSubList(); - treeTestResult.getResultParts().put(path, lst); - } - lst.getParts().add(resultPart); - if (relatedElements != null) - treeTestResult.getElements().putAll(relatedElements); - - session.update(treeTestResult); - return treeTestResult; - } - }); - - } - - public void addAttachment(final String testResultId, - final SimpleAttachment attachment) { - getHibernateTemplate().execute(new HibernateCallback() { - - public Object doInHibernate(Session session) - throws HibernateException, SQLException { - TreeTestResult treeTestResult = getTreeTestResult(session, - testResultId); - - // Check is there is already such an attachment - Assert.notNull(attachment, "attachment is null"); - Assert.notNull(session, "session is null"); - SimpleAttachment att = (SimpleAttachment) session.get( - attachment.getClass(), attachment.getUuid()); - if (att != null) - throw new SlcException( - "There is already an attachement with id " - + attachment.getUuid()); - - treeTestResult.getAttachments().add(attachment); - session.update(treeTestResult); - return treeTestResult; - } - }); - - } - - protected TreeTestResult getTreeTestResult(Session session, - String testResultId) { - TreeTestResult treeTestResult = (TreeTestResult) session.get( - TreeTestResult.class, testResultId); - if (treeTestResult == null) - throw new SlcException("No result with id " + testResultId); - return treeTestResult; - } - - public void updateAttributes(final String testResultId, - final SortedMap attributes) { - getHibernateTemplate().execute(new HibernateCallback() { - - public Object doInHibernate(Session session) - throws HibernateException, SQLException { - TreeTestResult treeTestResult = getTreeTestResult(session, - testResultId); - treeTestResult.setAttributes(attributes); - - session.update(treeTestResult); - return treeTestResult; - } - }); - } - -} diff --git a/runtime/org.argeo.slc.support.hibernate/src/main/java/org/argeo/slc/hibernate/test/tree/package.html b/runtime/org.argeo.slc.support.hibernate/src/main/java/org/argeo/slc/hibernate/test/tree/package.html deleted file mode 100644 index 6042b0789..000000000 --- a/runtime/org.argeo.slc.support.hibernate/src/main/java/org/argeo/slc/hibernate/test/tree/package.html +++ /dev/null @@ -1,6 +0,0 @@ - - - -Hibernate based DAO implementations for tree-based SLC Test. - - \ No newline at end of file diff --git a/runtime/org.argeo.slc.support.hibernate/src/main/resources/org/argeo/slc/hibernate/attachment/SimpleAttachment.hbm.xml b/runtime/org.argeo.slc.support.hibernate/src/main/resources/org/argeo/slc/hibernate/attachment/SimpleAttachment.hbm.xml deleted file mode 100644 index d35d9ff98..000000000 --- a/runtime/org.argeo.slc.support.hibernate/src/main/resources/org/argeo/slc/hibernate/attachment/SimpleAttachment.hbm.xml +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/runtime/org.argeo.slc.support.hibernate/src/main/resources/org/argeo/slc/hibernate/dao.xml b/runtime/org.argeo.slc.support.hibernate/src/main/resources/org/argeo/slc/hibernate/dao.xml deleted file mode 100644 index baac4036e..000000000 --- a/runtime/org.argeo.slc.support.hibernate/src/main/resources/org/argeo/slc/hibernate/dao.xml +++ /dev/null @@ -1,48 +0,0 @@ - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/runtime/org.argeo.slc.support.hibernate/src/main/resources/org/argeo/slc/hibernate/ehcache.xml b/runtime/org.argeo.slc.support.hibernate/src/main/resources/org/argeo/slc/hibernate/ehcache.xml deleted file mode 100644 index b09747786..000000000 --- a/runtime/org.argeo.slc.support.hibernate/src/main/resources/org/argeo/slc/hibernate/ehcache.xml +++ /dev/null @@ -1,71 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/runtime/org.argeo.slc.support.hibernate/src/main/resources/org/argeo/slc/hibernate/process/RealizedFlow.hbm.xml b/runtime/org.argeo.slc.support.hibernate/src/main/resources/org/argeo/slc/hibernate/process/RealizedFlow.hbm.xml deleted file mode 100644 index c56231d83..000000000 --- a/runtime/org.argeo.slc.support.hibernate/src/main/resources/org/argeo/slc/hibernate/process/RealizedFlow.hbm.xml +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - - - - - - - - \ No newline at end of file diff --git a/runtime/org.argeo.slc.support.hibernate/src/main/resources/org/argeo/slc/hibernate/process/SlcExecution.hbm.xml b/runtime/org.argeo.slc.support.hibernate/src/main/resources/org/argeo/slc/hibernate/process/SlcExecution.hbm.xml deleted file mode 100644 index 526d6bf0c..000000000 --- a/runtime/org.argeo.slc.support.hibernate/src/main/resources/org/argeo/slc/hibernate/process/SlcExecution.hbm.xml +++ /dev/null @@ -1,51 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/runtime/org.argeo.slc.support.hibernate/src/main/resources/org/argeo/slc/hibernate/process/SlcExecutionStep.hbm.xml b/runtime/org.argeo.slc.support.hibernate/src/main/resources/org/argeo/slc/hibernate/process/SlcExecutionStep.hbm.xml deleted file mode 100644 index 0a1ce76dc..000000000 --- a/runtime/org.argeo.slc.support.hibernate/src/main/resources/org/argeo/slc/hibernate/process/SlcExecutionStep.hbm.xml +++ /dev/null @@ -1,54 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - ? - ]]> - - \ No newline at end of file diff --git a/runtime/org.argeo.slc.support.hibernate/src/main/resources/org/argeo/slc/hibernate/runtime/SlcAgentDescriptor.hbm.xml b/runtime/org.argeo.slc.support.hibernate/src/main/resources/org/argeo/slc/hibernate/runtime/SlcAgentDescriptor.hbm.xml deleted file mode 100644 index 90ada75f3..000000000 --- a/runtime/org.argeo.slc.support.hibernate/src/main/resources/org/argeo/slc/hibernate/runtime/SlcAgentDescriptor.hbm.xml +++ /dev/null @@ -1,39 +0,0 @@ - - - - - - - - - - - - \ No newline at end of file diff --git a/runtime/org.argeo.slc.support.hibernate/src/main/resources/org/argeo/slc/hibernate/sessionFactories.xml b/runtime/org.argeo.slc.support.hibernate/src/main/resources/org/argeo/slc/hibernate/sessionFactories.xml deleted file mode 100644 index 48544ecb9..000000000 --- a/runtime/org.argeo.slc.support.hibernate/src/main/resources/org/argeo/slc/hibernate/sessionFactories.xml +++ /dev/null @@ -1,74 +0,0 @@ - - - - - - - - - org/argeo/slc/hibernate/structure/SimpleSElement.hbm.xml - - - org/argeo/slc/hibernate/test/SimpleResultPart.hbm.xml - - - org/argeo/slc/hibernate/test/tree/TreeTestResult.hbm.xml - - - org/argeo/slc/hibernate/test/tree/TreeTestResultCollection.hbm.xml - - - org/argeo/slc/hibernate/test/tree/PartSubList.hbm.xml - - - org/argeo/slc/hibernate/test/TestRunDescriptor.hbm.xml - - - org/argeo/slc/hibernate/process/SlcExecution.hbm.xml - - - org/argeo/slc/hibernate/process/SlcExecutionStep.hbm.xml - - - org/argeo/slc/hibernate/runtime/SlcAgentDescriptor.hbm.xml - - - org/argeo/slc/hibernate/attachment/SimpleAttachment.hbm.xml - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/runtime/org.argeo.slc.support.hibernate/src/main/resources/org/argeo/slc/hibernate/spring.xml b/runtime/org.argeo.slc.support.hibernate/src/main/resources/org/argeo/slc/hibernate/spring.xml deleted file mode 100644 index 240aa921a..000000000 --- a/runtime/org.argeo.slc.support.hibernate/src/main/resources/org/argeo/slc/hibernate/spring.xml +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/runtime/org.argeo.slc.support.hibernate/src/main/resources/org/argeo/slc/hibernate/structure/SimpleSElement.hbm.xml b/runtime/org.argeo.slc.support.hibernate/src/main/resources/org/argeo/slc/hibernate/structure/SimpleSElement.hbm.xml deleted file mode 100644 index 2244d49c6..000000000 --- a/runtime/org.argeo.slc.support.hibernate/src/main/resources/org/argeo/slc/hibernate/structure/SimpleSElement.hbm.xml +++ /dev/null @@ -1,37 +0,0 @@ - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/runtime/org.argeo.slc.support.hibernate/src/main/resources/org/argeo/slc/hibernate/test/SimpleResultPart.hbm.xml b/runtime/org.argeo.slc.support.hibernate/src/main/resources/org/argeo/slc/hibernate/test/SimpleResultPart.hbm.xml deleted file mode 100644 index b84cfd679..000000000 --- a/runtime/org.argeo.slc.support.hibernate/src/main/resources/org/argeo/slc/hibernate/test/SimpleResultPart.hbm.xml +++ /dev/null @@ -1,35 +0,0 @@ - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/runtime/org.argeo.slc.support.hibernate/src/main/resources/org/argeo/slc/hibernate/test/TestRunDescriptor.hbm.xml b/runtime/org.argeo.slc.support.hibernate/src/main/resources/org/argeo/slc/hibernate/test/TestRunDescriptor.hbm.xml deleted file mode 100644 index a0ba08c9b..000000000 --- a/runtime/org.argeo.slc.support.hibernate/src/main/resources/org/argeo/slc/hibernate/test/TestRunDescriptor.hbm.xml +++ /dev/null @@ -1,35 +0,0 @@ - - - - - - - - - - - - - \ No newline at end of file diff --git a/runtime/org.argeo.slc.support.hibernate/src/main/resources/org/argeo/slc/hibernate/test/tree/PartSubList.hbm.xml b/runtime/org.argeo.slc.support.hibernate/src/main/resources/org/argeo/slc/hibernate/test/tree/PartSubList.hbm.xml deleted file mode 100644 index 08fc99203..000000000 --- a/runtime/org.argeo.slc.support.hibernate/src/main/resources/org/argeo/slc/hibernate/test/tree/PartSubList.hbm.xml +++ /dev/null @@ -1,37 +0,0 @@ - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/runtime/org.argeo.slc.support.hibernate/src/main/resources/org/argeo/slc/hibernate/test/tree/TreeTestResult.hbm.xml b/runtime/org.argeo.slc.support.hibernate/src/main/resources/org/argeo/slc/hibernate/test/tree/TreeTestResult.hbm.xml deleted file mode 100644 index 6144656e7..000000000 --- a/runtime/org.argeo.slc.support.hibernate/src/main/resources/org/argeo/slc/hibernate/test/tree/TreeTestResult.hbm.xml +++ /dev/null @@ -1,68 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/runtime/org.argeo.slc.support.hibernate/src/main/resources/org/argeo/slc/hibernate/test/tree/TreeTestResultCollection.hbm.xml b/runtime/org.argeo.slc.support.hibernate/src/main/resources/org/argeo/slc/hibernate/test/tree/TreeTestResultCollection.hbm.xml deleted file mode 100644 index 7988d2bd9..000000000 --- a/runtime/org.argeo.slc.support.hibernate/src/main/resources/org/argeo/slc/hibernate/test/tree/TreeTestResultCollection.hbm.xml +++ /dev/null @@ -1,35 +0,0 @@ - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/runtime/org.argeo.slc.support.hibernate/src/site/apt/index.apt b/runtime/org.argeo.slc.support.hibernate/src/site/apt/index.apt deleted file mode 100644 index f414460db..000000000 --- a/runtime/org.argeo.slc.support.hibernate/src/site/apt/index.apt +++ /dev/null @@ -1 +0,0 @@ -Argeo SLC Site \ No newline at end of file diff --git a/runtime/org.argeo.slc.support.hibernate/src/test/java/org/argeo/slc/hibernate/process/CastorSlcExecutionHibernateTest.java b/runtime/org.argeo.slc.support.hibernate/src/test/java/org/argeo/slc/hibernate/process/CastorSlcExecutionHibernateTest.java deleted file mode 100644 index d2698c2ed..000000000 --- a/runtime/org.argeo.slc.support.hibernate/src/test/java/org/argeo/slc/hibernate/process/CastorSlcExecutionHibernateTest.java +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Copyright (C) 2007-2012 Mathieu Baudier - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.argeo.slc.hibernate.process; - -import java.sql.SQLException; - -import org.argeo.slc.dao.process.SlcExecutionDao; -import org.argeo.slc.hibernate.unit.HibernateTestCase; -import org.argeo.slc.msg.ObjectList; -import org.argeo.slc.process.SlcExecution; -import org.argeo.slc.unit.process.SlcExecutionTestUtils; -import org.hibernate.HibernateException; -import org.hibernate.Session; -import org.springframework.orm.hibernate3.HibernateCallback; -import org.springframework.oxm.Marshaller; -import org.springframework.oxm.Unmarshaller; -import org.springframework.xml.transform.StringResult; -import org.springframework.xml.transform.StringSource; - -public class CastorSlcExecutionHibernateTest extends HibernateTestCase { - - public void testSaveWithRealizedFlowsXml() throws Exception { - SlcExecutionDao dao = getBean(SlcExecutionDao.class); - - SlcExecution slcExec = SlcExecutionTestUtils - .createSlcExecutionWithRealizedFlows(); - - ObjectList ol = new ObjectList(slcExec.getRealizedFlows()); - StringResult result = new StringResult(); - getBean(Marshaller.class).marshal(ol, result); - slcExec.setRealizedFlowsXml(result.toString()); - - dao.create(slcExec); - - SlcExecution slcExecPersisted = dao.getSlcExecution(slcExec.getUuid()); - assertSlcExecution(slcExec, slcExecPersisted); - - StringSource source = new StringSource(slcExecPersisted - .getRealizedFlowsXml()); - ObjectList ol2 = (ObjectList) getBean(Unmarshaller.class).unmarshal( - source); - ol2.fill(slcExec.getRealizedFlows()); - - } - - public void assertSlcExecution(final SlcExecution expected, - final SlcExecution persisted) { - getHibernateTemplate().execute(new HibernateCallback() { - - public Object doInHibernate(Session session) - throws HibernateException, SQLException { - session.refresh(persisted); - SlcExecutionTestUtils.assertSlcExecution(expected, persisted); - return null; - } - }); - } - - @Override - protected String getApplicationContextLocation() { - return "org/argeo/slc/hibernate/withCastor.xml"; - } -} diff --git a/runtime/org.argeo.slc.support.hibernate/src/test/java/org/argeo/slc/hibernate/process/SlcExecutionHibernateTest.java b/runtime/org.argeo.slc.support.hibernate/src/test/java/org/argeo/slc/hibernate/process/SlcExecutionHibernateTest.java deleted file mode 100644 index b4798ce60..000000000 --- a/runtime/org.argeo.slc.support.hibernate/src/test/java/org/argeo/slc/hibernate/process/SlcExecutionHibernateTest.java +++ /dev/null @@ -1,133 +0,0 @@ -/* - * Copyright (C) 2007-2012 Mathieu Baudier - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.argeo.slc.hibernate.process; - -import java.sql.SQLException; -import java.util.ArrayList; -import java.util.List; - -import org.argeo.slc.dao.process.SlcExecutionDao; -import org.argeo.slc.hibernate.unit.HibernateTestCase; -import org.argeo.slc.process.SlcExecution; -import org.argeo.slc.process.SlcExecutionStep; -import org.argeo.slc.unit.process.SlcExecutionTestUtils; -import org.hibernate.HibernateException; -import org.hibernate.Session; -import org.springframework.orm.hibernate3.HibernateCallback; - -public class SlcExecutionHibernateTest extends HibernateTestCase { - - public void testSave() { - SlcExecutionDao dao = getBean(SlcExecutionDao.class); - - SlcExecution slcExec = SlcExecutionTestUtils.createSimpleSlcExecution(); - slcExec.getSteps().add(new SlcExecutionStep("A log line")); - slcExec.getSteps().add(new SlcExecutionStep("Two log\nlines")); - - dao.create(slcExec); - - SlcExecution slcExecPersisted = dao.getSlcExecution(slcExec.getUuid()); - assertSlcExecution(slcExec, slcExecPersisted); - } - - public void testTailSteps() { - SlcExecutionDao dao = getBean(SlcExecutionDao.class); - - SlcExecution slcExec = SlcExecutionTestUtils.createSimpleSlcExecution(); - int totalStepCount = 20; - for (int i = 0; i < totalStepCount; i++) { - slcExec.getSteps().add(new SlcExecutionStep("Log " + i)); - } - dao.create(slcExec); - - int lastStepsCount = 7; - List firstSteps = dao.tailSteps(slcExec.getUuid(), - lastStepsCount); - assertEquals(lastStepsCount, firstSteps.size()); - - SlcExecutionStep lastStep = firstSteps.get(lastStepsCount - 1); - - List additionalSteps = new ArrayList(); - int additionalStepsCount = 13; - for (int i = 0; i < additionalStepsCount; i++) { - additionalSteps.add(new SlcExecutionStep("Additonal log " + i)); - } - dao.addSteps(slcExec.getUuid(), additionalSteps); - - List lastSteps = dao.tailSteps(slcExec.getUuid(), - lastStep.getUuid()); - assertEquals(additionalStepsCount, lastSteps.size()); - } - - public void testModify() { - SlcExecutionDao dao = getBean(SlcExecutionDao.class); - - // slcExecution Creation - SlcExecution slcExec = SlcExecutionTestUtils.createSimpleSlcExecution(); - slcExec.getSteps().add(new SlcExecutionStep("A log line")); - slcExec.getSteps().add(new SlcExecutionStep("Two log\nlines")); - - dao.create(slcExec); - - // slcExecution retrieval and update - final SlcExecution slcExecRetrieved = dao.getSlcExecution(slcExec - .getUuid()); - - getHibernateTemplate().execute(new HibernateCallback() { - - public Object doInHibernate(Session session) - throws HibernateException, SQLException { - session.refresh(slcExecRetrieved); - List logLineListStep0 = slcExecRetrieved.getSteps() - .get(0).getLogLines(); - for (String logLine : logLineListStep0) - logLine = logLine + "appended Log text"; - - slcExecRetrieved.getSteps().get(0) - .setLogLines(logLineListStep0); - slcExecRetrieved.getSteps().add( - new SlcExecutionStep("Three \n log \n lines")); - return null; - } - }); - - dao.update(slcExecRetrieved); - - // updated slcExecution retrieval and comparison - SlcExecution slcExecUpdated = dao.getSlcExecution(slcExec.getUuid()); - - assertSlcExecution(slcExecRetrieved, slcExecUpdated); - } - - public void assertSlcExecution(final SlcExecution expected, - final SlcExecution persisted) { - getHibernateTemplate().execute(new HibernateCallback() { - - public Object doInHibernate(Session session) - throws HibernateException, SQLException { - session.refresh(persisted); - SlcExecutionTestUtils.assertSlcExecution(expected, persisted); - return null; - } - }); - } - - @Override - protected String getApplicationContextLocation() { - return "org/argeo/slc/hibernate/applicationContext.xml"; - } - -} diff --git a/runtime/org.argeo.slc.support.hibernate/src/test/java/org/argeo/slc/hibernate/test/tree/CastorTestResultDaoHibernateTest.java b/runtime/org.argeo.slc.support.hibernate/src/test/java/org/argeo/slc/hibernate/test/tree/CastorTestResultDaoHibernateTest.java deleted file mode 100644 index c922809b7..000000000 --- a/runtime/org.argeo.slc.support.hibernate/src/test/java/org/argeo/slc/hibernate/test/tree/CastorTestResultDaoHibernateTest.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright (C) 2007-2012 Mathieu Baudier - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.argeo.slc.hibernate.test.tree; - -import org.argeo.slc.core.structure.tree.TreeSPath; -import org.argeo.slc.core.test.tree.TreeTestResult; -import org.argeo.slc.dao.test.tree.TreeTestResultDao; -import org.argeo.slc.hibernate.unit.HibernateTestCase; -import org.argeo.slc.unit.test.tree.TreeTestResultTestUtils; -import org.springframework.oxm.Marshaller; -import org.springframework.oxm.Unmarshaller; -import org.springframework.xml.transform.StringResult; -import org.springframework.xml.transform.StringSource; - -public class CastorTestResultDaoHibernateTest extends HibernateTestCase { - - public void testUnmarshallAndCreate() throws Exception { - TreeTestResult ttr = TreeTestResultTestUtils - .createCompleteTreeTestResult(); - - StringResult result = new StringResult(); - getBean(Marshaller.class).marshal(ttr, result); - - StringSource source = new StringSource(result.toString()); - TreeTestResult ttrUnm = (TreeTestResult) getBean(Unmarshaller.class) - .unmarshal(source); - - for (TreeSPath path : ttrUnm.getResultParts().keySet()) { - log.debug("Path: " + path.getClass() + ": " + path); - } - - TreeTestResultDao ttrDao = getBean(TreeTestResultDao.class); - ttrDao.create(ttrUnm); - TreeTestResult ttrPersist = ttrDao.getTestResult(ttr.getUuid()); - - TreeTestResultDaoHibernateTest.assertInHibernate( - getHibernateTemplate(), ttr, ttrPersist); - } - - @Override - protected String getApplicationContextLocation() { - return "org/argeo/slc/hibernate/withCastor.xml"; - } - -} diff --git a/runtime/org.argeo.slc.support.hibernate/src/test/java/org/argeo/slc/hibernate/test/tree/TreeTestResultCollectionDaoHibernateTest.java b/runtime/org.argeo.slc.support.hibernate/src/test/java/org/argeo/slc/hibernate/test/tree/TreeTestResultCollectionDaoHibernateTest.java deleted file mode 100644 index de9aa1685..000000000 --- a/runtime/org.argeo.slc.support.hibernate/src/test/java/org/argeo/slc/hibernate/test/tree/TreeTestResultCollectionDaoHibernateTest.java +++ /dev/null @@ -1,122 +0,0 @@ -/* - * Copyright (C) 2007-2012 Mathieu Baudier - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.argeo.slc.hibernate.test.tree; - -import java.sql.SQLException; -import java.util.Date; - -import org.argeo.slc.core.test.tree.TreeTestResult; -import org.argeo.slc.core.test.tree.TreeTestResultCollection; -import org.argeo.slc.dao.test.tree.TreeTestResultCollectionDao; -import org.argeo.slc.dao.test.tree.TreeTestResultDao; -import org.argeo.slc.hibernate.unit.HibernateTestCase; -import org.argeo.slc.unit.test.tree.TreeTestResultTestUtils; -import org.argeo.slc.unit.test.tree.UnitTestTreeUtil; -import org.hibernate.HibernateException; -import org.hibernate.Session; -import org.springframework.orm.hibernate3.HibernateCallback; - -public class TreeTestResultCollectionDaoHibernateTest extends HibernateTestCase { - - public void testScenario() { - TreeTestResultDao ttrDao = getBean(TreeTestResultDao.class); - TreeTestResultCollectionDao ttrcDao = getBean(TreeTestResultCollectionDao.class); - - String ttrcName = "testCollection"; - - TreeTestResult ttr1 = TreeTestResultTestUtils - .createCompleteTreeTestResult(); - ttrDao.create(ttr1); - - TreeTestResultCollection ttrc = new TreeTestResultCollection(ttrcName); - ttrcDao.create(ttrc); - - ttrc.getResults().add(ttr1); - ttrcDao.update(ttrc); - - final TreeTestResult ttr2 = TreeTestResultTestUtils - .createCompleteTreeTestResult(); - ttrDao.create(ttr2); - - ttrc.getResults().add(ttr2); - ttrcDao.update(ttrc); - - ttrc.getResults().remove(ttr1); - ttrcDao.update(ttrc); - - final TreeTestResultCollection ttrcPersist = ttrcDao - .getTestResultCollection(ttrcName); - - // Because of lazy initialization - getHibernateTemplate().execute(new HibernateCallback() { - - public Object doInHibernate(Session session) - throws HibernateException, SQLException { - session.refresh(ttrcPersist); - assertEquals(1, ttrcPersist.getResults().size()); - UnitTestTreeUtil.assertTreeTestResult(ttr2, ttrcPersist - .getResults().iterator().next()); - return null; - } - }); - } - - public void testResultsWithSameCloseDate() { - TreeTestResultDao ttrDao = getBean(TreeTestResultDao.class); - TreeTestResultCollectionDao ttrcDao = getBean(TreeTestResultCollectionDao.class); - - String ttrcName = "testCollection"; - - Date closeDate = new Date(); - - // TTR1 - TreeTestResult ttr1 = TreeTestResultTestUtils - .createCompleteTreeTestResult(); - ttr1.setCloseDate(closeDate); - ttrDao.create(ttr1); - - // TTR2 - TreeTestResult ttr2 = TreeTestResultTestUtils - .createCompleteTreeTestResult(); - ttr2.setCloseDate(closeDate); - ttrDao.create(ttr2); - - // TTRC - TreeTestResultCollection ttrc = new TreeTestResultCollection(ttrcName); - ttrc.getResults().add(ttr1); - ttrc.getResults().add(ttr2); - ttrcDao.create(ttrc); - - final TreeTestResultCollection ttrcPersist = ttrcDao - .getTestResultCollection(ttrcName); - // Because of lazy initialization - getHibernateTemplate().execute(new HibernateCallback() { - - public Object doInHibernate(Session session) - throws HibernateException, SQLException { - session.refresh(ttrcPersist); - assertEquals(2, ttrcPersist.getResults().size()); - return null; - } - }); - } - - @Override - protected String getApplicationContextLocation() { - return "org/argeo/slc/hibernate/applicationContext.xml"; - } - -} diff --git a/runtime/org.argeo.slc.support.hibernate/src/test/java/org/argeo/slc/hibernate/test/tree/TreeTestResultDaoHibernateTest.java b/runtime/org.argeo.slc.support.hibernate/src/test/java/org/argeo/slc/hibernate/test/tree/TreeTestResultDaoHibernateTest.java deleted file mode 100644 index 4c5baa6fa..000000000 --- a/runtime/org.argeo.slc.support.hibernate/src/test/java/org/argeo/slc/hibernate/test/tree/TreeTestResultDaoHibernateTest.java +++ /dev/null @@ -1,175 +0,0 @@ -/* - * Copyright (C) 2007-2012 Mathieu Baudier - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.argeo.slc.hibernate.test.tree; - -import java.sql.SQLException; - -import org.argeo.slc.core.structure.SimpleSElement; -import org.argeo.slc.core.structure.tree.TreeSPath; -import org.argeo.slc.core.structure.tree.TreeSRegistry; -import org.argeo.slc.core.test.SimpleResultPart; -import org.argeo.slc.core.test.tree.TreeTestResult; -import org.argeo.slc.dao.test.tree.TreeTestResultDao; -import org.argeo.slc.hibernate.unit.HibernateTestCase; -import org.argeo.slc.test.TestStatus; -import org.argeo.slc.unit.test.tree.TreeTestResultTestUtils; -import org.argeo.slc.unit.test.tree.UnitTestTreeUtil; -import org.hibernate.HibernateException; -import org.hibernate.Session; -import org.springframework.orm.hibernate3.HibernateCallback; -import org.springframework.orm.hibernate3.HibernateTemplate; - -public class TreeTestResultDaoHibernateTest extends HibernateTestCase { - private TreeTestResultDao testResultDao = null; - - @Override - public void setUp() { - testResultDao = getBean(TreeTestResultDao.class); - } - - public void testCreate() { - - TreeTestResult ttr = TreeTestResultTestUtils - .createCompleteTreeTestResult(); - testResultDao.create(ttr); - - TreeTestResult ttrPersisted = (TreeTestResult) testResultDao - .getTestResult(ttr.getUuid()); - - assertInHibernate(ttr, ttrPersisted); - } - - public void testUpdate() { - TreeTestResult ttr = TreeTestResultTestUtils - .createCompleteTreeTestResult(); - testResultDao.create(ttr); - - final TreeTestResult ttrUpdated = (TreeTestResult) testResultDao - .getTestResult(ttr.getUuid()); - - // Modifying ttrUpdated - - /** - * this closeDate update commented because the assertTreeTestResult will - * find a unexpected discrepancy in the date. - * ttrUpdated.setCloseDate(new Date()); - */ - - String pathStr = "/test"; - final TreeSPath path = new TreeSPath(pathStr); - - final TreeSRegistry registry = new TreeSRegistry(); - SimpleSElement elem = new SimpleSElement("Unit Test"); - elem.getTags().put("myTag", "myTagValue"); - registry.register(path, elem); - - getHibernateTemplate().execute(new HibernateCallback() { - - public Object doInHibernate(Session session) - throws HibernateException, SQLException { - session.refresh(ttrUpdated); - ttrUpdated.notifyCurrentPath(registry, path); - - ttrUpdated.addResultPart(TreeTestResultTestUtils - .createSimpleResultPartPassed()); - ttrUpdated.addResultPart(TreeTestResultTestUtils - .createSimpleResultPartFailed()); - ttrUpdated.addResultPart(TreeTestResultTestUtils - .createSimpleResultPartError()); - return null; - } - }); - - testResultDao.update(ttrUpdated); - - // comparison of ttrUpdated and ttrRetrieved - TreeTestResult ttrRetrieved = (TreeTestResult) testResultDao - .getTestResult(ttr.getUuid()); - - assertInHibernate(ttrUpdated, ttrRetrieved); - } - - public void testMultipleUpdateScenario() throws Exception { - TreeSRegistry registry = new TreeSRegistry(); - - TreeSPath path = new TreeSPath("/root/test"); - SimpleSElement elem = new SimpleSElement("Unit Test"); - elem.getTags().put("myTag", "myTagValue"); - registry.register(path, elem); - - TreeTestResult ttr = TreeTestResultTestUtils - .createSimpleTreeTestResult(); - ttr.notifyCurrentPath(registry, path); - ttr - .addResultPart(new SimpleResultPart(TestStatus.PASSED, - "First test")); - - testResultDao.create(ttr); - - path = new TreeSPath("/root/test2/subtest"); - elem = new SimpleSElement("Sub Test"); - elem.getTags().put("myTag", "myTagValue"); - registry.register(path, elem); - - ttr.notifyCurrentPath(registry, path); - ttr - .addResultPart(new SimpleResultPart(TestStatus.PASSED, - "Second test")); - - testResultDao.update(ttr); - - ttr.notifyCurrentPath(registry, path); - ttr.addResultPart(new SimpleResultPart(TestStatus.PASSED, - "Third test with same path")); - - testResultDao.update(ttr); - - ttr.close(); - - testResultDao.close(ttr.getUuid(), ttr.getCloseDate()); - - TreeTestResult ttrRetrieved = (TreeTestResult) testResultDao - .getTestResult(ttr.getUuid()); - - assertInHibernate(ttr, ttrRetrieved); - - } - - @Override - protected String getApplicationContextLocation() { - return "org/argeo/slc/hibernate/applicationContext.xml"; - } - - public static void assertInHibernate(HibernateTemplate template, - final TreeTestResult ttrExpected, final TreeTestResult ttrPersisted) { - template.execute(new HibernateCallback() { - public Object doInHibernate(Session session) { - session.refresh(ttrPersisted); - UnitTestTreeUtil - .assertTreeTestResult(ttrExpected, ttrPersisted); - return null; - } - - }); - - } - - public void assertInHibernate(final TreeTestResult ttrExpected, - final TreeTestResult ttrPersisted) { - assertInHibernate(getHibernateTemplate(), ttrExpected, ttrPersisted); - } - -} diff --git a/runtime/org.argeo.slc.support.hibernate/src/test/resources/log4j.properties b/runtime/org.argeo.slc.support.hibernate/src/test/resources/log4j.properties deleted file mode 100644 index 4a97ea611..000000000 --- a/runtime/org.argeo.slc.support.hibernate/src/test/resources/log4j.properties +++ /dev/null @@ -1,28 +0,0 @@ -# Set root logger level to DEBUG and its only appender to A1. -log4j.rootLogger=WARN, console - -## Levels -# Slc -log4j.logger.org.argeo=DEBUG -log4j.logger.org.argeo.slc.hibernate.process=TRACE - -# Castor -log4j.logger.org.exolab.castor=WARN - -# Spring -#log4j.logger.org.springframework=INFO -# Hibernate -log4j.logger.org.hibernate=WARN -#log4j.logger.org.hibernate.SQL=TRACE -#log4j.logger.org.hibernate.tool.hbm2ddl=TRACE -#log4j.logger.org.hibernate.type=TRACE - - -## Appenders -# A1 is set to be a ConsoleAppender. -log4j.appender.console=org.apache.log4j.ConsoleAppender - -# A1 uses PatternLayout. -log4j.appender.console.layout=org.apache.log4j.PatternLayout -log4j.appender.console.layout.ConversionPattern= %-5p %d{ISO8601} %m - %c%n - diff --git a/runtime/org.argeo.slc.support.hibernate/src/test/resources/org/argeo/slc/hibernate/applicationContext.xml b/runtime/org.argeo.slc.support.hibernate/src/test/resources/org/argeo/slc/hibernate/applicationContext.xml deleted file mode 100644 index 739eb09bb..000000000 --- a/runtime/org.argeo.slc.support.hibernate/src/test/resources/org/argeo/slc/hibernate/applicationContext.xml +++ /dev/null @@ -1,74 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/runtime/org.argeo.slc.support.hibernate/src/test/resources/org/argeo/slc/hibernate/withCastor.xml b/runtime/org.argeo.slc.support.hibernate/src/test/resources/org/argeo/slc/hibernate/withCastor.xml deleted file mode 100644 index 48bc9dcfb..000000000 --- a/runtime/org.argeo.slc.support.hibernate/src/test/resources/org/argeo/slc/hibernate/withCastor.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/runtime/org.argeo.slc.support.ws.client/.classpath b/runtime/org.argeo.slc.support.ws.client/.classpath deleted file mode 100644 index a002fffa3..000000000 --- a/runtime/org.argeo.slc.support.ws.client/.classpath +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - diff --git a/runtime/org.argeo.slc.support.ws.client/.project b/runtime/org.argeo.slc.support.ws.client/.project deleted file mode 100644 index 142bb4ada..000000000 --- a/runtime/org.argeo.slc.support.ws.client/.project +++ /dev/null @@ -1,28 +0,0 @@ - - - org.argeo.slc.support.ws.client - - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.pde.ManifestBuilder - - - - - org.eclipse.pde.SchemaBuilder - - - - - - org.eclipse.jdt.core.javanature - org.eclipse.pde.PluginNature - - diff --git a/runtime/org.argeo.slc.support.ws.client/.settings/org.eclipse.jdt.core.prefs b/runtime/org.argeo.slc.support.ws.client/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 964778b0e..000000000 --- a/runtime/org.argeo.slc.support.ws.client/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,12 +0,0 @@ -#Fri Aug 29 11:31:46 CEST 2008 -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 -org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.compliance=1.5 -org.eclipse.jdt.core.compiler.debug.lineNumber=generate -org.eclipse.jdt.core.compiler.debug.localVariable=generate -org.eclipse.jdt.core.compiler.debug.sourceFile=generate -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.5 diff --git a/runtime/org.argeo.slc.support.ws.client/pom.xml b/runtime/org.argeo.slc.support.ws.client/pom.xml deleted file mode 100644 index db1b5b66d..000000000 --- a/runtime/org.argeo.slc.support.ws.client/pom.xml +++ /dev/null @@ -1,57 +0,0 @@ - - 4.0.0 - - org.argeo.slc - runtime - 1.1.3-SNAPSHOT - .. - - org.argeo.slc.runtime - org.argeo.slc.support.ws.client - jar - SLC Support Web Services Client (deprecated) - - - - org.apache.felix - maven-bundle-plugin - - - - - org.argeo.slc.ws.* - - org.w3c.dom;version="0.0.0", - javax.xml.*;version="0.0.0", - org.xml.*;version="0.0.0", - org.springframework.ws.*;resolution:="optional", - org.springframework.core;resolution:="optional", - * - - - - - - - - - org.argeo.slc.runtime - org.argeo.slc.support.simple - 1.1.3-SNAPSHOT - - - org.argeo.slc.runtime - org.argeo.slc.support.castor - 1.1.3-SNAPSHOT - - - - org.argeo.tp - org.springframework.ws - - - org.argeo.tp - com.sun.xml.messaging.saaj - - - \ No newline at end of file diff --git a/runtime/org.argeo.slc.support.ws.client/src/main/java/org/argeo/slc/ws/client/ValidatingClientInterceptor.java b/runtime/org.argeo.slc.support.ws.client/src/main/java/org/argeo/slc/ws/client/ValidatingClientInterceptor.java deleted file mode 100644 index 84c4b193c..000000000 --- a/runtime/org.argeo.slc.support.ws.client/src/main/java/org/argeo/slc/ws/client/ValidatingClientInterceptor.java +++ /dev/null @@ -1,103 +0,0 @@ -/* - * Copyright (C) 2007-2012 Mathieu Baudier - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.argeo.slc.ws.client; - -import java.io.IOException; - -import javax.xml.transform.Source; - -import org.springframework.ws.client.WebServiceClientException; -import org.springframework.ws.client.WebServiceIOException; -import org.springframework.ws.client.support.interceptor.ClientInterceptor; -import org.springframework.ws.context.MessageContext; -import org.springframework.xml.validation.XmlValidator; -import org.xml.sax.SAXParseException; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -public class ValidatingClientInterceptor implements ClientInterceptor { - private final static Log log = LogFactory - .getLog(ValidatingClientInterceptor.class); - - private Boolean validateRequest = true; - private Boolean validateResponse = false; - private XmlValidator validator = null; - - public boolean handleFault(MessageContext messageContext) - throws WebServiceClientException { - return true; - } - - public boolean handleRequest(MessageContext messageContext) - throws WebServiceClientException { - if (validateRequest) { - if (messageContext.getRequest() == null) - return true; - - Source source = messageContext.getRequest().getPayloadSource(); - try { - return validate(source); - } catch (IOException e) { - throw new WebServiceIOException("Cannot validate request", e); - } - } else { - return true; - } - } - - public boolean handleResponse(MessageContext messageContext) - throws WebServiceClientException { - if (validateResponse) { - if (messageContext.getResponse() == null) - return true; - - Source source = messageContext.getResponse().getPayloadSource(); - try { - return validate(source); - } catch (IOException e) { - throw new WebServiceIOException("Cannot validate response", e); - } - } else { - return true; - } - } - - protected boolean validate(Source source) throws IOException { - SAXParseException[] exceptions = validator.validate(source); - if (exceptions.length != 0) { - for (SAXParseException ex : exceptions) { - log.error(ex.getMessage()); - } - return false; - } else { - return true; - } - } - - public void setValidateRequest(Boolean validateRequest) { - this.validateRequest = validateRequest; - } - - public void setValidateResponse(Boolean validateResponse) { - this.validateResponse = validateResponse; - } - - public void setValidator(XmlValidator validator) { - this.validator = validator; - } - -} diff --git a/runtime/org.argeo.slc.support.ws.client/src/main/java/org/argeo/slc/ws/client/WebServiceUtils.java b/runtime/org.argeo.slc.support.ws.client/src/main/java/org/argeo/slc/ws/client/WebServiceUtils.java deleted file mode 100644 index 02502306f..000000000 --- a/runtime/org.argeo.slc.support.ws.client/src/main/java/org/argeo/slc/ws/client/WebServiceUtils.java +++ /dev/null @@ -1,99 +0,0 @@ -/* - * Copyright (C) 2007-2012 Mathieu Baudier - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.argeo.slc.ws.client; - -import java.util.Iterator; - -import javax.xml.transform.Source; -import javax.xml.transform.dom.DOMSource; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.springframework.ws.client.core.WebServiceTemplate; -import org.springframework.ws.soap.SoapFaultDetail; -import org.springframework.ws.soap.SoapFaultDetailElement; -import org.springframework.ws.soap.client.SoapFaultClientException; -import org.springframework.xml.transform.StringResult; -import org.w3c.dom.Node; - -public abstract class WebServiceUtils { - private final static Log log = LogFactory.getLog(WebServiceUtils.class); - - public static Object marshalSendAndReceiveSafe(WebServiceTemplate template, - Object req) { - try { - Object resp = marshalSendAndReceive(template, req); - return resp; - } catch (Exception e) { - log.error("Cannot send web servicerequest: " + e.getMessage()); - if (log.isDebugEnabled()) { - log.debug("Webservice exception details: ", e); - } - return null; - } - } - - public static Object marshalSendAndReceive(WebServiceTemplate template, - Object req) { - if (log.isTraceEnabled()) { - try { - StringResult result = new StringResult(); - template.getMarshaller().marshal(req, result); - log.trace("About to send " + result); - } catch (Exception e) { - log.error("Cannot marshall " + req + " for logging", e); - } - } - Object resp = template.marshalSendAndReceive(req); - return resp; - } - - public static void manageSoapException(SoapFaultClientException e) { - log - .error("WS root cause: " - + e.getSoapFault().getFaultStringOrReason()); - if (log.isTraceEnabled()) { - StringBuffer stack = new StringBuffer(""); - SoapFaultDetail detail = e.getSoapFault().getFaultDetail(); - if (detail != null) { - Iterator it = (Iterator) detail - .getDetailEntries(); - while (it.hasNext()) { - SoapFaultDetailElement elem = it.next(); - if (elem.getName().getLocalPart().equals("StackElement")) { - Source source = elem.getSource(); - if (source instanceof DOMSource) { - Node node = ((DOMSource) source).getNode(); - // stack.append(node.getTextContent()).append('\n'); - stack - .append( - node.getChildNodes().item(0) - .getNodeValue()).append( - '\n'); - } - } - } - - if (stack.length() > 0) - log.error("WS root cause stack: " + stack); - } - } - } - - private WebServiceUtils() { - - } -} diff --git a/runtime/org.argeo.slc.support.ws.client/src/main/java/org/argeo/slc/ws/process/WebServiceSlcExecutionNotifier.java b/runtime/org.argeo.slc.support.ws.client/src/main/java/org/argeo/slc/ws/process/WebServiceSlcExecutionNotifier.java deleted file mode 100644 index d341a63a3..000000000 --- a/runtime/org.argeo.slc.support.ws.client/src/main/java/org/argeo/slc/ws/process/WebServiceSlcExecutionNotifier.java +++ /dev/null @@ -1,131 +0,0 @@ -/* - * Copyright (C) 2007-2012 Mathieu Baudier - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.argeo.slc.ws.process; - -import java.util.List; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.argeo.slc.msg.process.SlcExecutionRequest; -import org.argeo.slc.msg.process.SlcExecutionStatusRequest; -import org.argeo.slc.msg.process.SlcExecutionStepsRequest; -import org.argeo.slc.execution.ExecutionStep; -import org.argeo.slc.execution.ExecutionProcess; -import org.argeo.slc.process.SlcExecution; -import org.argeo.slc.process.SlcExecutionNotifier; -import org.argeo.slc.process.SlcExecutionStep; -import org.argeo.slc.ws.client.WebServiceUtils; -import org.springframework.ws.client.WebServiceIOException; -import org.springframework.ws.client.core.WebServiceTemplate; -import org.springframework.ws.soap.client.SoapFaultClientException; - -public class WebServiceSlcExecutionNotifier implements SlcExecutionNotifier { - private WebServiceTemplate template; - - private Log log = LogFactory.getLog(getClass()); - - private Boolean cannotConnect = false; - - public void newExecution(ExecutionProcess process) { - SlcExecution slcExecution = (SlcExecution) process; - if (cannotConnect) - return; - - SlcExecutionRequest req = new SlcExecutionRequest(); - req.setSlcExecution(slcExecution); - try { - WebServiceUtils.marshalSendAndReceive(template, req); - if (log.isTraceEnabled()) - log.trace("Notified creation of slc execution " - + slcExecution.getUuid()); - } catch (SoapFaultClientException e) { - WebServiceUtils.manageSoapException(e); - } catch (WebServiceIOException e) { - manageIoException(e); - } - } - - public void updateExecution(SlcExecution slcExecution) { - if (cannotConnect) - return; - - SlcExecutionRequest req = new SlcExecutionRequest(); - req.setSlcExecution(slcExecution); - try { - WebServiceUtils.marshalSendAndReceive(template, req); - if (log.isTraceEnabled()) - log.trace("Notified update of slc execution " - + slcExecution.getUuid()); - } catch (SoapFaultClientException e) { - WebServiceUtils.manageSoapException(e); - } catch (WebServiceIOException e) { - manageIoException(e); - } - } - - public void updateStatus(ExecutionProcess process, String oldStatus, - String newStatus) { - SlcExecution slcExecution = (SlcExecution) process; - if (cannotConnect) - return; - - SlcExecutionStatusRequest req = new SlcExecutionStatusRequest( - slcExecution.getUuid(), newStatus); - try { - WebServiceUtils.marshalSendAndReceive(template, req); - if (log.isTraceEnabled()) - log.trace("Notified status update of slc execution " - + slcExecution.getUuid()); - } catch (SoapFaultClientException e) { - WebServiceUtils.manageSoapException(e); - } catch (WebServiceIOException e) { - manageIoException(e); - } - } - - public void addSteps(ExecutionProcess process, - List additionalSteps) { - SlcExecution slcExecution = (SlcExecution) process; - if (cannotConnect) - return; - - SlcExecutionStepsRequest req = new SlcExecutionStepsRequest( - slcExecution.getUuid(), additionalSteps); - try { - WebServiceUtils.marshalSendAndReceive(template, req); - if (log.isTraceEnabled()) - log.trace("Added steps to slc execution " - + slcExecution.getUuid()); - } catch (SoapFaultClientException e) { - WebServiceUtils.manageSoapException(e); - } catch (WebServiceIOException e) { - manageIoException(e); - } - } - - public void setTemplate(WebServiceTemplate template) { - this.template = template; - } - - protected void manageIoException(WebServiceIOException e) { - if (!cannotConnect) { - log.error("Cannot connect to " + template.getDefaultUri() - + ". Won't try again.", e); - cannotConnect = true; - } - } - -} diff --git a/runtime/org.argeo.slc.support.ws.client/src/main/java/org/argeo/slc/ws/test/tree/WebServiceTreeTestResultNotifier.java b/runtime/org.argeo.slc.support.ws.client/src/main/java/org/argeo/slc/ws/test/tree/WebServiceTreeTestResultNotifier.java deleted file mode 100644 index cefbcd138..000000000 --- a/runtime/org.argeo.slc.support.ws.client/src/main/java/org/argeo/slc/ws/test/tree/WebServiceTreeTestResultNotifier.java +++ /dev/null @@ -1,124 +0,0 @@ -/* - * Copyright (C) 2007-2012 Mathieu Baudier - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.argeo.slc.ws.test.tree; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.argeo.slc.core.test.tree.TreeTestResult; -import org.argeo.slc.msg.test.tree.CloseTreeTestResultRequest; -import org.argeo.slc.msg.test.tree.CreateTreeTestResultRequest; -import org.argeo.slc.msg.test.tree.ResultPartRequest; -import org.argeo.slc.test.TestResultListener; -import org.argeo.slc.test.TestResultPart; -import org.argeo.slc.ws.client.WebServiceUtils; -import org.springframework.ws.client.WebServiceIOException; -import org.springframework.ws.client.core.WebServiceTemplate; -import org.springframework.ws.soap.client.SoapFaultClientException; - -public class WebServiceTreeTestResultNotifier implements - TestResultListener { - private WebServiceTemplate template; - private Boolean onlyOnClose = false; - - private Log log = LogFactory.getLog(getClass()); - - private Boolean cannotConnect = false; - - public void resultPartAdded(TreeTestResult testResult, - TestResultPart testResultPart) { - if (onlyOnClose) - return; - - if (cannotConnect) - return; - - try { - if (testResult.getResultParts().size() == 1 - && testResult.getResultParts().values().iterator().next() - .getParts().size() == 1) { - CreateTreeTestResultRequest req = new CreateTreeTestResultRequest( - testResult); - - if (log.isDebugEnabled()) - log.debug("Send create result request for result " - + testResult.getUuid()); - - WebServiceUtils.marshalSendAndReceive(template, req); - } else { - ResultPartRequest req = new ResultPartRequest(testResult); - - if (log.isDebugEnabled()) - log.debug("Send result parts for result " - + testResult.getUuid()); - - WebServiceUtils.marshalSendAndReceive(template, req); - } - } catch (SoapFaultClientException e) { - WebServiceUtils.manageSoapException(e); - - } catch (WebServiceIOException e) { - manageIoException(e); - } - } - - public void close(TreeTestResult testResult) { - if (cannotConnect) - return; - - try { - if (onlyOnClose) { - CreateTreeTestResultRequest req = new CreateTreeTestResultRequest( - testResult); - - if (log.isDebugEnabled()) - log.debug("Send create result request for result " - + testResult.getUuid()); - - WebServiceUtils.marshalSendAndReceive(template, req); - } else { - CloseTreeTestResultRequest req = new CloseTreeTestResultRequest( - testResult); - - if (log.isDebugEnabled()) - log.debug("Send close result request for result " - + testResult.getUuid()); - - WebServiceUtils.marshalSendAndReceive(template, req); - - } - } catch (SoapFaultClientException e) { - WebServiceUtils.manageSoapException(e); - } catch (WebServiceIOException e) { - manageIoException(e); - } - } - - public void setTemplate(WebServiceTemplate template) { - this.template = template; - } - - public void setOnlyOnClose(Boolean onlyOnClose) { - this.onlyOnClose = onlyOnClose; - } - - protected void manageIoException(WebServiceIOException e) { - if (!cannotConnect) { - log.error("Cannot connect to " + template.getDefaultUri() - + ". Won't try again.", e); - cannotConnect = true; - } - } -} diff --git a/runtime/org.argeo.slc.support.ws.client/src/main/resources/org/argeo/slc/ws/client/spring/applicationContext.xml b/runtime/org.argeo.slc.support.ws.client/src/main/resources/org/argeo/slc/ws/client/spring/applicationContext.xml deleted file mode 100644 index 2cf78df6a..000000000 --- a/runtime/org.argeo.slc.support.ws.client/src/main/resources/org/argeo/slc/ws/client/spring/applicationContext.xml +++ /dev/null @@ -1,82 +0,0 @@ - - - - - - - - - - - - - - - - - - http://localhost:9090/org.argeo.slc.webapp/slcService/ - - - - - - - - - - - - - - - - - - - - - - - - - - - - -