You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@karaf.apache.org by jb...@apache.org on 2015/11/24 20:50:44 UTC

[01/10] karaf git commit: KARAF-3982: a bit of doc.

Repository: karaf
Updated Branches:
  refs/heads/master 9ebb25a9d -> fce8292d5


KARAF-3982: a bit of doc.


Project: http://git-wip-us.apache.org/repos/asf/karaf/repo
Commit: http://git-wip-us.apache.org/repos/asf/karaf/commit/0077f181
Tree: http://git-wip-us.apache.org/repos/asf/karaf/tree/0077f181
Diff: http://git-wip-us.apache.org/repos/asf/karaf/diff/0077f181

Branch: refs/heads/master
Commit: 0077f1813758c1ed5a3ba871d713b3c5322d4950
Parents: 42c424f
Author: Benson Margulies <be...@basistech.com>
Authored: Wed Sep 9 07:24:32 2015 -0400
Committer: Benson Margulies <be...@basistech.com>
Committed: Wed Sep 9 07:24:32 2015 -0400

----------------------------------------------------------------------
 .../main/java/org/apache/karaf/tooling/AssemblyMojo.java    | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/karaf/blob/0077f181/tooling/karaf-maven-plugin/src/main/java/org/apache/karaf/tooling/AssemblyMojo.java
