]> git.argeo.org Git - gpl/argeo-slc.git/commitdiff
Replace executable by runnable
authorMathieu Baudier <mbaudier@argeo.org>
Tue, 28 Apr 2009 13:24:22 +0000 (13:24 +0000)
committerMathieu Baudier <mbaudier@argeo.org>
Tue, 28 Apr 2009 13:24:22 +0000 (13:24 +0000)
git-svn-id: https://svn.argeo.org/slc/trunk@2390 4cfe0d0a-d680-48aa-b62c-e0a02a3f76cc

22 files changed:
runtime/org.argeo.slc.lib.detached/src/main/java/org/argeo/slc/lib/detached/DetachedAdminTask.java
runtime/org.argeo.slc.osgiboot/src/main/java/org/argeo/slc/osgiboot/Activator.java
runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/deploy/Deployment.java
runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/execution/Executable.java [deleted file]
runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/execution/ExecutionFlow.java
runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/test/ExecutableTestRun.java
runtime/org.argeo.slc.support.ant/src/main/java/org/argeo/slc/ant/deploy/SlcDeployTask.java
runtime/org.argeo.slc.support.ant/src/main/java/org/argeo/slc/ant/test/SlcTestTask.java
runtime/org.argeo.slc.support.simple/src/main/java/org/argeo/slc/core/execution/AbstractSpringExecutionModule.java
runtime/org.argeo.slc.support.simple/src/main/java/org/argeo/slc/core/execution/DefaultExecutionFlow.java
runtime/org.argeo.slc.support.simple/src/main/java/org/argeo/slc/core/execution/ExecutionAspect.java
runtime/org.argeo.slc.support.simple/src/main/java/org/argeo/slc/core/execution/tasks/CloseTestResultTask.java
runtime/org.argeo.slc.support.simple/src/main/java/org/argeo/slc/core/execution/tasks/Echo.java
runtime/org.argeo.slc.support.simple/src/main/java/org/argeo/slc/core/execution/tasks/OverrideContextAware.java
runtime/org.argeo.slc.support.simple/src/main/java/org/argeo/slc/core/execution/tasks/SlcManagerTask.java
runtime/org.argeo.slc.support.simple/src/main/java/org/argeo/slc/core/execution/tasks/SystemCall.java
runtime/org.argeo.slc.support.simple/src/main/java/org/argeo/slc/core/test/SimpleTestRun.java
runtime/org.argeo.slc.support.simple/src/main/java/org/argeo/slc/support/deploy/HttpdApplicationDeployment.java
runtime/org.argeo.slc.support.simple/src/main/java/org/argeo/slc/support/deploy/HttpdServerDeployment.java
runtime/org.argeo.slc.support.simple/src/main/java/org/argeo/slc/support/deploy/db/DbUnitDeployment.java
runtime/org.argeo.slc.support.simple/src/test/java/org/argeo/slc/core/execution/AbstractExecutionFlowTestCase.java
runtime/org.argeo.slc.support.simple/src/test/java/org/argeo/slc/core/execution/BasicExecutionFlowTest.java

index 8fd0bcfd09bf5dedc8f8b1436c746fda24981799..ab6c2ad16b9872e57c3851163b45338284508502 100644 (file)
@@ -1,6 +1,5 @@
 package org.argeo.slc.lib.detached;
 
-import java.util.Map;
 import java.util.Properties;
 import java.util.UUID;
 
@@ -10,16 +9,15 @@ import org.argeo.slc.SlcException;
 import org.argeo.slc.detached.DetachedAnswer;
 import org.argeo.slc.detached.DetachedClient;
 import org.argeo.slc.detached.DetachedRequest;
-import org.argeo.slc.execution.Executable;
 
