diff --git a/integration/pom.xml b/integration/pom.xml deleted file mode 100644 index 61b325c..0000000 --- a/integration/pom.xml +++ /dev/null @@ -1,52 +0,0 @@ - - - 4.0.0 - - - org.springframework.plugin - spring-plugin - 1.1.0.BUILD-SNAPSHOT - - - spring-plugin-integration - - Spring Plugin - Spring Integration integration - - - 2.1.4.RELEASE - - - - - ${project.groupId} - spring-plugin-core - ${project.version} - - - - org.springframework.integration - spring-integration-core - ${spring.integration.version} - - - - org.springframework - spring-context - ${spring.version} - - - - org.springframework - spring-beans - ${spring.version} - - - - org.springframework - spring-test - ${spring.version} - test - - - - diff --git a/integration/src/main/java/org/springframework/plugin/integration/PluginRegistryAwareMessageHandler.java b/integration/src/main/java/org/springframework/plugin/integration/PluginRegistryAwareMessageHandler.java deleted file mode 100644 index b9d3f82..0000000 --- a/integration/src/main/java/org/springframework/plugin/integration/PluginRegistryAwareMessageHandler.java +++ /dev/null @@ -1,295 +0,0 @@ -/* - * Copyright 2011-2012 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.plugin.integration; - -import java.lang.reflect.Method; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.List; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.springframework.core.GenericTypeResolver; -import org.springframework.core.Ordered; -import org.springframework.core.annotation.Order; -import org.springframework.expression.Expression; -import org.springframework.expression.spel.standard.SpelExpressionParser; -import org.springframework.expression.spel.support.StandardEvaluationContext; -import org.springframework.integration.Message; -import org.springframework.integration.MessageHandlingException; -import org.springframework.integration.handler.AbstractReplyProducingMessageHandler; -import org.springframework.plugin.core.OrderAwarePluginRegistry; -import org.springframework.plugin.core.Plugin; -import org.springframework.plugin.core.PluginRegistry; -import org.springframework.util.Assert; -import org.springframework.util.ObjectUtils; -import org.springframework.util.ReflectionUtils; -import org.springframework.util.StringUtils; - -/** - * Dynamic service activator that uses a {@link PluginRegistry} to delegate execution to one or more plugins matching a - * delimiter. - * - * @author Oliver Gierke - */ -public class PluginRegistryAwareMessageHandler extends AbstractReplyProducingMessageHandler { - - private static final Log LOG = LogFactory.getLog(PluginRegistryAwareMessageHandler.class); - - private final PluginRegistry, Object> registry; - private final Class> pluginType; - private final Class delimiterType; - private final SpelExpressionParser parser = new SpelExpressionParser(); - - private Expression delimiterExpression; - private Expression invocationArgumentsExpression; - private String serviceMethodName; - private PluginLookupMethod pluginLookupMethod = PluginLookupMethod.getDefault(); - - /** - * Creates a new {@link PluginRegistryAwareMessageHandler} for the given {@link PluginRegistry}, pluginType and a - * method name to call. - * - * @param registry - * @param pluginType - * @param serviceMethodName - */ - @SuppressWarnings("unchecked") - public PluginRegistryAwareMessageHandler(PluginRegistry, ?> registry, - Class> pluginType, String serviceMethodName) { - - Assert.notNull(registry); - Assert.notNull(pluginType); - Assert.hasText(serviceMethodName); - - this.registry = (PluginRegistry, Object>) registry; - this.serviceMethodName = serviceMethodName; - this.pluginType = pluginType; - this.delimiterType = GenericTypeResolver.resolveTypeArgument(pluginType, Plugin.class); - - verify(); - } - - private final void verify() { - - boolean methodFound = false; - - for (Method candidate : pluginType.getMethods()) { - if (candidate.getName().equals(serviceMethodName)) { - methodFound = true; - break; - } - } - - if (!methodFound) { - throw new IllegalArgumentException(String.format("Not method %s found for type %s!", serviceMethodName, - pluginType)); - } - } - - /** - * Sets the SpEL expression to extract the delimiter from the {@link Message}. - * - * @param delimiterExpression the delimiterExpression to set - */ - public void setDelimiterExpression(String expression) { - - Assert.hasText(expression); - this.delimiterExpression = parser.parseExpression(expression); - } - - /** - * Sets the SpEL expression to extract the method arguments for the actual plugin method invocation from the - * {@link Message}. - * - * @param invocationArgumentsExpression the invocationArgumentsExpression to set - */ - public void setInvocationArgumentsExpression(String expression) { - - Assert.hasText(expression); - this.invocationArgumentsExpression = parser.parseExpression(expression); - } - - /** - * Configures the method to be used when looking up plugins to invoke. - * - * @see PluginLookupMethod - * @param pluginLookupMethod the invocationMethod to set - */ - public void setPluginLookupMethod(PluginLookupMethod pluginLookupMethod) { - this.pluginLookupMethod = pluginLookupMethod == null ? PluginLookupMethod.getDefault() : pluginLookupMethod; - } - - /* - * (non-Javadoc) - * - * @see - * org.springframework.integration.handler.AbstractReplyProducingMessageHandler - * #handleRequestMessage(org.springframework.integration.Message) - */ - @SuppressWarnings("unchecked") - @Override - protected Object handleRequestMessage(Message requestMessage) { - - Object delimiter = getDelimiter(requestMessage); - - switch (pluginLookupMethod) { - - case ALL: - if (LOG.isDebugEnabled()) { - LOG.debug(String.format("Looking up plugins for delimiter %s", delimiter)); - } - return invokePlugins(registry.getPluginsFor(delimiter), requestMessage); - - case ONE: - if (LOG.isDebugEnabled()) { - LOG.debug(String.format("Looking up plugin for delimiter %s", delimiter)); - } - List results = invokePlugins(Arrays.asList(registry.getPluginFor(delimiter)), requestMessage); - return results.isEmpty() ? null : results.get(0); - - default: - throw new IllegalStateException(String.format("Unsupported plugin lookup method %s!", pluginLookupMethod)); - } - } - - private List invokePlugins(Collection> plugins, Message message) { - - List results = new ArrayList(); - if (LOG.isDebugEnabled()) { - LOG.debug(String.format("Invoking plugin(s) %s with message %s", - StringUtils.collectionToCommaDelimitedString(plugins), message)); - } - - for (Plugin plugin : plugins) { - - Object[] invocationArguments = getInvocationArguments(message); - Class[] types = getTypes(invocationArguments); - - Method businessMethod = ReflectionUtils.findMethod(pluginType, serviceMethodName, types); - - if (businessMethod == null) { - throw new MessageHandlingException(message, String.format( - "Did not find a method %s on %s taking the following parameters %s", serviceMethodName, - pluginType.getName(), Arrays.toString(types))); - } - - if (LOG.isDebugEnabled()) { - LOG.debug(String.format("Invoke plugin method %s using arguments %s", businessMethod, - Arrays.toString(invocationArguments))); - } - - Object result = ReflectionUtils.invokeMethod(businessMethod, plugin, invocationArguments); - - if (!businessMethod.getReturnType().equals(void.class)) { - results.add(result); - } - } - - return results; - } - - /** - * Returns the delimiter object to be used for the given {@link Message}. Will use the configured delimiter expression - * if configured. - * - * @param message - * @return - */ - private Object getDelimiter(Message message) { - - Object delimiter = message; - - if (delimiterExpression != null) { - StandardEvaluationContext context = new StandardEvaluationContext(message); - delimiter = delimiterExpression.getValue(context); - } - - Assert.isInstanceOf(delimiterType, delimiter, String.format("Delimiter expression did " - + "not return a suitable delimiter! Make sure the expression evaluates to a suitable " - + "type! Got %s but need %s", delimiter.getClass(), delimiterType)); - - return delimiter; - } - - /** - * Returns the actual arguments to be used for the plugin method invocation. Will apply the configured invocation - * argument expression to the given {@link Message}. - * - * @param message - * @return - */ - private Object[] getInvocationArguments(Message message) { - - if (invocationArgumentsExpression == null) { - return new Object[] { message }; - } - - StandardEvaluationContext context = new StandardEvaluationContext(message); - Object result = delimiterExpression.getValue(context); - - return ObjectUtils.isArray(result) ? ObjectUtils.toObjectArray(result) : new Object[] { result }; - } - - /** - * Returns an array of types for the given objects. Inspects each element of the array for its type. will return - * {@literal null} for {@literal null} source values. - * - * @param source - * @return - */ - private Class[] getTypes(Object[] source) { - - Class[] result = new Class[source.length]; - for (int i = 0; i < source.length; i++) { - Object sourceElement = source[i]; - result[i] = sourceElement == null ? null : sourceElement.getClass(); - } - return result; - } - - /** - * Lookup methods for plugins. - * - * @author Oliver Gierke - */ - private enum PluginLookupMethod { - - /** - * The first plugin supporting a given delimiter found will be invoked. - */ - ONE, - - /** - * All plugins supporting a given delimiter will be invoked. Plugin order will be considered. - * - * @see OrderAwarePluginRegistry - * @see Order - * @see Ordered - */ - ALL; - - /** - * Returns the default {@link PluginLookupMethod}. - * - * @return - */ - static PluginLookupMethod getDefault() { - return ONE; - } - } -} diff --git a/integration/src/main/java/org/springframework/plugin/integration/config/DynamicServiceActivatorParser.java b/integration/src/main/java/org/springframework/plugin/integration/config/DynamicServiceActivatorParser.java deleted file mode 100644 index 9e0332d..0000000 --- a/integration/src/main/java/org/springframework/plugin/integration/config/DynamicServiceActivatorParser.java +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Copyright 2011-2012 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.plugin.integration.config; - -import org.springframework.beans.factory.config.BeanDefinition; -import org.springframework.beans.factory.support.AbstractBeanDefinition; -import org.springframework.beans.factory.support.BeanDefinitionBuilder; -import org.springframework.beans.factory.xml.BeanDefinitionParser; -import org.springframework.beans.factory.xml.ParserContext; -import org.springframework.integration.config.xml.AbstractConsumerEndpointParser; -import org.springframework.plugin.core.support.PluginRegistryFactoryBean; -import org.springframework.plugin.integration.PluginRegistryAwareMessageHandler; -import org.springframework.util.StringUtils; -import org.w3c.dom.Element; - -/** - * {@link BeanDefinitionParser} to create {@link PluginRegistryAwareMessageHandler} beans. - * - * @author Oliver Gierke - */ -public class DynamicServiceActivatorParser extends AbstractConsumerEndpointParser { - - /* - * (non-Javadoc) - * @see org.springframework.integration.config.xml.AbstractConsumerEndpointParser#parseHandler(org.w3c.dom.Element, org.springframework.beans.factory.xml.ParserContext) - */ - @Override - protected BeanDefinitionBuilder parseHandler(Element element, ParserContext parserContext) { - - Object source = parserContext.extractSource(element); - - String pluginType = element.getAttribute("plugin-type"); - String method = element.getAttribute("method"); - - BeanDefinitionBuilder builder = BeanDefinitionBuilder.rootBeanDefinition(PluginRegistryAwareMessageHandler.class); - builder.addConstructorArgValue(getRegistryBeanDefinition(pluginType, source)); - builder.addConstructorArgValue(pluginType); - builder.addConstructorArgValue(method); - - String delimiter = element.getAttribute("delimiter"); - - if (StringUtils.hasText(delimiter)) { - builder.addPropertyValue("delimiterExpression", delimiter); - } - - String invocationArguments = element.getAttribute("invocation-arguments"); - - if (StringUtils.hasText(invocationArguments)) { - builder.addPropertyValue("invocationArgumentsExpression", invocationArguments); - } - - AbstractBeanDefinition definition = builder.getBeanDefinition(); - definition.setSource(source); - - return builder; - } - - /** - * Creates a {@link BeanDefinition} for a {@link PluginRegistryFactoryBean}. - * - * @param pluginType - * @param source - * @return - */ - private AbstractBeanDefinition getRegistryBeanDefinition(String pluginType, Object source) { - - BeanDefinitionBuilder builder = BeanDefinitionBuilder.rootBeanDefinition(PluginRegistryFactoryBean.class); - builder.addPropertyValue("type", pluginType); - - AbstractBeanDefinition definition = builder.getBeanDefinition(); - definition.setSource(source); - return definition; - } -} diff --git a/integration/src/main/java/org/springframework/plugin/integration/config/SpringPluginSpringIntegrationNamespaceHandler.java b/integration/src/main/java/org/springframework/plugin/integration/config/SpringPluginSpringIntegrationNamespaceHandler.java deleted file mode 100644 index a87a142..0000000 --- a/integration/src/main/java/org/springframework/plugin/integration/config/SpringPluginSpringIntegrationNamespaceHandler.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright 2011-2012 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.plugin.integration.config; - -import org.springframework.beans.factory.xml.BeanDefinitionParser; -import org.springframework.beans.factory.xml.NamespaceHandler; -import org.springframework.integration.config.xml.AbstractIntegrationNamespaceHandler; - -/** - * {@link NamespaceHandler} to register {@link BeanDefinitionParser}s. - * - * @author Oliver Gierke - */ -public class SpringPluginSpringIntegrationNamespaceHandler extends AbstractIntegrationNamespaceHandler { - - /* - * (non-Javadoc) - * @see org.springframework.beans.factory.xml.NamespaceHandler#init() - */ - public void init() { - registerBeanDefinitionParser("dynamic-service-activator", new DynamicServiceActivatorParser()); - } -} diff --git a/integration/src/main/resources/META-INF/spring.handlers b/integration/src/main/resources/META-INF/spring.handlers deleted file mode 100644 index fde326d..0000000 --- a/integration/src/main/resources/META-INF/spring.handlers +++ /dev/null @@ -1 +0,0 @@ -http\://www.springframework.org/schema/plugin/integration=org.springframework.plugin.integration.config.SpringPluginSpringIntegrationNamespaceHandler \ No newline at end of file diff --git a/integration/src/main/resources/META-INF/spring.schemas b/integration/src/main/resources/META-INF/spring.schemas deleted file mode 100644 index 9e794dd..0000000 --- a/integration/src/main/resources/META-INF/spring.schemas +++ /dev/null @@ -1 +0,0 @@ -http\://www.springframework.org/schema/plugin/integration/spring-plugin-integration.xsd=org/springframework/plugin/integration/config/spring-plugin-integration.xsd \ No newline at end of file diff --git a/integration/src/main/resources/META-INF/spring.tooling b/integration/src/main/resources/META-INF/spring.tooling deleted file mode 100644 index 597023f..0000000 --- a/integration/src/main/resources/META-INF/spring.tooling +++ /dev/null @@ -1,4 +0,0 @@ -# Tooling related information for the Spring Plugin Integration namespace -http\://www.springframework.org/schema/plugin/integration@name=Spring Plugin Spring Integration Namespace -http\://www.springframework.org/schema/plugin/integration@prefix=int-plugin -http\://www.springframework.org/schema/plugin/integration@icon=org/springframework/beans/factory/xml/spring-beans.gif \ No newline at end of file diff --git a/integration/src/main/resources/org/springframework/plugin/integration/config/spring-plugin-integration.xsd b/integration/src/main/resources/org/springframework/plugin/integration/config/spring-plugin-integration.xsd deleted file mode 100644 index 5d61c3a..0000000 --- a/integration/src/main/resources/org/springframework/plugin/integration/config/spring-plugin-integration.xsd +++ /dev/null @@ -1,90 +0,0 @@ - - - - - - - - - - This service activator will be backed by a Hera Plugin registry that - allows dynamic invocation of Spring beans implementing the plugin - interface defined in "plugin-type". We will dynamically pick up all - Spring beans implementing that interface and create a PluginRegistry - of those. See org.springframework.plugin.integration.PluginRegistryAwareMessageHandler for - details. - - - - - - - The input channel to listen to. - - - - - The type of Spring beans to dynamically pick up. - - - - - The method to be invoked on the plugin(s) selected. - - - - - The output channel to publish invocation results to. - - - - - - A SpEL expression to extract the delimiter to be used from the - incoming Message. If not set the entire Message will be used as - delimiter. - - - - - - - A SpEL expression to extract the arguments for the actual method - invocation. - - - - - - - Defines whether to invoke the first plugin matching the delimiter - (default) or all found. Order of the plugins will be considered. - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/integration/src/test/java/org/springframework/plugin/integration/PluginRegistryAwareMessageHandlerUnitTest.java b/integration/src/test/java/org/springframework/plugin/integration/PluginRegistryAwareMessageHandlerUnitTest.java deleted file mode 100644 index f981414..0000000 --- a/integration/src/test/java/org/springframework/plugin/integration/PluginRegistryAwareMessageHandlerUnitTest.java +++ /dev/null @@ -1,96 +0,0 @@ -/* - * Copyright 2011-2012 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.plugin.integration; - -import static org.hamcrest.CoreMatchers.*; -import static org.junit.Assert.*; -import static org.mockito.Mockito.*; - -import java.util.Arrays; - -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.ArgumentCaptor; -import org.mockito.Mock; -import org.mockito.Mockito; -import org.mockito.runners.MockitoJUnitRunner; -import org.springframework.integration.Message; -import org.springframework.integration.MessageChannel; -import org.springframework.integration.MessageHandlingException; -import org.springframework.integration.support.MessageBuilder; -import org.springframework.plugin.core.OrderAwarePluginRegistry; -import org.springframework.plugin.core.PluginRegistry; -import org.springframework.plugin.integration.PluginRegistryAwareMessageHandler; -import org.springframework.plugin.integration.sample.FirstSamplePluginImpl; -import org.springframework.plugin.integration.sample.SamplePlugin; -import org.springframework.plugin.integration.sample.SecondSamplePluginImpl; - -/** - * Unit tests for {@link PluginRegistryAwareMessageHandler}. - * - * @author Oliver Gierke - */ -@RunWith(MockitoJUnitRunner.class) -public class PluginRegistryAwareMessageHandlerUnitTest { - - PluginRegistry registry; - PluginRegistryAwareMessageHandler handler; - - @Mock - MessageChannel outputChannel; - - @Before - public void setUp() { - - registry = OrderAwarePluginRegistry - .create(Arrays.asList(new FirstSamplePluginImpl(), new SecondSamplePluginImpl())); - - handler = new PluginRegistryAwareMessageHandler(registry, SamplePlugin.class, "myBusinessMethod"); - handler.setOutputChannel(outputChannel); - } - - @Test - @SuppressWarnings("rawtypes") - public void routesInvocationToFirstpluginIfConfiguredToDoSo() { - - handler.setDelimiterExpression("payload"); - handler.setInvocationArgumentsExpression("payload"); - handler.afterPropertiesSet(); - - Message message = MessageBuilder.withPayload("FOO").build(); - when(outputChannel.send(Mockito.any(Message.class))).thenReturn(true); - - handler.handleMessage(message); - - ArgumentCaptor resultMessage = ArgumentCaptor.forClass(Message.class); - verify(outputChannel).send(resultMessage.capture()); - assertThat(resultMessage.getValue().getPayload().toString(), is("First")); - } - - @Test(expected = MessageHandlingException.class) - public void failsHandlingMessageIfDelimiterTypeDoesNotMatch() { - - Message message = MessageBuilder.withPayload("FOO").build(); - handler.handleMessage(message); - } - - @Test(expected = IllegalArgumentException.class) - public void rejectsInvalidMethodName() { - - new PluginRegistryAwareMessageHandler(registry, SamplePlugin.class, "foo"); - } -} diff --git a/integration/src/test/java/org/springframework/plugin/integration/config/DynamicServiceActivatorNamespaceIntegrationTest.java b/integration/src/test/java/org/springframework/plugin/integration/config/DynamicServiceActivatorNamespaceIntegrationTest.java deleted file mode 100644 index 50f998f..0000000 --- a/integration/src/test/java/org/springframework/plugin/integration/config/DynamicServiceActivatorNamespaceIntegrationTest.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright 2011-2012 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.plugin.integration.config; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Qualifier; -import org.springframework.integration.Message; -import org.springframework.integration.MessageChannel; -import org.springframework.integration.core.SubscribableChannel; -import org.springframework.integration.handler.LoggingHandler; -import org.springframework.integration.support.MessageBuilder; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; - -/** - * Integration test for the namespace. - * - * @author Oliver Gierke - */ -@RunWith(SpringJUnit4ClassRunner.class) -@ContextConfiguration("classpath:dynamic-service-activator-test-context.xml") -public class DynamicServiceActivatorNamespaceIntegrationTest { - - @Autowired - @Qualifier("sampleChannel") - MessageChannel channel; - - @Autowired - @Qualifier("foo") - SubscribableChannel sink; - - @Test - public void invokesPluginBasedOnPayload() { - - sink.subscribe(new LoggingHandler("DEBUG")); - Message message = MessageBuilder.withPayload("FOO").build(); - channel.send(message); - } -} diff --git a/integration/src/test/java/org/springframework/plugin/integration/sample/FirstSamplePluginImpl.java b/integration/src/test/java/org/springframework/plugin/integration/sample/FirstSamplePluginImpl.java deleted file mode 100644 index 5105778..0000000 --- a/integration/src/test/java/org/springframework/plugin/integration/sample/FirstSamplePluginImpl.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright 2011-2012 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.plugin.integration.sample; - -/** - * @author Oliver Gierke - */ -public class FirstSamplePluginImpl implements SamplePlugin { - - /* - * (non-Javadoc) - * @see org.springframework.plugin.core.Plugin#supports(java.lang.Object) - */ - public boolean supports(String delimiter) { - return "FOO".equals(delimiter); - } - - /* - * (non-Javadoc) - * @see org.springframework.plugin.integration.sample.SamplePlugin#myBusinessMethod() - */ - public String myBusinessMethod(String message) { - System.out.println("First plugin invoked! " + message); - return "First"; - } -} diff --git a/integration/src/test/java/org/springframework/plugin/integration/sample/SamplePlugin.java b/integration/src/test/java/org/springframework/plugin/integration/sample/SamplePlugin.java deleted file mode 100644 index a20860b..0000000 --- a/integration/src/test/java/org/springframework/plugin/integration/sample/SamplePlugin.java +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright 2011-2012 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.plugin.integration.sample; - -import org.springframework.plugin.core.Plugin; - -/** - * @author Oliver Gierke - */ -public interface SamplePlugin extends Plugin { - - String myBusinessMethod(String message); -} diff --git a/integration/src/test/java/org/springframework/plugin/integration/sample/SecondSamplePluginImpl.java b/integration/src/test/java/org/springframework/plugin/integration/sample/SecondSamplePluginImpl.java deleted file mode 100644 index 49cd3c0..0000000 --- a/integration/src/test/java/org/springframework/plugin/integration/sample/SecondSamplePluginImpl.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright 2011-2012 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.plugin.integration.sample; - -import org.springframework.core.annotation.Order; - -/** - * Sample implementation of {@link SamplePlugin} supporting {@code BAR} delimiter. - * - * @author Oliver Gierke - */ -@Order(10) -public class SecondSamplePluginImpl implements SamplePlugin { - - /* - * (non-Javadoc) - * @see org.springframework.plugin.core.Plugin#supports(java.lang.Object) - */ - public boolean supports(String delimiter) { - return "BAR".equals(delimiter); - } - - /* - * (non-Javadoc) - * @see org.springframework.plugin.integration.sample.SamplePlugin#myBusinessMethod() - */ - public String myBusinessMethod(String message) { - System.out.println("Second plugin invoked! " + message); - return "Second"; - } -} diff --git a/integration/src/test/java/org/springframework/plugin/integration/sample/ThirdSamplePluginImpl.java b/integration/src/test/java/org/springframework/plugin/integration/sample/ThirdSamplePluginImpl.java deleted file mode 100644 index 811a663..0000000 --- a/integration/src/test/java/org/springframework/plugin/integration/sample/ThirdSamplePluginImpl.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright 2011-2012 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.plugin.integration.sample; - -import org.springframework.core.annotation.Order; - -/** - * Third sample implementation of {@link SamplePlugin} also supporting {@code BAR) but with lower precendence. - * - * @author Oliver Gierke - */ -@Order(20) -class ThirdSamplePluginImpl implements SamplePlugin { - - /* - * (non-Javadoc) - * @see org.springframework.plugin.core.Plugin#supports(java.lang.Object) - */ - public boolean supports(String delimiter) { - return "BAR".equals(delimiter); - } - - /* - * (non-Javadoc) - * @see org.springframework.plugin.integration.sample.SamplePlugin#myBusinessMethod() - */ - public String myBusinessMethod(String message) { - System.out.println("Second plugin invoked! " + message); - return "Third"; - } -} diff --git a/integration/src/test/resources/dynamic-service-activator-test-context.xml b/integration/src/test/resources/dynamic-service-activator-test-context.xml deleted file mode 100644 index 318de7c..0000000 --- a/integration/src/test/resources/dynamic-service-activator-test-context.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - - - - - - - diff --git a/integration/src/test/resources/logback.xml b/integration/src/test/resources/logback.xml deleted file mode 100644 index 3f9fd30..0000000 --- a/integration/src/test/resources/logback.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - %d %5p %40.40c:%4L - %m%n - - - - - - - - - - \ No newline at end of file diff --git a/integration/template.mf b/integration/template.mf deleted file mode 100644 index 8c8c9a5..0000000 --- a/integration/template.mf +++ /dev/null @@ -1,14 +0,0 @@ -Bundle-ManifestVersion: 2 -Bundle-SymbolicName: ${project.artifactId} -Bundle-Name: ${project.name} -Bundle-Vendor: SpringSource, a division of VMware -Bundle-Version: ${project.version} -Bundle-RequiredExecutionEnvironment: J2SE-1.6 -Export-Template: - org.springframework.plugin.integration.*;version="${project.version}" -Import-Template: - org.apache.commons.logging.*;version="[1.1.0,2.0.0)", - org.springframework.*;version="${spring.version:[=.=.=.=,+1.0.0)}", - org.springframework.integration.*;version="${spring.integration.version:[=.=.=.=,+1.0.0)}", - org.springframework.plugin.core.*;version="${project.version:[=.=.=.=,+1.0.0)}", - org.w3c.dom.*;version="0" diff --git a/pom.xml b/pom.xml index a5e1a87..32388f3 100644 --- a/pom.xml +++ b/pom.xml @@ -41,7 +41,6 @@ core metadata - integration @@ -63,7 +62,7 @@ +1 - + @@ -79,7 +78,7 @@ 4.11 test - + org.mockito mockito-all @@ -203,7 +202,7 @@ - + spring-plugins-release