You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by cz...@apache.org on 2017/05/24 13:58:16 UTC

svn commit: r1796063 - in /sling/whiteboard/cziegeler/provisioning-model: ./ src/main/java/org/apache/sling/feature/ src/main/java/org/apache/sling/provisioning/model/ src/main/java/org/apache/sling/provisioning/model/io/ src/test/java/org/apache/sling...

Author: cziegeler
Date: Wed May 24 13:58:16 2017
New Revision: 1796063

URL: http://svn.apache.org/viewvc?rev=1796063&view=rev
Log:
Initial version of a feature model

Added:
    sling/whiteboard/cziegeler/provisioning-model/src/main/java/org/apache/sling/feature/
    sling/whiteboard/cziegeler/provisioning-model/src/main/java/org/apache/sling/feature/AbstractArtifact.java   (with props)
    sling/whiteboard/cziegeler/provisioning-model/src/main/java/org/apache/sling/feature/ArtifactId.java   (with props)
    sling/whiteboard/cziegeler/provisioning-model/src/main/java/org/apache/sling/feature/Bundle.java   (with props)
    sling/whiteboard/cziegeler/provisioning-model/src/main/java/org/apache/sling/feature/Capability.java   (with props)
    sling/whiteboard/cziegeler/provisioning-model/src/main/java/org/apache/sling/feature/Commentable.java   (with props)
    sling/whiteboard/cziegeler/provisioning-model/src/main/java/org/apache/sling/feature/Configuration.java   (with props)
    sling/whiteboard/cziegeler/provisioning-model/src/main/java/org/apache/sling/feature/Feature.java   (with props)
    sling/whiteboard/cziegeler/provisioning-model/src/main/java/org/apache/sling/feature/Include.java   (with props)
    sling/whiteboard/cziegeler/provisioning-model/src/main/java/org/apache/sling/feature/KeyValueMap.java   (with props)
    sling/whiteboard/cziegeler/provisioning-model/src/main/java/org/apache/sling/feature/Requirement.java   (with props)
    sling/whiteboard/cziegeler/provisioning-model/src/main/java/org/apache/sling/feature/Traceable.java   (with props)
    sling/whiteboard/cziegeler/provisioning-model/src/main/java/org/apache/sling/feature/Version.java   (with props)
    sling/whiteboard/cziegeler/provisioning-model/src/main/java/org/apache/sling/feature/package-info.java   (with props)
    sling/whiteboard/cziegeler/provisioning-model/src/test/java/org/apache/sling/feature/
    sling/whiteboard/cziegeler/provisioning-model/src/test/java/org/apache/sling/feature/VersionTest.java   (with props)
Removed:
    sling/whiteboard/cziegeler/provisioning-model/src/test/java/org/apache/sling/provisioning/
Modified:
    sling/whiteboard/cziegeler/provisioning-model/pom.xml
    sling/whiteboard/cziegeler/provisioning-model/src/main/java/org/apache/sling/provisioning/model/ModelResolveUtility.java
    sling/whiteboard/cziegeler/provisioning-model/src/main/java/org/apache/sling/provisioning/model/io/ModelWriter.java

Modified: sling/whiteboard/cziegeler/provisioning-model/pom.xml
URL: http://svn.apache.org/viewvc/sling/whiteboard/cziegeler/provisioning-model/pom.xml?rev=1796063&r1=1796062&r2=1796063&view=diff
==============================================================================
--- sling/whiteboard/cziegeler/provisioning-model/pom.xml (original)
+++ sling/whiteboard/cziegeler/provisioning-model/pom.xml Wed May 24 13:58:16 2017
@@ -30,6 +30,10 @@
         A feature describes an OSGi system
     </description>
 
+    <properties>
+        <sling.java.version>8</sling.java.version>
+    </properties>
+
     <scm>
         <connection>scm:svn:http://svn.apache.org/repos/asf/sling/trunk/tooling/support/feature</connection>
         <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/trunk/tooling/support/feature</developerConnection>

Added: sling/whiteboard/cziegeler/provisioning-model/src/main/java/org/apache/sling/feature/AbstractArtifact.java
URL: http://svn.apache.org/viewvc/sling/whiteboard/cziegeler/provisioning-model/src/main/java/org/apache/sling/feature/AbstractArtifact.java?rev=1796063&view=auto
==============================================================================
--- sling/whiteboard/cziegeler/provisioning-model/src/main/java/org/apache/sling/feature/AbstractArtifact.java (added)
+++ sling/whiteboard/cziegeler/provisioning-model/src/main/java/org/apache/sling/feature/AbstractArtifact.java Wed May 24 13:58:16 2017
@@ -0,0 +1,87 @@
+/*
+ * 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.sling.feature;
+
+/**
+ * Each abstract has an id
+ */
+public class AbstractArtifact
+    extends Commentable
+    implements Comparable {
+
+    private final ArtifactId id;
+
+    /** Artifact metadata. */
+    private final KeyValueMap<String> metadata = new KeyValueMap<>();
+
+    /**
+     * Construct a new artifact
+     * @param id The id of the artifact.
+     * @throws IllegalArgumentException If id is {@code null}.
+     */
+    public AbstractArtifact(final ArtifactId id) {
+        if ( id == null ) {
+            throw new IllegalArgumentException("id must not be null.");
+        }
+        this.id = id;
+    }
+
+    /**
+     * Get the id of the artifact.
+     * @return The id.
+     */
+    public ArtifactId getId() {
+        return this.id;
+    }
+
+    /**
+     * Get the metadata of the artifact.
+     * The metadata can be modified.
+     * @return The metadata.
+     */
+    public KeyValueMap<String> getMetadata() {
+        return this.metadata;
+    }
+
+    @Override
+    public int compareTo(final Object o) {
+        return this.id.compareTo(((AbstractArtifact)o).id);
+    }
+
+    @Override
+    public int hashCode() {
+        return this.id.hashCode();
+    }
+
+    @Override
+    public boolean equals(final Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (obj == null || getClass() != obj.getClass()) {
+            return false;
+        }
+        return this.id.equals(((AbstractArtifact)obj).id);
+    }
+
+    @Override
+    public String toString() {
+        return "Artifact [id=" + id.toMvnUrl().substring(4)
+                + ( this.getLocation() != null ? ", location=" + this.getLocation() : "")
+                + "]";
+    }
+}

