Unique launch
authorMathieu Baudier <mbaudier@argeo.org>
Fri, 9 Dec 2011 23:56:00 +0000 (23:56 +0000)
committerMathieu Baudier <mbaudier@argeo.org>
Fri, 9 Dec 2011 23:56:00 +0000 (23:56 +0000)
git-svn-id: https://svn.argeo.org/slc/trunk@4936 4cfe0d0a-d680-48aa-b62c-e0a02a3f76cc

18 files changed:
demo/site/org.argeo.slc.demo.minimal/META-INF/spring/helloworld.xml
dep/org.argeo.slc.dep.rcp/org.argeo.slc.dep.rcp-maven.target
dist/slc/src/main/rpm/etc/slc-cl/log4j.properties
dist/slc/src/main/rpm/usr/bin/slc
modules/agent/org.argeo.slc.agent/META-INF/spring/agent.xml
runtime/org.argeo.slc.core/src/main/java/org/argeo/slc/core/execution/DefaultExecutionFlowDescriptorConverter.java
runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/execution/ExecutionModuleDescriptor.java
runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/execution/ExecutionModulesManager.java
runtime/org.argeo.slc.support.equinox/.classpath
runtime/org.argeo.slc.support.equinox/META-INF/spring/manager.xml [new file with mode: 0644]
runtime/org.argeo.slc.support.equinox/META-INF/spring/osgi.xml [new file with mode: 0644]
runtime/org.argeo.slc.support.equinox/equinox.properties [new file with mode: 0644]
runtime/org.argeo.slc.support.equinox/src/main/java/org/argeo/slc/equinox/ExecutionCommandProvider.java
runtime/org.argeo.slc.support.equinox/src/main/resources/META-INF/spring/manager.xml [deleted file]
runtime/org.argeo.slc.support.equinox/src/main/resources/META-INF/spring/osgi.xml [deleted file]
runtime/org.argeo.slc.support.equinox/src/main/resources/equinox.properties [deleted file]
runtime/org.argeo.slc.support.osgi/src/main/java/org/argeo/slc/osgi/BundlesManager.java
runtime/org.argeo.slc.support.osgi/src/main/java/org/argeo/slc/osgi/OsgiExecutionModulesManager.java

index 7c2daa5a51278d7d952b22d2d15192302be52b51..3af2dcd0165427f25ed7bde24002ea88d9a28deb 100644 (file)
@@ -6,7 +6,7 @@
        http://www.argeo.org/schema/slc-flow http://www.argeo.org/schema/slc-flow-0.12.xsd">\r
 \r
        <!-- Hello world -->\r
-       <flow:flow name="hello/HelloWorld">\r
+       <flow:flow name="hello">\r
                <description>Print Hello World!</description>\r
                <bean p:message="Hello World!" class="org.argeo.slc.core.execution.tasks.Echo" />\r
        </flow:flow>\r
index e4d016d4825e15c0a0ea526284551ed92a811cf7..6ea422e94aa5e530cdc5f18d276bfb663303439d 100644 (file)
@@ -6,9 +6,11 @@
 <location path="${system_property:user.home}/.m2/repository/org/argeo/slc/eclipse/org.argeo.slc.client.ui/0.13.1-SNAPSHOT" type="Directory"/>
 <location path="${system_property:user.home}/.m2/repository/org/argeo/slc/eclipse/org.argeo.slc.client.ui.source/0.13.1-SNAPSHOT" type="Directory"/>
 <location path="${system_property:user.home}/.m2/repository/org/argeo/slc/runtime/org.argeo.slc.support.jcr/0.13.1-SNAPSHOT" type="Directory"/>
+<location path="${system_property:user.home}/.m2/repository/org/argeo/slc/runtime/org.argeo.slc.support.jcr.source/0.13.1-SNAPSHOT" type="Directory"/>
 <location path="${system_property:user.home}/.m2/repository/org/argeo/commons/server/org.argeo.server.jcr/0.3.4-SNAPSHOT" type="Directory"/>
 <location path="${system_property:user.home}/.m2/repository/org/argeo/commons/server/org.argeo.server.jcr.source/0.3.4-SNAPSHOT" type="Directory"/>
 <location path="${system_property:user.home}/.m2/repository/org/argeo/slc/runtime/org.argeo.slc.server/0.13.1-SNAPSHOT" type="Directory"/>
