This is an automated email from the ASF dual-hosted git repository. cziegeler pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-feature.git
commit f53aef5e060eefa9a9fb801b77b5361c8455cb03 Author: Carsten Ziegeler <[email protected]> AuthorDate: Sun Oct 4 17:16:34 2020 +0200 Revert "SLING-9265 : Add support for optional bundles" This reverts commit 4fee6a49731b1b012ce3c80b127e346a077c4b52. --- .../java/org/apache/sling/feature/Artifact.java | 34 +------------- .../apache/sling/feature/ArtifactResolution.java | 28 ------------ .../org/apache/sling/feature/package-info.java | 2 +- .../sling/feature/ArtifactResolutionTest.java | 52 ---------------------- 4 files changed, 3 insertions(+), 113 deletions(-) diff --git a/src/main/java/org/apache/sling/feature/Artifact.java b/src/main/java/org/apache/sling/feature/Artifact.java index 7486369..90e416c 100644 --- a/src/main/java/org/apache/sling/feature/Artifact.java +++ b/src/main/java/org/apache/sling/feature/Artifact.java @@ -41,18 +41,15 @@ import javax.json.JsonValue.ValueType; * This class is not thread-safe. */ public class Artifact implements Comparable<Artifact> { - /** Can be used in artifact metadata to specify an alias. Multiple aliases can be comma-separated. */ public static final String KEY_ALIAS = "alias"; - + + /** This key might be used by bundles to define the start order. */ public static final String KEY_START_ORDER = "start-order"; public static final String KEY_FEATURE_ORIGINS = "feature-origins"; - /** This key might be used to set the resolution for an artifact. @since 1.6.0 */ - public static final String KEY_RESOLUTION = "resolution"; - private static final String KEY_ID = "id"; /** The artifact id. */ @@ -225,33 +222,6 @@ public class Artifact implements Comparable<Artifact> { } } - /** - * Get the artifact resolution - * @return The resolution - * @since 1.6.0 - * @throws IllegalArgumentException If the stored value is invalid - */ - public ArtifactResolution getResolution() { - final String value = this.getMetadata().get(KEY_RESOLUTION); - if ( value == null ) { - return ArtifactResolution.MANDATORY; - } - return ArtifactResolution.valueOf(value.toUpperCase()); - } - - /** - * Set the artifact resolution - * @param value The resolution. If {@code null} the value will be removed. - * @since 1.6.0 - */ - public void setResolution(final ArtifactResolution value) { - if ( value == null ) { - this.getMetadata().remove(KEY_RESOLUTION); - } else { - this.getMetadata().put(KEY_RESOLUTION, value.name()); - } - } - @Override public int compareTo(final Artifact o) { return this.id.compareTo(o.id); diff --git a/src/main/java/org/apache/sling/feature/ArtifactResolution.java b/src/main/java/org/apache/sling/feature/ArtifactResolution.java deleted file mode 100644 index 326bc76..0000000 --- a/src/main/java/org/apache/sling/feature/ArtifactResolution.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with this - * work for additional information regarding copyright ownership. The ASF - * licenses this file to You under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ -package org.apache.sling.feature; - -/** - * Mandatory artifacts need to be resolved (default), optional might resolve - * @since 1.6.0 - */ -public enum ArtifactResolution { - - MANDATORY, - OPTIONAL - -} diff --git a/src/main/java/org/apache/sling/feature/package-info.java b/src/main/java/org/apache/sling/feature/package-info.java index 9d1cc7f..6ed34c0 100644 --- a/src/main/java/org/apache/sling/feature/package-info.java +++ b/src/main/java/org/apache/sling/feature/package-info.java @@ -17,7 +17,7 @@ * under the License. */ [email protected]("1.6.0") [email protected]("1.5.0") package org.apache.sling.feature; diff --git a/src/test/java/org/apache/sling/feature/ArtifactResolutionTest.java b/src/test/java/org/apache/sling/feature/ArtifactResolutionTest.java deleted file mode 100644 index 5fd51fb..0000000 --- a/src/test/java/org/apache/sling/feature/ArtifactResolutionTest.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.sling.feature; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNull; - -import org.junit.Test; - -public class ArtifactResolutionTest { - - @Test public void testValidResolution() { - final Artifact a = new Artifact(ArtifactId.parse("g:a:1")); - - assertNull(a.getMetadata().get(Artifact.KEY_RESOLUTION)); - assertEquals(ArtifactResolution.MANDATORY, a.getResolution()); - - a.setResolution(ArtifactResolution.MANDATORY); - assertEquals(ArtifactResolution.MANDATORY.name(), a.getMetadata().get(Artifact.KEY_RESOLUTION)); - assertEquals(ArtifactResolution.MANDATORY, a.getResolution()); - - a.setResolution(ArtifactResolution.OPTIONAL); - assertEquals(ArtifactResolution.OPTIONAL.name(), a.getMetadata().get(Artifact.KEY_RESOLUTION)); - assertEquals(ArtifactResolution.OPTIONAL, a.getResolution()); - - a.setResolution(null); - assertNull(a.getMetadata().get(Artifact.KEY_RESOLUTION)); - assertEquals(ArtifactResolution.MANDATORY, a.getResolution()); - } - - @Test(expected = IllegalArgumentException.class) - public void testInvalidResolution() { - final Artifact a = new Artifact(ArtifactId.parse("g:a:1")); - a.getMetadata().put(Artifact.KEY_RESOLUTION, "foo"); - - a.getResolution(); - } -} \ No newline at end of file
