]> git.argeo.org Git - gpl/argeo-slc.git/commitdiff
ActiveMQ and Castor integration
authorMathieu Baudier <mbaudier@argeo.org>
Wed, 25 Feb 2009 10:56:34 +0000 (10:56 +0000)
committerMathieu Baudier <mbaudier@argeo.org>
Wed, 25 Feb 2009 10:56:34 +0000 (10:56 +0000)
git-svn-id: https://svn.argeo.org/slc/trunk@2172 4cfe0d0a-d680-48aa-b62c-e0a02a3f76cc

49 files changed:
demo/org.argeo.slc.demo.basic/pom.xml
demo/org.argeo.slc.demo.basic/src/main/resources/BasicExecutionFlow.groovy [new file with mode: 0644]
demo/org.argeo.slc.demo.basic/src/main/resources/META-INF/MANIFEST.MF [deleted file]
demo/org.argeo.slc.demo.basic/src/main/resources/conf/BasicExecutionFlow.groovy [deleted file]
demo/org.argeo.slc.demo.basic/src/main/resources/conf/basic.xml
demo/org.argeo.slc.demo.basic/src/main/resources/conf/imports.xml [new file with mode: 0644]
demo/org.argeo.slc.demo.basic/src/main/resources/conf/main.xml
demo/org.argeo.slc.demo.basic/src/main/resources/conf/osgi.xml [new file with mode: 0644]
demo/org.argeo.slc.demo.basic/src/main/resources/conf/slc.properties [deleted file]
demo/org.argeo.slc.demo.basic/src/main/resources/conf/test.xml [deleted file]
demo/org.argeo.slc.demo.basic/src/main/resources/slc.properties [new file with mode: 0644]
demo/org.argeo.slc.demo.basic/src/main/resources/test.xml [new file with mode: 0644]
demo/org.argeo.slc.demo.manager/.classpath
demo/org.argeo.slc.demo.manager/.project
demo/org.argeo.slc.demo.manager/.springBeans
demo/org.argeo.slc.demo.manager/pom.xml
demo/org.argeo.slc.demo.manager/src/main/resources/META-INF/MANIFEST.MF [deleted file]
demo/org.argeo.slc.demo.manager/src/main/resources/conf/BasicExecutionFlow.groovy [deleted file]
demo/org.argeo.slc.demo.manager/src/main/resources/conf/basic.xml [deleted file]
demo/org.argeo.slc.demo.manager/src/main/resources/conf/common.xml [deleted file]
demo/org.argeo.slc.demo.manager/src/main/resources/conf/jms.xml [new file with mode: 0644]
demo/org.argeo.slc.demo.manager/src/main/resources/conf/main.xml [deleted file]
demo/org.argeo.slc.demo.manager/src/main/resources/conf/manager-osgi.xml [new file with mode: 0644]
demo/org.argeo.slc.demo.manager/src/main/resources/conf/manager.xml [new file with mode: 0644]
demo/org.argeo.slc.demo.manager/src/main/resources/conf/slc.properties [deleted file]
demo/org.argeo.slc.demo.manager/src/main/resources/conf/test.xml [deleted file]
demo/org.argeo.slc.demo.manager/src/main/resources/conf/testCases/basic-001.xml [deleted file]
demo/org.argeo.slc.demo.manager/src/main/resources/conf/testCases/basic-002.xml [deleted file]
demo/org.argeo.slc.demo.manager/src/test/java/org/argeo/slc/demo/manager/JmsTesting.java [new file with mode: 0644]
org.argeo.slc/pom.xml
runtime/org.argeo.slc.execution/.classpath
runtime/org.argeo.slc.execution/pom.xml
runtime/org.argeo.slc.execution/src/main/java/org/argeo/slc/execution/AbstractSpringExecutionModule.java [new file with mode: 0644]
runtime/org.argeo.slc.execution/src/main/java/org/argeo/slc/execution/ExecutionCommandProvider.java [new file with mode: 0644]
runtime/org.argeo.slc.execution/src/main/java/org/argeo/slc/execution/ExecutionContext.java
runtime/org.argeo.slc.execution/src/main/java/org/argeo/slc/execution/ExecutionModule.java [new file with mode: 0644]
runtime/org.argeo.slc.execution/src/main/java/org/argeo/slc/execution/ExecutionModuleDescriptor.java
runtime/org.argeo.slc.execution/src/main/java/org/argeo/slc/execution/ExecutionRegister.java [deleted file]
runtime/org.argeo.slc.execution/src/main/java/org/argeo/slc/execution/ModulesManager.java [new file with mode: 0644]
runtime/org.argeo.slc.execution/src/main/java/org/argeo/slc/execution/OsgiExecutionModule.java [new file with mode: 0644]
runtime/org.argeo.slc.execution/src/main/java/org/argeo/slc/execution/RefSpecAttribute.java
runtime/org.argeo.slc.execution/src/main/java/org/argeo/slc/execution/SimpleExecutionFlow.java
runtime/org.argeo.slc.execution/src/main/resources/META-INF/spring/osgi.xml [new file with mode: 0644]
runtime/org.argeo.slc.execution/src/main/resources/org/argeo/slc/execution/spring.xml [new file with mode: 0644]
runtime/org.argeo.slc.support.activemq/src/main/java/org/argeo/slc/jms/ServiceMessageListenerAdapter.java [new file with mode: 0644]
runtime/org.argeo.slc.support.activemq/src/main/resources/org/argeo/slc/activemq/spring.xml
runtime/org.argeo.slc.support.castor/pom.xml
runtime/org.argeo.slc.support.castor/src/main/resources/org/argeo/slc/castor/execution.xml [new file with mode: 0644]
runtime/org.argeo.slc.support.castor/src/main/resources/org/argeo/slc/castor/spring.xml

index 33d29dd732415e6f4a1ecb1cf8c29fa887be96cc..27ba7f0d378cfec912f6a7e7368c37d6a7e66a9c 100644 (file)
                                        <instructions>
                                                <Import-Package>org.apache.commons.logging,org.springframework.beans.factory.config</Import-Package>
                                                <Require-Bundle>org.argeo.slc.execution,org.argeo.slc.specs,org.argeo.slc.support.simple,org.springframework.aop,com.springsource.net.sf.cglib,com.springsource.org.aopalliance</Require-Bundle>