----------------------------------------------------------------------
diff --git a/tooling/karaf-maven-plugin/src/main/java/org/apache/karaf/tooling/AssemblyMojo.java b/tooling/karaf-maven-plugin/src/main/java/org/apache/karaf/tooling/AssemblyMojo.java
index eb3381d..44ebcbe 100644
--- a/tooling/karaf-maven-plugin/src/main/java/org/apache/karaf/tooling/AssemblyMojo.java
+++ b/tooling/karaf-maven-plugin/src/main/java/org/apache/karaf/tooling/AssemblyMojo.java
@@ -37,7 +37,14 @@ import java.util.ArrayList;
 import java.util.List;
 
 /**
- * Installs kar dependencies into a server-under-construction in target/assembly
+ * Creates a customized Karaf distribution by installing features and setting up
+ * configuration files. The plugin gets features from feature.xml files and KAR
+ * archives declared as dependencies or as files configured with the
+ * featureRespositories parameter. It picks up other files, such as config files,
+ * from ${project.build.directory}/classes. Thus, a file in src/main/resources/etc
+ * will be copied by the resource plugin to ${project.build.directory}/classes/etc,
+ * and then added to the assembly by this goal.
+ * <br>
  */
 @Mojo(name = "assembly", defaultPhase = LifecyclePhase.PROCESS_RESOURCES, requiresDependencyResolution = ResolutionScope.RUNTIME)
 public class AssemblyMojo extends MojoSupport {


[08/10] karaf git commit: KARAF-3928: connect up generated doc from Modello.

Posted by jb...@apache.org.
KARAF-3928: connect up generated doc from Modello.


Project: http://git-wip-us.apache.org/repos/asf/karaf/repo
Commit: http://git-wip-us.apache.org/repos/asf/karaf/commit/6bc4817a
Tree: http://git-wip-us.apache.org/repos/asf/karaf/tree/6bc4817a
Diff: http://git-wip-us.apache.org/repos/asf/karaf/diff/6bc4817a

Branch: refs/heads/master
Commit: 6bc4817ae587562042f09144f6e0ca7f2a9a4919
Parents: 3c2afb2
Author: Benson Margulies <be...@basistech.com>
Authored: Sun Sep 13 11:57:39 2015 -0400
Committer: Benson Margulies <be...@basistech.com>
Committed: Sun Sep 13 11:59:14 2015 -0400

----------------------------------------------------------------------
 tooling/karaf-maven-plugin/pom.xml              |   4 +-
 .../org/apache/karaf/tooling/AssemblyMojo.java  |   5 +-
 .../xdoc/karaf-property-instructions-model.xml  | 156 +++++++++++++++++++
 tooling/utils/src/main/mdo/edits.mdo            |   2 +-
 4 files changed, 163 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/karaf/blob/6bc4817a/tooling/karaf-maven-plugin/pom.xml
----------------------------------------------------------------------
diff --git a/tooling/karaf-maven-plugin/pom.xml b/tooling/karaf-maven-plugin/pom.xml
index 67998e4..d5bfcce 100644
--- a/tooling/karaf-maven-plugin/pom.xml
+++ b/tooling/karaf-maven-plugin/pom.xml
@@ -218,8 +218,8 @@
                     <!--<localRepositoryPath>${project.build.directory}/system</localRepositoryPath>-->
                     <!--<settingsFile>src/it/settings.xml</settingsFile>-->
                     <mavenOpts>-Djava.io.tmpdir=${project.build.directory}</mavenOpts>
-                    <skipInstallation>${skipTests}</skipInstallation>
-                    <skipInvocation>${skipTests}</skipInvocation>
+                    <skipInstallation>${invoker.skip}</skipInstallation>
+                    <skipInvocation>${invoker.skip}</skipInvocation>
                     <goals>
                         <goal>package</goal>
                     </goals>

http://git-wip-us.apache.org/repos/asf/karaf/blob/6bc4817a/tooling/karaf-maven-plugin/src/main/java/org/apache/karaf/tooling/AssemblyMojo.java
----------------------------------------------------------------------
diff --git a/tooling/karaf-maven-plugin/src/main/java/org/apache/karaf/tooling/AssemblyMojo.java b/tooling/karaf-maven-plugin/src/main/java/org/apache/karaf/tooling/AssemblyMojo.java
index ff634ee..2f2f5c1 100644
--- a/tooling/karaf-maven-plugin/src/main/java/org/apache/karaf/tooling/AssemblyMojo.java
+++ b/tooling/karaf-maven-plugin/src/main/java/org/apache/karaf/tooling/AssemblyMojo.java
@@ -180,7 +180,10 @@ public class AssemblyMojo extends MojoSupport {
 
     /**
      * Specify an XML file that instructs this goal to apply edits to
-     * one or more standard Karaf property files. This allows you to
+     * one or more standard Karaf property files.
+     * The contents of this file are documented in detail on
+     * <a href="karaf-property-instructions-model.html">this page</a>.
+     * This allows you to
      * customize these files without making copies in your resources
      * directories. Here's a simple example:
      * <pre>

http://git-wip-us.apache.org/repos/asf/karaf/blob/6bc4817a/tooling/karaf-maven-plugin/src/site/xdoc/karaf-property-instructions-model.xml
----------------------------------------------------------------------
diff --git a/tooling/karaf-maven-plugin/src/site/xdoc/karaf-property-instructions-model.xml b/tooling/karaf-maven-plugin/src/site/xdoc/karaf-property-instructions-model.xml
new file mode 100644
index 0000000..1b8a5a4
--- /dev/null
+++ b/tooling/karaf-maven-plugin/src/site/xdoc/karaf-property-instructions-model.xml
@@ -0,0 +1,156 @@
+<?xml version="1.0"?>
+    <!--
+
+        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.
+    -->
+
+
+
+<!-- =================== DO NOT EDIT THIS FILE ====================         -->
+<!-- Generated by Modello 1.8.3,                                            -->
+<!-- any modifications will be overwritten.                                 -->
+<!-- ==============================================================         -->
+<document>
+  <properties>
+    <title>KarafPropertyInstructionsModel</title>
+  </properties>
+  <body>
+    <section name="KarafPropertyInstructionsModel">
+      <p>
+        Specifications for how to modify Karaf property files to customize an installation.
+    </p>
+      <source>
+&lt;<a href="#class_property-edits">property-edits</a> xmlns="http://karaf.apache.org/tools/property-edits/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://karaf.apache.org/tools/property-edits/1.0.0 <a href="http://karaf.apache.org/xsd/property-edits-1.0.0.xsd">http://karaf.apache.org/xsd/property-edits-1.0.0.xsd</a>"&gt;
+  &lt;edits&gt;
+    &lt;<a href="#class_edit">edit</a>&gt;
+      &lt;<a href="#class_operation">operation</a> prepend=.. /&gt;
+      &lt;file/&gt;
+      &lt;key/&gt;
+      &lt;value/&gt;
+    &lt;/edit&gt;
+  &lt;/edits&gt;
+&lt;/property-edits&gt;
+</source>
+      <a name="class_property-edits"/>
+      <subsection name="property-edits">
+        <p>
+                A collection instructions. Each instruction is either a 'put' or an 'edit',
+                and calls out a file, a property name, and a property value.
+            </p>
+        <table>
+          <tr>
+            <th>Element</th>
+            <th>Type</th>
+            <th>Description</th>
+          </tr>
+          <tr>
+            <td>
+              <code>edits/<a href="#class_edit">edit</a>*</code>
+            </td>
+            <td>
+              <code>List&lt;KarafPropertyEdit&gt;</code>
+            </td>
+            <td><b>(Many)</b> The list of edits to perform.</td>
+          </tr>
+        </table>
+      </subsection>
+      <a name="class_edit"/>
+      <subsection name="edit">
+        <p>
+                A single property edit.
+            </p>
+        <table>
+          <tr>
+            <th>Element</th>
+            <th>Type</th>
+            <th>Description</th>
+          </tr>
+          <tr>
+            <td>
+              <code>
+                <a href="#class_operation">operation</a>
+              </code>
+            </td>
+            <td>
+              <code>Operation</code>
+            </td>
+            <td>
+                        The operation to perform: 'put' or 'extend'.
+                    </td>
+          </tr>
+          <tr>
+            <td>
+              <code>file</code>
+            </td>
+            <td>
+              <code>String</code>
+            </td>
+            <td>
+                        The pathname, relative to the the Karaf etc directory, of the file to manipulate.
+                    </td>
+          </tr>
+          <tr>
+            <td>
+              <code>key</code>
+            </td>
+            <td>
+              <code>String</code>
+            </td>
+            <td>
+                        The property key.
+                    </td>
+          </tr>
+          <tr>
+            <td>
+              <code>value</code>
+            </td>
+            <td>
+              <code>String</code>
+            </td>
+            <td>
+                        The property value.
+                    </td>
+          </tr>
+        </table>
+      </subsection>
+      <a name="class_operation"/>
+      <subsection name="operation">
+        <p>No description.</p>
+        <p>
+          <b>Element Content: </b>
+                        'extend' to extend the existing value, 'put' to replace.
+                    </p>
+        <table>
+          <tr>
+            <th>Attribute</th>
+            <th>Type</th>
+            <th>Description</th>
+          </tr>
+          <tr>
+            <td>
+              <code>prepend</code>
+            </td>
+            <td>
+              <code>boolean</code>
+            </td>
+            <td>for the 'extend' operation, indicates that the value should be placed at the head of the list.<br/><strong>Default value is</strong>: <code>false</code>.</td>
+          </tr>
+        </table>
+      </subsection>
+    </section>
+  </body>
+</document>

http://git-wip-us.apache.org/repos/asf/karaf/blob/6bc4817a/tooling/utils/src/main/mdo/edits.mdo
----------------------------------------------------------------------
diff --git a/tooling/utils/src/main/mdo/edits.mdo b/tooling/utils/src/main/mdo/edits.mdo
index b0d3f86..c8072ae 100644
--- a/tooling/utils/src/main/mdo/edits.mdo
+++ b/tooling/utils/src/main/mdo/edits.mdo
@@ -35,7 +35,7 @@
         <class rootElement="true" xml.tagName="property-edits">
             <description>
                 A collection instructions. Each instruction is either a 'put' or an 'edit',
-                and calls out a file and a series of name/value pairs.
+                and calls out a file, a property name, and a property value.
             </description>
             <name>KarafPropertyEdits</name>
             <version>1.0.0+</version>


[05/10] karaf git commit: KARAF-3982: finish up IT.

Posted by jb...@apache.org.
KARAF-3982: finish up IT.


Project: http://git-wip-us.apache.org/repos/asf/karaf/repo
Commit: http://git-wip-us.apache.org/repos/asf/karaf/commit/42ea0049
Tree: http://git-wip-us.apache.org/repos/asf/karaf/tree/42ea0049
Diff: http://git-wip-us.apache.org/repos/asf/karaf/diff/42ea0049

Branch: refs/heads/master
Commit: 42ea00495f695660380670277beeb5f7581f3225
Parents: d1f00dc
Author: Benson Margulies <be...@basistech.com>
Authored: Wed Sep 9 11:06:54 2015 -0400
Committer: Benson Margulies <be...@basistech.com>
Committed: Wed Sep 9 11:06:54 2015 -0400

----------------------------------------------------------------------
 .../src/it/test-assembly-prop-edits/verify.bsh  | 29 ++++++++++++++++++++
 1 file changed, 29 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/karaf/blob/42ea0049/tooling/karaf-maven-plugin/src/it/test-assembly-prop-edits/verify.bsh
----------------------------------------------------------------------
diff --git a/tooling/karaf-maven-plugin/src/it/test-assembly-prop-edits/verify.bsh b/tooling/karaf-maven-plugin/src/it/test-assembly-prop-edits/verify.bsh
new file mode 100644
index 0000000..e256f34
--- /dev/null
+++ b/tooling/karaf-maven-plugin/src/it/test-assembly-prop-edits/verify.bsh
@@ -0,0 +1,29 @@
+/*
+ * 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.
+ */
+
+import java.io.*;
+import java.lang.*;
+import java.util.*;
+
+Properties props = new Properties();
+InputStream propStream = new FileInputStream(new File(basedir, "target/assembly/etc/config.properties"));
+props.load(propStream);
+return "equinox".equals(props.getProperty("karaf.framework"));
+
+


[04/10] karaf git commit: KARAF-3982: a test.

Posted by jb...@apache.org.
KARAF-3982: a test.


Project: http://git-wip-us.apache.org/repos/asf/karaf/repo
Commit: http://git-wip-us.apache.org/repos/asf/karaf/commit/d1f00dcb
Tree: http://git-wip-us.apache.org/repos/asf/karaf/tree/d1f00dcb
Diff: http://git-wip-us.apache.org/repos/asf/karaf/diff/d1f00dcb

Branch: refs/heads/master
Commit: d1f00dcb52eecc168da77e3bb4419571dc03bc11
Parents: 2b17090
Author: Benson Margulies <be...@basistech.com>
Authored: Wed Sep 9 10:58:35 2015 -0400
Committer: Benson Margulies <be...@basistech.com>
Committed: Wed Sep 9 10:58:35 2015 -0400

----------------------------------------------------------------------
 .../src/main/karaf/assembly-property-edits.xml  | 35 ++++++++++++++++++++
 .../org/apache/karaf/tools/utils/test-edits.xml | 17 ++++++++++
 2 files changed, 52 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/karaf/blob/d1f00dcb/tooling/karaf-maven-plugin/src/it/test-assembly-prop-edits/src/main/karaf/assembly-property-edits.xml
----------------------------------------------------------------------
diff --git a/tooling/karaf-maven-plugin/src/it/test-assembly-prop-edits/src/main/karaf/assembly-property-edits.xml b/tooling/karaf-maven-plugin/src/it/test-assembly-prop-edits/src/main/karaf/assembly-property-edits.xml
new file mode 100644
index 0000000..eb3cd27
--- /dev/null
+++ b/tooling/karaf-maven-plugin/src/it/test-assembly-prop-edits/src/main/karaf/assembly-property-edits.xml
@@ -0,0 +1,35 @@
+<?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.
+  -->
+<property-edits xmlns="http://karaf.apache.org/tools/property-edits/1.0.0">
+    <edits>
+        <edit>
+            <file>config.properties</file>
+            <operation>put</operation>
+            <key>karaf.framework</key>
+            <value>equinox</value>
+        </edit>
+        <edit>
+            <file>config.properties</file>
+            <operation>extend</operation>
+            <key>org.osgi.framework.system.capabilities</key>
+            <value>my-magic-capability</value>
+        </edit>
+    </edits>
+</property-edits>

http://git-wip-us.apache.org/repos/asf/karaf/blob/d1f00dcb/tooling/utils/src/test/resources/org/apache/karaf/tools/utils/test-edits.xml
----------------------------------------------------------------------
diff --git a/tooling/utils/src/test/resources/org/apache/karaf/tools/utils/test-edits.xml b/tooling/utils/src/test/resources/org/apache/karaf/tools/utils/test-edits.xml
index 2aa8fca..59b792b 100644
--- a/tooling/utils/src/test/resources/org/apache/karaf/tools/utils/test-edits.xml
+++ b/tooling/utils/src/test/resources/org/apache/karaf/tools/utils/test-edits.xml
@@ -1,4 +1,21 @@
 <?xml version="1.0"?>
+<!--
+
+    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.
+-->
 <property-edits xmlns="http://karaf.apache.org/tools/property-edits/1.0.0">
     <edits>
         <edit>


[10/10] karaf git commit: [KARAF-3932] Fix utils version

Posted by jb...@apache.org.
[KARAF-3932] Fix utils version


Project: http://git-wip-us.apache.org/repos/asf/karaf/repo
Commit: http://git-wip-us.apache.org/repos/asf/karaf/commit/fce8292d
Tree: http://git-wip-us.apache.org/repos/asf/karaf/tree/fce8292d
Diff: http://git-wip-us.apache.org/repos/asf/karaf/diff/fce8292d

Branch: refs/heads/master
Commit: fce8292d51a796f146ff84d09222a4938fa797be
Parents: a8394fb
Author: Jean-Baptiste Onofré <jb...@apache.org>
Authored: Tue Nov 24 20:50:14 2015 +0100
Committer: Jean-Baptiste Onofré <jb...@apache.org>
Committed: Tue Nov 24 20:50:14 2015 +0100

----------------------------------------------------------------------
 tooling/utils/pom.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/karaf/blob/fce8292d/tooling/utils/pom.xml
----------------------------------------------------------------------
diff --git a/tooling/utils/pom.xml b/tooling/utils/pom.xml
index 03ec561..9f48e20 100644
--- a/tooling/utils/pom.xml
+++ b/tooling/utils/pom.xml
@@ -25,7 +25,7 @@
     <parent>
         <groupId>org.apache.karaf.tooling</groupId>
         <artifactId>tooling</artifactId>
-        <version>4.0.2-SNAPSHOT</version>
+        <version>4.0.4-SNAPSHOT</version>
     </parent>
 
     <artifactId>org.apache.karaf.tools.utils</artifactId>


[09/10] karaf git commit: Merge branch 'karaf-3982-propeditors' of https://github.com/bimargulies/karaf

Posted by jb...@apache.org.
Merge branch 'karaf-3982-propeditors' of https://github.com/bimargulies/karaf


Project: http://git-wip-us.apache.org/repos/asf/karaf/repo
Commit: http://git-wip-us.apache.org/repos/asf/karaf/commit/a8394fb6
Tree: http://git-wip-us.apache.org/repos/asf/karaf/tree/a8394fb6
Diff: http://git-wip-us.apache.org/repos/asf/karaf/diff/a8394fb6

Branch: refs/heads/master
Commit: a8394fb6c80e894c77c505d7c1bd61bad3c039f8
Parents: 9ebb25a 6bc4817
Author: Jean-Baptiste Onofré <jb...@apache.org>
Authored: Tue Nov 24 20:32:01 2015 +0100
Committer: Jean-Baptiste Onofré <jb...@apache.org>
Committed: Tue Nov 24 20:32:01 2015 +0100

----------------------------------------------------------------------
 .../standard/src/main/feature/feature.xml       |   2 +
 profile/pom.xml                                 |   6 +
 .../apache/karaf/profile/assembly/Builder.java  |  25 +++
 tooling/karaf-maven-plugin/pom.xml              |  12 +-
 .../src/it/test-assembly-prop-edits/pom.xml     |  78 ++++++++++
 .../src/main/karaf/assembly-property-edits.xml  |  35 +++++
 .../src/it/test-assembly-prop-edits/verify.bsh  |  29 ++++
 .../org/apache/karaf/tooling/AssemblyMojo.java  |  64 +++++++-
 .../karaf-maven-plugin/src/site/apt/usage.apt   |   6 +-
 .../xdoc/karaf-property-instructions-model.xml  | 156 +++++++++++++++++++
 tooling/pom.xml                                 |   1 +
 tooling/utils/pom.xml                           |  89 +++++++++++
 .../org/apache/karaf/tools/utils/JoinUtil.java  |  59 +++++++
 .../apache/karaf/tools/utils/JoinableValue.java |  25 +++
 .../tools/utils/KarafPropertiesEditor.java      |  78 ++++++++++
 .../karaf/tools/utils/KarafPropertiesFile.java  | 107 +++++++++++++
 tooling/utils/src/main/mdo/edits.mdo            | 123 +++++++++++++++
 .../tools/utils/KarafPropertiesEditorTest.java  |  78 ++++++++++
 .../org/apache/karaf/tools/utils/test-edits.xml |  52 +++++++
 19 files changed, 1018 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/karaf/blob/a8394fb6/assemblies/features/standard/src/main/feature/feature.xml
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/karaf/blob/a8394fb6/profile/pom.xml
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/karaf/blob/a8394fb6/profile/src/main/java/org/apache/karaf/profile/assembly/Builder.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/karaf/blob/a8394fb6/tooling/karaf-maven-plugin/pom.xml
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/karaf/blob/a8394fb6/tooling/karaf-maven-plugin/src/main/java/org/apache/karaf/tooling/AssemblyMojo.java
----------------------------------------------------------------------
diff --cc tooling/karaf-maven-plugin/src/main/java/org/apache/karaf/tooling/AssemblyMojo.java
index 166999c,2f2f5c1..c083256
--- a/tooling/karaf-maven-plugin/src/main/java/org/apache/karaf/tooling/AssemblyMojo.java
+++ b/tooling/karaf-maven-plugin/src/main/java/org/apache/karaf/tooling/AssemblyMojo.java
@@@ -37,9 -42,16 +42,16 @@@ import java.util.ArrayList
  import java.util.List;
  
  /**
-  * Installs kar dependencies into a server-under-construction in target/assembly
+  * Creates a customized Karaf distribution by installing features and setting up
+  * configuration files. The plugin gets features from feature.xml files and KAR
+  * archives declared as dependencies or as files configured with the
+  * featureRespositories parameter. It picks up other files, such as config files,
+  * from ${project.build.directory}/classes. Thus, a file in src/main/resources/etc
+  * will be copied by the resource plugin to ${project.build.directory}/classes/etc,
+  * and then added to the assembly by this goal.
+  * <br>
   */
 -@Mojo(name = "assembly", defaultPhase = LifecyclePhase.PROCESS_RESOURCES, requiresDependencyResolution = ResolutionScope.RUNTIME)
 +@Mojo(name = "assembly", defaultPhase = LifecyclePhase.PACKAGE, requiresDependencyResolution = ResolutionScope.RUNTIME)
  public class AssemblyMojo extends MojoSupport {
  
      /**

http://git-wip-us.apache.org/repos/asf/karaf/blob/a8394fb6/tooling/pom.xml
----------------------------------------------------------------------


[07/10] karaf git commit: KARAF-3982: add 'prepend' support.

Posted by jb...@apache.org.
KARAF-3982: add 'prepend' support.


Project: http://git-wip-us.apache.org/repos/asf/karaf/repo
Commit: http://git-wip-us.apache.org/repos/asf/karaf/commit/3c2afb20
Tree: http://git-wip-us.apache.org/repos/asf/karaf/tree/3c2afb20
Diff: http://git-wip-us.apache.org/repos/asf/karaf/diff/3c2afb20

Branch: refs/heads/master
Commit: 3c2afb204d457ea98e0b9130196b329d1eb1c334
Parents: 1ad8aa9
Author: Benson Margulies <be...@basistech.com>
Authored: Sun Sep 13 07:26:08 2015 -0400
Committer: Benson Margulies <be...@basistech.com>
Committed: Sun Sep 13 07:38:11 2015 -0400

----------------------------------------------------------------------
 .../org/apache/karaf/tooling/AssemblyMojo.java  |  6 +++++
 .../karaf-maven-plugin/src/site/apt/usage.apt   |  6 ++++-
 tooling/utils/pom.xml                           |  2 ++
 .../karaf/tools/utils/KarafPropertiesFile.java  | 13 ++++++----
 tooling/utils/src/main/mdo/edits.mdo            | 27 ++++++++++++++++++--
 .../tools/utils/KarafPropertiesEditorTest.java  |  3 ++-
 .../org/apache/karaf/tools/utils/test-edits.xml |  6 +++++
 7 files changed, 54 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/karaf/blob/3c2afb20/tooling/karaf-maven-plugin/src/main/java/org/apache/karaf/tooling/AssemblyMojo.java
----------------------------------------------------------------------
diff --git a/tooling/karaf-maven-plugin/src/main/java/org/apache/karaf/tooling/AssemblyMojo.java b/tooling/karaf-maven-plugin/src/main/java/org/apache/karaf/tooling/AssemblyMojo.java
index c0653c5..ff634ee 100644
--- a/tooling/karaf-maven-plugin/src/main/java/org/apache/karaf/tooling/AssemblyMojo.java
+++ b/tooling/karaf-maven-plugin/src/main/java/org/apache/karaf/tooling/AssemblyMojo.java
@@ -199,6 +199,12 @@ public class AssemblyMojo extends MojoSupport {
             <key>org.osgi.framework.system.capabilities</key>
             <value>my-magic-capability</value>
           </edit>
+          <edit>
+            <file>config.properties</file>
+            <operation prepend='true'>extend</operation>
+            <key>some-other-list</key>
+            <value>my-value-goes-first</value>
+            </edit>
          </edits>
       </property-edits>
      </pre>

http://git-wip-us.apache.org/repos/asf/karaf/blob/3c2afb20/tooling/karaf-maven-plugin/src/site/apt/usage.apt
----------------------------------------------------------------------
diff --git a/tooling/karaf-maven-plugin/src/site/apt/usage.apt b/tooling/karaf-maven-plugin/src/site/apt/usage.apt
index 1194e34..1fbf3e4 100644
--- a/tooling/karaf-maven-plugin/src/site/apt/usage.apt
+++ b/tooling/karaf-maven-plugin/src/site/apt/usage.apt
@@ -186,6 +186,10 @@ Packagings
             </plugin>
 +---+
 
+  property-file-edits specifies the location of an XML file that specifies edits to 'etc' files as they are
+  copied from the reference to the assembly. By default, the value of this parameter is src/main/karaf/assembly-property-edits.xml;
+  if you add a file at that location, the plugin will apply the edits you specify in it.
+
   defaultStartLevel determines the start level of bundles that do not have startLevel set in the feature xml descriptor. If not set, the default is 30.
 
   Project dependencies that are feature or kar packaging are treated differently depending on whether they are scope runtime, or compile/provided.  Runtime scope dependencies are installed
@@ -204,4 +208,4 @@ Packagings
   - adds the feature project dependencies and features in kar dependencies of scope runtime to the features service configuration.
 
   The result is packed up into zip and tar.gz assemblies.  Normally to get a working server you would include at least the karaf-framework kar and most likely the karaf-full kar: these are used
-  to assemble the minimal and full server.
\ No newline at end of file
+  to assemble the minimal and full server.

http://git-wip-us.apache.org/repos/asf/karaf/blob/3c2afb20/tooling/utils/pom.xml
----------------------------------------------------------------------
diff --git a/tooling/utils/pom.xml b/tooling/utils/pom.xml
index 8476f28..03ec561 100644
--- a/tooling/utils/pom.xml
+++ b/tooling/utils/pom.xml
@@ -53,11 +53,13 @@
                 <version>1.8.3</version>
                 <executions>
                     <execution>
+                        <phase>generate-sources</phase>
                         <goals>
                             <goal>java</goal>
                             <goal>stax-reader</goal>
                             <goal>stax-writer</goal>
                             <goal>xsd</goal>
+                            <goal>xdoc</goal>
                         </goals>
                     </execution>
                 </executions>

http://git-wip-us.apache.org/repos/asf/karaf/blob/3c2afb20/tooling/utils/src/main/java/org/apache/karaf/tools/utils/KarafPropertiesFile.java
----------------------------------------------------------------------
diff --git a/tooling/utils/src/main/java/org/apache/karaf/tools/utils/KarafPropertiesFile.java b/tooling/utils/src/main/java/org/apache/karaf/tools/utils/KarafPropertiesFile.java
index ef75d75..43efd73 100644
--- a/tooling/utils/src/main/java/org/apache/karaf/tools/utils/KarafPropertiesFile.java
+++ b/tooling/utils/src/main/java/org/apache/karaf/tools/utils/KarafPropertiesFile.java
@@ -60,18 +60,21 @@ public class KarafPropertiesFile {
         properties.put(key, value);
     }
 
-    public void extend(String key, String value) {
+    public void extend(String key, String value, boolean prepend) {
         if (properties.get(key) == null) {
             properties.put(key, value);
             return;
+        } else if (prepend) {
+            properties.put(key, JoinUtil.join(value, (String) properties.get(key)));
+        } else {
+            properties.put(key, JoinUtil.join((String) properties.get(key), value));
         }
-        properties.put(key, JoinUtil.join((String)properties.get(key), value));
     }
 
     public void apply(KarafPropertyEdit editSpec) {
-        if ("extend".equals(editSpec.getOperation())) {
-            extend(editSpec.getKey(), editSpec.getValue());
-        } else if ("put".equals(editSpec.getOperation())) {
+        if ("extend".equals(editSpec.getOperation().getOperation())) {
+            extend(editSpec.getKey(), editSpec.getValue(), editSpec.getOperation().isPrepend());
+        } else if ("put".equals(editSpec.getOperation().getOperation())) {
             put(editSpec.getKey(), editSpec.getValue());
         } else {
             throw new IllegalArgumentException("Operation must be 'extend' or 'put', not " + editSpec.getOperation());

http://git-wip-us.apache.org/repos/asf/karaf/blob/3c2afb20/tooling/utils/src/main/mdo/edits.mdo
----------------------------------------------------------------------
diff --git a/tooling/utils/src/main/mdo/edits.mdo b/tooling/utils/src/main/mdo/edits.mdo
index 5dfc48e..b0d3f86 100644
--- a/tooling/utils/src/main/mdo/edits.mdo
+++ b/tooling/utils/src/main/mdo/edits.mdo
@@ -51,6 +51,25 @@
                 </field>
             </fields>
         </class>
+        <class>
+            <name>Operation</name>
+            <fields>
+                <field xml.content="true">
+                    <name>operation</name>
+                    <type>String</type>
+                    <description>
+                        'extend' to extend the existing value, 'put' to replace.
+                    </description>
+                    <required>true</required>
+                </field>
+                <field xml.attribute="true">
+                    <name>prepend</name>
+                    <version>1.0.0</version>
+                    <type>boolean</type>
+                    <description><![CDATA[for the 'extend' operation, indicates that the value should be placed at the head of the list.]]></description>
+                </field>
+            </fields>
+        </class>
         <class xml.tagName="edit">
             <name>KarafPropertyEdit</name>
             <version>1.0.0+</version>
@@ -61,12 +80,16 @@
                 <field>
                     <name>operation</name>
                     <version>1.0.0+</version>
-                    <type>String</type>
+                    <association>
+                        <type>Operation</type>
+                        <multiplicity>1</multiplicity>
+                    </association>
                     <description>
-                        'extend' to extend the existing value, 'put' to replace.
+                        The operation to perform: 'put' or 'extend'.
                     </description>
                     <required>true</required>
                 </field>
+
                 <field>
                     <name>file</name>
                     <version>1.0.0+</version>

http://git-wip-us.apache.org/repos/asf/karaf/blob/3c2afb20/tooling/utils/src/test/java/org/apache/karaf/tools/utils/KarafPropertiesEditorTest.java
----------------------------------------------------------------------
diff --git a/tooling/utils/src/test/java/org/apache/karaf/tools/utils/KarafPropertiesEditorTest.java b/tooling/utils/src/test/java/org/apache/karaf/tools/utils/KarafPropertiesEditorTest.java
index e49226e..0705ede 100644
--- a/tooling/utils/src/test/java/org/apache/karaf/tools/utils/KarafPropertiesEditorTest.java
+++ b/tooling/utils/src/test/java/org/apache/karaf/tools/utils/KarafPropertiesEditorTest.java
@@ -51,6 +51,7 @@ public class KarafPropertiesEditorTest {
 
         Path path = FileSystems.getDefault().getPath("target");
         Path outputEtc = Files.createTempDirectory(path, "test-etc");
+        outputEtc.toFile().deleteOnExit();
 
         KarafPropertiesEditor editor = new KarafPropertiesEditor();
         editor.setInputEtc(new File(ETC_TO_START_WITH))
@@ -64,7 +65,7 @@ public class KarafPropertiesEditorTest {
             properties.load(resultInputStream);
         }
         assertEquals("equinox", properties.getProperty("karaf.framework"));
-        assertEquals("root,toor", properties.getProperty("karaf.name"));
+        assertEquals("prepended,root,toor", properties.getProperty("karaf.name"));
 
         resultConfigProps = new File(outputEtc.toFile(), "jre.properties");
         try (InputStream resultInputStream = new FileInputStream(resultConfigProps)) {

http://git-wip-us.apache.org/repos/asf/karaf/blob/3c2afb20/tooling/utils/src/test/resources/org/apache/karaf/tools/utils/test-edits.xml
----------------------------------------------------------------------
diff --git a/tooling/utils/src/test/resources/org/apache/karaf/tools/utils/test-edits.xml b/tooling/utils/src/test/resources/org/apache/karaf/tools/utils/test-edits.xml
index 59b792b..1fba57f 100644
--- a/tooling/utils/src/test/resources/org/apache/karaf/tools/utils/test-edits.xml
+++ b/tooling/utils/src/test/resources/org/apache/karaf/tools/utils/test-edits.xml
@@ -42,5 +42,11 @@
             <key>test-add-two</key>
             <value>This is the gun that shoots cereal</value>
         </edit>
+        <edit>
+            <file>config.properties</file>
+            <operation prepend="true">extend</operation>
+            <key>karaf.name</key>
+            <value>prepended</value>
+        </edit>
     </edits>
 </property-edits>


[02/10] karaf git commit: karaf-3982: reusable bits and pieces that do property editing.

Posted by jb...@apache.org.
karaf-3982: reusable bits and pieces that do property editing.


Project: http://git-wip-us.apache.org/repos/asf/karaf/repo
Commit: http://git-wip-us.apache.org/repos/asf/karaf/commit/04840c83
Tree: http://git-wip-us.apache.org/repos/asf/karaf/tree/04840c83
Diff: http://git-wip-us.apache.org/repos/asf/karaf/diff/04840c83

Branch: refs/heads/master
Commit: 04840c8316ab475f1f5d0fc92421aab28ca1ce7e
Parents: 0077f18
Author: Benson Margulies <be...@basistech.com>
Authored: Wed Sep 9 09:49:32 2015 -0400
Committer: Benson Margulies <be...@basistech.com>
Committed: Wed Sep 9 09:49:32 2015 -0400

----------------------------------------------------------------------
 tooling/pom.xml                                 |   1 +
 tooling/utils/pom.xml                           |  74 +++++++++++++
 .../org/apache/karaf/tools/utils/JoinUtil.java  |  59 +++++++++++
 .../apache/karaf/tools/utils/JoinableValue.java |  25 +++++
 .../tools/utils/KarafPropertiesEditor.java      |  78 ++++++++++++++
 .../karaf/tools/utils/KarafPropertiesFile.java  | 104 +++++++++++++++++++
 tooling/utils/src/main/mdo/edits.mdo            | 100 ++++++++++++++++++
 .../tools/utils/KarafPropertiesEditorTest.java  |  77 ++++++++++++++
 .../org/apache/karaf/tools/utils/test-edits.xml |  29 ++++++
 9 files changed, 547 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/karaf/blob/04840c83/tooling/pom.xml
----------------------------------------------------------------------
diff --git a/tooling/pom.xml b/tooling/pom.xml
index 4ed31a5..1aac831 100644
--- a/tooling/pom.xml
+++ b/tooling/pom.xml
@@ -34,6 +34,7 @@
     <name>Apache Karaf :: Tooling</name>
 
     <modules>
+        <module>utils</module>
         <module>karaf-services-maven-plugin</module>
         <module>karaf-maven-plugin</module>
     </modules>

http://git-wip-us.apache.org/repos/asf/karaf/blob/04840c83/tooling/utils/pom.xml
----------------------------------------------------------------------
diff --git a/tooling/utils/pom.xml b/tooling/utils/pom.xml
new file mode 100644
index 0000000..ece56ce
--- /dev/null
+++ b/tooling/utils/pom.xml
@@ -0,0 +1,74 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<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/xsd/maven-4.0.0.xsd">
+
+    <!--
+
+        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.
+    -->
+
+    <modelVersion>4.0.0</modelVersion>
+
+    <parent>
+        <groupId>org.apache.karaf.tooling</groupId>
+        <artifactId>tooling</artifactId>
+        <version>4.0.2-SNAPSHOT</version>
+    </parent>
+
+    <artifactId>org.apache.karaf.tools.utils</artifactId>
+    <packaging>bundle</packaging>
+    <name>Apache Karaf :: Tooling :: Utils</name>
+    <description>Karaf tooling resuable elsewhere (such as the Karaf pax-exam container).</description>
+    <dependencies>
+        <dependency>
+            <groupId>commons-io</groupId>
+            <artifactId>commons-io</artifactId>
+            <version>2.4</version>
+        </dependency>
+        <dependency>
+            <groupId>com.google.guava</groupId>
+            <artifactId>guava</artifactId>
+            <version>16.0.1</version>
+            <scope>test</scope>
+        </dependency>
+    </dependencies>
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.codehaus.modello</groupId>
+                <artifactId>modello-maven-plugin</artifactId>
+                <version>1.8.3</version>
+                <executions>
+                    <execution>
+                        <goals>
+                            <goal>java</goal>
+                            <goal>stax-reader</goal>
+                            <goal>stax-writer</goal>
+                            <goal>xsd</goal>
+                        </goals>
+                    </execution>
+                </executions>
+                <configuration>
+                    <models>
+                        <model>src/main/mdo/edits.mdo</model>
+                    </models>
+                    <useJava5>true</useJava5>
+                    <version>1.0.0</version>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+</project>

http://git-wip-us.apache.org/repos/asf/karaf/blob/04840c83/tooling/utils/src/main/java/org/apache/karaf/tools/utils/JoinUtil.java
----------------------------------------------------------------------
diff --git a/tooling/utils/src/main/java/org/apache/karaf/tools/utils/JoinUtil.java b/tooling/utils/src/main/java/org/apache/karaf/tools/utils/JoinUtil.java
new file mode 100644
index 0000000..ee18cc9
--- /dev/null
+++ b/tooling/utils/src/main/java/org/apache/karaf/tools/utils/JoinUtil.java
@@ -0,0 +1,59 @@
+/*
+ * 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.tools.utils;
+
+/**
+ * Join strings with commas. This has some reflection to be usable with
+ * the pax-exam
+ */
+public class JoinUtil {
+
+    private JoinUtil() {
+    }
+    
+    public static String join(String... options) {
+        return join((Object[])options);
+    }
+
+    public static String join(Object[] options) {
+        StringBuilder buffer = new StringBuilder();
+        for (Object option : options) {
+            String value = getStringValue(option);
+            if (buffer.length() > 0 && !value.startsWith(",")) {
+                buffer.append(",");
+            }
+            buffer.append(value);
+        }
+        return buffer.toString();
+    }
+
+    @SuppressWarnings("unchecked")
+    private static String getStringValue(Object option) {
+        if (option == null) {
+            return "";
+        }
+        else if (option instanceof String) {
+            return (String)option;
+        }
+        else if (option instanceof JoinableValue) {
+            return ((JoinableValue<String>)option).getValue();
+        }
+        else {
+            return "";
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/karaf/blob/04840c83/tooling/utils/src/main/java/org/apache/karaf/tools/utils/JoinableValue.java
----------------------------------------------------------------------
diff --git a/tooling/utils/src/main/java/org/apache/karaf/tools/utils/JoinableValue.java b/tooling/utils/src/main/java/org/apache/karaf/tools/utils/JoinableValue.java
new file mode 100644
index 0000000..421352b
--- /dev/null
+++ b/tooling/utils/src/main/java/org/apache/karaf/tools/utils/JoinableValue.java
@@ -0,0 +1,25 @@
+/*
+ * 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.tools.utils;
+
+/**
+ * General definition of an object that specifies a value for Join.
+ */
+public interface JoinableValue<T> {
+    T getValue();
+}

http://git-wip-us.apache.org/repos/asf/karaf/blob/04840c83/tooling/utils/src/main/java/org/apache/karaf/tools/utils/KarafPropertiesEditor.java
----------------------------------------------------------------------
diff --git a/tooling/utils/src/main/java/org/apache/karaf/tools/utils/KarafPropertiesEditor.java b/tooling/utils/src/main/java/org/apache/karaf/tools/utils/KarafPropertiesEditor.java
new file mode 100644
index 0000000..15f0c20
--- /dev/null
+++ b/tooling/utils/src/main/java/org/apache/karaf/tools/utils/KarafPropertiesEditor.java
@@ -0,0 +1,78 @@
+/*
+ * 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.tools.utils;
+
+import org.apache.karaf.tools.utils.model.KarafPropertyEdit;
+import org.apache.karaf.tools.utils.model.KarafPropertyEdits;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Apply a set of edits, reading files from a stock etc dir.
+ */
+public class KarafPropertiesEditor {
+    private File inputEtc;
+    private File outputEtc;
+    private KarafPropertyEdits edits;
+
+    public KarafPropertiesEditor setInputEtc(File inputEtc) {
+        this.inputEtc = inputEtc;
+        return this;
+    }
+
+    public KarafPropertiesEditor setOutputEtc(File outputEtc) {
+        this.outputEtc = outputEtc;
+        return this;
+    }
+
+    public KarafPropertiesEditor setEdits(KarafPropertyEdits edits) {
+        this.edits = edits;
+        return this;
+    }
+
+    public void run() throws IOException {
+
+        Map<String, List<KarafPropertyEdit>> editsByFile = new HashMap<>();
+
+        // organize edits by file.
+        for (KarafPropertyEdit edit : edits.getEdits()) {
+            List<KarafPropertyEdit> thisFileEdits = editsByFile.get(edit.getFile());
+            if (thisFileEdits == null) {
+                thisFileEdits = new ArrayList<>();
+                editsByFile.put(edit.getFile(), thisFileEdits);
+            }
+            thisFileEdits.add(edit);
+        }
+
+        for (Map.Entry<String, List<KarafPropertyEdit>> fileOps : editsByFile.entrySet()) {
+            File input = new File(inputEtc, fileOps.getKey());
+            KarafPropertiesFile propsFile = new KarafPropertiesFile(input);
+            propsFile.load();
+            List<KarafPropertyEdit> edits = fileOps.getValue();
+            for (KarafPropertyEdit edit : edits) {
+                propsFile.apply(edit);
+            }
+            File outputFile = new File(outputEtc, fileOps.getKey());
+            propsFile.store(outputFile);
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/karaf/blob/04840c83/tooling/utils/src/main/java/org/apache/karaf/tools/utils/KarafPropertiesFile.java
----------------------------------------------------------------------
diff --git a/tooling/utils/src/main/java/org/apache/karaf/tools/utils/KarafPropertiesFile.java b/tooling/utils/src/main/java/org/apache/karaf/tools/utils/KarafPropertiesFile.java
new file mode 100644
index 0000000..ef75d75
--- /dev/null
+++ b/tooling/utils/src/main/java/org/apache/karaf/tools/utils/KarafPropertiesFile.java
@@ -0,0 +1,104 @@
+/*
+ * 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.tools.utils;
+
+import org.apache.commons.io.FileUtils;
+import org.apache.karaf.tools.utils.model.KarafPropertyEdit;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.util.Properties;
+
+public class KarafPropertiesFile {
+
+    private final Properties properties;
+    private final File propertyFile;
+
+    public KarafPropertiesFile(File karafHome, String location) {
+        this(homedPropFile(karafHome, location));
+    }
+
+    public KarafPropertiesFile(File propertyFile) {
+        this.propertyFile = propertyFile;
+        properties = new Properties();
+    }
+
+    private static File homedPropFile(File karafHome, String location) {
+        File propFile;
+        if (location.startsWith("/")) {
+            propFile = new File(karafHome + location);
+        } else {
+            propFile = new File(karafHome + "/" + location);
+        }
+        return propFile;
+    }
+
+    public void load() throws IOException {
+        if (!propertyFile.exists()) {
+            return;
+        }
+        properties.load(new FileInputStream(propertyFile));
+    }
+
+    public void put(String key, String value) {
+        properties.put(key, value);
+    }
+
+    public void extend(String key, String value) {
+        if (properties.get(key) == null) {
+            properties.put(key, value);
+            return;
+        }
+        properties.put(key, JoinUtil.join((String)properties.get(key), value));
+    }
+
+    public void apply(KarafPropertyEdit editSpec) {
+        if ("extend".equals(editSpec.getOperation())) {
+            extend(editSpec.getKey(), editSpec.getValue());
+        } else if ("put".equals(editSpec.getOperation())) {
+            put(editSpec.getKey(), editSpec.getValue());
+        } else {
+            throw new IllegalArgumentException("Operation must be 'extend' or 'put', not " + editSpec.getOperation());
+        }
+    }
+
+    public String get(String key) {
+        return properties.getProperty(key);
+    }
+
+    public void store() throws IOException {
+        store(propertyFile);
+    }
+
+    public void store(File destinationFile) throws IOException {
+        try (FileOutputStream outputStream = new FileOutputStream(destinationFile)) {
+            properties.store(outputStream, String.format("Modified by %s", getClass().getName()));
+        }
+    }
+
+    public void replace(File source) {
+        try {
+            FileUtils.copyFile(source, propertyFile);
+        } 
+        catch (IOException e) {
+            throw new IllegalStateException(String.format("Failed to replace %s", propertyFile.getAbsolutePath()), e);
+        }
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/karaf/blob/04840c83/tooling/utils/src/main/mdo/edits.mdo
----------------------------------------------------------------------
diff --git a/tooling/utils/src/main/mdo/edits.mdo b/tooling/utils/src/main/mdo/edits.mdo
new file mode 100644
index 0000000..5dfc48e
--- /dev/null
+++ b/tooling/utils/src/main/mdo/edits.mdo
@@ -0,0 +1,100 @@
+<?xml version="1.0"?>
+<!--
+
+    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.
+-->
+<model  xmlns="http://modello.codehaus.org/MODELLO/1.4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+        xsi:schemaLocation="http://modello.codehaus.org/MODELLO/1.4.0 http://modello.codehaus.org/xsd/modello-1.4.0.xsd"
+        xml.namespace="http://karaf.apache.org/tools/property-edits/${version}"
+        xml.schemaLocation="http://karaf.apache.org/xsd/property-edits-${version}.xsd">
+    <id>karaf-property-instructions-model</id>
+    <name>KarafPropertyInstructionsModel</name>
+    <description>
+        Specifications for how to modify Karaf property files to customize an installation.
+    </description>
+    <defaults>
+        <default>
+            <key>package</key>
+            <value>org.apache.karaf.tools.utils.model</value>
+        </default>
+    </defaults>
+    <classes>
+        <class rootElement="true" xml.tagName="property-edits">
+            <description>
+                A collection instructions. Each instruction is either a 'put' or an 'edit',
+                and calls out a file and a series of name/value pairs.
+            </description>
+            <name>KarafPropertyEdits</name>
+            <version>1.0.0+</version>
+            <fields>
+                <field>
+                    <name>edits</name>
+                    <version>1.0.0+</version>
+                    <association>
+                        <type>KarafPropertyEdit</type>
+                        <multiplicity>*</multiplicity>
+                    </association>
+                    <description>The list of edits to perform.</description>
+                </field>
+            </fields>
+        </class>
+        <class xml.tagName="edit">
+            <name>KarafPropertyEdit</name>
+            <version>1.0.0+</version>
+            <description>
+                A single property edit.
+            </description>
+            <fields>
+                <field>
+                    <name>operation</name>
+                    <version>1.0.0+</version>
+                    <type>String</type>
+                    <description>
+                        'extend' to extend the existing value, 'put' to replace.
+                    </description>
+                    <required>true</required>
+                </field>
+                <field>
+                    <name>file</name>
+                    <version>1.0.0+</version>
+                    <type>String</type>
+                    <description>
+                        The pathname, relative to the the Karaf etc directory, of the file to manipulate.
+                    </description>
+                    <required>true</required>
+                </field>
+                <field>
+                    <name>key</name>
+                    <version>1.0.0+</version>
+                    <type>String</type>
+                    <description>
+                        The property key.
+                    </description>
+                    <required>true</required>
+                </field>
+                <field>
+                    <name>value</name>
+                    <version>1.0.0+</version>
+                    <type>String</type>
+                    <description>
+                        The property value.
+                    </description>
+                    <required>true</required>
+                </field>
+            </fields>
+        </class>
+    </classes>
+</model>

http://git-wip-us.apache.org/repos/asf/karaf/blob/04840c83/tooling/utils/src/test/java/org/apache/karaf/tools/utils/KarafPropertiesEditorTest.java
----------------------------------------------------------------------
diff --git a/tooling/utils/src/test/java/org/apache/karaf/tools/utils/KarafPropertiesEditorTest.java b/tooling/utils/src/test/java/org/apache/karaf/tools/utils/KarafPropertiesEditorTest.java
new file mode 100644
index 0000000..e49226e
--- /dev/null
+++ b/tooling/utils/src/test/java/org/apache/karaf/tools/utils/KarafPropertiesEditorTest.java
@@ -0,0 +1,77 @@
+/*
+ * 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.tools.utils;
+
+import com.google.common.io.Resources;
+import org.apache.karaf.tools.utils.model.KarafPropertyEdits;
+import org.apache.karaf.tools.utils.model.io.stax.KarafPropertyInstructionsModelStaxReader;
+import org.junit.Test;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.InputStream;
+import java.net.URL;
+import java.nio.file.FileSystems;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.util.Properties;
+
+import static org.junit.Assert.assertEquals;
+
+/**
+ * Test the property editing system.
+ * See src/test/resources/.../test-edit.xml.
+ */
+public class KarafPropertiesEditorTest {
+    private static final String ETC_TO_START_WITH = "../../main/src/test/resources/test-karaf-home/etc/";
+
+    @Test
+    public void onceOver() throws Exception {
+        KarafPropertyInstructionsModelStaxReader kipmsr = new KarafPropertyInstructionsModelStaxReader();
+        URL editsUrl = Resources.getResource(KarafPropertiesEditorTest.class, "test-edits.xml");
+        KarafPropertyEdits edits;
+        try (InputStream editsStream = Resources.asByteSource(editsUrl).openStream()) {
+            edits = kipmsr.read(editsStream, true);
+        }
+
+        Path path = FileSystems.getDefault().getPath("target");
+        Path outputEtc = Files.createTempDirectory(path, "test-etc");
+
+        KarafPropertiesEditor editor = new KarafPropertiesEditor();
+        editor.setInputEtc(new File(ETC_TO_START_WITH))
+                .setOutputEtc(outputEtc.toFile())
+                .setEdits(edits);
+        editor.run();
+
+        File resultConfigProps = new File(outputEtc.toFile(), "config.properties");
+        Properties properties = new Properties();
+        try (InputStream resultInputStream = new FileInputStream(resultConfigProps)) {
+            properties.load(resultInputStream);
+        }
+        assertEquals("equinox", properties.getProperty("karaf.framework"));
+        assertEquals("root,toor", properties.getProperty("karaf.name"));
+
+        resultConfigProps = new File(outputEtc.toFile(), "jre.properties");
+        try (InputStream resultInputStream = new FileInputStream(resultConfigProps)) {
+            properties.load(resultInputStream);
+        }
+
+        assertEquals("This is the cereal: shot from guns", properties.getProperty("test-add-one"));
+        assertEquals("This is the gun that shoots cereal", properties.getProperty("test-add-two"));
+    }
+}

http://git-wip-us.apache.org/repos/asf/karaf/blob/04840c83/tooling/utils/src/test/resources/org/apache/karaf/tools/utils/test-edits.xml
----------------------------------------------------------------------
diff --git a/tooling/utils/src/test/resources/org/apache/karaf/tools/utils/test-edits.xml b/tooling/utils/src/test/resources/org/apache/karaf/tools/utils/test-edits.xml
new file mode 100644
index 0000000..2aa8fca
--- /dev/null
+++ b/tooling/utils/src/test/resources/org/apache/karaf/tools/utils/test-edits.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0"?>
+<property-edits xmlns="http://karaf.apache.org/tools/property-edits/1.0.0">
+    <edits>
+        <edit>
+            <file>config.properties</file>
+            <operation>put</operation>
+            <key>karaf.framework</key>
+            <value>equinox</value>
+        </edit>
+        <edit>
+            <file>config.properties</file>
+            <operation>extend</operation>
+            <key>karaf.name</key>
+            <value>toor</value>
+        </edit>
+        <edit>
+            <file>jre.properties</file>
+            <operation>put</operation>
+            <key>test-add-one</key>
+            <value>This is the cereal: shot from guns</value>
+        </edit>
+        <edit>
+            <file>jre.properties</file>
+            <operation>extend</operation>
+            <key>test-add-two</key>
+            <value>This is the gun that shoots cereal</value>
+        </edit>
+    </edits>
+</property-edits>


[06/10] karaf git commit: KARAF-3982: fix up features.

Posted by jb...@apache.org.
KARAF-3982: fix up features.


Project: http://git-wip-us.apache.org/repos/asf/karaf/repo
Commit: http://git-wip-us.apache.org/repos/asf/karaf/commit/1ad8aa91
Tree: http://git-wip-us.apache.org/repos/asf/karaf/tree/1ad8aa91
Diff: http://git-wip-us.apache.org/repos/asf/karaf/diff/1ad8aa91

Branch: refs/heads/master
Commit: 1ad8aa91f6d02169adc1eadb9890a663b3a6e1ce
Parents: 42ea004
Author: Benson Margulies <be...@basistech.com>
Authored: Wed Sep 9 11:47:40 2015 -0400
Committer: Benson Margulies <be...@basistech.com>
Committed: Wed Sep 9 11:47:40 2015 -0400

----------------------------------------------------------------------
 assemblies/features/standard/src/main/feature/feature.xml | 2 ++
 tooling/utils/pom.xml                                     | 4 +++-
 2 files changed, 5 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/karaf/blob/1ad8aa91/assemblies/features/standard/src/main/feature/feature.xml
----------------------------------------------------------------------
diff --git a/assemblies/features/standard/src/main/feature/feature.xml b/assemblies/features/standard/src/main/feature/feature.xml
index d972da0..89da3d3 100644
--- a/assemblies/features/standard/src/main/feature/feature.xml
+++ b/assemblies/features/standard/src/main/feature/feature.xml
@@ -562,6 +562,8 @@
             profilesDirectory = ${karaf.home}/profiles
         </config>
         <bundle>mvn:org.apache.karaf.profile/org.apache.karaf.profile.core/${project.version}</bundle>
+        <bundle>mvn:org.apache.karaf.tooling/org.apache.karaf.tools.utils/${project.version}</bundle>
+        <bundle>mvn:commons-io/commons-io/${commons-io.version}</bundle>
     </feature>
 
     <feature name="jolokia" description="Jolokia monitoring support" version="${jolokia.version}">

http://git-wip-us.apache.org/repos/asf/karaf/blob/1ad8aa91/tooling/utils/pom.xml
----------------------------------------------------------------------
diff --git a/tooling/utils/pom.xml b/tooling/utils/pom.xml
index 7688e25..8476f28 100644
--- a/tooling/utils/pom.xml
+++ b/tooling/utils/pom.xml
@@ -75,7 +75,9 @@
                 <configuration>
                     <instructions>
                         <Export-Package>
-                            org.apache.karaf.tools.utils
+                            org.apache.karaf.tools.utils,
+                            org.apache.karaf.tools.utils.model,
+                            org.apache.karaf.tools.utils.model.io.stax
                         </Export-Package>
                     </instructions>
                 </configuration>


[03/10] karaf git commit: KARAF-3982: wire this up to the Builder and the mojo.

Posted by jb...@apache.org.
KARAF-3982: wire this up to the Builder and the mojo.


Project: http://git-wip-us.apache.org/repos/asf/karaf/repo
Commit: http://git-wip-us.apache.org/repos/asf/karaf/commit/2b170904
Tree: http://git-wip-us.apache.org/repos/asf/karaf/tree/2b170904
Diff: http://git-wip-us.apache.org/repos/asf/karaf/diff/2b170904

Branch: refs/heads/master
Commit: 2b1709045d79ea0d24e3cc4bd5d4b762b460872a
Parents: 04840c8
Author: Benson Margulies <be...@basistech.com>
Authored: Wed Sep 9 10:35:21 2015 -0400
Committer: Benson Margulies <be...@basistech.com>
Committed: Wed Sep 9 10:35:21 2015 -0400

----------------------------------------------------------------------
 profile/pom.xml                                 |  6 ++
 .../apache/karaf/profile/assembly/Builder.java  | 25 +++++++
 tooling/karaf-maven-plugin/pom.xml              |  8 +-
 .../src/it/test-assembly-prop-edits/pom.xml     | 78 ++++++++++++++++++++
 .../org/apache/karaf/tooling/AssemblyMojo.java  | 46 ++++++++++++
 tooling/utils/pom.xml                           | 11 +++
 6 files changed, 171 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/karaf/blob/2b170904/profile/pom.xml
----------------------------------------------------------------------
diff --git a/profile/pom.xml b/profile/pom.xml
index 2045cb3..fc3c2a5 100644
--- a/profile/pom.xml
+++ b/profile/pom.xml
@@ -71,6 +71,12 @@
         </dependency>
 
         <dependency>
+            <groupId>org.apache.karaf.tooling</groupId>
+            <artifactId>org.apache.karaf.tools.utils</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+
+        <dependency>
             <groupId>org.apache.karaf.shell</groupId>
             <artifactId>org.apache.karaf.shell.core</artifactId>
             <optional>true</optional>

http://git-wip-us.apache.org/repos/asf/karaf/blob/2b170904/profile/src/main/java/org/apache/karaf/profile/assembly/Builder.java
----------------------------------------------------------------------
diff --git a/profile/src/main/java/org/apache/karaf/profile/assembly/Builder.java b/profile/src/main/java/org/apache/karaf/profile/assembly/Builder.java
index dd0e623..b644ac3 100644
--- a/profile/src/main/java/org/apache/karaf/profile/assembly/Builder.java
+++ b/profile/src/main/java/org/apache/karaf/profile/assembly/Builder.java
@@ -75,6 +75,9 @@ import org.apache.karaf.kar.internal.Kar;
 import org.apache.karaf.profile.Profile;
 import org.apache.karaf.profile.ProfileBuilder;
 import org.apache.karaf.profile.impl.Profiles;
+import org.apache.karaf.tools.utils.KarafPropertiesEditor;
+import org.apache.karaf.tools.utils.model.KarafPropertyEdit;
+import org.apache.karaf.tools.utils.model.KarafPropertyEdits;
 import org.apache.karaf.util.config.PropertiesLoader;
 import org.apache.karaf.util.maven.Parser;
 import org.ops4j.pax.url.mvn.MavenResolver;
@@ -154,6 +157,7 @@ public class Builder {
     private Path etcDirectory;
     private Path systemDirectory;
     private Map<String, Profile> allProfiles;
+    private KarafPropertyEdits propertyEdits;
 
     public static Builder newInstance() {
         return new Builder();
@@ -336,6 +340,16 @@ public class Builder {
         return this;
     }
 
+    /**
+     * Specify a set of edits to apply when moving etc files.
+     * @param propertyEdits the edits.
+     * @return this.
+     */
+    public Builder propertyEdits(KarafPropertyEdits propertyEdits) {
+        this.propertyEdits = propertyEdits;
+        return this;
+    }
+
     public List<String> getBlacklistedProfiles() {
         return blacklistedProfiles;
     }
@@ -486,6 +500,8 @@ public class Builder {
             }
         }, false, false, true);
 
+        Map<String, List<KarafPropertyEdit>> editsByFile = new HashMap<>();
+
         //
         // Write config and system properties
         //
@@ -522,6 +538,15 @@ public class Builder {
             Files.write(configFile, config.getValue());
         }
 
+        // 'improve' configuration files.
+        if (propertyEdits != null) {
+            KarafPropertiesEditor editor = new KarafPropertiesEditor();
+            editor.setInputEtc(etcDirectory.toFile())
+                    .setOutputEtc(etcDirectory.toFile())
+                    .setEdits(propertyEdits);
+            editor.run();
+        }
+
         //
         // Handle overrides
         //

http://git-wip-us.apache.org/repos/asf/karaf/blob/2b170904/tooling/karaf-maven-plugin/pom.xml
----------------------------------------------------------------------
diff --git a/tooling/karaf-maven-plugin/pom.xml b/tooling/karaf-maven-plugin/pom.xml
index 9aa63d4..67998e4 100644
--- a/tooling/karaf-maven-plugin/pom.xml
+++ b/tooling/karaf-maven-plugin/pom.xml
@@ -92,13 +92,15 @@
             <groupId>org.apache.karaf</groupId>
             <artifactId>org.apache.karaf.util</artifactId>
         </dependency>
-
-
+        <dependency>
+            <groupId>org.apache.karaf.tooling</groupId>
+            <artifactId>org.apache.karaf.tools.utils</artifactId>
+            <version>${project.version}</version>
+        </dependency>
         <dependency>
             <groupId>org.slf4j</groupId>
             <artifactId>slf4j-jdk14</artifactId>
         </dependency>
-
         <dependency>
             <groupId>org.apache.maven.shared</groupId>
             <artifactId>maven-filtering</artifactId>

http://git-wip-us.apache.org/repos/asf/karaf/blob/2b170904/tooling/karaf-maven-plugin/src/it/test-assembly-prop-edits/pom.xml
----------------------------------------------------------------------
diff --git a/tooling/karaf-maven-plugin/src/it/test-assembly-prop-edits/pom.xml b/tooling/karaf-maven-plugin/src/it/test-assembly-prop-edits/pom.xml
new file mode 100644
index 0000000..886ef11
--- /dev/null
+++ b/tooling/karaf-maven-plugin/src/it/test-assembly-prop-edits/pom.xml
@@ -0,0 +1,78 @@
+<?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 xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
+         xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+    <modelVersion>4.0.0</modelVersion>
+
+    <groupId>test</groupId>
+    <artifactId>test-assembl-prop-edits</artifactId>
+    <version>1.0-SNAPSHOT</version>
+    <packaging>karaf-assembly</packaging>
+
+    <properties>
+        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+    </properties>
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.karaf.features</groupId>
+            <artifactId>framework</artifactId>
+            <version>@pom.version@</version>
+            <type>kar</type>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.karaf.features</groupId>
+            <artifactId>standard</artifactId>
+            <version>@pom.version@</version>
+            <classifier>features</classifier>
+            <type>xml</type>
+            <scope>runtime</scope>
+        </dependency>
+    </dependencies>
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.karaf.tooling</groupId>
+                <artifactId>karaf-maven-plugin</artifactId>
+                <version>@pom.version@</version>
+                <extensions>true</extensions>
+                <configuration>
+                    <finalName>${project.artifactId}</finalName>
+                    <bootFeatures>
+                        <feature>bundle</feature>
+                        <feature>config</feature>
+                        <feature>diagnostic</feature>
+                        <feature>feature</feature>
+                        <feature>jaas</feature>
+                        <feature>shell</feature>
+                        <feature>log</feature>
+                        <feature>management</feature>
+                        <feature>package</feature>
+                        <feature>shell-compat</feature>
+                        <feature>ssh</feature>
+                        <feature>system</feature>
+                        <feature>wrap</feature>
+                    </bootFeatures>
+                    <archiveZip>false</archiveZip>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+</project>

http://git-wip-us.apache.org/repos/asf/karaf/blob/2b170904/tooling/karaf-maven-plugin/src/main/java/org/apache/karaf/tooling/AssemblyMojo.java
----------------------------------------------------------------------
diff --git a/tooling/karaf-maven-plugin/src/main/java/org/apache/karaf/tooling/AssemblyMojo.java b/tooling/karaf-maven-plugin/src/main/java/org/apache/karaf/tooling/AssemblyMojo.java
index 44ebcbe..c0653c5 100644
--- a/tooling/karaf-maven-plugin/src/main/java/org/apache/karaf/tooling/AssemblyMojo.java
+++ b/tooling/karaf-maven-plugin/src/main/java/org/apache/karaf/tooling/AssemblyMojo.java
@@ -22,6 +22,9 @@ import org.apache.karaf.profile.assembly.Builder;
 import org.apache.karaf.tooling.utils.IoUtils;
 import org.apache.karaf.tooling.utils.MavenUtil;
 import org.apache.karaf.tooling.utils.MojoSupport;
+import org.apache.karaf.tools.utils.KarafPropertiesEditor;
+import org.apache.karaf.tools.utils.model.KarafPropertyEdits;
+import org.apache.karaf.tools.utils.model.io.stax.KarafPropertyInstructionsModelStaxReader;
 import org.apache.maven.artifact.Artifact;
 import org.apache.maven.plugin.MojoExecutionException;
 import org.apache.maven.plugin.MojoFailureException;
@@ -31,6 +34,8 @@ import org.apache.maven.plugins.annotations.Parameter;
 import org.apache.maven.plugins.annotations.ResolutionScope;
 
 import java.io.File;
+import java.io.FileInputStream;
+import java.io.InputStream;
 import java.nio.file.Files;
 import java.nio.file.attribute.PosixFilePermissions;
 import java.util.ArrayList;
@@ -173,6 +178,35 @@ public class AssemblyMojo extends MojoSupport {
     @Parameter(defaultValue = "1.7")
     protected String javase;
 
+    /**
+     * Specify an XML file that instructs this goal to apply edits to
+     * one or more standard Karaf property files. This allows you to
+     * customize these files without making copies in your resources
+     * directories. Here's a simple example:
+     * <pre>
+     * {@literal
+      <property-edits xmlns="http://karaf.apache.org/tools/property-edits/1.0.0">
+         <edits>
+          <edit>
+            <file>config.properties</file>
+            <operation>put</operation>
+            <key>karaf.framework</key>
+            <value>equinox</value>
+          </edit>
+          <edit>
+            <file>config.properties</file>
+            <operation>extend</operation>
+            <key>org.osgi.framework.system.capabilities</key>
+            <value>my-magic-capability</value>
+          </edit>
+         </edits>
+      </property-edits>
+     </pre>
+    }
+     */
+    @Parameter(defaultValue = "${project.basedir}/src/main/karaf/assembly-property-edits.xml")
+    protected String propertyFileEdits;
+
     @Override
     public void execute() throws MojoExecutionException, MojoFailureException {
         try {
@@ -226,6 +260,18 @@ public class AssemblyMojo extends MojoSupport {
         builder.blacklistProfiles(blacklistedProfiles);
         builder.blacklistPolicy(blacklistPolicy);
 
+        if (propertyFileEdits != null) {
+            File file = new File(propertyFileEdits);
+            if (file.exists()) {
+                KarafPropertyEdits edits;
+                try (InputStream editsStream = new FileInputStream(propertyFileEdits)) {
+                    KarafPropertyInstructionsModelStaxReader kipmsr = new KarafPropertyInstructionsModelStaxReader();
+                    edits = kipmsr.read(editsStream, true);
+                }
+                builder.propertyEdits(edits);
+            }
+        }
+
         // creating system directory
         getLog().info("Creating work directory");
         builder.homeDirectory(workDirectory.toPath());

http://git-wip-us.apache.org/repos/asf/karaf/blob/2b170904/tooling/utils/pom.xml
----------------------------------------------------------------------
diff --git a/tooling/utils/pom.xml b/tooling/utils/pom.xml
index ece56ce..7688e25 100644
--- a/tooling/utils/pom.xml
+++ b/tooling/utils/pom.xml
@@ -69,6 +69,17 @@
                     <version>1.0.0</version>
                 </configuration>
             </plugin>
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-bundle-plugin</artifactId>
+                <configuration>
+                    <instructions>
+                        <Export-Package>
+                            org.apache.karaf.tools.utils
+                        </Export-Package>
+                    </instructions>
+                </configuration>
+            </plugin>
         </plugins>
     </build>
 </project>