Propchange: sling/whiteboard/cziegeler/provisioning-model/src/main/java/org/apache/sling/feature/AbstractArtifact.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: sling/whiteboard/cziegeler/provisioning-model/src/main/java/org/apache/sling/feature/AbstractArtifact.java
------------------------------------------------------------------------------
    svn:keywords = author date id revision rev url

Added: sling/whiteboard/cziegeler/provisioning-model/src/main/java/org/apache/sling/feature/ArtifactId.java
URL: http://svn.apache.org/viewvc/sling/whiteboard/cziegeler/provisioning-model/src/main/java/org/apache/sling/feature/ArtifactId.java?rev=1796063&view=auto
==============================================================================
--- sling/whiteboard/cziegeler/provisioning-model/src/main/java/org/apache/sling/feature/ArtifactId.java (added)
+++ sling/whiteboard/cziegeler/provisioning-model/src/main/java/org/apache/sling/feature/ArtifactId.java Wed May 24 13:58:16 2017
@@ -0,0 +1,242 @@
+/*
+ * 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.sling.feature;
+
+/**
+ * An artifact identifier.
+ * An artifact is described by it's Apache Maven coordinates consisting of group id, artifact id, and version.
+ * In addition, the classifier and type can be specified as well. If no type is specified, "jar" is assumed.
+ */
+public class ArtifactId extends Commentable implements Comparable<ArtifactId> {
+
+    /** The required group id. */
+    private final String groupId;
+    /** The required artifact id. */
+    private final String artifactId;
+    /** The required version. */
+    private final Version version;
+    /** The optional classifier. */
+    private final String classifier;
+    /** The optional type. */
+    private final String type;
+
+    /**
+     * Create a new artifact object
+     * @param groupId   The group id (required)
+     * @param artifactId   The artifact id (required)
+     * @param version The version (required)
+     * @param classifier The classifier (optional)
+     * @param type The type/extension (optional, defaults to jar)
+     * @throws IllegalArgumentException If group id, artifact id or version are {@code null} or if
+     *         the version is not a valid version.
+     */
+    public ArtifactId(final String groupId,
+            final String artifactId,
+            final String version,
+            final String classifier,
+            final String type) {
+        if ( groupId == null || artifactId == null || version == null ) {
+            throw new IllegalArgumentException("Argument must not be null");
+        }
+        this.groupId = groupId;
+        this.artifactId = artifactId;
+        this.version = new Version(version);
+        if ( "bundle".equals(type) || type == null || type.isEmpty() ) {
+            this.type = "jar";
+        } else {
+            this.type = type;
+        }
+        if ( classifier != null && classifier.isEmpty() ) {
+            this.classifier = null;
+        } else {
+            this.classifier = classifier;
+        }
+    }
+
+    /**
+     * Create a new artifact from a maven url,
+     * 'mvn:' [ repository-url '!' ] group-id '/' artifact-id [ '/' [version] [ '/' [type] [ '/' classifier ] ] ] ]
+     * @param url The url
+     * @return A new artifact
+     * @throws IllegalArgumentException If the url is not valid
+     */
+    public static ArtifactId fromMvnUrl(final String url) {
+        if ( url == null || !url.startsWith("mvn:") ) {
+            throw new IllegalArgumentException("Invalid mvn url: " + url);
+        }
+        final String content = url.substring(4);
+        // ignore repository url
+        int pos = content.indexOf('!');
+        if ( pos != -1 ) {
+            throw new IllegalArgumentException("Repository url is not supported for Maven artifacts at the moment.");
+        }
+        final String coordinates = (pos == -1 ? content : content.substring(pos + 1));
+        String gId = null;
+        String aId = null;
+        String version = null;
+        String type = null;
+        String classifier = null;
+        int part = 0;
+        String value = coordinates;
+        while ( value != null ) {
+            pos = value.indexOf('/');
+            final String current;
+            if ( pos == -1 ) {
+                current = value;
+                value = null;
+            } else {
+                if ( pos == 0 ) {
+                    current = null;
+                } else {
+                    current = value.substring(0, pos);
+                }
+                value = value.substring(pos + 1);
+            }
+            if ( current != null ) {
+                if ( part == 0 ) {
+                    gId = current;
+                } else if ( part == 1 ) {
+                    aId = current;
+                } else if ( part == 2 ) {
+                    version = current;
+                } else if ( part == 3 ) {
+                    type = current;
+                } else if ( part == 4 ) {
+                    classifier = current;
+                }
+            }
+            part++;
+        }
+        return new ArtifactId(gId, aId, version, classifier, type);
+    }
+
+    @Override
+    public int hashCode() {
+        return toMvnUrl().hashCode();
+    }
+
+    @Override
+    public boolean equals(Object o) {
+        if(o == null) return false;
+        if(!(o instanceof ArtifactId)) return false;
+        return toMvnUrl().equals(((ArtifactId)o).toMvnUrl());
+    }
+
+    @Override
+    public int compareTo(final ArtifactId o) {
+        if(o == null) return 1;
+        return toMvnUrl().compareTo(o.toMvnUrl());
+    }
+
+    /**
+     * Return a mvn url
+     * @return A mvn url
+     * @see #fromMvnUrl(String)
+     */
+    public String toMvnUrl() {
+        final StringBuilder sb = new StringBuilder("mvn:");
+        sb.append(this.groupId);
+        sb.append('/');
+        sb.append(this.artifactId);
+        sb.append('/');
+        sb.append(this.version);
+        if ( this.classifier != null || !"jar".equals(this.type)) {
+            sb.append('/');
+            sb.append(this.type);
+            if ( this.classifier != null ) {
+                sb.append('/');
+                sb.append(this.classifier);
+            }
+        }
+        return sb.toString();
+    }
+
+    /**
+     * Return the group id.
+     * @return The group id.
+     */
+    public String getGroupId() {
+        return groupId;
+    }
+
+    /**
+     * Return the artifact id.
+     * @return The artifact id.
+     */
+    public String getArtifactId() {
+        return artifactId;
+    }
+
+    /**
+     * Return the version.
+     * @return The version.
+     */
+    public Version getVersion() {
+        return version;
+    }
+
+    /**
+     * Return the optional classifier.
+     * @return The classifier or null.
+     */
+    public String getClassifier() {
+        return classifier;
+    }
+
+    /**
+     * Return the type.
+     * @return The type.
+     */
+    public String getType() {
+        return type;
+    }
+
+    /**
+     * Create a Maven like relative repository path.
+     * @return A relative repository path.
+     */
+    public String getRepositoryPath() {
+        final StringBuilder sb = new StringBuilder();
+        sb.append(groupId.replace('.', '/'));
+        sb.append('/');
+        sb.append(artifactId);
+        sb.append('/');
+        sb.append(version);
+        sb.append('/');
+        sb.append(artifactId);
+        sb.append('-');
+        sb.append(version);
+        if ( classifier != null ) {
+            sb.append('-');
+            sb.append(classifier);
+        }
+        sb.append('.');
+        sb.append(type);
+        return sb.toString();
+    }
+
+    @Override
+    public String toString() {
+        return "Artifact [groupId=" + groupId
+                + ", artifactId=" + artifactId
+                + ", version=" + version
+                + ", classifier=" + classifier
+                + ", type=" + type
+                + ( this.getLocation() != null ? ", location=" + this.getLocation() : "")
+                + "]";
+    }
+}