-                                               <Spring-Context>conf/main.xml</Spring-Context>
+                                               <Spring-Context>conf/*,conf/testCases/*</Spring-Context>
                                        </instructions>
                                </configuration>
+                               <executions>
+                                       <execution>
+                                               <goals>
+                                                       <goal>manifest</goal>
+                                               </goals>
+                                               <phase>resources</phase>
+                                       </execution>
+                               </executions>
                        </plugin>
                </plugins>
        </build>
                        <groupId>org.argeo.slc.runtime</groupId>
                        <artifactId>org.argeo.slc.support.simple</artifactId>
                </dependency>
-               <dependency>
-                       <groupId>org.argeo.slc</groupId>
-                       <artifactId>org.argeo.slc.detached.launcher</artifactId>
-                       <version>${project.version}</version>
-               </dependency>
-
-               <dependency>
-                       <groupId>org.eclipse.osgi</groupId>
-                       <artifactId>org.eclipse.osgi</artifactId>
-               </dependency>
-
-               <dependency>
-                       <groupId>org.springframework.osgi</groupId>
-                       <artifactId>org.springframework.osgi.extender</artifactId>
-               </dependency>
        </dependencies>
 </project>
diff --git a/demo/org.argeo.slc.demo.basic/src/main/resources/BasicExecutionFlow.groovy b/demo/org.argeo.slc.demo.basic/src/main/resources/BasicExecutionFlow.groovy
new file mode 100644 (file)
index 0000000..da3926e
--- /dev/null
@@ -0,0 +1,12 @@
+import org.argeo.slc.test.*;
+
+public class BasicExecutionFlow implements org.argeo.slc.executionflow.ExecutionFlow {
+
+       ExecutableTestRun firstSubTest = null;
+       ExecutableTestRun secondSubTest = null;
+
+       void execute(){
+               firstSubTest?.execute();
+               secondSubTest?.execute();
+       }
+}
diff --git a/demo/org.argeo.slc.demo.basic/src/main/resources/META-INF/MANIFEST.MF b/demo/org.argeo.slc.demo.basic/src/main/resources/META-INF/MANIFEST.MF
deleted file mode 100644 (file)
index d0c3f3d..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-Manifest-Version: 1.0\r
-Private-Package: conf;version="0.11.3-SNAPSHOT",conf.testCases;version\r
- ="0.11.3-SNAPSHOT"\r
-Tool: Bnd-0.0.255\r
-Bundle-Name: SLC Sandbox Execution Flow\r
-Created-By: 1.6.0_0 (Sun Microsystems Inc.)\r
-Require-Bundle: org.argeo.slc.execution,org.argeo.slc.specs,org.argeo.\r
- slc.support.simple,org.springframework.aop,com.springsource.net.sf.cg\r
- lib,com.springsource.org.aopalliance\r
-Bundle-Vendor: Argeo\r
-Bundle-Version: 0.11.3.SNAPSHOT\r
-Spring-Context: conf/main.xml\r
-Bundle-ManifestVersion: 2\r
-Bundle-License: http://www.apache.org/licenses/LICENSE-2.0.txt\r
-Import-Package: org.apache.commons.logging;version="1.1",org.springfra\r
- mework.beans.factory.config\r
-Bundle-SymbolicName: org.argeo.slc.sandbox.executionflow\r
-Bundle-DocURL: http://www.argeo.org\r
-Originally-Created-By: 1.6.0_0 (Sun Microsystems Inc.)\r
-\r
diff --git a/demo/org.argeo.slc.demo.basic/src/main/resources/conf/BasicExecutionFlow.groovy b/demo/org.argeo.slc.demo.basic/src/main/resources/conf/BasicExecutionFlow.groovy
deleted file mode 100644 (file)
index da3926e..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-import org.argeo.slc.test.*;
-
-public class BasicExecutionFlow implements org.argeo.slc.executionflow.ExecutionFlow {
-
-       ExecutableTestRun firstSubTest = null;
-       ExecutableTestRun secondSubTest = null;
-
-       void execute(){
-               firstSubTest?.execute();
-               secondSubTest?.execute();
-       }
-}
index c2077f50f448c5bdfe65eadc2ccfdc40969e39ca..1ec671cb41dcb876d087d804366a8fec4340138e 100644 (file)
@@ -11,7 +11,7 @@
                <property name="attributes">\r
                        <map>\r
                                <entry key="testedComponentId">\r
-                                       <bean parent="specAttribute" p:value="100" />\r
+                                       <bean parent="specAttribute" p:value="100" p:isParameter="true"/>\r
                                </entry>\r
                                <entry key="testData1">\r
                                        <bean parent="refAttribute" p:targetClass="org.argeo.slc.core.test.BasicTestData" />\r
diff --git a/demo/org.argeo.slc.demo.basic/src/main/resources/conf/imports.xml b/demo/org.argeo.slc.demo.basic/src/main/resources/conf/imports.xml
new file mode 100644 (file)
index 0000000..2a7fc71
--- /dev/null
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xsi:schemaLocation="
+       http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
+
+       <import resource="classpath:org/argeo/slc/execution/spring.xml" />
+
+</beans>
\ No newline at end of file
index aab3785e2eb6ebc5f1f2caa6a07308550487bace..b5752299972592f8fc57310ee3c073bbf6c5b7c8 100644 (file)
@@ -1,21 +1,18 @@
 <?xml version="1.0" encoding="UTF-8"?>\r
 <beans xmlns="http://www.springframework.org/schema/beans"\r
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p"\r
-       xmlns:aop="http://www.springframework.org/schema/aop" xmlns:context="http://www.springframework.org/schema/context"\r
+       xmlns:aop="http://www.springframework.org/schema/aop"\r
        xsi:schemaLocation="\r
        http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd\r
        http://www.springframework.org/schema/lang http://www.springframework.org/schema/lang/spring-lang-2.5.xsd\r
-       http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd\r
        http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd">\r
 \r
-       <import resource="common.xml" />\r
-\r
-       <import resource="basic.xml" />\r
-       <import resource="testCases/basic-001.xml" />\r
-       <import resource="testCases/basic-002.xml" />\r
-\r
+<!-- \r
        <bean id="testLaunch" class="org.argeo.slc.execution.TestLaunch"\r
-               p:flowName="main" init-method="launch"/>\r
+               p:flowName="main" init-method="launch" />\r
+-->\r
+\r
+       <bean id="executionModule" class="org.argeo.slc.execution.OsgiExecutionModule" />\r
 \r
        <bean id="main" class="org.argeo.slc.execution.SimpleExecutionFlow">\r
                <property name="executionSpec">\r
                abstract="true">\r
        </bean>\r
 \r
-       <context:annotation-config />\r
-       <bean class="org.argeo.slc.execution.ExecutionRegister" />\r
-\r
-\r
-       <bean class="org.springframework.beans.factory.config.CustomScopeConfigurer">\r
-               <property name="scopes">\r
-                       <map>\r
-                               <entry key="execution">\r
-                                       <bean class="org.argeo.slc.execution.ExecutionScope" />\r
-                               </entry>\r
-                       </map>\r
-               </property>\r
-       </bean>\r
-\r
-       <bean\r
-               class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer" />\r
-       <bean class="org.argeo.slc.execution.ExecutionParameterPostProcessor" />\r
-       <bean class="org.argeo.slc.execution.InstantiationPostProcessor" />\r
-       <bean class="org.argeo.slc.execution.Executor" />\r
-\r
-       <bean class="org.argeo.slc.execution.ExecutionAspect"></bean>\r
-       <aop:aspectj-autoproxy />\r
-\r
 </beans>
\ No newline at end of file
diff --git a/demo/org.argeo.slc.demo.basic/src/main/resources/conf/osgi.xml b/demo/org.argeo.slc.demo.basic/src/main/resources/conf/osgi.xml
new file mode 100644 (file)
index 0000000..ebc3364
--- /dev/null
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>\r
+<beans:beans xmlns="http://www.springframework.org/schema/osgi"\r
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:beans="http://www.springframework.org/schema/beans"\r
+       xsi:schemaLocation="http://www.springframework.org/schema/osgi  \r
+       http://www.springframework.org/schema/osgi/spring-osgi-1.1.xsd\r
+       http://www.springframework.org/schema/beans   \r
+       http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">\r
+\r
+       <service interface="org.argeo.slc.execution.ExecutionModule"\r
+               ref="executionModule" />\r
+</beans:beans>
\ No newline at end of file
diff --git a/demo/org.argeo.slc.demo.basic/src/main/resources/conf/slc.properties b/demo/org.argeo.slc.demo.basic/src/main/resources/conf/slc.properties
deleted file mode 100644 (file)
index b18dce1..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-log4j.rootLogger=WARN, console
-
-## Levels
-log4j.logger.org.argeo=DEBUG
-log4j.logger.org.argeo.slc.executionflow.ExecutionParameterPostProcessor=TRACE
-log4j.logger.org.argeo.slc.executionflow.ExecutionContext=TRACE
-
-## Appenders
-# console is set to be a ConsoleAppender.
-log4j.appender.console=org.apache.log4j.ConsoleAppender
-
-# console uses PatternLayout.
-log4j.appender.console.layout=org.apache.log4j.PatternLayout
-log4j.appender.console.layout.ConversionPattern= %-5p %d{ISO8601} %m - %c%n
-
-testCase=002
\ No newline at end of file
diff --git a/demo/org.argeo.slc.demo.basic/src/main/resources/conf/test.xml b/demo/org.argeo.slc.demo.basic/src/main/resources/conf/test.xml
deleted file mode 100644 (file)
index 6cc40e8..0000000
+++ /dev/null
@@ -1,105 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>\r
-<beans xmlns="http://www.springframework.org/schema/beans"\r
-       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p"\r
-       xmlns:lang="http://www.springframework.org/schema/lang"\r
-       xsi:schemaLocation="\r
-       http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd\r
-       http://www.springframework.org/schema/lang http://www.springframework.org/schema/lang/spring-lang-2.5.xsd\r
-       ">\r
-\r
-       <import\r
-               resource="classpath:/org/argeo/slc/core/test/spring/applicationContext.xml" />\r
-\r
-       <import resource="testCases/basic-001.xml" />\r
-       <import resource="testCases/basic-002.xml" />\r
-\r
-       <bean id="executionFlow.basic1" class="org.argeo.slc.executionflow.SimpleExecutionFlow">\r
-               <meta key="meta1" value="mata1Value" />\r
-               <qualifier>\r
-                       <attribute key="qual1" value="qual1value" />\r
-               </qualifier>\r
-               <property name="executables">\r
-                       <list>\r
-                               <ref local="testGroovyImpl" />\r
-                               <ref local="testBshImpl" />\r
-                               <bean parent="testRun" p:testDefinition-ref="testDef"\r
-                                       p:testData-ref="testData-${testCase}" />\r
-                               <bean parent="testRun" p:testDefinition-ref="testDef"\r
-                                       p:testData-ref="testData-${testCase}" />\r
-                       </list>\r
-               </property>\r
-       </bean>\r
-\r
-       <lang:groovy id="executionFlow.groovy1" script-source="src/slc/conf/BasicExecutionFlow.groovy">\r
-               <lang:property name="firstSubTest">\r
-                       <bean parent="testRun" p:testDefinition-ref="testDef"\r
-                               p:testData-ref="testData-${testCase}" />\r
-               </lang:property>\r
-       </lang:groovy>\r
-\r
-       <bean id="testGroovyImpl" parent="testGroovy">\r
-               <property name="message" value="Hello World! Groovy" />\r
-       </bean>\r
-       <bean id="testBshImpl" parent="testBsh">\r
-               <property name="message" value="Hello World! Beanshell" />\r
-       </bean>\r
-\r
-       <bean id="testDef" class="org.argeo.slc.core.test.BasicTestDefinition"\r
-               scope="prototype" />\r
-\r
-       <bean\r
-               class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer" />\r
-\r
-       <bean id="testResult" parent="slcDefault.test.basicSimpleTestResult">\r
-       </bean>\r
-\r
-       <bean id="testRun" class="org.argeo.slc.core.test.SimpleTestRun"\r
-               abstract="true">\r
-               <property name="testResult" ref="testResult" />\r
-       </bean>\r
-\r
-       <lang:groovy id="testGroovyBean">\r
-               <lang:inline-script><![CDATA[\r
-               class Message {\r
-               String message = 'test'\r
-               \r
-               public String getMessage(){\r
-                       return message;\r
-               }\r
-               }\r
-               ]]></lang:inline-script>\r
-       </lang:groovy>\r
-\r
-       <lang:groovy id="testGroovy">\r
-               <lang:inline-script><![CDATA[\r
-               class GroovyMessenger extends org.argeo.slc.core.test.SimpleTestRun {\r
-       \r
-               String message = 'test'\r
-       \r
-                       void execute(){\r
-                               println(message);\r
-                       }\r
-               }\r
-               ]]></lang:inline-script>\r
-       </lang:groovy>\r
-\r
-       <lang:bsh id="testBsh" script-interfaces="org.argeo.slc.test.ExecutableTestRun">\r
-               <lang:inline-script><![CDATA[\r
-               setStrictJava(true);\r
-\r
-               class BshMessenger extends org.argeo.slc.core.test.SimpleTestRun {\r
-\r
-                       String message = "test";\r
-\r
-                       public void execute(){\r
-                               System.out.println(message);\r
-                       }\r
-                       \r
-                       public void setMessage(String message){\r
-                               this.message = message;\r
-                       }\r
-               }\r
-               ]]></lang:inline-script>\r
-       </lang:bsh>\r
-\r
-</beans>
\ No newline at end of file
diff --git a/demo/org.argeo.slc.demo.basic/src/main/resources/slc.properties b/demo/org.argeo.slc.demo.basic/src/main/resources/slc.properties
new file mode 100644 (file)
index 0000000..b18dce1
--- /dev/null
@@ -0,0 +1,16 @@
+log4j.rootLogger=WARN, console
+
+## Levels
+log4j.logger.org.argeo=DEBUG
+log4j.logger.org.argeo.slc.executionflow.ExecutionParameterPostProcessor=TRACE
+log4j.logger.org.argeo.slc.executionflow.ExecutionContext=TRACE
+
+## Appenders
+# console is set to be a ConsoleAppender.
+log4j.appender.console=org.apache.log4j.ConsoleAppender
+
+# console uses PatternLayout.
+log4j.appender.console.layout=org.apache.log4j.PatternLayout
+log4j.appender.console.layout.ConversionPattern= %-5p %d{ISO8601} %m - %c%n
+
+testCase=002
\ No newline at end of file
diff --git a/demo/org.argeo.slc.demo.basic/src/main/resources/test.xml b/demo/org.argeo.slc.demo.basic/src/main/resources/test.xml
new file mode 100644 (file)
index 0000000..6cc40e8
--- /dev/null
@@ -0,0 +1,105 @@
+<?xml version="1.0" encoding="UTF-8"?>\r
+<beans xmlns="http://www.springframework.org/schema/beans"\r
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p"\r
+       xmlns:lang="http://www.springframework.org/schema/lang"\r
+       xsi:schemaLocation="\r
+       http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd\r
+       http://www.springframework.org/schema/lang http://www.springframework.org/schema/lang/spring-lang-2.5.xsd\r
+       ">\r
+\r
+       <import\r
+               resource="classpath:/org/argeo/slc/core/test/spring/applicationContext.xml" />\r
+\r
+       <import resource="testCases/basic-001.xml" />\r
+       <import resource="testCases/basic-002.xml" />\r
+\r
+       <bean id="executionFlow.basic1" class="org.argeo.slc.executionflow.SimpleExecutionFlow">\r
+               <meta key="meta1" value="mata1Value" />\r
+               <qualifier>\r
+                       <attribute key="qual1" value="qual1value" />\r
+               </qualifier>\r
+               <property name="executables">\r
+                       <list>\r
+                               <ref local="testGroovyImpl" />\r
+                               <ref local="testBshImpl" />\r
+                               <bean parent="testRun" p:testDefinition-ref="testDef"\r
+                                       p:testData-ref="testData-${testCase}" />\r
+                               <bean parent="testRun" p:testDefinition-ref="testDef"\r
+                                       p:testData-ref="testData-${testCase}" />\r
+                       </list>\r
+               </property>\r
+       </bean>\r
+\r
+       <lang:groovy id="executionFlow.groovy1" script-source="src/slc/conf/BasicExecutionFlow.groovy">\r
+               <lang:property name="firstSubTest">\r
+                       <bean parent="testRun" p:testDefinition-ref="testDef"\r
+                               p:testData-ref="testData-${testCase}" />\r
+               </lang:property>\r
+       </lang:groovy>\r
+\r
+       <bean id="testGroovyImpl" parent="testGroovy">\r
+               <property name="message" value="Hello World! Groovy" />\r
+       </bean>\r
+       <bean id="testBshImpl" parent="testBsh">\r
+               <property name="message" value="Hello World! Beanshell" />\r
+       </bean>\r
+\r
+       <bean id="testDef" class="org.argeo.slc.core.test.BasicTestDefinition"\r
+               scope="prototype" />\r
+\r
+       <bean\r
+               class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer" />\r
+\r
+       <bean id="testResult" parent="slcDefault.test.basicSimpleTestResult">\r
+       </bean>\r
+\r
+       <bean id="testRun" class="org.argeo.slc.core.test.SimpleTestRun"\r
+               abstract="true">\r
+               <property name="testResult" ref="testResult" />\r
+       </bean>\r
+\r
+       <lang:groovy id="testGroovyBean">\r
+               <lang:inline-script><![CDATA[\r
+               class Message {\r
+               String message = 'test'\r
+               \r
+               public String getMessage(){\r
+                       return message;\r
+               }\r
+               }\r
+               ]]></lang:inline-script>\r
+       </lang:groovy>\r
+\r
+       <lang:groovy id="testGroovy">\r
+               <lang:inline-script><![CDATA[\r
+               class GroovyMessenger extends org.argeo.slc.core.test.SimpleTestRun {\r
+       \r
+               String message = 'test'\r
+       \r
+                       void execute(){\r
+                               println(message);\r
+                       }\r
+               }\r
+               ]]></lang:inline-script>\r
+       </lang:groovy>\r
+\r
+       <lang:bsh id="testBsh" script-interfaces="org.argeo.slc.test.ExecutableTestRun">\r
+               <lang:inline-script><![CDATA[\r
+               setStrictJava(true);\r
+\r
+               class BshMessenger extends org.argeo.slc.core.test.SimpleTestRun {\r
+\r
+                       String message = "test";\r
+\r
+                       public void execute(){\r
+                               System.out.println(message);\r
+                       }\r
+                       \r
+                       public void setMessage(String message){\r
+                               this.message = message;\r
+                       }\r
+               }\r
+               ]]></lang:inline-script>\r
+       </lang:bsh>\r
+\r
+</beans>
\ No newline at end of file
index df54f154b2b041bb1e4df96b3f7a2f0714973c3d..b5ef387afabc93bc2c852ad9eac7cca6c34252f0 100644 (file)
@@ -1,6 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <classpath>
        <classpathentry kind="src" path="src/main/resources"/>
+       <classpathentry kind="src" path="src/test/java"/>
        <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
        <classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
        <classpathentry kind="output" path="target/classes"/>
index 6a65410fd33956be21564a62c188950e9b00e064..ffa5f4ca37def5a0b42727703d633b5cca9ccf69 100644 (file)
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <projectDescription>
-       <name>org.argeo.slc.demo.basic</name>
+       <name>org.argeo.slc.demo.manager</name>
        <comment></comment>
        <projects>
        </projects>
index c11d814860ade8dba00c82079d3507a8a3952aee..2732929fee7c5d771fbc81da7241251b1197deef 100644 (file)
@@ -7,6 +7,8 @@
        </configSuffixes>
        <enableImports><![CDATA[true]]></enableImports>
        <configs>
+               <config>src/main/resources/conf/manager-osgi.xml</config>
+               <config>src/main/resources/conf/manager.xml</config>
        </configs>
        <configSets>
        </configSets>
index 33d29dd732415e6f4a1ecb1cf8c29fa887be96cc..d1b8d37d042d6fac4f3b34cb80537c63a1c1c6aa 100644 (file)
@@ -8,15 +8,12 @@
                <relativePath>../../org.argeo.slc</relativePath>
        </parent>
        <groupId>org.argeo.slc.demo</groupId>
-       <artifactId>org.argeo.slc.demo.basic</artifactId>
-       <name>SLC Demo Basic Test Module</name>
-       <packaging>jar</packaging>
+       <artifactId>org.argeo.slc.demo.manager</artifactId>
+       <name>SLC Demo Manager</name>
+       <packaging>bundle</packaging>
        <properties></properties>
        <build>
                <plugins>
-                       <plugin>
-                               <artifactId>maven-jar-plugin</artifactId>
-                       </plugin>
                        <plugin>
                                <groupId>org.apache.felix</groupId>
                                <artifactId>maven-bundle-plugin</artifactId>
                                <configuration>
                                        <instructions>
                                                <Import-Package>org.apache.commons.logging,org.springframework.beans.factory.config</Import-Package>
-                                               <Require-Bundle>org.argeo.slc.execution,org.argeo.slc.specs,org.argeo.slc.support.simple,org.springframework.aop,com.springsource.net.sf.cglib,com.springsource.org.aopalliance</Require-Bundle>
-                                               <Spring-Context>conf/main.xml</Spring-Context>
+                                               <Require-Bundle>org.springframework.jms,com.springsource.org.castor,com.springsource.org.apache.xbean.spring,com.springsource.org.apache.activemq,org.argeo.slc.execution,org.argeo.slc.support.activemq,org.argeo.slc.specs,org.argeo.slc.support.simple,org.springframework.aop,org.springframework.oxm,com.springsource.net.sf.cglib,com.springsource.org.aopalliance</Require-Bundle>
+                                               <Spring-Context>conf/*</Spring-Context>
+                                               <!-- 
+                                               <Embed-Dependency>com.springsource.org.castor</Embed-Dependency>
+                                               <Embed-Transitive>true</Embed-Transitive>
+                                               <Import-Package>*,javax.xml.parsers;resolution:=optional,
+                                                       javax.xml.transform;resolution:=optional,
+                                                       javax.xml.transform.dom;resolution:=optional,
+                                                       javax.xml.transform.stream;resolution:=optional,
+                                                       org.w3c.dom;resolution:=optional,
+                                                       org.xml.sax;resolution:=optional,
+                                                       org.xml.sax.helpers;resolution:=optional,
+                                                       netscape.ldap;resolution:=optional,
+                                                       org.apache.oro.text.regex;resolution:=optional,
+                                                       org.apache.xerces.utils.regex;resolution:=optional,
+                                                       weblogic.apache.xml.serialize;resolution:=optional,
+                                                       com.sun.org.apache.xml.internal.serialize;resolution:=optional
+                                               </Import-Package>
+                                               <Eclipse-RegisterBuddy>com.springsource.org.castor</Eclipse-RegisterBuddy>
+                                                -->
+
                                        </instructions>
                                </configuration>
                        </plugin>
                </dependency>
                <dependency>
                        <groupId>org.argeo.slc.runtime</groupId>
-                       <artifactId>org.argeo.slc.support.simple</artifactId>
+                       <artifactId>org.argeo.slc.support.activemq</artifactId>
+               </dependency>
+               <dependency>
+                       <groupId>org.argeo.slc.runtime</groupId>
+                       <artifactId>org.argeo.slc.support.castor</artifactId>
+               </dependency>
+
+               <dependency>
+                       <groupId>org.codehaus.castor</groupId>
+                       <artifactId>com.springsource.org.castor</artifactId>
+               </dependency>
+
+               <dependency>
+                       <groupId>javax.ejb</groupId>
+                       <artifactId>com.springsource.javax.ejb</artifactId>
+                       <version>3.0.0</version>
+               </dependency>
+               <dependency>
+                       <groupId>javax.xml.rpc</groupId>
+                       <artifactId>com.springsource.javax.xml.rpc</artifactId>
+                       <version>1.1.0</version>
                </dependency>
+               <dependency>
+                       <groupId>javax.xml.soap</groupId>
+                       <artifactId>com.springsource.javax.xml.soap</artifactId>
+                       <version>1.3.0</version>
+               </dependency>
+               <dependency>
+                       <groupId>javax.activation</groupId>
+                       <artifactId>com.springsource.javax.activation</artifactId>
+                       <version>1.1.1</version>
+               </dependency>
+               <dependency>
+                       <groupId>javax.servlet</groupId>
+                       <artifactId>com.springsource.javax.servlet</artifactId>
+               </dependency>
+
                <dependency>
                        <groupId>org.argeo.slc</groupId>
                        <artifactId>org.argeo.slc.detached.launcher</artifactId>
                        <groupId>org.springframework.osgi</groupId>
                        <artifactId>org.springframework.osgi.extender</artifactId>
                </dependency>
+
        </dependencies>
 </project>
diff --git a/demo/org.argeo.slc.demo.manager/src/main/resources/META-INF/MANIFEST.MF b/demo/org.argeo.slc.demo.manager/src/main/resources/META-INF/MANIFEST.MF
deleted file mode 100644 (file)
index d0c3f3d..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-Manifest-Version: 1.0\r
-Private-Package: conf;version="0.11.3-SNAPSHOT",conf.testCases;version\r
- ="0.11.3-SNAPSHOT"\r
-Tool: Bnd-0.0.255\r
-Bundle-Name: SLC Sandbox Execution Flow\r
-Created-By: 1.6.0_0 (Sun Microsystems Inc.)\r
-Require-Bundle: org.argeo.slc.execution,org.argeo.slc.specs,org.argeo.\r
- slc.support.simple,org.springframework.aop,com.springsource.net.sf.cg\r
- lib,com.springsource.org.aopalliance\r
-Bundle-Vendor: Argeo\r
-Bundle-Version: 0.11.3.SNAPSHOT\r
-Spring-Context: conf/main.xml\r
-Bundle-ManifestVersion: 2\r
-Bundle-License: http://www.apache.org/licenses/LICENSE-2.0.txt\r
-Import-Package: org.apache.commons.logging;version="1.1",org.springfra\r
- mework.beans.factory.config\r
-Bundle-SymbolicName: org.argeo.slc.sandbox.executionflow\r
-Bundle-DocURL: http://www.argeo.org\r
-Originally-Created-By: 1.6.0_0 (Sun Microsystems Inc.)\r
-\r
diff --git a/demo/org.argeo.slc.demo.manager/src/main/resources/conf/BasicExecutionFlow.groovy b/demo/org.argeo.slc.demo.manager/src/main/resources/conf/BasicExecutionFlow.groovy
deleted file mode 100644 (file)
index da3926e..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-import org.argeo.slc.test.*;
-
-public class BasicExecutionFlow implements org.argeo.slc.executionflow.ExecutionFlow {
-
-       ExecutableTestRun firstSubTest = null;
-       ExecutableTestRun secondSubTest = null;
-
-       void execute(){
-               firstSubTest?.execute();
-               secondSubTest?.execute();
-       }
-}
diff --git a/demo/org.argeo.slc.demo.manager/src/main/resources/conf/basic.xml b/demo/org.argeo.slc.demo.manager/src/main/resources/conf/basic.xml
deleted file mode 100644 (file)
index c2077f5..0000000
+++ /dev/null
@@ -1,85 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>\r
-<beans xmlns="http://www.springframework.org/schema/beans"\r
-       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p"\r
-       xmlns:aop="http://www.springframework.org/schema/aop"\r
-       xsi:schemaLocation="\r
-       http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd\r
-       http://www.springframework.org/schema/lang http://www.springframework.org/schema/lang/spring-lang-2.5.xsd\r
-       http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd">\r
-\r
-       <bean id="basic.executionSpec" class="org.argeo.slc.execution.SimpleExecutionSpec">\r
-               <property name="attributes">\r
-                       <map>\r
-                               <entry key="testedComponentId">\r
-                                       <bean parent="specAttribute" p:value="100" />\r
-                               </entry>\r
-                               <entry key="testData1">\r
-                                       <bean parent="refAttribute" p:targetClass="org.argeo.slc.core.test.BasicTestData" />\r
-                               </entry>\r
-                               <entry key="testData2">\r
-                                       <bean parent="refAttribute" p:targetClass="org.argeo.slc.core.test.BasicTestData" />\r
-                               </entry>\r
-                       </map>\r
-               </property>\r
-       </bean>\r
-\r
-       <bean id="basic.ref" factory-bean="basic.executionSpec"\r
-               factory-method="createRef" abstract="true" />\r
-\r
-       <bean id="basic.executionFlowTemplate" class="org.argeo.slc.execution.SimpleExecutionFlow"\r
-               abstract="true">\r
-               <property name="executionSpec" ref="basic.executionSpec" />\r
-               <property name="executables">\r
-                       <list>\r
-                               <ref bean="echo1" />\r
-                               <bean parent="testRun">\r
-                                       <property name="testDefinition" ref="testDef" />\r
-                                       <property name="testData">\r
-                                               <bean parent="basic.ref">\r
-                                                       <constructor-arg value="testData1" />\r
-                                               </bean>\r
-                                       </property>\r
-                               </bean>\r
-                               <bean parent="testRun">\r
-                                       <property name="testDefinition" ref="testDef" />\r
-                                       <property name="testData" ref="ref1" />\r
-                               </bean>\r
-                       </list>\r
-               </property>\r
-       </bean>\r
-\r
-       <bean id="ref1" parent="basic.ref" scope="prototype">\r
-               <constructor-arg value="testData2" />\r
-       </bean>\r
-\r
\r
-       <bean id="basic.testData" class="org.argeo.slc.core.test.BasicTestData"\r
-               >\r
-               <aop:scoped-proxy />\r
-               <property name="expected" value="tata" />\r
-               <property name="reached" value="tata" />\r
-       </bean>\r
\r
\r
-       <bean id="testDef" class="org.argeo.slc.core.test.BasicTestDefinition"\r
-               scope="prototype" />\r
-\r
-       <bean id="testResult" parent="slcDefault.test.basicSimpleTestResult" />\r
-\r
-       <bean id="testRun" class="org.argeo.slc.core.test.SimpleTestRun"\r
-               abstract="true">\r
-               <property name="testResult" ref="testResult" />\r
-       </bean>\r
-\r
-       <!--\r
-               <bean class="org.springframework.aop.framework.ProxyFactoryBean">\r
-               <property name="targetClass"\r
-               value="org.argeo.slc.core.test.BasicTestData" /> <property\r
-               name="targetSource"> <bean\r
-               class="org.argeo.slc.executionflow.ExecutionTargetSource"> <property\r
-               name="name" value="testData" /> <property name="targetClass"\r
-               value="org.argeo.slc.core.test.BasicTestData" /> </bean> </property>\r
-               <property name="proxyTargetClass" value="true" /> </bean>\r
-       -->\r
-\r
-</beans>
\ No newline at end of file
diff --git a/demo/org.argeo.slc.demo.manager/src/main/resources/conf/common.xml b/demo/org.argeo.slc.demo.manager/src/main/resources/conf/common.xml
deleted file mode 100644 (file)
index 4495b2f..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>\r
-<beans xmlns="http://www.springframework.org/schema/beans"\r
-       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p"\r
-       xmlns:aop="http://www.springframework.org/schema/aop"\r
-       xsi:schemaLocation="\r
-       http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd\r
-       http://www.springframework.org/schema/lang http://www.springframework.org/schema/lang/spring-lang-2.5.xsd\r
-       http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd">\r
-\r
-       <import\r
-               resource="classpath:/org/argeo/slc/core/test/spring/applicationContext.xml" />\r
-\r
-       <bean id="specAttribute" class="org.argeo.slc.execution.SimpleSpecAttribute"\r
-               abstract="true" />\r
-\r
-       <bean id="refAttribute" class="org.argeo.slc.execution.RefSpecAttribute"\r
-               abstract="true" />\r
-\r
-</beans>
\ No newline at end of file
diff --git a/demo/org.argeo.slc.demo.manager/src/main/resources/conf/jms.xml b/demo/org.argeo.slc.demo.manager/src/main/resources/conf/jms.xml
new file mode 100644 (file)
index 0000000..b5a323d
--- /dev/null
@@ -0,0 +1,48 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd"
+       default-lazy-init="false">
+
+       <import resource="classpath:org/argeo/slc/castor/spring.xml" />
+
+       <bean id="slcDefault.jms.castorMessageConverter" class="org.argeo.slc.jms.MarshallerMessageConverter">
+               <property name="marshaller" ref="slcDefault.castor.marshaller" />
+               <property name="unmarshaller" ref="slcDefault.castor.marshaller" />
+       </bean>
+
+
+       <bean id="slcDefault.jms.amqConnectionFactory" class="org.apache.activemq.ActiveMQConnectionFactory">
+               <property name="brokerURL">
+                       <value>tcp://localhost:61616</value>
+               </property>
+       </bean>
+
+
+       <bean id="slcDefault.jms.connectionFactory"
+               class="org.springframework.jms.connection.SingleConnectionFactory">
+               <property name="targetConnectionFactory">
+                       <ref local="slcDefault.jms.amqConnectionFactory" />
+               </property>
+       </bean>
+
+       <bean id="slcDefault.jms.jmsTemplateCastor" class="org.springframework.jms.core.JmsTemplate">
+               <property name="connectionFactory" ref="slcDefault.jms.connectionFactory" />
+               <property name="messageConverter" ref="slcDefault.jms.castorMessageConverter" />
+       </bean>
+
+
+
+       <!-- Templates -->
+       <bean id="slcTemplate.jms.listenerContainer"
+               class="org.springframework.jms.listener.DefaultMessageListenerContainer"
+               abstract="true">
+               <property name="connectionFactory" ref="slcDefault.jms.connectionFactory" />
+       </bean>
+
+       <bean id="slcTemplate.jms.listenerAdapterCastor"
+               class="org.springframework.jms.listener.adapter.MessageListenerAdapter"
+               abstract="true">
+               <property name="messageConverter" ref="slcDefault.jms.castorMessageConverter" />
+       </bean>
+</beans>
\ No newline at end of file
diff --git a/demo/org.argeo.slc.demo.manager/src/main/resources/conf/main.xml b/demo/org.argeo.slc.demo.manager/src/main/resources/conf/main.xml
deleted file mode 100644 (file)
index aab3785..0000000
+++ /dev/null
@@ -1,75 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>\r
-<beans xmlns="http://www.springframework.org/schema/beans"\r
-       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p"\r
-       xmlns:aop="http://www.springframework.org/schema/aop" xmlns:context="http://www.springframework.org/schema/context"\r
-       xsi:schemaLocation="\r
-       http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd\r
-       http://www.springframework.org/schema/lang http://www.springframework.org/schema/lang/spring-lang-2.5.xsd\r
-       http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd\r
-       http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd">\r
-\r
-       <import resource="common.xml" />\r
-\r
-       <import resource="basic.xml" />\r
-       <import resource="testCases/basic-001.xml" />\r
-       <import resource="testCases/basic-002.xml" />\r
-\r
-       <bean id="testLaunch" class="org.argeo.slc.execution.TestLaunch"\r
-               p:flowName="main" init-method="launch"/>\r
-\r
-       <bean id="main" class="org.argeo.slc.execution.SimpleExecutionFlow">\r
-               <property name="executionSpec">\r
-                       <bean class="org.argeo.slc.execution.SimpleExecutionSpec">\r
-                               <property name="attributes">\r
-                                       <map>\r
-                                               <entry key="testKey">\r
-                                                       <bean parent="specAttribute" p:value="660" />\r
-                                               </entry>\r
-                                       </map>\r
-                               </property>\r
-                       </bean>\r
-               </property>\r
-               <property name="executables">\r
-                       <list>\r
-                               <ref local="echo1" />\r
-                               <ref bean="basic.001" />\r
-                               <ref bean="basic.001" />\r
-                               <ref bean="basic.002" />\r
-                       </list>\r
-               </property>\r
-       </bean>\r
-\r
-       <bean id="echo1" parent="echoTemplate" scope="execution">\r
-               <property name="message"\r
-                       value="From main! @{testKey}, slc.flows=@{slc.flows}" />\r
-               <aop:scoped-proxy />\r
-       </bean>\r
-\r
-       <bean id="echoTemplate" class="org.argeo.slc.execution.tasks.Echo"\r
-               abstract="true">\r
-       </bean>\r
-\r
-       <context:annotation-config />\r
-       <bean class="org.argeo.slc.execution.ExecutionRegister" />\r
-\r
-\r
-       <bean class="org.springframework.beans.factory.config.CustomScopeConfigurer">\r
-               <property name="scopes">\r
-                       <map>\r
-                               <entry key="execution">\r
-                                       <bean class="org.argeo.slc.execution.ExecutionScope" />\r
-                               </entry>\r
-                       </map>\r
-               </property>\r
-       </bean>\r
-\r
-       <bean\r
-               class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer" />\r
-       <bean class="org.argeo.slc.execution.ExecutionParameterPostProcessor" />\r
-       <bean class="org.argeo.slc.execution.InstantiationPostProcessor" />\r
-       <bean class="org.argeo.slc.execution.Executor" />\r
-\r
-       <bean class="org.argeo.slc.execution.ExecutionAspect"></bean>\r
-       <aop:aspectj-autoproxy />\r
-\r
-</beans>
\ No newline at end of file
diff --git a/demo/org.argeo.slc.demo.manager/src/main/resources/conf/manager-osgi.xml b/demo/org.argeo.slc.demo.manager/src/main/resources/conf/manager-osgi.xml
new file mode 100644 (file)
index 0000000..a37132e
--- /dev/null
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>\r
+<beans:beans xmlns="http://www.springframework.org/schema/osgi"\r
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:beans="http://www.springframework.org/schema/beans"\r
+       xsi:schemaLocation="http://www.springframework.org/schema/osgi  \r
+       http://www.springframework.org/schema/osgi/spring-osgi-1.1.xsd\r
+       http://www.springframework.org/schema/beans   \r
+       http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">\r
+\r
+       <list id="executionModules" interface="org.argeo.slc.execution.ExecutionModule" />\r
+</beans:beans>
\ No newline at end of file
diff --git a/demo/org.argeo.slc.demo.manager/src/main/resources/conf/manager.xml b/demo/org.argeo.slc.demo.manager/src/main/resources/conf/manager.xml
new file mode 100644 (file)
index 0000000..3c3a278
--- /dev/null
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>\r
+<beans xmlns="http://www.springframework.org/schema/beans"\r
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p"\r
+       xmlns:aop="http://www.springframework.org/schema/aop" xmlns:context="http://www.springframework.org/schema/context"\r
+       xsi:schemaLocation="\r
+       http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd\r
+       http://www.springframework.org/schema/lang http://www.springframework.org/schema/lang/spring-lang-2.5.xsd\r
+       http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd\r
+       http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd">\r
+\r
+\r
+       <bean id="modulesManager" class="org.argeo.slc.execution.ModulesManager">\r
+               <property name="executionModules" ref="executionModules" />\r
+       </bean>\r
+\r
+       <bean id="modulesManager.listenerContainer" parent="slcTemplate.jms.listenerContainer">\r
+               <property name="destinationName" value="modulesManager.request" />\r
+               <property name="messageListener">\r
+                       <bean class="org.argeo.slc.jms.ServiceMessageListenerAdapter">\r
+                               <property name="methodArguments">\r
+                                       <map>\r
+                                               <entry key="getExecutionModuleDescriptor">\r
+                                                       <list>\r
+                                                               <value>name</value>\r
+                                                               <value>version</value>\r
+                                                       </list>\r
+                                               </entry>\r
+                                       </map>\r
+                               </property>\r
+\r
+                               <property name="delegate" ref="modulesManager" />\r
+                               <property name="defaultResponseQueueName" value="modulesManager.response" />\r
+                               <property name="messageConverter" ref="slcDefault.jms.castorMessageConverter" />\r
+                       </bean>\r
+               </property>\r
+       </bean>\r
+\r
+</beans>
\ No newline at end of file
diff --git a/demo/org.argeo.slc.demo.manager/src/main/resources/conf/slc.properties b/demo/org.argeo.slc.demo.manager/src/main/resources/conf/slc.properties
deleted file mode 100644 (file)
index b18dce1..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-log4j.rootLogger=WARN, console
-
-## Levels
-log4j.logger.org.argeo=DEBUG
-log4j.logger.org.argeo.slc.executionflow.ExecutionParameterPostProcessor=TRACE
-log4j.logger.org.argeo.slc.executionflow.ExecutionContext=TRACE
-
-## Appenders
-# console is set to be a ConsoleAppender.
-log4j.appender.console=org.apache.log4j.ConsoleAppender
-
-# console uses PatternLayout.
-log4j.appender.console.layout=org.apache.log4j.PatternLayout
-log4j.appender.console.layout.ConversionPattern= %-5p %d{ISO8601} %m - %c%n
-
-testCase=002
\ No newline at end of file
diff --git a/demo/org.argeo.slc.demo.manager/src/main/resources/conf/test.xml b/demo/org.argeo.slc.demo.manager/src/main/resources/conf/test.xml
deleted file mode 100644 (file)
index 6cc40e8..0000000
+++ /dev/null
@@ -1,105 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>\r
-<beans xmlns="http://www.springframework.org/schema/beans"\r
-       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p"\r
-       xmlns:lang="http://www.springframework.org/schema/lang"\r
-       xsi:schemaLocation="\r
-       http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd\r
-       http://www.springframework.org/schema/lang http://www.springframework.org/schema/lang/spring-lang-2.5.xsd\r
-       ">\r
-\r
-       <import\r
-               resource="classpath:/org/argeo/slc/core/test/spring/applicationContext.xml" />\r
-\r
-       <import resource="testCases/basic-001.xml" />\r
-       <import resource="testCases/basic-002.xml" />\r
-\r
-       <bean id="executionFlow.basic1" class="org.argeo.slc.executionflow.SimpleExecutionFlow">\r
-               <meta key="meta1" value="mata1Value" />\r
-               <qualifier>\r
-                       <attribute key="qual1" value="qual1value" />\r
-               </qualifier>\r
-               <property name="executables">\r
-                       <list>\r
-                               <ref local="testGroovyImpl" />\r
-                               <ref local="testBshImpl" />\r
-                               <bean parent="testRun" p:testDefinition-ref="testDef"\r
-                                       p:testData-ref="testData-${testCase}" />\r
-                               <bean parent="testRun" p:testDefinition-ref="testDef"\r
-                                       p:testData-ref="testData-${testCase}" />\r
-                       </list>\r
-               </property>\r
-       </bean>\r
-\r
-       <lang:groovy id="executionFlow.groovy1" script-source="src/slc/conf/BasicExecutionFlow.groovy">\r
-               <lang:property name="firstSubTest">\r
-                       <bean parent="testRun" p:testDefinition-ref="testDef"\r
-                               p:testData-ref="testData-${testCase}" />\r
-               </lang:property>\r
-       </lang:groovy>\r
-\r
-       <bean id="testGroovyImpl" parent="testGroovy">\r
-               <property name="message" value="Hello World! Groovy" />\r
-       </bean>\r
-       <bean id="testBshImpl" parent="testBsh">\r
-               <property name="message" value="Hello World! Beanshell" />\r
-       </bean>\r
-\r
-       <bean id="testDef" class="org.argeo.slc.core.test.BasicTestDefinition"\r
-               scope="prototype" />\r
-\r
-       <bean\r
-               class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer" />\r
-\r
-       <bean id="testResult" parent="slcDefault.test.basicSimpleTestResult">\r
-       </bean>\r
-\r
-       <bean id="testRun" class="org.argeo.slc.core.test.SimpleTestRun"\r
-               abstract="true">\r
-               <property name="testResult" ref="testResult" />\r
-       </bean>\r
-\r
-       <lang:groovy id="testGroovyBean">\r
-               <lang:inline-script><![CDATA[\r
-               class Message {\r
-               String message = 'test'\r
-               \r
-               public String getMessage(){\r
-                       return message;\r
-               }\r
-               }\r
-               ]]></lang:inline-script>\r
-       </lang:groovy>\r
-\r
-       <lang:groovy id="testGroovy">\r
-               <lang:inline-script><![CDATA[\r
-               class GroovyMessenger extends org.argeo.slc.core.test.SimpleTestRun {\r
-       \r
-               String message = 'test'\r
-       \r
-                       void execute(){\r
-                               println(message);\r
-                       }\r
-               }\r
-               ]]></lang:inline-script>\r
-       </lang:groovy>\r
-\r
-       <lang:bsh id="testBsh" script-interfaces="org.argeo.slc.test.ExecutableTestRun">\r
-               <lang:inline-script><![CDATA[\r
-               setStrictJava(true);\r
-\r
-               class BshMessenger extends org.argeo.slc.core.test.SimpleTestRun {\r
-\r
-                       String message = "test";\r
-\r
-                       public void execute(){\r
-                               System.out.println(message);\r
-                       }\r
-                       \r
-                       public void setMessage(String message){\r
-                               this.message = message;\r
-                       }\r
-               }\r
-               ]]></lang:inline-script>\r
-       </lang:bsh>\r
-\r
-</beans>
\ No newline at end of file
diff --git a/demo/org.argeo.slc.demo.manager/src/main/resources/conf/testCases/basic-001.xml b/demo/org.argeo.slc.demo.manager/src/main/resources/conf/testCases/basic-001.xml
deleted file mode 100644 (file)
index a542664..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>\r
-<beans xmlns="http://www.springframework.org/schema/beans"\r
-       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p"\r
-       xmlns:aop="http://www.springframework.org/schema/aop"\r
-       xsi:schemaLocation="\r
-       http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd\r
-       http://www.springframework.org/schema/lang http://www.springframework.org/schema/lang/spring-lang-2.5.xsd\r
-       http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd">\r
-\r
-       <bean id="basic.001" parent="basic.executionFlowTemplate">\r
-               <constructor-arg>\r
-                       <map>\r
-                               <entry key="testData1" value-ref="basic.001.testData" />\r
-                               <entry key="testData2">\r
-                                       <bean class="org.argeo.slc.core.test.BasicTestData" scope="execution">\r
-                                               <aop:scoped-proxy />\r
-                                               <property name="expected" value="tata101" />\r
-                                               <property name="reached" value="tata@{testKey}" />\r
-                                       </bean>\r
-                               </entry>\r
-                       </map>\r
-               </constructor-arg>\r
-       </bean>\r
-\r
-       <bean id="basic.001.testData" class="org.argeo.slc.core.test.BasicTestData"\r
-               scope="execution">\r
-               <aop:scoped-proxy />\r
-               <property name="expected" value="tata100" />\r
-               <property name="reached" value="tata@{testedComponentId}" />\r
-       </bean>\r
-\r
-       <bean id="basic.001.testData2" class="org.argeo.slc.core.test.context.DefaultContextTestData">\r
-       </bean>\r
-\r
-</beans>
\ No newline at end of file
diff --git a/demo/org.argeo.slc.demo.manager/src/main/resources/conf/testCases/basic-002.xml b/demo/org.argeo.slc.demo.manager/src/main/resources/conf/testCases/basic-002.xml
deleted file mode 100644 (file)
index c2946fd..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>\r
-<beans xmlns="http://www.springframework.org/schema/beans"\r
-       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p"\r
-\r
-       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">\r
-\r
-       <bean id="basic.002" parent="basic.executionFlowTemplate">\r
-               <constructor-arg>\r
-                       <map>\r
-                               <entry key="testData1">\r
-                                       <bean class="org.argeo.slc.core.test.BasicTestData">\r
-                                               <property name="expected" value="toto" />\r
-                                               <property name="reached" value="toto" />\r
-                                       </bean>\r
-                               </entry>\r
-                               <entry key="testData2">\r
-                                       <bean class="org.argeo.slc.core.test.BasicTestData">\r
-                                               <property name="expected" value="tata" />\r
-                                               <property name="reached" value="toto" />\r
-                                       </bean>\r
-                               </entry>\r
-                       </map>\r
-               </constructor-arg>\r
-       </bean>\r
-</beans>
\ No newline at end of file
diff --git a/demo/org.argeo.slc.demo.manager/src/test/java/org/argeo/slc/demo/manager/JmsTesting.java b/demo/org.argeo.slc.demo.manager/src/test/java/org/argeo/slc/demo/manager/JmsTesting.java
new file mode 100644 (file)
index 0000000..50ea47e
--- /dev/null
@@ -0,0 +1,57 @@
+package org.argeo.slc.demo.manager;
+
+import javax.jms.ConnectionFactory;
+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.apache.xbean.spring.context.ClassPathXmlApplicationContext;
+import org.springframework.beans.BeansException;
+import org.springframework.jms.JmsException;
+import org.springframework.jms.core.JmsTemplate;
+import org.springframework.jms.core.MessageCreator;
+
+public class JmsTesting {
+       private final static Log log = LogFactory.getLog(JmsTesting.class);
+
+       /**
+        * @param args
+        */
+       public static void main(String[] args) {
+               ClassPathXmlApplicationContext applicationContext = new ClassPathXmlApplicationContext(
+                               "conf/jms.xml");
+               try {
+
+                       ConnectionFactory connectionFactory = (ConnectionFactory) applicationContext
+                                       .getBean("slcDefault.jms.connectionFactory");
+                       JmsTemplate jmsTemplate = new JmsTemplate(connectionFactory);
+
+                       jmsTemplate.send("modulesManager.request", new MessageCreator() {
+
+                               public Message createMessage(Session session)
+                                               throws JMSException {
+                                       TextMessage message = session.createTextMessage();
+                                       message.setStringProperty("action",
+                                                       "getExecutionModuleDescriptor");
+                                       message.setStringProperty("name",
+                                                       "org.argeo.slc.demo.basic");
+                                       message.setStringProperty("version", "LATEST");
+                                       return message;
+                               }
+                       });
+
+                       TextMessage message = (TextMessage) jmsTemplate
+                                       .receive("modulesManager.response");
+                       log.info("Received message: " + message.getText() + "\n");
+
+               } catch (Exception e) {
+                       e.printStackTrace();
+               } finally {
+                       applicationContext.close();
+               }
+       }
+
+}
index f6092a1ff4d055243fbdbec221fb5a470175ccfe..33b4d3afd63d86f747a01ccf90e45e9f2f0ef184 100644 (file)
@@ -12,6 +12,7 @@
        <properties>
                <version.spring>2.5.6.A</version.spring>
                <version.spring-ws>1.5.5.A</version.spring-ws>
