X-Git-Url: http://git.argeo.org/?a=blobdiff_plain;f=runtime%2Forg.argeo.slc.core%2Fsrc%2Fmain%2Fjava%2Forg%2Fargeo%2Fslc%2Fcore%2Fexecution%2FInstantiationManager.java;h=60e93ec15c08b40d24882f7ffa431f7e8d56da8b;hb=af9457b0628ba4cc625192762d0c0fe7564b9846;hp=eb6ce53473407a258fb5f1a6af52401be5201eb8;hpb=2fc453bcd60b20071d878d6f1249592c8572de16;p=gpl%2Fargeo-slc.git diff --git a/runtime/org.argeo.slc.core/src/main/java/org/argeo/slc/core/execution/InstantiationManager.java b/runtime/org.argeo.slc.core/src/main/java/org/argeo/slc/core/execution/InstantiationManager.java index eb6ce5347..60e93ec15 100644 --- a/runtime/org.argeo.slc.core/src/main/java/org/argeo/slc/core/execution/InstantiationManager.java +++ b/runtime/org.argeo.slc.core/src/main/java/org/argeo/slc/core/execution/InstantiationManager.java @@ -1,3 +1,18 @@ +/* + * Copyright (C) 2007-2012 Argeo GmbH + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.argeo.slc.core.execution; import java.util.Stack; @@ -8,6 +23,7 @@ import org.argeo.slc.SlcException; import org.argeo.slc.execution.ExecutionFlow; import org.argeo.slc.execution.ExecutionSpecAttribute; +/** Manage parameters that need to be set during the instantiation of a flow */ public class InstantiationManager { private final static Log log = LogFactory @@ -26,15 +42,15 @@ public class InstantiationManager { } public void flowInitializationStarted(ExecutionFlow flow, String flowName) { - if (log.isTraceEnabled()) - log.trace("Start initialization of " + flow.hashCode() + " (" - + flow + " - " + flow.getClass() + ")"); - // set the flow name if it is DefaultExecutionFlow if (flow instanceof DefaultExecutionFlow) { ((DefaultExecutionFlow) flow).setBeanName(flowName); } + if (log.isTraceEnabled()) + log.trace("Start initialization of " + flow.hashCode() + " (" + + flow + " - " + flow.getClass() + ")"); + // log.info("# flowInitializationStarted " + flowName); // create a stack for this thread if there is none if (flowStack.get() == null) { @@ -47,12 +63,18 @@ public class InstantiationManager { if (log.isTraceEnabled()) log.trace("Finish initialization of " + flow.hashCode() + " (" + flow + " - " + flow.getClass() + ")"); - ExecutionFlow registeredFlow = flowStack.get().pop(); - if (registeredFlow != null) { - if (!flow.getName().equals(registeredFlow.getName())) - throw new SlcException("Current flow is " + flow); - // log.info("# flowInitializationFinished " + flowName); - // initializingFlow.set(null); + + if (flowStack.get() != null) { + ExecutionFlow registeredFlow = flowStack.get().pop(); + if (registeredFlow != null) { + if (!flow.getName().equals(registeredFlow.getName())) + throw new SlcException("Current flow is " + flow); + // log.info("# flowInitializationFinished " + flowName); + // initializingFlow.set(null); + } + } else { + // happens for flows imported as services + log.warn("flowInitializationFinished - Flow Stack is null"); } }