From: Mathieu Baudier Date: Thu, 30 Jul 2009 15:58:56 +0000 (+0000) Subject: Mark ref as internal when they are not found X-Git-Tag: argeo-slc-2.1.7~1575 X-Git-Url: http://git.argeo.org/?a=commitdiff_plain;h=35f2455f24c3c8570a9c8ae7137be046e40fa84d;p=gpl%2Fargeo-slc.git Mark ref as internal when they are not found git-svn-id: https://svn.argeo.org/slc/trunk@2839 4cfe0d0a-d680-48aa-b62c-e0a02a3f76cc --- 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 0e51cfeaa..e10b4bc76 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 @@ -28,7 +28,7 @@ public class DefaultExecutionFlowDescriptorConverter implements public final static String REF_VALUE_TYPE_BEAN_NAME = "beanName"; /** Workaround for https://www.spartadn.com/bugzilla/show_bug.cgi?id=206 */ - private final static String REF_VALUE_IS_FROZEN = "[internal]"; + private final static String REF_VALUE_INTERNAL = "[internal]"; private final static Log log = LogFactory .getLog(DefaultExecutionFlowDescriptorConverter.class); @@ -61,17 +61,19 @@ public class DefaultExecutionFlowDescriptorConverter implements } else if (value instanceof RefValue) { RefValue refValue = (RefValue) value; - if (REF_VALUE_TYPE_BEAN_NAME.equals(refValue.getType())) - if (refValue.getRef() != null) { + if (REF_VALUE_TYPE_BEAN_NAME.equals(refValue.getType())) { + String ref = refValue.getRef(); + if (ref != null && !ref.equals(REF_VALUE_INTERNAL)) { Object obj = applicationContext.getBean(refValue .getRef()); convertedValues.put(key, obj); } else { log.warn("Cannot interpret " + refValue); } - else + } else { throw new UnsupportedException("Ref value type", refValue.getType()); + } } } } @@ -110,7 +112,7 @@ public class DefaultExecutionFlowDescriptorConverter implements } } else if (attribute instanceof RefSpecAttribute) { if (attribute.getIsFrozen()) { - values.put(key, new RefValue(REF_VALUE_IS_FROZEN)); + values.put(key, new RefValue(REF_VALUE_INTERNAL)); } else values.put(key, buildRefValue( (RefSpecAttribute) attribute, executionFlow, @@ -180,6 +182,7 @@ public class DefaultExecutionFlowDescriptorConverter implements log.warn("Cannot define reference for ref spec attribute " + key + " in " + executionFlow + " (" + rsa + ")." + " If it is an inner bean consider put it frozen."); + ref = REF_VALUE_INTERNAL; } else { if (log.isDebugEnabled()) log.debug(ref + " is the reference for ref spec attribute " diff --git a/runtime/org.argeo.slc.core/src/main/java/org/argeo/slc/core/execution/ExecutionThread.java b/runtime/org.argeo.slc.core/src/main/java/org/argeo/slc/core/execution/ExecutionThread.java index 08dfca28b..1450ab98a 100644 --- a/runtime/org.argeo.slc.core/src/main/java/org/argeo/slc/core/execution/ExecutionThread.java +++ b/runtime/org.argeo.slc.core/src/main/java/org/argeo/slc/core/execution/ExecutionThread.java @@ -43,6 +43,7 @@ public class ExecutionThread extends Thread { log.error(msg, e); dispatchAddStep(processThread.getSlcProcess(), new SlcExecutionStep(msg + " " + e.getMessage())); + processThread.notifyError(); } finally { processThread.flowCompleted(); dispatchAddStep(processThread.getSlcProcess(), diff --git a/runtime/org.argeo.slc.core/src/main/java/org/argeo/slc/core/execution/ProcessThread.java b/runtime/org.argeo.slc.core/src/main/java/org/argeo/slc/core/execution/ProcessThread.java index 678e6f679..ec600cb57 100644 --- a/runtime/org.argeo.slc.core/src/main/java/org/argeo/slc/core/execution/ProcessThread.java +++ b/runtime/org.argeo.slc.core/src/main/java/org/argeo/slc/core/execution/ProcessThread.java @@ -19,6 +19,8 @@ public class ProcessThread extends Thread { private final ThreadGroup processThreadGroup; private final List flowsToProcess = new ArrayList(); + private Boolean hadAnError = false; + public ProcessThread( AbstractExecutionModulesManager executionModulesManager, SlcExecution slcExecution) { @@ -53,9 +55,12 @@ public class ProcessThread extends Thread { } } - slcProcess.setStatus(SlcExecution.STATUS_FINISHED); + if (hadAnError) + slcProcess.setStatus(SlcExecution.STATUS_ERROR); + else + slcProcess.setStatus(SlcExecution.STATUS_FINISHED); dispatchUpdateStatus(slcProcess, SlcExecution.STATUS_RUNNING, - SlcExecution.STATUS_FINISHED); + slcProcess.getStatus()); } protected void dispatchUpdateStatus(SlcExecution slcExecution, @@ -66,6 +71,10 @@ public class ProcessThread extends Thread { } } + public void notifyError() { + hadAnError = true; + } + public synchronized void flowCompleted() { notifyAll(); }