Remove flow path
authorMathieu Baudier <mbaudier@argeo.org>
Tue, 6 Nov 2012 17:27:58 +0000 (17:27 +0000)
committerMathieu Baudier <mbaudier@argeo.org>
Tue, 6 Nov 2012 17:27:58 +0000 (17:27 +0000)
git-svn-id: https://svn.argeo.org/slc/trunk@5714 4cfe0d0a-d680-48aa-b62c-e0a02a3f76cc

runtime/org.argeo.slc.core/src/main/java/org/argeo/slc/core/execution/DefaultExecutionFlow.java
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/ExecutionFlow.java
runtime/org.argeo.slc.support.jcr/src/main/java/org/argeo/slc/jcr/execution/JcrExecutionModulesListener.java
runtime/org.argeo.slc.support.osgi/src/main/java/org/argeo/slc/osgi/OsgiExecutionModulesManager.java

index 20c3c7c4a28ab312a268f7d4ac3dfe7401f31b3e..9f2c9dbeabb5bf4c9717635f080f3ee1816153fa 100644 (file)
@@ -27,12 +27,10 @@ import org.argeo.slc.execution.ExecutionFlow;
 import org.argeo.slc.execution.ExecutionSpec;
 import org.argeo.slc.execution.ExecutionSpecAttribute;
 import org.springframework.beans.factory.BeanNameAware;
-import org.springframework.beans.factory.InitializingBean;
 import org.springframework.validation.MapBindingResult;
 
 /** Default implementation of an execution flow. */