+<location path="${system_property:user.home}/.m2/repository/org/argeo/slc/runtime/org.argeo.slc.server.source/0.13.1-SNAPSHOT" type="Directory"/>
 <location path="${system_property:user.home}/.m2/repository/org/argeo/commons/security/org.argeo.security.core/0.3.4-SNAPSHOT" type="Directory"/>
 <location path="${system_property:user.home}/.m2/repository/org/argeo/commons/security/org.argeo.security.core.source/0.3.4-SNAPSHOT" type="Directory"/>
 <location path="${system_property:user.home}/.m2/repository/org/springframework/org.springframework.web.servlet/2.5.6.SEC01" type="Directory"/>
@@ -34,7 +36,9 @@
 <location path="${system_property:user.home}/.m2/repository/org/argeo/slc/eclipse/org.argeo.slc.client.ui.dist/0.13.1-SNAPSHOT" type="Directory"/>
 <location path="${system_property:user.home}/.m2/repository/org/argeo/slc/eclipse/org.argeo.slc.client.ui.dist.source/0.13.1-SNAPSHOT" type="Directory"/>
 <location path="${system_property:user.home}/.m2/repository/org/argeo/slc/runtime/org.argeo.slc.repo/0.13.1-SNAPSHOT" type="Directory"/>
+<location path="${system_property:user.home}/.m2/repository/org/argeo/slc/runtime/org.argeo.slc.repo.source/0.13.1-SNAPSHOT" type="Directory"/>
 <location path="${system_property:user.home}/.m2/repository/org/argeo/slc/runtime/org.argeo.slc.support.aether/0.13.1-SNAPSHOT" type="Directory"/>
+<location path="${system_property:user.home}/.m2/repository/org/argeo/slc/runtime/org.argeo.slc.support.aether.source/0.13.1-SNAPSHOT" type="Directory"/>
 <location path="${system_property:user.home}/.m2/repository/org/argeo/dep/osgi/org.argeo.dep.osgi.aether/1.11.0.0001" type="Directory"/>
 <location path="${system_property:user.home}/.m2/repository/org/argeo/dep/osgi/org.argeo.dep.osgi.aether.source/1.11.0.0001" type="Directory"/>
 <location path="${system_property:user.home}/.m2/repository/org/argeo/slc/modules/org.argeo.slc.server.repo/0.13.1-SNAPSHOT" type="Directory"/>
@@ -42,6 +46,7 @@
 <location path="${system_property:user.home}/.m2/repository/org/argeo/dep/osgi/org.argeo.dep.osgi.bnd.source/0.0.384.0002" type="Directory"/>
 <location path="${system_property:user.home}/.m2/repository/org/argeo/slc/dep/org.argeo.slc.dep.backend/0.13.1-SNAPSHOT" type="Directory"/>
 <location path="${system_property:user.home}/.m2/repository/org/argeo/slc/runtime/org.argeo.slc.support.ant/0.13.1-SNAPSHOT" type="Directory"/>
+<location path="${system_property:user.home}/.m2/repository/org/argeo/slc/runtime/org.argeo.slc.support.ant.source/0.13.1-SNAPSHOT" type="Directory"/>
 <location path="${system_property:user.home}/.m2/repository/org/apache/ant/com.springsource.org.apache.tools.ant/1.7.1" type="Directory"/>
 <location path="${system_property:user.home}/.m2/repository/org/apache/ant/com.springsource.org.apache.tools.ant.source/1.7.1" type="Directory"/>
 <location path="${system_property:user.home}/.m2/repository/org/apache/ant/com.springsource.org.apache.tools.ant.launch/1.7.1" type="Directory"/>
@@ -53,6 +58,7 @@
 <location path="${system_property:user.home}/.m2/repository/org/apache/bsf/com.springsource.org.apache.bsf/2.4.0" type="Directory"/>
 <location path="${system_property:user.home}/.m2/repository/org/apache/bsf/com.springsource.org.apache.bsf.source/2.4.0" type="Directory"/>
 <location path="${system_property:user.home}/.m2/repository/org/argeo/slc/runtime/org.argeo.slc.support.activemq/0.13.1-SNAPSHOT" type="Directory"/>
+<location path="${system_property:user.home}/.m2/repository/org/argeo/slc/runtime/org.argeo.slc.support.activemq.source/0.13.1-SNAPSHOT" type="Directory"/>
 <location path="${system_property:user.home}/.m2/repository/org/springframework/org.springframework.jms/2.5.6.SEC01" type="Directory"/>
 <location path="${system_property:user.home}/.m2/repository/org/springframework/org.springframework.jms.source/2.5.6.SEC01" type="Directory"/>
 <location path="${system_property:user.home}/.m2/repository/org/springframework/ws/org.springframework.oxm/1.5.9.A" type="Directory"/>