+               <version.spring-osgi>1.1.3.RELEASE</version.spring-osgi>
                <version.maven>2.0.9</version.maven>
                <version.ant>1.7.0</version.ant>
                <version.jetty>6.1.14</version.jetty>
@@ -48,7 +49,7 @@ 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.
 ]]>
-               </comments>
+                       </comments>
                </license>
        </licenses>
        <organization>
@@ -469,7 +470,12 @@ limitations under the License.
                        <dependency>
                                <groupId>org.springframework.osgi</groupId>
                                <artifactId>org.springframework.osgi.extender</artifactId>
-                               <version>1.1.2.B</version>
+                               <version>${version.spring-osgi}</version>
+                       </dependency>
+                       <dependency>
+                               <groupId>org.springframework.osgi</groupId>
+                               <artifactId>org.springframework.osgi.core</artifactId>
+                               <version>${version.spring-osgi}</version>
                        </dependency>
 
                        <!-- Ant -->
@@ -749,7 +755,8 @@ limitations under the License.
                        <id>com.springsource.repository.bundles.release</id>
                        <name>
                                SpringSource Enterprise Bundle Repository - SpringSource
-                               Bundle Releases
+                               Bundle
+                               Releases
                        </name>
                        <url>
                                http://repository.springsource.com/maven/bundles/release