Propchange: sling/whiteboard/cziegeler/provisioning-model/src/main/java/org/apache/sling/feature/ArtifactId.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: sling/whiteboard/cziegeler/provisioning-model/src/main/java/org/apache/sling/feature/ArtifactId.java
------------------------------------------------------------------------------
    svn:keywords = author date id revision rev url

Added: sling/whiteboard/cziegeler/provisioning-model/src/main/java/org/apache/sling/feature/Bundle.java
URL: http://svn.apache.org/viewvc/sling/whiteboard/cziegeler/provisioning-model/src/main/java/org/apache/sling/feature/Bundle.java?rev=1796063&view=auto
==============================================================================
--- sling/whiteboard/cziegeler/provisioning-model/src/main/java/org/apache/sling/feature/Bundle.java (added)
+++ sling/whiteboard/cziegeler/provisioning-model/src/main/java/org/apache/sling/feature/Bundle.java Wed May 24 13:58:16 2017
@@ -0,0 +1,65 @@
+/*
+ * 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.sling.feature;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * A bundle consists of
+ * <ul>
+ *   <li>An id
+ *   <li>metadata
+ *   <li>configurations
+ *   <li>start level
+ * </ul>
+ */
+public class Bundle
+    extends AbstractArtifact {
+
+    private final List<Configuration> configurations = new ArrayList<>();
+
+    private int startLevel = 1;
+
+    /**
+     * Construct a new bundle.
+     * @param id The id of the bundle.
+     * @throws IllegalArgumentException If id is {@code null}.
+     */
+    public Bundle(final ArtifactId id) {
+        super(id);
+    }
+
+    public List<Configuration> getConfigurations() {
+        return this.configurations;
+    }
+
+    public int getStartLevel() {
+        return startLevel;
+    }
+
+    public void setStartLevel(int startLevel) {
+        this.startLevel = startLevel;
+    }
+
+    @Override
+    public String toString() {
+        return "Bundle [id=" + getId().toMvnUrl().substring(4)
+                + ( this.getLocation() != null ? ", location=" + this.getLocation() : "")
+                + "]";
+    }
+}

Propchange: sling/whiteboard/cziegeler/provisioning-model/src/main/java/org/apache/sling/feature/Bundle.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: sling/whiteboard/cziegeler/provisioning-model/src/main/java/org/apache/sling/feature/Bundle.java
------------------------------------------------------------------------------
    svn:keywords = author date id revision rev url

Added: sling/whiteboard/cziegeler/provisioning-model/src/main/java/org/apache/sling/feature/Capability.java
URL: http://svn.apache.org/viewvc/sling/whiteboard/cziegeler/provisioning-model/src/main/java/org/apache/sling/feature/Capability.java?rev=1796063&view=auto
==============================================================================
--- sling/whiteboard/cziegeler/provisioning-model/src/main/java/org/apache/sling/feature/Capability.java (added)
+++ sling/whiteboard/cziegeler/provisioning-model/src/main/java/org/apache/sling/feature/Capability.java Wed May 24 13:58:16 2017
@@ -0,0 +1,42 @@
+/*
+ * 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.sling.feature;
+
+public class Capability extends Commentable {
+
+    private final String namespace;
+
+    private final KeyValueMap<String> attributes = new KeyValueMap<>();
+
+    private final KeyValueMap<String> directives = new KeyValueMap<>();
+
+    public Capability(final String namespace) {
+        this.namespace = namespace;
+    }
+
+    public String getNamespace() {
+        return namespace;
+    }
+
+    public KeyValueMap<String> getAttributes() {
+        return attributes;
+    }
+
+    public KeyValueMap<String> getDirectives() {
+        return directives;
+    }
+}

Propchange: sling/whiteboard/cziegeler/provisioning-model/src/main/java/org/apache/sling/feature/Capability.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: sling/whiteboard/cziegeler/provisioning-model/src/main/java/org/apache/sling/feature/Capability.java
------------------------------------------------------------------------------
    svn:keywords = author date id revision rev url

Added: sling/whiteboard/cziegeler/provisioning-model/src/main/java/org/apache/sling/feature/Commentable.java
URL: http://svn.apache.org/viewvc/sling/whiteboard/cziegeler/provisioning-model/src/main/java/org/apache/sling/feature/Commentable.java?rev=1796063&view=auto
==============================================================================
--- sling/whiteboard/cziegeler/provisioning-model/src/main/java/org/apache/sling/feature/Commentable.java (added)
+++ sling/whiteboard/cziegeler/provisioning-model/src/main/java/org/apache/sling/feature/Commentable.java Wed May 24 13:58:16 2017
@@ -0,0 +1,49 @@
+/*
+ * 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.sling.feature;
+
+/**
+ * A commentable has a comment and a location.
+ * Both are optional.
+ */
+public abstract class Commentable extends Traceable {
+
+    /** The comment. */
+    private String comment;
+
+    /**
+     * Get the comment.
+     * @return The comment or {@code null}.
+     */
+    public String getComment() {
+        return this.comment;
+    }
+
+    /**
+     * Set the comment.
+     * @param value The new comment.
+     */
+    public void setComment(final String value) {
+        this.comment = value;
+    }
+
+    @Override
+    public String toString() {
+        return "Commentable [location=" + this.getLocation() + ", comment=" + comment + "]";
+    }
+}
+