@@ -79,7 +85,9 @@
 <location path="${system_property:user.home}/.m2/repository/javax/ejb/com.springsource.javax.ejb.source/3.0.0" type="Directory"/>
 <location path="${system_property:user.home}/.m2/repository/javax/xml/rpc/com.springsource.javax.xml.rpc/1.1.0" type="Directory"/>
 <location path="${system_property:user.home}/.m2/repository/org/argeo/slc/runtime/org.argeo.slc.support.equinox/0.13.1-SNAPSHOT" type="Directory"/>
+<location path="${system_property:user.home}/.m2/repository/org/argeo/slc/runtime/org.argeo.slc.support.equinox.source/0.13.1-SNAPSHOT" type="Directory"/>
 <location path="${system_property:user.home}/.m2/repository/org/argeo/slc/runtime/org.argeo.slc.support.osgi/0.13.1-SNAPSHOT" type="Directory"/>
+<location path="${system_property:user.home}/.m2/repository/org/argeo/slc/runtime/org.argeo.slc.support.osgi.source/0.13.1-SNAPSHOT" type="Directory"/>
 <location path="${system_property:user.home}/.m2/repository/org/objectweb/asm/com.springsource.org.objectweb.asm.attrs/2.2.3" type="Directory"/>
 <location path="${system_property:user.home}/.m2/repository/org/objectweb/asm/com.springsource.org.objectweb.asm.attrs.source/2.2.3" type="Directory"/>
 <location path="${system_property:user.home}/.m2/repository/org/objectweb/asm/com.springsource.org.objectweb.asm/2.2.3" type="Directory"/>
 <location path="${system_property:user.home}/.m2/repository/org/argeo/commons/security/org.argeo.security.ui.admin/0.3.4-SNAPSHOT" type="Directory"/>
 <location path="${system_property:user.home}/.m2/repository/org/argeo/commons/security/org.argeo.security.ui.admin.source/0.3.4-SNAPSHOT" type="Directory"/>
 <location path="${system_property:user.home}/.m2/repository/org/argeo/slc/runtime/org.argeo.slc.unit/0.13.1-SNAPSHOT" type="Directory"/>
+<location path="${system_property:user.home}/.m2/repository/org/argeo/slc/runtime/org.argeo.slc.unit.source/0.13.1-SNAPSHOT" type="Directory"/>
 <location path="${system_property:user.home}/.m2/repository/org/argeo/slc/runtime/org.argeo.slc.core/0.13.1-SNAPSHOT" type="Directory"/>
+<location path="${system_property:user.home}/.m2/repository/org/argeo/slc/runtime/org.argeo.slc.core.source/0.13.1-SNAPSHOT" type="Directory"/>
 <location path="${system_property:user.home}/.m2/repository/org/argeo/slc/runtime/org.argeo.slc.specs/0.13.1-SNAPSHOT" type="Directory"/>
+<location path="${system_property:user.home}/.m2/repository/org/argeo/slc/runtime/org.argeo.slc.specs.source/0.13.1-SNAPSHOT" type="Directory"/>
 <location path="${system_property:user.home}/.m2/repository/org/aspectj/com.springsource.org.aspectj.runtime/1.6.3.RELEASE" type="Directory"/>
 <location path="${system_property:user.home}/.m2/repository/org/aspectj/com.springsource.org.aspectj.runtime.source/1.6.3.RELEASE" type="Directory"/>
 <location path="${system_property:user.home}/.m2/repository/org/aspectj/com.springsource.org.aspectj.weaver/1.6.3.RELEASE" type="Directory"/>
 <location path="${system_property:user.home}/.m2/repository/org/apache/commons/com.springsource.org.apache.commons.codec/1.4.0" type="Directory"/>
 <location path="${system_property:user.home}/.m2/repository/org/apache/commons/com.springsource.org.apache.commons.codec.source/1.4.0" type="Directory"/>
 <location path="${system_property:user.home}/.m2/repository/org/argeo/slc/runtime/org.argeo.slc.support.simple/0.13.1-SNAPSHOT" type="Directory"/>
