You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@aries.apache.org by gn...@apache.org on 2016/01/05 10:33:11 UTC
svn commit: r1723023 - in /aries/trunk/blueprint: ./ blueprint-itests/
blueprint-itests/src/test/java/org/apache/aries/blueprint/itests/
blueprint-spring-extender/src/main/java/org/apache/aries/blueprint/spring/extender/
blueprint-spring/src/main/java/...
Author: gnodet
Date: Tue Jan 5 09:33:10 2016
New Revision: 1723023
URL: http://svn.apache.org/viewvc?rev=1723023&view=rev
Log:
[ARIES-1480] Leverage ARIES-1482
Support for osgi compendium namespace
Improve osgi namespace support
Add spring extender integration test
Added:
aries/trunk/blueprint/blueprint-itests/src/test/java/org/apache/aries/blueprint/itests/SpringExtenderTest.java
- copied, changed from r1723022, aries/trunk/blueprint/blueprint-itests/src/test/java/org/apache/aries/blueprint/itests/SpringTest.java
aries/trunk/blueprint/blueprint-testbundlee/
aries/trunk/blueprint/blueprint-testbundlee/LICENSE
aries/trunk/blueprint/blueprint-testbundlee/NOTICE
aries/trunk/blueprint/blueprint-testbundlee/pom.xml
aries/trunk/blueprint/blueprint-testbundlee/src/
aries/trunk/blueprint/blueprint-testbundlee/src/main/
aries/trunk/blueprint/blueprint-testbundlee/src/main/java/
aries/trunk/blueprint/blueprint-testbundlee/src/main/java/org/
aries/trunk/blueprint/blueprint-testbundlee/src/main/java/org/apache/
aries/trunk/blueprint/blueprint-testbundlee/src/main/java/org/apache/aries/
aries/trunk/blueprint/blueprint-testbundlee/src/main/java/org/apache/aries/blueprint/
aries/trunk/blueprint/blueprint-testbundlee/src/main/java/org/apache/aries/blueprint/testbundlee/
aries/trunk/blueprint/blueprint-testbundlee/src/main/java/org/apache/aries/blueprint/testbundlee/BeanA.java
aries/trunk/blueprint/blueprint-testbundlee/src/main/java/org/apache/aries/blueprint/testbundlee/BeanAFactory.java
aries/trunk/blueprint/blueprint-testbundlee/src/main/java/org/apache/aries/blueprint/testbundlee/BeanB.java
aries/trunk/blueprint/blueprint-testbundlee/src/main/java/org/apache/aries/blueprint/testbundlee/BeanC.java
aries/trunk/blueprint/blueprint-testbundlee/src/main/java/org/apache/aries/blueprint/testbundlee/BeanCItf.java
aries/trunk/blueprint/blueprint-testbundlee/src/main/resources/
aries/trunk/blueprint/blueprint-testbundlee/src/main/resources/META-INF/
aries/trunk/blueprint/blueprint-testbundlee/src/main/resources/META-INF/spring/
aries/trunk/blueprint/blueprint-testbundlee/src/main/resources/META-INF/spring/imported.xml
Modified:
aries/trunk/blueprint/blueprint-itests/pom.xml
aries/trunk/blueprint/blueprint-itests/src/test/java/org/apache/aries/blueprint/itests/Helper.java
aries/trunk/blueprint/blueprint-itests/src/test/java/org/apache/aries/blueprint/itests/SpringTest.java
aries/trunk/blueprint/blueprint-spring-extender/src/main/java/org/apache/aries/blueprint/spring/extender/SpringOsgiCompendiumNamespaceHandler.java
aries/trunk/blueprint/blueprint-spring-extender/src/main/java/org/apache/aries/blueprint/spring/extender/SpringOsgiExtender.java
aries/trunk/blueprint/blueprint-spring-extender/src/main/java/org/apache/aries/blueprint/spring/extender/SpringOsgiExtension.java
aries/trunk/blueprint/blueprint-spring-extender/src/main/java/org/apache/aries/blueprint/spring/extender/SpringOsgiNamespaceHandler.java
aries/trunk/blueprint/blueprint-spring/src/main/java/org/apache/aries/blueprint/spring/BeansNamespaceHandler.java
aries/trunk/blueprint/blueprint-spring/src/main/java/org/apache/aries/blueprint/spring/BlueprintNamespaceHandler.java
aries/trunk/blueprint/blueprint-spring/src/main/java/org/apache/aries/blueprint/spring/SpringBeanProcessor.java
aries/trunk/blueprint/pom.xml
Modified: aries/trunk/blueprint/blueprint-itests/pom.xml
URL: http://svn.apache.org/viewvc/aries/trunk/blueprint/blueprint-itests/pom.xml?rev=1723023&r1=1723022&r2=1723023&view=diff
==============================================================================
--- aries/trunk/blueprint/blueprint-itests/pom.xml (original)
+++ aries/trunk/blueprint/blueprint-itests/pom.xml Tue Jan 5 09:33:10 2016
@@ -75,6 +75,16 @@
<version>1.0.1-SNAPSHOT</version>
</dependency>
<dependency>
+ <groupId>org.apache.aries.blueprint</groupId>
+ <artifactId>org.apache.aries.blueprint.spring</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.aries.blueprint</groupId>
+ <artifactId>org.apache.aries.blueprint.spring.extender</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+ </dependency>
+ <dependency>
<groupId>org.apache.aries.proxy</groupId>
<artifactId>org.apache.aries.proxy.impl</artifactId>
<version>1.0.3</version>
@@ -188,6 +198,12 @@
</dependency>
<dependency>
<groupId>org.apache.aries.blueprint</groupId>
+ <artifactId>org.apache.aries.blueprint.testbundlee</artifactId>
+ <scope>test</scope>
+ <version>1.0.0-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.aries.blueprint</groupId>
<artifactId>org.apache.aries.blueprint.testbundles</artifactId>
<scope>test</scope>
<version>1.0.0-SNAPSHOT</version>
Modified: aries/trunk/blueprint/blueprint-itests/src/test/java/org/apache/aries/blueprint/itests/Helper.java
URL: http://svn.apache.org/viewvc/aries/trunk/blueprint/blueprint-itests/src/test/java/org/apache/aries/blueprint/itests/Helper.java?rev=1723023&r1=1723022&r2=1723023&view=diff
==============================================================================
--- aries/trunk/blueprint/blueprint-itests/src/test/java/org/apache/aries/blueprint/itests/Helper.java (original)
+++ aries/trunk/blueprint/blueprint-itests/src/test/java/org/apache/aries/blueprint/itests/Helper.java Tue Jan 5 09:33:10 2016
@@ -79,8 +79,7 @@ public class Helper {
mvnBundle("org.apache.aries.blueprint", "org.apache.aries.blueprint.core", startBlueprint),
mvnBundle("org.apache.aries.blueprint", "org.apache.aries.blueprint.cm", startBlueprint),
mvnBundle("org.apache.aries.blueprint", "org.apache.aries.blueprint.annotation.api", startBlueprint),
- mvnBundle("org.apache.aries.blueprint", "org.apache.aries.blueprint.annotation.impl", startBlueprint),
- mvnBundle("org.apache.aries.blueprint", "org.apache.aries.blueprint.spring", startBlueprint)
+ mvnBundle("org.apache.aries.blueprint", "org.apache.aries.blueprint.annotation.impl", startBlueprint)
);
}
Copied: aries/trunk/blueprint/blueprint-itests/src/test/java/org/apache/aries/blueprint/itests/SpringExtenderTest.java (from r1723022, aries/trunk/blueprint/blueprint-itests/src/test/java/org/apache/aries/blueprint/itests/SpringTest.java)
URL: http://svn.apache.org/viewvc/aries/trunk/blueprint/blueprint-itests/src/test/java/org/apache/aries/blueprint/itests/SpringExtenderTest.java?p2=aries/trunk/blueprint/blueprint-itests/src/test/java/org/apache/aries/blueprint/itests/SpringExtenderTest.java&p1=aries/trunk/blueprint/blueprint-itests/src/test/java/org/apache/aries/blueprint/itests/SpringTest.java&r1=1723022&r2=1723023&rev=1723023&view=diff
==============================================================================
--- aries/trunk/blueprint/blueprint-itests/src/test/java/org/apache/aries/blueprint/itests/SpringTest.java (original)
+++ aries/trunk/blueprint/blueprint-itests/src/test/java/org/apache/aries/blueprint/itests/SpringExtenderTest.java Tue Jan 5 09:33:10 2016
@@ -18,42 +18,38 @@
*/
package org.apache.aries.blueprint.itests;
-import java.util.List;
-
-import org.apache.aries.blueprint.testbundles.BeanC;
-import org.apache.aries.blueprint.testbundles.BeanCItf;
+import org.apache.aries.blueprint.testbundlee.BeanCItf;
import org.junit.Test;
import org.ops4j.pax.exam.Option;
import org.osgi.framework.Bundle;
import org.osgi.service.blueprint.container.BlueprintContainer;
-import org.springframework.beans.factory.NoSuchBeanDefinitionException;
import static org.apache.aries.blueprint.itests.Helper.mvnBundle;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.fail;
-public class SpringTest extends AbstractBlueprintIntegrationTest {
+public class SpringExtenderTest extends AbstractBlueprintIntegrationTest {
@Test
public void testSpringBundle() throws Exception {
- Bundle bundles = context().getBundleByName("org.apache.aries.blueprint.testbundles");
+ try {
+ context().getService(BeanCItf.class, 1);
+ fail("The service should not be registered");
+ } catch (RuntimeException e) {
+ // Expected
+ }
+
+ Bundle bundles = context().getBundleByName("org.apache.aries.blueprint.testbundlee");
assertNotNull(bundles);
bundles.start();
- BlueprintContainer container = startBundleBlueprint("org.apache.aries.blueprint.testbundles");
- List list = (List) container.getComponentInstance("springList");
- System.out.println(list);
-
- BeanCItf beanC = (BeanCItf) list.get(4);
- assertEquals(1, beanC.getInitialized());
-
- try {
- beanC.doSomething();
- fail("Should have thrown an exception because the transaction manager is not defined");
- } catch (NoSuchBeanDefinitionException e) {
- // expected
- }
+ BlueprintContainer container = startBundleBlueprint("org.apache.aries.blueprint.testbundlee");
+ assertNotNull(container);
+ BeanCItf beanC1 = context().getService(BeanCItf.class, "(name=BeanC-1)");
+ assertEquals(1, beanC1.getInitialized());
+ BeanCItf beanC2 = context().getService(BeanCItf.class, "(name=BeanC-2)");
+ assertEquals(1, beanC2.getInitialized());
}
@org.ops4j.pax.exam.Configuration
@@ -61,6 +57,10 @@ public class SpringTest extends Abstract
return new Option[] {
baseOptions(),
Helper.blueprintBundles(),
+ // Blueprint spring
+ mvnBundle("org.apache.aries.blueprint", "org.apache.aries.blueprint.spring"),
+ mvnBundle("org.apache.aries.blueprint", "org.apache.aries.blueprint.spring.extender"),
+ // Spring
mvnBundle("org.apache.servicemix.bundles", "org.apache.servicemix.bundles.aopalliance"),
mvnBundle("org.apache.servicemix.bundles", "org.apache.servicemix.bundles.spring-core"),
mvnBundle("org.apache.servicemix.bundles", "org.apache.servicemix.bundles.spring-context"),
@@ -70,7 +70,7 @@ public class SpringTest extends Abstract
mvnBundle("org.apache.servicemix.bundles", "org.apache.servicemix.bundles.spring-expression"),
mvnBundle("org.apache.servicemix.bundles", "org.apache.servicemix.bundles.spring-tx"),
// test bundle
- mvnBundle("org.apache.aries.blueprint", "org.apache.aries.blueprint.testbundles", false),
+ mvnBundle("org.apache.aries.blueprint", "org.apache.aries.blueprint.testbundlee", false),
};
}
Modified: aries/trunk/blueprint/blueprint-itests/src/test/java/org/apache/aries/blueprint/itests/SpringTest.java
URL: http://svn.apache.org/viewvc/aries/trunk/blueprint/blueprint-itests/src/test/java/org/apache/aries/blueprint/itests/SpringTest.java?rev=1723023&r1=1723022&r2=1723023&view=diff
==============================================================================
--- aries/trunk/blueprint/blueprint-itests/src/test/java/org/apache/aries/blueprint/itests/SpringTest.java (original)
+++ aries/trunk/blueprint/blueprint-itests/src/test/java/org/apache/aries/blueprint/itests/SpringTest.java Tue Jan 5 09:33:10 2016
@@ -61,6 +61,9 @@ public class SpringTest extends Abstract
return new Option[] {
baseOptions(),
Helper.blueprintBundles(),
+ // Blueprint spring
+ mvnBundle("org.apache.aries.blueprint", "org.apache.aries.blueprint.spring"),
+ // Spring
mvnBundle("org.apache.servicemix.bundles", "org.apache.servicemix.bundles.aopalliance"),
mvnBundle("org.apache.servicemix.bundles", "org.apache.servicemix.bundles.spring-core"),
mvnBundle("org.apache.servicemix.bundles", "org.apache.servicemix.bundles.spring-context"),
Modified: aries/trunk/blueprint/blueprint-spring-extender/src/main/java/org/apache/aries/blueprint/spring/extender/SpringOsgiCompendiumNamespaceHandler.java
URL: http://svn.apache.org/viewvc/aries/trunk/blueprint/blueprint-spring-extender/src/main/java/org/apache/aries/blueprint/spring/extender/SpringOsgiCompendiumNamespaceHandler.java?rev=1723023&r1=1723022&r2=1723023&view=diff
==============================================================================
--- aries/trunk/blueprint/blueprint-spring-extender/src/main/java/org/apache/aries/blueprint/spring/extender/SpringOsgiCompendiumNamespaceHandler.java (original)
+++ aries/trunk/blueprint/blueprint-spring-extender/src/main/java/org/apache/aries/blueprint/spring/extender/SpringOsgiCompendiumNamespaceHandler.java Tue Jan 5 09:33:10 2016
@@ -16,6 +16,7 @@
*/
package org.apache.aries.blueprint.spring.extender;
+import java.net.URI;
import java.net.URL;
import java.util.Set;
@@ -23,13 +24,14 @@ import org.apache.aries.blueprint.Namesp
import org.apache.aries.blueprint.ParserContext;
import org.osgi.service.blueprint.reflect.ComponentMetadata;
import org.osgi.service.blueprint.reflect.Metadata;
-import org.osgi.service.blueprint.reflect.ReferenceMetadata;
-import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
public class SpringOsgiCompendiumNamespaceHandler implements NamespaceHandler {
+ public static final String CM_NAMESPACE = "http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.3.0";
+
@Override
public URL getSchemaLocation(String namespace) {
if (namespace.startsWith("http://www.springframework.org/schema/osgi-compendium/spring-osgi-compendium")) {
@@ -49,20 +51,26 @@ public class SpringOsgiCompendiumNamespa
@Override
public Metadata parse(Element element, ParserContext context) {
- if ("managed-properties".equals(element.getLocalName())) {
-
- }
- else if ("managed-service-factory".equals(element.getLocalName())) {
-
- }
- else if ("cm-properties".equals(element.getLocalName())) {
-
- }
- throw new UnsupportedOperationException();
+ fixDom(element, CM_NAMESPACE);
+ NamespaceHandler handler = context.getNamespaceHandler(URI.create(CM_NAMESPACE));
+ return handler.parse(element, context);
}
@Override
public ComponentMetadata decorate(Node node, ComponentMetadata component, ParserContext context) {
return component;
}
+
+ private static void fixDom(Node node, String namespace) {
+ if (node.getNodeType() == Node.ELEMENT_NODE) {
+ if (!namespace.equals(node.getNamespaceURI())) {
+ node.getOwnerDocument().renameNode(node, namespace, node.getLocalName());
+ }
+ NodeList children = node.getChildNodes();
+ for (int i = 0; i < children.getLength(); i++) {
+ fixDom(children.item(i), namespace);
+ }
+ }
+ }
+
}
Modified: aries/trunk/blueprint/blueprint-spring-extender/src/main/java/org/apache/aries/blueprint/spring/extender/SpringOsgiExtender.java
URL: http://svn.apache.org/viewvc/aries/trunk/blueprint/blueprint-spring-extender/src/main/java/org/apache/aries/blueprint/spring/extender/SpringOsgiExtender.java?rev=1723023&r1=1723022&r2=1723023&view=diff
==============================================================================
--- aries/trunk/blueprint/blueprint-spring-extender/src/main/java/org/apache/aries/blueprint/spring/extender/SpringOsgiExtender.java (original)
+++ aries/trunk/blueprint/blueprint-spring-extender/src/main/java/org/apache/aries/blueprint/spring/extender/SpringOsgiExtender.java Tue Jan 5 09:33:10 2016
@@ -107,6 +107,7 @@ public class SpringOsgiExtender extends
}
private boolean isCompatible(Bundle bundle) {
+ // TODO
return true;
}
Modified: aries/trunk/blueprint/blueprint-spring-extender/src/main/java/org/apache/aries/blueprint/spring/extender/SpringOsgiExtension.java
URL: http://svn.apache.org/viewvc/aries/trunk/blueprint/blueprint-spring-extender/src/main/java/org/apache/aries/blueprint/spring/extender/SpringOsgiExtension.java?rev=1723023&r1=1723022&r2=1723023&view=diff
==============================================================================
--- aries/trunk/blueprint/blueprint-spring-extender/src/main/java/org/apache/aries/blueprint/spring/extender/SpringOsgiExtension.java (original)
+++ aries/trunk/blueprint/blueprint-spring-extender/src/main/java/org/apache/aries/blueprint/spring/extender/SpringOsgiExtension.java Tue Jan 5 09:33:10 2016
@@ -23,6 +23,7 @@ import java.io.File;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.io.OutputStreamWriter;
+import java.net.URI;
import java.net.URL;
import java.util.ArrayList;
import java.util.Arrays;
@@ -65,7 +66,7 @@ public class SpringOsgiExtension impleme
public void start() throws Exception {
List<Object> bpPaths = new ArrayList<Object>();
- Set<String> namespaces = new LinkedHashSet<String>();
+ Set<URI> namespaces = new LinkedHashSet<URI>();
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
dbf.setNamespaceAware(true);
for (URL url : paths) {
@@ -79,7 +80,11 @@ public class SpringOsgiExtension impleme
List<String> locs = new ArrayList<String>(Arrays.asList(schemaLoc.getValue().split("\\s+")));
locs.remove("");
for (int i = 0; i < locs.size() / 2; i++) {
- namespaces.add(locs.get(i * 2));
+ String ns = locs.get(i * 2);
+ namespaces.add(URI.create(ns));
+ if (ns.startsWith("http://www.springframework.org/schema/osgi-compendium")) {
+ namespaces.add(URI.create(SpringOsgiCompendiumNamespaceHandler.CM_NAMESPACE));
+ }
}
}
} finally {
@@ -95,10 +100,6 @@ public class SpringOsgiExtension impleme
writer.write("\txmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n");
writer.write("\txmlns:bean=\"http://www.springframework.org/schema/beans\"\n");
writer.write("\txsi:schemaLocation=\"http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.2.xsd\">\n");
- // TODO: improve that, this is a big hack to force the reference to namespace handlers
- for (String namespace : namespaces) {
- writer.write("\t<bean class=\"java.lang.String\" scope=\"ns1:dummy\" xmlns:ns1=\"" + namespace + "\"/>\n");
- }
for (URL url : paths) {
writer.write("\t<bean:import resource=\"" + url.toString() + "\"/>\n");
}
@@ -108,7 +109,7 @@ public class SpringOsgiExtension impleme
}
LOGGER.info("Generated blueprint for bundle {}/{} at {}", bundle.getSymbolicName(), bundle.getVersion(), file);
bpPaths.add(file.toURI().toURL());
- container = blueprintExtenderService.createContainer(bundle, bpPaths);
+ container = blueprintExtenderService.createContainer(bundle, bpPaths, namespaces);
}
@Override
Modified: aries/trunk/blueprint/blueprint-spring-extender/src/main/java/org/apache/aries/blueprint/spring/extender/SpringOsgiNamespaceHandler.java
URL: http://svn.apache.org/viewvc/aries/trunk/blueprint/blueprint-spring-extender/src/main/java/org/apache/aries/blueprint/spring/extender/SpringOsgiNamespaceHandler.java?rev=1723023&r1=1723022&r2=1723023&view=diff
==============================================================================
--- aries/trunk/blueprint/blueprint-spring-extender/src/main/java/org/apache/aries/blueprint/spring/extender/SpringOsgiNamespaceHandler.java (original)
+++ aries/trunk/blueprint/blueprint-spring-extender/src/main/java/org/apache/aries/blueprint/spring/extender/SpringOsgiNamespaceHandler.java Tue Jan 5 09:33:10 2016
@@ -16,9 +16,11 @@
*/
package org.apache.aries.blueprint.spring.extender;
+import java.net.URI;
import java.net.URL;
import java.util.ArrayList;
import java.util.Arrays;
+import java.util.HashSet;
import java.util.List;
import java.util.Set;
@@ -28,17 +30,25 @@ import org.apache.aries.blueprint.mutabl
import org.apache.aries.blueprint.mutable.MutableReferenceMetadata;
import org.apache.aries.blueprint.mutable.MutableServiceMetadata;
import org.apache.aries.blueprint.mutable.MutableValueMetadata;
+import org.osgi.service.blueprint.reflect.BeanMetadata;
import org.osgi.service.blueprint.reflect.ComponentMetadata;
import org.osgi.service.blueprint.reflect.Metadata;
import org.osgi.service.blueprint.reflect.NonNullMetadata;
import org.osgi.service.blueprint.reflect.ReferenceMetadata;
import org.osgi.service.blueprint.reflect.ServiceMetadata;
+import org.osgi.service.blueprint.reflect.Target;
import org.springframework.util.Assert;
import org.springframework.util.StringUtils;
import org.w3c.dom.*;
public class SpringOsgiNamespaceHandler implements NamespaceHandler {
+ public static final String BLUEPRINT_NAMESPACE = "http://www.osgi.org/xmlns/blueprint/v1.0.0";
+ public static final String SPRING_NAMESPACE = "http://www.springframework.org/schema/beans";
+ public static final String BEAN_ELEMENT = "bean";
+
+ private int idCounter;
+
@Override
public URL getSchemaLocation(String namespace) {
if (namespace.startsWith("http://www.springframework.org/schema/osgi/spring-osgi")) {
@@ -61,8 +71,11 @@ public class SpringOsgiNamespaceHandler
if ("reference".equals(element.getLocalName())) {
MutableReferenceMetadata metadata = context.createMetadata(MutableReferenceMetadata.class);
// Parse attributes
- // TODO: auto generate id ?
- metadata.setId(element.getAttribute("id"));
+ if (element.hasAttribute("id")) {
+ metadata.setId(element.getAttribute("id"));
+ } else {
+ metadata.setId(generateId(context));
+ }
metadata.setAvailability("0..1".equals(element.getAttribute("cardinality"))
? ReferenceMetadata.AVAILABILITY_OPTIONAL
: ReferenceMetadata.AVAILABILITY_MANDATORY);
@@ -90,7 +103,39 @@ public class SpringOsgiNamespaceHandler
}
else if ("listener".equals(child.getLocalName())) {
// TODO: listener
-
+ String bindMethod = nonEmpty(child.getAttribute("bind-method"));
+ String unbindMethod = nonEmpty(child.getAttribute("unbind-method"));
+ String refStr = nonEmpty(child.getAttribute("ref"));
+ Target listenerComponent = null;
+ if (refStr != null) {
+ MutableRefMetadata ref = context.createMetadata(MutableRefMetadata.class);
+ ref.setComponentId(refStr);
+ listenerComponent = ref;
+ }
+ for (Element cchild : getChildren(child)) {
+ if (BLUEPRINT_NAMESPACE.equals(cchild.getNamespaceURI())
+ && BEAN_ELEMENT.equals(cchild.getLocalName())) {
+ if (listenerComponent != null) {
+ throw new IllegalArgumentException("Only one of @ref attribute and bean element is allowed");
+ }
+ listenerComponent = context.parseElement(BeanMetadata.class, metadata, cchild);
+ }
+ else if (SPRING_NAMESPACE.equals(cchild.getNamespaceURI())
+ && BEAN_ELEMENT.equals(cchild.getLocalName())) {
+ if (listenerComponent != null) {
+ throw new IllegalArgumentException("Only one of @ref attribute or inlined bean definition element is allowed");
+ }
+ listenerComponent = (Target) context.getNamespaceHandler(URI.create(SPRING_NAMESPACE))
+ .parse(cchild, context);
+ }
+ else {
+ throw new IllegalArgumentException("Unsupported element " + cchild.getLocalName());
+ }
+ }
+ if (listenerComponent == null) {
+ throw new IllegalArgumentException("Missing @ref attribute or inlined bean definition element");
+ }
+ metadata.addServiceListener(listenerComponent, bindMethod, unbindMethod);
}
}
else {
@@ -102,23 +147,26 @@ public class SpringOsgiNamespaceHandler
else if ("service".equals(element.getLocalName())) {
MutableServiceMetadata metadata = context.createMetadata(MutableServiceMetadata.class);
// Parse attributes
- // TODO: auto generate id ?
- metadata.setId(element.getAttribute("id"));
- if (element.getAttribute("ref") != null) {
+ if (element.hasAttribute("id")) {
+ metadata.setId(element.getAttribute("id"));
+ } else {
+ metadata.setId(generateId(context));
+ }
+ if (nonEmpty(element.getAttribute("ref")) != null) {
MutableRefMetadata ref = context.createMetadata(MutableRefMetadata.class);
ref.setComponentId(element.getAttribute("ref"));
metadata.setServiceComponent(ref);
}
- metadata.setRanking(element.getAttribute("ranking") != null
+ metadata.setRanking(nonEmpty(element.getAttribute("ranking")) != null
? Integer.parseInt(element.getAttribute("ranking"))
: 0);
- String itf = element.getAttribute("interface");
+ String itf = nonEmpty(element.getAttribute("interface"));
if (itf != null) {
metadata.addInterface(itf);
}
- String[] dependsOn = StringUtils.tokenizeToStringArray(element.getAttribute("depends-on"), ",; ");
+ String[] dependsOn = StringUtils.tokenizeToStringArray(nonEmpty(element.getAttribute("depends-on")), ",; ");
metadata.setDependsOn(dependsOn != null ? Arrays.asList(dependsOn) : null);
- String autoExp = element.getAttribute("auto-export");
+ String autoExp = nonEmpty(element.getAttribute("auto-export"));
if ("interfaces".equals(autoExp)) {
metadata.setAutoExport(ServiceMetadata.AUTO_EXPORT_INTERFACES);
} else if ("class-hierarchy".equals(autoExp)) {
@@ -185,8 +233,25 @@ public class SpringOsgiNamespaceHandler
}
}
}
+ else if (BLUEPRINT_NAMESPACE.equals(child.getNamespaceURI())
+ && BEAN_ELEMENT.equals(child.getLocalName())) {
+ if (metadata.getServiceComponent() != null) {
+ throw new IllegalArgumentException("Only one of @ref attribute and bean element is allowed");
+ }
+ Target bean = context.parseElement(BeanMetadata.class, metadata, child);
+ metadata.setServiceComponent(bean);
+ }
+ else if (SPRING_NAMESPACE.equals(child.getNamespaceURI())
+ && BEAN_ELEMENT.equals(child.getLocalName())) {
+ if (metadata.getServiceComponent() != null) {
+ throw new IllegalArgumentException("Only one of @ref attribute or inlined bean definition element is allowed");
+ }
+ Target bean = (Target) context.getNamespaceHandler(URI.create(SPRING_NAMESPACE))
+ .parse(child, context);
+ metadata.setServiceComponent(bean);
+ }
else {
- throw new UnsupportedOperationException("Custom namespaces not supported");
+ throw new IllegalArgumentException("Unsupported element " + child.getLocalName());
}
}
return metadata;
@@ -203,6 +268,18 @@ public class SpringOsgiNamespaceHandler
throw new UnsupportedOperationException();
}
+ private String nonEmpty(String ref) {
+ return ref != null && ref.isEmpty() ? null : ref;
+ }
+
+ private String generateId(ParserContext context) {
+ String id;
+ do {
+ id = ".spring-osgi-" + ++idCounter;
+ } while (context.getComponentDefinitionRegistry().containsComponentDefinition(id));
+ return id;
+ }
+
@Override
public ComponentMetadata decorate(Node node, ComponentMetadata component, ParserContext context) {
return component;
Modified: aries/trunk/blueprint/blueprint-spring/src/main/java/org/apache/aries/blueprint/spring/BeansNamespaceHandler.java
URL: http://svn.apache.org/viewvc/aries/trunk/blueprint/blueprint-spring/src/main/java/org/apache/aries/blueprint/spring/BeansNamespaceHandler.java?rev=1723023&r1=1723022&r2=1723023&view=diff
==============================================================================
--- aries/trunk/blueprint/blueprint-spring/src/main/java/org/apache/aries/blueprint/spring/BeansNamespaceHandler.java (original)
+++ aries/trunk/blueprint/blueprint-spring/src/main/java/org/apache/aries/blueprint/spring/BeansNamespaceHandler.java Tue Jan 5 09:33:10 2016
@@ -52,8 +52,8 @@ public class BeansNamespaceHandler imple
@Override
public BeanDefinition parse(Element ele, ParserContext parserContext) {
- getReader(parserContext).parseElement(ele);
- return null;
+ BeanDefinitionHolder bdh = getReader(parserContext).parseElement(ele);
+ return bdh != null ? bdh.getBeanDefinition() : null;
}
@Override
@@ -129,11 +129,12 @@ public class BeansNamespaceHandler imple
}
- public void parseElement(Element ele) {
+ public BeanDefinitionHolder parseElement(Element ele) {
BeanDefinitionParserDelegate parent = this.delegate;
this.delegate = createDelegate(getReaderContext(), ele.getOwnerDocument().getDocumentElement(), parent);
- parseDefaultElement(ele, this.delegate);
+ BeanDefinitionHolder bdh = parseDefaultElement(ele, this.delegate);
this.delegate = parent;
+ return bdh;
}
/**
@@ -199,7 +200,8 @@ public class BeansNamespaceHandler imple
}
}
- private void parseDefaultElement(Element ele, BeanDefinitionParserDelegate delegate) {
+ private BeanDefinitionHolder parseDefaultElement(Element ele, BeanDefinitionParserDelegate delegate) {
+ BeanDefinitionHolder bdh = null;
if (delegate.nodeNameEquals(ele, IMPORT_ELEMENT)) {
importBeanDefinitionResource(ele);
}
@@ -207,12 +209,13 @@ public class BeansNamespaceHandler imple
processAliasRegistration(ele);
}
else if (delegate.nodeNameEquals(ele, BEAN_ELEMENT)) {
- processBeanDefinition(ele, delegate);
+ bdh = processBeanDefinition(ele, delegate);
}
else if (delegate.nodeNameEquals(ele, NESTED_BEANS_ELEMENT)) {
// recurse
doRegisterBeanDefinitions(ele);
}
+ return bdh;
}
/**
@@ -315,7 +318,7 @@ public class BeansNamespaceHandler imple
* Process the given bean element, parsing the bean definition
* and registering it with the registry.
*/
- protected void processBeanDefinition(Element ele, BeanDefinitionParserDelegate delegate) {
+ protected BeanDefinitionHolder processBeanDefinition(Element ele, BeanDefinitionParserDelegate delegate) {
BeanDefinitionHolder bdHolder = delegate.parseBeanDefinitionElement(ele);
if (bdHolder != null) {
bdHolder = delegate.decorateBeanDefinitionIfRequired(ele, bdHolder);
@@ -330,6 +333,7 @@ public class BeansNamespaceHandler imple
// Send registration event.
getReaderContext().fireComponentRegistered(new BeanComponentDefinition(bdHolder));
}
+ return bdHolder;
}
}
Modified: aries/trunk/blueprint/blueprint-spring/src/main/java/org/apache/aries/blueprint/spring/BlueprintNamespaceHandler.java
URL: http://svn.apache.org/viewvc/aries/trunk/blueprint/blueprint-spring/src/main/java/org/apache/aries/blueprint/spring/BlueprintNamespaceHandler.java?rev=1723023&r1=1723022&r2=1723023&view=diff
==============================================================================
--- aries/trunk/blueprint/blueprint-spring/src/main/java/org/apache/aries/blueprint/spring/BlueprintNamespaceHandler.java (original)
+++ aries/trunk/blueprint/blueprint-spring/src/main/java/org/apache/aries/blueprint/spring/BlueprintNamespaceHandler.java Tue Jan 5 09:33:10 2016
@@ -102,7 +102,22 @@ public class BlueprintNamespaceHandler i
org.springframework.beans.factory.xml.ParserContext springContext
= getOrCreateParserContext(parserContext);
// Parse spring bean
- springHandler.parse(element, springContext);
+ BeanDefinition bd = springHandler.parse(element, springContext);
+ for (String name : springContext.getRegistry().getBeanDefinitionNames()) {
+ if (springContext.getRegistry().getBeanDefinition(name) == bd) {
+ ComponentDefinitionRegistry registry = parserContext.getComponentDefinitionRegistry();
+ if (registry.containsComponentDefinition(name)) {
+ // Hack: we can't really make the difference between a top level bean
+ // and an inlined bean when using custom (eventually nested) namespaces.
+ // To work around the problem, the BlueprintBeanFactory will always register
+ // a BeanMetadata for each bean, but here, we unregister it and return it instead
+ // so that the caller is responsible for registering the metadata.
+ ComponentMetadata metadata = registry.getComponentDefinition(name);
+ registry.removeComponentDefinition(name);
+ return metadata;
+ }
+ }
+ }
return null;
} catch (Exception e) {
throw new RuntimeException(e);
Modified: aries/trunk/blueprint/blueprint-spring/src/main/java/org/apache/aries/blueprint/spring/SpringBeanProcessor.java
URL: http://svn.apache.org/viewvc/aries/trunk/blueprint/blueprint-spring/src/main/java/org/apache/aries/blueprint/spring/SpringBeanProcessor.java?rev=1723023&r1=1723022&r2=1723023&view=diff
==============================================================================
--- aries/trunk/blueprint/blueprint-spring/src/main/java/org/apache/aries/blueprint/spring/SpringBeanProcessor.java (original)
+++ aries/trunk/blueprint/blueprint-spring/src/main/java/org/apache/aries/blueprint/spring/SpringBeanProcessor.java Tue Jan 5 09:33:10 2016
@@ -58,7 +58,7 @@ public class SpringBeanProcessor impleme
@Override
public Object beforeInit(Object o, String s, BeanCreator beanCreator, BeanMetadata beanMetadata) {
- if (beanMetadata instanceof SpringMetadata) {
+ if (beanMetadata instanceof SpringMetadata || beanMetadata == null) {
return o;
}
if (o instanceof Aware) {
Added: aries/trunk/blueprint/blueprint-testbundlee/LICENSE
URL: http://svn.apache.org/viewvc/aries/trunk/blueprint/blueprint-testbundlee/LICENSE?rev=1723023&view=auto
==============================================================================
--- aries/trunk/blueprint/blueprint-testbundlee/LICENSE (added)
+++ aries/trunk/blueprint/blueprint-testbundlee/LICENSE Tue Jan 5 09:33:10 2016
@@ -0,0 +1,203 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ 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.
+
Added: aries/trunk/blueprint/blueprint-testbundlee/NOTICE
URL: http://svn.apache.org/viewvc/aries/trunk/blueprint/blueprint-testbundlee/NOTICE?rev=1723023&view=auto
==============================================================================
--- aries/trunk/blueprint/blueprint-testbundlee/NOTICE (added)
+++ aries/trunk/blueprint/blueprint-testbundlee/NOTICE Tue Jan 5 09:33:10 2016
@@ -0,0 +1,8 @@
+
+Apache Aries
+Copyright 2009-2011 The Apache Software Foundation
+
+This product includes software developed at
+The Apache Software Foundation (http://www.apache.org/).
+
+
Added: aries/trunk/blueprint/blueprint-testbundlee/pom.xml
URL: http://svn.apache.org/viewvc/aries/trunk/blueprint/blueprint-testbundlee/pom.xml?rev=1723023&view=auto
==============================================================================
--- aries/trunk/blueprint/blueprint-testbundlee/pom.xml (added)
+++ aries/trunk/blueprint/blueprint-testbundlee/pom.xml Tue Jan 5 09:33:10 2016
@@ -0,0 +1,101 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.apache.aries</groupId>
+ <artifactId>parent</artifactId>
+ <version>2.0.1</version>
+ <relativePath>../../parent/pom.xml</relativePath>
+ </parent>
+
+ <groupId>org.apache.aries.blueprint</groupId>
+ <artifactId>org.apache.aries.blueprint.testbundlee</artifactId>
+ <name>Apache Aries Blueprint Test Bundle E</name>
+ <version>1.0.0-SNAPSHOT</version>
+ <packaging>bundle</packaging>
+ <description>Blueprint Test Bundle E, provides Spring Extender test</description>
+
+ <scm>
+ <connection>scm:svn:http://svn.apache.org/repos/asf/aries/trunk/blueprint/blueprint-testbundlee</connection>
+ <developerConnection>scm:svn:https://svn.apache.org/repos/asf/aries/trunk/blueprint/blueprint-testbundlee</developerConnection>
+ <url>http://svn.apache.org/viewvc/aries/branches/trunk/blueprint-testbundlee</url>
+ </scm>
+
+ <properties>
+ <aries.osgi.private.pkg />
+ <aries.osgi.export.pkg>${project.artifactId}*</aries.osgi.export.pkg>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.eclipse</groupId>
+ <artifactId>osgi</artifactId>
+ <version>3.5.0.v20090520</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.aries.blueprint</groupId>
+ <artifactId>org.apache.aries.blueprint.api</artifactId>
+ <version>1.0.0</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.aries.blueprint</groupId>
+ <artifactId>org.apache.aries.blueprint.core</artifactId>
+ <version>1.0.0</version>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-context</artifactId>
+ <version>4.2.2.RELEASE</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-tx</artifactId>
+ <version>4.2.2.RELEASE</version>
+ <scope>provided</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.aries.versioning</groupId>
+ <artifactId>org.apache.aries.versioning.plugin</artifactId>
+ <executions>
+ <execution>
+ <id>default-verify</id>
+ <phase>verify</phase>
+ <goals>
+ <goal>version-check</goal>
+ </goals>
+ <configuration>
+ <skip>true</skip>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
Added: aries/trunk/blueprint/blueprint-testbundlee/src/main/java/org/apache/aries/blueprint/testbundlee/BeanA.java
URL: http://svn.apache.org/viewvc/aries/trunk/blueprint/blueprint-testbundlee/src/main/java/org/apache/aries/blueprint/testbundlee/BeanA.java?rev=1723023&view=auto
==============================================================================
--- aries/trunk/blueprint/blueprint-testbundlee/src/main/java/org/apache/aries/blueprint/testbundlee/BeanA.java (added)
+++ aries/trunk/blueprint/blueprint-testbundlee/src/main/java/org/apache/aries/blueprint/testbundlee/BeanA.java Tue Jan 5 09:33:10 2016
@@ -0,0 +1,24 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.apache.aries.blueprint.testbundlee;
+
+public class BeanA {
+
+ public BeanA(String arg1) {
+ }
+
+}
Added: aries/trunk/blueprint/blueprint-testbundlee/src/main/java/org/apache/aries/blueprint/testbundlee/BeanAFactory.java
URL: http://svn.apache.org/viewvc/aries/trunk/blueprint/blueprint-testbundlee/src/main/java/org/apache/aries/blueprint/testbundlee/BeanAFactory.java?rev=1723023&view=auto
==============================================================================
--- aries/trunk/blueprint/blueprint-testbundlee/src/main/java/org/apache/aries/blueprint/testbundlee/BeanAFactory.java (added)
+++ aries/trunk/blueprint/blueprint-testbundlee/src/main/java/org/apache/aries/blueprint/testbundlee/BeanAFactory.java Tue Jan 5 09:33:10 2016
@@ -0,0 +1,24 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.apache.aries.blueprint.testbundlee;
+
+public class BeanAFactory {
+
+ public static BeanA createBean(String arg1) {
+ return new BeanA(arg1);
+ }
+}
Added: aries/trunk/blueprint/blueprint-testbundlee/src/main/java/org/apache/aries/blueprint/testbundlee/BeanB.java
URL: http://svn.apache.org/viewvc/aries/trunk/blueprint/blueprint-testbundlee/src/main/java/org/apache/aries/blueprint/testbundlee/BeanB.java?rev=1723023&view=auto
==============================================================================
--- aries/trunk/blueprint/blueprint-testbundlee/src/main/java/org/apache/aries/blueprint/testbundlee/BeanB.java (added)
+++ aries/trunk/blueprint/blueprint-testbundlee/src/main/java/org/apache/aries/blueprint/testbundlee/BeanB.java Tue Jan 5 09:33:10 2016
@@ -0,0 +1,43 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.apache.aries.blueprint.testbundlee;
+
+import org.springframework.context.ApplicationContext;
+import org.springframework.context.ApplicationContextAware;
+
+public class BeanB implements ApplicationContextAware {
+
+ private BeanA beanA;
+ private ApplicationContext applicationContext;
+
+ public BeanA getBeanA() {
+ return beanA;
+ }
+
+ public void setBeanA(BeanA beanA) {
+ this.beanA = beanA;
+ }
+
+ public ApplicationContext getApplicationContext() {
+ return applicationContext;
+ }
+
+ @Override
+ public void setApplicationContext(ApplicationContext applicationContext) {
+ this.applicationContext = applicationContext;
+ }
+}
Added: aries/trunk/blueprint/blueprint-testbundlee/src/main/java/org/apache/aries/blueprint/testbundlee/BeanC.java
URL: http://svn.apache.org/viewvc/aries/trunk/blueprint/blueprint-testbundlee/src/main/java/org/apache/aries/blueprint/testbundlee/BeanC.java?rev=1723023&view=auto
==============================================================================
--- aries/trunk/blueprint/blueprint-testbundlee/src/main/java/org/apache/aries/blueprint/testbundlee/BeanC.java (added)
+++ aries/trunk/blueprint/blueprint-testbundlee/src/main/java/org/apache/aries/blueprint/testbundlee/BeanC.java Tue Jan 5 09:33:10 2016
@@ -0,0 +1,48 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.apache.aries.blueprint.testbundlee;
+
+import javax.annotation.PostConstruct;
+
+import org.springframework.transaction.annotation.Transactional;
+
+public class BeanC implements BeanCItf {
+
+ private final BeanA beanA;
+ private int initialized;
+
+ protected BeanC() {
+ this.beanA = null;
+ }
+
+ public BeanC(BeanA beanA) {
+ this.beanA = beanA;
+ }
+
+ @PostConstruct
+ public void start() {
+ this.initialized++;
+ }
+
+ @Transactional
+ public void doSomething() {
+ }
+
+ public int getInitialized() {
+ return initialized;
+ }
+}
Added: aries/trunk/blueprint/blueprint-testbundlee/src/main/java/org/apache/aries/blueprint/testbundlee/BeanCItf.java
URL: http://svn.apache.org/viewvc/aries/trunk/blueprint/blueprint-testbundlee/src/main/java/org/apache/aries/blueprint/testbundlee/BeanCItf.java?rev=1723023&view=auto
==============================================================================
--- aries/trunk/blueprint/blueprint-testbundlee/src/main/java/org/apache/aries/blueprint/testbundlee/BeanCItf.java (added)
+++ aries/trunk/blueprint/blueprint-testbundlee/src/main/java/org/apache/aries/blueprint/testbundlee/BeanCItf.java Tue Jan 5 09:33:10 2016
@@ -0,0 +1,26 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.apache.aries.blueprint.testbundlee;
+
+public interface BeanCItf {
+
+ void doSomething();
+
+ int getInitialized();
+}
Added: aries/trunk/blueprint/blueprint-testbundlee/src/main/resources/META-INF/spring/imported.xml
URL: http://svn.apache.org/viewvc/aries/trunk/blueprint/blueprint-testbundlee/src/main/resources/META-INF/spring/imported.xml?rev=1723023&view=auto
==============================================================================
--- aries/trunk/blueprint/blueprint-testbundlee/src/main/resources/META-INF/spring/imported.xml (added)
+++ aries/trunk/blueprint/blueprint-testbundlee/src/main/resources/META-INF/spring/imported.xml Tue Jan 5 09:33:10 2016
@@ -0,0 +1,54 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright (C) FuseSource, Inc.
+ http://fusesource.com
+
+ 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.
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:osgi="http://www.springframework.org/schema/osgi"
+ xmlns:context="http://www.springframework.org/schema/context"
+ xsi:schemaLocation="
+ http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.2.xsd
+ http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.2.xsd
+ http://www.springframework.org/schema/osgi http://www.springframework.org/schema/osgi/spring-osgi.xsd">
+
+ <context:annotation-config />
+
+ <bean name="beanA" class="org.apache.aries.blueprint.testbundlee.BeanAFactory"
+ factory-method="createBean">
+ <constructor-arg value="arg1"/>
+ </bean>
+
+ <osgi:service interface="org.apache.aries.blueprint.testbundlee.BeanCItf">
+ <osgi:service-properties>
+ <entry key="name" value="BeanC-1"/>
+ </osgi:service-properties>
+ <bean class="org.apache.aries.blueprint.testbundlee.BeanC">
+ <constructor-arg ref="beanA"/>
+ </bean>
+ </osgi:service>
+
+ <osgi:service interface="org.apache.aries.blueprint.testbundlee.BeanCItf"
+ ref="beanC">
+ <osgi:service-properties>
+ <entry key="name" value="BeanC-2"/>
+ </osgi:service-properties>
+ </osgi:service>
+
+ <bean id="beanC" class="org.apache.aries.blueprint.testbundlee.BeanC">
+ <constructor-arg ref="beanA"/>
+ </bean>
+
+</beans>
Modified: aries/trunk/blueprint/pom.xml
URL: http://svn.apache.org/viewvc/aries/trunk/blueprint/pom.xml?rev=1723023&r1=1723022&r2=1723023&view=diff
==============================================================================
--- aries/trunk/blueprint/pom.xml (original)
+++ aries/trunk/blueprint/pom.xml Tue Jan 5 09:33:10 2016
@@ -54,7 +54,6 @@
<module>blueprint-annotation-api</module>
<module>blueprint-annotation-impl</module>
<module>blueprint-authz</module>
- <module>blueprint-testbundles</module>
<module>blueprint-spring</module>
<module>blueprint-spring-extender</module>
<module>blueprint-sample-annotation</module>
@@ -62,6 +61,8 @@
<module>blueprint-sample-war</module>
<module>blueprint-testbundlea</module>
<module>blueprint-testbundleb</module>
+ <module>blueprint-testbundlee</module>
+ <module>blueprint-testbundles</module>
<module>blueprint-testquiescebundle</module>
<module>blueprint-itests</module>
</modules>