Propchange: sling/whiteboard/cziegeler/provisioning-model/src/main/java/org/apache/sling/feature/Commentable.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: sling/whiteboard/cziegeler/provisioning-model/src/main/java/org/apache/sling/feature/Commentable.java
------------------------------------------------------------------------------
    svn:keywords = author date id revision rev url

Added: sling/whiteboard/cziegeler/provisioning-model/src/main/java/org/apache/sling/feature/Configuration.java
URL: http://svn.apache.org/viewvc/sling/whiteboard/cziegeler/provisioning-model/src/main/java/org/apache/sling/feature/Configuration.java?rev=1796063&view=auto
==============================================================================
--- sling/whiteboard/cziegeler/provisioning-model/src/main/java/org/apache/sling/feature/Configuration.java (added)
+++ sling/whiteboard/cziegeler/provisioning-model/src/main/java/org/apache/sling/feature/Configuration.java Wed May 24 13:58:16 2017
@@ -0,0 +1,108 @@
+/*
+ * 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.sling.feature;
+
+import java.util.Dictionary;
+import java.util.Hashtable;
+
+
+/**
+ * A configuration has either
+ * - a pid
+ * - or a factory pid and an alias (pid)
+ * and properties.
+ */
+public class Configuration
+    extends Commentable
+    implements Comparable<Configuration> {
+
+    /** The pid. */
+    private final String pid;
+
+    /** The factory pid. */
+    private final String factoryPid;
+
+    /** The properties. */
+    private final Dictionary<String, Object> properties = new Hashtable<>();
+
+    /**
+     * Create a new configuration
+     * @param pid The pid or alias for a factory pid
+     * @param factoryPid The factory pid
+     */
+    public Configuration(final String pid, final String factoryPid) {
+        this.pid = (pid != null ? pid.trim() : null);
+        this.factoryPid = (factoryPid != null ? factoryPid.trim() : null);
+    }
+
+    private int compareString(final String a, final String b) {
+        if ( a == null ) {
+            if ( b == null ) {
+                return 0;
+            }
+            return -1;
+        }
+        if ( b == null ) {
+            return 1;
+        }
+        return a.compareTo(b);
+    }
+
+    @Override
+    public int compareTo(final Configuration o) {
+        int result = compareString(this.factoryPid, o.factoryPid);
+        if ( result == 0 ) {
+            result = compareString(this.pid, o.pid);
+        }
+        return result;
+    }
+
+
+    /**
+     * Get the pid.
+     * If this is a factory configuration, it returns the alias for the configuration
+     * @return The pid.
+     */
+    public String getPid() {
+        return this.pid;
+    }
+
+    /**
+     * Return the factory pid
+     * @return The factory pid or null.
+     */
+    public String getFactoryPid() {
+        return this.factoryPid;
+    }
+
+    /**
+     * Get all properties of the configuration.
+     * @return The properties
+     */
+    public Dictionary<String, Object> getProperties() {
+        return this.properties;
+    }
+
+    @Override
+    public String toString() {
+        return "Configuration [pid=" + pid
+                + ", factoryPid=" + factoryPid
+                + ", properties=" + properties
+                + ( this.getLocation() != null ? ", location=" + this.getLocation() : "")
+                + "]";
+    }
+}

Propchange: sling/whiteboard/cziegeler/provisioning-model/src/main/java/org/apache/sling/feature/Configuration.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: sling/whiteboard/cziegeler/provisioning-model/src/main/java/org/apache/sling/feature/Configuration.java
------------------------------------------------------------------------------
    svn:keywords = author date id revision rev url

Added: sling/whiteboard/cziegeler/provisioning-model/src/main/java/org/apache/sling/feature/Feature.java
URL: http://svn.apache.org/viewvc/sling/whiteboard/cziegeler/provisioning-model/src/main/java/org/apache/sling/feature/Feature.java?rev=1796063&view=auto
==============================================================================
--- sling/whiteboard/cziegeler/provisioning-model/src/main/java/org/apache/sling/feature/Feature.java (added)
+++ sling/whiteboard/cziegeler/provisioning-model/src/main/java/org/apache/sling/feature/Feature.java Wed May 24 13:58:16 2017
@@ -0,0 +1,92 @@
+/*
+ * 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.sling.feature;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * A feature consists of
+ * <ul>
+ *   <li>A unique id {@link ArtifactId}
+ *   <li>Bundles
+ *   <li>Configurations
+ *   <li>framework properties
+ *   <li>requirements and capabilities
+ *   <li>Includes
+ * </ul>
+ */
+public class Feature
+    extends AbstractArtifact {
+
+    private final List<Bundle> bundles = new ArrayList<>();
+
+    private final List<Configuration> configurations = new ArrayList<>();
+
+    private final KeyValueMap<String> frameworkProperties = new KeyValueMap<>();
+
+    private final List<Requirement> requirements = new ArrayList<>();
+
+    private final List<Capability> capabilities = new ArrayList<>();
+
+    private final List<Include> includes = new ArrayList<>();
+
+    /**
+     * Construct a new feature.
+     * @param id The id of the feature.
+     * @throws IllegalArgumentException If id is {@code null}.
+     */
+    public Feature(final ArtifactId id) {
+        super(id);
+    }
+
+    /**
+     * Get the list of bundles.
+     * The list can be modified
+     * @return The list of bundles.
+     */
+    public List<Bundle> getBundles() {
+        return this.bundles;
+    }
+
+    public List<Configuration> getConfigurations() {
+        return this.configurations;
+    }
+
+    public KeyValueMap<String> getFrameworkProperties() {
+        return this.frameworkProperties;
+    }
+
+    public List<Requirement> getRequirements() {
+        return requirements;
+    }
+
+    public List<Capability> getCapabilities() {
+        return capabilities;
+    }
+
+    public List<Include> getIncludes() {
+        return includes;
+    }
+
+    @Override
+    public String toString() {
+        return "Feature [id=" + this.getId().toMvnUrl().substring(4)
+                + ( this.getLocation() != null ? ", location=" + this.getLocation() : "")
+                + "]";
+    }
+}