+<location path="${system_property:user.home}/.m2/repository/org/argeo/slc/runtime/org.argeo.slc.support.simple.source/0.13.1-SNAPSHOT" type="Directory"/>
 <location path="${system_property:user.home}/.m2/repository/com/jcraft/jsch/com.springsource.com.jcraft.jsch/0.1.41" type="Directory"/>
 <location path="${system_property:user.home}/.m2/repository/com/jcraft/jsch/com.springsource.com.jcraft.jsch.source/0.1.41" type="Directory"/>
 <location path="${system_property:user.home}/.m2/repository/com/opensymphony/quartz/com.springsource.org.quartz/1.6.2" type="Directory"/>
 <plugin id="org.argeo.slc.client.ui"/>
 <plugin id="org.argeo.slc.client.ui.source"/>
 <plugin id="org.argeo.slc.support.jcr"/>
+<plugin id="org.argeo.slc.support.jcr.source"/>
 <plugin id="org.argeo.server.jcr"/>
 <plugin id="org.argeo.server.jcr.source"/>
 <plugin id="org.argeo.slc.server"/>
+<plugin id="org.argeo.slc.server.source"/>
 <plugin id="org.argeo.security.core"/>
 <plugin id="org.argeo.security.core.source"/>
 <plugin id="org.springframework.web.servlet"/>
 <plugin id="org.argeo.slc.client.ui.dist"/>
 <plugin id="org.argeo.slc.client.ui.dist.source"/>
 <plugin id="org.argeo.slc.repo"/>
+<plugin id="org.argeo.slc.repo.source"/>
 <plugin id="org.argeo.slc.support.aether"/>
+<plugin id="org.argeo.slc.support.aether.source"/>
 <plugin id="org.argeo.dep.osgi.aether"/>
 <plugin id="org.argeo.dep.osgi.aether.source"/>
 <plugin id="org.argeo.slc.server.repo"/>
 <plugin id="biz.aQute.bnd.source"/>
 <plugin id="org.argeo.slc.dep.backend"/>
 <plugin id="org.argeo.slc.support.ant"/>
+<plugin id="org.argeo.slc.support.ant.source"/>
 <plugin id="com.springsource.org.apache.tools.ant"/>
 <plugin id="com.springsource.org.apache.tools.ant.source"/>
 <plugin id="com.springsource.org.apache.tools.ant.launch"/>
 <plugin id="com.springsource.org.apache.bsf"/>
 <plugin id="com.springsource.org.apache.bsf.source"/>
 <plugin id="org.argeo.slc.support.activemq"/>
+<plugin id="org.argeo.slc.support.activemq.source"/>
 <plugin id="org.springframework.jms"/>
 <plugin id="org.springframework.jms.source"/>
 <plugin id="org.springframework.oxm"/>
 <plugin id="com.springsource.javax.ejb.source"/>
 <plugin id="com.springsource.javax.xml.rpc"/>
 <plugin id="org.argeo.slc.support.equinox"/>
+<plugin id="org.argeo.slc.support.equinox.source"/>
 <plugin id="org.argeo.slc.support.osgi"/>
+<plugin id="org.argeo.slc.support.osgi.source"/>
 <plugin id="com.springsource.org.objectweb.asm.attrs"/>
 <plugin id="com.springsource.org.objectweb.asm.attrs.source"/>
 <plugin id="com.springsource.org.objectweb.asm"/>
 <plugin id="org.argeo.security.ui.admin"/>
 <plugin id="org.argeo.security.ui.admin.source"/>
 <plugin id="org.argeo.slc.unit"/>
+<plugin id="org.argeo.slc.unit.source"/>
 <plugin id="org.argeo.slc.core"/>
+<plugin id="org.argeo.slc.core.source"/>
 <plugin id="org.argeo.slc.specs"/>
+<plugin id="org.argeo.slc.specs.source"/>
 <plugin id="com.springsource.org.aspectj.runtime"/>
 <plugin id="com.springsource.org.aspectj.runtime.source"/>
 <plugin id="com.springsource.org.aspectj.weaver"/>
 <plugin id="com.springsource.org.apache.commons.codec"/>
 <plugin id="com.springsource.org.apache.commons.codec.source"/>
 <plugin id="org.argeo.slc.support.simple"/>
+<plugin id="org.argeo.slc.support.simple.source"/>
 <plugin id="com.springsource.com.jcraft.jsch"/>
 <plugin id="com.springsource.com.jcraft.jsch.source"/>
 <plugin id="com.springsource.org.quartz"/>
index 7edc3f2d4ad73cca6436cb950cb214fa647b2e6a..a9d97ce917c21b85c45007b9314debe232967444 100644 (file)
@@ -1,5 +1,5 @@
-log4j.rootLogger=WARN, file
-#log4j.rootLogger=WARN, console
+#log4j.rootLogger=WARN, file
+log4j.rootLogger=WARN, console
 
 ## Levels
 log4j.logger.org.argeo=INFO