-public class DefaultExecutionFlow implements ExecutionFlow, InitializingBean,
-               BeanNameAware {
+public class DefaultExecutionFlow implements ExecutionFlow, BeanNameAware {
        private final static Log log = LogFactory
                        .getLog(DefaultExecutionFlow.class);
 
@@ -41,8 +39,6 @@ public class DefaultExecutionFlow implements ExecutionFlow, InitializingBean,
        private Map<String, Object> parameters = new HashMap<String, Object>();
        private List<Runnable> executables = new ArrayList<Runnable>();
 
-       private String path;
-
        private Boolean failOnError = true;
 
        public DefaultExecutionFlow() {
@@ -136,28 +132,6 @@ public class DefaultExecutionFlow implements ExecutionFlow, InitializingBean,
                runnable.run();
        }
 
-       public void afterPropertiesSet() throws Exception {
-               if (path == null) {
-                       if (name.charAt(0) == '/') {
-                               path = name.substring(0, name.lastIndexOf('/'));
-                       }
-               }
-
-               if (path != null) {
-                       for (Runnable executable : executables) {
-                               if (executable instanceof DefaultExecutionFlow) {
-                                       // so we don't need to have DefaultExecutionFlow
-                                       // implementing StructureAware
-                                       // FIXME: probably has side effects
-                                       DefaultExecutionFlow flow = (DefaultExecutionFlow) executable;
-                                       String newPath = path + '/' + flow.getName();
-                                       flow.setPath(newPath);
-                                       log.warn(newPath + " was forcibly set on " + flow);
-                               }
-                       }
-               }
-       }
-
        public void setBeanName(String name) {
                this.name = name;
        }
@@ -221,12 +195,9 @@ public class DefaultExecutionFlow implements ExecutionFlow, InitializingBean,
                return name.hashCode();
        }
 
-       public String getPath() {
-               return path;
-       }
-
+       /** @deprecated does nothing */
+       @Deprecated
        public void setPath(String path) {
-               this.path = path;
        }
 
        public Boolean getFailOnError() {
index a5a9662158e0de5ba9cb536d474b4f492775f3e0..ce523a082ea2d0ed8ebad9d699579b980e0a059c 100644 (file)
@@ -164,7 +164,6 @@ public class DefaultExecutionFlowDescriptorConverter implements
                md.getExecutionFlows().addAll(set);
        }
 
-       @SuppressWarnings("deprecation")
        public ExecutionFlowDescriptor getExecutionFlowDescriptor(
                        ExecutionFlow executionFlow) {
                if (executionFlow.getName() == null)
@@ -212,10 +211,10 @@ public class DefaultExecutionFlowDescriptorConverter implements
 
                ExecutionFlowDescriptor efd = new ExecutionFlowDescriptor(name, values,
                                executionSpec);
-               if (executionFlow.getPath() != null)
-                       efd.setPath(executionFlow.getPath());
-               else
-                       efd.setPath("");
+//             if (executionFlow.getPath() != null)
+//                     efd.setPath(executionFlow.getPath());
+//             else
+//                     efd.setPath("");
 
                // Takes description from spring
                BeanFactory bf = getBeanFactory();
index f9e737ccfcd73842c788091da8084e28c1cdaa9f..387e5eac14f1592fb4793f05fae95fa3e2ec2fcc 100644 (file)
@@ -31,10 +31,4 @@ public interface ExecutionFlow extends Runnable {
         * interpreted by UIs as a hierarchy;
         */
        public String getName();
-
-       /**
-        * @deprecated will be removed in SLC 2.0, the path should be the part of
-        *             the name with '/'
-        */
-       public String getPath();
 }
index f63acb5c06faac9f5a21054014fccba7314816c0..541d366bf78b2b74fb27b3d422f77ccd4530a265 100644 (file)
@@ -243,6 +243,11 @@ public class JcrExecutionModulesListener implements ExecutionModulesListener,
                        String relativePath, ExecutionFlowDescriptor efd)
                        throws RepositoryException {
                Node flowNode = null;
+               // if (relativePath.startsWith("/"))
+               // relativePath = relativePath.substring(1);
+               // if (relativePath.endsWith("/"))
+               // relativePath = relativePath.substring(0, relativePath.length() - 1);
+
                Iterator<String> names = Arrays.asList(relativePath.split("/"))
                                .iterator();
                // create intermediary paths
@@ -383,12 +388,9 @@ public class JcrExecutionModulesListener implements ExecutionModulesListener,
         * UTILITIES
         */
        /** @return the relative path, never starts with '/' */
-       @SuppressWarnings("deprecation")
        protected String getExecutionFlowRelativePath(
                        ExecutionFlowDescriptor executionFlow) {
-               String relativePath = executionFlow.getPath() == null ? executionFlow
-                               .getName() : executionFlow.getPath() + '/'
-                               + executionFlow.getName();
+               String relativePath = executionFlow.getName();
                // we assume that it is more than one char long
                if (relativePath.charAt(0) == '/')
                        relativePath = relativePath.substring(1);
index bd38e6ca83074a5409b1373ca2ef3df8faa17d12..f85df26aa1e2bce907ba94e75bd649e0323f080b 100644 (file)
@@ -596,33 +596,35 @@ public class OsgiExecutionModulesManager extends
                }
        }
 
-       @SuppressWarnings("deprecation")
        protected ObjectName flowMBeanName(Module module,
                        ExecutionFlow executionFlow) {
                String executionModulesPrefix = "SLCExecutionModules";
-               String path = executionFlow.getPath();
+               // String path = executionFlow.getPath();
                String name = executionFlow.getName();
-               if (path == null && name.indexOf('/') >= 0) {
-                       path = name.substring(0, name.lastIndexOf('/'));
-                       name = name.substring(name.lastIndexOf('/'));
-               }
+               // if (path == null && name.indexOf('/') >= 0) {
+               // path = name.substring(0, name.lastIndexOf('/'));
+               // name = name.substring(name.lastIndexOf('/'));
+               // }
 
                StringBuffer buf = new StringBuffer(executionModulesPrefix + ":"
                                + "module=" + module.getName() + " [" + module.getVersion()
                                + "],");
 
-               if (path != null && !path.equals("")) {
-                       int depth = 0;
-                       for (String token : path.split("/")) {
-                               if (!token.equals("")) {
-                                       buf.append("path").append(depth).append('=');
-                                       // in order to have directories first
-                                       buf.append('/');
-                                       buf.append(token).append(',');
-                                       depth++;
-                               }
-                       }
-               }
+               // if (path != null && !path.equals("")) {
+               // int depth = 0;
+               // for (String token : path.split("/")) {
+               // if (!token.equals("")) {
+               // buf.append("path").append(depth).append('=');
+               // // in order to have directories first
+               // buf.append('/');
+               // buf.append(token).append(',');
+               // depth++;
+               // }
+               // }
+               // }
+
+               // FIXME deal with /
+
                buf.append("name=").append(name);
                try {
                        return new ObjectName(buf.toString());