Propchange: sling/whiteboard/cziegeler/provisioning-model/src/main/java/org/apache/sling/feature/Feature.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: sling/whiteboard/cziegeler/provisioning-model/src/main/java/org/apache/sling/feature/Feature.java
------------------------------------------------------------------------------
    svn:keywords = author date id revision rev url

Added: sling/whiteboard/cziegeler/provisioning-model/src/main/java/org/apache/sling/feature/Include.java
URL: http://svn.apache.org/viewvc/sling/whiteboard/cziegeler/provisioning-model/src/main/java/org/apache/sling/feature/Include.java?rev=1796063&view=auto
==============================================================================
--- sling/whiteboard/cziegeler/provisioning-model/src/main/java/org/apache/sling/feature/Include.java (added)
+++ sling/whiteboard/cziegeler/provisioning-model/src/main/java/org/apache/sling/feature/Include.java Wed May 24 13:58:16 2017
@@ -0,0 +1,40 @@
+/*
+ * 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.sling.feature;
+
+/**
+ * A include is an inclusion of a feature
+ */
+public class Include
+    extends AbstractArtifact {
+
+    /**
+     * Construct a new Include.
+     * @param id The id of the feature.
+     * @throws IllegalArgumentException If id is {@code null}.
+     */
+    public Include(final ArtifactId id) {
+        super(id);
+    }
+
+    @Override
+    public String toString() {
+        return "Include [id=" + getId().toMvnUrl().substring(4)
+                + ( this.getLocation() != null ? ", location=" + this.getLocation() : "")
+                + "]";
+    }
+}

Propchange: sling/whiteboard/cziegeler/provisioning-model/src/main/java/org/apache/sling/feature/Include.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: sling/whiteboard/cziegeler/provisioning-model/src/main/java/org/apache/sling/feature/Include.java
------------------------------------------------------------------------------
    svn:keywords = author date id revision rev url

Added: sling/whiteboard/cziegeler/provisioning-model/src/main/java/org/apache/sling/feature/KeyValueMap.java
URL: http://svn.apache.org/viewvc/sling/whiteboard/cziegeler/provisioning-model/src/main/java/org/apache/sling/feature/KeyValueMap.java?rev=1796063&view=auto
==============================================================================
--- sling/whiteboard/cziegeler/provisioning-model/src/main/java/org/apache/sling/feature/KeyValueMap.java (added)
+++ sling/whiteboard/cziegeler/provisioning-model/src/main/java/org/apache/sling/feature/KeyValueMap.java Wed May 24 13:58:16 2017
@@ -0,0 +1,101 @@
+/*
+ * 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.sling.feature;
+
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.TreeMap;
+
+/**
+ * Helper class to hold key value pairs.
+ */
+public class KeyValueMap<T>
+    extends Commentable
+    implements Iterable<Map.Entry<String, T>> {
+
+    /** The map holding the actual key value pairs. */
+    private final Map<String, T> properties = new TreeMap<>();
+
+    /**
+     * Get an item from the map.
+     * @param key The key of the item.
+     * @return The item or {@code null}.
+     */
+    public T get(final String key) {
+        return this.properties.get(key);
+    }
+
+    /**
+     * Put an item in the map
+     * @param key The key of the item.
+     * @param value The value
+     */
+    public void put(final String key, final T value) {
+        this.properties.put(key, value);
+    }
+
+    /**
+     * Remove an item from the map
+     * @param key The key of the item.
+     * @return The previously stored value for the key or {@code null}.
+     */
+    public T remove(final String key) {
+        return this.properties.remove(key);
+    }
+
+    /**
+     * Put all items from the other map in this map
+     * @param map The other map
+     */
+    public void putAll(final KeyValueMap<T> map) {
+        this.properties.putAll(map.properties);
+    }
+
+    @Override
+    public Iterator<Entry<String, T>> iterator() {
+        return this.properties.entrySet().iterator();
+    }
+
+    /**
+     * Check whether this map is empty.
+     * @return {@code true} if the map is empty.
+     */
+    public boolean isEmpty() {
+        return this.properties.isEmpty();
+    }
+
+    @Override
+    public String toString() {
+        return properties.toString();
+    }
+
+    /**
+     * Get the size of the map.
+     * @return The size of the map.
+     */
+    public int size() {
+        return this.properties.size();
+    }
+
+    /**
+     * Clear the map
+     */
+    public void clear() {
+        this.properties.clear();
+    }
+}

Propchange: sling/whiteboard/cziegeler/provisioning-model/src/main/java/org/apache/sling/feature/KeyValueMap.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: sling/whiteboard/cziegeler/provisioning-model/src/main/java/org/apache/sling/feature/KeyValueMap.java
------------------------------------------------------------------------------
    svn:keywords = author date id revision rev url