index edf98110da2762d225717754bd7f8e2d2a06e3a8..3efd3bc67250a041e891f952cf2678f20820c900 100644 (file)
@@ -20,5 +20,6 @@ java -jar $OSGI_FRAMEWORK \
  -configuration $CONF_DIR \
  -data $DATA_DIR \
  -Dslc.launch.module=$MODULE \
- -Dslc.launch.execution=$FLOW \
+ -Dslc.launch.flow=$FLOW \
+ -console \
  -clean
index c91f98b20d97a13855be653913a6bc29d2a0f320..2cb735787c0af484884604762a705135469d1155 100644 (file)
@@ -5,7 +5,8 @@
        http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">\r
 \r
        <!-- Manager -->\r
-       <bean id="modulesManager" class="org.argeo.slc.osgi.OsgiExecutionModulesManager">\r
+       <bean id="modulesManager" class="org.argeo.slc.osgi.OsgiExecutionModulesManager"\r
+               init-method="init" destroy-method="destroy">\r
                <property name="slcExecutionNotifiers" ref="slcExecutionListeners" />\r
                <property name="bundlesManager" ref="bundlesManager" />\r
        </bean>\r
index 2fb897d3a988b6eec9a5512b0da93cc688e76650..9b3764b8af08550affccd9b777277136d0957a31 100644 (file)
@@ -35,6 +35,7 @@ import org.argeo.slc.execution.ExecutionSpec;
 import org.argeo.slc.execution.ExecutionSpecAttribute;
 import org.springframework.aop.scope.ScopedObject;
 import org.springframework.beans.BeansException;
+import org.springframework.beans.factory.BeanFactory;
 import org.springframework.beans.factory.config.BeanDefinition;
 import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
 import org.springframework.context.ApplicationContext;
@@ -217,8 +218,11 @@ public class DefaultExecutionFlowDescriptorConverter implements
                        efd.setPath("");
 
                // Takes description from spring
-               BeanDefinition bd = getBeanFactory().getBeanDefinition(name);
-               efd.setDescription(bd.getDescription());
+               BeanFactory bf = getBeanFactory();
+               if (bf != null) {
+                       BeanDefinition bd = getBeanFactory().getBeanDefinition(name);
+                       efd.setDescription(bd.getDescription());
+               }
                return efd;
        }
 
@@ -292,7 +296,10 @@ public class DefaultExecutionFlowDescriptorConverter implements
                }
        }
 
+       /** @return can be null */
        private ConfigurableListableBeanFactory getBeanFactory() {
+               if (applicationContext == null)
+                       return null;
                return ((ConfigurableApplicationContext) applicationContext)
                                .getBeanFactory();
        }
index 04f8f2d2690b39bb7697b8397945bc34b1333055..ff841a138dbac3bb94e3868506d2ab70f35bce62 100644 (file)
@@ -21,6 +21,7 @@ import java.util.List;
 
 import org.argeo.slc.deploy.ModuleDescriptor;
 
