You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@karaf.apache.org by dj...@apache.org on 2011/01/28 20:34:53 UTC
svn commit: r1064825 [1/2] - in /karaf/trunk: features/core/
tooling/features-maven-plugin/
tooling/features-maven-plugin/src/main/java/org/apache/karaf/features/
tooling/features-maven-plugin/src/main/java/org/apache/karaf/features/internal/
tooling/f...
Author: djencks
Date: Fri Jan 28 19:34:52 2011
New Revision: 1064825
URL: http://svn.apache.org/viewvc?rev=1064825&view=rev
Log:
KARAF-424 Start of an ArchiveKarMojo. Add a jaxb tree for feature.xml manipulation, use it in GenerateFeaturesXmlMojo2. Currently ArchiveKarMojo includes the bundles but not the features.xml or the legal files
Added:
karaf/trunk/tooling/features-maven-plugin/src/main/java/org/apache/karaf/features/
karaf/trunk/tooling/features-maven-plugin/src/main/java/org/apache/karaf/features/internal/
karaf/trunk/tooling/features-maven-plugin/src/main/java/org/apache/karaf/features/internal/Bundle.java (with props)
karaf/trunk/tooling/features-maven-plugin/src/main/java/org/apache/karaf/features/internal/Config.java (with props)
karaf/trunk/tooling/features-maven-plugin/src/main/java/org/apache/karaf/features/internal/ConfigFile.java (with props)
karaf/trunk/tooling/features-maven-plugin/src/main/java/org/apache/karaf/features/internal/Dependency.java (with props)
karaf/trunk/tooling/features-maven-plugin/src/main/java/org/apache/karaf/features/internal/Feature.java (with props)
karaf/trunk/tooling/features-maven-plugin/src/main/java/org/apache/karaf/features/internal/FeaturesRoot.java (with props)
karaf/trunk/tooling/features-maven-plugin/src/main/java/org/apache/karaf/features/internal/ObjectFactory.java (with props)
karaf/trunk/tooling/features-maven-plugin/src/main/java/org/apache/karaf/tooling/features/ArchiveKarMojo.java (with props)
karaf/trunk/tooling/features-maven-plugin/src/main/java/org/apache/karaf/tooling/features/JaxbUtil.java (with props)
karaf/trunk/tooling/features-maven-plugin/src/main/resources/org/
karaf/trunk/tooling/features-maven-plugin/src/main/resources/org/apache/
karaf/trunk/tooling/features-maven-plugin/src/main/resources/org/apache/karaf/
karaf/trunk/tooling/features-maven-plugin/src/main/resources/org/apache/karaf/features/
karaf/trunk/tooling/features-maven-plugin/src/main/resources/org/apache/karaf/features/karaf-features-1.0.0-ordered.xsd (with props)
Modified:
karaf/trunk/features/core/pom.xml
karaf/trunk/tooling/features-maven-plugin/pom.xml
karaf/trunk/tooling/features-maven-plugin/src/main/java/org/apache/karaf/tooling/features/AddFeaturesToRepoMojo.java
karaf/trunk/tooling/features-maven-plugin/src/main/java/org/apache/karaf/tooling/features/GenerateFeaturesXmlMojo2.java
karaf/trunk/tooling/features-maven-plugin/src/main/java/org/apache/karaf/tooling/features/MojoSupport.java
karaf/trunk/tooling/features-maven-plugin/src/main/resources/META-INF/plexus/components.xml
Modified: karaf/trunk/features/core/pom.xml
URL: http://svn.apache.org/viewvc/karaf/trunk/features/core/pom.xml?rev=1064825&r1=1064824&r2=1064825&view=diff
==============================================================================
--- karaf/trunk/features/core/pom.xml (original)
+++ karaf/trunk/features/core/pom.xml Fri Jan 28 19:34:52 2011
@@ -93,23 +93,6 @@
<build>
<plugins>
<plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>jaxb2-maven-plugin</artifactId>
- <version>1.3</version>
- <executions>
- <execution>
- <goals>
- <goal>xjc</goal>
- </goals>
- </execution>
- </executions>
- <configuration>
- <schemaDirectory>src/main/resources/org/apache/karaf/features</schemaDirectory>
- <packageName>org.apache.karaf.features.internal</packageName>
- <extension>true</extension>
- </configuration>
- </plugin>
- <plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<configuration>
Modified: karaf/trunk/tooling/features-maven-plugin/pom.xml
URL: http://svn.apache.org/viewvc/karaf/trunk/tooling/features-maven-plugin/pom.xml?rev=1064825&r1=1064824&r2=1064825&view=diff
==============================================================================
--- karaf/trunk/tooling/features-maven-plugin/pom.xml (original)
+++ karaf/trunk/tooling/features-maven-plugin/pom.xml Fri Jan 28 19:34:52 2011
@@ -93,4 +93,27 @@
</dependency>
</dependencies>
+ <build>
+ <plugins>
+ <!--<plugin>-->
+ <!--<groupId>org.codehaus.mojo</groupId>-->
+ <!--<artifactId>jaxb2-maven-plugin</artifactId>-->
+ <!--<version>1.3</version>-->
+ <!--<executions>-->
+ <!--<execution>-->
+ <!--<goals>-->
+ <!--<goal>xjc</goal>-->
+ <!--</goals>-->
+ <!--</execution>-->
+ <!--</executions>-->
+ <!--<configuration>-->
+ <!--<schemaDirectory>src/main/resources/org/apache/karaf/features</schemaDirectory>-->
+ <!--<packageName>org.apache.karaf.features.internal</packageName>-->
+ <!--<extension>true</extension>-->
+ <!--</configuration>-->
+ <!--</plugin>-->
+
+ </plugins>
+ </build>
+
</project>
Added: karaf/trunk/tooling/features-maven-plugin/src/main/java/org/apache/karaf/features/internal/Bundle.java
URL: http://svn.apache.org/viewvc/karaf/trunk/tooling/features-maven-plugin/src/main/java/org/apache/karaf/features/internal/Bundle.java?rev=1064825&view=auto
==============================================================================
--- karaf/trunk/tooling/features-maven-plugin/src/main/java/org/apache/karaf/features/internal/Bundle.java (added)
+++ karaf/trunk/tooling/features-maven-plugin/src/main/java/org/apache/karaf/features/internal/Bundle.java Fri Jan 28 19:34:52 2011
@@ -0,0 +1,154 @@
+//
+// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-833
+// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
+// Any modifications to this file will be lost upon recompilation of the source schema.
+// Generated on: 2011.01.19 at 04:45:46 PM PST
+//
+
+
+package org.apache.karaf.features.internal;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlSchemaType;
+import javax.xml.bind.annotation.XmlType;
+import javax.xml.bind.annotation.XmlValue;
+
+
+/**
+ *
+ * Deployable element to install.
+ *
+ *
+ * <p>Java class for bundle complex type.
+ *
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ *
+ * <pre>
+ * <complexType name="bundle">
+ * <simpleContent>
+ * <extension base="<http://www.w3.org/2001/XMLSchema>anyURI">
+ * <attribute name="start-level" type="{http://www.w3.org/2001/XMLSchema}int" />
+ * <attribute name="start" type="{http://www.w3.org/2001/XMLSchema}boolean" />
+ * <attribute name="dependency" type="{http://www.w3.org/2001/XMLSchema}boolean" />
+ * </extension>
+ * </simpleContent>
+ * </complexType>
+ * </pre>
+ *
+ *
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "bundle", propOrder = {
+ "value"
+})
+public class Bundle {
+
+ @XmlValue
+ @XmlSchemaType(name = "anyURI")
+ protected String value;
+ @XmlAttribute(name = "start-level")
+ protected Integer startLevel;
+ @XmlAttribute
+ protected Boolean start;
+ @XmlAttribute
+ protected Boolean dependency;
+
+ /**
+ * Gets the value of the value property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getValue() {
+ return value;
+ }
+
+ /**
+ * Sets the value of the value property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setValue(String value) {
+ this.value = value;
+ }
+
+ /**
+ * Gets the value of the startLevel property.
+ *
+ * @return
+ * possible object is
+ * {@link Integer }
+ *
+ */
+ public Integer getStartLevel() {
+ return startLevel;
+ }
+
+ /**
+ * Sets the value of the startLevel property.
+ *
+ * @param value
+ * allowed object is
+ * {@link Integer }
+ *
+ */
+ public void setStartLevel(Integer value) {
+ this.startLevel = value;
+ }
+
+ /**
+ * Gets the value of the start property.
+ *
+ * @return
+ * possible object is
+ * {@link Boolean }
+ *
+ */
+ public Boolean isStart() {
+ return start;
+ }
+
+ /**
+ * Sets the value of the start property.
+ *
+ * @param value
+ * allowed object is
+ * {@link Boolean }
+ *
+ */
+ public void setStart(Boolean value) {
+ this.start = value;
+ }
+
+ /**
+ * Gets the value of the dependency property.
+ *
+ * @return
+ * possible object is
+ * {@link Boolean }
+ *
+ */
+ public Boolean isDependency() {
+ return dependency;
+ }
+
+ /**
+ * Sets the value of the dependency property.
+ *
+ * @param value
+ * allowed object is
+ * {@link Boolean }
+ *
+ */
+ public void setDependency(Boolean value) {
+ this.dependency = value;
+ }
+
+}
Propchange: karaf/trunk/tooling/features-maven-plugin/src/main/java/org/apache/karaf/features/internal/Bundle.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: karaf/trunk/tooling/features-maven-plugin/src/main/java/org/apache/karaf/features/internal/Bundle.java
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: karaf/trunk/tooling/features-maven-plugin/src/main/java/org/apache/karaf/features/internal/Bundle.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: karaf/trunk/tooling/features-maven-plugin/src/main/java/org/apache/karaf/features/internal/Config.java
URL: http://svn.apache.org/viewvc/karaf/trunk/tooling/features-maven-plugin/src/main/java/org/apache/karaf/features/internal/Config.java?rev=1064825&view=auto
==============================================================================
--- karaf/trunk/tooling/features-maven-plugin/src/main/java/org/apache/karaf/features/internal/Config.java (added)
+++ karaf/trunk/tooling/features-maven-plugin/src/main/java/org/apache/karaf/features/internal/Config.java Fri Jan 28 19:34:52 2011
@@ -0,0 +1,99 @@
+//
+// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-833
+// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
+// Any modifications to this file will be lost upon recompilation of the source schema.
+// Generated on: 2011.01.19 at 04:45:46 PM PST
+//
+
+
+package org.apache.karaf.features.internal;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlType;
+import javax.xml.bind.annotation.XmlValue;
+
+
+/**
+ *
+ * Configuration entries which should be created during feature installation. This
+ * configuration may be used with OSGi Configuration Admin.
+ *
+ *
+ * <p>Java class for config complex type.
+ *
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ *
+ * <pre>
+ * <complexType name="config">
+ * <simpleContent>
+ * <extension base="<http://www.w3.org/2001/XMLSchema>string">
+ * <attribute name="name" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
+ * </extension>
+ * </simpleContent>
+ * </complexType>
+ * </pre>
+ *
+ *
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "config", propOrder = {
+ "value"
+})
+public class Config {
+
+ @XmlValue
+ protected String value;
+ @XmlAttribute(required = true)
+ protected String name;
+
+ /**
+ * Gets the value of the value property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getValue() {
+ return value;
+ }
+
+ /**
+ * Sets the value of the value property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setValue(String value) {
+ this.value = value;
+ }
+
+ /**
+ * Gets the value of the name property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * Sets the value of the name property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setName(String value) {
+ this.name = value;
+ }
+
+}
Propchange: karaf/trunk/tooling/features-maven-plugin/src/main/java/org/apache/karaf/features/internal/Config.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: karaf/trunk/tooling/features-maven-plugin/src/main/java/org/apache/karaf/features/internal/Config.java
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: karaf/trunk/tooling/features-maven-plugin/src/main/java/org/apache/karaf/features/internal/Config.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: karaf/trunk/tooling/features-maven-plugin/src/main/java/org/apache/karaf/features/internal/ConfigFile.java
URL: http://svn.apache.org/viewvc/karaf/trunk/tooling/features-maven-plugin/src/main/java/org/apache/karaf/features/internal/ConfigFile.java?rev=1064825&view=auto
==============================================================================
--- karaf/trunk/tooling/features-maven-plugin/src/main/java/org/apache/karaf/features/internal/ConfigFile.java (added)
+++ karaf/trunk/tooling/features-maven-plugin/src/main/java/org/apache/karaf/features/internal/ConfigFile.java Fri Jan 28 19:34:52 2011
@@ -0,0 +1,98 @@
+//
+// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-833
+// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
+// Any modifications to this file will be lost upon recompilation of the source schema.
+// Generated on: 2011.01.19 at 04:45:46 PM PST
+//
+
+
+package org.apache.karaf.features.internal;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlType;
+import javax.xml.bind.annotation.XmlValue;
+
+
+/**
+ *
+ * Additional configuration files which should be created during feature installation.
+ *
+ *
+ * <p>Java class for configFile complex type.
+ *
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ *
+ * <pre>
+ * <complexType name="configFile">
+ * <simpleContent>
+ * <extension base="<http://www.w3.org/2001/XMLSchema>string">
+ * <attribute name="finalname" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
+ * </extension>
+ * </simpleContent>
+ * </complexType>
+ * </pre>
+ *
+ *
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "configFile", propOrder = {
+ "value"
+})
+public class ConfigFile {
+
+ @XmlValue
+ protected String value;
+ @XmlAttribute(required = true)
+ protected String finalname;
+
+ /**
+ * Gets the value of the value property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getValue() {
+ return value;
+ }
+
+ /**
+ * Sets the value of the value property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setValue(String value) {
+ this.value = value;
+ }
+
+ /**
+ * Gets the value of the finalname property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getFinalname() {
+ return finalname;
+ }
+
+ /**
+ * Sets the value of the finalname property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setFinalname(String value) {
+ this.finalname = value;
+ }
+
+}
Propchange: karaf/trunk/tooling/features-maven-plugin/src/main/java/org/apache/karaf/features/internal/ConfigFile.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: karaf/trunk/tooling/features-maven-plugin/src/main/java/org/apache/karaf/features/internal/ConfigFile.java
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: karaf/trunk/tooling/features-maven-plugin/src/main/java/org/apache/karaf/features/internal/ConfigFile.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: karaf/trunk/tooling/features-maven-plugin/src/main/java/org/apache/karaf/features/internal/Dependency.java
URL: http://svn.apache.org/viewvc/karaf/trunk/tooling/features-maven-plugin/src/main/java/org/apache/karaf/features/internal/Dependency.java?rev=1064825&view=auto
==============================================================================
--- karaf/trunk/tooling/features-maven-plugin/src/main/java/org/apache/karaf/features/internal/Dependency.java (added)
+++ karaf/trunk/tooling/features-maven-plugin/src/main/java/org/apache/karaf/features/internal/Dependency.java Fri Jan 28 19:34:52 2011
@@ -0,0 +1,104 @@
+//
+// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-833
+// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
+// Any modifications to this file will be lost upon recompilation of the source schema.
+// Generated on: 2011.01.19 at 04:45:46 PM PST
+//
+
+
+package org.apache.karaf.features.internal;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlType;
+import javax.xml.bind.annotation.XmlValue;
+
+
+/**
+ *
+ * Dependency of feature.
+ *
+ *
+ * <p>Java class for dependency complex type.
+ *
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ *
+ * <pre>
+ * <complexType name="dependency">
+ * <simpleContent>
+ * <extension base="<http://karaf.apache.org/xmlns/features/v1.0.0>featureName">
+ * <attribute name="version" type="{http://www.w3.org/2001/XMLSchema}string" default="0.0.0" />
+ * </extension>
+ * </simpleContent>
+ * </complexType>
+ * </pre>
+ *
+ *
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "dependency", propOrder = {
+ "value"
+})
+public class Dependency {
+
+ @XmlValue
+ protected String value;
+ @XmlAttribute
+ protected String version;
+
+ /**
+ *
+ * Feature name should be non empty string.
+ *
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getValue() {
+ return value;
+ }
+
+ /**
+ * Sets the value of the value property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setValue(String value) {
+ this.value = value;
+ }
+
+ /**
+ * Gets the value of the version property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getVersion() {
+ if (version == null) {
+ return "0.0.0";
+ } else {
+ return version;
+ }
+ }
+
+ /**
+ * Sets the value of the version property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setVersion(String value) {
+ this.version = value;
+ }
+
+}
Propchange: karaf/trunk/tooling/features-maven-plugin/src/main/java/org/apache/karaf/features/internal/Dependency.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: karaf/trunk/tooling/features-maven-plugin/src/main/java/org/apache/karaf/features/internal/Dependency.java
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: karaf/trunk/tooling/features-maven-plugin/src/main/java/org/apache/karaf/features/internal/Dependency.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: karaf/trunk/tooling/features-maven-plugin/src/main/java/org/apache/karaf/features/internal/Feature.java
URL: http://svn.apache.org/viewvc/karaf/trunk/tooling/features-maven-plugin/src/main/java/org/apache/karaf/features/internal/Feature.java?rev=1064825&view=auto
==============================================================================
--- karaf/trunk/tooling/features-maven-plugin/src/main/java/org/apache/karaf/features/internal/Feature.java (added)
+++ karaf/trunk/tooling/features-maven-plugin/src/main/java/org/apache/karaf/features/internal/Feature.java Fri Jan 28 19:34:52 2011
@@ -0,0 +1,324 @@
+//
+// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-833
+// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
+// Any modifications to this file will be lost upon recompilation of the source schema.
+// Generated on: 2011.01.19 at 04:45:46 PM PST
+//
+
+
+package org.apache.karaf.features.internal;
+
+import java.util.ArrayList;
+import java.util.List;
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ *
+ * Definition of the Feature.
+ *
+ *
+ * <p>Java class for feature complex type.
+ *
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ *
+ * <pre>
+ * <complexType name="feature">
+ * <complexContent>
+ * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * <sequence>
+ * <element name="description" type="{http://www.w3.org/2001/XMLSchema}string" maxOccurs="unbounded" minOccurs="0"/>
+ * <element name="details" type="{http://www.w3.org/2001/XMLSchema}string" maxOccurs="unbounded" minOccurs="0"/>
+ * <element name="config" type="{http://karaf.apache.org/xmlns/features/v1.0.0}config" maxOccurs="unbounded" minOccurs="0"/>
+ * <element name="configfile" type="{http://karaf.apache.org/xmlns/features/v1.0.0}configFile" maxOccurs="unbounded" minOccurs="0"/>
+ * <element name="feature" type="{http://karaf.apache.org/xmlns/features/v1.0.0}dependency" maxOccurs="unbounded" minOccurs="0"/>
+ * <element name="bundle" type="{http://karaf.apache.org/xmlns/features/v1.0.0}bundle" maxOccurs="unbounded" minOccurs="0"/>
+ * </sequence>
+ * <attribute name="name" use="required" type="{http://karaf.apache.org/xmlns/features/v1.0.0}featureName" />
+ * <attribute name="version" type="{http://www.w3.org/2001/XMLSchema}string" default="0.0.0" />
+ * <attribute name="resolver" type="{http://karaf.apache.org/xmlns/features/v1.0.0}resolver" />
+ * </restriction>
+ * </complexContent>
+ * </complexType>
+ * </pre>
+ *
+ *
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "feature", propOrder = {
+ "description",
+ "details",
+ "config",
+ "configfile",
+ "feature",
+ "bundle"
+})
+public class Feature {
+
+ protected List<String> description;
+ protected List<String> details;
+ protected List<Config> config;
+ protected List<ConfigFile> configfile;
+ protected List<Dependency> feature;
+ protected List<Bundle> bundle;
+ @XmlAttribute(required = true)
+ protected String name;
+ @XmlAttribute
+ protected String version;
+ @XmlAttribute
+ protected String resolver;
+
+ /**
+ * Gets the value of the description property.
+ *
+ * <p>
+ * This accessor method returns a reference to the live list,
+ * not a snapshot. Therefore any modification you make to the
+ * returned list will be present inside the JAXB object.
+ * This is why there is not a <CODE>set</CODE> method for the description property.
+ *
+ * <p>
+ * For example, to add a new item, do as follows:
+ * <pre>
+ * getDescription().add(newItem);
+ * </pre>
+ *
+ *
+ * <p>
+ * Objects of the following type(s) are allowed in the list
+ * {@link String }
+ *
+ *
+ */
+ public List<String> getDescription() {
+ if (description == null) {
+ description = new ArrayList<String>();
+ }
+ return this.description;
+ }
+
+ /**
+ * Gets the value of the details property.
+ *
+ * <p>
+ * This accessor method returns a reference to the live list,
+ * not a snapshot. Therefore any modification you make to the
+ * returned list will be present inside the JAXB object.
+ * This is why there is not a <CODE>set</CODE> method for the details property.
+ *
+ * <p>
+ * For example, to add a new item, do as follows:
+ * <pre>
+ * getDetails().add(newItem);
+ * </pre>
+ *
+ *
+ * <p>
+ * Objects of the following type(s) are allowed in the list
+ * {@link String }
+ *
+ *
+ */
+ public List<String> getDetails() {
+ if (details == null) {
+ details = new ArrayList<String>();
+ }
+ return this.details;
+ }
+
+ /**
+ * Gets the value of the config property.
+ *
+ * <p>
+ * This accessor method returns a reference to the live list,
+ * not a snapshot. Therefore any modification you make to the
+ * returned list will be present inside the JAXB object.
+ * This is why there is not a <CODE>set</CODE> method for the config property.
+ *
+ * <p>
+ * For example, to add a new item, do as follows:
+ * <pre>
+ * getConfig().add(newItem);
+ * </pre>
+ *
+ *
+ * <p>
+ * Objects of the following type(s) are allowed in the list
+ * {@link Config }
+ *
+ *
+ */
+ public List<Config> getConfig() {
+ if (config == null) {
+ config = new ArrayList<Config>();
+ }
+ return this.config;
+ }
+
+ /**
+ * Gets the value of the configfile property.
+ *
+ * <p>
+ * This accessor method returns a reference to the live list,
+ * not a snapshot. Therefore any modification you make to the
+ * returned list will be present inside the JAXB object.
+ * This is why there is not a <CODE>set</CODE> method for the configfile property.
+ *
+ * <p>
+ * For example, to add a new item, do as follows:
+ * <pre>
+ * getConfigfile().add(newItem);
+ * </pre>
+ *
+ *
+ * <p>
+ * Objects of the following type(s) are allowed in the list
+ * {@link ConfigFile }
+ *
+ *
+ */
+ public List<ConfigFile> getConfigfile() {
+ if (configfile == null) {
+ configfile = new ArrayList<ConfigFile>();
+ }
+ return this.configfile;
+ }
+
+ /**
+ * Gets the value of the feature property.
+ *
+ * <p>
+ * This accessor method returns a reference to the live list,
+ * not a snapshot. Therefore any modification you make to the
+ * returned list will be present inside the JAXB object.
+ * This is why there is not a <CODE>set</CODE> method for the feature property.
+ *
+ * <p>
+ * For example, to add a new item, do as follows:
+ * <pre>
+ * getFeature().add(newItem);
+ * </pre>
+ *
+ *
+ * <p>
+ * Objects of the following type(s) are allowed in the list
+ * {@link Dependency }
+ *
+ *
+ */
+ public List<Dependency> getFeature() {
+ if (feature == null) {
+ feature = new ArrayList<Dependency>();
+ }
+ return this.feature;
+ }
+
+ /**
+ * Gets the value of the bundle property.
+ *
+ * <p>
+ * This accessor method returns a reference to the live list,
+ * not a snapshot. Therefore any modification you make to the
+ * returned list will be present inside the JAXB object.
+ * This is why there is not a <CODE>set</CODE> method for the bundle property.
+ *
+ * <p>
+ * For example, to add a new item, do as follows:
+ * <pre>
+ * getBundle().add(newItem);
+ * </pre>
+ *
+ *
+ * <p>
+ * Objects of the following type(s) are allowed in the list
+ * {@link Bundle }
+ *
+ *
+ */
+ public List<Bundle> getBundle() {
+ if (bundle == null) {
+ bundle = new ArrayList<Bundle>();
+ }
+ return this.bundle;
+ }
+
+ /**
+ * Gets the value of the name property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * Sets the value of the name property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setName(String value) {
+ this.name = value;
+ }
+
+ /**
+ * Gets the value of the version property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getVersion() {
+ if (version == null) {
+ return "0.0.0";
+ } else {
+ return version;
+ }
+ }
+
+ /**
+ * Sets the value of the version property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setVersion(String value) {
+ this.version = value;
+ }
+
+ /**
+ * Gets the value of the resolver property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getResolver() {
+ return resolver;
+ }
+
+ /**
+ * Sets the value of the resolver property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setResolver(String value) {
+ this.resolver = value;
+ }
+
+}
Propchange: karaf/trunk/tooling/features-maven-plugin/src/main/java/org/apache/karaf/features/internal/Feature.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: karaf/trunk/tooling/features-maven-plugin/src/main/java/org/apache/karaf/features/internal/Feature.java
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: karaf/trunk/tooling/features-maven-plugin/src/main/java/org/apache/karaf/features/internal/Feature.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: karaf/trunk/tooling/features-maven-plugin/src/main/java/org/apache/karaf/features/internal/FeaturesRoot.java
URL: http://svn.apache.org/viewvc/karaf/trunk/tooling/features-maven-plugin/src/main/java/org/apache/karaf/features/internal/FeaturesRoot.java?rev=1064825&view=auto
==============================================================================
--- karaf/trunk/tooling/features-maven-plugin/src/main/java/org/apache/karaf/features/internal/FeaturesRoot.java (added)
+++ karaf/trunk/tooling/features-maven-plugin/src/main/java/org/apache/karaf/features/internal/FeaturesRoot.java Fri Jan 28 19:34:52 2011
@@ -0,0 +1,144 @@
+//
+// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-833
+// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
+// Any modifications to this file will be lost upon recompilation of the source schema.
+// Generated on: 2011.01.19 at 04:45:46 PM PST
+//
+
+
+package org.apache.karaf.features.internal;
+
+import java.util.ArrayList;
+import java.util.List;
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlSchemaType;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ *
+ * Root element of Feature definition. It contains optional attribute which allow
+ * name of repository. This name will be used in shell to display source repository
+ * of given feature.
+ *
+ *
+ * <p>Java class for featuresRoot complex type.
+ *
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ *
+ * <pre>
+ * <complexType name="featuresRoot">
+ * <complexContent>
+ * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * <sequence>
+ * <element name="repository" type="{http://www.w3.org/2001/XMLSchema}anyURI" maxOccurs="unbounded" minOccurs="0"/>
+ * <element name="feature" type="{http://karaf.apache.org/xmlns/features/v1.0.0}feature" maxOccurs="unbounded" minOccurs="0"/>
+ * </sequence>
+ * <attribute name="name" type="{http://www.w3.org/2001/XMLSchema}string" />
+ * </restriction>
+ * </complexContent>
+ * </complexType>
+ * </pre>
+ *
+ *
+ */
+@XmlRootElement
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "featuresRoot", propOrder = {
+ "repository",
+ "feature"
+})
+public class FeaturesRoot {
+
+ @XmlSchemaType(name = "anyURI")
+ protected List<String> repository;
+ protected List<Feature> feature;
+ @XmlAttribute
+ protected String name;
+
+ /**
+ * Gets the value of the repository property.
+ *
+ * <p>
+ * This accessor method returns a reference to the live list,
+ * not a snapshot. Therefore any modification you make to the
+ * returned list will be present inside the JAXB object.
+ * This is why there is not a <CODE>set</CODE> method for the repository property.
+ *
+ * <p>
+ * For example, to add a new item, do as follows:
+ * <pre>
+ * getRepository().add(newItem);
+ * </pre>
+ *
+ *
+ * <p>
+ * Objects of the following type(s) are allowed in the list
+ * {@link String }
+ *
+ *
+ */
+ public List<String> getRepository() {
+ if (repository == null) {
+ repository = new ArrayList<String>();
+ }
+ return this.repository;
+ }
+
+ /**
+ * Gets the value of the feature property.
+ *
+ * <p>
+ * This accessor method returns a reference to the live list,
+ * not a snapshot. Therefore any modification you make to the
+ * returned list will be present inside the JAXB object.
+ * This is why there is not a <CODE>set</CODE> method for the feature property.
+ *
+ * <p>
+ * For example, to add a new item, do as follows:
+ * <pre>
+ * getFeature().add(newItem);
+ * </pre>
+ *
+ *
+ * <p>
+ * Objects of the following type(s) are allowed in the list
+ * {@link Feature }
+ *
+ *
+ */
+ public List<Feature> getFeature() {
+ if (feature == null) {
+ feature = new ArrayList<Feature>();
+ }
+ return this.feature;
+ }
+
+ /**
+ * Gets the value of the name property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * Sets the value of the name property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setName(String value) {
+ this.name = value;
+ }
+
+}
Propchange: karaf/trunk/tooling/features-maven-plugin/src/main/java/org/apache/karaf/features/internal/FeaturesRoot.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: karaf/trunk/tooling/features-maven-plugin/src/main/java/org/apache/karaf/features/internal/FeaturesRoot.java
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: karaf/trunk/tooling/features-maven-plugin/src/main/java/org/apache/karaf/features/internal/FeaturesRoot.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: karaf/trunk/tooling/features-maven-plugin/src/main/java/org/apache/karaf/features/internal/ObjectFactory.java
URL: http://svn.apache.org/viewvc/karaf/trunk/tooling/features-maven-plugin/src/main/java/org/apache/karaf/features/internal/ObjectFactory.java?rev=1064825&view=auto
==============================================================================
--- karaf/trunk/tooling/features-maven-plugin/src/main/java/org/apache/karaf/features/internal/ObjectFactory.java (added)
+++ karaf/trunk/tooling/features-maven-plugin/src/main/java/org/apache/karaf/features/internal/ObjectFactory.java Fri Jan 28 19:34:52 2011
@@ -0,0 +1,100 @@
+//
+// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-833
+// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
+// Any modifications to this file will be lost upon recompilation of the source schema.
+// Generated on: 2011.01.19 at 04:45:46 PM PST
+//
+
+
+package org.apache.karaf.features.internal;
+
+import javax.xml.bind.JAXBElement;
+import javax.xml.bind.annotation.XmlElementDecl;
+import javax.xml.bind.annotation.XmlRegistry;
+import javax.xml.namespace.QName;
+
+
+/**
+ * This object contains factory methods for each
+ * Java content interface and Java element interface
+ * generated in the org.apache.karaf.features.internal package.
+ * <p>An ObjectFactory allows you to programatically
+ * construct new instances of the Java representation
+ * for XML content. The Java representation of XML
+ * content can consist of schema derived interfaces
+ * and classes representing the binding of schema
+ * type definitions, element declarations and model
+ * groups. Factory methods for each of these are
+ * provided in this class.
+ *
+ */
+@XmlRegistry
+public class ObjectFactory {
+
+ private final static QName _Features_QNAME = new QName("http://karaf.apache.org/xmlns/features/v1.0.0", "features");
+
+ /**
+ * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: org.apache.karaf.features.internal
+ *
+ */
+ public ObjectFactory() {
+ }
+
+ /**
+ * Create an instance of {@link ConfigFile }
+ *
+ */
+ public ConfigFile createConfigFile() {
+ return new ConfigFile();
+ }
+
+ /**
+ * Create an instance of {@link Dependency }
+ *
+ */
+ public Dependency createDependency() {
+ return new Dependency();
+ }
+
+ /**
+ * Create an instance of {@link Bundle }
+ *
+ */
+ public Bundle createBundle() {
+ return new Bundle();
+ }
+
+ /**
+ * Create an instance of {@link FeaturesRoot }
+ *
+ */
+ public FeaturesRoot createFeaturesRoot() {
+ return new FeaturesRoot();
+ }
+
+ /**
+ * Create an instance of {@link Config }
+ *
+ */
+ public Config createConfig() {
+ return new Config();
+ }
+
+ /**
+ * Create an instance of {@link Feature }
+ *
+ */
+ public Feature createFeature() {
+ return new Feature();
+ }
+
+ /**
+ * Create an instance of {@link JAXBElement }{@code <}{@link FeaturesRoot }{@code >}}
+ *
+ */
+ @XmlElementDecl(namespace = "http://karaf.apache.org/xmlns/features/v1.0.0", name = "features")
+ public JAXBElement<FeaturesRoot> createFeatures(FeaturesRoot value) {
+ return new JAXBElement<FeaturesRoot>(_Features_QNAME, FeaturesRoot.class, null, value);
+ }
+
+}
Propchange: karaf/trunk/tooling/features-maven-plugin/src/main/java/org/apache/karaf/features/internal/ObjectFactory.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: karaf/trunk/tooling/features-maven-plugin/src/main/java/org/apache/karaf/features/internal/ObjectFactory.java
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: karaf/trunk/tooling/features-maven-plugin/src/main/java/org/apache/karaf/features/internal/ObjectFactory.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified: karaf/trunk/tooling/features-maven-plugin/src/main/java/org/apache/karaf/tooling/features/AddFeaturesToRepoMojo.java
URL: http://svn.apache.org/viewvc/karaf/trunk/tooling/features-maven-plugin/src/main/java/org/apache/karaf/tooling/features/AddFeaturesToRepoMojo.java?rev=1064825&r1=1064824&r2=1064825&view=diff
==============================================================================
--- karaf/trunk/tooling/features-maven-plugin/src/main/java/org/apache/karaf/tooling/features/AddFeaturesToRepoMojo.java (original)
+++ karaf/trunk/tooling/features-maven-plugin/src/main/java/org/apache/karaf/tooling/features/AddFeaturesToRepoMojo.java Fri Jan 28 19:34:52 2011
@@ -142,66 +142,24 @@ public class AddFeaturesToRepoMojo exten
}
// bundles with explicitely specified remote repos. key -> bundle, value -> remote repo
- Map<String, ArtifactRepository> explicitRepoBundles = new HashMap<String, ArtifactRepository>();
+ List<Artifact> explicitRepoBundles = new ArrayList<Artifact>();
getLog().info("Base repo: " + localRepo.getUrl());
for (String bundle : bundles) {
- // get rid of of possible line-breaks KARAF-313
- bundle = bundle.replace("\r\n", "").replace("\n", "").replace(" ", "");
- final int index = bundle.indexOf("mvn:");
- if (index < 0) {
- if (skipNonMavenProtocols) {
- continue;
- }
- throw new MojoExecutionException("Bundle url is not a maven url: " + bundle);
- }
- else {
- bundle = bundle.substring(index);
- }
- // Truncate the URL when a '#', a '?' or a '$' is encountered
- final int index1 = bundle.indexOf('?');
- final int index2 = bundle.indexOf('#');
- int endIndex = -1;
- if (index1 > 0) {
- if (index2 > 0) {
- endIndex = Math.min(index1, index2);
- } else {
- endIndex = index1;
- }
- } else if (index2 > 0) {
- endIndex = index2;
- }
- if (endIndex >= 0) {
- bundle = bundle.substring(0, endIndex);
- }
- final int index3 = bundle.indexOf('$');
- if (index3 > 0) {
- bundle = bundle.substring(0, index3);
+ Artifact artifact = bundleToArtifact(bundle, skipNonMavenProtocols);
+ if (artifact == null) {
+ continue;
+ }
+ if (artifact.getRepository() != null) {
+ explicitRepoBundles.add(artifact);
+ } else {
+ //bundle URL without repository information are resolved now
+ resolveBundle(artifact, remoteRepos);
}
- if (index1 > 0 || index2 > 0 || endIndex > 0 || index3 > 0)
- getLog().debug("Bundle URL truncated: "+bundle);
-
- String bundleDescriptor = bundle.substring("mvn:".length());
- //check if the bundle descriptor contains also remote repository information.
- if(bundleDescriptor.startsWith("http://")) {
- final int repoDelimIntex = bundleDescriptor.indexOf('!');
- String repoUrl = bundleDescriptor.substring(0, repoDelimIntex);
-
- ArtifactRepository repo = new DefaultArtifactRepository(
- repoUrl,
- repoUrl,
- new DefaultRepositoryLayout());
- bundleDescriptor = bundleDescriptor.substring(repoDelimIntex + 1);
-
- explicitRepoBundles.put(bundleDescriptor, repo);
- continue;
- }
- //bundle URL without repository information are resolved now
- resolveBundle(bundleDescriptor, remoteRepos);
}
// resolving all bundles with explicitly specified remote repository
- for(Map.Entry<String, ArtifactRepository> explicitBundle : explicitRepoBundles.entrySet()) {
- resolveBundle(explicitBundle.getKey(), Collections.singletonList(explicitBundle.getValue()));
+ for(Artifact explicitBundle : explicitRepoBundles) {
+ resolveBundle(explicitBundle, Collections.singletonList(explicitBundle.getRepository()));
}
if (copyFileBasedDescriptors != null) {
for (CopyFileBasedDescriptor fileBasedDescritpor : copyFileBasedDescriptors) {
@@ -221,31 +179,17 @@ public class AddFeaturesToRepoMojo exten
}
}
- // resolves the bundle in question
- private void resolveBundle(String bundle, List<ArtifactRepository> remoteRepos) throws IOException, MojoFailureException {
- String[] parts = bundle.split("/");
- String groupId = parts[0];
- String artifactId = parts[1];
- String version = null;
- String classifier = null;
- String type = "jar";
- if (parts.length > 2) {
- version = parts[2];
- if (parts.length > 3) {
- type = parts[3];
- if (parts.length > 4) {
- classifier = parts[4];
- }
- }
- }
- String dir = groupId.replace('.', '/') + "/" + artifactId + "/" + version + "/";
- String name = artifactId + "-" + version + (classifier != null ? "-" + classifier : "") + "." + type;
+ // resolves the bundle in question
+ //TODO neither remoteRepos nor bundle's Repository are used, only the local repo?????
+ private void resolveBundle(Artifact bundle, List<ArtifactRepository> remoteRepos) throws IOException, MojoFailureException {
+ //TODO consider DefaultRepositoryLayout
+ String dir = bundle.getGroupId().replace('.', '/') + "/" + bundle.getArtifactId() + "/" + bundle.getBaseVersion() + "/";
+ String name = bundle.getArtifactId() + "-" + bundle.getBaseVersion() + (bundle.getClassifier() != null ? "-" + bundle.getClassifier() : "") + "." + bundle.getType();
- Artifact artifact = factory.createArtifactWithClassifier(groupId, artifactId, version, type, classifier);
try {
getLog().info("Copying bundle: " + bundle);
- resolver.resolve(artifact, remoteRepos, localRepo);
- copy(new FileInputStream(artifact.getFile()),
+ resolver.resolve(bundle, remoteRepos, localRepo);
+ copy(new FileInputStream(bundle.getFile()),
repository,
name,
dir,
Added: karaf/trunk/tooling/features-maven-plugin/src/main/java/org/apache/karaf/tooling/features/ArchiveKarMojo.java
URL: http://svn.apache.org/viewvc/karaf/trunk/tooling/features-maven-plugin/src/main/java/org/apache/karaf/tooling/features/ArchiveKarMojo.java?rev=1064825&view=auto
==============================================================================
--- karaf/trunk/tooling/features-maven-plugin/src/main/java/org/apache/karaf/tooling/features/ArchiveKarMojo.java (added)
+++ karaf/trunk/tooling/features-maven-plugin/src/main/java/org/apache/karaf/tooling/features/ArchiveKarMojo.java Fri Jan 28 19:34:52 2011
@@ -0,0 +1,380 @@
+/*
+ * 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.karaf.tooling.features;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.karaf.features.internal.Bundle;
+import org.apache.karaf.features.internal.Feature;
+import org.apache.karaf.features.internal.FeaturesRoot;
+import org.apache.maven.archiver.MavenArchiveConfiguration;
+import org.apache.maven.archiver.MavenArchiver;
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.MojoFailureException;
+import org.codehaus.plexus.archiver.ArchiverException;
+import org.codehaus.plexus.archiver.UnArchiver;
+import org.codehaus.plexus.archiver.jar.JarArchiver;
+import org.codehaus.plexus.archiver.manager.ArchiverManager;
+import org.codehaus.plexus.archiver.manager.NoSuchArchiverException;
+import org.codehaus.plexus.util.FileUtils;
+
+/**
+ * assembles a kar archive from a features.xml file
+ *
+ * @version $Revision: 1.1 $
+ * @goal archive-kar
+ * @phase compile
+ * @execute phase="package"
+ * @requiresDependencyResolution runtime
+ * @inheritByDefault true
+ * @description Assemble a kar archive from a features.xml file
+ */
+public class ArchiveKarMojo extends MojoSupport {
+
+
+ /**
+ * The maven archive configuration to use.
+ * <p/>
+ * See <a href="http://maven.apache.org/ref/current/maven-archiver/apidocs/org/apache/maven/archiver/MavenArchiveConfiguration.html">the Javadocs for MavenArchiveConfiguration</a>.
+ *
+ * @parameter
+ */
+ private MavenArchiveConfiguration archive = new MavenArchiveConfiguration();
+
+ /**
+ * The Jar archiver.
+ *
+ * @component role="org.codehaus.plexus.archiver.Archiver" roleHint="jar"
+ * @required
+ * @readonly
+ */
+ private JarArchiver jarArchiver = null;
+
+ /**
+ * The Jar archiver.
+ *
+ * @component role="org.codehaus.plexus.archiver.manager.ArchiverManager"
+ * @required
+ * @readonly
+ */
+ private ArchiverManager archiverManager = null;
+
+ /**
+ * The module base directory.
+ *
+ * @parameter expression="${project.basedir}"
+ * @required
+ * @readonly
+ */
+ private File baseDirectory = null;
+
+ /**
+ * Directory containing the generated archive.
+ *
+ * @parameter expression="${project.build.directory}"
+ * @required
+ */
+ private File outputDirectory = null;
+
+ /**
+ * Name of the generated archive.
+ *
+ * @parameter expression="${project.build.finalName}"
+ * @required
+ */
+ private String finalName = null;
+
+ /**
+ * The Geronimo repository where modules will be packaged up from.
+ *
+ * @parameter expression="${project.build.directory}/repository"
+ * @required
+ */
+ private File targetRepository = null;
+
+ /**
+ * Location of resources directory for additional content to include in the car.
+ *
+ * @parameter expression="${project.build.directory}/resources"
+ */
+ private File resourcesDir;
+
+
+ /**
+ * The features file to use as instructions
+ *
+ * @parameter default-value="${project.build.directory}/feature/feature.xml"
+ */
+ private File featuresFile;
+ //
+ // Mojo
+ //
+
+ public void execute() throws MojoExecutionException, MojoFailureException {
+ List<Artifact> bundles = readBundles();
+ // Build the archive
+ File archive = createArchive(bundles);
+
+ // Attach the generated archive for install/deploy
+ project.getArtifact().setFile(archive);
+ }
+
+ private List<Artifact> readBundles() throws MojoExecutionException {
+ List<Artifact> bundles = new ArrayList<Artifact>();
+ try {
+ InputStream in = new FileInputStream(featuresFile);
+ try {
+ FeaturesRoot features = JaxbUtil.unmarshal(FeaturesRoot.class, in, false);
+ for (Feature feature : features.getFeature()) {
+ for (Bundle bundle : feature.getBundle()) {
+ if (bundle.isDependency() == null || !bundle.isDependency()) {
+ bundles.add(bundleToArtifact(bundle.getValue()));
+ }
+ }
+ }
+ return bundles;
+ } finally {
+ in.close();
+ }
+ } catch (MojoExecutionException e) {
+ throw e;
+ } catch (Exception e) {
+ throw new MojoExecutionException("Could not interpret features.xml", e);
+ }
+ }
+
+ private File getArtifactInRepositoryDir() {
+ //
+ // HACK: Generate the filename in the repo... really should delegate this to the repo impl
+ //
+
+ String groupId = project.getGroupId().replace('.', '/');
+ String artifactId = project.getArtifactId();
+ String version = project.getVersion();
+ String type = "car";
+
+
+ File dir = new File(targetRepository, groupId);
+ dir = new File(dir, artifactId);
+ dir = new File(dir, version);
+ dir = new File(dir, artifactId + "-" + version + "." + type);
+
+ return dir;
+ }
+
+
+ /**
+ * Generates the configuration archive.
+ * @param bundles
+ */
+ private File createArchive(List<Artifact> bundles) throws MojoExecutionException {
+ File archiveFile = getArchiveFile(outputDirectory, finalName, null);
+
+ GeronimoArchiver archiver = new GeronimoArchiver(archiverManager);
+ archiver.setArchiver(jarArchiver);
+ archiver.setOutputFile(archiveFile);
+
+ try {
+
+ for (Artifact artifact: bundles) {
+ resolver.resolve(artifact, remoteRepos, localRepo);
+ File localFile = artifact.getFile();
+ //TODO isn't there a maven class that can do this better?
+ String dir = artifact.getGroupId().replace('.', '/') + "/" + artifact.getArtifactId() + "/" + artifact.getVersion() + "/";
+ String name = artifact.getArtifactId() + "-" + artifact.getVersion() + (artifact.getClassifier() != null ? "-" + artifact.getClassifier() : "") + "." + artifact.getType();
+ String targetFileName = dir + name;
+ jarArchiver.addFile(localFile, targetFileName);
+ }
+
+ // Include the generated artifact contents
+ File artifactDirectory = this.getArtifactInRepositoryDir();
+
+ if (artifactDirectory.exists()) {
+ archiver.addArchivedFileSet(artifactDirectory);
+ }
+
+ if (resourcesDir.isDirectory()) {
+ archiver.getArchiver().addDirectory(resourcesDir);
+ }
+
+ //
+ // HACK: Include legal files here for sanity
+ //
+
+ //
+ // NOTE: Would be nice to share this with the copy-legal-files mojo
+ //
+ String[] includes = {
+ "LICENSE.txt",
+ "LICENSE",
+
+ "NOTICE.txt",
+ "NOTICE",
+ "DISCLAIMER.txt",
+ "DISCLAIMER"
+ };
+
+ archiver.getArchiver().addDirectory(baseDirectory, "META-INF/", includes, new String[0]);
+
+ //For no plan car, do nothing
+// if (artifactDirectory.exists()) {
+//
+// JarFile includedJarFile = new JarFile(artifactDirectory) ;
+//
+// if (includedJarFile.getEntry("META-INF/MANIFEST.MF") != null) {
+// JarArchiver.FilesetManifestConfig mergeFilesetManifestConfig = new JarArchiver.FilesetManifestConfig();
+// mergeFilesetManifestConfig.setValue("merge");
+// archiver.getArchiver().setFilesetmanifest(mergeFilesetManifestConfig);
+// } else {
+// //File configFile = new File(new File(getArtifactInRepositoryDir(), "META-INF"), "imports.txt");
+// ZipEntry importTxtEntry = includedJarFile.getEntry("META-INF/imports.txt");
+// if (importTxtEntry != null) {
+// StringBuilder imports = new StringBuilder("org.apache.geronimo.kernel.osgi,");
+// if (boot) {
+// archive.addManifestEntry(Constants.BUNDLE_ACTIVATOR, BootActivator.class.getName());
+// imports.append("org.apache.geronimo.system.osgi,");
+// } else {
+// archive.addManifestEntry(Constants.BUNDLE_ACTIVATOR, ConfigurationActivator.class.getName());
+// }
+// archive.addManifestEntry(Constants.BUNDLE_NAME, project.getName());
+// archive.addManifestEntry(Constants.BUNDLE_VENDOR, project.getOrganization().getName());
+// ArtifactVersion version = project.getArtifact().getSelectedVersion();
+// String versionString = "" + version.getMajorVersion() + "." + version.getMinorVersion() + "." + version.getIncrementalVersion();
+// if (version.getQualifier() != null) {
+// versionString += "." + version.getQualifier();
+// }
+// archive.addManifestEntry(Constants.BUNDLE_VERSION, versionString);
+// archive.addManifestEntry(Constants.BUNDLE_MANIFESTVERSION, "2");
+// archive.addManifestEntry(Constants.BUNDLE_DESCRIPTION, project.getDescription());
+// // NB, no constant for this one
+// archive.addManifestEntry("Bundle-License", ((License) project.getLicenses().get(0)).getUrl());
+// archive.addManifestEntry(Constants.BUNDLE_DOCURL, project.getUrl());
+// archive.addManifestEntry(Constants.BUNDLE_SYMBOLICNAME, project.getGroupId() + "." + project.getArtifactId());
+// Reader in = new InputStreamReader(includedJarFile.getInputStream(importTxtEntry));
+// char[] buf = new char[1024];
+// try {
+// int i;
+// while ((i = in.read(buf)) > 0) {
+// imports.append(buf, 0, i);
+// }
+// } finally {
+// in.close();
+// }
+// // do we have any additional processing directives?
+// if (instructions != null) {
+// String explicitImports = (String) instructions.get(Constants.IMPORT_PACKAGE);
+// // if there is an Import-Package instructions, then add these imports to the
+// // list
+// if (explicitImports != null) {
+// // if specified on multiple lines, remove the line-ends.
+// explicitImports = explicitImports.replaceAll("[\r\n]", "");
+// imports.append(',');
+// imports.append(explicitImports);
+// }
+// String requiredBundles = (String) instructions.get(Constants.REQUIRE_BUNDLE);
+// if (requiredBundles != null) {
+// requiredBundles = requiredBundles.replaceAll("[\r\n]", "");
+// archive.addManifestEntry(Constants.REQUIRE_BUNDLE, requiredBundles);
+// }
+// }
+// archive.addManifestEntry(Constants.IMPORT_PACKAGE, imports.toString());
+// archive.addManifestEntry(Constants.DYNAMICIMPORT_PACKAGE, "*");
+// }
+// }
+// }
+ archiver.createArchive(project, archive);
+
+ return archiveFile;
+ } catch (Exception e) {
+ throw new MojoExecutionException("Failed to create archive", e);
+ } finally {
+ archiver.cleanup();
+ }
+ }
+
+ protected static File getArchiveFile(final File basedir, final String finalName, String classifier) {
+ if (classifier == null) {
+ classifier = "";
+ } else if (classifier.trim().length() > 0 && !classifier.startsWith("-")) {
+ classifier = "-" + classifier;
+ }
+
+ return new File(basedir, finalName + classifier + ".kar");
+ }
+
+ private static class GeronimoArchiver extends MavenArchiver {
+
+ private ArchiverManager archiverManager;
+ private List<File> tmpDirs = new ArrayList<File>();
+
+ public GeronimoArchiver(ArchiverManager archiverManager) {
+ this.archiverManager = archiverManager;
+ }
+
+ public void addArchivedFileSet(File archiveFile) throws ArchiverException {
+ UnArchiver unArchiver;
+ try {
+ unArchiver = archiverManager.getUnArchiver(archiveFile);
+ } catch (NoSuchArchiverException e) {
+ throw new ArchiverException(
+ "Error adding archived file-set. UnArchiver not found for: " + archiveFile,
+ e);
+ }
+
+ File tempDir = FileUtils.createTempFile("archived-file-set.", ".tmp", null);
+
+ tempDir.mkdirs();
+
+ tmpDirs.add(tempDir);
+
+ unArchiver.setSourceFile(archiveFile);
+ unArchiver.setDestDirectory(tempDir);
+
+ try {
+ unArchiver.extract();
+ } catch (IOException e) {
+ throw new ArchiverException("Error adding archived file-set. Failed to extract: "
+ + archiveFile, e);
+ }
+
+ getArchiver().addDirectory(tempDir, null, null, null);
+ }
+
+ public void cleanup() {
+ for (File dir : tmpDirs) {
+ try {
+ FileUtils.deleteDirectory(dir);
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+ tmpDirs.clear();
+ }
+
+ }
+
+}
Propchange: karaf/trunk/tooling/features-maven-plugin/src/main/java/org/apache/karaf/tooling/features/ArchiveKarMojo.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: karaf/trunk/tooling/features-maven-plugin/src/main/java/org/apache/karaf/tooling/features/ArchiveKarMojo.java
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: karaf/trunk/tooling/features-maven-plugin/src/main/java/org/apache/karaf/tooling/features/ArchiveKarMojo.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified: karaf/trunk/tooling/features-maven-plugin/src/main/java/org/apache/karaf/tooling/features/GenerateFeaturesXmlMojo2.java
URL: http://svn.apache.org/viewvc/karaf/trunk/tooling/features-maven-plugin/src/main/java/org/apache/karaf/tooling/features/GenerateFeaturesXmlMojo2.java?rev=1064825&r1=1064824&r2=1064825&view=diff
==============================================================================
--- karaf/trunk/tooling/features-maven-plugin/src/main/java/org/apache/karaf/tooling/features/GenerateFeaturesXmlMojo2.java (original)
+++ karaf/trunk/tooling/features-maven-plugin/src/main/java/org/apache/karaf/tooling/features/GenerateFeaturesXmlMojo2.java Fri Jan 28 19:34:52 2011
@@ -31,9 +31,13 @@ import java.util.List;
import java.util.Map;
import java.util.Properties;
import java.util.Set;
-import java.util.zip.ZipException;
+import javax.xml.bind.JAXBException;
import org.apache.felix.utils.version.VersionRange;
+import org.apache.karaf.features.internal.Bundle;
+import org.apache.karaf.features.internal.Feature;
+import org.apache.karaf.features.internal.FeaturesRoot;
+import org.apache.karaf.features.internal.ObjectFactory;
import org.apache.maven.artifact.Artifact;
import org.apache.maven.artifact.factory.ArtifactFactory;
import org.apache.maven.artifact.metadata.ArtifactMetadataSource;
@@ -83,7 +87,7 @@ public class GenerateFeaturesXmlMojo2 ex
/**
* The file to generate
*
- * @parameter default-value="${project.build.directory}/classes/feature.xml"
+ * @parameter default-value="${project.build.directory}/feature/feature.xml"
*/
private File outputFile;
@@ -168,6 +172,8 @@ public class GenerateFeaturesXmlMojo2 ex
public void execute() throws MojoExecutionException, MojoFailureException {
PrintStream out = null;
try {
+ File dir = outputFile.getParentFile();
+ dir.mkdirs();
out = new PrintStream(new FileOutputStream(outputFile));
readSystemPackages();
// readKernelBundles();
@@ -306,28 +312,46 @@ public class GenerateFeaturesXmlMojo2 ex
* Write all project dependencies as feature
*/
private void writeFeatures(PrintStream out) throws ArtifactResolutionException, ArtifactNotFoundException,
- ZipException, IOException {
+ IOException, JAXBException {
getLogger().info("Step 4 : Generating " + outputFile.getAbsolutePath());
- out.println("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
- out.println("<features>");
- out.println(" <feature name='" + project.getArtifactId() + "' version='"
- + project.getArtifact().getBaseVersion() + "'>");
-
- for (Artifact artifact : localDependencies) {
+ ObjectFactory objectFactory = new ObjectFactory();
+ FeaturesRoot featuresRoot = objectFactory.createFeaturesRoot();
+ Feature feature = objectFactory.createFeature();
+ featuresRoot.getFeature().add(feature);
+ feature.setName(project.getArtifactId());
+ feature.setVersion(project.getArtifact().getBaseVersion());
+ for (Artifact artifact: localDependencies) {
+ String bundleName;
if (artifact.getType().equals("jar")) {
- out.println(String.format(" <bundle>mvn:%s/%s/%s</bundle>", artifact.getGroupId(), artifact.getArtifactId(), artifact.getBaseVersion()));
+ bundleName = String.format("mvn:%s/%s/%s", artifact.getGroupId(), artifact.getArtifactId(), artifact.getBaseVersion());
} else {
- out.println(String.format(" <bundle>mvn:%s/%s/%s/%s</bundle>", artifact.getGroupId(), artifact.getArtifactId(), artifact.getBaseVersion(), artifact.getType()));
+ bundleName = String.format("mvn:%s/%s/%s/%s", artifact.getGroupId(), artifact.getArtifactId(), artifact.getBaseVersion(), artifact.getType());
}
-// if (!artifact.getScope().equals(Artifact.SCOPE_PROVIDED) && !artifact.getType().equals("pom")) {
-// getLogger().info(" Generating feature " + artifact.getArtifactId() + " from " + artifact);
-// Feature feature = getFeature(artifact);
-// feature.write(out);
-//// registerFeature(artifact, feature);
+ Bundle bundle = objectFactory.createBundle();
+ bundle.setValue(bundleName);
+ feature.getBundle().add(bundle);
+ }
+ JaxbUtil.marshal(FeaturesRoot.class, featuresRoot, out);
+// out.println("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
+// out.println("<features>");
+// out.println(" <feature name='" + project.getArtifactId() + "' version='"
+// + project.getArtifact().getBaseVersion() + "'>");
+//
+// for (Artifact artifact : localDependencies) {
+// if (artifact.getType().equals("jar")) {
+// out.println(String.format(" <bundle>mvn:%s/%s/%s</bundle>", artifact.getGroupId(), artifact.getArtifactId(), artifact.getBaseVersion()));
+// } else {
+// out.println(String.format(" <bundle>mvn:%s/%s/%s/%s</bundle>", artifact.getGroupId(), artifact.getArtifactId(), artifact.getBaseVersion(), artifact.getType()));
// }
- }
- out.println(" </feature>");
- out.println("</features>");
+//// if (!artifact.getScope().equals(Artifact.SCOPE_PROVIDED) && !artifact.getType().equals("pom")) {
+//// getLogger().info(" Generating feature " + artifact.getArtifactId() + " from " + artifact);
+//// Feature feature = getFeature(artifact);
+//// feature.write(out);
+////// registerFeature(artifact, feature);
+//// }
+// }
+// out.println(" </feature>");
+// out.println("</features>");
getLogger().info("...done!");
}
Added: karaf/trunk/tooling/features-maven-plugin/src/main/java/org/apache/karaf/tooling/features/JaxbUtil.java
URL: http://svn.apache.org/viewvc/karaf/trunk/tooling/features-maven-plugin/src/main/java/org/apache/karaf/tooling/features/JaxbUtil.java?rev=1064825&view=auto
==============================================================================
--- karaf/trunk/tooling/features-maven-plugin/src/main/java/org/apache/karaf/tooling/features/JaxbUtil.java (added)
+++ karaf/trunk/tooling/features-maven-plugin/src/main/java/org/apache/karaf/tooling/features/JaxbUtil.java Fri Jan 28 19:34:52 2011
@@ -0,0 +1,110 @@
+/*
+ * 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.karaf.tooling.features;
+
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.JAXBException;
+import javax.xml.bind.Marshaller;
+import javax.xml.bind.Unmarshaller;
+import javax.xml.bind.ValidationEvent;
+import javax.xml.bind.ValidationEventHandler;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.parsers.SAXParser;
+import javax.xml.parsers.SAXParserFactory;
+import javax.xml.transform.sax.SAXSource;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+import org.xml.sax.XMLFilter;
+import org.xml.sax.XMLReader;
+import org.xml.sax.helpers.XMLFilterImpl;
+
+/**
+ * @version $Rev:$ $Date:$
+ */
+public class JaxbUtil {
+
+ public static <T> void marshal(Class<T> type, Object object, OutputStream out) throws JAXBException {
+ JAXBContext ctx2 = JAXBContext.newInstance(type);
+ Marshaller marshaller = ctx2.createMarshaller();
+
+ marshaller.setProperty("jaxb.formatted.output", true);
+
+ marshaller.marshal(object, out);
+ }
+
+
+ /**
+ * Read in a T from the input stream.
+ *
+ * @param type Class of object to be read in
+ * @param in input stream to read
+ * @param validate whether to validate the input.
+ * @param <T> class of object to be returned
+ * @return a T read from the input stream
+ * @throws ParserConfigurationException is the SAX parser can not be configured
+ * @throws SAXException if there is an xml problem
+ * @throws JAXBException if the xml cannot be marshalled into a T.
+ */
+ public static <T> T unmarshal(Class<T> type, InputStream in, boolean validate) throws ParserConfigurationException, SAXException, JAXBException {
+ InputSource inputSource = new InputSource(in);
+
+ SAXParserFactory factory = SAXParserFactory.newInstance();
+ factory.setNamespaceAware(true);
+ factory.setValidating(validate);
+ SAXParser parser = factory.newSAXParser();
+
+ JAXBContext ctx = JAXBContext.newInstance(type);
+ Unmarshaller unmarshaller = ctx.createUnmarshaller();
+ unmarshaller.setEventHandler(new ValidationEventHandler() {
+ public boolean handleEvent(ValidationEvent validationEvent) {
+ System.out.println(validationEvent);
+ return false;
+ }
+ });
+
+ XMLFilter xmlFilter = new NoSourceFilter(parser.getXMLReader());
+ xmlFilter.setContentHandler(unmarshaller.getUnmarshallerHandler());
+
+ SAXSource source = new SAXSource(xmlFilter, inputSource);
+
+ return type.cast(unmarshaller.unmarshal(source));
+ }
+
+ public static class NoSourceFilter extends XMLFilterImpl {
+ private static final InputSource EMPTY_INPUT_SOURCE = new InputSource(new ByteArrayInputStream(new byte[0]));
+
+ public NoSourceFilter(XMLReader xmlReader) {
+ super(xmlReader);
+ }
+
+ @Override
+ public InputSource resolveEntity(String publicId, String systemId) throws SAXException, IOException {
+ return EMPTY_INPUT_SOURCE;
+ }
+ }
+
+
+}
Propchange: karaf/trunk/tooling/features-maven-plugin/src/main/java/org/apache/karaf/tooling/features/JaxbUtil.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: karaf/trunk/tooling/features-maven-plugin/src/main/java/org/apache/karaf/tooling/features/JaxbUtil.java
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: karaf/trunk/tooling/features-maven-plugin/src/main/java/org/apache/karaf/tooling/features/JaxbUtil.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified: karaf/trunk/tooling/features-maven-plugin/src/main/java/org/apache/karaf/tooling/features/MojoSupport.java
URL: http://svn.apache.org/viewvc/karaf/trunk/tooling/features-maven-plugin/src/main/java/org/apache/karaf/tooling/features/MojoSupport.java?rev=1064825&r1=1064824&r2=1064825&view=diff
==============================================================================
--- karaf/trunk/tooling/features-maven-plugin/src/main/java/org/apache/karaf/tooling/features/MojoSupport.java (original)
+++ karaf/trunk/tooling/features-maven-plugin/src/main/java/org/apache/karaf/tooling/features/MojoSupport.java Fri Jan 28 19:34:52 2011
@@ -350,4 +350,56 @@ public abstract class MojoSupport extend
throw new RuntimeException("Repository URL is not valid", e);
}
}
+
+ protected Artifact bundleToArtifact(String bundle) throws MojoExecutionException {
+ bundle = bundle.replace("\r\n", "").replace("\n", "").replace(" ", "");
+ final int index = bundle.indexOf("mvn:");
+ if (index < 0) {
+// if (skipNonMavenProtocols) {
+// continue;
+// }
+ throw new MojoExecutionException("Bundle url is not a maven url: " + bundle);
+ }
+ else {
+ bundle = bundle.substring(index);
+ }
+ // Truncate the URL when a '#', a '?' or a '$' is encountered
+ final int index1 = bundle.indexOf('?');
+ final int index2 = bundle.indexOf('#');
+ int endIndex = -1;
+ if (index1 > 0) {
+ if (index2 > 0) {
+ endIndex = Math.min(index1, index2);
+ } else {
+ endIndex = index1;
+ }
+ } else if (index2 > 0) {
+ endIndex = index2;
+ }
+ if (endIndex >= 0) {
+ bundle = bundle.substring(0, endIndex);
+ }
+ final int index3 = bundle.indexOf('$');
+ if (index3 > 0) {
+ bundle = bundle.substring(0, index3);
+ }
+
+ String[] parts = bundle.substring("mvn:".length()).split("/");
+ String groupId = parts[0];
+ String artifactId = parts[1];
+ String version = null;
+ String classifier = null;
+ String type = "jar";
+ if (parts.length > 2) {
+ version = parts[2];
+ if (parts.length > 3) {
+ type = parts[3];
+ if (parts.length > 4) {
+ classifier = parts[4];
+ }
+ }
+ }
+ Artifact artifact = factory.createArtifactWithClassifier(groupId, artifactId, version, type, classifier);
+ return artifact;
+ }
}
Modified: karaf/trunk/tooling/features-maven-plugin/src/main/resources/META-INF/plexus/components.xml
URL: http://svn.apache.org/viewvc/karaf/trunk/tooling/features-maven-plugin/src/main/resources/META-INF/plexus/components.xml?rev=1064825&r1=1064824&r2=1064825&view=diff
==============================================================================
--- karaf/trunk/tooling/features-maven-plugin/src/main/resources/META-INF/plexus/components.xml (original)
+++ karaf/trunk/tooling/features-maven-plugin/src/main/resources/META-INF/plexus/components.xml Fri Jan 28 19:34:52 2011
@@ -51,7 +51,36 @@
<!--org.apache.geronimo.buildsupport:car-maven-plugin:archive-car-->
<!--</package>-->
<install>
- org.apache.maven.plugins:maven-install-plugin:install,
+ org.apache.maven.plugins:maven-install-plugin:install
+ </install>
+ <deploy>
+ org.apache.maven.plugins:maven-deploy-plugin:deploy
+ </deploy>
+ </phases>
+ </lifecycle>
+ </lifecycles>
+ </configuration>
+ </component>
+ <component>
+ <role>org.apache.maven.lifecycle.mapping.LifecycleMapping</role>
+ <role-hint>kar</role-hint>
+ <implementation>org.apache.maven.lifecycle.mapping.DefaultLifecycleMapping</implementation>
+ <configuration>
+ <lifecycles>
+ <lifecycle>
+ <id>default</id>
+ <phases>
+ <process-resources>
+ org.apache.maven.plugins:maven-resources-plugin:resources
+ </process-resources>
+ <compile>
+ org.apache.karaf.tooling:features-maven-plugin:generate-features-xml2
+ </compile>
+ <package>
+ org.apache.karaf.tooling:features-maven-plugin:archive-kar
+ </package>
+ <install>
+ org.apache.maven.plugins:maven-install-plugin:install
</install>
<deploy>
org.apache.maven.plugins:maven-deploy-plugin:deploy