diff --git a/spring-webflow/src/main/java/org/springframework/webflow/definition/registry/FlowDefinitionRegistryImpl.java b/spring-webflow/src/main/java/org/springframework/webflow/definition/registry/FlowDefinitionRegistryImpl.java index 564c5fea..a3a93963 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/definition/registry/FlowDefinitionRegistryImpl.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/definition/registry/FlowDefinitionRegistryImpl.java @@ -92,7 +92,8 @@ public class FlowDefinitionRegistryImpl implements FlowDefinitionRegistry { public void registerFlowDefinition(FlowDefinitionHolder definitionHolder) { Assert.notNull(definitionHolder, "The holder of the flow definition to register is required"); if (logger.isDebugEnabled()) { - logger.debug("Registering flow definition held by " + definitionHolder); + logger.debug("Registering flow definition held by " + definitionHolder + " under id '" + + definitionHolder.getFlowDefinitionId() + "'"); } flowDefinitions.put(definitionHolder.getFlowDefinitionId(), definitionHolder); } @@ -115,6 +116,6 @@ public class FlowDefinitionRegistryImpl implements FlowDefinitionRegistry { } public String toString() { - return new ToStringCreator(this).append("flowDefinitions", flowDefinitions).append("parent", parent).toString(); + return new ToStringCreator(this).append("flowIds", getFlowDefinitionIds()).append("parent", parent).toString(); } } \ No newline at end of file diff --git a/spring-webflow/src/main/java/org/springframework/webflow/definition/registry/StaticFlowDefinitionHolder.java b/spring-webflow/src/main/java/org/springframework/webflow/definition/registry/StaticFlowDefinitionHolder.java index 6c8f9422..2feb1c5f 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/definition/registry/StaticFlowDefinitionHolder.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/definition/registry/StaticFlowDefinitionHolder.java @@ -15,6 +15,7 @@ */ package org.springframework.webflow.definition.registry; +import org.springframework.core.style.ToStringCreator; import org.springframework.webflow.definition.FlowDefinition; /** @@ -60,4 +61,8 @@ class StaticFlowDefinitionHolder implements FlowDefinitionHolder { return flowDefinition.hashCode(); } + public String toString() { + return new ToStringCreator(this).append("flowDefinition", flowDefinition).toString(); + } + } \ No newline at end of file diff --git a/spring-webflow/src/main/java/org/springframework/webflow/engine/builder/DefaultFlowHolder.java b/spring-webflow/src/main/java/org/springframework/webflow/engine/builder/DefaultFlowHolder.java index d1d73e37..a8572ca6 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/engine/builder/DefaultFlowHolder.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/engine/builder/DefaultFlowHolder.java @@ -17,6 +17,8 @@ package org.springframework.webflow.engine.builder; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.springframework.core.style.ToStringCreator; +import org.springframework.util.Assert; import org.springframework.webflow.definition.FlowDefinition; import org.springframework.webflow.definition.registry.FlowDefinitionConstructionException; import org.springframework.webflow.definition.registry.FlowDefinitionHolder; @@ -60,6 +62,7 @@ public class DefaultFlowHolder implements FlowDefinitionHolder { * @param assembler the flow assembler to use */ public DefaultFlowHolder(FlowAssembler assembler) { + Assert.notNull(assembler, "The FlowAssembler is required"); this.assembler = assembler; } @@ -106,7 +109,7 @@ public class DefaultFlowHolder implements FlowDefinitionHolder { } public String toString() { - return "'" + getFlowDefinitionId() + "'"; + return new ToStringCreator(this).append("flowBuilder", assembler.getFlowBuilder()).toString(); } } \ No newline at end of file diff --git a/spring-webflow/src/main/java/org/springframework/webflow/engine/builder/model/FlowModelFlowBuilder.java b/spring-webflow/src/main/java/org/springframework/webflow/engine/builder/model/FlowModelFlowBuilder.java index ba4878ee..59cb1360 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/engine/builder/model/FlowModelFlowBuilder.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/engine/builder/model/FlowModelFlowBuilder.java @@ -41,6 +41,7 @@ import org.springframework.context.support.GenericApplicationContext; import org.springframework.context.support.ReloadableResourceBundleMessageSource; import org.springframework.core.JdkVersion; import org.springframework.core.io.Resource; +import org.springframework.core.style.ToStringCreator; import org.springframework.util.ClassUtils; import org.springframework.util.StringUtils; import org.springframework.web.context.WebApplicationContext; @@ -964,4 +965,8 @@ public class FlowModelFlowBuilder extends AbstractFlowBuilder { } } + public String toString() { + return new ToStringCreator(this).append("resource", flowModelHolder.getFlowModelResource()).toString(); + } + } diff --git a/spring-webflow/src/main/java/org/springframework/webflow/engine/impl/FlowExecutionImpl.java b/spring-webflow/src/main/java/org/springframework/webflow/engine/impl/FlowExecutionImpl.java index 074f3440..13aab825 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/engine/impl/FlowExecutionImpl.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/engine/impl/FlowExecutionImpl.java @@ -57,9 +57,8 @@ import org.springframework.webflow.execution.View; /** * Default implementation of FlowExecution that uses a stack-based data structure to manage spawned flow sessions. This - * class is closely coupled with package-private FlowSessionImpl and - * RequestControlContextImpl. The three classes work together to form a complete flow execution - * implementation based on a finite state machine. + * class is closely coupled with package-private FlowSessionImpl and RequestControlContextImpl + * . The three classes work together to form a complete flow execution implementation based on a finite state machine. *

* This implementation of FlowExecution is serializable so it can be safely stored in an HTTP session or other * persistent store such as a file, database, or client-side form field. Once deserialized, the @@ -211,7 +210,7 @@ public class FlowExecutionImpl implements FlowExecution, Externalizable { IllegalStateException { Assert.state(!started, "This flow has already been started; you cannot call 'start()' more than once"); if (logger.isDebugEnabled()) { - logger.debug("Starting execution in " + externalContext); + logger.debug("Starting in " + externalContext + " with input " + input); } started = true; MessageContext messageContext = createMessageContext(null); @@ -230,13 +229,13 @@ public class FlowExecutionImpl implements FlowExecution, Externalizable { try { listeners.firePaused(requestContext); } catch (Throwable e) { - logger.error("Flow execution listener threw exception", e); + logger.error("FlowExecutionListener threw exception", e); } } try { listeners.fireRequestProcessed(requestContext); } catch (Throwable e) { - logger.error("Flow execution listener threw exception", e); + logger.error("FlowExecutionListener threw exception", e); } RequestContextHolder.setRequestContext(null); } @@ -251,7 +250,7 @@ public class FlowExecutionImpl implements FlowExecution, Externalizable { } } if (logger.isDebugEnabled()) { - logger.debug("Resuming execution in " + externalContext); + logger.debug("Resuming in " + externalContext); } Flow activeFlow = getActiveSessionInternal().getFlow(); MessageContext messageContext = createMessageContext(activeFlow.getApplicationContext()); @@ -271,13 +270,13 @@ public class FlowExecutionImpl implements FlowExecution, Externalizable { try { listeners.firePaused(requestContext); } catch (Throwable e) { - logger.error("Flow execution listener threw exception", e); + logger.error("FlowExecutionListener threw exception", e); } } try { listeners.fireRequestProcessed(requestContext); } catch (Throwable e) { - logger.error("Flow execution listener threw exception", e); + logger.error("FlowExecutionListener threw exception", e); } RequestContextHolder.setRequestContext(null); } @@ -539,8 +538,8 @@ public class FlowExecutionImpl implements FlowExecution, Externalizable { // internal helpers /** - * Activate a new FlowSession for the flow definition. Creates the new flow session and pushes it - * onto the stack. + * Activate a new FlowSession for the flow definition. Creates the new flow session and pushes it onto + * the stack. * @param flow the flow definition * @return the new flow session */ diff --git a/spring-webflow/src/main/java/org/springframework/webflow/executor/FlowExecutorImpl.java b/spring-webflow/src/main/java/org/springframework/webflow/executor/FlowExecutorImpl.java index 5b3bae9b..c113ce2a 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/executor/FlowExecutorImpl.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/executor/FlowExecutorImpl.java @@ -15,6 +15,8 @@ */ package org.springframework.webflow.executor; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import org.springframework.util.Assert; import org.springframework.webflow.context.ExternalContext; import org.springframework.webflow.context.ExternalContextHolder; @@ -72,6 +74,8 @@ import org.springframework.webflow.execution.repository.FlowExecutionRepository; */ public class FlowExecutorImpl implements FlowExecutor { + private static final Log logger = LogFactory.getLog(FlowExecutorImpl.class); + /** * The locator to access flow definitions registered in a central registry. */ @@ -127,6 +131,9 @@ public class FlowExecutorImpl implements FlowExecutor { public FlowExecutionResult launchExecution(String flowId, MutableAttributeMap input, ExternalContext context) throws FlowException { try { + if (logger.isDebugEnabled()) { + logger.debug("Launching new execution of flow '" + flowId + "' with input " + input); + } ExternalContextHolder.setExternalContext(context); FlowDefinition flowDefinition = definitionLocator.getFlowDefinition(flowId); FlowExecution flowExecution = executionFactory.createFlowExecution(flowDefinition); @@ -144,6 +151,9 @@ public class FlowExecutorImpl implements FlowExecutor { public FlowExecutionResult resumeExecution(String flowExecutionKey, ExternalContext context) throws FlowException { try { + if (logger.isDebugEnabled()) { + logger.debug("Resuming flow execution with key '" + flowExecutionKey); + } ExternalContextHolder.setExternalContext(context); FlowExecutionKey key = executionRepository.parseFlowExecutionKey(flowExecutionKey); FlowExecutionLock lock = executionRepository.getLock(key); diff --git a/spring-webflow/src/main/java/org/springframework/webflow/mvc/servlet/AbstractFlowHandler.java b/spring-webflow/src/main/java/org/springframework/webflow/mvc/servlet/AbstractFlowHandler.java index 02001e4c..ccd1145a 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/mvc/servlet/AbstractFlowHandler.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/mvc/servlet/AbstractFlowHandler.java @@ -49,7 +49,7 @@ public class AbstractFlowHandler implements FlowHandler { } public String toString() { - return new ToStringCreator(this).append("flowId", getFlowId()).toString(); + return new ToStringCreator(this).toString(); } } diff --git a/spring-webflow/src/main/java/org/springframework/webflow/mvc/servlet/FlowHandlerMapping.java b/spring-webflow/src/main/java/org/springframework/webflow/mvc/servlet/FlowHandlerMapping.java index 1cc51a12..889e4e79 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/mvc/servlet/FlowHandlerMapping.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/mvc/servlet/FlowHandlerMapping.java @@ -20,6 +20,7 @@ import javax.servlet.http.HttpServletRequest; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.springframework.core.style.ToStringCreator; import org.springframework.util.Assert; import org.springframework.web.servlet.handler.AbstractHandlerMapping; import org.springframework.webflow.context.servlet.DefaultFlowUrlHandler; @@ -113,7 +114,12 @@ public class FlowHandlerMapping extends AbstractHandlerMapping { return null; } + public String toString() { + return new ToStringCreator(this).append("flowRegistry", flowRegistry).toString(); + } + private static class DefaultFlowHandler extends AbstractFlowHandler { + private String flowId; public DefaultFlowHandler(String flowId) {