+/** Describes the information required to launch a flow */
 public class ExecutionModuleDescriptor extends ModuleDescriptor {
        private static final long serialVersionUID = -2394473464513029512L;
        private List<ExecutionSpec> executionSpecs = new ArrayList<ExecutionSpec>();
index 3f927a345e9027d33be59b6d463ccee6863c47ee..616dc502c74886bbe73575d1cd9aa928882675e9 100644 (file)
@@ -27,6 +27,12 @@ public interface ExecutionModulesManager extends ModulesManager {
        /** Used to filter event notified to an execution notifier. */
        public static String SLC_PROCESS_ID = "slc.process.id";
 
+       /** Unique launch module */
+       public static String UNIQUE_LAUNCH_MODULE_PROPERTY = "slc.launch.module";
+
+       /** Unique launch flow */
+       public static String UNIQUE_LAUNCH_FLOW_PROPERTY = "slc.launch.flow";
+
        /** @return a full fledged module descriptor. */
        public ExecutionModuleDescriptor getExecutionModuleDescriptor(
                        String moduleName, String version);
index 762e65304a45132d5d1e220c1529aa25d8e5da91..c9f26bd8e704463f8beb64862d982d3f2b45f2ae 100644 (file)
@@ -1,7 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <classpath>
        <classpathentry kind="src" output="target/classes" path="src/main/java"/>
-       <classpathentry kind="src" output="target/classes" path="src/main/resources"/>
        <classpathentry kind="src" output="target/test-classes" path="src/test/java"/>
        <classpathentry kind="src" output="target/test-classes" path="src/test/resources"/>
        <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
diff --git a/runtime/org.argeo.slc.support.equinox/META-INF/spring/manager.xml b/runtime/org.argeo.slc.support.equinox/META-INF/spring/manager.xml
new file mode 100644 (file)
index 0000000..e5779ac
--- /dev/null
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="UTF-8"?>\r
+<!-- Copyright (C) 2010 Mathieu Baudier <mbaudier@argeo.org> Licensed under \r
+       the Apache License, Version 2.0 (the "License"); you may not use this file \r
+       except in compliance with the License. You may obtain a copy of the License \r
+       at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable \r
+       law or agreed to in writing, software distributed under the License is distributed \r
+       on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either \r
+       express or implied. See the License for the specific language governing permissions \r
+       and limitations under the License. -->\r
+\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\r
+               class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">\r
+               <property name="systemPropertiesModeName" value="SYSTEM_PROPERTIES_MODE_OVERRIDE" />\r
+               <property name="ignoreUnresolvablePlaceholders" value="false" />\r
+               <property name="locations">\r
+                       <value>osgibundle:equinox.properties\r
+                       </value>\r
+               </property>\r
+       </bean>\r
+\r
+       <bean id="commandProvider" class="org.argeo.slc.equinox.ExecutionCommandProvider">\r
+               <property name="modulesManager" ref="modulesManager" />\r
+       </bean>\r
+\r
+       <bean id="bundlesManager" class="org.argeo.slc.osgi.BundlesManager">\r
+               <property name="defaultTimeout" value="${slc.equinox.commandTimeout}" />\r
+               <property name="pollingPeriod" value="${slc.equinox.commandPollingPeriod}" />\r
+       </bean>\r
+\r
+       <bean id="modulesManager" class="org.argeo.slc.osgi.OsgiExecutionModulesManager">\r
+               <property name="bundlesManager" ref="bundlesManager" />\r
+       </bean>\r
+\r
+</beans>
\ No newline at end of file
diff --git a/runtime/org.argeo.slc.support.equinox/META-INF/spring/osgi.xml b/runtime/org.argeo.slc.support.equinox/META-INF/spring/osgi.xml
new file mode 100644 (file)
index 0000000..79a47bc
--- /dev/null
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="UTF-8"?>\r
+<!--\r
+\r
+    Copyright (C) 2010 Mathieu Baudier <mbaudier@argeo.org>\r
+\r
+    Licensed under the Apache License, Version 2.0 (the "License");\r
+    you may not use this file except in compliance with the License.\r
+    You may obtain a copy of the License at\r
+\r
+            http://www.apache.org/licenses/LICENSE-2.0\r
+\r
+    Unless required by applicable law or agreed to in writing, software\r
+    distributed under the License is distributed on an "AS IS" BASIS,\r
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+    See the License for the specific language governing permissions and\r
+    limitations under the License.\r
+\r
+-->\r
+\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
+       <beans:import resource="classpath:org/argeo/slc/osgi/manager.xml" />\r
+\r
+       <service interface="org.eclipse.osgi.framework.console.CommandProvider"\r
+               ref="commandProvider" />\r
+\r
+       <!--\r
+               <service\r
+               interface="org.springframework.osgi.context.event.OsgiBundleApplicationContextListener"\r
+               ref="bundlesManager" />\r
+       -->\r
+</beans:beans>
\ No newline at end of file
diff --git a/runtime/org.argeo.slc.support.equinox/equinox.properties b/runtime/org.argeo.slc.support.equinox/equinox.properties
new file mode 100644 (file)
index 0000000..dae8b2e
--- /dev/null
@@ -0,0 +1,4 @@
+# Timeout for the SLC command in the OSGi console (in ms)
+slc.equinox.commandTimeout=10000
+# Polling period for synchronous OSGi commands (in ms)
+slc.equinox.commandPollingPeriod=100
\ No newline at end of file
index 2a265bb9151789f7c3b7eea30efe888a8557fa05..5d7f7796a6d2855927087f676ce1026067c081f8 100644 (file)
@@ -21,7 +21,6 @@ import org.apache.commons.logging.LogFactory;
 import org.argeo.slc.SlcException;
 import org.argeo.slc.osgi.OsgiExecutionModulesManager;
 import org.argeo.slc.process.RealizedFlow;
-import org.eclipse.core.runtime.adaptor.EclipseStarter;
 import org.eclipse.osgi.framework.console.CommandInterpreter;
 import org.eclipse.osgi.framework.console.CommandProvider;
 
@@ -100,31 +99,4 @@ public class ExecutionCommandProvider implements CommandProvider {
                this.modulesManager = osgiModulesManager;
        }
 
-       public void init() throws Exception {
-               final String module = System.getProperty("slc.launch.module");
-               final String executionName = System.getProperty("slc.launch.execution");
-               if (module != null) {
-                       new Thread() {
-
-                               @Override
-                               public void run() {
-                                       try {
-                                               launch(SLC_NO_REFRESH, module, executionName);
-                                               // in case of failure OSGi runtime stays up and last
-                                               // launch can be used to debug by calling 'slc'
-                                       } catch (Exception e) {
-                                               throw new SlcException("Error when executing "
-                                                               + executionName + " on " + module, e);
-                                       }
-                                       try {
-                                               EclipseStarter.shutdown();
-                                       } catch (Exception e) {
-                                               throw new SlcException("Cannot shutdown equinox.", e);
-                                       }
-                               }
-
-                       }.start();
-               }
-
-       }
 }
diff --git a/runtime/org.argeo.slc.support.equinox/src/main/resources/META-INF/spring/manager.xml b/runtime/org.argeo.slc.support.equinox/src/main/resources/META-INF/spring/manager.xml
deleted file mode 100644 (file)
index aafe929..0000000
+++ /dev/null
@@ -1,52 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>\r
-<!--\r
-\r
-    Copyright (C) 2010 Mathieu Baudier <mbaudier@argeo.org>\r
-\r
-    Licensed under the Apache License, Version 2.0 (the "License");\r
-    you may not use this file except in compliance with the License.\r
-    You may obtain a copy of the License at\r
-\r
-            http://www.apache.org/licenses/LICENSE-2.0\r
-\r
-    Unless required by applicable law or agreed to in writing, software\r
-    distributed under the License is distributed on an "AS IS" BASIS,\r
-    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
-    See the License for the specific language governing permissions and\r
-    limitations under the License.\r
-\r
--->\r
-\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\r
-               class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">\r
-               <property name="systemPropertiesModeName" value="SYSTEM_PROPERTIES_MODE_OVERRIDE" />\r
-               <property name="ignoreUnresolvablePlaceholders" value="false" />\r
-               <property name="locations">\r
-                       <value>osgibundle:equinox.properties\r
-                       </value>\r
-               </property>\r
-       </bean>\r
-\r
-       <bean id="commandProvider" class="org.argeo.slc.equinox.ExecutionCommandProvider"\r
-               init-method="init">\r
-               <property name="modulesManager" ref="modulesManager" />\r
-       </bean>\r
-\r
-       <bean id="bundlesManager" class="org.argeo.slc.osgi.BundlesManager">\r
-               <property name="defaultTimeout" value="${slc.equinox.commandTimeout}" />\r
-               <property name="pollingPeriod" value="${slc.equinox.commandPollingPeriod}" />\r
-       </bean>\r
-\r
-       <bean id="modulesManager" class="org.argeo.slc.osgi.OsgiExecutionModulesManager">\r
-               <property name="bundlesManager" ref="bundlesManager" />\r
-       </bean>\r
-\r
-</beans>
\ No newline at end of file
diff --git a/runtime/org.argeo.slc.support.equinox/src/main/resources/META-INF/spring/osgi.xml b/runtime/org.argeo.slc.support.equinox/src/main/resources/META-INF/spring/osgi.xml
deleted file mode 100644 (file)
index 79a47bc..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>\r
-<!--\r
-\r
-    Copyright (C) 2010 Mathieu Baudier <mbaudier@argeo.org>\r
-\r
-    Licensed under the Apache License, Version 2.0 (the "License");\r
-    you may not use this file except in compliance with the License.\r
-    You may obtain a copy of the License at\r
-\r
-            http://www.apache.org/licenses/LICENSE-2.0\r
-\r
-    Unless required by applicable law or agreed to in writing, software\r
-    distributed under the License is distributed on an "AS IS" BASIS,\r
-    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
-    See the License for the specific language governing permissions and\r
-    limitations under the License.\r
-\r
--->\r
-\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
-       <beans:import resource="classpath:org/argeo/slc/osgi/manager.xml" />\r
-\r
-       <service interface="org.eclipse.osgi.framework.console.CommandProvider"\r
-               ref="commandProvider" />\r
-\r
-       <!--\r
-               <service\r
-               interface="org.springframework.osgi.context.event.OsgiBundleApplicationContextListener"\r
-               ref="bundlesManager" />\r
-       -->\r
-</beans:beans>
\ No newline at end of file
diff --git a/runtime/org.argeo.slc.support.equinox/src/main/resources/equinox.properties b/runtime/org.argeo.slc.support.equinox/src/main/resources/equinox.properties
deleted file mode 100644 (file)
index dae8b2e..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-# Timeout for the SLC command in the OSGi console (in ms)
-slc.equinox.commandTimeout=10000
-# Polling period for synchronous OSGi commands (in ms)
-slc.equinox.commandPollingPeriod=100
\ No newline at end of file
index b56ebc2a638dc48cb5c6beeabe49f4c9f286f79e..3d6510d147bb051e0348bf631b8117f7d60d222a 100644 (file)
@@ -281,11 +281,16 @@ public class BundlesManager implements BundleContextAware, FrameworkListener,
        }
 
        @SuppressWarnings(value = { "unchecked" })
