moving osgi module to sandbox
This commit is contained in:
@@ -1,32 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" path="src/main/java"/>
|
||||
<classpathentry kind="src" path="src/main/resources"/>
|
||||
<classpathentry kind="src" output="target/test-classes" path="src/test/java"/>
|
||||
<classpathentry kind="src" path="src/test/resources"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
||||
<classpathentry kind="var" path="IVY_CACHE/org.aspectj/com.springsource.org.aspectj.weaver/1.6.3.RELEASE/com.springsource.org.aspectj.weaver-1.6.3.RELEASE.jar" sourcepath="/IVY_CACHE/org.aspectj/com.springsource.org.aspectj.weaver/1.6.3.RELEASE/com.springsource.org.aspectj.weaver-1.6.3.RELEASE.jar"/>
|
||||
<classpathentry kind="var" path="IVY_CACHE/net.sourceforge.cglib/com.springsource.net.sf.cglib/2.1.3/com.springsource.net.sf.cglib-2.1.3.jar" sourcepath="/IVY_CACHE/net.sourceforge.cglib/com.springsource.net.sf.cglib/2.1.3/com.springsource.net.sf.cglib-sources-2.1.3.jar"/>
|
||||
<classpathentry kind="var" path="IVY_CACHE/org.aopalliance/com.springsource.org.aopalliance/1.0.0/com.springsource.org.aopalliance-1.0.0.jar" sourcepath="/IVY_CACHE/org.aopalliance/com.springsource.org.aopalliance/1.0.0/com.springsource.org.aopalliance-sources-1.0.0.jar"/>
|
||||
<classpathentry kind="var" path="IVY_CACHE/org.apache.commons/com.springsource.org.apache.commons.logging/1.1.1/com.springsource.org.apache.commons.logging-1.1.1.jar" sourcepath="/IVY_CACHE/org.apache.commons/com.springsource.org.apache.commons.logging/1.1.1/com.springsource.org.apache.commons.logging-sources-1.1.1.jar"/>
|
||||
<classpathentry kind="var" path="IVY_CACHE/org.easymock/com.springsource.org.easymock/2.3.0/com.springsource.org.easymock-2.3.0.jar" sourcepath="/IVY_CACHE/org.easymock/com.springsource.org.easymock/2.3.0/com.springsource.org.easymock-sources-2.3.0.jar"/>
|
||||
<classpathentry kind="var" path="IVY_CACHE/org.junit/com.springsource.org.junit/4.7.0/com.springsource.org.junit-4.7.0.jar" sourcepath="/IVY_CACHE/org.junit/com.springsource.org.junit/4.7.0/com.springsource.org.junit-sources-4.7.0.jar"/>
|
||||
<classpathentry kind="var" path="IVY_CACHE/org.mockito/com.springsource.org.mockito/1.8.0/com.springsource.org.mockito-1.8.0.jar" sourcepath="/IVY_CACHE/org.mockito/com.springsource.org.mockito/1.8.0/com.springsource.org.mockito-sources-1.8.0.jar"/>
|
||||
<classpathentry kind="var" path="IVY_CACHE/org.objenesis/com.springsource.org.objenesis/1.0.0/com.springsource.org.objenesis-1.0.0.jar" sourcepath="/IVY_CACHE/org.objenesis/com.springsource.org.objenesis/1.0.0/com.springsource.org.objenesis-sources-1.0.0.jar"/>
|
||||
<classpathentry kind="var" path="IVY_CACHE/org.eclipse.osgi/org.eclipse.osgi/3.5.100.v20090629/org.eclipse.osgi-3.5.100.v20090629.jar" sourcepath="/IVY_CACHE/org.eclipse.osgi/com.springsource.org.objenesis/1.0.0/com.springsource.org.objenesis-sources-1.0.0.jar"/>
|
||||
<classpathentry combineaccessrules="false" kind="src" path="/org.springframework.integration"/>
|
||||
<classpathentry combineaccessrules="false" kind="src" path="/org.springframework.integration.file"/>
|
||||
<classpathentry kind="var" path="IVY_CACHE/org.springframework.osgi/org.springframework.osgi.test/1.2.0/org.springframework.osgi.test-1.2.0.jar" sourcepath="/IVY_CACHE/org.springframework.osgi/org.springframework.osgi.test/1.2.0/org.springframework.osgi.test-sources-1.2.0.jar"/>
|
||||
<classpathentry kind="var" path="IVY_CACHE/org.springframework.osgi/org.springframework.osgi.core/1.2.0/org.springframework.osgi.core-1.2.0.jar" sourcepath="/IVY_CACHE/org.springframework.osgi/org.springframework.osgi.core/1.2.0/org.springframework.osgi.core-sources-1.2.0.jar"/>
|
||||
<classpathentry kind="var" path="IVY_CACHE/org.springframework.osgi/org.springframework.osgi.io/1.2.0/org.springframework.osgi.io-1.2.0.jar" sourcepath="/IVY_CACHE/org.springframework.osgi/org.springframework.osgi.io/1.2.0/org.springframework.osgi.io-sources-1.2.0.jar"/>
|
||||
<classpathentry kind="var" path="IVY_CACHE/org.objectweb.asm/com.springsource.org.objectweb.asm/3.1.0/com.springsource.org.objectweb.asm-3.1.0.jar"/>
|
||||
<classpathentry kind="var" path="IVY_CACHE/org.springframework.osgi/org.springframework.osgi.mock/1.2.0/org.springframework.osgi.mock-1.2.0.jar" sourcepath="/IVY_CACHE/org.springframework.osgi/org.springframework.osgi.mock/1.2.0/org.springframework.osgi.mock-sources-1.2.0.jar"/>
|
||||
<classpathentry kind="var" path="IVY_CACHE/org.apache.log4j/com.springsource.org.apache.log4j/1.2.15/com.springsource.org.apache.log4j-1.2.15.jar" sourcepath="/IVY_CACHE/org.apache.log4j/com.springsource.org.apache.log4j/1.2.15/com.springsource.org.apache.log4j-sources-1.2.15.jar"/>
|
||||
<classpathentry combineaccessrules="false" kind="src" path="/org.springframework.integration.event"/>
|
||||
<classpathentry kind="var" path="IVY_CACHE/org.springframework/org.springframework.beans/3.0.1.RELEASE-A/org.springframework.beans-3.0.1.RELEASE-A.jar" sourcepath="/IVY_CACHE/org.springframework/org.springframework.beans/3.0.1.RELEASE-A/org.springframework.beans-sources-3.0.1.RELEASE-A.jar"/>
|
||||
<classpathentry kind="var" path="IVY_CACHE/org.springframework/org.springframework.context/3.0.1.RELEASE-A/org.springframework.context-3.0.1.RELEASE-A.jar" sourcepath="/IVY_CACHE/org.springframework/org.springframework.context/3.0.1.RELEASE-A/org.springframework.context-sources-3.0.1.RELEASE-A.jar"/>
|
||||
<classpathentry kind="var" path="IVY_CACHE/org.springframework/org.springframework.core/3.0.1.RELEASE-A/org.springframework.core-3.0.1.RELEASE-A.jar" sourcepath="/IVY_CACHE/org.springframework/org.springframework.core/3.0.1.RELEASE-A/org.springframework.core-sources-3.0.1.RELEASE-A.jar"/>
|
||||
<classpathentry kind="var" path="IVY_CACHE/org.springframework/org.springframework.expression/3.0.1.RELEASE-A/org.springframework.expression-3.0.1.RELEASE-A.jar" sourcepath="/IVY_CACHE/org.springframework/org.springframework.expression/3.0.1.RELEASE-A/org.springframework.expression-sources-3.0.1.RELEASE-A.jar"/>
|
||||
<classpathentry kind="var" path="IVY_CACHE/org.springframework/org.springframework.aop/3.0.1.RELEASE-A/org.springframework.aop-3.0.1.RELEASE-A.jar" sourcepath="/IVY_CACHE/org.springframework/org.springframework.aop/3.0.1.RELEASE-A/org.springframework.aop-sources-3.0.1.RELEASE-A.jar"/>
|
||||
<classpathentry kind="output" path="target/classes"/>
|
||||
</classpath>
|
||||
@@ -1,29 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>org.springframework.integration.osgi</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.wst.common.project.facet.core.builder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.springframework.ide.eclipse.core.springbuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.springframework.ide.eclipse.core.springnature</nature>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
||||
@@ -1,9 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project name="org.springframework.integration.osgi">
|
||||
|
||||
<property file="${basedir}/../build.properties"/>
|
||||
<import file="${basedir}/../build-spring-integration/package-bundle.xml"/>
|
||||
<import file="${basedir}/../build-spring-integration/generate-pom.xml"/>
|
||||
<import file="${basedir}/../spring-build/standard/default.xml"/>
|
||||
|
||||
</project>
|
||||
@@ -1,42 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<?xml-stylesheet type="text/xsl" href="http://ivyrep.jayasoft.org/ivy-doc.xsl"?>
|
||||
<ivy-module
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:noNamespaceSchemaLocation="http://incubator.apache.org/ivy/schemas/ivy.xsd"
|
||||
version="1.3">
|
||||
|
||||
<info organisation="org.springframework.integration" module="${ant.project.name}">
|
||||
<license name="Apache 2.0" url="http://www.apache.org/licenses/LICENSE-2.0"/>
|
||||
<ivyauthor name="Oleg Zhurakousky"/>
|
||||
</info>
|
||||
|
||||
<configurations>
|
||||
<include file="${spring.build.dir}/common/default-ivy-configurations.xml"/>
|
||||
</configurations>
|
||||
|
||||
<publications>
|
||||
<artifact name="${ant.project.name}"/>
|
||||
<artifact name="${ant.project.name}-sources" type="src" ext="jar"/>
|
||||
</publications>
|
||||
|
||||
<dependencies>
|
||||
<dependency org="net.sourceforge.cglib" name="com.springsource.net.sf.cglib" rev="2.1.3" conf="test->runtime"/>
|
||||
<dependency org="org.junit" name="com.springsource.org.junit" rev="${junit.version}" conf="test->runtime"/>
|
||||
<dependency org="org.apache.log4j" name="com.springsource.org.apache.log4j" rev="1.2.15" conf="test->runtime"/>
|
||||
<dependency org="org.springframework" name="org.springframework.aop" rev="${spring.version}" conf="compile->runtime"/>
|
||||
<dependency org="org.springframework" name="org.springframework.context" rev="${spring.version}" conf="compile->runtime"/>
|
||||
<dependency org="org.springframework" name="org.springframework.transaction" rev="${spring.version}" conf="compile->runtime"/>
|
||||
<dependency org="org.springframework" name="org.springframework.test" rev="${spring.version}" conf="test->runtime"/>
|
||||
<dependency org="org.mockito" name="com.springsource.org.mockito" rev="${mockito.version}" conf="test->runtime"/>
|
||||
<dependency org="org.aspectj" name="com.springsource.org.aspectj.weaver" rev="1.6.3.RELEASE" conf="compile->runtime"/>
|
||||
<dependency org="org.eclipse.osgi" name="org.eclipse.osgi" rev="3.5.0.v20090311-1300" conf="compile->runtime"/>
|
||||
<dependency org="org.springframework.integration" name="org.springframework.integration" rev="latest.integration" conf="compile->compile"/>
|
||||
<dependency org="org.springframework.integration" name="org.springframework.integration.file" rev="latest.integration" conf="compile->compile"/>
|
||||
<dependency org="org.springframework.osgi" name="org.springframework.osgi.test" rev="1.2.0" conf="compile->compile"/>
|
||||
<dependency org="org.springframework.osgi" name="org.springframework.osgi.mock" rev="1.2.0" conf="compile->compile"/>
|
||||
<dependency org="org.springframework.osgi" name="org.springframework.osgi.io" rev="1.2.0" conf="compile->compile"/>
|
||||
<dependency org="org.springframework.osgi" name="org.springframework.osgi.core" rev="1.2.0" conf="compile->compile"/>
|
||||
<dependency org="org.springframework.integration" name="org.springframework.integration.event" rev="latest.integration" conf="compile->compile"/>
|
||||
</dependencies>
|
||||
|
||||
</ivy-module>
|
||||
@@ -1,52 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>org.springframework.integration</groupId>
|
||||
<artifactId>spring-integration-osgi</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<name>Spring Integration OSGi Extender</name>
|
||||
<parent>
|
||||
<groupId>org.springframework.integration</groupId>
|
||||
<artifactId>spring-integration-parent</artifactId>
|
||||
<version>2.0.0.BUILD-SNAPSHOT</version>
|
||||
<relativePath>../spring-integration-parent</relativePath>
|
||||
</parent>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>cglib</groupId>
|
||||
<artifactId>cglib-nodep</artifactId>
|
||||
<version>2.1_3</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>${junit.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-context</artifactId>
|
||||
<version>${spring.version}</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-test</artifactId>
|
||||
<version>${spring.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.integration</groupId>
|
||||
<artifactId>spring-integration-core</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.mockito</groupId>
|
||||
<artifactId>mockito-all</artifactId>
|
||||
<version>1.8.0</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
@@ -1,31 +0,0 @@
|
||||
/*
|
||||
* Copyright 2002-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.integration.osgi;
|
||||
|
||||
/**
|
||||
* Constants used by OSGi Service Extender
|
||||
*
|
||||
* @author Oleg Zhurakousky
|
||||
* @since 2.0
|
||||
*/
|
||||
public interface IntegrationOSGiConstants {
|
||||
public final String OSGI_BEAN_NAME = "org.springframework.osgi.bean.name";
|
||||
public final String INTEGRATION_EVENT_TYPE = "INTEGRATION_EVENT_TYPE";
|
||||
public final String REGISTRATION = "REGISTRATION";
|
||||
public final String UNREGISTRATION = "UNREGISTRATION";
|
||||
public final String BINDING = "BINDING";
|
||||
public final String UNBINDING= "UNBINDING";
|
||||
}
|
||||
@@ -1,69 +0,0 @@
|
||||
/*
|
||||
* Copyright 2002-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.integration.osgi;
|
||||
|
||||
import org.springframework.integration.channel.SubscribableChannel;
|
||||
import org.springframework.integration.controlbus.ControlBus;
|
||||
import org.springframework.integration.core.Message;
|
||||
import org.springframework.integration.message.MessageHandler;
|
||||
|
||||
/**
|
||||
* Implementation of the {@link ControlBus} interface.
|
||||
* Control Bus itself wrapper over {@link SubscribableChannel},
|
||||
* which represents the entry point to Control Bus infrastructure.
|
||||
*
|
||||
* @author Oleg Zhurakousky
|
||||
* @since 2.0
|
||||
*/
|
||||
public class OSGiIntegrationControlBus implements ControlBus {
|
||||
private SubscribableChannel channel;
|
||||
private String busName;
|
||||
|
||||
public OSGiIntegrationControlBus(SubscribableChannel channel, String busName){
|
||||
this.channel = channel;
|
||||
this.busName = busName;
|
||||
}
|
||||
|
||||
public boolean subscribe(MessageHandler handler) {
|
||||
return channel.subscribe(handler);
|
||||
}
|
||||
|
||||
|
||||
public boolean unsubscribe(MessageHandler handler) {
|
||||
return channel.unsubscribe(handler);
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return channel.getName();
|
||||
}
|
||||
|
||||
|
||||
public boolean send(Message<?> message) {
|
||||
return channel.send(message);
|
||||
}
|
||||
|
||||
|
||||
public boolean send(Message<?> message, long timeout) {
|
||||
return channel.send(message, timeout);
|
||||
}
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see org.springframework.integration.controlbus.ControlBus#isBusAvailable()
|
||||
*/
|
||||
public boolean isBusAvailable() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -1,73 +0,0 @@
|
||||
/*
|
||||
* Copyright 2002-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.integration.osgi.config.xml;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.springframework.beans.factory.BeanDefinitionStoreException;
|
||||
import org.springframework.beans.factory.support.AbstractBeanDefinition;
|
||||
import org.springframework.beans.factory.support.BeanDefinitionBuilder;
|
||||
import org.springframework.beans.factory.support.BeanDefinitionReaderUtils;
|
||||
import org.springframework.beans.factory.xml.AbstractBeanDefinitionParser;
|
||||
import org.springframework.beans.factory.xml.ParserContext;
|
||||
import org.springframework.integration.controlbus.ControlBus;
|
||||
import org.springframework.integration.osgi.OSGiIntegrationControlBus;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.w3c.dom.Element;
|
||||
|
||||
/**
|
||||
* Parser to handle 'bus-config' element.
|
||||
*
|
||||
* @author Oleg Zhurakousky
|
||||
* @since 2.0
|
||||
*/
|
||||
public class BusConfigParser extends AbstractBeanDefinitionParser {
|
||||
private static final Log log = LogFactory.getLog(BusConfigParser.class);
|
||||
|
||||
private String beanName;
|
||||
/**
|
||||
*
|
||||
*/
|
||||
protected String resolveId(Element element, AbstractBeanDefinition definition, ParserContext parserContext)
|
||||
throws BeanDefinitionStoreException {
|
||||
return beanName;
|
||||
}
|
||||
/**
|
||||
*
|
||||
*/
|
||||
protected AbstractBeanDefinition parseInternal(Element element, ParserContext parserContext) {
|
||||
String busGroupName = element.getAttribute("group-name");
|
||||
Assert.isTrue(StringUtils.hasText(busGroupName), "bus-config 'group-name' attribute must be provided");
|
||||
beanName = busGroupName;
|
||||
if (parserContext.getRegistry().containsBeanDefinition(beanName)){
|
||||
throw new BeanDefinitionStoreException("You atempted to register a second instance of the Control Bus with the same 'group-name' " +
|
||||
"in the single Application Context which is not allowed.");
|
||||
}
|
||||
|
||||
BeanDefinitionBuilder rootBuilder = BeanDefinitionBuilder.rootBeanDefinition(OSGiIntegrationControlBus.class);
|
||||
rootBuilder.addConstructorArgReference(ControlBusOSGiConfigUtils.DEFAULT_CONTROL_DIST_CHANNEL);
|
||||
rootBuilder.addConstructorArgValue(beanName);
|
||||
|
||||
BeanDefinitionBuilder osgiServiceDefinition =
|
||||
ControlBusOSGiConfigUtils.defineServiceExporterFor(beanName, parserContext.getRegistry(), ControlBus.class);
|
||||
BeanDefinitionReaderUtils.registerWithGeneratedName(osgiServiceDefinition.getBeanDefinition(), parserContext.getRegistry());
|
||||
|
||||
// NOTE add listeners
|
||||
log.trace("Control Bus " + beanName + " was parsed successfully");
|
||||
return rootBuilder.getBeanDefinition();
|
||||
}
|
||||
}
|
||||
@@ -1,192 +0,0 @@
|
||||
/*
|
||||
* Copyright 2002-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.integration.osgi.config.xml;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
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.support.BeanDefinitionReaderUtils;
|
||||
import org.springframework.beans.factory.support.BeanDefinitionRegistry;
|
||||
import org.springframework.beans.factory.support.ManagedList;
|
||||
import org.springframework.beans.factory.xml.BeanDefinitionParser;
|
||||
import org.springframework.beans.factory.xml.ParserContext;
|
||||
import org.springframework.integration.osgi.extender.ControlBusRegistrationMessageDistributionListener;
|
||||
import org.springframework.integration.osgi.extender.LifecycleServiceManagingListener;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.xml.DomUtils;
|
||||
import org.w3c.dom.Element;
|
||||
|
||||
/**
|
||||
* Parser to process 'config' element of SI Service Extender
|
||||
* and its sub-elements
|
||||
*
|
||||
* @author Oleg Zhurakousky
|
||||
* @since 2.0
|
||||
*/
|
||||
public class ConfigParser implements BeanDefinitionParser {
|
||||
private static final Log log = LogFactory.getLog(ConfigParser.class);
|
||||
private static final String TYPE = "si-type";
|
||||
private static final String REF = "ref";
|
||||
private static final String NAME = "name";
|
||||
private static final String CONTROL_BUS = "control-bus";
|
||||
private static final String EXPORTER_SUFFIX = "-Service";
|
||||
private static final int EXPORT = 1;
|
||||
private static final int IMPORT = 2;
|
||||
/**
|
||||
* Will parse 'config' element of "integration-service-extender' namespace and its sub-elements
|
||||
*/
|
||||
public BeanDefinition parse(Element element, ParserContext parserContext) {
|
||||
List<Element> elements = DomUtils.getChildElementsByTagName(element, "export");
|
||||
for (Element exportElements : elements) {
|
||||
this.processExportElement(exportElements, parserContext, EXPORT);
|
||||
}
|
||||
elements = DomUtils.getChildElementsByTagName(element, "import");
|
||||
for (Element exportElements : elements) {
|
||||
this.processImportElement(exportElements, parserContext, IMPORT);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
/**
|
||||
*/
|
||||
private void processExportElement(Element element, ParserContext parserContext, int configType){
|
||||
BeanDefinitionRegistry registry = parserContext.getRegistry();
|
||||
String includeType = this.getIncludeType(element);
|
||||
Assert.notNull(includeType, "You must prvide one of the following: 'type' or 'ref' attribute wihin the 'include' element");
|
||||
if (includeType.equals(TYPE)){
|
||||
this.processTypeAttribute(element, registry, configType);
|
||||
} else if (includeType.equals(REF)){
|
||||
this.processRefAttribute(element, registry, configType);
|
||||
}
|
||||
}
|
||||
/**
|
||||
*/
|
||||
private void processImportElement(Element element, ParserContext parserContext, int configType){
|
||||
BeanDefinitionRegistry registry = parserContext.getRegistry();
|
||||
String serviceName = element.getAttribute(NAME);
|
||||
Assert.hasText(serviceName, "you must enter a valid value in the " + NAME + " attribute");
|
||||
Class[] interfaces = this.discoverInterfaces(serviceName, element);
|
||||
BeanDefinitionBuilder importerBuilder =
|
||||
ControlBusOSGiConfigUtils.defineServiceImporterFor(serviceName, null, registry, interfaces);
|
||||
// define binding listeners
|
||||
ManagedList<BeanDefinition> listenerDefinitions = new ManagedList<BeanDefinition>();
|
||||
if (element.hasAttribute(CONTROL_BUS)){
|
||||
String busBeanName = element.getAttribute(CONTROL_BUS);
|
||||
BeanDefinition busBindingListener =
|
||||
ControlBusOSGiConfigUtils.defineBindingMessageDistributor(registry, importerBuilder, busBeanName);
|
||||
listenerDefinitions.add(busBindingListener);
|
||||
}
|
||||
List<String> dependentSources = ControlBusOSGiConfigUtils.discoverDependentElements(element, serviceName);
|
||||
// add binding listener that will execute start/stop on dependent lifecycle beans
|
||||
if (dependentSources.size() > 0){
|
||||
log.debug("Candidate beans dependent on '" + serviceName +
|
||||
"' and to be managed by IntegrationServiceBindingListener: " + dependentSources);
|
||||
BeanDefinitionBuilder lifecycleBindingManagerBuilder =
|
||||
BeanDefinitionBuilder.genericBeanDefinition(LifecycleServiceManagingListener.class);
|
||||
lifecycleBindingManagerBuilder.addPropertyValue("dependentSources", dependentSources);
|
||||
listenerDefinitions.add(lifecycleBindingManagerBuilder.getBeanDefinition());
|
||||
}
|
||||
|
||||
if (listenerDefinitions.size() > 0){
|
||||
importerBuilder.addPropertyValue("listeners", listenerDefinitions);
|
||||
}
|
||||
|
||||
registry.registerBeanDefinition(serviceName, importerBuilder.getBeanDefinition());
|
||||
}
|
||||
/**
|
||||
*/
|
||||
private void processRefAttribute(Element element, BeanDefinitionRegistry registry, int configType) {
|
||||
if (configType == EXPORT){
|
||||
String beanName = element.getAttribute(REF);
|
||||
this.generateServiceExorterDefinition(beanName, element, registry);
|
||||
} else if (configType == IMPORT){
|
||||
|
||||
}
|
||||
}
|
||||
/**
|
||||
*/
|
||||
private void processTypeAttribute(Element element, BeanDefinitionRegistry registry, int configType) {
|
||||
String exportedTypes = element.getAttribute(TYPE);
|
||||
if (configType == EXPORT){
|
||||
Element rootDocumentElement = element.getOwnerDocument().getDocumentElement();
|
||||
List<Element> elementsToExport = DomUtils.getChildElementsByTagName(rootDocumentElement, exportedTypes);
|
||||
for (Element elementToExport : elementsToExport) {
|
||||
String beanName = elementToExport.getAttribute("id");
|
||||
this.generateServiceExorterDefinition(beanName, element, registry);
|
||||
}
|
||||
}
|
||||
}
|
||||
/*
|
||||
*
|
||||
*/
|
||||
private void generateServiceExorterDefinition(String beanName, Element element, BeanDefinitionRegistry registry){
|
||||
BeanDefinitionBuilder exportedElementBuilder =
|
||||
ControlBusOSGiConfigUtils.defineServiceExporterFor(beanName, registry);
|
||||
ManagedList<BeanDefinition> listenerDefinitions = new ManagedList<BeanDefinition>();
|
||||
if (element.hasAttribute(CONTROL_BUS)){
|
||||
BeanDefinition controlBusMessageDistributorDefinition =
|
||||
this.defineControlBusMessageDistributor(element, exportedElementBuilder, registry, beanName);
|
||||
listenerDefinitions.add(controlBusMessageDistributorDefinition);
|
||||
}
|
||||
// NOTE: add more listeners here if needed
|
||||
if (listenerDefinitions.size() > 0){
|
||||
exportedElementBuilder.addPropertyValue("listeners", listenerDefinitions);
|
||||
}
|
||||
registry.registerBeanDefinition(beanName+EXPORTER_SUFFIX, exportedElementBuilder.getBeanDefinition());
|
||||
}
|
||||
/**
|
||||
* If element specifies 'control-bus' attribute, this method will register
|
||||
* {@link ControlBusRegistrationMessageDistributionListener}
|
||||
* which will send registration messages to the ControlBus
|
||||
*/
|
||||
private BeanDefinition defineControlBusMessageDistributor(Element originalElement,
|
||||
BeanDefinitionBuilder exportedElementBuilder,
|
||||
BeanDefinitionRegistry registry,
|
||||
String componentName) {
|
||||
AbstractBeanDefinition listenerDefinition = null;
|
||||
if (originalElement.hasAttribute(CONTROL_BUS)){
|
||||
String controlBusAttributeValue = originalElement.getAttribute(CONTROL_BUS);
|
||||
Assert.hasText(controlBusAttributeValue, "You must provide control bus name when defining 'control-bus' attribute");
|
||||
log.trace("Adding registration listener for exported OSGi service for:" + componentName);
|
||||
|
||||
listenerDefinition =
|
||||
ControlBusOSGiConfigUtils.defineRegistrationMessageDistributor(registry, exportedElementBuilder, controlBusAttributeValue);
|
||||
BeanDefinitionReaderUtils.registerWithGeneratedName(listenerDefinition, registry);
|
||||
}
|
||||
return listenerDefinition;
|
||||
}
|
||||
/**
|
||||
*/
|
||||
private String getIncludeType(Element element){
|
||||
if (element.hasAttribute(REF)){
|
||||
return REF;
|
||||
} else if (element.hasAttribute(TYPE)){
|
||||
return TYPE;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
/**
|
||||
*/
|
||||
private Class[] discoverInterfaces(String name, Element element){
|
||||
if (element.hasAttribute(TYPE)){
|
||||
return SiTypeToJavaTypeMaper.mapSiType(element.getAttribute(TYPE));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -1,214 +0,0 @@
|
||||
/*
|
||||
* Copyright 2002-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.integration.osgi.config.xml;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
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.support.BeanDefinitionReaderUtils;
|
||||
import org.springframework.beans.factory.support.BeanDefinitionRegistry;
|
||||
import org.springframework.integration.controlbus.ControlBus;
|
||||
import org.springframework.integration.osgi.IntegrationOSGiConstants;
|
||||
import org.springframework.integration.osgi.extender.ControlBusBindingMessageDistributionListener;
|
||||
import org.springframework.integration.osgi.extender.ControlBusListeningDecorator;
|
||||
import org.springframework.integration.osgi.extender.ControlBusRegistrationMessageDistributionListener;
|
||||
import org.springframework.osgi.service.exporter.support.AutoExport;
|
||||
import org.springframework.osgi.service.exporter.support.OsgiServiceFactoryBean;
|
||||
import org.springframework.osgi.service.importer.support.Cardinality;
|
||||
import org.springframework.osgi.service.importer.support.OsgiServiceProxyFactoryBean;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.w3c.dom.Element;
|
||||
import org.w3c.dom.Node;
|
||||
import org.w3c.dom.NodeList;
|
||||
|
||||
/**
|
||||
* Helper class used by varilus bean parsers to create OSGi Factory bean definitions
|
||||
*
|
||||
* @author Oleg Zhurakousky
|
||||
* @since 2.0
|
||||
*/
|
||||
class ControlBusOSGiConfigUtils {
|
||||
public final static String DEFAULT_BUS_GROUP_NAME = "DEFAULT_CONTROL_GROUP";
|
||||
public final static String DEFAULT_CONTROL_DIST_CHANNEL = "DEFAULT_CONTROL_DIST_CHANNEL";
|
||||
/**
|
||||
* Will define a service importer (equivalent to <osgi:reference>) for the ControlBus service.
|
||||
* It will also register binding listener for this 'controlbus' reference which could be used
|
||||
* to react to the life-cycle events of this 'controlbus' reference.
|
||||
* For example: Individual service reference listeners coiuld use it to determine when the bus went away and
|
||||
* no control events need to be dispatched to the bus.
|
||||
*/
|
||||
public static BeanDefinition registerImporterForControlBus(BeanDefinitionRegistry registry, String busGroupName){
|
||||
String filter = "(&(" + IntegrationOSGiConstants.OSGI_BEAN_NAME + "=" + busGroupName + "))";
|
||||
BeanDefinitionBuilder controlBusImporterBuilder =
|
||||
defineServiceImporterFor(busGroupName, filter, registry, ControlBus.class);
|
||||
|
||||
BeanDefinitionBuilder busListenerBuilder =
|
||||
BeanDefinitionBuilder.genericBeanDefinition(ControlBusListeningDecorator.class);
|
||||
AbstractBeanDefinition busListenerDefinition = busListenerBuilder.getBeanDefinition();
|
||||
//String listenerName = IntegrationOSGiConstants.BUS_LISTENER_PREFIX + busGroupName;
|
||||
String listenerName = busGroupName;
|
||||
registry.registerBeanDefinition(listenerName, busListenerDefinition);
|
||||
controlBusImporterBuilder.addPropertyReference("listeners", listenerName);
|
||||
BeanDefinition controlBusImporterDefinition = controlBusImporterBuilder.getBeanDefinition();
|
||||
BeanDefinitionReaderUtils.registerWithGeneratedName(controlBusImporterBuilder.getBeanDefinition(), registry);
|
||||
return controlBusImporterDefinition;
|
||||
}
|
||||
/**
|
||||
* Will define OSGi Service exporter BeanDefinitionBuilder for a bean identified by the 'beanName'
|
||||
* parameter as an OSGi Service. If 'publishInterfaces' parameter is not provided this exporter will
|
||||
* use all interfaces implemented by this service class hierarchy. Otherwise you can provide an array of
|
||||
* specific interfaces to be published under this service.
|
||||
*
|
||||
* @param beanName
|
||||
* @param registry
|
||||
* @param publishedIntefaces
|
||||
* @return
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public static BeanDefinitionBuilder defineServiceExporterFor(String beanName,
|
||||
BeanDefinitionRegistry registry,
|
||||
Class... publishedIntefaces){
|
||||
BeanDefinitionBuilder serviceBuilder = BeanDefinitionBuilder.genericBeanDefinition(OsgiServiceFactoryBean.class);
|
||||
serviceBuilder.addPropertyValue("targetBeanName", beanName);
|
||||
if (publishedIntefaces != null && publishedIntefaces.length > 0){
|
||||
serviceBuilder.addPropertyValue("interfaces", publishedIntefaces);
|
||||
} else {
|
||||
serviceBuilder.addPropertyValue("autoExport", AutoExport.INTERFACES);
|
||||
}
|
||||
serviceBuilder.addPropertyValue("registerService", true);
|
||||
return serviceBuilder;
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @param beanName
|
||||
* @param filter
|
||||
* @param registry
|
||||
* @param publishedIntefaces
|
||||
* @return
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public static BeanDefinitionBuilder defineServiceImporterFor(String beanName, String filter,
|
||||
BeanDefinitionRegistry registry, Class... publishedIntefaces){
|
||||
Assert.notEmpty(publishedIntefaces, "At least one interface must be provided");
|
||||
BeanDefinitionBuilder serviceBuilder = BeanDefinitionBuilder.genericBeanDefinition(OsgiServiceProxyFactoryBean.class);
|
||||
serviceBuilder.addPropertyValue("cardinality", Cardinality.C_0__1);
|
||||
if (StringUtils.hasText(filter)){
|
||||
serviceBuilder.addPropertyValue("filter", filter);
|
||||
}
|
||||
if (publishedIntefaces != null && publishedIntefaces.length > 0){
|
||||
serviceBuilder.addPropertyValue("interfaces", publishedIntefaces);
|
||||
}
|
||||
// will make sure it uses exporter's bean name when building a relationship with importer
|
||||
serviceBuilder.addPropertyValue("serviceBeanName", beanName);
|
||||
|
||||
//TODO: pf.setTimeout(timeoutInMillis)
|
||||
|
||||
return serviceBuilder;
|
||||
}
|
||||
/**
|
||||
* Will define a registration listener bean definition for the exported service adding reference to the
|
||||
* to the ControlBusListeninigDecorator to it.
|
||||
*
|
||||
* @param registry
|
||||
* @param exporterBuilder
|
||||
* @param busBeanName
|
||||
* @return
|
||||
*/
|
||||
public static AbstractBeanDefinition defineRegistrationMessageDistributor(BeanDefinitionRegistry registry,
|
||||
BeanDefinitionBuilder exporterBuilder,
|
||||
String busBeanName){
|
||||
// create listener builder
|
||||
BeanDefinitionBuilder listenerBuilder =
|
||||
BeanDefinitionBuilder.genericBeanDefinition(ControlBusRegistrationMessageDistributionListener.class);
|
||||
String busGroupName = busBeanName;
|
||||
// if reference to the bus doesn't exist yet, create one
|
||||
// corresponding bean is not the actual bus but a ControlBusListentingDecorator
|
||||
if (!registry.containsBeanDefinition(busGroupName)){
|
||||
ControlBusOSGiConfigUtils.registerImporterForControlBus(registry, busGroupName);
|
||||
}
|
||||
listenerBuilder.addConstructorArgReference(busGroupName);
|
||||
AbstractBeanDefinition listenerDefinition = listenerBuilder.getBeanDefinition();
|
||||
//exporterBuilder.addPropertyValue("listeners", listenerDefinition);
|
||||
return listenerDefinition;
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @param registry
|
||||
* @param exporterBuilder
|
||||
* @param busBeanName
|
||||
* @return
|
||||
*/
|
||||
public static AbstractBeanDefinition defineBindingMessageDistributor(BeanDefinitionRegistry registry,
|
||||
BeanDefinitionBuilder exporterBuilder,
|
||||
String busBeanName){
|
||||
// create listener builder
|
||||
BeanDefinitionBuilder listenerBuilder =
|
||||
BeanDefinitionBuilder.genericBeanDefinition(ControlBusBindingMessageDistributionListener.class);
|
||||
String busGroupName = busBeanName;
|
||||
// if reference to the bus doesn't exist yet, create one
|
||||
// corresponding bean is not the actual bus but a ControlBusListentingDecorator
|
||||
if (!registry.containsBeanDefinition(busGroupName)){
|
||||
ControlBusOSGiConfigUtils.registerImporterForControlBus(registry, busGroupName);
|
||||
}
|
||||
listenerBuilder.addConstructorArgReference(busGroupName);
|
||||
AbstractBeanDefinition listenerDefinition = listenerBuilder.getBeanDefinition();
|
||||
return listenerDefinition;
|
||||
}
|
||||
|
||||
public static List<String> discoverDependentElements(Element element, String attributeValue){
|
||||
List<String> dependentSources = new ArrayList<String>();
|
||||
Element documentElement = element.getOwnerDocument().getDocumentElement();
|
||||
NodeList nodes = documentElement.getChildNodes();
|
||||
for (int i = 0; i < nodes.getLength(); i++) {
|
||||
Node node = nodes.item(i);
|
||||
if (node.getNodeType() == Node.ELEMENT_NODE){
|
||||
Element elementNode = (Element) node;
|
||||
String elementName = isDependent(elementNode, attributeValue);
|
||||
if (StringUtils.hasText(elementName)){
|
||||
dependentSources.add(elementName);
|
||||
}
|
||||
}
|
||||
}
|
||||
return dependentSources;
|
||||
}
|
||||
//
|
||||
private static String isDependent(Element element, String attributeValue){
|
||||
String[] monitoredAttributes = new String[]{"input-channel",
|
||||
"output-channel",
|
||||
"default-request-channel",
|
||||
"default-reply-channel",
|
||||
"channel"};
|
||||
for (String monitoredAttribute : monitoredAttributes) {
|
||||
if (element.hasAttribute(monitoredAttribute) &&
|
||||
element.getAttribute(monitoredAttribute).equals(attributeValue) ){
|
||||
if (!element.hasAttribute("name") && !element.hasAttribute("id")){
|
||||
// need to generate id for elements that do not have one
|
||||
// so they can be included in the listener dependentSource list
|
||||
element.setAttribute("id", element.getTagName() + "-" + attributeValue + "-" + element.hashCode());
|
||||
element.setIdAttribute("id", true);
|
||||
}
|
||||
String elementName = StringUtils.hasText(element.getAttribute("id")) ?
|
||||
element.getAttribute("id") : element.getAttribute("name");
|
||||
return elementName;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
/*
|
||||
* Copyright 2002-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.integration.osgi.config.xml;
|
||||
|
||||
import org.springframework.integration.config.xml.AbstractIntegrationNamespaceHandler;
|
||||
|
||||
/**
|
||||
* @author Oleg Zhurakousky
|
||||
* @since 2.0
|
||||
*/
|
||||
public class IntegrationOSGiControlBusNamespaceHandler extends AbstractIntegrationNamespaceHandler {
|
||||
|
||||
/**
|
||||
* Will register the required parsers
|
||||
*/
|
||||
public void init() {
|
||||
registerBeanDefinitionParser("bus-config", new BusConfigParser());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
/*
|
||||
* Copyright 2002-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.integration.osgi.config.xml;
|
||||
|
||||
import org.springframework.integration.config.xml.AbstractIntegrationNamespaceHandler;
|
||||
|
||||
/**
|
||||
* @author Oleg Zhurakousky
|
||||
* @since 2.0
|
||||
*/
|
||||
public class IntegrationOSGiServiceExtenderNamespaceHandler extends AbstractIntegrationNamespaceHandler {
|
||||
|
||||
/**
|
||||
* Will register the required parsers
|
||||
*/
|
||||
public void init() {
|
||||
registerBeanDefinitionParser("config", new ConfigParser());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,41 +0,0 @@
|
||||
/*
|
||||
* Copyright 2002-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.integration.osgi.config.xml;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.springframework.integration.channel.SubscribableChannel;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
/**
|
||||
* @author Oleg Zhurakousky
|
||||
* @since 2.0
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
class SiTypeToJavaTypeMaper {
|
||||
public static final String PUB_SUB_CHANNEL = "publish-subscribe-channel";
|
||||
private static Map<String, Class[]> siTypeMappings = new HashMap<String, Class[]>();
|
||||
|
||||
static {
|
||||
siTypeMappings.put(PUB_SUB_CHANNEL, new Class[]{SubscribableChannel.class});
|
||||
}
|
||||
|
||||
public static Class[] mapSiType(String siType){
|
||||
Assert.isTrue(siTypeMappings.containsKey(siType), "Can not map SI-Type '" + siType + "' to Java Type. Not supported.");
|
||||
return siTypeMappings.get(siType);
|
||||
}
|
||||
}
|
||||
@@ -1,74 +0,0 @@
|
||||
/*
|
||||
* Copyright 2002-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.integration.osgi.extender;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.springframework.integration.controlbus.ControlBus;
|
||||
import org.springframework.integration.message.MessageBuilder;
|
||||
import org.springframework.integration.osgi.IntegrationOSGiConstants;
|
||||
import org.springframework.osgi.service.importer.OsgiServiceLifecycleListener;
|
||||
|
||||
/**
|
||||
* Will send control messages to the ControlBus when OSGi references are bound to the backing services.
|
||||
*
|
||||
* @author Oleg Zhurakousky
|
||||
* @since 2.0
|
||||
*/
|
||||
public class ControlBusBindingMessageDistributionListener implements
|
||||
OsgiServiceLifecycleListener {
|
||||
private static final Log log = LogFactory.getLog(ControlBusBindingMessageDistributionListener.class);
|
||||
private ControlBus controlBus;
|
||||
|
||||
public ControlBusBindingMessageDistributionListener(ControlBus controlBus){
|
||||
this.controlBus = controlBus;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.springframework.osgi.service.importer.OsgiServiceLifecycleListener#bind(java.lang.Object, java.util.Map)
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public void bind(Object service, Map properties) throws Exception {
|
||||
if (controlBus.isBusAvailable()){
|
||||
log.info("Dispatching BINDING Message for: " + properties.get(IntegrationOSGiConstants.OSGI_BEAN_NAME) +
|
||||
"- " + properties + " to: " +
|
||||
controlBus.getName());
|
||||
MessageBuilder builder = MessageBuilder.withPayload(properties.get(IntegrationOSGiConstants.OSGI_BEAN_NAME));
|
||||
builder.copyHeaders(properties);
|
||||
builder.setHeader(IntegrationOSGiConstants.INTEGRATION_EVENT_TYPE, IntegrationOSGiConstants.BINDING);
|
||||
controlBus.send(builder.build());
|
||||
}
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.springframework.osgi.service.importer.OsgiServiceLifecycleListener#unbind(java.lang.Object, java.util.Map)
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public void unbind(Object service, Map properties) throws Exception {
|
||||
if (controlBus.isBusAvailable()){
|
||||
log.info("Dispatching UNBINDING Message for: " + properties.get(IntegrationOSGiConstants.OSGI_BEAN_NAME) +
|
||||
"- " + properties + " to: " +
|
||||
controlBus.getName());
|
||||
MessageBuilder builder = MessageBuilder.withPayload(properties.get(IntegrationOSGiConstants.OSGI_BEAN_NAME));
|
||||
builder.copyHeaders(properties);
|
||||
builder.setHeader(IntegrationOSGiConstants.INTEGRATION_EVENT_TYPE, IntegrationOSGiConstants.UNBINDING);
|
||||
controlBus.send(builder.build());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,143 +0,0 @@
|
||||
/*
|
||||
* Copyright 2002-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.integration.osgi.extender;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.springframework.integration.controlbus.ControlBus;
|
||||
import org.springframework.integration.core.Message;
|
||||
import org.springframework.integration.message.MessageHandler;
|
||||
import org.springframework.osgi.service.importer.OsgiServiceLifecycleListener;
|
||||
|
||||
/**
|
||||
* Wraps OSGi Service Reference representing a {@link ControlBus} to provide several simplification
|
||||
* around life-cycle of the underlying reference.
|
||||
*
|
||||
* First, this wrapper implements {@link OsgiServiceLifecycleListener} which will listen for
|
||||
* bind/unbind events of the service reference representing a particular instance of the {@link ControlBus} service.
|
||||
* Calls to bind/unbind methods will set <code>busAvailable</code> attribute to 'true'/'false' respectively.
|
||||
* sparing you from dealing with the internals of the service reference proxy, which might be at the state where
|
||||
* it is not backed up by a concrete instance of the {@link ControlBus} service (e.g., when such service is unregistered).
|
||||
* This class also implements {@link ControlBus} interface delegating all method calls to the actual instance of the ControlBus
|
||||
* with one exception. Call to {@link ControlBus#isBusAvailable()} will return the value of the <code>busAvailable</code>
|
||||
* attribute which is set by the calls to bind/unbind methods.
|
||||
* This way you can interact with the ControlBus as if it was a real instance of the ControlBus service when it is
|
||||
* available, but it also give you a quick and convenient way to know when bus goes away.
|
||||
*
|
||||
* @author Oleg Zhurakousky
|
||||
* @since 2.0
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public class ControlBusListeningDecorator implements OsgiServiceLifecycleListener, ControlBus {
|
||||
|
||||
private static final Log log = LogFactory.getLog(ControlBusListeningDecorator.class);
|
||||
private boolean busAvailable;
|
||||
private ControlBus controlBus;
|
||||
private String name;
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see org.springframework.osgi.service.importer.OsgiServiceLifecycleListener#bind(java.lang.Object, java.util.Map)
|
||||
*/
|
||||
public void bind(Object service, Map properties) throws Exception {
|
||||
controlBus = (ControlBus) service;
|
||||
name = controlBus.getName();
|
||||
log.debug("Binding to the Control Bus: " + name);
|
||||
busAvailable = true;
|
||||
}
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see org.springframework.osgi.service.importer.OsgiServiceLifecycleListener#unbind(java.lang.Object, java.util.Map)
|
||||
*/
|
||||
public void unbind(Object service, Map properties) throws Exception {
|
||||
log.debug("un-Binding from the Control Bus: " + name);
|
||||
busAvailable = false;
|
||||
controlBus = null;
|
||||
}
|
||||
/*
|
||||
*/
|
||||
public void setControlBus(ControlBus controlBus) {
|
||||
this.controlBus = controlBus;
|
||||
}
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see org.springframework.integration.controlbus.ControlBus#isBusAvailable()
|
||||
*/
|
||||
public boolean isBusAvailable() {
|
||||
return busAvailable;
|
||||
}
|
||||
/*
|
||||
*/
|
||||
public void setBusAvailable(boolean busAvailable) {
|
||||
this.busAvailable = busAvailable;
|
||||
}
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see org.springframework.integration.channel.SubscribableChannel#subscribe(org.springframework.integration.message.MessageHandler)
|
||||
*/
|
||||
public boolean subscribe(MessageHandler handler) {
|
||||
if (isBusAvailable()){
|
||||
return controlBus.subscribe(handler);
|
||||
} else {
|
||||
log.debug("Can not subscribe to the Control Bus: " + name + ". Control Bus is not availabel");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see org.springframework.integration.channel.SubscribableChannel#unsubscribe(org.springframework.integration.message.MessageHandler)
|
||||
*/
|
||||
public boolean unsubscribe(MessageHandler handler) {
|
||||
if (isBusAvailable()){
|
||||
return controlBus.unsubscribe(handler);
|
||||
} else {
|
||||
log.debug("Can not unsubscribe from the Control Bus: " + name + ". Control Bus is not availabel");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see org.springframework.integration.core.MessageChannel#getName()
|
||||
*/
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see org.springframework.integration.core.MessageChannel#send(org.springframework.integration.core.Message)
|
||||
*/
|
||||
public boolean send(Message<?> message) {
|
||||
if (isBusAvailable()){
|
||||
return controlBus.send(message);
|
||||
} else {
|
||||
log.debug("Can not send message to the Control Bus: " + name + ". Control Bus is not availabel");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see org.springframework.integration.core.MessageChannel#send(org.springframework.integration.core.Message, long)
|
||||
*/
|
||||
public boolean send(Message<?> message, long timeout) {
|
||||
if (isBusAvailable()){
|
||||
return controlBus.send(message, timeout);
|
||||
} else {
|
||||
log.debug("Can not send message to the Control Bus: " + name + ". Control Bus is not availabel");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,70 +0,0 @@
|
||||
/*
|
||||
* Copyright 2002-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.integration.osgi.extender;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.springframework.integration.controlbus.ControlBus;
|
||||
import org.springframework.integration.message.MessageBuilder;
|
||||
import org.springframework.integration.osgi.IntegrationOSGiConstants;
|
||||
import org.springframework.osgi.service.exporter.OsgiServiceRegistrationListener;
|
||||
|
||||
/**
|
||||
* Will send control messages to the ControlBus when OSGi services are registered.
|
||||
*
|
||||
* @author Oleg Zhurakousky
|
||||
* @since 2.0
|
||||
*/
|
||||
public class ControlBusRegistrationMessageDistributionListener implements OsgiServiceRegistrationListener {
|
||||
private static final Log log = LogFactory.getLog(ControlBusRegistrationMessageDistributionListener.class);
|
||||
private ControlBus controlBus;
|
||||
|
||||
public ControlBusRegistrationMessageDistributionListener(ControlBus controlBus){
|
||||
this.controlBus = controlBus;
|
||||
}
|
||||
/**
|
||||
* Will send a notification message to the named {@link ControlBus} notifying that service
|
||||
* for an SI component was registered and is ready to be used.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public void registered(Object service, Map properties){
|
||||
if (controlBus.isBusAvailable()){
|
||||
log.info("Dispatching REGISTRATION Message for: " + service + "- " + properties + " to: " +
|
||||
controlBus.getName());
|
||||
MessageBuilder builder = MessageBuilder.withPayload(service);
|
||||
builder.copyHeaders(properties);
|
||||
builder.setHeader(IntegrationOSGiConstants.INTEGRATION_EVENT_TYPE, IntegrationOSGiConstants.REGISTRATION);
|
||||
controlBus.send(builder.build());
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Will send a notification message to the named {@link ControlBus} notifying that service
|
||||
* for an SI component was un-registered and can no longet be used.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public void unregistered(Object service, Map properties){
|
||||
if (controlBus.isBusAvailable()){
|
||||
log.info("Dispatching UN-REGISTRATION Message for: " + service + "- " + properties + " to: " +
|
||||
controlBus.getName());
|
||||
MessageBuilder builder = MessageBuilder.withPayload(service);
|
||||
builder.copyHeaders(properties);
|
||||
builder.setHeader(IntegrationOSGiConstants.INTEGRATION_EVENT_TYPE, IntegrationOSGiConstants.UNREGISTRATION);
|
||||
controlBus.send(builder.build());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,86 +0,0 @@
|
||||
/*
|
||||
* Copyright 2002-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.integration.osgi.extender;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.springframework.beans.BeansException;
|
||||
import org.springframework.beans.DirectFieldAccessor;
|
||||
import org.springframework.beans.factory.BeanFactory;
|
||||
import org.springframework.beans.factory.BeanFactoryAware;
|
||||
import org.springframework.context.Lifecycle;
|
||||
import org.springframework.osgi.service.importer.OsgiServiceLifecycleListener;
|
||||
|
||||
/**
|
||||
* Will start/stop {@link Lifecycle} beans that are dependent on OSGi Service references that are being bound/unbound
|
||||
*
|
||||
* @author Oleg Zhurakousky
|
||||
* @since 2.0
|
||||
*/
|
||||
public class LifecycleServiceManagingListener implements OsgiServiceLifecycleListener, BeanFactoryAware {
|
||||
private static final Log log = LogFactory.getLog(LifecycleServiceManagingListener.class);
|
||||
private List<String> dependentSources;
|
||||
private BeanFactory beanFactory;
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.springframework.osgi.service.importer.OsgiServiceLifecycleListener#bind(java.lang.Object, java.util.Map)
|
||||
*/
|
||||
public void bind(Object service, Map properties) throws Exception {
|
||||
for (String dependentSource : dependentSources) {
|
||||
Object bean = beanFactory.getBean(dependentSource);
|
||||
if (bean instanceof Lifecycle){
|
||||
Lifecycle lifecycle = (Lifecycle) bean;
|
||||
if (!lifecycle.isRunning()){
|
||||
log.debug("Staring: " + lifecycle);
|
||||
lifecycle.start();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.springframework.osgi.service.importer.OsgiServiceLifecycleListener#unbind(java.lang.Object, java.util.Map)
|
||||
*/
|
||||
public void unbind(Object service, Map properties) throws Exception {
|
||||
for (String dependentSource : dependentSources) {
|
||||
Object bean = beanFactory.getBean(dependentSource);
|
||||
if (bean instanceof Lifecycle){
|
||||
Lifecycle lifecycle = (Lifecycle) bean;
|
||||
if (lifecycle.isRunning()){
|
||||
log.debug("Stopping: " + lifecycle);
|
||||
//lifecycle.stop();
|
||||
DirectFieldAccessor lifecycleAccessor = new DirectFieldAccessor(lifecycle);
|
||||
lifecycleAccessor.setPropertyValue("running", false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
public List<String> getDependentSources() {
|
||||
return dependentSources;
|
||||
}
|
||||
|
||||
public void setDependentSources(List<String> dependentSources) {
|
||||
this.dependentSources = dependentSources;
|
||||
}
|
||||
|
||||
|
||||
public void setBeanFactory(BeanFactory beanFactory) throws BeansException {
|
||||
this.beanFactory = beanFactory;
|
||||
}
|
||||
}
|
||||
@@ -1,2 +0,0 @@
|
||||
http\://www.springframework.org/schema/integration/integration-control-bus=org.springframework.integration.osgi.config.xml.IntegrationOSGiControlBusNamespaceHandler
|
||||
http\://www.springframework.org/schema/integration/integration-service-extender=org.springframework.integration.osgi.config.xml.IntegrationOSGiServiceExtenderNamespaceHandler
|
||||
@@ -1,3 +0,0 @@
|
||||
http\://www.springframework.org/schema/integration/integration-control-bus/spring-integration-bus-1.0.xsd=org/springframework/integration/osgi/config/xml/spring-integration-bus-1.0.xsd
|
||||
http\://www.springframework.org/schema/integration/integration-service-extender/spring-integration-service-extender-1.0.xsd=org/springframework/integration/osgi/config/xml/spring-integration-service-extender-1.0.xsd
|
||||
|
||||
@@ -1,38 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:si-control="http://www.springframework.org/schema/integration/integration-control-bus"
|
||||
xmlns:si="http://www.springframework.org/schema/integration"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
|
||||
http://www.springframework.org/schema/integration/integration-control-bus http://www.springframework.org/schema/integration/integration-control-bus/spring-integration-bus-1.0.xsd
|
||||
http://www.springframework.org/schema/integration http://www.springframework.org/schema/integration/spring-integration-2.0.xsd">
|
||||
|
||||
<si-control:bus-config group-name="DEFAULT_CONTROL_GROUP"/>
|
||||
|
||||
<!-- SERVICE REGISTRATION CONFIG-->
|
||||
<si:publish-subscribe-channel id="serviceRegistrationControlChannel" task-executor="executor"/>
|
||||
<si:service-activator input-channel="serviceRegistrationControlChannel">
|
||||
<bean class="org.springframework.integration.controlbus.ControlBusMessageHandler"/>
|
||||
</si:service-activator>
|
||||
<!-- END SERVICE REGISTRATION CONFIG-->
|
||||
|
||||
<!-- SERVICE BINDING CONFIG-->
|
||||
<si:publish-subscribe-channel id="serviceBindingControlChannel" task-executor="executor"/>
|
||||
<si:service-activator input-channel="serviceBindingControlChannel">
|
||||
<bean class="org.springframework.integration.controlbus.ControlBusMessageHandler"/>
|
||||
</si:service-activator>
|
||||
<!-- END SERVICE BINDING CONFIG-->
|
||||
|
||||
<!-- CONTROL BUS channel, exposed as an OSGi service -->
|
||||
<si:publish-subscribe-channel id="DEFAULT_CONTROL_DIST_CHANNEL"/>
|
||||
<!-- END CONTROL BUS channel, exposed as an OSGi service -->
|
||||
|
||||
<si:header-value-router input-channel="DEFAULT_CONTROL_DIST_CHANNEL" header-name="INTEGRATION_EVENT_TYPE">
|
||||
<si:mapping value="REGISTRATION" channel="serviceRegistrationControlChannel"/>
|
||||
<si:mapping value="UNREGISTRATION" channel="serviceRegistrationControlChannel"/>
|
||||
<si:mapping value="BINDING" channel="serviceBindingControlChannel"/>
|
||||
<si:mapping value="UNBINDING" channel="serviceBindingControlChannel"/>
|
||||
</si:header-value-router>
|
||||
|
||||
<si:thread-pool-task-executor id="executor" core-size="10"/>
|
||||
</beans>
|
||||
@@ -1,33 +0,0 @@
|
||||
<xsd:schema xmlns="http://www.springframework.org/schema/integration/integration-control-bus"
|
||||
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
|
||||
xmlns:beans="http://www.springframework.org/schema/beans"
|
||||
xmlns:tool="http://www.springframework.org/schema/tool"
|
||||
targetNamespace="http://www.springframework.org/schema/integration/integration-control-bus"
|
||||
elementFormDefault="qualified" attributeFormDefault="unqualified">
|
||||
<xsd:import namespace="http://www.springframework.org/schema/beans" />
|
||||
<xsd:import namespace="http://www.springframework.org/schema/tool" />
|
||||
|
||||
<xsd:element name="bus-config">
|
||||
<xsd:complexType>
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>
|
||||
Configures all required components for a named Control Bus configuration
|
||||
</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
<xsd:attribute name="group-name" type="xsd:string" default="DEFAULT_CONTROL_GROUP">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>
|
||||
Identifies group-name of a Control Bus this configuration defines
|
||||
</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:attribute>
|
||||
<xsd:attribute name="task-executor" type="xsd:string">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>
|
||||
Identifies the 'task-executor' for this bus's instance
|
||||
</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:attribute>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
@@ -1,96 +0,0 @@
|
||||
<xsd:schema
|
||||
xmlns="http://www.springframework.org/schema/integration/integration-service-extender"
|
||||
xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:beans="http://www.springframework.org/schema/beans"
|
||||
xmlns:tool="http://www.springframework.org/schema/tool"
|
||||
targetNamespace="http://www.springframework.org/schema/integration/integration-service-extender"
|
||||
elementFormDefault="qualified" attributeFormDefault="unqualified">
|
||||
<xsd:import namespace="http://www.springframework.org/schema/beans" />
|
||||
<xsd:import namespace="http://www.springframework.org/schema/tool" />
|
||||
|
||||
<xsd:element name="config">
|
||||
<xsd:complexType>
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>
|
||||
Configures SI Service Extender, which configures
|
||||
existing beans as SI Services.
|
||||
</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
<xsd:choice>
|
||||
<xsd:element name="export" minOccurs="0" maxOccurs="unbounded">
|
||||
<xsd:complexType>
|
||||
<xsd:complexContent>
|
||||
<xsd:extension base="siTypes">
|
||||
<xsd:attribute name="ref" type="xsd:string">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>
|
||||
Identifies the name of the 'bean' to be
|
||||
exported as an SI Service. Framework will find bean matching
|
||||
this name and export it as an SI Service.
|
||||
</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:attribute>
|
||||
</xsd:extension>
|
||||
</xsd:complexContent>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="import" minOccurs="0" maxOccurs="unbounded">
|
||||
<xsd:complexType>
|
||||
<xsd:complexContent>
|
||||
<xsd:extension base="siTypes">
|
||||
<xsd:attribute name="name" type="xsd:string">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>
|
||||
Identifies the name of the 'bean' to be
|
||||
imported as an SI Service.
|
||||
</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:attribute>
|
||||
</xsd:extension>
|
||||
</xsd:complexContent>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<!-- -->
|
||||
<xsd:complexType name="siTypes">
|
||||
<xsd:attribute name="si-type">
|
||||
<xsd:simpleType>
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>Identifies the supported type of Spring
|
||||
Integration components to be
|
||||
exported as SI Services. Framework
|
||||
will find all components of matching type and export them as
|
||||
SI
|
||||
Services.
|
||||
</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
<xsd:restriction base="xsd:string">
|
||||
<xsd:enumeration value="publish-subscribe-channel">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>
|
||||
Will export all components of type
|
||||
<publish-subscribe-channel> as SI Services
|
||||
</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:enumeration>
|
||||
</xsd:restriction>
|
||||
</xsd:simpleType>
|
||||
</xsd:attribute>
|
||||
<xsd:attribute name="control-bus" type="xsd:string">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>Identifies the name of the 'control-bus'
|
||||
which
|
||||
will manage this component. This
|
||||
means that framework will
|
||||
dispatch
|
||||
control events to the identified
|
||||
'control-bus'.
|
||||
(OPTIONAL if no
|
||||
control is necessary)
|
||||
</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:attribute>
|
||||
</xsd:complexType>
|
||||
</xsd:schema>
|
||||
@@ -1,53 +0,0 @@
|
||||
/*
|
||||
* Copyright 2002-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.integration.osgi;
|
||||
|
||||
import java.net.URL;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Enumeration;
|
||||
|
||||
import org.osgi.framework.BundleContext;
|
||||
import org.springframework.core.io.ClassPathResource;
|
||||
import org.springframework.integration.osgi.stubs.SIBundleContextStub;
|
||||
import org.springframework.osgi.context.ConfigurableOsgiBundleApplicationContext;
|
||||
import org.springframework.osgi.context.support.OsgiBundleXmlApplicationContext;
|
||||
import org.springframework.osgi.mock.ArrayEnumerator;
|
||||
import org.springframework.osgi.mock.MockBundle;
|
||||
|
||||
/**
|
||||
* @author Oleg Zhurakousky
|
||||
* @since 2.0
|
||||
*/
|
||||
public abstract class AbstractSIConfigBundleTestDeployer {
|
||||
protected OsgiBundleXmlApplicationContext applicationContext;
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public ConfigurableOsgiBundleApplicationContext deploySIConfig(BundleContext bundleContext, String configPackage, String... configFiles) throws Exception {
|
||||
applicationContext = new OsgiBundleXmlApplicationContext(configFiles);
|
||||
final ArrayList<URL> tempConfigurations = new ArrayList<URL>();
|
||||
for (String configFile : configFiles) {
|
||||
tempConfigurations.add(new ClassPathResource(configPackage + configFile).getURL());
|
||||
}
|
||||
((SIBundleContextStub)bundleContext).setBundle(new MockBundle() {
|
||||
public Enumeration findEntries(String path, String filePattern, boolean recurse) {
|
||||
return new ArrayEnumerator(tempConfigurations.toArray());
|
||||
}
|
||||
});
|
||||
((OsgiBundleXmlApplicationContext)applicationContext).setBundleContext(bundleContext);
|
||||
((OsgiBundleXmlApplicationContext)applicationContext).refresh();
|
||||
return applicationContext;
|
||||
}
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:si-control="http://www.springframework.org/schema/integration/integration-control-bus"
|
||||
xmlns:si="http://www.springframework.org/schema/integration"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
|
||||
http://www.springframework.org/schema/integration/integration-control-bus http://www.springframework.org/schema/integration/integration-control-bus/spring-integration-bus-1.0.xsd
|
||||
http://www.springframework.org/schema/integration http://www.springframework.org/schema/integration/spring-integration-2.0.xsd">
|
||||
|
||||
<import resource="base-bus-config.xml"/>
|
||||
|
||||
<si-control:bus-config/>
|
||||
|
||||
</beans>
|
||||
@@ -1,14 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:si-control="http://www.springframework.org/schema/integration/integration-control-bus"
|
||||
xmlns:si="http://www.springframework.org/schema/integration"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
|
||||
http://www.springframework.org/schema/integration/integration-control-bus http://www.springframework.org/schema/integration/integration-control-bus/spring-integration-bus-1.0.xsd
|
||||
http://www.springframework.org/schema/integration http://www.springframework.org/schema/integration/spring-integration-2.0.xsd">
|
||||
|
||||
<import resource="base-bus-config.xml"/>
|
||||
|
||||
<si-control:bus-config group-name="FOO"/>
|
||||
|
||||
</beans>
|
||||
@@ -1,65 +0,0 @@
|
||||
/*
|
||||
* Copyright 2002-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.integration.osgi.config.xml;
|
||||
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.osgi.framework.BundleContext;
|
||||
import org.osgi.framework.ServiceReference;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.integration.controlbus.ControlBus;
|
||||
import org.springframework.integration.osgi.AbstractSIConfigBundleTestDeployer;
|
||||
import org.springframework.integration.osgi.IntegrationOSGiConstants;
|
||||
import org.springframework.integration.osgi.stubs.SIBundleContextStub;
|
||||
|
||||
|
||||
/**
|
||||
* @author Oleg Zhurakousky
|
||||
* @since 2.0
|
||||
*/
|
||||
public class BusConfigParserTests extends AbstractSIConfigBundleTestDeployer {
|
||||
|
||||
@Test
|
||||
public void testDefaultControlBusConfig() throws Exception {
|
||||
BundleContext bundleContext = SIBundleContextStub.getInstance();
|
||||
ApplicationContext ac = this.deploySIConfig(bundleContext,
|
||||
"org/springframework/integration/osgi/config/xml/",
|
||||
"BusConfigParserTests-default.xml");
|
||||
ControlBus controlBus = (ControlBus) ac.getBean(ControlBusOSGiConfigUtils.DEFAULT_BUS_GROUP_NAME);
|
||||
assertNotNull(controlBus);
|
||||
ServiceReference[] sr = bundleContext.getServiceReferences(ControlBus.class.getName(),
|
||||
"(&(" + IntegrationOSGiConstants.OSGI_BEAN_NAME + "=" +
|
||||
ControlBusOSGiConfigUtils.DEFAULT_BUS_GROUP_NAME + "))");
|
||||
assertNotNull(sr);
|
||||
assertTrue(sr.length == 1);
|
||||
controlBus = (ControlBus) bundleContext.getService(sr[0]);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testNamededControlBusConfig() throws Exception {
|
||||
BundleContext bundleContext = SIBundleContextStub.getInstance();
|
||||
ApplicationContext ac = this.deploySIConfig(bundleContext,
|
||||
"org/springframework/integration/osgi/config/xml/",
|
||||
"BusConfigParserTests-overrideGroupName.xml");
|
||||
ControlBus controlBus = (ControlBus) ac.getBean("FOO");
|
||||
assertNotNull(controlBus);
|
||||
ServiceReference sr = bundleContext.getServiceReference(ControlBus.class.getName());
|
||||
assertNotNull(sr);
|
||||
controlBus = (ControlBus) bundleContext.getService(sr);
|
||||
}
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:si-control="http://www.springframework.org/schema/integration/integration-control-bus"
|
||||
xmlns:si="http://www.springframework.org/schema/integration"
|
||||
xmlns:osgi="http://www.springframework.org/schema/osgi"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
|
||||
http://www.springframework.org/schema/integration/integration-control-bus http://www.springframework.org/schema/integration/integration-control-bus/spring-integration-bus-1.0.xsd
|
||||
http://www.springframework.org/schema/integration http://www.springframework.org/schema/integration/spring-integration-2.0.xsd
|
||||
http://www.springframework.org/schema/osgi http://www.springframework.org/schema/osgi/spring-osgi.xsd">
|
||||
|
||||
|
||||
<osgi:reference id="bus" interface="org.springframework.integration.controlbus.ControlBus">
|
||||
<osgi:listener ref="busListener" bind-method="bind" unbind-method="unBind"/>
|
||||
</osgi:reference>
|
||||
|
||||
<bean id="busListener" class="org.springframework.integration.osgi.config.xml.BusUsageFailoverTests$BusListener"/>
|
||||
</beans>
|
||||
@@ -1,13 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:si-control="http://www.springframework.org/schema/integration/integration-control-bus"
|
||||
xmlns:si="http://www.springframework.org/schema/integration"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
|
||||
http://www.springframework.org/schema/integration/integration-control-bus http://www.springframework.org/schema/integration/integration-control-bus/spring-integration-bus-1.0.xsd
|
||||
http://www.springframework.org/schema/integration http://www.springframework.org/schema/integration/spring-integration-2.0.xsd">
|
||||
|
||||
<import resource="base-bus-config.xml"/>
|
||||
<si-control:bus-config/>
|
||||
|
||||
</beans>
|
||||
@@ -1,13 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:si-control="http://www.springframework.org/schema/integration/integration-control-bus"
|
||||
xmlns:si="http://www.springframework.org/schema/integration"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
|
||||
http://www.springframework.org/schema/integration/integration-control-bus http://www.springframework.org/schema/integration/integration-control-bus/spring-integration-bus-1.0.xsd
|
||||
http://www.springframework.org/schema/integration http://www.springframework.org/schema/integration/spring-integration-2.0.xsd">
|
||||
|
||||
<import resource="base-bus-config.xml"/>
|
||||
<si-control:bus-config/>
|
||||
|
||||
</beans>
|
||||
@@ -1,79 +0,0 @@
|
||||
/*
|
||||
* Copyright 2002-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.integration.osgi.config.xml;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.mockito.Mockito;
|
||||
import org.osgi.framework.BundleContext;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.ConfigurableApplicationContext;
|
||||
import org.springframework.integration.controlbus.ControlBus;
|
||||
import org.springframework.integration.message.MessageHandler;
|
||||
import org.springframework.integration.message.StringMessage;
|
||||
import org.springframework.integration.osgi.AbstractSIConfigBundleTestDeployer;
|
||||
import org.springframework.integration.osgi.stubs.SIBundleContextStub;
|
||||
|
||||
/**
|
||||
* This test bootstraps two instances of the Control Bus, then shuts down one demonstrating and testing
|
||||
* transparent fail-over to another instance of the Control Bus
|
||||
*
|
||||
* @author Oleg Zhurakousky
|
||||
* @since 2.0
|
||||
*/
|
||||
public class BusUsageFailoverTests extends AbstractSIConfigBundleTestDeployer {
|
||||
static MessageHandler handler = Mockito.mock(MessageHandler.class);
|
||||
|
||||
|
||||
@Test
|
||||
public void testControlBusFailover() throws Exception {
|
||||
BundleContext bundleContext = SIBundleContextStub.getInstance();
|
||||
|
||||
ConfigurableApplicationContext primaryAc = this.deploySIConfig(bundleContext,
|
||||
"org/springframework/integration/osgi/config/xml/",
|
||||
"BusUsageFailoverTests-context-primary.xml");
|
||||
|
||||
this.deploySIConfig(bundleContext,
|
||||
"org/springframework/integration/osgi/config/xml/",
|
||||
"BusUsageFailoverTests-context-secondary.xml");
|
||||
|
||||
ApplicationContext userAC = this.deploySIConfig(bundleContext,
|
||||
"org/springframework/integration/osgi/config/xml/",
|
||||
"BusUsageFailoverReferenceTests-context.xml");
|
||||
|
||||
ControlBus bus = (ControlBus) userAC.getBean("bus");
|
||||
StringMessage message = new StringMessage("hello");
|
||||
|
||||
bus.send(message);
|
||||
Thread.sleep(200);
|
||||
Mockito.verify(handler, Mockito.times(1)).handleMessage(message);
|
||||
primaryAc.close(); // shut down primary Bus
|
||||
|
||||
Mockito.reset(handler);
|
||||
bus.send(message);
|
||||
Thread.sleep(200);
|
||||
Mockito.verify(handler, Mockito.times(1)).handleMessage(message);
|
||||
}
|
||||
|
||||
public static class BusListener{
|
||||
public void bind(ControlBus bus, Map properties){
|
||||
bus.subscribe(handler);
|
||||
}
|
||||
public void unBind(ControlBus bus, Map properties){
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:si-service="http://www.springframework.org/schema/integration/integration-service-extender"
|
||||
xmlns:si-control="http://www.springframework.org/schema/integration/integration-control-bus"
|
||||
xmlns:si="http://www.springframework.org/schema/integration"
|
||||
xmlns:osgi="http://www.springframework.org/schema/osgi"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
|
||||
http://www.springframework.org/schema/integration/integration-control-bus http://www.springframework.org/schema/integration/integration-control-bus/spring-integration-bus-1.0.xsd
|
||||
http://www.springframework.org/schema/integration/integration-service-extender http://www.springframework.org/schema/integration/integration-service-extender/spring-integration-service-extender-1.0.xsd
|
||||
http://www.springframework.org/schema/osgi http://www.springframework.org/schema/osgi/spring-osgi-1.2.xsd
|
||||
http://www.springframework.org/schema/integration http://www.springframework.org/schema/integration/spring-integration-2.0.xsd">
|
||||
|
||||
<si:publish-subscribe-channel id="channelA"/>
|
||||
<si:publish-subscribe-channel id="channelB"/>
|
||||
|
||||
<si:channel id="channelC"/>
|
||||
|
||||
<si-service:config>
|
||||
<si-service:export si-type="publish-subscribe-channel"/>
|
||||
<si-service:export ref="channelC"/>
|
||||
</si-service:config>
|
||||
|
||||
<osgi:reference id="channelA-reference" interface="org.springframework.integration.channel.SubscribableChannel"/>
|
||||
</beans>
|
||||
@@ -1,26 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:si-service="http://www.springframework.org/schema/integration/integration-service-extender"
|
||||
xmlns:si-control="http://www.springframework.org/schema/integration/integration-control-bus"
|
||||
xmlns:si="http://www.springframework.org/schema/integration"
|
||||
xmlns:osgi="http://www.springframework.org/schema/osgi"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
|
||||
http://www.springframework.org/schema/integration/integration-control-bus http://www.springframework.org/schema/integration/integration-control-bus/spring-integration-bus-1.0.xsd
|
||||
http://www.springframework.org/schema/integration/integration-service-extender http://www.springframework.org/schema/integration/integration-service-extender/spring-integration-service-extender-1.0.xsd
|
||||
http://www.springframework.org/schema/osgi http://www.springframework.org/schema/osgi/spring-osgi-1.2.xsd
|
||||
http://www.springframework.org/schema/integration http://www.springframework.org/schema/integration/spring-integration-2.0.xsd">
|
||||
|
||||
<si:publish-subscribe-channel id="channelA"/>
|
||||
<si:publish-subscribe-channel id="channelB"/>
|
||||
|
||||
<si:channel id="channelC"/>
|
||||
|
||||
<si-service:config>
|
||||
<si-service:export si-type="publish-subscribe-channel" control-bus="DEFAULT_CONTROL_GROUP"/>
|
||||
<si-service:export ref="channelC" control-bus="DEFAULT_CONTROL_GROUP"/>
|
||||
</si-service:config>
|
||||
</beans>
|
||||
|
||||
|
||||
<!-- <si-service:import name="foo"/>-->
|
||||
@@ -1,80 +0,0 @@
|
||||
/*
|
||||
* Copyright 2002-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.integration.osgi.config.xml;
|
||||
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.mockito.Mockito;
|
||||
import org.osgi.framework.BundleContext;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.ConfigurableApplicationContext;
|
||||
import org.springframework.integration.channel.SubscribableChannel;
|
||||
import org.springframework.integration.controlbus.ControlBus;
|
||||
import org.springframework.integration.core.Message;
|
||||
import org.springframework.integration.message.MessageHandler;
|
||||
import org.springframework.integration.message.StringMessage;
|
||||
import org.springframework.integration.osgi.AbstractSIConfigBundleTestDeployer;
|
||||
import org.springframework.integration.osgi.stubs.SIBundleContextStub;
|
||||
|
||||
/**
|
||||
* Tests 'config' element.
|
||||
*
|
||||
* @author Oleg Zhurakousky
|
||||
* @since 2.0
|
||||
*/
|
||||
public class ConfigParserExporterTests extends AbstractSIConfigBundleTestDeployer {
|
||||
|
||||
@Test
|
||||
public void testBasicSIServiceConfig() throws Exception {
|
||||
BundleContext bundleContext = SIBundleContextStub.getNewInstance();
|
||||
ApplicationContext ac = this.deploySIConfig(bundleContext,
|
||||
"org/springframework/integration/osgi/config/xml/",
|
||||
"ConfigParserExporterTests-default.xml");
|
||||
assertNotNull(ac.getBean("channelA-Service"));
|
||||
assertNotNull(ac.getBean("channelB-Service"));
|
||||
assertNotNull(ac.getBean("channelC-Service"));
|
||||
|
||||
SubscribableChannel channel = (SubscribableChannel) ac.getBean("channelA");
|
||||
SubscribableChannel channel_reference = ac.getBean("channelA-reference", SubscribableChannel.class);
|
||||
// verify that standar OSGi configuration can still bind to this service
|
||||
MessageHandler handler = Mockito.mock(MessageHandler.class);
|
||||
channel_reference.subscribe(handler);
|
||||
Message<String> message = new StringMessage("hello");
|
||||
channel.send(message);
|
||||
Mockito.verify(handler, Mockito.times(1)).handleMessage(message);
|
||||
}
|
||||
@Test
|
||||
public void testControlBusAttributeWithBusPresent() throws Exception {
|
||||
BundleContext bundleContext = SIBundleContextStub.getNewInstance();
|
||||
ConfigurableApplicationContext busAC = this.deploySIConfig(bundleContext,
|
||||
"org/springframework/integration/osgi/config/xml/",
|
||||
"BusConfigParserTests-default.xml");
|
||||
ConfigurableApplicationContext ac = this.deploySIConfig(bundleContext,
|
||||
"org/springframework/integration/osgi/config/xml/",
|
||||
"ConfigParserExporterTests-withbus-attribute.xml");
|
||||
assertNotNull(ac.getBean("channelA-Service"));
|
||||
assertNotNull(ac.getBean("channelB-Service"));
|
||||
assertNotNull(ac.getBean("channelC-Service"));
|
||||
ControlBus bus = (ControlBus) ac.getBean("DEFAULT_CONTROL_GROUP");
|
||||
assertNotNull(bus);
|
||||
MessageHandler handler = Mockito.mock(MessageHandler.class);
|
||||
bus.subscribe(handler);
|
||||
ac.close();
|
||||
// should be 3 notification messages sent to the bus
|
||||
Mockito.verify(handler, Mockito.times(3)).handleMessage((Message<?>) Mockito.any());
|
||||
}
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:si-service="http://www.springframework.org/schema/integration/integration-service-extender"
|
||||
xmlns:si="http://www.springframework.org/schema/integration"
|
||||
xmlns:osgi="http://www.springframework.org/schema/osgi"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
|
||||
http://www.springframework.org/schema/integration/integration-service-extender http://www.springframework.org/schema/integration/integration-service-extender/spring-integration-service-extender-1.0.xsd
|
||||
http://www.springframework.org/schema/osgi http://www.springframework.org/schema/osgi/spring-osgi-1.2.xsd
|
||||
http://www.springframework.org/schema/integration http://www.springframework.org/schema/integration/spring-integration-2.0.xsd">
|
||||
|
||||
<si-service:config>
|
||||
<si-service:import name="channelA" si-type="publish-subscribe-channel" control-bus="DEFAULT_CONTROL_GROUP"/>
|
||||
</si-service:config>
|
||||
|
||||
<si:service-activator id="sampleActivator" input-channel="channelA" auto-startup="false">
|
||||
<bean class="org.springframework.integration.osgi.config.xml.ConfigParserImporterTests$TestBean"/>
|
||||
</si:service-activator>
|
||||
|
||||
<si:gateway id="sampleGateway" service-interface="java.io.Serializable" default-request-channel="channelA"/>
|
||||
|
||||
|
||||
</beans>
|
||||
@@ -1,18 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:si-service="http://www.springframework.org/schema/integration/integration-service-extender"
|
||||
xmlns:si="http://www.springframework.org/schema/integration"
|
||||
xmlns:osgi="http://www.springframework.org/schema/osgi"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
|
||||
http://www.springframework.org/schema/integration/integration-service-extender http://www.springframework.org/schema/integration/integration-service-extender/spring-integration-service-extender-1.0.xsd
|
||||
http://www.springframework.org/schema/osgi http://www.springframework.org/schema/osgi/spring-osgi-1.2.xsd
|
||||
http://www.springframework.org/schema/integration http://www.springframework.org/schema/integration/spring-integration-2.0.xsd">
|
||||
|
||||
<si-service:config>
|
||||
<si-service:export si-type="publish-subscribe-channel"/>
|
||||
</si-service:config>
|
||||
|
||||
<si:publish-subscribe-channel id="channelA"/>
|
||||
|
||||
</beans>
|
||||
@@ -1,146 +0,0 @@
|
||||
/*
|
||||
* Copyright 2002-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.integration.osgi.config.xml;
|
||||
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import junit.framework.Assert;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.mockito.Mockito;
|
||||
import org.osgi.framework.BundleContext;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.ConfigurableApplicationContext;
|
||||
import org.springframework.context.Lifecycle;
|
||||
import org.springframework.integration.channel.SubscribableChannel;
|
||||
import org.springframework.integration.controlbus.ControlBus;
|
||||
import org.springframework.integration.core.Message;
|
||||
import org.springframework.integration.message.MessageHandler;
|
||||
import org.springframework.integration.message.StringMessage;
|
||||
import org.springframework.integration.osgi.AbstractSIConfigBundleTestDeployer;
|
||||
import org.springframework.integration.osgi.stubs.SIBundleContextStub;
|
||||
import org.springframework.osgi.service.ServiceUnavailableException;
|
||||
|
||||
/**
|
||||
* Tests 'config' element.
|
||||
*
|
||||
* @author Oleg Zhurakousky
|
||||
* @since 2.0
|
||||
*/
|
||||
public class ConfigParserImporterTests extends AbstractSIConfigBundleTestDeployer {
|
||||
|
||||
@Test
|
||||
public void testBasicSIServiceConfigNoBackingService() throws Exception {
|
||||
BundleContext bundleContext = SIBundleContextStub.getNewInstance();
|
||||
ApplicationContext ac = this.deploySIConfig(bundleContext,
|
||||
"org/springframework/integration/osgi/config/xml/",
|
||||
"ConfigParserImporterTests-default.xml");
|
||||
SubscribableChannel channel = ac.getBean("channelA", SubscribableChannel.class);
|
||||
assertNotNull(channel);
|
||||
}
|
||||
|
||||
@Test(expected=ServiceUnavailableException.class)
|
||||
public void testBasicSIServiceConfigNoBackingServiceError() throws Exception {
|
||||
BundleContext bundleContext = SIBundleContextStub.getNewInstance();
|
||||
ApplicationContext ac = this.deploySIConfig(bundleContext,
|
||||
"org/springframework/integration/osgi/config/xml/",
|
||||
"ConfigParserImporterTests-default.xml");
|
||||
SubscribableChannel channel = ac.getBean("channelA", SubscribableChannel.class);
|
||||
assertNotNull(channel);
|
||||
// try to use it and see error
|
||||
channel.send(null);
|
||||
}
|
||||
/**
|
||||
* Will register AC with service importer, then it will register another AC with service exporter
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
@Test
|
||||
public void testBasicSIServiceConfigWithBackingService() throws Exception {
|
||||
BundleContext bundleContext = SIBundleContextStub.getNewInstance();
|
||||
ApplicationContext ac = this.deploySIConfig(bundleContext,
|
||||
"org/springframework/integration/osgi/config/xml/",
|
||||
"ConfigParserImporterTests-default.xml");
|
||||
SubscribableChannel channel = ac.getBean("channelA", SubscribableChannel.class);
|
||||
assertNotNull(channel);
|
||||
this.deploySIConfig(bundleContext,
|
||||
"org/springframework/integration/osgi/config/xml/",
|
||||
"ConfigParserImporterTests-exporter.xml");
|
||||
MessageHandler handler = Mockito.mock(MessageHandler.class);
|
||||
Message<String> message = new StringMessage("hello");
|
||||
channel.subscribe(handler);
|
||||
channel.send(message);
|
||||
Mockito.verify(handler, Mockito.times(1)).handleMessage(message);
|
||||
}
|
||||
@Test
|
||||
public void testBasicSIServiceConfigWithBackingServiceLate() throws Exception {
|
||||
BundleContext bundleContext = SIBundleContextStub.getNewInstance();
|
||||
ApplicationContext ac = this.deploySIConfig(bundleContext,
|
||||
"org/springframework/integration/osgi/config/xml/",
|
||||
"ConfigParserImporterTests-default.xml");
|
||||
SubscribableChannel channel = ac.getBean("channelA", SubscribableChannel.class);
|
||||
assertNotNull(channel);
|
||||
Lifecycle sampleActivator = (Lifecycle) ac.getBean("sampleActivator");
|
||||
Assert.assertTrue(!sampleActivator.isRunning());
|
||||
try {
|
||||
channel.send(new StringMessage("hello"));
|
||||
Assert.fail("Should have failed with ServiceUnavailableException");
|
||||
} catch (ServiceUnavailableException e) {}
|
||||
|
||||
|
||||
ConfigurableApplicationContext exporterAC = this.deploySIConfig(bundleContext,
|
||||
"org/springframework/integration/osgi/config/xml/",
|
||||
"ConfigParserImporterTests-exporter.xml");
|
||||
Assert.assertTrue(sampleActivator.isRunning());
|
||||
try {
|
||||
channel.send(new StringMessage("hello"));
|
||||
} catch (Exception e) {
|
||||
Assert.fail("Should not have failed");
|
||||
}
|
||||
exporterAC.close();
|
||||
Assert.assertTrue(!sampleActivator.isRunning());
|
||||
exporterAC = this.deploySIConfig(bundleContext,
|
||||
"org/springframework/integration/osgi/config/xml/",
|
||||
"ConfigParserImporterTests-exporter.xml");
|
||||
Assert.assertTrue(sampleActivator.isRunning());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testControlBusAttributeWithBusPresent() throws Exception {
|
||||
BundleContext bundleContext = SIBundleContextStub.getNewInstance();
|
||||
ConfigurableApplicationContext busAC = this.deploySIConfig(bundleContext,
|
||||
"org/springframework/integration/osgi/config/xml/",
|
||||
"BusConfigParserTests-default.xml");
|
||||
ConfigurableApplicationContext exporterAC = this.deploySIConfig(bundleContext,
|
||||
"org/springframework/integration/osgi/config/xml/",
|
||||
"ConfigParserImporterTests-exporter.xml");
|
||||
ConfigurableApplicationContext ac = this.deploySIConfig(bundleContext,
|
||||
"org/springframework/integration/osgi/config/xml/",
|
||||
"ConfigParserImporterTests-default.xml");
|
||||
assertNotNull(ac.getBean("channelA"));
|
||||
|
||||
ControlBus bus = (ControlBus) ac.getBean("DEFAULT_CONTROL_GROUP");
|
||||
assertNotNull(bus);
|
||||
MessageHandler handler = Mockito.mock(MessageHandler.class);
|
||||
bus.subscribe(handler);
|
||||
exporterAC.close();
|
||||
// should be 1 notification message sent to the bus
|
||||
Mockito.verify(handler, Mockito.times(1)).handleMessage((Message<?>) Mockito.any());
|
||||
}
|
||||
|
||||
public static class TestBean{
|
||||
public void foo(Message<?> message){}
|
||||
}
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:si-control="http://www.springframework.org/schema/integration/integration-control-bus"
|
||||
xmlns:si="http://www.springframework.org/schema/integration"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
|
||||
http://www.springframework.org/schema/integration/integration-control-bus http://www.springframework.org/schema/integration/integration-control-bus/spring-integration-bus-1.0.xsd
|
||||
http://www.springframework.org/schema/integration http://www.springframework.org/schema/integration/spring-integration-2.0.xsd">
|
||||
|
||||
<import resource="base-bus-config.xml"/>
|
||||
<si-control:bus-config/>
|
||||
<si-control:bus-config/>
|
||||
|
||||
</beans>
|
||||
@@ -1,38 +0,0 @@
|
||||
/*
|
||||
* Copyright 2002-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.integration.osgi.config.xml;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.osgi.framework.BundleContext;
|
||||
import org.springframework.beans.factory.BeanDefinitionStoreException;
|
||||
import org.springframework.integration.osgi.AbstractSIConfigBundleTestDeployer;
|
||||
import org.springframework.integration.osgi.stubs.SIBundleContextStub;
|
||||
|
||||
/**
|
||||
* Will make sure only one instance of the Control Bus can exist per single Application Context
|
||||
*
|
||||
* @author Oleg Zhurakousky
|
||||
* @since 2.0
|
||||
*/
|
||||
public class MultiBusDefinitionInSingleApplicationContextTests extends AbstractSIConfigBundleTestDeployer{
|
||||
@Test(expected=BeanDefinitionStoreException.class)
|
||||
public void testMultiBusDefinitionConfig() throws Exception {
|
||||
BundleContext bundleContext = SIBundleContextStub.getInstance();
|
||||
this.deploySIConfig(bundleContext,
|
||||
"org/springframework/integration/osgi/config/xml/",
|
||||
"MultiBusDefinitionInSingleApplicationContextTests-context.xml");
|
||||
}
|
||||
}
|
||||
@@ -1,38 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:task="http://www.springframework.org/schema/task"
|
||||
xmlns:si-control="http://www.springframework.org/schema/integration/integration-control-bus"
|
||||
xmlns:si="http://www.springframework.org/schema/integration"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
|
||||
http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task-3.0.xsd
|
||||
http://www.springframework.org/schema/integration/integration-control-bus http://www.springframework.org/schema/integration/integration-control-bus/spring-integration-bus-1.0.xsd
|
||||
http://www.springframework.org/schema/integration http://www.springframework.org/schema/integration/spring-integration-2.0.xsd">
|
||||
|
||||
<!-- SERVICE REGISTRATION CONFIG-->
|
||||
<si:publish-subscribe-channel id="serviceRegistrationControlChannel" task-executor="executor"/>
|
||||
<si:service-activator input-channel="serviceRegistrationControlChannel">
|
||||
<bean class="org.springframework.integration.controlbus.ControlBusMessageHandler"/>
|
||||
</si:service-activator>
|
||||
<!-- END SERVICE REGISTRATION CONFIG-->
|
||||
|
||||
<!-- SERVICE BINDING CONFIG-->
|
||||
<si:publish-subscribe-channel id="serviceBindingControlChannel" task-executor="executor"/>
|
||||
<si:service-activator input-channel="serviceBindingControlChannel">
|
||||
<bean class="org.springframework.integration.controlbus.ControlBusMessageHandler"/>
|
||||
</si:service-activator>
|
||||
<!-- END SERVICE BINDING CONFIG-->
|
||||
|
||||
<!-- CONTROL BUS channel, exposed as an OSGi service -->
|
||||
<si:publish-subscribe-channel id="DEFAULT_CONTROL_DIST_CHANNEL"/>
|
||||
<!-- END CONTROL BUS channel, exposed as an OSGi service -->
|
||||
|
||||
<si:header-value-router input-channel="controlMessagesDistributionChannel" header-name="INTEGRATION_EVENT_TYPE">
|
||||
<si:mapping value="REGISTRATION" channel="serviceRegistrationControlChannel"/>
|
||||
<si:mapping value="UNREGISTRATION" channel="serviceRegistrationControlChannel"/>
|
||||
<si:mapping value="BINDING" channel="serviceBindingControlChannel"/>
|
||||
<si:mapping value="UNBINDING" channel="serviceBindingControlChannel"/>
|
||||
</si:header-value-router>
|
||||
|
||||
<task:executor id="executor" pool-size="10"/>
|
||||
</beans>
|
||||
@@ -1,10 +0,0 @@
|
||||
package org.springframework.integration.osgi.demo;
|
||||
|
||||
import org.springframework.integration.core.Message;
|
||||
|
||||
public class SampleActivator {
|
||||
|
||||
public void handle(Message<?> message){
|
||||
System.out.println("Message: " + message);
|
||||
}
|
||||
}
|
||||
@@ -1,57 +0,0 @@
|
||||
/*
|
||||
* Copyright 2002-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.integration.osgi.demo;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.osgi.framework.BundleContext;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.integration.channel.SubscribableChannel;
|
||||
import org.springframework.integration.message.StringMessage;
|
||||
import org.springframework.integration.osgi.AbstractSIConfigBundleTestDeployer;
|
||||
import org.springframework.integration.osgi.stubs.SIBundleContextStub;
|
||||
import org.springframework.osgi.context.support.OsgiBundleXmlApplicationContext;
|
||||
|
||||
/**
|
||||
* Simple demo shows how Spring-DM namespace support could be applied without using
|
||||
* real OSGi runtime, by simply stubbing out OSGi BundleContext and passing it to
|
||||
* OsgiBundleXmlApplicationContext
|
||||
*
|
||||
* @author Oleg Zhurakousky
|
||||
* @since 2.0
|
||||
*/
|
||||
public class SpringDMnoOSGiDemo extends AbstractSIConfigBundleTestDeployer {
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
new SpringDMnoOSGiDemo().runDemo();
|
||||
}
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public void runDemo() throws Exception {
|
||||
BundleContext bundleContext = SIBundleContextStub.getNewInstance();
|
||||
ApplicationContext serviceExporterAC = this.deploySIConfig(bundleContext,
|
||||
"org/springframework/integration/osgi/extender/",
|
||||
"ac-service-exporter.xml");
|
||||
ApplicationContext serviceImporterAC = this.deploySIConfig(bundleContext,
|
||||
"org/springframework/integration/osgi/extender/",
|
||||
"ac-service-importer.xml");
|
||||
// get channel from the exporter AC and send message
|
||||
SubscribableChannel channel = serviceExporterAC.getBean("input", SubscribableChannel.class);
|
||||
channel.send(new StringMessage("Hello String-DM without OSGi"));
|
||||
// the output coming out of Service Activator defined in importer AC should display the message
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:si-control="http://www.springframework.org/schema/integration/integration-control-bus"
|
||||
xmlns:si="http://www.springframework.org/schema/integration"
|
||||
xmlns:osgi="http://www.springframework.org/schema/osgi"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
|
||||
http://www.springframework.org/schema/integration/integration-control-bus http://www.springframework.org/schema/integration/integration-control-bus/spring-integration-bus-1.0.xsd
|
||||
http://www.springframework.org/schema/integration http://www.springframework.org/schema/integration/spring-integration-2.0.xsd
|
||||
http://www.springframework.org/schema/osgi http://www.springframework.org/schema/osgi/spring-osgi.xsd">
|
||||
|
||||
|
||||
<si:publish-subscribe-channel id="input"/>
|
||||
|
||||
<osgi:service ref="input" interface="org.springframework.integration.channel.SubscribableChannel"/>
|
||||
</beans>
|
||||
@@ -1,18 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:si-control="http://www.springframework.org/schema/integration/integration-control-bus"
|
||||
xmlns:si="http://www.springframework.org/schema/integration"
|
||||
xmlns:osgi="http://www.springframework.org/schema/osgi"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
|
||||
http://www.springframework.org/schema/integration/integration-control-bus http://www.springframework.org/schema/integration/integration-control-bus/spring-integration-bus-1.0.xsd
|
||||
http://www.springframework.org/schema/integration http://www.springframework.org/schema/integration/spring-integration-2.0.xsd
|
||||
http://www.springframework.org/schema/osgi http://www.springframework.org/schema/osgi/spring-osgi.xsd">
|
||||
|
||||
|
||||
<osgi:reference id="input" interface="org.springframework.integration.channel.SubscribableChannel"/>
|
||||
|
||||
<si:service-activator input-channel="input">
|
||||
<bean class="org.springframework.integration.osgi.extender.SampleActivator"/>
|
||||
</si:service-activator>
|
||||
</beans>
|
||||
@@ -1,117 +0,0 @@
|
||||
/*
|
||||
* Copyright 2002-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.integration.osgi.stubs;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Dictionary;
|
||||
import java.util.Enumeration;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.StringTokenizer;
|
||||
|
||||
import org.osgi.framework.ServiceReference;
|
||||
import org.springframework.osgi.util.internal.MapBasedDictionary;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
/**
|
||||
* @author Oleg Zhurakousky
|
||||
* @since 2.0
|
||||
*/
|
||||
public class OSGiMockUtils {
|
||||
|
||||
public static Dictionary parseFilterIntoDictionary(String filter){
|
||||
Dictionary properties = new MapBasedDictionary();
|
||||
String filterToEvaluate = null;
|
||||
if (filter != null){
|
||||
StringTokenizer tokenizer = new StringTokenizer(filter, "()&!");
|
||||
while(tokenizer.hasMoreTokens()){
|
||||
String nextToken = tokenizer.nextToken();
|
||||
String name = nextToken.substring(0, nextToken.indexOf("="));
|
||||
String value = nextToken.substring(nextToken.indexOf("=")+1);
|
||||
properties.put(name, value);
|
||||
}
|
||||
}
|
||||
return properties;
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @param originalFilter
|
||||
* @param valueToAdd
|
||||
*/
|
||||
public static String addToFilter(String originalFilter, String valueToAdd) {
|
||||
MapBasedDictionary original = new MapBasedDictionary(OSGiMockUtils.parseFilterIntoDictionary(originalFilter));
|
||||
Dictionary added = OSGiMockUtils.parseFilterIntoDictionary(valueToAdd);
|
||||
original.putAll(added);
|
||||
StringBuffer newFilter = new StringBuffer("(&");
|
||||
Enumeration emum = original.keys();
|
||||
while (emum.hasMoreElements()) {
|
||||
Object key = (Object) emum.nextElement();
|
||||
Object value = original.get(key);
|
||||
newFilter.append("(");
|
||||
newFilter.append(key);
|
||||
newFilter.append("=");
|
||||
newFilter.append(value);
|
||||
newFilter.append(")");
|
||||
}
|
||||
newFilter.append(")");
|
||||
return newFilter.toString();
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @param allServiceReferences
|
||||
* @param filter
|
||||
* @return
|
||||
*/
|
||||
public static ServiceReference[] buildFilteredServiceReferences(Set<ServiceReference> allServiceReferences, String filter){
|
||||
Dictionary properties = OSGiMockUtils.parseFilterIntoDictionary(filter);
|
||||
ArrayList<ServiceReference> filteredReferences = new ArrayList<ServiceReference>();
|
||||
|
||||
for (ServiceReference sr : allServiceReferences) {
|
||||
Enumeration keys = properties.keys();
|
||||
boolean match = true;
|
||||
inner:
|
||||
while (keys.hasMoreElements()) {
|
||||
String key = (String) keys.nextElement();
|
||||
Object value = properties.get(key);
|
||||
Object compareToValue = sr.getProperty(key);
|
||||
if (compareToValue != null && compareToValue instanceof String[] && key.equals("objectClass")){
|
||||
List<String> srImplementedClasses = Arrays.asList((String[])compareToValue);
|
||||
List<String> filteredClasses = Arrays.asList(StringUtils.commaDelimitedListToStringArray((String)value));
|
||||
match = srImplementedClasses.containsAll(filteredClasses);
|
||||
if (!match){
|
||||
break inner;
|
||||
}
|
||||
} else if (!value.equals(compareToValue)){
|
||||
match = false;
|
||||
break inner;
|
||||
}
|
||||
}
|
||||
if (match){
|
||||
filteredReferences.add(sr);
|
||||
}
|
||||
}
|
||||
ServiceReference[] references = null;
|
||||
if (filteredReferences.size() > 0){
|
||||
references = new ServiceReference[filteredReferences.size()];
|
||||
for (int i = 0; i < filteredReferences.size(); i++) {
|
||||
references[i] = filteredReferences.get(i);
|
||||
}
|
||||
}
|
||||
return references;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,189 +0,0 @@
|
||||
/*
|
||||
* Copyright 2002-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.integration.osgi.stubs;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Dictionary;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Hashtable;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.mockito.Mockito;
|
||||
import org.osgi.framework.InvalidSyntaxException;
|
||||
import org.osgi.framework.ServiceEvent;
|
||||
import org.osgi.framework.ServiceFactory;
|
||||
import org.osgi.framework.ServiceListener;
|
||||
import org.osgi.framework.ServiceReference;
|
||||
import org.osgi.framework.ServiceRegistration;
|
||||
import org.springframework.osgi.mock.MockBundleContext;
|
||||
import org.springframework.osgi.mock.MockServiceReference;
|
||||
import org.springframework.osgi.util.internal.MapBasedDictionary;
|
||||
|
||||
/**
|
||||
* Mock BundleContext to be used for testing
|
||||
*
|
||||
* @author Oleg Zhurakousky
|
||||
* @since 2.0
|
||||
*/
|
||||
public class SIBundleContextStub extends MockBundleContext {
|
||||
private static final Log log = LogFactory.getLog(SIBundleContextStub.class);
|
||||
private static SIBundleContextStub bundleContext = new SIBundleContextStub();
|
||||
|
||||
private Map<ServiceReference, Object> services = new HashMap<ServiceReference, Object>();
|
||||
|
||||
|
||||
private Set<ServiceReference> serviceReferences = new HashSet<ServiceReference>();
|
||||
private Map<MapBasedDictionary, ServiceListener> serviceListenerMap =
|
||||
new HashMap<MapBasedDictionary, ServiceListener>();
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public static SIBundleContextStub getInstance(){
|
||||
log.debug("Returning Stubed BundleContext");
|
||||
return bundleContext;
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public static SIBundleContextStub getNewInstance(){
|
||||
log.debug("Returning newly created Stubed BundleContext");
|
||||
return new SIBundleContextStub();
|
||||
}
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public ServiceRegistration registerService(String[] clazzes, Object service, Dictionary properties) {
|
||||
if (properties instanceof Hashtable){
|
||||
properties = new MapBasedDictionary(properties);
|
||||
}
|
||||
log.info("Registering SERVICE: " + service);
|
||||
SIServiceRegistrationStub reg = new SIServiceRegistrationStub(clazzes, properties);
|
||||
reg.setBundleContext(this);
|
||||
|
||||
MockServiceReference ref = new MockServiceReference(this.getBundle(), properties, reg, clazzes);
|
||||
for (int i = 0; i < clazzes.length; i++) {
|
||||
serviceReferences.add(ref);
|
||||
}
|
||||
if (service instanceof ServiceFactory){
|
||||
service = ((ServiceFactory)service).getService(this.getBundle(), reg);
|
||||
}
|
||||
reg.setReference(ref);
|
||||
services.put(ref, service);
|
||||
final ServiceEvent event = new ServiceEvent(ServiceEvent.REGISTERED, ref);
|
||||
final Set<ServiceListener> listeners = this.getFilteredListeners(properties);
|
||||
for (final ServiceListener listener : listeners) {
|
||||
// Thread t = new Thread(new Runnable() {
|
||||
// public void run() {
|
||||
listener.serviceChanged(event);
|
||||
// }
|
||||
// });
|
||||
// t.start();
|
||||
}
|
||||
log.info("Registered SERVICE: " + ref);
|
||||
return reg;
|
||||
}
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public Object getService(ServiceReference sr){
|
||||
return services.get(sr);
|
||||
}
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public ServiceReference getServiceReference(String serviceName){
|
||||
String filter = "(&(objectClass=" + serviceName + "))";
|
||||
ServiceReference[] references = OSGiMockUtils.buildFilteredServiceReferences(serviceReferences, filter);
|
||||
return references == null ? null : references[0];
|
||||
}
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public ServiceReference[] getServiceReferences(String serviceName, String filter) throws InvalidSyntaxException {
|
||||
if (serviceName != null){
|
||||
String classFilter = "(&(objectClass=" + serviceName + "))";
|
||||
filter = OSGiMockUtils.addToFilter(filter, classFilter);
|
||||
}
|
||||
ServiceReference[] references = OSGiMockUtils.buildFilteredServiceReferences(serviceReferences, filter);
|
||||
return references;
|
||||
}
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public void addServiceListener(ServiceListener listener) {
|
||||
MapBasedDictionary properties = new MapBasedDictionary();
|
||||
serviceListenerMap.put(properties, listener);
|
||||
}
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public void addServiceListener(ServiceListener listener, String filter) throws InvalidSyntaxException {
|
||||
MapBasedDictionary properties = (MapBasedDictionary) OSGiMockUtils.parseFilterIntoDictionary(filter);
|
||||
serviceListenerMap.put(properties, listener);
|
||||
}
|
||||
@SuppressWarnings("unchecked")
|
||||
public Set<ServiceListener> getFilteredListeners(Dictionary properties){
|
||||
Set filteredListeners = new HashSet<ServiceListener>();
|
||||
if (properties != null && properties.size() > 0){
|
||||
for (Dictionary filter : serviceListenerMap.keySet()) {
|
||||
MapBasedDictionary listenerFilter = new MapBasedDictionary(filter);
|
||||
|
||||
log.trace("Trying to match filter properties: " + listenerFilter);
|
||||
MapBasedDictionary inFilter = new MapBasedDictionary(properties);
|
||||
log.trace("Current filter entry: " + inFilter);
|
||||
boolean objecClassMatch = true;
|
||||
if (listenerFilter.containsKey("objectClass")){
|
||||
objecClassMatch = this.matchObjectClass(listenerFilter, inFilter);
|
||||
}
|
||||
listenerFilter.remove("objectClass");
|
||||
inFilter.remove("objectClass");
|
||||
if (inFilter.keySet().containsAll(listenerFilter.keySet()) &&
|
||||
inFilter.values().containsAll(listenerFilter.values()) && objecClassMatch){
|
||||
filteredListeners.add(serviceListenerMap.get(filter));
|
||||
log.debug("Found listener for properties: " + listenerFilter + " - " + serviceListenerMap.get(filter));
|
||||
}
|
||||
}
|
||||
}
|
||||
return filteredListeners;
|
||||
}
|
||||
|
||||
public boolean matchObjectClass(MapBasedDictionary listenerFilter, MapBasedDictionary inFilter){
|
||||
String interfaze = (String) listenerFilter.get("objectClass");
|
||||
String[] interfaces = (String[]) inFilter.get("objectClass");
|
||||
|
||||
return Arrays.binarySearch(interfaces, interfaze) >=0;
|
||||
}
|
||||
public Map<MapBasedDictionary, ServiceListener> getServiceListenerMap() {
|
||||
return serviceListenerMap;
|
||||
}
|
||||
public Map<ServiceReference, Object> getServices() {
|
||||
return services;
|
||||
}
|
||||
|
||||
public void remove(ServiceReference sr){
|
||||
services.remove(sr);
|
||||
serviceReferences.remove(sr);
|
||||
}
|
||||
}
|
||||
@@ -1,83 +0,0 @@
|
||||
/*
|
||||
* Copyright 2002-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.integration.osgi.stubs;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Dictionary;
|
||||
import java.util.Hashtable;
|
||||
|
||||
import junit.framework.Assert;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.mockito.Mockito;
|
||||
import org.osgi.framework.BundleContext;
|
||||
import org.osgi.framework.ServiceEvent;
|
||||
import org.osgi.framework.ServiceListener;
|
||||
import org.osgi.framework.ServiceReference;
|
||||
import org.osgi.framework.ServiceRegistration;
|
||||
|
||||
/**
|
||||
* @author Oleg Zhurakousky
|
||||
* @since 2.0
|
||||
*/
|
||||
public class SIBundleContextStubTest {
|
||||
|
||||
@Test
|
||||
public void validateServiceRegistrationWithNoFilters(){
|
||||
BundleContext context = SIBundleContextStub.getInstance();
|
||||
context.registerService(Serializable.class.getName(), new Serializable(){}, null);
|
||||
|
||||
ServiceReference sr = context.getServiceReference(Serializable.class.getName());
|
||||
Assert.assertNotNull(sr);
|
||||
Serializable service = (Serializable) context.getService(sr);
|
||||
Assert.assertNotNull(service);
|
||||
}
|
||||
@Test
|
||||
public void validateServiceRegistrationWithFiltersNegativeReturn() throws Exception {
|
||||
BundleContext context = SIBundleContextStub.getInstance();
|
||||
Dictionary<String, String> properties = new Hashtable<String, String>();
|
||||
properties.put("name", "foo");
|
||||
context.registerService(Serializable.class.getName(), new Serializable(){}, properties);
|
||||
|
||||
ServiceReference[] srs = context.getServiceReferences(Serializable.class.getName(), "(&(name=bar))");
|
||||
Assert.assertTrue("Expected no ServiceReferences", srs == null);
|
||||
}
|
||||
@Test
|
||||
public void validateServiceRegistrationWithFiltersPositiveReturn() throws Exception {
|
||||
BundleContext context = SIBundleContextStub.getInstance();
|
||||
Dictionary<String, String> properties = new Hashtable<String, String>();
|
||||
properties.put("name", "foo");
|
||||
context.registerService(Serializable.class.getName(), new Serializable(){}, properties);
|
||||
|
||||
properties = new Hashtable<String, String>();
|
||||
properties.put("name", "bar");
|
||||
context.registerService(Serializable.class.getName(), new Serializable(){}, properties);
|
||||
|
||||
ServiceReference[] srs = context.getServiceReferences(Serializable.class.getName(), "(&(name=bar))");
|
||||
Assert.assertNotNull(srs);
|
||||
}
|
||||
@Test
|
||||
public void validateServiceListenerRegistrationWithFilter() throws Exception{
|
||||
BundleContext context = SIBundleContextStub.getInstance();
|
||||
ServiceListener sl = Mockito.mock(ServiceListener.class);
|
||||
context.addServiceListener(sl, "(&(name=foo))");
|
||||
Dictionary<String, String> properties = new Hashtable<String, String>();
|
||||
properties.put("name", "foo");
|
||||
ServiceRegistration sr =
|
||||
context.registerService(Serializable.class.getName(), new Serializable(){}, properties);
|
||||
Mockito.verify(sl, Mockito.times(1)).serviceChanged((ServiceEvent) Mockito.anyObject());
|
||||
}
|
||||
}
|
||||
@@ -1,52 +0,0 @@
|
||||
/*
|
||||
* Copyright 2002-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.integration.osgi.stubs;
|
||||
|
||||
import java.util.Dictionary;
|
||||
import java.util.Set;
|
||||
|
||||
import org.osgi.framework.ServiceEvent;
|
||||
import org.osgi.framework.ServiceListener;
|
||||
import org.osgi.framework.ServiceReference;
|
||||
import org.springframework.beans.DirectFieldAccessor;
|
||||
import org.springframework.osgi.mock.MockServiceRegistration;
|
||||
|
||||
/**
|
||||
* TODO - insert COMMENT
|
||||
* @author Oleg Zhurakousky
|
||||
* @since 2.0
|
||||
*/
|
||||
public class SIServiceRegistrationStub extends MockServiceRegistration {
|
||||
private SIBundleContextStub context;
|
||||
|
||||
public SIServiceRegistrationStub(String[] clazz, Dictionary props) {
|
||||
super(clazz, props);
|
||||
}
|
||||
public void setBundleContext(SIBundleContextStub context){
|
||||
this.context = context;
|
||||
}
|
||||
public void unregister() {
|
||||
ServiceReference ref = this.getReference();
|
||||
DirectFieldAccessor refAccessor = new DirectFieldAccessor(ref);
|
||||
Dictionary properties = (Dictionary) refAccessor.getPropertyValue("properties");
|
||||
|
||||
context.remove(this.getReference());
|
||||
Set<ServiceListener> listeners = context.getFilteredListeners(properties);
|
||||
for (ServiceListener serviceListener : listeners) {
|
||||
serviceListener.serviceChanged(new ServiceEvent(ServiceEvent.UNREGISTERING, ref));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,31 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
|
||||
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
|
||||
|
||||
<!-- Appenders -->
|
||||
<appender name="console" class="org.apache.log4j.ConsoleAppender">
|
||||
<param name="Target" value="System.out" />
|
||||
<layout class="org.apache.log4j.PatternLayout">
|
||||
<param name="ConversionPattern" value="%-5p: %c - %m%n" />
|
||||
</layout>
|
||||
</appender>
|
||||
|
||||
<logger name="org.springframework.osgi">
|
||||
<level value="info" />
|
||||
</logger>
|
||||
|
||||
<logger name="org.springframework.integration">
|
||||
<level value="info" />
|
||||
</logger>
|
||||
|
||||
<logger name="org.springframework.integration.osgi">
|
||||
<level value="trace" />
|
||||
</logger>
|
||||
|
||||
<!-- Root Logger -->
|
||||
<root>
|
||||
<priority value="warn" />
|
||||
<appender-ref ref="console" />
|
||||
</root>
|
||||
|
||||
</log4j:configuration>
|
||||
@@ -1,16 +0,0 @@
|
||||
Bundle-SymbolicName: org.springframework.integration.osgi
|
||||
Bundle-Name: Spring Integration OSGi Extender
|
||||
Bundle-Vendor: SpringSource
|
||||
Bundle-ManifestVersion: 2
|
||||
Import-Package: org.springframework.integration.handler;version="[2.0.0, 2.0.1)",
|
||||
org.springframework.integration.config;version="[2.0.0, 2.0.1)",
|
||||
org.springframework.integration.router;version="[2.0.0, 2.0.1)",
|
||||
org.springframework.integration.endpoint;version="[2.0.0, 2.0.1)",
|
||||
org.springframework.scheduling.concurrent;version="[3.0.0, 4.0.0)"
|
||||
Import-Template: org.springframework.integration.*;version="[2.0.0, 2.0.1)",
|
||||
org.springframework.osgi.*;version="[1.2.0, 2.0.1)",
|
||||
org.springframework.*;version="[3.0.0, 4.0.0)",
|
||||
org.apache.commons.logging.*;version="[1.1.1,1.1.1]",
|
||||
org.w3c.dom;version="0"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user