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 14:32:37 UTC

svn commit: r1796068 - in /sling/whiteboard/cziegeler/provisioning-model/src/main/java/org/apache/sling/feature: Artifact.java Bundle.java Extension.java ExtensionType.java Feature.java

Author: cziegeler
Date: Wed May 24 14:32:37 2017
New Revision: 1796068

URL: http://svn.apache.org/viewvc?rev=1796068&view=rev
Log:
Update feature

Added:
    sling/whiteboard/cziegeler/provisioning-model/src/main/java/org/apache/sling/feature/Artifact.java   (with props)
    sling/whiteboard/cziegeler/provisioning-model/src/main/java/org/apache/sling/feature/Extension.java   (with props)
    sling/whiteboard/cziegeler/provisioning-model/src/main/java/org/apache/sling/feature/ExtensionType.java   (with props)
Modified:
    sling/whiteboard/cziegeler/provisioning-model/src/main/java/org/apache/sling/feature/Bundle.java
    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/Artifact.java
URL: http://svn.apache.org/viewvc/sling/whiteboard/cziegeler/provisioning-model/src/main/java/org/apache/sling/feature/Artifact.java?rev=1796068&view=auto
==============================================================================
--- sling/whiteboard/cziegeler/provisioning-model/src/main/java/org/apache/sling/feature/Artifact.java (added)
+++ sling/whiteboard/cziegeler/provisioning-model/src/main/java/org/apache/sling/feature/Artifact.java Wed May 24 14:32:37 2017
@@ -0,0 +1,54 @@
+/*
+ * 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;
+
+/**
+ * An artifact consists of
+ * <ul>
+ *   <li>An id
+ *   <li>metadata
+ *   <li>configurations
+ * </ul>
+ */
+public class Artifact
+    extends AbstractArtifact {
+
+    private final List<Configuration> configurations = new ArrayList<>();
+
+    /**
+     * Construct a new artifact.
+     * @param id The id of the artifact.
+     * @throws IllegalArgumentException If id is {@code null}.
+     */
+    public Artifact(final ArtifactId id) {
+        super(id);
+    }
+
+    public List<Configuration> getConfigurations() {
+        return this.configurations;
+    }
+
+    @Override
+    public String toString() {
+        return "Artifact [id=" + getId().toMvnUrl().substring(4)
+                + ( this.getLocation() != null ? ", location=" + this.getLocation() : "")
+                + "]";
+    }
+}

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

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

Modified: 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=1796068&r1=1796067&r2=1796068&view=diff
==============================================================================
--- sling/whiteboard/cziegeler/provisioning-model/src/main/java/org/apache/sling/feature/Bundle.java (original)
+++ sling/whiteboard/cziegeler/provisioning-model/src/main/java/org/apache/sling/feature/Bundle.java Wed May 24 14:32:37 2017
@@ -16,9 +16,6 @@
  */
 package org.apache.sling.feature;
 
-import java.util.ArrayList;
-import java.util.List;
-
 /**
  * A bundle consists of
  * <ul>
@@ -29,9 +26,7 @@ import java.util.List;
  * </ul>
  */
 public class Bundle
-    extends AbstractArtifact {
-
-    private final List<Configuration> configurations = new ArrayList<>();
+    extends Artifact {
 
     private int startLevel = 1;
 
@@ -44,10 +39,6 @@ public class Bundle
         super(id);
     }
 
-    public List<Configuration> getConfigurations() {
-        return this.configurations;
-    }
-
     public int getStartLevel() {
         return startLevel;
     }

Added: sling/whiteboard/cziegeler/provisioning-model/src/main/java/org/apache/sling/feature/Extension.java
URL: http://svn.apache.org/viewvc/sling/whiteboard/cziegeler/provisioning-model/src/main/java/org/apache/sling/feature/Extension.java?rev=1796068&view=auto
==============================================================================
--- sling/whiteboard/cziegeler/provisioning-model/src/main/java/org/apache/sling/feature/Extension.java (added)
+++ sling/whiteboard/cziegeler/provisioning-model/src/main/java/org/apache/sling/feature/Extension.java Wed May 24 14:32:37 2017
@@ -0,0 +1,73 @@
+/*
+ * 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;
+
+import org.apache.sling.provisioning.model.Artifact;
+
+/**
+ * Extension
+ */
+public abstract class Extension extends Commentable {
+
+    private final ExtensionType type;
+
+    private final String name;
+
+    private final List<Artifact> artifacts = new ArrayList<>();
+
+    private String text;
+
+    public Extension(final ExtensionType t, final String name) {
+        if ( t == null || name == null ) {
+            throw new IllegalArgumentException("Argument must not be null");
+        }
+        this.type = t;
+        this.name = name;
+    }
+
+    public ExtensionType getType() {
+        return this.type;
+    }
+
+    public String getText() {
+        if ( type == ExtensionType.ARTIFACTS ) {
+            throw new IllegalStateException();
+        }
+        return text;
+    }
+
+    public void setText(String text) {
+        if ( type == ExtensionType.ARTIFACTS ) {
+            throw new IllegalStateException();
+        }
+        this.text = text;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public List<Artifact> getArtifacts() {
+        if ( type == ExtensionType.TEXT ) {
+            throw new IllegalStateException();
+        }
+        return artifacts;
+    }
+}

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

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

Added: sling/whiteboard/cziegeler/provisioning-model/src/main/java/org/apache/sling/feature/ExtensionType.java
URL: http://svn.apache.org/viewvc/sling/whiteboard/cziegeler/provisioning-model/src/main/java/org/apache/sling/feature/ExtensionType.java?rev=1796068&view=auto
==============================================================================
--- sling/whiteboard/cziegeler/provisioning-model/src/main/java/org/apache/sling/feature/ExtensionType.java (added)
+++ sling/whiteboard/cziegeler/provisioning-model/src/main/java/org/apache/sling/feature/ExtensionType.java Wed May 24 14:32:37 2017
@@ -0,0 +1,26 @@
+/*
+ * 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;
+
+/**
+ * Constants for common feature types.
+ */
+public enum ExtensionType {
+
+    ARTIFACTS,
+    TEXT
+}

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

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

Modified: 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=1796068&r1=1796067&r2=1796068&view=diff
==============================================================================
--- sling/whiteboard/cziegeler/provisioning-model/src/main/java/org/apache/sling/feature/Feature.java (original)
+++ sling/whiteboard/cziegeler/provisioning-model/src/main/java/org/apache/sling/feature/Feature.java Wed May 24 14:32:37 2017
@@ -28,6 +28,7 @@ import java.util.List;
  *   <li>framework properties
  *   <li>requirements and capabilities
  *   <li>Includes
+ *   <li>Extensions
  * </ul>
  */
 public class Feature
@@ -45,6 +46,8 @@ public class Feature
 
     private final List<Include> includes = new ArrayList<>();
 
+    private final List<Extension> extensions = new ArrayList<>();
+
     /**
      * Construct a new feature.
      * @param id The id of the feature.
@@ -83,6 +86,10 @@ public class Feature
         return includes;
     }
 
+    public List<Extension> getExtensions() {
+        return this.extensions;
+    }
+
     @Override
     public String toString() {
         return "Feature [id=" + this.getId().toMvnUrl().substring(4)