-public class DetachedAdminTask implements Executable {
+public class DetachedAdminTask implements Runnable {
        private final static Log log = LogFactory.getLog(DetachedAdminTask.class);
 
        private String action;
        private DetachedClient client;
        private Properties properties;
 
-       public void execute() {
+       public void run() {
                // Prepare and send request
                DetachedRequest request = new DetachedRequest(UUID.randomUUID()
                                .toString());
index 78d6024f93798f26309b740d8f2cbf81c6a5f293..6d5a6ed02ee3d4317384a98d9f7c772477f57b92 100644 (file)
@@ -34,7 +34,7 @@ public class Activator implements BundleActivator {
        public void start(BundleContext bundleContext) throws Exception {
                try {
                        info("SLC OSGi bootstrap starting...");
-//                     installUrls(bundleContext, getDevLocationsUrls());
+                       // installUrls(bundleContext, getDevLocationsUrls());
 
                        installUrls(bundleContext, getLocationsUrls());
 
@@ -329,20 +329,18 @@ public class Activator implements BundleActivator {
                }
        }
 
+       /** Key is location */
        protected static Map<String, Bundle> getInstalledBundles(
                        BundleContext bundleContext) {
                Map<String, Bundle> installedBundles = new HashMap<String, Bundle>();
 
                for (Bundle bundle : bundleContext.getBundles()) {
-                       String key = bundle.getSymbolicName();
-                       if (key == null) {
-                               key = bundle.getLocation();
-                       }
-                       installedBundles.put(key, bundle);
+                       installedBundles.put(bundle.getLocation(), bundle);
                }
                return installedBundles;
        }
 
+       /** Key is symbolic name */
        protected static Map<String, Bundle> getBundles(BundleContext bundleContext) {
                Map<String, Bundle> installedBundles = new HashMap<String, Bundle>();
                for (Bundle bundle : bundleContext.getBundles())
index 13d39313666f6fd3df052c6d2552637233efae39..74be42ab0e8a4d44f2e5bf39fabe5ad403099b68 100644 (file)
@@ -1,9 +1,8 @@
 package org.argeo.slc.deploy;\r
 \r
 import org.argeo.slc.build.Distribution;\r
-import org.argeo.slc.execution.Executable;\r
 \r
-public interface Deployment extends Executable{\r
+public interface Deployment extends Runnable{\r
        public DeployedSystem getDeployedSystem();\r
 \r
        public void setTargetData(TargetData targetData);\r
@@ -11,7 +10,4 @@ public interface Deployment extends Executable{
        public void setDeploymentData(DeploymentData deploymentData);\r
 \r
        public void setDistribution(Distribution distribution);\r
-\r
-       public void execute();\r
-\r
 }\r
diff --git a/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/execution/Executable.java b/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/execution/Executable.java
deleted file mode 100644 (file)
index bc804bd..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-package org.argeo.slc.execution;
-
-/** Any object which can perform processing */
-public interface Executable {
-       /** Executes the actions specified by the object */
-       public void execute();
-}
index ea568116bc21083dac9ef29951f218cbad1efdf4..c2d109960e408640d3b08f3558866276ec5c4e26 100644 (file)
@@ -1,7 +1,7 @@
 package org.argeo.slc.execution;
 
 
-public interface ExecutionFlow extends Executable {
+public interface ExecutionFlow extends Runnable {
        public Object getParameter(String key);
 
        public Boolean isSetAsParameter(String key);
index 37843d1838f6bb0c0e0f866176271d73580f8b1b..f18196a498138b7dac9048e4a7e5e00d1acdc894 100644 (file)
@@ -1,8 +1,7 @@
 package org.argeo.slc.test;\r
 \r
-import org.argeo.slc.execution.Executable;\r
 \r
 /** A test run that can be executed */\r
-public interface ExecutableTestRun extends TestRun, Executable {\r
+public interface ExecutableTestRun extends TestRun, Runnable {\r
 \r
 }\r
index 8ea4d28e24394b4293ca462e23fcef7e3ae580d2..4bfd675a9e98fb2acb9e84c112fe3fd21238d248 100644 (file)
@@ -41,7 +41,7 @@ public class SlcDeployTask extends SAwareTask {
                        log.trace("Overrides target data");\r
                }\r
 \r
-               deployment.execute();\r
+               deployment.run();\r
        }\r
 \r
        /**\r
index 66a416c6e59529621992cffac11645f1fe31b9be..730ae94855ab62a1e35d0084b1cd13a11231ddab 100644 (file)
@@ -112,7 +112,7 @@ public class SlcTestTask extends SAwareTask {
                }\r
 \r
                try {\r
-                       ((ExecutableTestRun) testRun).execute();\r
+                       ((ExecutableTestRun) testRun).run();\r
                } catch (RuntimeException e) {\r
                        if (result != null) {\r
                                SimpleResultPart errorPart = new SimpleResultPart(\r
index 1cac123a81daf00a9489529a07e967aa5533eddb..1bbf16821539b2a8ec06bcfc234274ebded757e1 100644 (file)
@@ -109,7 +109,7 @@ public abstract class AbstractSpringExecutionModule implements ExecutionModule,
                                        .convertValues(executionFlowDescriptor));
                ExecutionFlow flow = (ExecutionFlow) applicationContext.getBean(
                                executionFlowDescriptor.getName(), ExecutionFlow.class);
-               flow.execute();
+               flow.run();
        }
 
        public void setApplicationContext(ApplicationContext applicationContext)
index f2c26f225db5ba724df8f02d589c8bc2a63a4c41..16105e241ef0e4ea10a14270831d500bf9550a3d 100644 (file)
@@ -10,7 +10,6 @@ import org.apache.commons.logging.LogFactory;
 import org.argeo.slc.SlcException;
 import org.argeo.slc.core.structure.tree.TreeSPath;
 import org.argeo.slc.core.structure.tree.TreeSRegistry;
-import org.argeo.slc.execution.Executable;
 import org.argeo.slc.execution.ExecutionFlow;
 import org.argeo.slc.execution.ExecutionSpec;
 import org.argeo.slc.execution.ExecutionSpecAttribute;
@@ -32,7 +31,7 @@ public class DefaultExecutionFlow implements ExecutionFlow, InitializingBean,
        private final ExecutionSpec executionSpec;
        private String name = null;
        private Map<String, Object> parameters = new HashMap<String, Object>();
-       private List<Executable> executables = new ArrayList<Executable>();
+       private List<Runnable> executables = new ArrayList<Runnable>();
 
        private String path;
        private StructureRegistry<TreeSPath> registry = new TreeSRegistry();
@@ -93,15 +92,15 @@ public class DefaultExecutionFlow implements ExecutionFlow, InitializingBean,
 
        }
 
-       public void execute() {
-               for (Executable executable : executables) {
-                       executable.execute();
+       public void run() {
+               for (Runnable executable : executables) {
+                       executable.run();
                }
        }
 
        public void afterPropertiesSet() throws Exception {
                if (path != null) {
-                       for (Executable executable : executables) {
+                       for (Runnable executable : executables) {
                                if (executable instanceof StructureAware) {
                                        ((StructureAware<TreeSPath>) executable).notifyCurrentPath(
                                                        registry, new TreeSPath(path));
@@ -114,7 +113,7 @@ public class DefaultExecutionFlow implements ExecutionFlow, InitializingBean,
                this.name = name;
        }
 
-       public void setExecutables(List<Executable> executables) {
+       public void setExecutables(List<Runnable> executables) {
                this.executables = executables;
        }
 
@@ -144,8 +143,10 @@ public class DefaultExecutionFlow implements ExecutionFlow, InitializingBean,
                        Object paramValue = parameters.get(parameterName);
                        if (specAttr instanceof ResourceSpecAttribute) {
                                // deal with resources
-                               Resource resource = resourceLoader.getResource(paramValue.toString());
-                               return ((ResourceSpecAttribute) specAttr).convertResource(resource);
+                               Resource resource = resourceLoader.getResource(paramValue
+                                               .toString());
+                               return ((ResourceSpecAttribute) specAttr)
+                                               .convertResource(resource);
                        } else {
                                return paramValue;
                        }
index a352c89ba834956425722e8659ac203a5f39e371..c2abfed27005ebde3fbc4c37918005aa05f36287 100644 (file)
@@ -43,7 +43,7 @@ public class ExecutionAspect {
                executionContext.leaveFlow(executionFlow);
        }
 
-       @Pointcut("execution(void org.argeo.slc.execution.ExecutionFlow.execute())")
+       @Pointcut("execution(void org.argeo.slc.execution.ExecutionFlow.run())")
        public void flowExecution() {
        }
        
index f6992cd3280c40971c60488a8aab5958baeb7340..e117a6989ee3bbf8aaab3c5f3ca8bb0a8cc682cd 100644 (file)
@@ -1,12 +1,11 @@
 package org.argeo.slc.core.execution.tasks;
 
-import org.argeo.slc.execution.Executable;
 import org.argeo.slc.test.TestResult;
 
-public class CloseTestResultTask implements Executable {
+public class CloseTestResultTask implements Runnable {
        private TestResult testResult;
 
-       public void execute() {
+       public void run() {
                testResult.close();
        }
 
index eeead38886c044b2a9d08ca8cf676328cde37fe9..5c932899084796970a7a216ce59bad92f4069532 100644 (file)
@@ -2,15 +2,14 @@ package org.argeo.slc.core.execution.tasks;
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import org.argeo.slc.execution.Executable;
 
-public class Echo implements Executable {
+public class Echo implements Runnable {
        private final static Log defaultLog = LogFactory.getLog(Echo.class);
 
        private Log log;
        private String message;
 
-       public void execute() {
+       public void run() {
                log().info(message);
        }
 
index e48cb8141f2e4d4ae04e3182b4c4180d6e0c015b..bb095684dff0c854f97bba50c677b3080ed5d89c 100644 (file)
@@ -2,11 +2,9 @@ package org.argeo.slc.core.execution.tasks;
 \r
 import org.argeo.slc.SlcException;\r
 import org.argeo.slc.core.test.context.SimpleContextAware;\r
-import org.argeo.slc.core.test.context.SimpleParentContextAware;\r
-import org.argeo.slc.execution.Executable;\r
 import org.argeo.slc.test.context.ContextAware;\r
 \r
-public class OverrideContextAware implements Executable {\r
+public class OverrideContextAware implements Runnable {\r
 \r
        private ContextAware source;\r
 \r
@@ -23,7 +21,7 @@ public class OverrideContextAware implements Executable {
        }\r
 \r
 \r
-       public void execute() {\r
+       public void run() {\r
                // override values\r
                if(source.getValues() != null)\r
                        for(String key : source.getValues().keySet()) {\r
index c14c629da0752e3217294b67513068ca995cae5a..4da708cb04cbd215c214fec90b1fe3633f249071 100644 (file)
@@ -6,13 +6,12 @@ import java.util.UUID;
 import org.argeo.slc.SlcException;\r
 import org.argeo.slc.deploy.DeployedSystem;\r
 import org.argeo.slc.deploy.DeployedSystemManager;\r
-import org.argeo.slc.execution.Executable;\r
 import org.argeo.slc.process.SlcExecution;\r
 import org.argeo.slc.process.SlcExecutionRelated;\r
 import org.argeo.slc.process.SlcExecutionStep;\r
 import org.argeo.slc.structure.StructureRegistry;\r
 \r
-public class SlcManagerTask implements Executable, SlcExecutionRelated {\r
+public class SlcManagerTask implements Runnable, SlcExecutionRelated {\r
        private String uuid;\r
        private String slcExecutionUuid;\r
        private String slcExecutionStepUuid;\r
@@ -20,7 +19,7 @@ public class SlcManagerTask implements Executable, SlcExecutionRelated {
        private String action;\r
        private DeployedSystemManager<DeployedSystem> manager;\r
 \r
-       public final void execute() {\r
+       public final void run() {\r
                uuid = UUID.randomUUID().toString();\r
                executeActions(StructureRegistry.ALL);\r
        }\r
index f5a9db5cae4e17cafe527bfcd18c8559dccdaf02..574e21d9e3ba195759bda74748f2a713afbae308 100644 (file)
@@ -16,9 +16,8 @@ import org.apache.commons.io.IOUtils;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.argeo.slc.SlcException;
-import org.argeo.slc.execution.Executable;
 
-public class SystemCall implements Executable {
+public class SystemCall implements Runnable {
        // TODO: specify environment variables
 
        private final Log log = LogFactory.getLog(getClass());
@@ -37,7 +36,7 @@ public class SystemCall implements Executable {
        private Map<String, List<String>> osCommands = new HashMap<String, List<String>>();
        private Map<String, String> osCmds = new HashMap<String, String>();
 
-       public void execute() {
+       public void run() {
                try {
                        if (log.isTraceEnabled()) {
                                log.debug("os.name=" + System.getProperty("os.name"));
index b01e103ead65f5a3fc7086ebb7a986aa64ccdf93..86b35323b2353e55572fec4469ec27fbc99ff2d2 100644 (file)
@@ -37,7 +37,7 @@ public class SimpleTestRun implements WritableTestRun, ExecutableTestRun,
        private TestResult testResult;\r
 \r
        /** Executes the underlying test definition. */\r
-       public void execute() {\r
+       public void run() {\r
                uuid = UUID.randomUUID().toString();\r
                if (testResult != null)\r
                        testResult.notifyTestRun(this);\r
index 32100b8b8ed82c61614ef2889f4d9e31f7745f69..f72fe2da1b67fe7320f3b22c49c0cce28ed19704 100644 (file)
@@ -23,7 +23,7 @@ public class HttpdApplicationDeployment implements Deployment {
 \r
        private DeployEnvironment deployEnvironment;\r
 \r
-       public void execute() {\r
+       public void run() {\r
                try {\r
                        deployEnvironment.unpackTo(distribution, targetData\r
                                        .getTargetRootLocation(), null);\r
index 2abcc6d0e1d4acef7543781dc913c76e8ae709b2..0f22a88eb558929e4364f777b77d7b3e5d67516c 100644 (file)
@@ -9,7 +9,7 @@ import org.argeo.slc.deploy.TargetData;
 public class HttpdServerDeployment implements Deployment {
        private HttpdServerTargetData targetData;
 
-       public void execute() {
+       public void run() {
                // TODO Auto-generated method stub
 
        }
index 64eb3091cb401b01c11e42ce710a51b136eab192..b6b8de343ccf1fcb0903bcfe7f18bca6c866ab41 100644 (file)
@@ -25,7 +25,7 @@ public class DbUnitDeployment implements Deployment {
        private DbUnitDeploymentData deploymentData;\r
        private DbModel dbModel;\r
 \r
-       public void execute() {\r
+       public void run() {\r
                try {\r
                        IDatabaseTester databaseTester = new DataSourceDatabaseTester(\r
                                        mxDatabase.getDataSource());\r
index 365971add8970d5935ba59af983821dbad03d510..a541071269a32399a0672ea86aa2091c33a1290f 100644 (file)
@@ -41,7 +41,7 @@ public abstract class AbstractExecutionFlowTestCase extends TestCase {
        protected void configureAndExecuteSlcFlow(String applicationContextSuffix, String beanName) {\r
                ConfigurableApplicationContext applicationContext = createApplicationContext(applicationContextSuffix);\r
                ExecutionFlow executionFlow = (ExecutionFlow) applicationContext.getBean(beanName);\r
-               executionFlow.execute();                \r
+               executionFlow.run();            \r
                applicationContext.close();\r
        }       \r
        \r
index 57ccfa3555b7c273f296cb5e1f754b55dbdaae79..ae0a1fd581f6dbd3147811142ee826446a7f5bf9 100644 (file)
@@ -25,7 +25,7 @@ public class BasicExecutionFlowTest extends AbstractExecutionFlowTestCase {
 \r
        public void testSpecOverriding() throws Exception {\r
                ConfigurableApplicationContext applicationContext = createApplicationContext("specOverriding.xml");\r
-               ((ExecutionFlow) applicationContext.getBean("flow2")).execute();\r
+               ((ExecutionFlow) applicationContext.getBean("flow2")).run();\r
                SimpleTestResult res = (SimpleTestResult) applicationContext\r
                                .getBean("myTestResult");\r
                validateTestResult(res);\r
@@ -33,12 +33,12 @@ public class BasicExecutionFlowTest extends AbstractExecutionFlowTestCase {
 \r
        public void testMultipleFlows() throws Exception {\r
                ConfigurableApplicationContext applicationContext = createApplicationContext("multipleFlow.xml");\r
-               ((ExecutionFlow) applicationContext.getBean("flow1")).execute();\r
+               ((ExecutionFlow) applicationContext.getBean("flow1")).run();\r
                SimpleTestResult res = (SimpleTestResult) applicationContext\r
                                .getBean("myTestResult");\r
                validateTestResult(res);\r
                res.getParts().clear();\r
-               ((ExecutionFlow) applicationContext.getBean("flow2")).execute();\r
+               ((ExecutionFlow) applicationContext.getBean("flow2")).run();\r
                validateTestResult(res, TestStatus.FAILED);\r
                applicationContext.close();\r
        }\r
@@ -51,7 +51,7 @@ public class BasicExecutionFlowTest extends AbstractExecutionFlowTestCase {
         */\r
        public void testPlaceHolders() throws Exception {\r
                ConfigurableApplicationContext applicationContext = createApplicationContext("placeHolders.cascading.xml");\r
-               ((ExecutionFlow) applicationContext.getBean("flowA")).execute();\r
+               ((ExecutionFlow) applicationContext.getBean("flowA")).run();\r
                validateTestResult((SimpleTestResult) applicationContext\r
                                .getBean("myTestResult"));\r
                applicationContext.close();\r
@@ -80,7 +80,7 @@ public class BasicExecutionFlowTest extends AbstractExecutionFlowTestCase {
                executionParameters.put("p8", "e8");\r
                executionContext.addVariables(executionParameters);\r
 \r
-               ((ExecutionFlow) applicationContext.getBean("flowA")).execute();\r
+               ((ExecutionFlow) applicationContext.getBean("flowA")).run();\r
                validateTestResult((SimpleTestResult) applicationContext\r
                                .getBean("myTestResult"));\r
                applicationContext.close();\r
@@ -100,7 +100,7 @@ public class BasicExecutionFlowTest extends AbstractExecutionFlowTestCase {
                executionParameters.put("p6", "e6");\r
                executionContext.addVariables(executionParameters);\r
 \r
-               ((ExecutionFlow) applicationContext.getBean("flowA")).execute();\r
+               ((ExecutionFlow) applicationContext.getBean("flowA")).run();\r
                validateTestResult((SimpleTestResult) applicationContext\r
                                .getBean("myTestResult"));\r
                applicationContext.close();\r
@@ -138,7 +138,7 @@ public class BasicExecutionFlowTest extends AbstractExecutionFlowTestCase {
                ConfigurableApplicationContext applicationContext = createApplicationContext("listSetMap.xml");\r
                ExecutionFlow executionFlow = (ExecutionFlow) applicationContext\r
                                .getBean("myFlow");\r
-               executionFlow.execute();\r
+               executionFlow.run();\r
 \r
                validateTestResult((SimpleTestResult) applicationContext\r
                                .getBean("myTestResult"));\r
@@ -152,12 +152,12 @@ public class BasicExecutionFlowTest extends AbstractExecutionFlowTestCase {
 \r
        public void testListSetMapMultipleFlows() throws Exception {\r
                ConfigurableApplicationContext applicationContext = createApplicationContext("listSetMapMultipleFlow.xml");\r
-               ((ExecutionFlow) applicationContext.getBean("flow1")).execute();\r
+               ((ExecutionFlow) applicationContext.getBean("flow1")).run();\r
                SimpleTestResult res = (SimpleTestResult) applicationContext\r
                                .getBean("myTestResult");\r
                validateTestResult(res);\r
                res.getParts().clear();\r
-               ((ExecutionFlow) applicationContext.getBean("flow2")).execute();\r
+               ((ExecutionFlow) applicationContext.getBean("flow2")).run();\r
                validateTestResult(res, TestStatus.FAILED);\r
                applicationContext.close();\r
        }\r