@@ -769,7 +776,8 @@ limitations under the License.
                        <id>com.springsource.repository.bundles.external</id>
                        <name>
                                SpringSource Enterprise Bundle Repository - External
-                               Bundle Releases
+                               Bundle
+                               Releases
                        </name>
                        <url>
                                http://repository.springsource.com/maven/bundles/external
index 16f01e2ee7b671c44c26c453773dab706e98da1e..30baf1326015b0e1e881c9009d643374adafa6e4 100644 (file)
@@ -1,6 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <classpath>
        <classpathentry kind="src" output="target/classes" path="src/main/java"/>
+       <classpathentry kind="src" path="src/main/resources"/>
        <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
        <classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
        <classpathentry kind="output" path="target/classes"/>
index 4fc28d3f108fd00684d330f81344cd81a0f1c2d6..a563077112d4de23062f10087a41d45232605c1f 100644 (file)
                        <artifactId>org.argeo.slc.support.simple</artifactId>
                </dependency>
 
+               <dependency>
+                       <groupId>org.eclipse.osgi</groupId>
+                       <artifactId>org.eclipse.osgi</artifactId>
+               </dependency>
+               <dependency>
+                       <groupId>org.springframework.osgi</groupId>
+                       <artifactId>org.springframework.osgi.core</artifactId>
+               </dependency>
+
                <dependency>
                        <groupId>org.aspectj</groupId>
                        <artifactId>com.springsource.org.aspectj.runtime</artifactId>
