FELIX-2884 - The multiplicity isn't taken into account by the maven bundle plugin and bundlerepository when generating the repository xml

git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@1082904 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/bundleplugin/pom.xml b/bundleplugin/pom.xml
index 48e5eaa..f7f1146 100644
--- a/bundleplugin/pom.xml
+++ b/bundleplugin/pom.xml
@@ -66,7 +66,7 @@
   <dependency>
       <groupId>org.apache.felix</groupId>
       <artifactId>org.apache.felix.bundlerepository</artifactId>
-      <version>1.6.2</version>
+      <version>1.6.5-SNAPSHOT</version>
   </dependency>
   <dependency>
     <groupId>org.apache.felix</groupId>
diff --git a/bundleplugin/src/main/resources/org/apache/felix/bundleplugin/blueprint.xsl b/bundleplugin/src/main/resources/org/apache/felix/bundleplugin/blueprint.xsl
index 2d16d18..58ca714 100644
--- a/bundleplugin/src/main/resources/org/apache/felix/bundleplugin/blueprint.xsl
+++ b/bundleplugin/src/main/resources/org/apache/felix/bundleplugin/blueprint.xsl
@@ -88,8 +88,8 @@
             </xsl:text>
         </xsl:for-each>
 
-        <xsl:for-each select="//bp:reference[@interface] | //bp:reference-list[@interface]">
-            <xsl:value-of select="concat('Import-Service:', @interface)" />
+        <xsl:for-each select="//bp:reference[@interface]">
+            <xsl:value-of select="concat('Import-Service:', @interface, ';multiple:=false')" />
             <xsl:choose>
                 <xsl:when test="@availability">
                     <xsl:value-of select="concat(';availability:=', @availability)"/>
@@ -125,7 +125,44 @@
             </xsl:text>
         </xsl:for-each>
 
-    </xsl:template>
+        <xsl:for-each select="//bp:reference-list[@interface]">
+            <xsl:value-of select="concat('Import-Service:', @interface, ';multiple:=true')"/>
+            <xsl:choose>
+                <xsl:when test="@availability">
+                    <xsl:value-of select="concat(';availability:=', @availability)"/>
+                </xsl:when>
+                <xsl:otherwise>
+                    <xsl:choose>
+                        <xsl:when test="/bp:blueprint/@default-availability">
+                            <xsl:value-of select="concat(';availability:=', /bp:blueprint/@default-availability)"/>
+                        </xsl:when>
+                    </xsl:choose>
+                </xsl:otherwise>
+            </xsl:choose>
+            <xsl:choose>
+                <xsl:when test="@filter">
+                    <xsl:choose>
+                        <xsl:when test="@component-name">
+                            <xsl:value-of select="concat(';filter=&quot;(&amp;', @filter, ')(osgi.service.blueprint.compname=',  @component-name, ')&quot;')" />
+                         </xsl:when>
+                        <xsl:otherwise>
+                            <xsl:value-of select="concat(';filter=&quot;', @filter, '&quot;')" />
+                        </xsl:otherwise>
+                    </xsl:choose>
+                </xsl:when>
+                <xsl:otherwise>
+                    <xsl:choose>
+                        <xsl:when test="@component-name">
+                            <xsl:value-of select="concat(';filter=&quot;(osgi.service.blueprint.compname=', @component-name, ')&quot;')" />
+                        </xsl:when>
+                    </xsl:choose>
+                </xsl:otherwise>
+            </xsl:choose>
+            <xsl:text>
+            </xsl:text>
+        </xsl:for-each>
+
+   </xsl:template>
 
 </xsl:stylesheet>
 
diff --git a/bundlerepository/pom.xml b/bundlerepository/pom.xml
index f345dd8..34cb840 100644
--- a/bundlerepository/pom.xml
+++ b/bundlerepository/pom.xml
@@ -109,7 +109,7 @@
             <Bundle-Vendor>The Apache Software Foundation</Bundle-Vendor>
             <Export-Service>org.apache.felix.bundlerepository.RepositoryAdmin,org.osgi.service.obr.RepositoryAdmin</Export-Service>
             <_versionpolicy>[$(version;==;$(@)),$(version;+;$(@)))</_versionpolicy>
-            <Include-Resource>META-INF/LICENSE=LICENSE,META-INF/LICENSE.kxml2=LICENSE.kxml2,META-INF/NOTICE=NOTICE,META-INF/DEPENDENCIES=DEPENDENCIES,{src/main/resources/}</Include-Resource>
+            <Include-Resource>META-INF/LICENSE=LICENSE,META-INF/LICENSE.kxml2=LICENSE.kxml2,META-INF/NOTICE=NOTICE,META-INF/DEPENDENCIES=DEPENDENCIES</Include-Resource>
           </instructions>
         </configuration>
       </plugin>
diff --git a/bundlerepository/src/main/java/org/apache/felix/bundlerepository/impl/DataModelHelperImpl.java b/bundlerepository/src/main/java/org/apache/felix/bundlerepository/impl/DataModelHelperImpl.java
index 7e86c81..9a4d785 100644
--- a/bundlerepository/src/main/java/org/apache/felix/bundlerepository/impl/DataModelHelperImpl.java
+++ b/bundlerepository/src/main/java/org/apache/felix/bundlerepository/impl/DataModelHelperImpl.java
@@ -575,8 +575,9 @@
             ri.addText("Import Service " + imports[i].getName());
 
             String avail = imports[i].getDirective("availability");
+            String mult = imports[i].getDirective("multiple");
             ri.setOptional("optional".equalsIgnoreCase(avail));
-            ri.setMultiple(true);
+            ri.setMultiple(!"false".equalsIgnoreCase(mult));
             resource.addRequire(ri);
         }