Added: sling/whiteboard/cziegeler/provisioning-model/src/main/java/org/apache/sling/feature/Requirement.java
URL: http://svn.apache.org/viewvc/sling/whiteboard/cziegeler/provisioning-model/src/main/java/org/apache/sling/feature/Requirement.java?rev=1796063&view=auto
==============================================================================
--- sling/whiteboard/cziegeler/provisioning-model/src/main/java/org/apache/sling/feature/Requirement.java (added)
+++ sling/whiteboard/cziegeler/provisioning-model/src/main/java/org/apache/sling/feature/Requirement.java Wed May 24 13:58:16 2017
@@ -0,0 +1,42 @@
+/*
+ * 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.sling.feature;
+
+public class Requirement extends Commentable {
+
+    private final String namespace;
+
+    private final KeyValueMap<String> attributes = new KeyValueMap<>();
+
+    private final KeyValueMap<String> directives = new KeyValueMap<>();
+
+    public Requirement(final String namespace) {
+        this.namespace = namespace;
+    }
+
+    public String getNamespace() {
+        return namespace;
+    }
+
+    public KeyValueMap<String> getAttributes() {
+        return attributes;
+    }
+
+    public KeyValueMap<String> getDirectives() {
+        return directives;
+    }
+}

Propchange: sling/whiteboard/cziegeler/provisioning-model/src/main/java/org/apache/sling/feature/Requirement.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: sling/whiteboard/cziegeler/provisioning-model/src/main/java/org/apache/sling/feature/Requirement.java
------------------------------------------------------------------------------
    svn:keywords = author date id revision rev url

Added: sling/whiteboard/cziegeler/provisioning-model/src/main/java/org/apache/sling/feature/Traceable.java
URL: http://svn.apache.org/viewvc/sling/whiteboard/cziegeler/provisioning-model/src/main/java/org/apache/sling/feature/Traceable.java?rev=1796063&view=auto
==============================================================================
--- sling/whiteboard/cziegeler/provisioning-model/src/main/java/org/apache/sling/feature/Traceable.java (added)
+++ sling/whiteboard/cziegeler/provisioning-model/src/main/java/org/apache/sling/feature/Traceable.java Wed May 24 13:58:16 2017
@@ -0,0 +1,50 @@
+/*
+ * 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.sling.feature;
+
+/**
+ * A traceable has an optional location.
+ */
+public abstract class Traceable {
+
+    /** The location. */
+    private String location;
+
+    /**
+     * Get the location.
+     * The location might be the location of the model file or any other
+     * means identifying where the object is defined.
+     * @return The location or {@code null}.
+     */
+    public String getLocation() {
+        return this.location;
+    }
+
+    /**
+     * Set the location.
+     * @param value The new location.
+     */
+    public void setLocation(final String value) {
+        this.location = value;
+    }
+
+    @Override
+    public String toString() {
+        return "Traceable [location=" + location + "]";
+    }
+}
+

Propchange: sling/whiteboard/cziegeler/provisioning-model/src/main/java/org/apache/sling/feature/Traceable.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: sling/whiteboard/cziegeler/provisioning-model/src/main/java/org/apache/sling/feature/Traceable.java
------------------------------------------------------------------------------
    svn:keywords = author date id revision rev url

Added: sling/whiteboard/cziegeler/provisioning-model/src/main/java/org/apache/sling/feature/Version.java
URL: http://svn.apache.org/viewvc/sling/whiteboard/cziegeler/provisioning-model/src/main/java/org/apache/sling/feature/Version.java?rev=1796063&view=auto
==============================================================================
--- sling/whiteboard/cziegeler/provisioning-model/src/main/java/org/apache/sling/feature/Version.java (added)
+++ sling/whiteboard/cziegeler/provisioning-model/src/main/java/org/apache/sling/feature/Version.java Wed May 24 13:58:16 2017
@@ -0,0 +1,178 @@
+/*
+ * 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.sling.feature;
+
+/**
+ * Version object supporting Maven and OSGi versions.
+ */
+public class Version implements Comparable<Version> {
+
+    private final int majorVersion;
+	private final int minorVersion;
+	private final int microVersion;
+	private final String qualifier;
+
+	/**
+	 * Creates a version identifier from the specified string.
+	 * @throws IllegalArgumentException if the version string can't be parsed
+	 */
+	public Version(final String version) {
+	    String parts[] = version.split("\\.");
+	    if ( parts.length > 4 ) {
+	        throw new IllegalArgumentException("Invalid version " + version);
+	    }
+	    if ( parts.length < 4) {
+    	    final int pos = parts[parts.length - 1].indexOf('-');
+    	    if ( pos != -1 ) {
+    	        final String[] newParts = new String[4];
+    	        newParts[0] = parts.length > 1 ? parts[0] : parts[0].substring(0, pos);
+                newParts[1] = parts.length > 2 ? parts[1] : (parts.length > 1 ? parts[1].substring(0, pos) : "0");
+                newParts[2] = parts.length > 3 ? parts[2] : (parts.length > 2 ? parts[2].substring(0, pos) : "0");
+                newParts[3] = parts[parts.length - 1].substring(pos + 1);
+                parts = newParts;
+    	    }
+	    }
+	    this.majorVersion = parseInt(parts[0], version);
+	    if ( parts.length > 1 ) {
+	        this.minorVersion = parseInt(parts[1], version);
+	    } else {
+	        this.minorVersion = 0;
+	    }
+        if ( parts.length > 2 ) {
+            this.microVersion = parseInt(parts[2], version);
+        } else {
+            this.microVersion = 0;
+        }
+        this.qualifier = (parts.length > 3 ? parts[3] : "");
+	}
+
+	/**
+	 * Get the major version
+	 * @return The major version
+	 */
+	public int getMajorVersion() {
+        return majorVersion;
+    }
+
+    /**
+     * Get the minor version
+     * @return The minor version
+     */
+    public int getMinorVersion() {
+        return minorVersion;
+    }
+
+    /**
+     * Get the micro version
+     * @return The micro version
+     */
+    public int getMicroVersion() {
+        return microVersion;
+    }
+
+    /**
+     * Get the qualifier
+     * @return The qualifier, the qualifier might be the empty string.
+     */
+    public String getQualifier() {
+        return qualifier;
+    }
+
+    /**
+	 * Parse an integer.
+	 */
+	private static int parseInt(final String value, final String version) {
+		try {
+			return Integer.parseInt(value);
+		} catch (NumberFormatException e) {
+			throw new IllegalArgumentException("Invalid version " + version);
+		}
+	}
+
+	@Override
+    public int hashCode() {
+        final int prime = 31;
+        int result = 1;
+        result = prime * result + majorVersion;
+        result = prime * result + microVersion;
+        result = prime * result + minorVersion;
+        result = prime * result + ((qualifier == null) ? 0 : qualifier.hashCode());
+        return result;
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj)
+            return true;
+        if (obj == null)
+            return false;
+        if (getClass() != obj.getClass())
+            return false;
+        Version other = (Version) obj;
+        if (majorVersion != other.majorVersion)
+            return false;
+        if (microVersion != other.microVersion)
+            return false;
+        if (minorVersion != other.minorVersion)
+            return false;
+        if (qualifier == null) {
+            if (other.qualifier != null)
+                return false;
+        } else if (!qualifier.equals(other.qualifier))
+            return false;
+        return true;
+    }
+
+    /**
+	 * Compares this {@code Version} object to another {@code Version}.
+	 */
+	@Override
+    public int compareTo(final Version other) {
+	    int result = 0;
+		if (other != this) {
+
+	        result = majorVersion - other.majorVersion;
+	        if (result == 0) {
+	            result = minorVersion - other.minorVersion;
+	            if (result == 0) {
+	                result = microVersion - other.microVersion;
+	                if (result == 0) {
+	                    result = qualifier.compareTo(other.qualifier);
+	                    if ( result != 0 ) {
+	                        if ( "SNAPSHOT".equals(qualifier) ) {
+	                            result = -1;
+	                        } else if ( "SNAPSHOT".equals(other.qualifier) ) {
+	                            result = 1;
+	                        }
+	                    }
+	                }
+	            }
+
+	        }
+
+		}
+		return result;
+	}
+
+    @Override
+    public String toString() {
+        return String.valueOf(this.majorVersion) + "."
+                + String.valueOf(this.minorVersion + "."
+                + String.valueOf(this.microVersion) +
+                (this.qualifier.length() == 0 ? "" : "." + this.qualifier));
+    }
+}

