You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jackrabbit.apache.org by tr...@apache.org on 2017/09/15 06:24:39 UTC

svn commit: r1808412 [6/7] - in /jackrabbit/commons/filevault-package-maven-plugin/trunk: ./ it/ it/src/ it/src/test/ it/src/test/java/ it/src/test/java/org/ it/src/test/java/org/apache/ it/src/test/java/org/apache/jackrabbit/ it/src/test/java/org/apac...

Added: jackrabbit/commons/filevault-package-maven-plugin/trunk/plugin/src/main/java/org/apache/jackrabbit/filevault/maven/packaging/Version.java
URL: http://svn.apache.org/viewvc/jackrabbit/commons/filevault-package-maven-plugin/trunk/plugin/src/main/java/org/apache/jackrabbit/filevault/maven/packaging/Version.java?rev=1808412&view=auto
==============================================================================
--- jackrabbit/commons/filevault-package-maven-plugin/trunk/plugin/src/main/java/org/apache/jackrabbit/filevault/maven/packaging/Version.java (added)
+++ jackrabbit/commons/filevault-package-maven-plugin/trunk/plugin/src/main/java/org/apache/jackrabbit/filevault/maven/packaging/Version.java Fri Sep 15 06:24:37 2017
@@ -0,0 +1,183 @@
+/*
+ * 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.jackrabbit.filevault.maven.packaging;
+
+/**
+ * Implements a package version.
+ * @since 2.0
+ */
+public class Version implements Comparable<Version> {
+
+    /**
+     * The empty version
+     */
+    public static final Version EMPTY = new Version("", new String[0]);
+
+    /**
+     * internal string representation
+     */
+    private final String str;
+
+    /**
+     * All segments of this version
+     */
+    private final String[] segments;
+
+    /**
+     * Constructs a new version from the given string.
+     * @param str the version string.
+     * @deprecated use {@link Version#create(String)} instead.
+     */
+    public Version(String str) {
+        this(str, str.split("\\."));
+    }
+
+    /**
+     * Creates a new version from the given string.
+     * @param str the version string.
+     * @return the new version or {@link Version#EMPTY} if <code>str</code> is an empty string.
+     * @since 2.2.4
+     */
+    public static Version create(String str) {
+        if (str == null || str.length() == 0) {
+            return Version.EMPTY;
+        }else {
+            return new Version(str, str.split("\\."));
+        }
+    }
+
+    /**
+     * Creates a new version from version segments
+     * @param segments version segments
+     * @return the new version or {@link Version#EMPTY} if <code>segments</code> is empty.
+     * @since 2.2.4
+     */
+    public static Version create(String[] segments) {
+        if (segments == null || segments.length == 0) {
+            return Version.EMPTY;
+        } else {
+            StringBuilder b = new StringBuilder();
+            String delim = "";
+            for (String s:segments) {
+                b.append(delim);
+                b.append(s);
+                delim=".";
+            }
+            return new Version(b.toString(), segments);
+        }
+    }
+
+    /**
+     * Internal constructor
+     * @param str string
+     * @param segments segments
+     */
+    private Version(String str, String[] segments) {
+        if (str == null) {
+            throw new NullPointerException("Version String must not be null.");
+        }
+        this.str = str;
+        this.segments = segments;
+    }
+
+    @Override
+    public int hashCode() {
+        return str.hashCode();
+    }
+
+    @Override
+    public boolean equals(Object o) {
+        return this == o ||
+                o instanceof Version && str.equals(((Version) o).str);
+
+    }
+
+    @Override
+    public String toString() {
+        return str;
+    }
+
+    /**
+     * Returns all segments.
+     * @return all segments.
+     */
+    public String[] getNormalizedSegments() {
+        return segments;
+    }
+
+    /**
+     * Compares this version to the given one, segment by segment with a special
+     * "SNAPSHOT" handling.
+     *
+     * Examples:
+     * "1" < "2"
+     * "1.0" < "2"
+     * "2.0.1" < "2.1"
+     * "2.1" < "2.1.1"
+     * "2.9" < "2.11"
+     * "2.1" > "2.1-SNAPSHOT"
+     * "2.1" > "2.1-R1234556"
+     * "2.1-R12345" < "2.1-SNAPSHOT"
+     *
+     * @param o the other version
+     * @return  a negative integer, zero, or a positive integer as this version
+     *		is less than, equal to, or greater than the specified version.
+     */
+    public int compareTo(Version o) {
+        String[] oSegs = o.getNormalizedSegments();
+        for (int i=0; i< Math.min(segments.length, oSegs.length); i++) {
+            String s1 = segments[i];
+            String s2 = oSegs[i];
+            if (s1.equals(s2)) {
+                continue;
+            }
+            try {
+                int v1 = Integer.parseInt(segments[i]);
+                int v2 = Integer.parseInt(oSegs[i]);
+                if (v1 != v2) {
+                    return v1 - v2;
+                }
+            } catch (NumberFormatException e) {
+                // ignore
+            }
+            String ss1[] = s1.split("-");
+            String ss2[] = s2.split("-");
+            for (int j=0; j< Math.min(ss1.length, ss2.length); j++) {
+                String c1 = ss1[j];
+                String c2 = ss2[j];
+                try {
+                    int v1 = Integer.parseInt(c1);
+                    int v2 = Integer.parseInt(c2);
+                    if (v1 != v2) {
+                        return v1 - v2;
+                    }
+                } catch (NumberFormatException e) {
+                    // ignore
+                }
+                int c = c1.compareTo(c2);
+                if (c!=0) {
+                    return c;
+                }
+            }
+            int c = ss1.length - ss2.length;
+            if (c != 0) {
+                return -c;
+            }
+        }
+        return segments.length - oSegs.length;
+    }
+}
\ No newline at end of file

