From 118c8d5e9be5f68176c49a8c7a74676f9bd0b595 Mon Sep 17 00:00:00 2001 From: Keith Donald Date: Sun, 13 Apr 2008 02:36:34 +0000 Subject: [PATCH] copyright on action package, better javadoc removed obsolete types --- .../webflow/action/AbstractAction.java | 2 +- .../action/AbstractBeanInvokingAction.java | 144 ------------------ .../webflow/action/ActionResultExposer.java | 3 +- .../action/BeanInvokingActionFactory.java | 82 ---------- .../webflow/action/CompositeAction.java | 2 +- .../DefaultMultiActionMethodResolver.java | 2 +- .../webflow/action/DispatchMethodInvoker.java | 2 +- .../webflow/action/EvaluateAction.java | 2 +- .../webflow/action/EventFactorySupport.java | 2 +- .../action/ExternalRedirectAction.java | 24 +++ .../action/FlowDefinitionRedirectAction.java | 25 +++ .../webflow/action/FormAction.java | 37 ++--- .../webflow/action/FormObjectAccessor.java | 2 +- .../action/LocalBeanInvokingAction.java | 58 ------- .../webflow/action/MultiAction.java | 19 +-- .../webflow/action/RenderAction.java | 2 +- .../webflow/action/ResultEventFactory.java | 2 +- .../action/ResultEventFactorySelector.java | 3 +- .../action/ResultObjectBasedEventFactory.java | 2 +- .../webflow/action/SetAction.java | 2 +- .../webflow/action/SuccessEventFactory.java | 2 +- .../action/ViewFactoryActionAdapter.java | 20 +++ .../builder/support/FlowBuilderServices.java | 7 +- 23 files changed, 107 insertions(+), 339 deletions(-) delete mode 100644 spring-webflow/src/main/java/org/springframework/webflow/action/AbstractBeanInvokingAction.java delete mode 100644 spring-webflow/src/main/java/org/springframework/webflow/action/BeanInvokingActionFactory.java delete mode 100644 spring-webflow/src/main/java/org/springframework/webflow/action/LocalBeanInvokingAction.java diff --git a/spring-webflow/src/main/java/org/springframework/webflow/action/AbstractAction.java b/spring-webflow/src/main/java/org/springframework/webflow/action/AbstractAction.java index 7b140816..03b0fb25 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/action/AbstractAction.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/action/AbstractAction.java @@ -1,5 +1,5 @@ /* - * Copyright 2004-2007 the original author or authors. + * Copyright 2004-2008 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-webflow/src/main/java/org/springframework/webflow/action/AbstractBeanInvokingAction.java b/spring-webflow/src/main/java/org/springframework/webflow/action/AbstractBeanInvokingAction.java deleted file mode 100644 index 43eaa684..00000000 --- a/spring-webflow/src/main/java/org/springframework/webflow/action/AbstractBeanInvokingAction.java +++ /dev/null @@ -1,144 +0,0 @@ -/* - * Copyright 2004-2007 the original author or authors. - * - * 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.springframework.webflow.action; - -import org.springframework.binding.convert.ConversionService; -import org.springframework.binding.convert.service.DefaultConversionService; -import org.springframework.binding.method.MethodInvoker; -import org.springframework.binding.method.MethodSignature; -import org.springframework.util.Assert; -import org.springframework.webflow.execution.Action; -import org.springframework.webflow.execution.Event; -import org.springframework.webflow.execution.RequestContext; - -/** - * Base class for actions that delegate to methods on beans (POJOs - Plain Old Java Objects). Acts as an adapter that - * adapts an {@link Object} method to the Spring Web Flow {@link Action} contract. - *

- * Subclasses are required to implement the {@link #getBean(RequestContext)} method, returning the bean on which a - * method should be invoked. - * - * @see BeanInvokingActionFactory - * - * @author Keith Donald - */ -public abstract class AbstractBeanInvokingAction extends AbstractAction { - - /** - * The signature of the method to invoke on the target bean, capable of resolving the method when used with a - * {@link MethodInvoker}. Required. - */ - private MethodSignature methodSignature; - - /** - * The method invoker that performs the action->bean method binding, accepting a {@link MethodSignature} and - * {@link #getBean(RequestContext) target bean} instance. - */ - private MethodInvoker methodInvoker = new MethodInvoker(); - - /** - * The specification (configuration) for how bean method return values should be exposed to an executing flow that - * invokes this action. - */ - private ActionResultExposer methodResultExposer; - - /** - * The strategy that adapts bean method return values to Event objects. - */ - private ResultEventFactory resultEventFactory = new SuccessEventFactory(); - - /** - * Creates a new bean invoking action. - * @param methodSignature the signature of the method to invoke - */ - protected AbstractBeanInvokingAction(MethodSignature methodSignature) { - Assert.notNull(methodSignature, "The signature of the target method to invoke is required"); - this.methodSignature = methodSignature; - } - - /** - * Returns the signature of the method to invoke on the target bean. - */ - public MethodSignature getMethodSignature() { - return methodSignature; - } - - /** - * Returns the configuration for how bean method return values should be exposed to an executing flow that invokes - * this action. - */ - public ActionResultExposer getMethodResultExposer() { - return methodResultExposer; - } - - /** - * Configures how bean method return values should be exposed to an executing flow that invokes this action. This is - * optional. By default the bean method return values do not get exposed to the executing flow. - */ - public void setMethodResultExposer(ActionResultExposer methodResultExposer) { - this.methodResultExposer = methodResultExposer; - } - - /** - * Returns the event adaption strategy used by this action. - */ - protected ResultEventFactory getResultEventFactory() { - return resultEventFactory; - } - - /** - * Set the bean return value->event adaption strategy. Defaults to {@link SuccessEventFactory}, so all bean - * method return values will be interpreted as "success". - */ - public void setResultEventFactory(ResultEventFactory resultEventFactory) { - this.resultEventFactory = resultEventFactory; - } - - /** - * Set the conversion service to perform type conversion of event parameters to method arguments as neccessary. - * Defaults to {@link DefaultConversionService}. - */ - public void setConversionService(ConversionService conversionService) { - methodInvoker.setConversionService(conversionService); - } - - /** - * Returns the bean method invoker helper. - */ - protected MethodInvoker getMethodInvoker() { - return methodInvoker; - } - - protected Event doExecute(RequestContext context) throws Exception { - Object bean = getBean(context); - Object returnValue = getMethodInvoker().invoke(methodSignature, bean, context); - if (methodResultExposer != null) { - methodResultExposer.exposeResult(returnValue, context); - } - return resultEventFactory.createResultEvent(bean, returnValue, context); - } - - // subclassing hooks - - /** - * Retrieves the bean to invoke a method on. Subclasses need to implement this method. - * @param context the flow execution request context - * @return the bean on which to invoke methods - * @throws Exception when the bean cannot be retreived - */ - protected abstract Object getBean(RequestContext context) throws Exception; - -} \ No newline at end of file diff --git a/spring-webflow/src/main/java/org/springframework/webflow/action/ActionResultExposer.java b/spring-webflow/src/main/java/org/springframework/webflow/action/ActionResultExposer.java index 15afbdab..c1e85b37 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/action/ActionResultExposer.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/action/ActionResultExposer.java @@ -1,5 +1,5 @@ /* - * Copyright 2004-2007 the original author or authors. + * Copyright 2004-2008 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -28,7 +28,6 @@ import org.springframework.webflow.execution.RequestContext; * attribute in a configured scope. * * @see EvaluateAction - * @see AbstractBeanInvokingAction * * @author Keith Donald */ diff --git a/spring-webflow/src/main/java/org/springframework/webflow/action/BeanInvokingActionFactory.java b/spring-webflow/src/main/java/org/springframework/webflow/action/BeanInvokingActionFactory.java deleted file mode 100644 index 296b95b2..00000000 --- a/spring-webflow/src/main/java/org/springframework/webflow/action/BeanInvokingActionFactory.java +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright 2004-2007 the original author or authors. - * - * 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.springframework.webflow.action; - -import org.springframework.beans.factory.BeanFactory; -import org.springframework.binding.convert.ConversionService; -import org.springframework.binding.method.MethodKey; -import org.springframework.binding.method.MethodSignature; -import org.springframework.webflow.core.collection.AttributeMap; -import org.springframework.webflow.execution.Action; - -/** - * A helper factory for {@link Action} instances that invoke methods on beans managed in a Spring bean factory. - *

- * This factory encapsulates the logic required to take an arbitrary java.lang.Object from a Spring bean - * factory and adapt a method on it to the {@link Action} interface. If the bean you want to use is not managed in a - * Spring bean factory, consider subclassing {@link AbstractBeanInvokingAction} and using it directly. - * - * @see AbstractBeanInvokingAction - * - * @author Keith Donald - */ -public class BeanInvokingActionFactory { - - /** - * Determines which result event factory should be used for each bean invoking action created by this factory. - */ - private ResultEventFactorySelector resultEventFactorySelector = new ResultEventFactorySelector(); - - /** - * Returns the strategy for calculating the result event factory to configure for each bean invoking action created - * by this factory. - */ - public ResultEventFactorySelector getResultEventFactorySelector() { - return resultEventFactorySelector; - } - - /** - * Sets the strategy to calculate the result event factory to configure for each bean invoking action created by - * this factory. - */ - public void setResultEventFactorySelector(ResultEventFactorySelector resultEventFactorySelector) { - this.resultEventFactorySelector = resultEventFactorySelector; - } - - /** - * Factory method that creates a bean invoking action, an adapter that adapts a method on an abitrary {@link Object} - * to the {@link Action} interface. This method is an atomic operation that returns a fully initialized Action. It - * encapsulates the selection of the action implementation as well as the action assembly. - * @param beanId the id of the bean to be adapted to an Action instance - * @param beanFactory the bean factory where the bean is managed - * @param methodSignature the method to invoke on the bean when the action is executed (required) - * @param resultExposer the specification for what to do with the method return value (optional) - * @param conversionService the conversion service to be used to convert method parameters (optional) - * @param attributes attributes that may be used to affect the bean invoking action's construction - * @return the fully configured bean invoking action instance - */ - public Action createBeanInvokingAction(String beanId, BeanFactory beanFactory, MethodSignature methodSignature, - ActionResultExposer resultExposer, ConversionService conversionService, AttributeMap attributes) { - Object bean = beanFactory.getBean(beanId); - AbstractBeanInvokingAction action = new LocalBeanInvokingAction(methodSignature, bean); - action.setMethodResultExposer(resultExposer); - MethodKey methodKey = new MethodKey(bean.getClass(), methodSignature.getMethodName(), methodSignature - .getParameters().getTypesArray()); - action.setResultEventFactory(resultEventFactorySelector.forMethod(methodKey.getMethod())); - action.setConversionService(conversionService); - return action; - } -} \ No newline at end of file diff --git a/spring-webflow/src/main/java/org/springframework/webflow/action/CompositeAction.java b/spring-webflow/src/main/java/org/springframework/webflow/action/CompositeAction.java index 5e4dea6e..19162b80 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/action/CompositeAction.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/action/CompositeAction.java @@ -1,5 +1,5 @@ /* - * Copyright 2004-2007 the original author or authors. + * Copyright 2004-2008 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-webflow/src/main/java/org/springframework/webflow/action/DefaultMultiActionMethodResolver.java b/spring-webflow/src/main/java/org/springframework/webflow/action/DefaultMultiActionMethodResolver.java index 1fdcdcfc..1177c047 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/action/DefaultMultiActionMethodResolver.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/action/DefaultMultiActionMethodResolver.java @@ -1,5 +1,5 @@ /* - * Copyright 2004-2007 the original author or authors. + * Copyright 2004-2008 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-webflow/src/main/java/org/springframework/webflow/action/DispatchMethodInvoker.java b/spring-webflow/src/main/java/org/springframework/webflow/action/DispatchMethodInvoker.java index a0dcc025..6d5a52b5 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/action/DispatchMethodInvoker.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/action/DispatchMethodInvoker.java @@ -1,5 +1,5 @@ /* - * Copyright 2004-2007 the original author or authors. + * Copyright 2004-2008 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-webflow/src/main/java/org/springframework/webflow/action/EvaluateAction.java b/spring-webflow/src/main/java/org/springframework/webflow/action/EvaluateAction.java index b6e738e1..6a149e98 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/action/EvaluateAction.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/action/EvaluateAction.java @@ -1,5 +1,5 @@ /* - * Copyright 2004-2007 the original author or authors. + * Copyright 2004-2008 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-webflow/src/main/java/org/springframework/webflow/action/EventFactorySupport.java b/spring-webflow/src/main/java/org/springframework/webflow/action/EventFactorySupport.java index 6e805831..6d8710cf 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/action/EventFactorySupport.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/action/EventFactorySupport.java @@ -1,5 +1,5 @@ /* - * Copyright 2004-2007 the original author or authors. + * Copyright 2004-2008 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-webflow/src/main/java/org/springframework/webflow/action/ExternalRedirectAction.java b/spring-webflow/src/main/java/org/springframework/webflow/action/ExternalRedirectAction.java index df381ad6..b09c6a93 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/action/ExternalRedirectAction.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/action/ExternalRedirectAction.java @@ -1,3 +1,18 @@ +/* + * Copyright 2004-2008 the original author or authors. + * + * 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.springframework.webflow.action; import org.springframework.binding.expression.Expression; @@ -5,10 +20,19 @@ import org.springframework.util.Assert; import org.springframework.webflow.execution.Event; import org.springframework.webflow.execution.RequestContext; +/** + * An action that sends an external redirect when executed. + * + * @author Keith Donald + */ public class ExternalRedirectAction extends AbstractAction { private Expression resourceUri; + /** + * Creates a new external redirect action + * @param resourceUri an expression for the resource Uri to redirect to + */ public ExternalRedirectAction(Expression resourceUri) { Assert.notNull(resourceUri, "The URI of the resource to redirect to is required"); this.resourceUri = resourceUri; diff --git a/spring-webflow/src/main/java/org/springframework/webflow/action/FlowDefinitionRedirectAction.java b/spring-webflow/src/main/java/org/springframework/webflow/action/FlowDefinitionRedirectAction.java index 291cfa92..49e853f7 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/action/FlowDefinitionRedirectAction.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/action/FlowDefinitionRedirectAction.java @@ -1,3 +1,18 @@ +/* + * Copyright 2004-2008 the original author or authors. + * + * 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.springframework.webflow.action; import org.springframework.binding.expression.Expression; @@ -7,9 +22,19 @@ import org.springframework.webflow.core.collection.LocalAttributeMap; import org.springframework.webflow.execution.Event; import org.springframework.webflow.execution.RequestContext; +/** + * An action that sends a flow definition redirect when executed. + * + * @author Keith Donald + */ public class FlowDefinitionRedirectAction extends AbstractAction { + private Expression expression; + /** + * Creates a new flow definition redirect action. + * @param expression a encoded flow redirect expression + */ public FlowDefinitionRedirectAction(Expression expression) { Assert.notNull(expression, "The flow definition redirect expression is required"); this.expression = expression; diff --git a/spring-webflow/src/main/java/org/springframework/webflow/action/FormAction.java b/spring-webflow/src/main/java/org/springframework/webflow/action/FormAction.java index 32519bbf..1a940bbd 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/action/FormAction.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/action/FormAction.java @@ -1,5 +1,5 @@ /* - * Copyright 2004-2007 the original author or authors. + * Copyright 2004-2008 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -35,8 +35,8 @@ import org.springframework.webflow.execution.RequestContext; import org.springframework.webflow.execution.ScopeType; /** - * Multi-action that implements common logic dealing with input forms. This class leverages the Spring Web data binding - * code to do binding and validation. + * Multi-action that implements common logic dealing with input forms. This class uses the Spring Web data binding code + * to do binding and validation. *

* Several action execution methods are provided: *