Propchange: sling/whiteboard/cziegeler/provisioning-model/src/main/java/org/apache/sling/feature/Version.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: sling/whiteboard/cziegeler/provisioning-model/src/main/java/org/apache/sling/feature/Version.java
------------------------------------------------------------------------------
    svn:keywords = author date id revision rev url

Added: sling/whiteboard/cziegeler/provisioning-model/src/main/java/org/apache/sling/feature/package-info.java
URL: http://svn.apache.org/viewvc/sling/whiteboard/cziegeler/provisioning-model/src/main/java/org/apache/sling/feature/package-info.java?rev=1796063&view=auto
==============================================================================
--- sling/whiteboard/cziegeler/provisioning-model/src/main/java/org/apache/sling/feature/package-info.java (added)
+++ sling/whiteboard/cziegeler/provisioning-model/src/main/java/org/apache/sling/feature/package-info.java Wed May 24 13:58:16 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.
+ */
+
+@org.osgi.annotation.versioning.Version("1.0.0")
+package org.apache.sling.feature;
+
+

Propchange: sling/whiteboard/cziegeler/provisioning-model/src/main/java/org/apache/sling/feature/package-info.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: sling/whiteboard/cziegeler/provisioning-model/src/main/java/org/apache/sling/feature/package-info.java
------------------------------------------------------------------------------
    svn:keywords = author date id revision rev url

Modified: sling/whiteboard/cziegeler/provisioning-model/src/main/java/org/apache/sling/provisioning/model/ModelResolveUtility.java
URL: http://svn.apache.org/viewvc/sling/whiteboard/cziegeler/provisioning-model/src/main/java/org/apache/sling/provisioning/model/ModelResolveUtility.java?rev=1796063&r1=1796062&r2=1796063&view=diff
==============================================================================
--- sling/whiteboard/cziegeler/provisioning-model/src/main/java/org/apache/sling/provisioning/model/ModelResolveUtility.java (original)
+++ sling/whiteboard/cziegeler/provisioning-model/src/main/java/org/apache/sling/provisioning/model/ModelResolveUtility.java Wed May 24 13:58:16 2017
@@ -18,15 +18,11 @@
  */
 package org.apache.sling.provisioning.model;
 
-import java.io.ByteArrayInputStream;
 import java.io.IOException;
-import java.io.LineNumberReader;
 import java.io.StringReader;
-import java.util.Dictionary;
 import java.util.Enumeration;
 import java.util.Properties;
 
-import org.apache.felix.cm.file.ConfigurationHandler;
 import org.apache.sling.provisioning.model.ModelUtility.ArtifactVersionResolver;
 import org.apache.sling.provisioning.model.ModelUtility.VariableResolver;
 
@@ -77,7 +73,7 @@ class ModelResolveUtility {
         }
         return msg;
     }
-    
+
     /**
      * Tries to resolves artifact version via {@link ArtifactVersionResolver} if no version was defined in provisioning file.
      * @param groupId Group ID
@@ -96,9 +92,9 @@ class ModelResolveUtility {
                 return newVersion;
             }
         }
-        return version;       
+        return version;
     }
-    
+
     /**
      * Replaces variables in configuration.
      * @param feature Feature
@@ -140,46 +136,7 @@ class ModelResolveUtility {
                         final String key = (String)i.nextElement();
                         newConfig.getProperties().put(key, props.get(key));
                     }
-                } else {
-                    // Apache Felix CA format
-                    // the raw format might have comments, we have to remove them first
-                    final StringBuilder sb = new StringBuilder();
-                    try {
-                        final LineNumberReader lnr = new LineNumberReader(new StringReader(rawConfig));
-                        String line = null;
-                        while ((line = lnr.readLine()) != null ) {
-                            line = line.trim();
-                            if ( line.isEmpty() || line.startsWith("#")) {
-                                continue;
-                            }
-                            sb.append(line);
-                            sb.append('\n');
-                        }
-                    } catch ( final IOException ioe) {
-                        throw new IllegalArgumentException("Unable to read configuration properties: " + config, ioe);
-                    }
 
-                    ByteArrayInputStream bais = null;
-                    try {
-                        bais = new ByteArrayInputStream(sb.toString().getBytes("UTF-8"));
-                        @SuppressWarnings("unchecked")
-                        final Dictionary<String, Object> props = ConfigurationHandler.read(bais);
-                        final Enumeration<String> i = props.keys();
-                        while ( i.hasMoreElements() ) {
-                            final String key = i.nextElement();
-                            newConfig.getProperties().put(key, props.get(key));
-                        }
-                    } catch ( final IOException ioe) {
-                        throw new IllegalArgumentException("Unable to read configuration properties: " + config, ioe);
-                    } finally {
-                        if ( bais != null ) {
-                            try {
-                                bais.close();
-                            } catch ( final IOException ignore ) {
-                                // ignore
-                            }
-                        }
-                    }
                 }
             }
         } else {
@@ -191,5 +148,5 @@ class ModelResolveUtility {
             }
         }
     }
-    
+
 }

Modified: sling/whiteboard/cziegeler/provisioning-model/src/main/java/org/apache/sling/provisioning/model/io/ModelWriter.java
URL: http://svn.apache.org/viewvc/sling/whiteboard/cziegeler/provisioning-model/src/main/java/org/apache/sling/provisioning/model/io/ModelWriter.java?rev=1796063&r1=1796062&r2=1796063&view=diff
==============================================================================
--- sling/whiteboard/cziegeler/provisioning-model/src/main/java/org/apache/sling/provisioning/model/io/ModelWriter.java (original)
+++ sling/whiteboard/cziegeler/provisioning-model/src/main/java/org/apache/sling/provisioning/model/io/ModelWriter.java Wed May 24 13:58:16 2017
@@ -16,7 +16,6 @@
  */
 package org.apache.sling.provisioning.model.io;
 