-       public <T> T getSingleService(Class<T> clss, String filter) {
+       public <T> T getSingleService(Class<T> clss, String filter,
+                       Boolean synchronous) {
                Assert.isTrue(OsgiFilterUtils.isValidFilter(filter), "valid filter");
                ServiceReference[] sfs;
                try {
-                       sfs = bundleContext.getServiceReferences(clss.getName(), filter);
+                       if (synchronous)
+                               sfs = getServiceRefSynchronous(clss.getName(), filter);
+                       else
+                               sfs = bundleContext
+                                               .getServiceReferences(clss.getName(), filter);
                } catch (InvalidSyntaxException e) {
                        throw new SlcException("Cannot retrieve service reference for "
                                        + filter, e);
@@ -300,7 +305,7 @@ public class BundlesManager implements BundleContextAware, FrameworkListener,
        }
 
        public <T> T getSingleServiceStrict(Class<T> clss, String filter) {
-               T service = getSingleService(clss, filter);
+               T service = getSingleService(clss, filter, true);
                if (service == null)
                        throw new SlcException("No execution flow found for " + filter);
                else
index 6625ebd3b53fbacbc79c31360328111f1bc1fff8..c5d23589ef03ee09c5a53429359a7e36a412567d 100644 (file)
@@ -67,6 +67,47 @@ public class OsgiExecutionModulesManager extends
 
        private Boolean registerFlowsToJmx = true;
 
+       public void init() throws Exception {
+               final String module = System.getProperty(UNIQUE_LAUNCH_MODULE_PROPERTY);
+               final String flow = System.getProperty(UNIQUE_LAUNCH_FLOW_PROPERTY);
+               if (module != null) {
+                       // launch a flow and stops
+                       new Thread("Unique Flow") {
+                               @Override
+                               public void run() {
+                                       try {
+                                               bundlesManager.startSynchronous(bundlesManager
+                                                               .findRelatedBundle(bundlesManager
+                                                                               .findFromPattern(module)));
+                                               RealizedFlow lastLaunch = findRealizedFlow(module, flow);
+                                               if (lastLaunch == null)
+                                                       throw new SlcException("Cannot find launch for "
+                                                                       + module + " " + flow);
+                                               execute(lastLaunch);
+                                       } catch (Exception e) {
+                                               throw new SlcException(
+                                                               "Error when executing unique flow " + flow
+                                                                               + " on " + module, e);
+                                       } finally {
+                                               try {
+                                                       bundlesManager.getBundleContext().getBundle(0)
+                                                                       .stop();
+                                                       System.exit(0);
+                                               } catch (Exception e) {
+                                                       log.error("Cannot shutdown equinox.", e);
+                                                       System.exit(1);
+                                               }
+                                       }
+                               }
+                       }.start();
+               }
+
+       }
+
+       public void destroy() {
+
+       }
+
        public synchronized ExecutionModuleDescriptor getExecutionModuleDescriptor(
                        String moduleName, String version) {
                ExecutionModuleDescriptor md = new ExecutionModuleDescriptor();
@@ -142,11 +183,10 @@ public class OsgiExecutionModulesManager extends
 
        protected ExecutionFlowDescriptorConverter findExecutionFlowDescriptorConverter(
                        String moduleName, String moduleVersion) {
-
                String filter = "(&(Bundle-SymbolicName=" + moduleName
                                + ")(Bundle-Version=" + moduleVersion + "))";
                return bundlesManager.getSingleService(
-                               ExecutionFlowDescriptorConverter.class, filter);
+                               ExecutionFlowDescriptorConverter.class, filter, false);
        }
 
        /**