From 8bc7d4f282d8734bc657a38d9c3683b0f623dd1d Mon Sep 17 00:00:00 2001 From: Scott Andrews Date: Sat, 12 Apr 2008 01:09:35 +0000 Subject: [PATCH] restored minor 1.x compat --- .../webflow/executor/FlowExecutorImpl.java | 27 ++++++++++-- .../webflow/mvc/servlet/FlowController.java | 42 ++++++++++++++++--- 2 files changed, 60 insertions(+), 9 deletions(-) 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 c75fc7d8..baa24eab 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 @@ -73,17 +73,17 @@ import org.springframework.webflow.execution.repository.FlowExecutionRepository; public class FlowExecutorImpl implements FlowExecutor { /** - * A locator to access flow definitions registered in a central registry. + * The locator to access flow definitions registered in a central registry. */ private FlowDefinitionLocator definitionLocator; /** - * An abstract factory for creating a new execution of a flow definition. + * The abstract factory for creating a new execution of a flow definition. */ private FlowExecutionFactory executionFactory; /** - * An repository used to save, update, and load existing flow executions to/from a persistent store. + * The repository used to save, update, and load existing flow executions to/from a persistent store. */ private FlowExecutionRepository executionRepository; @@ -103,6 +103,27 @@ public class FlowExecutorImpl implements FlowExecutor { this.executionRepository = executionRepository; } + /** + * Returns the locator to load flow definitions to execute. + */ + public FlowDefinitionLocator getDefinitionLocator() { + return definitionLocator; + } + + /** + * Returns the abstract factory used to create new executions of a flow. + */ + public FlowExecutionFactory getExecutionFactory() { + return executionFactory; + } + + /** + * Returns the repository used to save, update, and load existing flow executions to/from a persistent store. + */ + public FlowExecutionRepository getExecutionRepository() { + return executionRepository; + } + public FlowExecutionResult launchExecution(String flowId, MutableAttributeMap input, ExternalContext context) throws FlowException { try { diff --git a/spring-webflow/src/main/java/org/springframework/webflow/mvc/servlet/FlowController.java b/spring-webflow/src/main/java/org/springframework/webflow/mvc/servlet/FlowController.java index 8ffe9406..24cc3124 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/mvc/servlet/FlowController.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/mvc/servlet/FlowController.java @@ -52,7 +52,7 @@ public class FlowController extends AbstractController { private static final Log logger = LogFactory.getLog(FlowController.class); /** - * The entry point into Spring Web Flow. + * The central service for executing flows and the entry point into the Web Flow system. */ private FlowExecutor flowExecutor; @@ -72,16 +72,31 @@ public class FlowController extends AbstractController { */ private Map flowHandlers = new HashMap(); + public FlowController() { + initDefaults(); + } + /** * Creates a new flow controller. * @param flowExecutor the web flow executor service */ public FlowController(FlowExecutor flowExecutor) { this.flowExecutor = flowExecutor; - this.urlHandler = new DefaultFlowUrlHandler(); - this.ajaxHandler = new SpringJavascriptAjaxHandler(); - // set the cache seconds property to 0 so no pages are cached by default for flows - setCacheSeconds(0); + initDefaults(); + } + + /** + * Returns the central service for executing flows and the entry point into the Web Flow system. + */ + public FlowExecutor getFlowExecutor() { + return flowExecutor; + } + + /** + * Sets the central service for executing flows and the entry point into the Web Flow system. + */ + public void setFlowExecutor(FlowExecutor flowExecutor) { + this.flowExecutor = flowExecutor; } /** @@ -95,7 +110,7 @@ public class FlowController extends AbstractController { * Sets the configured flow url handler. * @param urlHandler the flow url handler. */ - public void setFlowRequestUrlHandler(FlowUrlHandler urlHandler) { + public void setFlowUrlHandler(FlowUrlHandler urlHandler) { this.urlHandler = urlHandler; } @@ -114,6 +129,14 @@ public class FlowController extends AbstractController { this.ajaxHandler = ajaxHandler; } + /** + * Sets the custom flow handles for managing access to specific flows in a custom manner. + * @param flowHandlers the flow handler map + */ + public void setFlowHandlers(Map flowHandlers) { + this.flowHandlers = flowHandlers; + } + /** * Registers a handler for managing access to a specific flow definition. * @param handler the flow handler @@ -202,6 +225,13 @@ public class FlowController extends AbstractController { // internal helpers + private void initDefaults() { + urlHandler = new DefaultFlowUrlHandler(); + ajaxHandler = new SpringJavascriptAjaxHandler(); + // set the cache seconds property to 0 so no pages are cached by default for flows + setCacheSeconds(0); + } + private ModelAndView handleFlowExecutionResult(FlowExecutionResult result, ServletExternalContext context, HttpServletRequest request, HttpServletResponse response) throws IOException { if (result.paused()) {