From a76902ac6a1cf0a2ec9d10f8cec6b89970c6a5ab Mon Sep 17 00:00:00 2001 From: Vadim Dubs Date: Thu, 19 Jan 2017 18:32:13 +0600 Subject: [PATCH] Version 1.3.5 --- flower-core/pom.xml | 4 +-- flower-spring/pom.xml | 4 +-- .../impl/DefaultActionDefinitionFactory.java | 22 +++++++-------- .../spring/impl/DefaultActionFactory.java | 6 ++-- .../spring/impl/DefaultExtensionFactory.java | 13 ++++++--- .../spring/impl/DefaultFeatureFactory.java | 6 ++-- .../spring/impl/MiddlewareDefinition.java | 23 +++++++-------- .../spring/impl/flows/AsyncFlowFactory.java | 7 ++++- .../spring/impl/flows/SyncFlowFactory.java | 4 ++- .../selectors/KeywordSelectorFactory.java | 4 ++- .../test/resources/application-context.xml | 12 ++++---- .../test/resources/features/email-feature.xml | 28 +++++++++---------- .../test/resources/features/sms-feature.xml | 22 +++++++-------- flower-tools/pom.xml | 2 +- pom.xml | 2 +- 15 files changed, 89 insertions(+), 70 deletions(-) diff --git a/flower-core/pom.xml b/flower-core/pom.xml index 7117993..7d4ef67 100644 --- a/flower-core/pom.xml +++ b/flower-core/pom.xml @@ -9,14 +9,14 @@ com.github.xdcrafts flower .. - 1.3.4 + 1.3.5 com.github.xdcrafts flower-tools - 1.3.4 + 1.3.5 junit diff --git a/flower-spring/pom.xml b/flower-spring/pom.xml index 5502c1d..5db7ab1 100644 --- a/flower-spring/pom.xml +++ b/flower-spring/pom.xml @@ -9,14 +9,14 @@ com.github.xdcrafts flower .. - 1.3.4 + 1.3.5 com.github.xdcrafts flower-core - 1.3.4 + 1.3.5 org.springframework diff --git a/flower-spring/src/main/java/com/github/xdcrafts/flower/spring/impl/DefaultActionDefinitionFactory.java b/flower-spring/src/main/java/com/github/xdcrafts/flower/spring/impl/DefaultActionDefinitionFactory.java index 442b6d8..91a4172 100644 --- a/flower-spring/src/main/java/com/github/xdcrafts/flower/spring/impl/DefaultActionDefinitionFactory.java +++ b/flower-spring/src/main/java/com/github/xdcrafts/flower/spring/impl/DefaultActionDefinitionFactory.java @@ -17,8 +17,9 @@ package com.github.xdcrafts.flower.spring.impl; import org.springframework.beans.BeansException; +import org.springframework.beans.MutablePropertyValues; +import org.springframework.beans.factory.annotation.Required; import org.springframework.beans.factory.config.ConfigurableListableBeanFactory; -import org.springframework.beans.factory.config.ConstructorArgumentValues; import org.springframework.beans.factory.support.BeanDefinitionRegistry; import org.springframework.beans.factory.support.BeanDefinitionRegistryPostProcessor; import org.springframework.beans.factory.support.GenericBeanDefinition; @@ -31,16 +32,15 @@ */ public class DefaultActionDefinitionFactory implements BeanDefinitionRegistryPostProcessor { - private final String namespace; - private final Map actions; + private String namespace; + private Map actions; - public DefaultActionDefinitionFactory(Map actions) { - this.namespace = null; - this.actions = actions; + public void setNamespace(String namespace) { + this.namespace = namespace; } - public DefaultActionDefinitionFactory(String namespace, Map actions) { - this.namespace = namespace; + @Required + public void setActions(Map actions) { this.actions = actions; } @@ -50,11 +50,11 @@ public void postProcessBeanDefinitionRegistry(BeanDefinitionRegistry registry) t final String name = entry.getKey(); final String qualifiedName = Named.qualifiedName(this.namespace, name); final Object method = entry.getValue(); - final ConstructorArgumentValues constructorArgumentValues = new ConstructorArgumentValues(); - constructorArgumentValues.addGenericArgumentValue(method); + final MutablePropertyValues propertyValues = new MutablePropertyValues(); + propertyValues.add("method", method); final GenericBeanDefinition beanDefinition = new GenericBeanDefinition(); beanDefinition.setBeanClass(DefaultActionFactory.class); - beanDefinition.setConstructorArgumentValues(constructorArgumentValues); + beanDefinition.setPropertyValues(propertyValues); registry.registerBeanDefinition(qualifiedName, beanDefinition); }); } diff --git a/flower-spring/src/main/java/com/github/xdcrafts/flower/spring/impl/DefaultActionFactory.java b/flower-spring/src/main/java/com/github/xdcrafts/flower/spring/impl/DefaultActionFactory.java index a48e0cf..64c530e 100644 --- a/flower-spring/src/main/java/com/github/xdcrafts/flower/spring/impl/DefaultActionFactory.java +++ b/flower-spring/src/main/java/com/github/xdcrafts/flower/spring/impl/DefaultActionFactory.java @@ -17,6 +17,7 @@ package com.github.xdcrafts.flower.spring.impl; import com.github.xdcrafts.flower.core.impl.actions.DefaultAction; +import org.springframework.beans.factory.annotation.Required; /** * Spring factory bean for default action that uses bean name as action name. @@ -25,9 +26,10 @@ public class DefaultActionFactory extends AbstractActionFactoryBean { - private final String method; + private String method; - public DefaultActionFactory(String method) { + @Required + public void setMethod(String method) { this.method = method; } diff --git a/flower-spring/src/main/java/com/github/xdcrafts/flower/spring/impl/DefaultExtensionFactory.java b/flower-spring/src/main/java/com/github/xdcrafts/flower/spring/impl/DefaultExtensionFactory.java index eccb05f..18d22bb 100644 --- a/flower-spring/src/main/java/com/github/xdcrafts/flower/spring/impl/DefaultExtensionFactory.java +++ b/flower-spring/src/main/java/com/github/xdcrafts/flower/spring/impl/DefaultExtensionFactory.java @@ -20,6 +20,7 @@ import com.github.xdcrafts.flower.core.Middleware; import com.github.xdcrafts.flower.core.impl.actions.DefaultAction; import com.github.xdcrafts.flower.core.impl.extensions.DefaultExtension; +import org.springframework.beans.factory.annotation.Required; import java.security.SecureRandom; import java.util.Collections; @@ -34,17 +35,21 @@ public class DefaultExtensionFactory extends AbstractActionFactoryBean { - private final Map extensions; + private Map extensions; - public DefaultFeatureFactory(Map extensions) { + @Required + public void setExtensions(Map extensions) { this.extensions = extensions; } diff --git a/flower-spring/src/main/java/com/github/xdcrafts/flower/spring/impl/MiddlewareDefinition.java b/flower-spring/src/main/java/com/github/xdcrafts/flower/spring/impl/MiddlewareDefinition.java index 29b6bbf..4df7200 100644 --- a/flower-spring/src/main/java/com/github/xdcrafts/flower/spring/impl/MiddlewareDefinition.java +++ b/flower-spring/src/main/java/com/github/xdcrafts/flower/spring/impl/MiddlewareDefinition.java @@ -17,6 +17,7 @@ package com.github.xdcrafts.flower.spring.impl; import org.springframework.beans.BeansException; +import org.springframework.beans.factory.annotation.Required; import org.springframework.context.ApplicationContext; import org.springframework.context.ApplicationContextAware; import com.github.xdcrafts.flower.core.Middleware; @@ -38,24 +39,24 @@ private static List split(String string) { return Arrays.stream(string.split(SPLITTER_REGEX)).map(String::trim).collect(Collectors.toList()); } - private final boolean shared; - private final String namespace; - private final Map rawDefinition; + private boolean shared = true; + private String namespace; + private Map rawDefinition; private Map> definition; - public MiddlewareDefinition(boolean shared, Map definition) { - this(shared, null, definition); + public void setShared(boolean shared) { + this.shared = shared; } - public MiddlewareDefinition(boolean shared, String namespace, Map definition) { - if (definition == null) { - throw new IllegalArgumentException("'definition' can not be null."); - } - this.shared = shared; - this.rawDefinition = definition; + public void setNamespace(String namespace) { this.namespace = namespace; } + @Required + public void setDefinition(Map definition) { + this.rawDefinition = definition; + } + public boolean isShared() { return shared; } diff --git a/flower-spring/src/main/java/com/github/xdcrafts/flower/spring/impl/flows/AsyncFlowFactory.java b/flower-spring/src/main/java/com/github/xdcrafts/flower/spring/impl/flows/AsyncFlowFactory.java index fb24d65..f03d6a0 100644 --- a/flower-spring/src/main/java/com/github/xdcrafts/flower/spring/impl/flows/AsyncFlowFactory.java +++ b/flower-spring/src/main/java/com/github/xdcrafts/flower/spring/impl/flows/AsyncFlowFactory.java @@ -17,6 +17,7 @@ package com.github.xdcrafts.flower.spring.impl.flows; import com.github.xdcrafts.flower.core.impl.flows.AsyncFlow; +import org.springframework.beans.factory.annotation.Required; import java.util.List; import java.util.Map; @@ -30,8 +31,12 @@ public class AsyncFlowFactory extends AbstractFlowFactoryBean { private List actions; private Map configuration; - public AsyncFlowFactory(List actions, Map configuration) { + public void setActions(List actions) { this.actions = actions; + } + + @Required + public void setConfiguration(Map configuration) { this.configuration = configuration; } diff --git a/flower-spring/src/main/java/com/github/xdcrafts/flower/spring/impl/flows/SyncFlowFactory.java b/flower-spring/src/main/java/com/github/xdcrafts/flower/spring/impl/flows/SyncFlowFactory.java index 8dc70d8..e171951 100644 --- a/flower-spring/src/main/java/com/github/xdcrafts/flower/spring/impl/flows/SyncFlowFactory.java +++ b/flower-spring/src/main/java/com/github/xdcrafts/flower/spring/impl/flows/SyncFlowFactory.java @@ -17,6 +17,7 @@ package com.github.xdcrafts.flower.spring.impl.flows; import com.github.xdcrafts.flower.core.impl.flows.SyncFlow; +import org.springframework.beans.factory.annotation.Required; import java.util.List; import java.util.stream.Collectors; @@ -28,7 +29,8 @@ public class SyncFlowFactory extends AbstractFlowFactoryBean { private List actions; - public SyncFlowFactory(List actions) { + @Required + public void setActions(List actions) { this.actions = actions; } diff --git a/flower-spring/src/main/java/com/github/xdcrafts/flower/spring/impl/selectors/KeywordSelectorFactory.java b/flower-spring/src/main/java/com/github/xdcrafts/flower/spring/impl/selectors/KeywordSelectorFactory.java index e0b9134..344969d 100644 --- a/flower-spring/src/main/java/com/github/xdcrafts/flower/spring/impl/selectors/KeywordSelectorFactory.java +++ b/flower-spring/src/main/java/com/github/xdcrafts/flower/spring/impl/selectors/KeywordSelectorFactory.java @@ -18,6 +18,7 @@ import com.github.xdcrafts.flower.core.impl.selectors.KeywordSelector; import com.github.xdcrafts.flower.spring.impl.AbstractActionFactoryBean; +import org.springframework.beans.factory.annotation.Required; /** * KeywordSelector factory bean. @@ -26,7 +27,8 @@ public class KeywordSelectorFactory extends AbstractActionFactoryBean - - + + - + @@ -91,7 +91,7 @@ - + @@ -99,13 +99,13 @@ - + authenticator::authenticate receiver::receive - + diff --git a/flower-spring/src/test/resources/features/email-feature.xml b/flower-spring/src/test/resources/features/email-feature.xml index 642905e..d76804d 100644 --- a/flower-spring/src/test/resources/features/email-feature.xml +++ b/flower-spring/src/test/resources/features/email-feature.xml @@ -37,13 +37,13 @@ - - - + + + - + @@ -51,14 +51,14 @@ - - + + - + @@ -66,13 +66,13 @@ - + - + @@ -80,22 +80,22 @@ - - + + - + - + - + diff --git a/flower-spring/src/test/resources/features/sms-feature.xml b/flower-spring/src/test/resources/features/sms-feature.xml index d1ca6cc..9b3a295 100644 --- a/flower-spring/src/test/resources/features/sms-feature.xml +++ b/flower-spring/src/test/resources/features/sms-feature.xml @@ -19,13 +19,13 @@ - - - + + + - + @@ -33,13 +33,13 @@ - + sms.RequestValidator::validate sms.Authorizer::authorize sms.Sender::send - + @@ -48,22 +48,22 @@ - - + + - + - + - + diff --git a/flower-tools/pom.xml b/flower-tools/pom.xml index e856c1e..c1b326f 100644 --- a/flower-tools/pom.xml +++ b/flower-tools/pom.xml @@ -9,7 +9,7 @@ com.github.xdcrafts flower .. - 1.3.4 + 1.3.5 diff --git a/pom.xml b/pom.xml index 12314db..6a8408c 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ com.github.xdcrafts flower pom - 1.3.4 + 1.3.5 ${project.groupId}:${project.artifactId} Data-driven workflows with Java. https://github.com/xdcrafts/flower