diff --git a/runtime/org.argeo.slc.execution/src/main/java/org/argeo/slc/execution/AbstractSpringExecutionModule.java b/runtime/org.argeo.slc.execution/src/main/java/org/argeo/slc/execution/AbstractSpringExecutionModule.java
new file mode 100644 (file)
index 0000000..c39343b
--- /dev/null
@@ -0,0 +1,68 @@
+package org.argeo.slc.execution;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.argeo.slc.process.SlcExecution;
+import org.springframework.beans.BeansException;
+import org.springframework.beans.factory.generic.GenericBeanFactoryAccessor;
+import org.springframework.context.ApplicationContext;
+import org.springframework.context.ApplicationContextAware;
+import org.springframework.util.Assert;
+
+public abstract class AbstractSpringExecutionModule implements ExecutionModule,
+               ApplicationContextAware {
+       private ApplicationContext applicationContext;
+
+       public ExecutionModuleDescriptor getDescriptor() {
+               ExecutionModuleDescriptor md = new ExecutionModuleDescriptor();
+               md.setName(getName());
+               md.setVersion(getVersion());
+
+               GenericBeanFactoryAccessor accessor = new GenericBeanFactoryAccessor(
+                               applicationContext);
+               Map<String, ExecutionFlow> executionFlows = accessor
+                               .getBeansOfType(ExecutionFlow.class);
+
+               for (String name : executionFlows.keySet()) {
+                       ExecutionFlow executionFlow = executionFlows.get(name);
+
+                       Assert.notNull(executionFlow.getName());
+                       Assert.state(name.equals(executionFlow.getName()));
+
+                       ExecutionSpec executionSpec = executionFlow.getExecutionSpec();
+                       Assert.notNull(executionSpec);
+                       Assert.notNull(executionSpec.getName());
+
+                       Map<String, Object> values = new HashMap<String, Object>();
+                       for (String key : executionSpec.getAttributes().keySet()) {
+                               ExecutionSpecAttribute attribute = executionSpec
+                                               .getAttributes().get(key);
+                               if (attribute instanceof SimpleExecutionSpec
+                                               && attribute.getIsParameter()) {
+                                       values.put(key, executionFlow.getParameter(key));
+                               }
+                       }
+
+                       ExecutionFlowDescriptor efd = new ExecutionFlowDescriptor(name,
+                                       values, executionSpec);
+
+                       if (!md.getExecutionSpecs().contains(executionSpec))
+                               md.getExecutionSpecs().add(executionSpec);
+                       md.getExecutionFlows().add(efd);
+               }
+
+               return md;
+       }
+
+       public void execute(SlcExecution slcExecution) {
+               applicationContext.publishEvent(new NewExecutionEvent(this,
+                               slcExecution));
+       }
+
+       public void setApplicationContext(ApplicationContext applicationContext)
+                       throws BeansException {
+               this.applicationContext = applicationContext;
+       }
+
+}
diff --git a/runtime/org.argeo.slc.execution/src/main/java/org/argeo/slc/execution/ExecutionCommandProvider.java b/runtime/org.argeo.slc.execution/src/main/java/org/argeo/slc/execution/ExecutionCommandProvider.java
new file mode 100644 (file)
index 0000000..ad71a4d
--- /dev/null
@@ -0,0 +1,46 @@
+package org.argeo.slc.execution;
+
+import java.util.List;
+
+import org.argeo.slc.process.SlcExecution;
+import org.eclipse.osgi.framework.console.CommandInterpreter;
+import org.eclipse.osgi.framework.console.CommandProvider;
+
+public class ExecutionCommandProvider implements CommandProvider {
+       private List<ExecutionModule> executionModules;
+
+       public Object _slc_execute(CommandInterpreter ci) {
+               String moduleName = ci.nextArgument();
+               String executionName = ci.nextArgument();
+               
+               SlcExecution slcExecution = new SlcExecution();
+               slcExecution.getAttributes().put("slc.flows", executionName);
+
+               ExecutionModule module = null;
+               for (ExecutionModule moduleT : executionModules) {
+                       if(moduleT.getName().equals(moduleName)){
+                               // TODO: check version
+                               module = moduleT;
+                               break;
+                       }
+               }
+
+               if(module!=null)
+                       module.execute(slcExecution);
+               
+               return null;
+       }
+
+       public String getHelp() {
+               StringBuffer buf = new StringBuffer();
+               buf.append("---SLC Execution Commands---\n");
+               buf.append("\tslc_execute - Execute an execution flow\n");
+               return buf.toString();
+
+       }
+
+       public void setExecutionModules(List<ExecutionModule> executionModules) {
+               this.executionModules = executionModules;
+       }
+
+}
index cd2baa3da402610bc51bfa7a679432f3dda90b31..c6d8e2c338e686fa426e1362cb45027635797538 100644 (file)
@@ -52,7 +52,7 @@ public class ExecutionContext {
                ExecutionFlowRuntime runtime = new ExecutionFlowRuntime(executionFlow);
                stack.push(runtime);
 
-               if (log.isTraceEnabled())
+               if (log.isDebugEnabled())
                        log.debug(depthSpaces(stack.size()) + "=> " + executionFlow + " #"
                                        + getCurrentStackUuid() + ", depth=" + stack.size());
 
@@ -105,7 +105,7 @@ public class ExecutionContext {
 
        public static void leaveFlow(ExecutionFlow executionFlow) {
                Stack<ExecutionFlowRuntime> stack = executionContext.get().stack;
-               if (log.isTraceEnabled())
+               if (log.isDebugEnabled())
                        log.debug(depthSpaces(stack.size()) + "<= " + executionFlow + " #"
                                        + getCurrentStackUuid() + ", depth=" + stack.size());
 
diff --git a/runtime/org.argeo.slc.execution/src/main/java/org/argeo/slc/execution/ExecutionModule.java b/runtime/org.argeo.slc.execution/src/main/java/org/argeo/slc/execution/ExecutionModule.java
new file mode 100644 (file)
index 0000000..9be1494
--- /dev/null
@@ -0,0 +1,13 @@
+package org.argeo.slc.execution;
+
+import org.argeo.slc.process.SlcExecution;
+
+public interface ExecutionModule {
+       public String getName();
+
+       public String getVersion();
+
+       public ExecutionModuleDescriptor getDescriptor();
+
+       public void execute(SlcExecution slcExecution);
+}
index 548eb112cd21e330c71977036b0ffb0898867c8a..e87a14e4ac3198ffd342d599713475fec2716252 100644 (file)
@@ -4,6 +4,8 @@ import java.util.ArrayList;
 import java.util.List;
 
 public class ExecutionModuleDescriptor {
+       private String name;
+       private String version;
        private List<ExecutionSpec> executionSpecs = new ArrayList<ExecutionSpec>();
        private List<ExecutionFlowDescriptor> executionFlows = new ArrayList<ExecutionFlowDescriptor>();
 
@@ -23,4 +25,20 @@ public class ExecutionModuleDescriptor {
                this.executionFlows = executionFlows;
        }
 
+       public String getName() {
+               return name;
+       }
+
+       public void setName(String name) {
+               this.name = name;
+       }
+
+       public String getVersion() {
+               return version;
+       }
+
+       public void setVersion(String version) {
+               this.version = version;
+       }
+
 }
diff --git a/runtime/org.argeo.slc.execution/src/main/java/org/argeo/slc/execution/ExecutionRegister.java b/runtime/org.argeo.slc.execution/src/main/java/org/argeo/slc/execution/ExecutionRegister.java
deleted file mode 100644 (file)
index 957adde..0000000
+++ /dev/null
@@ -1,69 +0,0 @@
-package org.argeo.slc.execution;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.springframework.beans.BeansException;
-import org.springframework.beans.factory.InitializingBean;
-import org.springframework.beans.factory.generic.GenericBeanFactoryAccessor;
-import org.springframework.context.ApplicationContext;
-import org.springframework.context.ApplicationContextAware;
-import org.springframework.util.Assert;
-
-public class ExecutionRegister implements InitializingBean,
-               ApplicationContextAware {
-       private final static Log log = LogFactory.getLog(ExecutionRegister.class);
-
-       private ApplicationContext applicationContext;
-
-       public ExecutionModuleDescriptor getDescriptor() {
-               ExecutionModuleDescriptor md = new ExecutionModuleDescriptor();
-
-               GenericBeanFactoryAccessor accessor = new GenericBeanFactoryAccessor(
-                               applicationContext);
-               Map<String, ExecutionFlow> executionFlows = accessor
-                               .getBeansOfType(ExecutionFlow.class);
-
-               for (String name : executionFlows.keySet()) {
-                       ExecutionFlow executionFlow = executionFlows.get(name);
-
-                       Assert.notNull(executionFlow.getName());
-                       Assert.state(name.equals(executionFlow.getName()));
-
-                       ExecutionSpec executionSpec = executionFlow.getExecutionSpec();
-                       Assert.notNull(executionSpec);
-                       Assert.notNull(executionSpec.getName());
-
-                       Map<String, Object> values = new HashMap<String, Object>();
-                       for (String key : executionSpec.getAttributes().keySet()) {
-                               ExecutionSpecAttribute attribute = executionSpec
-                                               .getAttributes().get(key);
-                               if (attribute instanceof SimpleExecutionSpec
-                                               && attribute.getIsParameter()) {
-                                       values.put(key, executionFlow.getParameter(key));
-                               }
-                       }
-
-                       ExecutionFlowDescriptor efd = new ExecutionFlowDescriptor(name,
-                                       values, executionSpec);
-
-                       if (!md.getExecutionSpecs().contains(executionSpec))
-                               md.getExecutionSpecs().add(executionSpec);
-                       md.getExecutionFlows().add(efd);
-               }
-
-               return md;
-       }
-
-       public void afterPropertiesSet() throws Exception {
-               log.debug("Execution Module Descriptor:\n" + getDescriptor());
-       }
-
-       public void setApplicationContext(ApplicationContext applicationContext)
-                       throws BeansException {
-               this.applicationContext = applicationContext;
-       }
-
-}
diff --git a/runtime/org.argeo.slc.execution/src/main/java/org/argeo/slc/execution/ModulesManager.java b/runtime/org.argeo.slc.execution/src/main/java/org/argeo/slc/execution/ModulesManager.java
new file mode 100644 (file)
index 0000000..4dd2623
--- /dev/null
@@ -0,0 +1,31 @@
+package org.argeo.slc.execution;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.springframework.util.Assert;
+
+public class ModulesManager {
+       private List<ExecutionModule> executionModules = new ArrayList<ExecutionModule>();
+
+       public ExecutionModuleDescriptor getExecutionModuleDescriptor(
+                       String moduleName, String version) {
+               ExecutionModule module = null;
+               for (ExecutionModule moduleT : executionModules) {
+                       if(moduleT.getName().equals(moduleName)){
+                               // TODO: check version
+                               module = moduleT;
+                               break;
+                       }
+               }
+               
+               Assert.notNull(module);
+               
+               return module.getDescriptor();
+       }
+
+       public void setExecutionModules(List<ExecutionModule> executionModules) {
+               this.executionModules = executionModules;
+       }
+
+}
diff --git a/runtime/org.argeo.slc.execution/src/main/java/org/argeo/slc/execution/OsgiExecutionModule.java b/runtime/org.argeo.slc.execution/src/main/java/org/argeo/slc/execution/OsgiExecutionModule.java
new file mode 100644 (file)
index 0000000..570635e
--- /dev/null
@@ -0,0 +1,23 @@
+package org.argeo.slc.execution;
+
+import org.osgi.framework.BundleContext;
+import org.springframework.osgi.context.BundleContextAware;
+
+public class OsgiExecutionModule extends AbstractSpringExecutionModule implements
+               BundleContextAware {
+       private BundleContext bundleContext;
+
+       public String getName() {
+               return bundleContext.getBundle().getSymbolicName();
+       }
+
+       public String getVersion() {
+               return bundleContext.getBundle().getHeaders().get("Bundle-Version")
+                               .toString();
+       }
+
+       public void setBundleContext(BundleContext bundleContext) {
+               this.bundleContext = bundleContext;
+       }
+
+}
index 9b0ea6d3ca55637a75073610961c647ad892ab2c..e9ce3ef17a699847ced5483fdbd265d916318826 100644 (file)
@@ -1,7 +1,9 @@
 package org.argeo.slc.execution;
 
-public class RefSpecAttribute  extends AbstractSpecAttribute {
+public class RefSpecAttribute extends AbstractSpecAttribute {
        private Class targetClass;
+       /** Read only. */
+       private String targetClassName;
        private Object value = null;
 
        public Object getValue() {
@@ -18,6 +20,11 @@ public class RefSpecAttribute  extends AbstractSpecAttribute {
 
        public void setTargetClass(Class targetClass) {
                this.targetClass = targetClass;
+               this.targetClassName = targetClass.getName();
+       }
+
+       public String getTargetClassName() {
+               return targetClassName;
        }
 
 }
index 53114291f32e952ca82fc8be4b90e516c2f2488a..79f900d023e9b3ef4a070ce8407c2e2f0ae0df6f 100644 (file)
@@ -55,6 +55,7 @@ public class SimpleExecutionFlow implements ExecutionFlow, InitializingBean,
                                Object obj = parameters.get(key);
                                if (executionSpecAttr instanceof RefSpecAttribute) {
                                        RefSpecAttribute rsa = (RefSpecAttribute) executionSpecAttr;
+                                       // TODO: make sure this will not cause pb with OSGi
                                        Class targetClass = rsa.getTargetClass();
                                        if (!targetClass.isAssignableFrom(obj.getClass())) {
                                                errors.reject(key
diff --git a/runtime/org.argeo.slc.execution/src/main/resources/META-INF/spring/osgi.xml b/runtime/org.argeo.slc.execution/src/main/resources/META-INF/spring/osgi.xml
new file mode 100644 (file)
index 0000000..ef9d141
--- /dev/null
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>\r
+<beans:beans xmlns="http://www.springframework.org/schema/osgi"\r
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:beans="http://www.springframework.org/schema/beans"\r
+       xsi:schemaLocation="http://www.springframework.org/schema/osgi  \r
+       http://www.springframework.org/schema/osgi/spring-osgi-1.1.xsd\r
+       http://www.springframework.org/schema/beans   \r
+       http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">\r
+\r
+       <service interface="org.eclipse.osgi.framework.console.CommandProvider">\r
+               <beans:bean class="org.argeo.slc.execution.ExecutionCommandProvider">\r
+                       <beans:property name="executionModules" ref="executionModules" />\r
+               </beans:bean>\r
+       </service>\r
+\r
+       <list id="executionModules" interface="org.argeo.slc.execution.ExecutionModule" />\r
+</beans:beans>
\ No newline at end of file
diff --git a/runtime/org.argeo.slc.execution/src/main/resources/org/argeo/slc/execution/spring.xml b/runtime/org.argeo.slc.execution/src/main/resources/org/argeo/slc/execution/spring.xml
new file mode 100644 (file)
index 0000000..81e177f
--- /dev/null
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p"
+       xmlns:aop="http://www.springframework.org/schema/aop"
+       xsi:schemaLocation="
+       http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
+       http://www.springframework.org/schema/lang http://www.springframework.org/schema/lang/spring-lang-2.5.xsd
+       http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd">
+
+       <bean class="org.springframework.beans.factory.config.CustomScopeConfigurer">
+               <property name="scopes">
+                       <map>
+                               <entry key="execution">
+                                       <bean class="org.argeo.slc.execution.ExecutionScope" />
+                               </entry>
+                       </map>
+               </property>
+       </bean>
+
+       <bean
+               class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer" />
+
+       <bean class="org.argeo.slc.execution.ExecutionParameterPostProcessor" />
+       <bean class="org.argeo.slc.execution.InstantiationPostProcessor" />
+       <bean class="org.argeo.slc.execution.Executor" />
+       <bean class="org.argeo.slc.execution.ExecutionAspect"/>
+
+       <aop:aspectj-autoproxy />
+
+</beans>
\ No newline at end of file
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
new file mode 100644 (file)
index 0000000..01ca721
--- /dev/null
@@ -0,0 +1,125 @@
+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<String, List<String>> methodArguments = new HashMap<String, List<String>>();
+
+       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<String> parameterNames = methodArguments.get(methodName);
+                               List<Object> arguments = new ArrayList<Object>();
+                               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<String, List<String>> methodArguments) {
+               this.methodArguments = methodArguments;
+       }
+
+       public static void setMethodNameParameter(String methodNameParameter) {
+               ServiceMessageListenerAdapter.methodNameParameter = methodNameParameter;
+       }
+       
+       
+}
index 14dde19c43625a50015f1e3f4739f323ebdbc0ae..f2a9848b2773f073a2baeedb1af543ddc316f4f8 100644 (file)
@@ -2,7 +2,7 @@
 <beans xmlns="http://www.springframework.org/schema/beans"
        xmlns:amq="http://activemq.apache.org/schema/core" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
-       http://activemq.apache.org/schema/core http://activemq.apache.org/schema/core/activemq-core.xsd"
+       http://activemq.apache.org/schema/core http://activemq.apache.org/schema/core/activemq-core-5.2.0.xsd"
        default-lazy-init="false">
 
        <import resource="classpath:org/argeo/slc/castor/spring.xml" />
        <amq:topic id="slcJms.destination.agent.newExecution"
                physicalName="agent.newExecution" />
 
+       <amq:queue id="slcJms.destination.modulesManager.request"
+               physicalName="modulesManager.request" />
+       <amq:topic id="slcJms.destination.modulesManager.response"
+               physicalName="modulesManager.response" />
+
        <!-- Templates -->
        <bean id="slcTemplate.jms.listenerContainer"
                class="org.springframework.jms.listener.DefaultMessageListenerContainer"
index 3647c2493f0bb8d2277135134e6c7b19d215dca8..d8091bacba8ac04512ee0c2ca00864b1cc973658 100644 (file)
                                                <Export-Package>
                                                        org.argeo.slc.*
                                                </Export-Package>
-                                               <Import-Package>*,javax.xml.parsers;resolution:=optional,
+                                               <Import-Package>org.argeo.slc.*;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.execution;resolution:=optional,
+                                               org.argeo.slc.msg;resolution:=optional,
+                                               org.argeo.slc.msg.process;resolution:=optional,
+                                               org.argeo.slc.msg.test.tree;resolution:=optional
+                                               </Import-Package>
+                                               <Fragment-Host>com.springsource.org.castor</Fragment-Host>
+                                               <!-- 
+                                               <Import-Package>*,org.argeo.slc.msg,
+                                               org.argeo.slc.msg.process,
+                                               org.argeo.slc.msg.test.tree,
+                                               javax.xml.parsers;resolution:=optional,
                                                javax.xml.transform;resolution:=optional,
                                                javax.xml.transform.dom;resolution:=optional,
                                                javax.xml.transform.stream;resolution:=optional,
                                                org.w3c.dom;resolution:=optional,
                                                org.xml.sax;resolution:=optional
                                                </Import-Package>
+                                                -->
                                        </instructions>
                                </configuration>
                        </plugin>
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
new file mode 100644 (file)
index 0000000..7e6499f
--- /dev/null
@@ -0,0 +1,92 @@
+<?xml version="1.0"?>\r
+\r
+<!DOCTYPE mapping PUBLIC "-//EXOLAB/Castor Mapping DTD Version 1.0//EN" "http://castor.org/mapping.dtd">\r
+\r
+<mapping>\r
+       <description>Execution objects XML mapping</description>\r
+\r
+       <class name="org.argeo.slc.execution.ExecutionModuleDescriptor">\r
+               <map-to ns-uri="http://argeo.org/projects/slc/schemas"\r
+                       ns-prefix="slc" />\r
+               <field name="name" />\r
+               <field name="version" />\r
+               <field name="executionFlows" collection="arraylist"\r
+                       type="org.argeo.slc.execution.ExecutionFlowDescriptor">\r
+                       <bind-xml auto-naming="deriveByClass" location="executionFlows" />\r
+               </field>\r
+               <field name="executionSpecs" collection="arraylist"\r
+                       type="org.argeo.slc.execution.ExecutionSpec">\r
+                       <bind-xml auto-naming="deriveByClass" location="executionSpecs" />\r
+               </field>\r
+       </class>\r
+\r
+       <class name="org.argeo.slc.execution.ExecutionFlowDescriptor">\r
+               <map-to ns-uri="http://argeo.org/projects/slc/schemas"\r
+                       ns-prefix="slc" />\r
+               <field name="name" identity="true">\r
+                       <bind-xml name="name" node="attribute" />\r
+               </field>\r
+               <field name="executionSpec">\r
+                       <bind-xml name="executionSpec" node="attribute" reference="true" />\r
+               </field>\r
+               <field name="values" collection="map">\r
+                       <bind-xml name="value" location="values">\r
+                               <class name="org.exolab.castor.mapping.MapItem">\r
+                                       <map-to ns-uri="http://argeo.org/projects/slc/schemas"\r
+                                               ns-prefix="slc" />\r
+                                       <field name="key" type="string">\r
+                                               <bind-xml name="key" node="attribute" />\r
+                                       </field>\r
+                                       <field name="value" type="string">\r
+                                               <bind-xml node="text" />\r
+                                       </field>\r
+                               </class>\r
+                       </bind-xml>\r
+               </field>\r
+       </class>\r
+\r
+       <class name="org.argeo.slc.execution.SimpleExecutionSpec">\r
+               <map-to ns-uri="http://argeo.org/projects/slc/schemas"\r
+                       ns-prefix="slc" />\r
+               <field name="name" identity="true">\r
+                       <bind-xml name="name" node="attribute" />\r
+               </field>\r
+               <field name="attributes" collection="map">\r
+                       <bind-xml name="value" location="values">\r
+                               <class name="org.exolab.castor.mapping.MapItem">\r
+                                       <map-to ns-uri="http://argeo.org/projects/slc/schemas"\r
+                                               ns-prefix="slc" />\r
+                                       <field name="key" type="string">\r
+                                               <bind-xml name="key" node="attribute" />\r
+                                       </field>\r
+                                       <field name="value">\r
+                                               <bind-xml auto-naming="deriveByClass" />\r
+                                       </field>\r
+                               </class>\r
+                       </bind-xml>\r
+               </field>\r
+       </class>\r
+\r
+       <class name="org.argeo.slc.execution.AbstractSpecAttribute">\r
+               <map-to ns-uri="http://argeo.org/projects/slc/schemas"\r
+                       ns-prefix="slc" />\r
+               <field name="isParameter">\r
+                       <bind-xml name="isParameter" node="attribute" />\r
+               </field>\r
+       </class>\r
+\r
+       <class name="org.argeo.slc.execution.SimpleSpecAttribute"\r
+               extends="org.argeo.slc.execution.AbstractSpecAttribute">\r
+               <map-to ns-uri="http://argeo.org/projects/slc/schemas"\r
+                       ns-prefix="slc" />\r
+               <field name="value" />\r
+       </class>\r
+\r
+       <class name="org.argeo.slc.execution.RefSpecAttribute" extends="org.argeo.slc.execution.AbstractSpecAttribute">\r
+               <map-to ns-uri="http://argeo.org/projects/slc/schemas"\r
+                       ns-prefix="slc" />\r
+               <field name="targetClassName">\r
+                       <bind-xml name="targetClassName" node="attribute" />\r
+               </field>\r
+       </class>\r
+</mapping>
\ No newline at end of file
index 46f0ad212025144b04501af96a69095812880d6d..73a6b3f41ca052a89a9cafa0ae1ac6a4b59a2637 100644 (file)
@@ -22,6 +22,9 @@
                                <value>
                                        classpath:org/argeo/slc/castor/test.xml
                                </value>
+                               <value>
+                                       classpath:org/argeo/slc/castor/execution.xml
+                               </value>
                        </list>
                </property>
                <property name="whitespacePreserve" value="true" />