Added: jackrabbit/commons/filevault-package-maven-plugin/trunk/plugin/src/main/java/org/apache/jackrabbit/filevault/maven/packaging/VersionRange.java
URL: http://svn.apache.org/viewvc/jackrabbit/commons/filevault-package-maven-plugin/trunk/plugin/src/main/java/org/apache/jackrabbit/filevault/maven/packaging/VersionRange.java?rev=1808412&view=auto
==============================================================================
--- jackrabbit/commons/filevault-package-maven-plugin/trunk/plugin/src/main/java/org/apache/jackrabbit/filevault/maven/packaging/VersionRange.java (added)
+++ jackrabbit/commons/filevault-package-maven-plugin/trunk/plugin/src/main/java/org/apache/jackrabbit/filevault/maven/packaging/VersionRange.java Fri Sep 15 06:24:37 2017
@@ -0,0 +1,222 @@
+/*
+ * 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.jackrabbit.filevault.maven.packaging;
+
+/**
+ * Implements a version range
+ * @since 2.0
+ */
+public class VersionRange {
+
+    /**
+     * Infinite (covers all) range.
+     */
+    public static final VersionRange INFINITE = new VersionRange(null, true, null, true);
+
+    /**
+     * lower bound
+     */
+    private final Version low;
+
+    /**
+     * specifies if lower bound is inclusive
+     */
+    private final boolean lowIncl;
+
+    /**
+     * upper bound
+     */
+    private final Version high;
+
+    /**
+     * specifies if upper bound is inclusive
+     */
+    private final boolean highIncl;
+
+    /**
+     * internal string representation
+     */
+    private final String str;
+
+    /**
+     * Creates a new version range.
+     * @param low lower bound or <code>null</code>
+     * @param lowIncl specifies if lower bound is inclusive
+     * @param high upper bound or <code>null</code>
+     * @param highIncl specifies if upper bound is inclusive
+     * @throws IllegalArgumentException if bounds are not valid
+     */
+    public VersionRange(Version low, boolean lowIncl, Version high, boolean highIncl) {
+        // check if range is valid
+        if (low != null && high != null) {
+            int comp = low.compareTo(high);
+            if (comp > 0) {
+                throw new IllegalArgumentException("lower bound must be less or equal to upper bound.");
+            } else if (comp == 0) {
+                if (!lowIncl || !highIncl) {
+                    throw new IllegalArgumentException("invalid empty range. upper and lower bound must be inclusive.");
+                }
+            }
+        }
+        this.low = low;
+        this.lowIncl = lowIncl;
+        this.high = high;
+        this.highIncl = highIncl;
+        StringBuilder b = new StringBuilder();
+        if (low == null && high == null) {
+            // infinite range, empty string
+        } else if (high == null) {
+            // no high bound,
+            if (lowIncl) {
+                // special case, just use version
+                b.append(low);
+            } else {
+                b.append('(');
+                b.append(low);
+                b.append(",)");
+            }
+        } else if (low == null) {
+            b.append("[,");
+            b.append(high);
+            b.append(highIncl ? ']' : ')');
+        } else {
+            b.append(lowIncl ? '[' : '(');
+            b.append(low);
+            b.append(',');
+            b.append(high);
+            b.append(highIncl ? ']' : ')');
+        }
+        this.str = b.toString();
+    }
+
+    /**
+     * Creates a new version range that exactly includes the given version.
+     * @param v the version.
+     */
+    public VersionRange(Version v) {
+        this(v, true, v, true);
+    }
+
+    /**
+     * Returns the lower bound
+     * @return the lower bound or <code>null</code>
+     */
+    public Version getLow() {
+        return low;
+    }
+
+    /**
+     * Returns <code>true</code> if the lower bound is inclusive
+     * @return <code>true</code> if the lower bound is inclusive
+     */
+    public boolean isLowInclusive() {
+        return lowIncl;
+    }
+
+    /**
+     * Returns the upper bound
+     * @return the upper bound or <code>null</code>
+     */
+    public Version getHigh() {
+        return high;
+    }
+
+    /**
+     * Returns <code>true</code> if the upper bound is inclusive
+     * @return <code>true</code> if the upper bound is inclusive
+     */
+    public boolean isHighInclusive() {
+        return highIncl;
+    }
+
+    @Override
+    public int hashCode() {
+        return str.hashCode();
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        return this == obj ||
+                obj instanceof VersionRange && str.equals(obj.toString());
+    }
+
+    @Override
+    public String toString() {
+        return str;
+    }
+
+    /**
+     * Checks if the given version is in this range.
+     * @param v the version to check
+     * @return <code>true</code> if the given version is in this range.
+     */
+    public boolean isInRange(Version v) {
+        if (low != null) {
+            int comp = v.compareTo(low);
+            if (comp < 0 || comp == 0 && !lowIncl) {
+                return false;
+            }
+        }
+        if (high != null) {
+            int comp = v.compareTo(high);
+            if (comp > 0 || comp == 0 && !highIncl) {
+                return false;
+            }
+        }
+        return true;
+    }
+
+    /**
+     * Creates a range from a string
+     * @param str string
+     * @return the version range
+     */
+    public static VersionRange fromString(String str) {
+        int idx = str.indexOf(',');
+        if (idx >= 0) {
+            boolean linc = false;
+            int lm = str.indexOf('(');
+            if (lm < 0) {
+                lm = str.indexOf('[');
+                if (lm < 0) {
+                    throw new IllegalArgumentException("Range must start with '[' or '('");
+                }
+                linc = true;
+            }
+            boolean hinc = false;
+            int hm = str.indexOf(')');
+            if (hm < 0) {
+                hm = str.indexOf(']');
+                if (hm < 0) {
+                    throw new IllegalArgumentException("Range must end with ']' or ')'");
+                }
+                hinc = true;
+            }
+            String low = str.substring(lm + 1, idx).trim();
+            String high = str.substring(idx+1, hm).trim();
+            Version vLow = low.length() == 0 ? null : Version.create(low);
+            Version vHigh = high.length() == 0 ? null : Version.create(high);
+            return new VersionRange(vLow, linc, vHigh, hinc);
+        } else if (str.length() == 0) {
+            // infinite range
+            return new VersionRange(null, false, null, false);
+        } else {
+            // simple range where given version is minimum
+            return new VersionRange(Version.create(str), true, null, false);
+        }
+    }
+}
\ No newline at end of file

