You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@felix.apache.org by gn...@apache.org on 2009/09/02 23:15:28 UTC

svn commit: r810699 - in /felix/trunk/bundleplugin/src/main: java/org/apache/felix/bnd/ java/org/apache/felix/bundleplugin/ resources/org/ resources/org/apache/ resources/org/apache/felix/ resources/org/apache/felix/bnd/

Author: gnodet
Date: Wed Sep  2 21:15:28 2009
New Revision: 810699

URL: http://svn.apache.org/viewvc?rev=810699&view=rev
Log:
FELIX-1552: add support for blueprint and spring-dm declarations to import the discovered packages

Added:
    felix/trunk/bundleplugin/src/main/java/org/apache/felix/bnd/
    felix/trunk/bundleplugin/src/main/java/org/apache/felix/bnd/BlueprintComponent.java
    felix/trunk/bundleplugin/src/main/resources/org/
    felix/trunk/bundleplugin/src/main/resources/org/apache/
    felix/trunk/bundleplugin/src/main/resources/org/apache/felix/
    felix/trunk/bundleplugin/src/main/resources/org/apache/felix/bnd/
    felix/trunk/bundleplugin/src/main/resources/org/apache/felix/bnd/blueprint.xsl
Modified:
    felix/trunk/bundleplugin/src/main/java/org/apache/felix/bundleplugin/BundlePlugin.java

Added: felix/trunk/bundleplugin/src/main/java/org/apache/felix/bnd/BlueprintComponent.java
URL: http://svn.apache.org/viewvc/felix/trunk/bundleplugin/src/main/java/org/apache/felix/bnd/BlueprintComponent.java?rev=810699&view=auto
==============================================================================
--- felix/trunk/bundleplugin/src/main/java/org/apache/felix/bnd/BlueprintComponent.java (added)
+++ felix/trunk/bundleplugin/src/main/java/org/apache/felix/bnd/BlueprintComponent.java Wed Sep  2 21:15:28 2009
@@ -0,0 +1,21 @@
+package org.apache.felix.bnd;
+
+import java.util.List;
+import java.util.ArrayList;
+
+import aQute.lib.spring.XMLTypeProcessor;
+import aQute.lib.spring.XMLType;
+import aQute.lib.osgi.Analyzer;
+
+public class BlueprintComponent extends XMLTypeProcessor {
+
+    protected List<XMLType> getTypes(Analyzer analyzer) throws Exception {
+        List<XMLType> types = new ArrayList<XMLType>();
+
+        String header = analyzer.getProperty("Bundle-Blueprint", "OSGI-INF/blueprint");
+        process(types,"blueprint.xsl", header, ".*\\.xml"); 
+
+        return types;
+    }
+
+}

Modified: felix/trunk/bundleplugin/src/main/java/org/apache/felix/bundleplugin/BundlePlugin.java
URL: http://svn.apache.org/viewvc/felix/trunk/bundleplugin/src/main/java/org/apache/felix/bundleplugin/BundlePlugin.java?rev=810699&r1=810698&r2=810699&view=diff
==============================================================================
--- felix/trunk/bundleplugin/src/main/java/org/apache/felix/bundleplugin/BundlePlugin.java (original)
+++ felix/trunk/bundleplugin/src/main/java/org/apache/felix/bundleplugin/BundlePlugin.java Wed Sep  2 21:15:28 2009
@@ -55,6 +55,7 @@
 import org.apache.maven.project.MavenProjectHelper;
 import org.apache.maven.shared.osgi.DefaultMaven2OsgiConverter;
 import org.apache.maven.shared.osgi.Maven2OsgiConverter;
+import org.apache.felix.bnd.BlueprintComponent;
 import org.codehaus.plexus.archiver.UnArchiver;
 import org.codehaus.plexus.archiver.manager.ArchiverManager;
 import org.codehaus.plexus.util.DirectoryScanner;
@@ -66,6 +67,8 @@
 import aQute.lib.osgi.EmbeddedResource;
 import aQute.lib.osgi.FileResource;
 import aQute.lib.osgi.Jar;
+import aQute.lib.spring.SpringXMLType;
+import aQute.lib.spring.JPAComponent;
 
 
 /**
@@ -882,6 +885,10 @@
 
         properties.put( "classifier", classifier == null ? "" : classifier );
 
+        // Add default plugins
+        header( properties, Analyzer.PLUGIN,
+                BlueprintComponent.class.getName() + "," + SpringXMLType.class.getName());
+
         return properties;
     }
 

Added: felix/trunk/bundleplugin/src/main/resources/org/apache/felix/bnd/blueprint.xsl
URL: http://svn.apache.org/viewvc/felix/trunk/bundleplugin/src/main/resources/org/apache/felix/bnd/blueprint.xsl?rev=810699&view=auto
==============================================================================
--- felix/trunk/bundleplugin/src/main/resources/org/apache/felix/bnd/blueprint.xsl (added)
+++ felix/trunk/bundleplugin/src/main/resources/org/apache/felix/bnd/blueprint.xsl Wed Sep  2 21:15:28 2009
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:bp="http://www.osgi.org/xmlns/blueprint/v1.0.0">
+	<xsl:output method="text" />
+
+	<xsl:template match="/">
+
+		<!-- Match all attributes that holds a class or a comma delimited 
+		     list of classes and print them -->
+
+		<xsl:for-each select="
+				//bp:bean/@class 
+			|	//bp:service/@interface 
+			|   //bp:service/bp:interfaces/bp:value/text()
+ 			|	//bp:reference/@interface
+			|	//bp:reference-list/@interface
+		">
+			<xsl:value-of select="." />
+			<xsl:text>
+			</xsl:text>
+		</xsl:for-each>
+
+		<xsl:for-each select="
+				//bp:bean/bp:argument/@type
+		    |	//bp:list/@value-type 
+    		|	//bp:set/@value-type 
+    		|	//bp:array/@value-type 
+			|   //bp:map/@key-type
+			|   //bp:map/@value-type
+		">
+		    <xsl:choose>
+		        <xsl:when test="contains(., '[')"><xsl:value-of select="substring-before(., '[')"/></xsl:when>
+		        <xsl:otherwise><xsl:value-of select="."/></xsl:otherwise>
+			</xsl:choose>
+			<xsl:text>
+			</xsl:text>
+		</xsl:for-each>
+
+	</xsl:template>
+
+
+</xsl:stylesheet>
+