-import java.io.ByteArrayOutputStream;
 import java.io.IOException;
 import java.io.LineNumberReader;
 import java.io.PrintWriter;
@@ -24,7 +23,6 @@ import java.io.StringReader;
 import java.io.Writer;
 import java.util.Map;
 
-import org.apache.felix.cm.file.ConfigurationHandler;
 import org.apache.sling.provisioning.model.Artifact;
 import org.apache.sling.provisioning.model.ArtifactGroup;
 import org.apache.sling.provisioning.model.Commentable;
@@ -229,16 +227,8 @@ public class ModelWriter {
                         final String configString;
                         if ( raw != null ) {
                             configString = raw;
-                        } else if ( config.isSpecial() ) {
-                            configString = config.getProperties().get(config.getPid()).toString();
                         } else {
-                            final ByteArrayOutputStream os = new ByteArrayOutputStream();
-                            try {
-                                ConfigurationHandler.write(os , config.getProperties());
-                            } finally {
-                                os.close();
-                            }
-                            configString = new String(os.toByteArray(), "UTF-8");
+                            configString = config.getProperties().get(config.getPid()).toString();
                         }
                         // we have to read the configuration line by line to properly indent
                         final LineNumberReader lnr = new LineNumberReader(new StringReader(configString));

Added: sling/whiteboard/cziegeler/provisioning-model/src/test/java/org/apache/sling/feature/VersionTest.java
URL: http://svn.apache.org/viewvc/sling/whiteboard/cziegeler/provisioning-model/src/test/java/org/apache/sling/feature/VersionTest.java?rev=1796063&view=auto
==============================================================================
--- sling/whiteboard/cziegeler/provisioning-model/src/test/java/org/apache/sling/feature/VersionTest.java (added)
+++ sling/whiteboard/cziegeler/provisioning-model/src/test/java/org/apache/sling/feature/VersionTest.java Wed May 24 13:58:16 2017
@@ -0,0 +1,98 @@
+/*
+ * 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.sling.feature;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import org.junit.Test;
+
+public class VersionTest {
+
+    @Test
+    public void testSameVersion() {
+        final String v1 = "1";
+        final String v10 = "1.0";
+        final String v100 = "1.0.0";
+
+        final Version ve1 = new Version(v1);
+        final Version ve10 = new Version(v10);
+        final Version ve100 = new Version(v100);
+
+        assertEquals(0, ve1.compareTo(ve10));
+        assertEquals(0, ve10.compareTo(ve100));
+        assertEquals(0, ve1.compareTo(ve100));
+        assertEquals(0, ve10.compareTo(ve1));
+        assertEquals(0, ve100.compareTo(ve10));
+        assertEquals(0, ve100.compareTo(ve1));
+    }
+
+    @Test
+    public void testVersions() {
+        final String v1 = "1";
+        final String v20 = "2.0";
+        final String v150 = "1.5.0";
+
+        final Version ve1 = new Version(v1);
+        final Version ve20 = new Version(v20);
+        final Version ve150 = new Version(v150);
+
+        assertTrue(ve1.compareTo(ve20) < 0);
+        assertTrue(ve20.compareTo(ve150) > 0);
+        assertTrue(ve1.compareTo(ve150) < 0);
+        assertTrue(ve20.compareTo(ve1) > 0);
+        assertTrue(ve150.compareTo(ve20) < 0);
+        assertTrue(ve150.compareTo(ve1) > 0);
+    }
+
+    @Test
+    public void testSnapshotQualifier() {
+        final Version v1 = new Version("1");
+        final Version v1snapshot = new Version("1-SNAPSHOT");
+        final Version v1a = new Version("1-A");
+
+        // snapshot is lower than the corresponding version
+        assertTrue(v1.compareTo(v1snapshot) > 0);
+        assertTrue(v1snapshot.compareTo(v1) < 0);
+
+        // qualifier is higher than the version
+        assertTrue(v1a.compareTo(v1) > 0);
+        assertTrue(v1.compareTo(v1a) < 0);
+
+        // qualifier is higher than snapshot
+        assertTrue(v1a.compareTo(v1snapshot) > 0);
+        assertTrue(v1snapshot.compareTo(v1a) < 0);
+    }
+
+    @Test
+    public void testQualifiers() {
+        final Version va = new Version("1-A");
+        final Version vb = new Version("1-B");
+
+        assertTrue(va.compareTo(vb) < 0);
+        assertTrue(vb.compareTo(va) > 0);
+    }
+
+    @Test
+    public void testOSGiVersion() {
+        final Version v = new Version("1.5.2.SNAPSHOT");
+        assertEquals(1, v.getMajorVersion());
+        assertEquals(5, v.getMinorVersion());
+        assertEquals(2, v.getMicroVersion());
+        assertEquals("SNAPSHOT", v.getQualifier());
+    }
+}

Propchange: sling/whiteboard/cziegeler/provisioning-model/src/test/java/org/apache/sling/feature/VersionTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: sling/whiteboard/cziegeler/provisioning-model/src/test/java/org/apache/sling/feature/VersionTest.java
------------------------------------------------------------------------------
    svn:keywords = author date id revision rev url