From bfa6b0cd3926ebd1aa0bf2b49f2d92e4156eafbd Mon Sep 17 00:00:00 2001 From: Keith Donald Date: Wed, 14 May 2008 03:22:35 +0000 Subject: [PATCH] message system polish --- .../binding/message/DefaultMessageContext.java | 8 +++++--- .../binding/message/StateManageableMessageContext.java | 3 ++- ...tFactoryTests.java => DefaultMessageContextTests.java} | 2 +- .../webflow/engine/impl/FlowExecutionImplFactory.java | 8 +++----- 4 files changed, 11 insertions(+), 10 deletions(-) rename spring-binding/src/test/java/org/springframework/binding/message/{DefaultMessageContextFactoryTests.java => DefaultMessageContextTests.java} (98%) diff --git a/spring-binding/src/main/java/org/springframework/binding/message/DefaultMessageContext.java b/spring-binding/src/main/java/org/springframework/binding/message/DefaultMessageContext.java index 6587f5ab..a5639bdc 100644 --- a/spring-binding/src/main/java/org/springframework/binding/message/DefaultMessageContext.java +++ b/spring-binding/src/main/java/org/springframework/binding/message/DefaultMessageContext.java @@ -34,7 +34,8 @@ import org.springframework.core.style.ToStringCreator; import org.springframework.util.CachingMapDecorator; /** - * Default message context implementation. + * The default message context implementation. Uses a {@link MessageSource} to resolve messages that are added by + * callers. * * @author Keith Donald */ @@ -51,7 +52,8 @@ public class DefaultMessageContext implements StateManageableMessageContext { }; /** - * Creates a new default message context. + * Creates a new default message context. Defaults to a message source that simply resolves default text and cannot + * resolve localized message codes. */ public DefaultMessageContext() { init(null); @@ -59,7 +61,7 @@ public class DefaultMessageContext implements StateManageableMessageContext { /** * Creates a new default message context. - * @param messageSource the message source to resolve messages added to this context (may be null) + * @param messageSource the message source to resolve messages added to this context */ public DefaultMessageContext(MessageSource messageSource) { init(messageSource); diff --git a/spring-binding/src/main/java/org/springframework/binding/message/StateManageableMessageContext.java b/spring-binding/src/main/java/org/springframework/binding/message/StateManageableMessageContext.java index 0a943c81..fb0dccac 100644 --- a/spring-binding/src/main/java/org/springframework/binding/message/StateManageableMessageContext.java +++ b/spring-binding/src/main/java/org/springframework/binding/message/StateManageableMessageContext.java @@ -42,7 +42,8 @@ public interface StateManageableMessageContext extends MessageContext { public void restoreMessages(Serializable messagesMemento); /** - * Configure the message source used to resolve messages added to this context. + * Configure the message source used to resolve messages added to this context. May be set at any time to change how + * coded messages are resolved. * @param messageSource the message source * @see MessageContext#addMessage(MessageResolver) */ diff --git a/spring-binding/src/test/java/org/springframework/binding/message/DefaultMessageContextFactoryTests.java b/spring-binding/src/test/java/org/springframework/binding/message/DefaultMessageContextTests.java similarity index 98% rename from spring-binding/src/test/java/org/springframework/binding/message/DefaultMessageContextFactoryTests.java rename to spring-binding/src/test/java/org/springframework/binding/message/DefaultMessageContextTests.java index 3f2d53fa..d856c23f 100644 --- a/spring-binding/src/test/java/org/springframework/binding/message/DefaultMessageContextFactoryTests.java +++ b/spring-binding/src/test/java/org/springframework/binding/message/DefaultMessageContextTests.java @@ -7,7 +7,7 @@ import junit.framework.TestCase; import org.springframework.context.support.StaticMessageSource; -public class DefaultMessageContextFactoryTests extends TestCase { +public class DefaultMessageContextTests extends TestCase { private DefaultMessageContext context; protected void setUp() { diff --git a/spring-webflow/src/main/java/org/springframework/webflow/engine/impl/FlowExecutionImplFactory.java b/spring-webflow/src/main/java/org/springframework/webflow/engine/impl/FlowExecutionImplFactory.java index bbb5245f..478388d7 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/engine/impl/FlowExecutionImplFactory.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/engine/impl/FlowExecutionImplFactory.java @@ -54,7 +54,6 @@ public class FlowExecutionImplFactory implements FlowExecutionFactory { * @param executionAttributes flow execution system attributes */ public void setExecutionAttributes(AttributeMap executionAttributes) { - Assert.notNull(executionAttributes, "The execution attributes map is required"); this.executionAttributes = executionAttributes; } @@ -63,7 +62,6 @@ public class FlowExecutionImplFactory implements FlowExecutionFactory { * over what listeners should apply for executions of a flow definition. */ public void setExecutionListenerLoader(FlowExecutionListenerLoader executionListenerLoader) { - Assert.notNull(executionListenerLoader, "The execution listener loader is required"); this.executionListenerLoader = executionListenerLoader; } @@ -75,7 +73,7 @@ public class FlowExecutionImplFactory implements FlowExecutionFactory { } public FlowExecution createFlowExecution(FlowDefinition flowDefinition) { - Assert.isInstanceOf(Flow.class, flowDefinition, "FlowDefinition is of wrong type: "); + Assert.isInstanceOf(Flow.class, flowDefinition, "FlowDefinition is of the wrong type: "); if (logger.isDebugEnabled()) { logger.debug("Creating new execution of '" + flowDefinition.getId() + "'"); } @@ -89,8 +87,8 @@ public class FlowExecutionImplFactory implements FlowExecutionFactory { public FlowExecution restoreFlowExecution(FlowExecution flowExecution, FlowDefinition flowDefinition, FlowExecutionKey flowExecutionKey, MutableAttributeMap conversationScope, FlowDefinitionLocator subflowDefinitionLocator) { - Assert.isInstanceOf(FlowExecutionImpl.class, flowExecution, "FlowExecution is of wrong type: "); - Assert.isInstanceOf(Flow.class, flowDefinition, "FlowDefinition is of wrong type: "); + Assert.isInstanceOf(FlowExecutionImpl.class, flowExecution, "FlowExecution is of the wrong type: "); + Assert.isInstanceOf(Flow.class, flowDefinition, "FlowDefinition is of the wrong type: "); FlowExecutionImpl execution = (FlowExecutionImpl) flowExecution; Flow flow = (Flow) flowDefinition; execution.setFlow(flow);