Added: jackrabbit/commons/filevault-package-maven-plugin/trunk/plugin/src/main/java/org/apache/jackrabbit/filevault/maven/packaging/impl/DefaultPathFilter.java
URL: http://svn.apache.org/viewvc/jackrabbit/commons/filevault-package-maven-plugin/trunk/plugin/src/main/java/org/apache/jackrabbit/filevault/maven/packaging/impl/DefaultPathFilter.java?rev=1808412&view=auto
==============================================================================
--- jackrabbit/commons/filevault-package-maven-plugin/trunk/plugin/src/main/java/org/apache/jackrabbit/filevault/maven/packaging/impl/DefaultPathFilter.java (added)
+++ jackrabbit/commons/filevault-package-maven-plugin/trunk/plugin/src/main/java/org/apache/jackrabbit/filevault/maven/packaging/impl/DefaultPathFilter.java Fri Sep 15 06:24:37 2017
@@ -0,0 +1,89 @@
+/*
+ * 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.jackrabbit.filevault.maven.packaging.impl;
+
+import java.util.regex.Pattern;
+
+/**
+ * The default path filter provides hierarchical filtering.
+ *
+ */
+public class DefaultPathFilter implements PathFilter {
+
+    /**
+     * the internal regex pattern
+     */
+    private Pattern regex;
+
+    /**
+     * Default constructor
+     */
+    public DefaultPathFilter() {
+    }
+
+    /**
+     * Creates a new default path filter
+     * @param pattern the pattern
+     * @see #setPattern
+     */
+    public DefaultPathFilter(String pattern) {
+        setPattern(pattern);
+    }
+
+    /**
+     * Sets the regexp pattern for this filter.
+     *
+     * Examples:
+     * <xmp>
+     * | Pattern        | Matches
+     * | /foo           | exactly "/foo"
+     * | /foo.*         | all paths starting with "/foo"
+     * | ^.* /foo[^/]*$ | all files starting with "foo"
+     * | /foo/[^/]*$    | all direct children of /foo
+     * | /foo/.*        | all children of /foo
+     * | /foo(/.*)?     | all children of /foo and foo itself
+     * </xmp>
+     *
+     * @param pattern the pattern.
+     */
+    public void setPattern(String pattern) {
+        regex = Pattern.compile(pattern);
+    }
+
+    /**
+     * Returns the pattern
+     * @return the pattern
+     */
+    public String getPattern() {
+        return regex.pattern();
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public boolean matches(String path) {
+        return regex.matcher(path).matches();
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public boolean isAbsolute() {
+        return regex.pattern().startsWith("/");
+    }
+
+}
\ No newline at end of file

Added: jackrabbit/commons/filevault-package-maven-plugin/trunk/plugin/src/main/java/org/apache/jackrabbit/filevault/maven/packaging/impl/DefaultWorkspaceFilter.java
URL: http://svn.apache.org/viewvc/jackrabbit/commons/filevault-package-maven-plugin/trunk/plugin/src/main/java/org/apache/jackrabbit/filevault/maven/packaging/impl/DefaultWorkspaceFilter.java?rev=1808412&view=auto
==============================================================================
--- jackrabbit/commons/filevault-package-maven-plugin/trunk/plugin/src/main/java/org/apache/jackrabbit/filevault/maven/packaging/impl/DefaultWorkspaceFilter.java (added)
+++ jackrabbit/commons/filevault-package-maven-plugin/trunk/plugin/src/main/java/org/apache/jackrabbit/filevault/maven/packaging/impl/DefaultWorkspaceFilter.java Fri Sep 15 06:24:37 2017
@@ -0,0 +1,319 @@
+/*
+ * 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.jackrabbit.filevault.maven.packaging.impl;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.UnsupportedEncodingException;
+import java.util.LinkedList;
+import java.util.List;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+
+import org.apache.jackrabbit.filevault.maven.packaging.Filter;
+import org.codehaus.plexus.util.IOUtil;
+import org.codehaus.plexus.util.xml.pull.MXSerializer;
+import org.codehaus.plexus.util.xml.pull.XmlSerializer;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+import org.xml.sax.SAXException;
+
+
+/**
+ * Holds a list of {@link PathFilterSet}s.
+ *
+ */
+public class DefaultWorkspaceFilter  {
+
+    /**
+     * default logger
+     */
+    private static final Logger log = LoggerFactory.getLogger(DefaultWorkspaceFilter.class);
+
+    private final List<PathFilterSet> filterSets = new LinkedList<PathFilterSet>();
+
+    public static final String ATTR_VERSION = "version";
+
+    public static final double SUPPORTED_VERSION = 1.0;
+
+    protected double version = SUPPORTED_VERSION;
+
+    private byte[] source;
+
+    /**
+     * globally ignored paths. they are not persisted, yet
+     */
+    private PathFilter globalIgnored;
+
+    public void add(PathFilterSet set) {
+        filterSets.add(set);
+    }
+
+    public List<PathFilterSet> getFilterSets() {
+        return filterSets;
+    }
+
+    public PathFilterSet getCoveringFilterSet(String path) {
+        if (isGloballyIgnored(path)) {
+            return null;
+        }
+        for (PathFilterSet set: filterSets) {
+            if (set.covers(path)) {
+                return set;
+            }
+        }
+        return null;
+    }
+
+    public boolean contains(String path) {
+        if (isGloballyIgnored(path)) {
+            return false;
+        }
+        for (PathFilterSet set: filterSets) {
+            if (set.contains(path)) {
+                return true;
+            }
+        }
+        return false;
+    }
+
+    public boolean covers(String path) {
+        if (isGloballyIgnored(path)) {
+            return false;
+        }
+        for (PathFilterSet set: filterSets) {
+            if (set.covers(path)) {
+                return true;
+            }
+        }
+        return false;
+    }
+
+    public boolean isAncestor(String path) {
+        for (PathFilterSet set: filterSets) {
+            if (set.isAncestor(path)) {
+                return true;
+            }
+        }
+        return false;
+    }
+
+    public boolean isGloballyIgnored(String path) {
+        return globalIgnored != null && globalIgnored.matches(path);
+    }
+
+    public void addFilter(Filter filter) {
+        add(filter.toPathFilterSet());
+    }
+
+    // added for Maven 2.2.1 compatibility
+    public void setFilter(Filter filter) {
+        add(filter.toPathFilterSet());
+    }
+
+    /**
+     * Loads the workspace filter from the given file
+     * @param file source
+     * @throws IOException if an I/O error occurs
+     */
+    public void load(File file) throws IOException {
+        load(new FileInputStream(file));
+    }
+
+    public InputStream getSource() {
+        if (source == null) {
+            generateSource();
+        }
+        return new ByteArrayInputStream(source);
+    }
+
+    public String getSourceAsString() {
+        if (source == null) {
+            generateSource();
+        }
+        try {
+            return new String(source, "utf-8");
+        } catch (UnsupportedEncodingException e) {
+            throw new IllegalStateException(e);
+        }
+    }
+
+    /**
+     * Loads the workspace filter from the given input source
+     * @param in source
+     * @throws IOException if an I/O error occurs
+     */
+    public void load(InputStream in) throws IOException {
+        try {
+
+            source = IOUtil.toByteArray(in);
+            in = getSource();
+            DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
+            factory.setNamespaceAware(true);
+            //factory.setFeature("http://xml.org/sax/features/namespace-prefixes", false);
+            DocumentBuilder builder = factory.newDocumentBuilder();
+            Document document = builder.parse(in);
+            Element doc = document.getDocumentElement();
+            if (!doc.getNodeName().equals("workspaceFilter")) {
+                throw new IOException("<workspaceFilter> expected.");
+            }
+            String v = doc.getAttribute(ATTR_VERSION);
+            if (v == null || v.equals("")) {
+                v = "1.0";
+            }
+            version = Double.parseDouble(v);
+            if (version > SUPPORTED_VERSION) {
+                throw new IOException("version " + version + " not supported.");
+            }
+            read(doc);
+        } catch (ParserConfigurationException e) {
+            IOException ioe = new IOException("Unable to create configuration XML parser");
+            e.initCause(e);
+            throw ioe;
+        } catch (SAXException e) {
+            IOException ioe = new IOException("Configuration file syntax error.");
+            e.initCause(e);
+            throw ioe;
+        } finally {
+            IOUtil.close(in);
+        }
+
+    }
+
+    private void read(Element elem) throws IOException {
+        NodeList nl = elem.getChildNodes();
+        for (int i=0; i<nl.getLength(); i++) {
+            Node child = nl.item(i);
+            if (child.getNodeType() == Node.ELEMENT_NODE) {
+                if (!child.getNodeName().equals("filter")) {
+                    throw new IOException("<filter> expected.");
+                }
+                PathFilterSet def = readDef((Element) child);
+                filterSets.add(def);
+            }
+        }
+    }
+
+    private PathFilterSet readDef(Element elem) throws IOException {
+        String root = elem.getAttribute("root");
+        PathFilterSet def = new PathFilterSet(root == null || root.length() == 0 ? "/" : root);
+        // check for import mode
+        String mode = elem.getAttribute("mode");
+        if (mode != null && mode.length() > 0) {
+            def.setImportMode(ImportMode.valueOf(mode.toUpperCase()));
+        }
+        // check for filters
+        NodeList n1 = elem.getChildNodes();
+        for (int i=0; i<n1.getLength(); i++) {
+            Node child = n1.item(i);
+            if (child.getNodeType() == Node.ELEMENT_NODE) {
+                if (child.getNodeName().equals("include")) {
+                    def.addInclude(readFilter((Element) child));
+                } else if (child.getNodeName().equals("exclude")) {
+                    def.addExclude(readFilter((Element) child));
+                } else {
+                    throw new IOException("either <include> or <exclude> expected.");
+                }
+            }
+        }
+        return def;
+    }
+
+    private PathFilter readFilter(Element elem) throws IOException {
+        String pattern = elem.getAttribute("pattern");
+        if (pattern == null || pattern.equals("")) {
+            throw new IOException("Filter pattern must not be empty");
+        }
+        return new DefaultPathFilter(pattern);
+    }
+
+    private void generateSource() {
+        try {
+            ByteArrayOutputStream out = new ByteArrayOutputStream();
+
+            XmlSerializer ser = new MXSerializer();
+            ser.setProperty("http://xmlpull.org/v1/doc/properties.html#serializer-indentation", "    ");
+            ser.setProperty("http://xmlpull.org/v1/doc/properties.html#serializer-line-separator", "\n");
+            ser.setOutput(out, "UTF-8");
+            ser.startDocument("UTF-8", null);
+            ser.text("\n");
+            ser.startTag(null, "workspaceFilter");
+            ser.attribute(null, ATTR_VERSION, String.valueOf(version));
+            for (PathFilterSet set: filterSets) {
+
+                ser.startTag(null, "filter");
+                //attrs = new AttributesImpl();
+                //attrs.addAttribute(null, null, "root", "CDATA", set.getRoot());
+                ser.attribute(null, "root", set.getRoot());
+                if (set.getImportMode() != ImportMode.REPLACE) {
+                    //attrs.addAttribute(null, null, "mode", "CDATA", set.getImportMode().name().toLowerCase());
+                    ser.attribute(null, "mode", set.getImportMode().name().toLowerCase());
+                }
+                //ser.startElement(null, null, "filter", attrs);
+                for (PathFilterSet.Entry<PathFilter> entry: set.getEntries()) {
+                    // only handle path filters
+                    PathFilter filter = entry.getFilter();
+                    if (filter instanceof DefaultPathFilter) {
+                        if (entry.isInclude()) {
+                            ser.startTag(null, "include");
+                            ser.attribute(null, "pattern", ((DefaultPathFilter) filter).getPattern());
+                            ser.endTag(null, "include");
+                        } else {
+                            ser.startTag(null, "exclude");
+                            ser.attribute(null, "pattern", ((DefaultPathFilter) filter).getPattern());
+                            ser.endTag(null, "exclude");
+                        }
+                    } else {
+                        throw new IllegalArgumentException("Can only export default path filters, yet.");
+                    }
+                }
+                ser.endTag(null, "filter");
+            }
+            ser.endTag(null, "workspaceFilter");
+            ser.endDocument();
+            source = out.toByteArray();
+        } catch (IOException e) {
+            throw new IllegalStateException(e);
+        }
+    }
+
+    public void setGlobalIgnored(PathFilter ignored) {
+        globalIgnored = ignored;
+    }
+
+    public void merge(DefaultWorkspaceFilter source) {
+        for (PathFilterSet fs: source.getFilterSets()) {
+            // check for collision
+            for (PathFilterSet mfs: getFilterSets()) {
+                if (mfs.getRoot().equals(fs.getRoot())) {
+                    throw new IllegalArgumentException("Merging of equal filter roots not allowed for: " + fs.getRoot());
+                }
+            }
+            add(fs);
+        }
+    }
+}
\ No newline at end of file

Added: jackrabbit/commons/filevault-package-maven-plugin/trunk/plugin/src/main/java/org/apache/jackrabbit/filevault/maven/packaging/impl/Filter.java
URL: http://svn.apache.org/viewvc/jackrabbit/commons/filevault-package-maven-plugin/trunk/plugin/src/main/java/org/apache/jackrabbit/filevault/maven/packaging/impl/Filter.java?rev=1808412&view=auto
==============================================================================
--- jackrabbit/commons/filevault-package-maven-plugin/trunk/plugin/src/main/java/org/apache/jackrabbit/filevault/maven/packaging/impl/Filter.java (added)
+++ jackrabbit/commons/filevault-package-maven-plugin/trunk/plugin/src/main/java/org/apache/jackrabbit/filevault/maven/packaging/impl/Filter.java Fri Sep 15 06:24:37 2017
@@ -0,0 +1,23 @@
+/*
+ * 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.jackrabbit.filevault.maven.packaging.impl;
+
+/**
+ * <code>Filter</code>...
+ */
+public interface Filter {
+}
\ No newline at end of file

Added: jackrabbit/commons/filevault-package-maven-plugin/trunk/plugin/src/main/java/org/apache/jackrabbit/filevault/maven/packaging/impl/FilterSet.java
URL: http://svn.apache.org/viewvc/jackrabbit/commons/filevault-package-maven-plugin/trunk/plugin/src/main/java/org/apache/jackrabbit/filevault/maven/packaging/impl/FilterSet.java?rev=1808412&view=auto
==============================================================================
--- jackrabbit/commons/filevault-package-maven-plugin/trunk/plugin/src/main/java/org/apache/jackrabbit/filevault/maven/packaging/impl/FilterSet.java (added)
+++ jackrabbit/commons/filevault-package-maven-plugin/trunk/plugin/src/main/java/org/apache/jackrabbit/filevault/maven/packaging/impl/FilterSet.java Fri Sep 15 06:24:37 2017
@@ -0,0 +1,314 @@
+/*
+ * 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.jackrabbit.filevault.maven.packaging.impl;
+
+import java.util.Collections;
+import java.util.LinkedList;
+import java.util.List;
+
+/**
+ * The item filter set holds a set of item filters each attributed as include
+ * or exclude filter. The evaluation of the set allows included items and
+ * rejects excluded items.
+ * <p/>
+ * Additionally it contains a "root" path for which the filters are evaluated.
+ * if an item has not the node addressed by the root path as ancestor, it is
+ * always excluded.
+ */
+public abstract class FilterSet<E extends Filter> {
+
+    /**
+     * root path of this definition
+     */
+    private String root;
+
+    /**
+     * root patten to check for inclusion
+     */
+    private String rootPattern;
+
+    /**
+     * filter entries
+     */
+    private List<Entry<E>> entries;
+
+    /**
+     * flag that indicates if set is sealed
+     */
+    private boolean sealed;
+
+    /**
+     * import mode. defaults to {@link ImportMode#REPLACE}.
+     */
+    private ImportMode mode = ImportMode.REPLACE;
+
+    /**
+     * Default constructor. initializes the root path to "/"
+     */
+    public FilterSet() {
+        this("");
+    }
+
+    /**
+     * Creates a new item filter set and sets the respective root path
+     * @param root path
+     */
+    public FilterSet(String root) {
+        setRoot(root);
+    }
+
+    /**
+     * Returns the root path
+     * @return root path
+     */
+    public String getRoot() {
+        return root.equals("") ? "/" : root;
+    }
+
+    /**
+     * Sets the root path
+     * @param path root path
+     */
+    public void setRoot(String path) {
+        if (sealed) {
+            throw new UnsupportedOperationException("FilterSet is sealed.");
+        }
+        if (path.endsWith("/")) {
+            rootPattern = path;
+            root = path.substring(0, path.length() - 1);
+        } else {
+            rootPattern = path + "/";
+            root = path;
+        }
+    }
+
+    /**
+     * Returns the import mode that is specified for this filter set. Defaults to
+     * {@link ImportMode#REPLACE}.
+     *
+     * @return the import mode.
+     */
+    public ImportMode getImportMode() {
+        return mode;
+    }
+
+    /**
+     * Sets the import mode.
+     * @param mode import mode
+     */
+    public void setImportMode(ImportMode mode) {
+        if (sealed) {
+            throw new UnsupportedOperationException("FilterSet is sealed.");
+        }
+        this.mode = mode;
+    }
+
+    /**
+     * Seals this list, i.e. makes it unmodifiable.
+     * @return this list
+     */
+    public FilterSet seal() {
+        if (!sealed) {
+            if (entries == null) {
+                entries = Collections.emptyList();
+            } else {
+                entries = Collections.unmodifiableList(entries);
+            }
+            sealed = true;
+        }
+        return this;
+    }
+
+    /**
+     * Checks if this filter set is sealed.
+     * @return <code>true</code> if sealed.
+     */
+    public boolean isSealed() {
+        return sealed;
+    }
+
+    /**
+     * Adds (replaces) all entries from the given set to this one.
+     * @param set the set of entries
+     * @return <code>this</code> suitable for chaining.
+     */
+    public FilterSet addAll(FilterSet<E> set) {
+        if (sealed) {
+            throw new UnsupportedOperationException("FilterSet is sealed.");
+        }
+        if (entries == null) {
+            entries = new LinkedList<Entry<E>>(set.entries);
+        } else {
+            entries.clear();
+            entries.addAll(set.entries);
+        }
+        return this;
+    }
+
+    /**
+     * Adds a new item filter as included entry.
+     * @param filter the filter
+     * @return <code>this</code> suitable for chaining.
+     */
+    public FilterSet addInclude(E filter) {
+        addEntry(new Entry<E>(filter, true));
+        return this;
+    }
+
+    /**
+     * Adds a new item filter as excluded entry.
+     * @param filter the filter
+     * @return <code>this</code> suitable for chaining.
+     */
+    public FilterSet addExclude(E filter) {
+        addEntry(new Entry<E>(filter, false));
+        return this;
+    }
+
+    /**
+     * Internally adds a new entry to the list
+     * @param e the entry
+     */
+    private void addEntry(Entry<E> e) {
+        if (sealed) {
+            throw new UnsupportedOperationException("FilterSet is sealed.");
+        }
+        if (entries == null) {
+            entries = new LinkedList<Entry<E>>();
+        }
+        entries.add(e);
+    }
+
+    /**
+     * Returns the list of entries
+     * @return the list of entries
+     */
+    public List<Entry<E>> getEntries() {
+        seal();
+        return entries;
+    }
+
+    /**
+     * Checks if this filter set has any entries defined.
+     * @return <code>true</code> if empty
+     */
+    public boolean isEmpty() {
+        return entries == null || entries.isEmpty();
+    }
+
+    /**
+     * Checks if the given item is covered by this filter set. I.e. if the node
+     * addressed by the <code>root</code> path is an ancestor of the given item.
+     *
+     * @param path path of the item
+     * @return <code>true</code> if this set covers the given item
+     */
+    public boolean covers(String path) {
+        return path.equals(root) || path.startsWith(rootPattern);
+    }
+
+    /**
+     * Checks if the given item is an ancestor of the root node.
+     * @param path path of the item to check
+     * @return <code>true</code> if the given item is an ancestor
+     */
+    public boolean isAncestor(String path) {
+        return path.equals(root) || root.startsWith(path + "/") || path.equals("/");
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public int hashCode() {
+        return 0;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public boolean equals(Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (obj instanceof FilterSet) {
+            return entries.equals(((FilterSet) obj).entries);
+        }
+        return false;
+    }
+
+    /**
+     * Holds a filter entry
+     */
+    public static class Entry<E extends Filter> {
+
+        /**
+         * The item filter
+         */
+        protected final E filter;
+
+        /**
+         * indicates if this an include filter
+         */
+        protected final boolean include;
+
+        /**
+         * Constructs a new entry
+         * @param filter the filter
+         * @param include the include flag
+         */
+        public Entry(E filter, boolean include) {
+            this.filter = filter;
+            this.include = include;
+        }
+
+        /**
+         * Returns the filter of this entry
+         * @return the filter
+         */
+        public E getFilter() {
+            return filter;
+        }
+
+        /**
+         * Returns the 'include' flag of this entry
+         * @return the flag
+         */
+        public boolean isInclude() {
+            return include;
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        public int hashCode() {
+            return 0;
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        public boolean equals(Object obj) {
+            if (this == obj) {
+                return true;
+            }
+            if (obj instanceof Entry) {
+                return ((Entry) obj).include == include && ((Entry) obj).filter.equals(filter);
+            }
+            return false;
+        }
+    }
+}
\ No newline at end of file

Added: jackrabbit/commons/filevault-package-maven-plugin/trunk/plugin/src/main/java/org/apache/jackrabbit/filevault/maven/packaging/impl/ImportMode.java
URL: http://svn.apache.org/viewvc/jackrabbit/commons/filevault-package-maven-plugin/trunk/plugin/src/main/java/org/apache/jackrabbit/filevault/maven/packaging/impl/ImportMode.java?rev=1808412&view=auto
==============================================================================
--- jackrabbit/commons/filevault-package-maven-plugin/trunk/plugin/src/main/java/org/apache/jackrabbit/filevault/maven/packaging/impl/ImportMode.java (added)
+++ jackrabbit/commons/filevault-package-maven-plugin/trunk/plugin/src/main/java/org/apache/jackrabbit/filevault/maven/packaging/impl/ImportMode.java Fri Sep 15 06:24:37 2017
@@ -0,0 +1,41 @@
+/*
+ * 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.jackrabbit.filevault.maven.packaging.impl;
+
+/**
+ * <code>ImportMode</code> is used to define how importing content is applied
+ * to the existing content in the repository.
+ */
+public enum ImportMode {
+
+    /**
+     * Normal behavior. Existing content is replaced completly by the imported
+     * content, i.e. is overridden or deleted accordingly.
+     */
+    REPLACE,
+
+    /**
+     * Existing content is not modified, i.e. only new content is added and
+     * none is deleted or modified.
+     */
+    MERGE,
+
+    /**
+     * Existing content is only updated but never deleted.
+     */
+    UPDATE
+}
\ No newline at end of file

Added: jackrabbit/commons/filevault-package-maven-plugin/trunk/plugin/src/main/java/org/apache/jackrabbit/filevault/maven/packaging/impl/PackageInfo.java
URL: http://svn.apache.org/viewvc/jackrabbit/commons/filevault-package-maven-plugin/trunk/plugin/src/main/java/org/apache/jackrabbit/filevault/maven/packaging/impl/PackageInfo.java?rev=1808412&view=auto
==============================================================================
--- jackrabbit/commons/filevault-package-maven-plugin/trunk/plugin/src/main/java/org/apache/jackrabbit/filevault/maven/packaging/impl/PackageInfo.java (added)
+++ jackrabbit/commons/filevault-package-maven-plugin/trunk/plugin/src/main/java/org/apache/jackrabbit/filevault/maven/packaging/impl/PackageInfo.java Fri Sep 15 06:24:37 2017
@@ -0,0 +1,139 @@
+/*
+ * 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.jackrabbit.filevault.maven.packaging.impl;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.Enumeration;
+import java.util.Properties;
+import java.util.jar.JarFile;
+import java.util.jar.Manifest;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipFile;
+
+import javax.annotation.Nonnull;
+
+import org.apache.commons.lang.StringUtils;
+
+import org.apache.jackrabbit.filevault.maven.packaging.PackageId;
+import org.apache.jackrabbit.filevault.maven.packaging.VaultMojo;
+
+/**
+ * Very simple class that reads basic package info from a file.
+ */
+public class PackageInfo {
+
+    private final PackageId id;
+
+    private final DefaultWorkspaceFilter filter;
+
+    private final PackageType packageType;
+
+    private PackageInfo(PackageId id, DefaultWorkspaceFilter filter, PackageType packageType) {
+        this.id = id;
+        this.filter = filter;
+        this.packageType = packageType;
+    }
+
+    /**
+     * Reads the package file.
+     * @param file the file.
+     * @return {@code true} if the package is valid.
+     * @throws IOException if an error occurrs.
+     */
+    public static PackageInfo read(@Nonnull File file) throws IOException {
+        PackageId id = null;
+        DefaultWorkspaceFilter filter = null;
+        PackageType packageType = PackageType.MIXED;
+
+        ZipFile zip = new ZipFile(file);
+        Enumeration<? extends ZipEntry> entries = zip.entries();
+        while (entries.hasMoreElements() && (id == null || filter == null)) {
+            ZipEntry e = entries.nextElement();
+            if (JarFile.MANIFEST_NAME.equalsIgnoreCase(e.getName())) {
+                Manifest mf = new Manifest(zip.getInputStream(e));
+                String idStr = mf.getMainAttributes().getValue(VaultMojo.MF_KEY_PACKAGE_ID);
+                if (idStr != null) {
+                    id = PackageId.fromString(idStr);
+                }
+                String roots = mf.getMainAttributes().getValue(VaultMojo.MF_KEY_PACKAGE_ROOTS);
+                filter = new DefaultWorkspaceFilter();
+                if (roots != null) {
+                    for (String root: StringUtils.split(roots, ',')) {
+                        filter.add(new PathFilterSet(root));
+                    }
+                }
+                String type = mf.getMainAttributes().getValue(VaultMojo.MF_KEY_PACKAGE_TYPE);
+                if (type != null) {
+                    packageType = PackageType.valueOf(type.toUpperCase());
+                }
+            } else if (VaultMojo.PROPERTIES_FILE.equalsIgnoreCase(e.getName())) {
+                Properties props = new Properties();
+                props.loadFromXML(zip.getInputStream(e));
+                String version = props.getProperty("version");
+                if (version == null) {
+                    version = "";
+                }
+                String group = props.getProperty("group");
+                String name = props.getProperty("name");
+                if (group != null && name != null) {
+                    id = new PackageId(group, name, version);
+                } else {
+                    // check for legacy packages that only contains a 'path' property
+                    String path = props.getProperty("path");
+                    if (path == null || path.length() == 0) {
+                        path = "/etc/packages/unknown";
+                    }
+                    id = new PackageId(path, version);
+                }
+            } else if (VaultMojo.FILTER_FILE.equalsIgnoreCase(e.getName())) {
+                filter = new DefaultWorkspaceFilter();
+                filter.load(zip.getInputStream(e));
+            }
+        }
+        zip.close();
+        if (id == null || filter == null) {
+            return null;
+        } else {
+            return new PackageInfo(id, filter, packageType);
+        }
+    }
+
+    /**
+     * Returns the package id.
+     * @return the package id.
+     */
+    public PackageId getId() {
+        return id;
+    }
+
+    /**
+     * Returns the workspace filter
+     * @return the filter
+     */
+    public DefaultWorkspaceFilter getFilter() {
+        return filter;
+    }
+
+    /**
+     * Returns the package type.
+     * @return the package type
+     */
+    public PackageType getPackageType() {
+        return packageType;
+    }
+}
\ No newline at end of file

Added: jackrabbit/commons/filevault-package-maven-plugin/trunk/plugin/src/main/java/org/apache/jackrabbit/filevault/maven/packaging/impl/PackageType.java
URL: http://svn.apache.org/viewvc/jackrabbit/commons/filevault-package-maven-plugin/trunk/plugin/src/main/java/org/apache/jackrabbit/filevault/maven/packaging/impl/PackageType.java?rev=1808412&view=auto
==============================================================================
--- jackrabbit/commons/filevault-package-maven-plugin/trunk/plugin/src/main/java/org/apache/jackrabbit/filevault/maven/packaging/impl/PackageType.java (added)
+++ jackrabbit/commons/filevault-package-maven-plugin/trunk/plugin/src/main/java/org/apache/jackrabbit/filevault/maven/packaging/impl/PackageType.java Fri Sep 15 06:24:37 2017
@@ -0,0 +1,47 @@
+/*
+ * 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.jackrabbit.filevault.maven.packaging.impl;
+
+/**
+ * Specifies the type of the package. The package type helps to characterize the contents of a package and influences
+ * how the package is used during deployment, installation and removal.
+ */
+public enum PackageType {
+
+    /**
+     * An application package consists purely of application content. It serializes entire subtrees with no
+     * inclusion or exclusion filters. it does not contain any subpackages nor OSGi configuration or bundles.
+     */
+    APPLICATION,
+
+    /**
+     * A content package consists only of content and user defined configuration. It usually serializes entire subtrees
+     * but can contain inclusion or exclusion filters. it does not contain any subpackages nor OSGi configuration or bundles.
+     */
+    CONTENT,
+
+    /**
+     * A container package only contains sub packages and OSGi configuration and bundles. The container package is only used as container for deployment.
+     */
+    CONTAINER,
+
+    /**
+     * Catch all type for a combination of the above.
+     */
+    MIXED
+
+}
\ No newline at end of file

Added: jackrabbit/commons/filevault-package-maven-plugin/trunk/plugin/src/main/java/org/apache/jackrabbit/filevault/maven/packaging/impl/PathFilter.java
URL: http://svn.apache.org/viewvc/jackrabbit/commons/filevault-package-maven-plugin/trunk/plugin/src/main/java/org/apache/jackrabbit/filevault/maven/packaging/impl/PathFilter.java?rev=1808412&view=auto
==============================================================================
--- jackrabbit/commons/filevault-package-maven-plugin/trunk/plugin/src/main/java/org/apache/jackrabbit/filevault/maven/packaging/impl/PathFilter.java (added)
+++ jackrabbit/commons/filevault-package-maven-plugin/trunk/plugin/src/main/java/org/apache/jackrabbit/filevault/maven/packaging/impl/PathFilter.java Fri Sep 15 06:24:37 2017
@@ -0,0 +1,81 @@
+/*
+ * 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.jackrabbit.filevault.maven.packaging.impl;
+
+/**
+ * The item filter is used to include or exclude a set of paths.
+ * It is usually part of a {@link PathFilterSet}.
+ *
+ */
+public interface PathFilter extends Filter {
+
+    /**
+     * The "Catch all" item filter.
+     */
+    public static final PathFilter ALL = new PathFilter() {
+
+        /**
+         * Returns always <code>true</code>
+         */
+        public boolean matches(String path) {
+            return true;
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        public boolean isAbsolute() {
+            return true;
+        }
+    };
+
+    /**
+     * The "Miss all" item filter.
+     */
+    public static final PathFilter NONE = new PathFilter() {
+
+        /**
+         * Returns always <code>false</code>
+         */
+        public boolean matches(String path) {
+            return false;
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        public boolean isAbsolute() {
+            return true;
+        }
+
+    };
+
+    /**
+     * Checks if the given path matches this filters criteria.
+     *
+     * @param path the path to check
+     * @return <code>true</code> if this filter matches the criteria;
+     *         <code>false</code> otherwise.
+     */
+    boolean matches(String path);
+
+    /**
+     * Checks if the pattern is absolute, i.e. does not start with a wildcard.
+     * @return <code>true</code> if pattern is absolute
+     */
+    boolean isAbsolute();
+}
\ No newline at end of file

Added: jackrabbit/commons/filevault-package-maven-plugin/trunk/plugin/src/main/java/org/apache/jackrabbit/filevault/maven/packaging/impl/PathFilterSet.java
URL: http://svn.apache.org/viewvc/jackrabbit/commons/filevault-package-maven-plugin/trunk/plugin/src/main/java/org/apache/jackrabbit/filevault/maven/packaging/impl/PathFilterSet.java?rev=1808412&view=auto
==============================================================================
--- jackrabbit/commons/filevault-package-maven-plugin/trunk/plugin/src/main/java/org/apache/jackrabbit/filevault/maven/packaging/impl/PathFilterSet.java (added)
+++ jackrabbit/commons/filevault-package-maven-plugin/trunk/plugin/src/main/java/org/apache/jackrabbit/filevault/maven/packaging/impl/PathFilterSet.java Fri Sep 15 06:24:37 2017
@@ -0,0 +1,120 @@
+/*
+ * 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.jackrabbit.filevault.maven.packaging.impl;
+
+import java.util.List;
+
+/**
+ * The path filter set holds a set of path filters each attributes as include
+ * or exclude filter. The evaluation of the set allows included paths and
+ * rejects excluded paths.
+ * <p/>
+ * Additionally it contains a "root" path for which the filters are evaluated.
+ * if an item has not the node addressed by the root path as ancestor, it is
+ * always excluded.
+ *
+ */
+public class PathFilterSet extends FilterSet<PathFilter> {
+
+    /**
+     * The include all item filter set
+     */
+    public static final PathFilterSet INCLUDE_ALL =
+            (PathFilterSet) new PathFilterSet().addInclude(PathFilter.ALL).seal();
+
+    /**
+     * The exclude all item filter set
+     */
+    public static final PathFilterSet EXCLUDE_ALL =
+            (PathFilterSet) new PathFilterSet().addExclude(PathFilter.ALL).seal();
+
+
+    /**
+     * specifies if only relative patters are included in this filter ser
+     */
+    private boolean onlyRelativePatterns;
+
+    /**
+     * Default constructor. initializes the root path to "/"
+     */
+    public PathFilterSet() {
+        super();
+    }
+
+    /**
+     * Creates a new path filter set and sets the respective root path
+     * @param root path
+     */
+    public PathFilterSet(String root) {
+        super(root);
+    }
+
+    /**
+     * Evaluates the filters if this set does {@link #covers(String) cover} the
+     * given item. otherwise <code>false</code> is returned.
+     * The result of the evaluation is the polarity of the last matched path.
+     * If no filter matches it returns <code>true</code>
+     * if the first filter is an exclude filter or if no filter is defined;
+     * <code>false</code> if the first filter is an include filter.
+     *
+     * @param path the path to check
+     * @return <code>true</code> if this set matches the item
+     */
+    public boolean contains(String path) {
+        if (!covers(path)) {
+            return false;
+        }
+        List<Entry<PathFilter>> entries = getEntries();
+        if (entries.isEmpty()) {
+            return true;
+        } else {
+            boolean result = !entries.get(0).include;
+            for (Entry<PathFilter> entry: entries) {
+                if (entry.filter.matches(path)) {
+                    result = entry.include;
+                }
+            }
+            return result;
+        }
+    }
+
+    @Override
+    public FilterSet seal() {
+        if (!isSealed()) {
+            super.seal();
+            onlyRelativePatterns = true;
+            for (Entry<PathFilter> entry: getEntries()) {
+                if (!entry.include || entry.filter.isAbsolute()) {
+                    onlyRelativePatterns = false;
+                    break;
+                }
+            }
+        }
+        return this;
+    }
+
+    /**
+     * Checks if this path filter set only contains entries that are relative
+     * include patterns, eg: ".* /foo.*". in this case the aggregator will use a
+     * different strategy when providing non matching leave nodes.
+     * @return <code>true</code> if only contains relative patterns
+     */
+    public boolean hasOnlyRelativePatterns() {
+        seal();
+        return onlyRelativePatterns;
+    }
+}
\ No newline at end of file

Added: jackrabbit/commons/filevault-package-maven-plugin/trunk/plugin/src/main/java/org/apache/jackrabbit/filevault/maven/packaging/impl/PlatformNameFormat.java
URL: http://svn.apache.org/viewvc/jackrabbit/commons/filevault-package-maven-plugin/trunk/plugin/src/main/java/org/apache/jackrabbit/filevault/maven/packaging/impl/PlatformNameFormat.java?rev=1808412&view=auto
==============================================================================
--- jackrabbit/commons/filevault-package-maven-plugin/trunk/plugin/src/main/java/org/apache/jackrabbit/filevault/maven/packaging/impl/PlatformNameFormat.java (added)
+++ jackrabbit/commons/filevault-package-maven-plugin/trunk/plugin/src/main/java/org/apache/jackrabbit/filevault/maven/packaging/impl/PlatformNameFormat.java Fri Sep 15 06:24:37 2017
@@ -0,0 +1,214 @@
+/*
+ * 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.jackrabbit.filevault.maven.packaging.impl;
+
+import org.codehaus.plexus.util.StringUtils;
+
+/**
+ * Implements a repository to platform name formatter. 
+ * 
+ * <p>Illegal characters a
+ * generally escaped using the url escaping format, i.e. replacing the char
+ * by a '%' hex(char) sequence. special treatment is used for the ':' char
+ * since it's used quite often as namespace prefix separator. the
+ * PREFIX ':' NAME sequence is replaced by '_' PREFIX '_' NAME. item names
+ * that would generate the same pattern are escaped with an extra leading '_'.
+ * 
+ * <p>Examples:
+ * 
+ * <pre>
+ * +-------------------+----------------------+----+----+
+ * | repository name   | platform name        | pp | sp |
+ * +-------------------+----------------------+----+----+
+ * | test.jpg          | test.jpg             | -1 | -1 |
+ * | cq:content        | _cq_content          |  2 | -1 |
+ * | cq:test_image.jpg | _cq_test_image.jpg   |  2 |  7 |
+ * | test_image.jpg    | test_image.jpg       | -1 |  4 |
+ * | _testimage.jpg    | _testimage.jpg       | -1 |  0 |
+ * | _test_image.jpg   | __test_image.jpg     | -1 |  0 |
+ * +-------------------+----------------------+----+----+
+ * | cq:test:image.jpg | _cq_test%3aimage.jpg |  2 | -1 |
+ * | _cq_:test.jpg     | __cq_%3atest.jpg     |  4 |  0 |
+ * | _cq:test.jpg      | __cq%3atest.jpg      |  3 |  0 |
+ * | cq_:test.jpg      | cq_%3atest.jpg       |  3 |  2 |
+ * +-------------------+----------------------+----+----+
+ * </pre>
+ * 
+ * note for the 2nd set of examples the cases are very rare and justify the
+ * ugly '%' escaping.
+ *
+ */
+public class PlatformNameFormat {
+
+    /**
+     * Returns the platform name for a given repository name. Unsupported
+     * characters are URL escaped (i.e. %xx).
+     *
+     * Note: Forward slashes '/' are not escaped since they never occur in a
+     * jcr name. so this method can also be used to encode paths.
+     *
+     * @param repositoryName the repository name
+     * @return the (escaped) platform name.
+     */
+    public static String getPlatformName(String repositoryName) {
+        StringBuilder buf = new StringBuilder("_");
+        boolean escapeColon = false;
+        boolean useUnderscore = false;
+        int numUnderscore = 0;
+        for (int i=0; i<repositoryName.length(); i++) {
+            char c = repositoryName.charAt(i);
+            switch (c) {
+                 case':':
+                     if (!escapeColon && i>0) {
+                         // pure prefix
+                         escapeColon = true;
+                         useUnderscore = true;
+                         numUnderscore = 2;
+                         buf.append('_');
+                     } else {
+                         buf.append("%3a");
+                     }
+                     break;
+                 case '_':
+                     if (i==0) {
+                         useUnderscore = true;
+                     }
+                     numUnderscore++;
+                     escapeColon=true;
+                     buf.append(c);
+                     break;
+                 case'\\':
+                 case'<':
+                 case'>':
+                 case'|':
+                 case'\"':
+                 case '/':
+                 case'?':
+                 case'%':
+                     buf.append('%');
+                     buf.append(Character.forDigit(c / 16, 16));
+                     buf.append(Character.forDigit(c % 16, 16));
+                     break;
+                 default:
+                     buf.append(c);
+             }
+        }
+        if (useUnderscore && numUnderscore > 1) {
+            return buf.toString();
+        } else {
+            return buf.substring(1);
+        }
+    }
+
+    /**
+     * Returns the platform path for the given repository one.
+     * @param repoPath the repository path
+     * @return the platform path
+     */
+    public static String getPlatformPath(String repoPath) {
+        String[] elems = StringUtils.split(repoPath, "/");
+        for (int i=0; i<elems.length; i++) {
+            if (elems[i].length() > 0) {
+                elems[i] = getPlatformName(elems[i]);
+            }
+        }
+        return StringUtils.join(elems, "/");
+    }
+
+    /**
+     * Returns the repository name for a given platform name.
+     *
+     * @param platformName the platform name
+     * @return the (unescaped) repository name.
+     */
+    public static String getRepositoryName(String platformName) {
+        StringBuilder buffer = new StringBuilder("_");
+        boolean firstUnderscore = false;
+        for (int i=0; i<platformName.length(); i++) {
+            char c = platformName.charAt(i);
+            if (c == '%') {
+                if (platformName.length() > i+2) {
+                    int a = Character.digit(platformName.charAt(++i), 16);
+                    int b = Character.digit(platformName.charAt(++i), 16);
+                    c = (char) (a * 16 + b);
+                }
+            } else if (c == '_') {
+                if (i==0) {
+                    firstUnderscore = true;
+                    if (platformName.length()>1) {
+                        c = platformName.charAt(++i);
+                        if (c == '_') {
+                            buffer.append('_');
+                            firstUnderscore = false;
+                        } else {
+                            buffer.append(c);
+                        }
+                    }
+                    continue;
+                } else if (firstUnderscore) {
+                    c = ':';
+                    firstUnderscore = false;
+                }
+            }
+            buffer.append(c);
+        }
+        if (firstUnderscore) {
+            // pending underscore
+            return buffer.toString();
+        } else {
+            return buffer.substring(1);
+        }
+    }
+
+    /**
+     * Returns the repository path for the given platform one.
+     * @param path the platform path
+     * @return the repository path
+     */
+    public static String getRepositoryPath(String path) {
+        String[] elems = StringUtils.split(path, "/");
+        for (int i=0; i<elems.length; i++) {
+            if (elems[i].length() > 0) {
+                elems[i] = getRepositoryName(elems[i]);
+            }
+        }
+        return StringUtils.join(elems, "/");
+    }
+
+    /**
+     * Returns the repository path for the given platform one.
+     * @param path the platform path
+     * @param respectDotDir if {@code true}, all ".dir" are removed.
+     * @return the repository path
+     */
+    public static String getRepositoryPath(String path, boolean respectDotDir) {
+        String[] elems = StringUtils.split(path, "/");
+        for (int i=0; i<elems.length; i++) {
+            if (elems[i].length() > 0) {
+                if (respectDotDir && elems[i].endsWith(".dir")) {
+                    elems[i] = getRepositoryName(elems[i].substring(0, elems[i].length() - 4));
+                } else {
+                    elems[i] = getRepositoryName(elems[i]);
+                }
+            }
+        }
+        return StringUtils.join(elems, "/");
+    }
+
+
+}
\ No newline at end of file

Added: jackrabbit/commons/filevault-package-maven-plugin/trunk/plugin/src/main/java/org/apache/jackrabbit/filevault/maven/packaging/impl/StringFilter.java
URL: http://svn.apache.org/viewvc/jackrabbit/commons/filevault-package-maven-plugin/trunk/plugin/src/main/java/org/apache/jackrabbit/filevault/maven/packaging/impl/StringFilter.java?rev=1808412&view=auto
==============================================================================
--- jackrabbit/commons/filevault-package-maven-plugin/trunk/plugin/src/main/java/org/apache/jackrabbit/filevault/maven/packaging/impl/StringFilter.java (added)
+++ jackrabbit/commons/filevault-package-maven-plugin/trunk/plugin/src/main/java/org/apache/jackrabbit/filevault/maven/packaging/impl/StringFilter.java Fri Sep 15 06:24:37 2017
@@ -0,0 +1,68 @@
+/*
+ * 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.jackrabbit.filevault.maven.packaging.impl;
+
+/**
+ * <code>StringFilter</code>...
+ */
+public class StringFilter extends DefaultPathFilter {
+
+    private String string;
+
+    public StringFilter(String pattern) {
+        super(pattern);
+    }
+
+    @Override
+    public String getPattern() {
+        if (string == null) {
+            return super.getPattern();
+        } else {
+            return string;
+        }
+    }
+    @Override
+    public void setPattern(String pattern) {
+        if (pattern.startsWith("/")) {
+            pattern = pattern.substring(1);
+            if (pattern.endsWith("/")) {
+                pattern = pattern.substring(0, pattern.length()-1);
+            }
+            super.setPattern(pattern);
+        } else {
+            string = pattern;
+        }
+    }
+
+    @Override
+    public boolean matches(String path) {
+        if (string == null) {
+            return super.matches(path);
+        } else {
+            return string.equals(path);
+        }
+    }
+
+    @Override
+    public String toString() {
+        if (string == null) {
+            return "/" + getPattern() + "/";
+        } else {
+            return getPattern();
+        }
+    }
+}
\ No newline at end of file

Added: jackrabbit/commons/filevault-package-maven-plugin/trunk/plugin/src/main/java/org/apache/jackrabbit/filevault/maven/packaging/impl/StringFilterSet.java
URL: http://svn.apache.org/viewvc/jackrabbit/commons/filevault-package-maven-plugin/trunk/plugin/src/main/java/org/apache/jackrabbit/filevault/maven/packaging/impl/StringFilterSet.java?rev=1808412&view=auto
==============================================================================
--- jackrabbit/commons/filevault-package-maven-plugin/trunk/plugin/src/main/java/org/apache/jackrabbit/filevault/maven/packaging/impl/StringFilterSet.java (added)
+++ jackrabbit/commons/filevault-package-maven-plugin/trunk/plugin/src/main/java/org/apache/jackrabbit/filevault/maven/packaging/impl/StringFilterSet.java Fri Sep 15 06:24:37 2017
@@ -0,0 +1,69 @@
+/*
+ * 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.jackrabbit.filevault.maven.packaging.impl;
+
+import java.util.List;
+
+/**
+ * <code>StringFilterSet</code>...
+ */
+public class StringFilterSet extends FilterSet<StringFilter> {
+
+    public void addEntry(String pattern) {
+        if (pattern.startsWith("~")) {
+            addExclude(new StringFilter(pattern.substring(1)));
+        } else {
+            addInclude(new StringFilter(pattern));
+        }
+    }
+
+    public void addEntries(String patterns) {
+        for (String name: patterns.split(",")) {
+            addEntry(name.trim());
+        }
+    }
+
+    public boolean contains(String path) {
+        List<Entry<StringFilter>> entries = getEntries();
+        if (entries.isEmpty()) {
+            return true;
+        } else {
+            boolean result = !entries.get(0).isInclude();
+            for (Entry<StringFilter> entry: entries) {
+                if (entry.getFilter().matches(path)) {
+                    result = entry.isInclude();
+                }
+            }
+            return result;
+        }
+    }
+
+    @Override
+    public String toString() {
+        StringBuilder builder = new StringBuilder();
+        String delim = "";
+        for (Entry<StringFilter> entry: getEntries()) {
+            builder.append(delim);
+            if (!entry.isInclude()) {
+                builder.append("~");
+            }
+            builder.append(entry.getFilter());
+            delim=",";
+        }
+        return builder.toString();
+    }
+}
\ No newline at end of file

Added: jackrabbit/commons/filevault-package-maven-plugin/trunk/plugin/src/main/resources/META-INF/m2e/lifecycle-mapping-metadata.xml
URL: http://svn.apache.org/viewvc/jackrabbit/commons/filevault-package-maven-plugin/trunk/plugin/src/main/resources/META-INF/m2e/lifecycle-mapping-metadata.xml?rev=1808412&view=auto
==============================================================================
--- jackrabbit/commons/filevault-package-maven-plugin/trunk/plugin/src/main/resources/META-INF/m2e/lifecycle-mapping-metadata.xml (added)
+++ jackrabbit/commons/filevault-package-maven-plugin/trunk/plugin/src/main/resources/META-INF/m2e/lifecycle-mapping-metadata.xml Fri Sep 15 06:24:37 2017
@@ -0,0 +1,30 @@
+<!--
+  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.
+  -->
+<lifecycleMappingMetadata>
+    <pluginExecutions>
+        <pluginExecution>
+            <pluginExecutionFilter>
+                <goals>
+                    <goal>check-signature</goal>
+                </goals>
+            </pluginExecutionFilter>
+            <action>
+                <ignore/>
+            </action>
+        </pluginExecution>
+    </pluginExecutions>
+</lifecycleMappingMetadata>
\ No newline at end of file

Added: jackrabbit/commons/filevault-package-maven-plugin/trunk/plugin/src/main/resources/META-INF/plexus/components.xml
URL: http://svn.apache.org/viewvc/jackrabbit/commons/filevault-package-maven-plugin/trunk/plugin/src/main/resources/META-INF/plexus/components.xml?rev=1808412&view=auto
==============================================================================
--- jackrabbit/commons/filevault-package-maven-plugin/trunk/plugin/src/main/resources/META-INF/plexus/components.xml (added)
+++ jackrabbit/commons/filevault-package-maven-plugin/trunk/plugin/src/main/resources/META-INF/plexus/components.xml Fri Sep 15 06:24:37 2017
@@ -0,0 +1,63 @@
+<!--
+  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.
+  -->
+<component-set>
+    <components>
+        <component>
+            <role>org.apache.maven.lifecycle.mapping.LifecycleMapping</role>
+            <role-hint>content-package</role-hint>
+            <implementation>org.apache.maven.lifecycle.mapping.DefaultLifecycleMapping</implementation>
+            <configuration>
+                <lifecycles>
+                    <lifecycle>
+                        <id>default</id>
+                        <!-- START SNIPPET: bundle-lifecycle -->
+                        <phases>
+                            <process-resources>org.apache.maven.plugins:maven-resources-plugin:resources
+                            </process-resources>
+                            <compile>org.apache.maven.plugins:maven-compiler-plugin:compile</compile>
+                            <process-classes>
+                                org.apache.jackrabbit:filevault-package-maven-plugin:check-signature,
+                                org.apache.jackrabbit:filevault-package-maven-plugin:analyze-classes
+                            </process-classes>
+                            <process-test-resources>org.apache.maven.plugins:maven-resources-plugin:testResources
+                            </process-test-resources>
+                            <test-compile>org.apache.maven.plugins:maven-compiler-plugin:testCompile</test-compile>
+                            <test>org.apache.maven.plugins:maven-surefire-plugin:test</test>
+                            <package>org.apache.jackrabbit:filevault-package-maven-plugin:package</package>
+                            <install>org.apache.maven.plugins:maven-install-plugin:install</install>
+                            <deploy>org.apache.maven.plugins:maven-deploy-plugin:deploy</deploy>
+                        </phases>
+                        <!-- END SNIPPET: bundle-lifecycle -->
+                    </lifecycle>
+                </lifecycles>
+            </configuration>
+        </component>
+        <component>
+            <role>org.apache.maven.artifact.handler.ArtifactHandler</role>
+            <role-hint>content-package</role-hint>
+            <implementation>org.apache.maven.artifact.handler.DefaultArtifactHandler</implementation>
+            <configuration>
+                <type>content-package</type>
+                <includesDependencies>true</includesDependencies>
+                <language>java</language>
+                <extension>zip</extension>
+                <packaging>content-package</packaging>
+                <addedToClasspath>true</addedToClasspath>
+            </configuration>
+        </component>
+    </components>
+</component-set>

Added: jackrabbit/commons/filevault-package-maven-plugin/trunk/plugin/src/main/resources/vault/config.xml
URL: http://svn.apache.org/viewvc/jackrabbit/commons/filevault-package-maven-plugin/trunk/plugin/src/main/resources/vault/config.xml?rev=1808412&view=auto
==============================================================================
--- jackrabbit/commons/filevault-package-maven-plugin/trunk/plugin/src/main/resources/vault/config.xml (added)
+++ jackrabbit/commons/filevault-package-maven-plugin/trunk/plugin/src/main/resources/vault/config.xml Fri Sep 15 06:24:37 2017
@@ -0,0 +1,93 @@
+<!--
+  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.
+  -->
+<vaultfs version="1.1">
+    <!--
+        Defines the content aggregation. The order of the defined aggregates
+        is important for finding the correct aggregator.
+    -->
+    <aggregates>
+        <!--
+            Defines an aggregate that handles nt:file and nt:resource nodes.
+        -->
+        <aggregate type="file" title="File Aggregate"/>
+
+        <!--
+            Defines an aggregate that handles file/folder like nodes. It matches
+            all nt:hierarchyNode nodes that have or define a jcr:content
+            child node and excludes child nodes that are nt:hierarchyNodes.
+        -->
+        <aggregate type="filefolder" title="File/Folder Aggregate"/>
+
+        <!--
+            Defines an aggregate that handles nt:nodeType nodes and serializes
+            them into .cnd notation.
+        -->
+        <aggregate type="nodetype" title="Node Type Aggregate" />
+
+        <!--
+            Defines an aggregate that defines full coverage for certain node
+            types that cannot be covered by the default aggregator.
+        -->
+        <aggregate type="full" title="Full Coverage Aggregate">
+            <matches>
+                <include nodeType="rep:AccessControl" respectSupertype="true" />
+                <include nodeType="cq:Widget" respectSupertype="true" />
+                <include nodeType="cq:WidgetCollection" respectSupertype="true" />
+                <include nodeType="cq:EditConfig" respectSupertype="true" />
+                <include nodeType="cq:WorkflowModel" respectSupertype="true" />
+                <include nodeType="vlt:FullCoverage" respectSupertype="true" />
+                <include nodeType="mix:language" respectSupertype="true" />
+                <include nodeType="sling:OsgiConfig" respectSupertype="true" />
+            </matches>
+        </aggregate>
+
+        <!--
+            Defines an aggregate that handles nt:folder like nodes.
+        -->
+        <aggregate type="generic" title="Folder Aggregate">
+            <matches>
+                <include nodeType="nt:folder" respectSupertype="true" />
+            </matches>
+            <contains>
+                <exclude isNode="true" />
+            </contains>
+        </aggregate>
+
+        <!--
+            Defines the default aggregate
+        -->
+        <aggregate type="generic" title="Default Aggregator" isDefault="true">
+            <contains>
+                <exclude nodeType="nt:hierarchyNode" respectSupertype="true" />
+            </contains>
+            <matches>
+                <!-- all -->
+            </matches>
+        </aggregate>
+
+    </aggregates>
+
+    <!--
+      defines the input handlers
+    -->
+    <handlers>
+        <handler type="folder"/>
+        <handler type="file"/>
+        <handler type="nodetype"/>
+        <handler type="generic"/>
+    </handlers>
+</vaultfs>
\ No newline at end of file

Added: jackrabbit/commons/filevault-package-maven-plugin/trunk/plugin/src/main/resources/vault/settings.xml
URL: http://svn.apache.org/viewvc/jackrabbit/commons/filevault-package-maven-plugin/trunk/plugin/src/main/resources/vault/settings.xml?rev=1808412&view=auto
==============================================================================
--- jackrabbit/commons/filevault-package-maven-plugin/trunk/plugin/src/main/resources/vault/settings.xml (added)
+++ jackrabbit/commons/filevault-package-maven-plugin/trunk/plugin/src/main/resources/vault/settings.xml Fri Sep 15 06:24:37 2017
@@ -0,0 +1,21 @@
+<?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.
+  -->
+<vault version="1.0">
+  <ignore name=".svn"/>
+  <ignore name=".DS_Store"/>
+</vault>
\ No newline at end of file