From a050d4c27325c65fc04e7eed5b63b5f8ea117df0 Mon Sep 17 00:00:00 2001 From: Mathieu Baudier Date: Tue, 6 Nov 2012 17:27:58 +0000 Subject: [PATCH] Remove flow path git-svn-id: https://svn.argeo.org/slc/trunk@5714 4cfe0d0a-d680-48aa-b62c-e0a02a3f76cc --- .../core/execution/DefaultExecutionFlow.java | 35 ++--------------- ...faultExecutionFlowDescriptorConverter.java | 9 ++--- .../argeo/slc/execution/ExecutionFlow.java | 6 --- .../JcrExecutionModulesListener.java | 10 +++-- .../slc/osgi/OsgiExecutionModulesManager.java | 38 ++++++++++--------- 5 files changed, 33 insertions(+), 65 deletions(-) diff --git a/runtime/org.argeo.slc.core/src/main/java/org/argeo/slc/core/execution/DefaultExecutionFlow.java b/runtime/org.argeo.slc.core/src/main/java/org/argeo/slc/core/execution/DefaultExecutionFlow.java index 20c3c7c4a..9f2c9dbea 100644 --- a/runtime/org.argeo.slc.core/src/main/java/org/argeo/slc/core/execution/DefaultExecutionFlow.java +++ b/runtime/org.argeo.slc.core/src/main/java/org/argeo/slc/core/execution/DefaultExecutionFlow.java @@ -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 parameters = new HashMap(); private List executables = new ArrayList(); - 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() { diff --git a/runtime/org.argeo.slc.core/src/main/java/org/argeo/slc/core/execution/DefaultExecutionFlowDescriptorConverter.java b/runtime/org.argeo.slc.core/src/main/java/org/argeo/slc/core/execution/DefaultExecutionFlowDescriptorConverter.java index a5a966215..ce523a082 100644 --- a/runtime/org.argeo.slc.core/src/main/java/org/argeo/slc/core/execution/DefaultExecutionFlowDescriptorConverter.java +++ b/runtime/org.argeo.slc.core/src/main/java/org/argeo/slc/core/execution/DefaultExecutionFlowDescriptorConverter.java @@ -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(); diff --git a/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/execution/ExecutionFlow.java b/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/execution/ExecutionFlow.java index f9e737ccf..387e5eac1 100644 --- a/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/execution/ExecutionFlow.java +++ b/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/execution/ExecutionFlow.java @@ -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(); } diff --git a/runtime/org.argeo.slc.support.jcr/src/main/java/org/argeo/slc/jcr/execution/JcrExecutionModulesListener.java b/runtime/org.argeo.slc.support.jcr/src/main/java/org/argeo/slc/jcr/execution/JcrExecutionModulesListener.java index f63acb5c0..541d366bf 100644 --- a/runtime/org.argeo.slc.support.jcr/src/main/java/org/argeo/slc/jcr/execution/JcrExecutionModulesListener.java +++ b/runtime/org.argeo.slc.support.jcr/src/main/java/org/argeo/slc/jcr/execution/JcrExecutionModulesListener.java @@ -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 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); diff --git a/runtime/org.argeo.slc.support.osgi/src/main/java/org/argeo/slc/osgi/OsgiExecutionModulesManager.java b/runtime/org.argeo.slc.support.osgi/src/main/java/org/argeo/slc/osgi/OsgiExecutionModulesManager.java index bd38e6ca8..f85df26aa 100644 --- a/runtime/org.argeo.slc.support.osgi/src/main/java/org/argeo/slc/osgi/OsgiExecutionModulesManager.java +++ b/runtime/org.argeo.slc.support.osgi/src/main/java/org/argeo/slc/osgi/OsgiExecutionModulesManager.java @@ -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()); -- 2.39.2