You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by si...@apache.org on 2019/06/19 14:53:55 UTC

[sling-whiteboard] branch master updated (4bcce72 -> a76ce1c)

This is an automated email from the ASF dual-hosted git repository.

simonetripodi pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/sling-whiteboard.git.


    from 4bcce72  url-connection-agent moved to https://github.com/apache/sling-org-apache-sling-connection-timeout-agent
     new 5b95988  [feature-diff] comparators are implementations, a good style is to name the package "impl" or "internal" They don't need a package-info file
     new 8e4934b  [feature-diff] diff request API simplification
     new b49b3e2  [featire-diff] updated documentation
     new 9869c6d  [feature-diff] added package OSGi metadata Version
     new 6a2a99a  [r2f] refactored implementation according to OSGi best practice
     new a76ce1c  Merge branch 'master' of github.com:apache/sling-whiteboard

The 6 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 feature-diff/README.md                             |  6 +-
 feature-diff/pom.xml                               |  7 +-
 .../sling/feature/diff/DefaultDiffRequest.java     | 94 ----------------------
 .../org/apache/sling/feature/diff/DiffRequest.java | 65 +++++++++++++--
 .../feature/diff/comparators/package-info.java     | 17 ----
 .../AbstractFeatureElementComparator.java          |  2 +-
 .../{comparators => impl}/BundlesComparator.java   |  2 +-
 .../ConfigurationsComparator.java                  |  2 +-
 .../ExtensionsComparator.java                      |  2 +-
 .../FrameworkPropertiesComparator.java             |  2 +-
 .../apache/sling/feature/diff/package-info.java    |  1 +
 .../feature/diff/spi/FeatureElementComparator.java | 16 ++++
 .../apache/sling/feature/diff/FeatureDiffTest.java |  6 +-
 .../AbstractComparatorTest.java                    |  2 +-
 .../BundlesComparatorTest.java                     |  4 +-
 .../ConfigurationsComparatorTest.java              |  4 +-
 .../FrameworkPropertiesComparatorTest.java         |  4 +-
 runtime2feature/pom.xml                            | 27 +++++--
 .../sling/feature/r2f/ConversionRequest.java       | 28 -------
 .../feature/r2f/DefaultConversionRequest.java      | 55 -------------
 .../r2f/RuntimeEnvironment2FeatureModel.java       |  5 +-
 .../RuntimeEnvironment2FeatureModelActivator.java  | 51 ------------
 .../RuntimeEnvironment2FeatureModelService.java    | 41 +++++++---
 .../org/apache/sling/feature/r2f/package-info.java |  2 +
 24 files changed, 155 insertions(+), 290 deletions(-)
 delete mode 100644 feature-diff/src/main/java/org/apache/sling/feature/diff/DefaultDiffRequest.java
 delete mode 100644 feature-diff/src/main/java/org/apache/sling/feature/diff/comparators/package-info.java
 rename feature-diff/src/main/java/org/apache/sling/feature/diff/{comparators => impl}/AbstractFeatureElementComparator.java (96%)
 rename feature-diff/src/main/java/org/apache/sling/feature/diff/{comparators => impl}/BundlesComparator.java (97%)
 rename feature-diff/src/main/java/org/apache/sling/feature/diff/{comparators => impl}/ConfigurationsComparator.java (98%)
 rename feature-diff/src/main/java/org/apache/sling/feature/diff/{comparators => impl}/ExtensionsComparator.java (99%)
 rename feature-diff/src/main/java/org/apache/sling/feature/diff/{comparators => impl}/FrameworkPropertiesComparator.java (98%)
 rename feature-diff/src/test/java/org/apache/sling/feature/diff/{comparators => impl}/AbstractComparatorTest.java (97%)
 rename feature-diff/src/test/java/org/apache/sling/feature/diff/{comparators => impl}/BundlesComparatorTest.java (96%)
 rename feature-diff/src/test/java/org/apache/sling/feature/diff/{comparators => impl}/ConfigurationsComparatorTest.java (97%)
 rename feature-diff/src/test/java/org/apache/sling/feature/diff/{comparators => impl}/FrameworkPropertiesComparatorTest.java (95%)
 delete mode 100644 runtime2feature/src/main/java/org/apache/sling/feature/r2f/ConversionRequest.java
 delete mode 100644 runtime2feature/src/main/java/org/apache/sling/feature/r2f/DefaultConversionRequest.java
 delete mode 100644 runtime2feature/src/main/java/org/apache/sling/feature/r2f/impl/RuntimeEnvironment2FeatureModelActivator.java


[sling-whiteboard] 06/06: Merge branch 'master' of github.com:apache/sling-whiteboard

Posted by si...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

simonetripodi pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-whiteboard.git

commit a76ce1c2802b56641b999a623fd2b0306be32b56
Merge: 6a2a99a 4bcce72
Author: Simo Tripodi <st...@adobe.com>
AuthorDate: Wed Jun 19 16:53:33 2019 +0200

    Merge branch 'master' of github.com:apache/sling-whiteboard

 pom.xml                                            |   1 -
 url-connection-agent/README.md                     |  55 ------
 url-connection-agent/pom.xml                       | 142 --------------
 .../main/java/org/apache/sling/uca/impl/Agent.java |  72 -------
 .../java/org/apache/sling/uca/impl/AgentInfo.java  |  77 --------
 .../org/apache/sling/uca/impl/AgentInfoMBean.java  |  52 ------
 .../uca/impl/HttpClient3TimeoutTransformer.java    |  61 ------
 .../uca/impl/HttpClient4TimeoutTransformer.java    |  35 ----
 .../sling/uca/impl/JavaNetTimeoutTransformer.java  |  65 -------
 .../main/java/org/apache/sling/uca/impl/Log.java   | 113 -----------
 .../uca/impl/MBeanAwareTimeoutTransformer.java     |  75 --------
 .../sling/uca/impl/OkHttpTimeoutTransformer.java   |  36 ----
 ...pdateFieldsInConstructorTimeoutTransformer.java |  62 ------
 .../java/org/apache/sling/uca/impl/AgentIT.java    | 206 --------------------
 .../org/apache/sling/uca/impl/AgentLauncher.java   | 107 -----------
 .../org/apache/sling/uca/impl/ErrorDescriptor.java |  37 ----
 .../apache/sling/uca/impl/HttpClientLauncher.java  | 208 ---------------------
 .../sling/uca/impl/MisbehavingServerControl.java   |  45 -----
 .../sling/uca/impl/MisbehavingServerExtension.java | 121 ------------
 .../apache/sling/uca/impl/RecordedThrowable.java   |  40 ----
 .../org/apache/sling/uca/impl/TestTimeouts.java    |  64 -------
 .../src/test/resources/simplelogger.properties     |  20 --
 22 files changed, 1694 deletions(-)


[sling-whiteboard] 02/06: [feature-diff] diff request API simplification

Posted by si...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

simonetripodi pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-whiteboard.git

commit 8e4934b64f364f163a66155511b26bcb1c21e690
Author: Simo Tripodi <st...@adobe.com>
AuthorDate: Wed Jun 19 14:48:39 2019 +0200

    [feature-diff] diff request API simplification
---
 .../sling/feature/diff/DefaultDiffRequest.java     | 94 ----------------------
 .../org/apache/sling/feature/diff/DiffRequest.java | 65 +++++++++++++--
 .../apache/sling/feature/diff/FeatureDiffTest.java |  6 +-
 3 files changed, 62 insertions(+), 103 deletions(-)

diff --git a/feature-diff/src/main/java/org/apache/sling/feature/diff/DefaultDiffRequest.java b/feature-diff/src/main/java/org/apache/sling/feature/diff/DefaultDiffRequest.java
deleted file mode 100644
index d88cbae..0000000
--- a/feature-diff/src/main/java/org/apache/sling/feature/diff/DefaultDiffRequest.java
+++ /dev/null
@@ -1,94 +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.diff;
-
-import static java.util.Objects.requireNonNull;
-
-import java.util.HashSet;
-import java.util.Set;
-
-import org.apache.sling.feature.ArtifactId;
-import org.apache.sling.feature.Feature;
-
-public final class DefaultDiffRequest implements DiffRequest {
-
-    private final Set<String> includeComparators = new HashSet<>();
-
-    private final Set<String> excludeComparators = new HashSet<>();
-
-    private Feature previous;
-
-    private Feature current;
-
-    private ArtifactId resultId;
-
-    @Override
-    public Feature getPrevious() {
-        return previous;
-    }
-
-    public DefaultDiffRequest setPrevious(Feature previous) {
-        this.previous = requireNonNull(previous, "Impossible to compare null previous feature.");
-        return this;
-    }
-
-    @Override
-    public Feature getCurrent() {
-        return current;
-    }
-
-    public DefaultDiffRequest setCurrent(Feature current) {
-        this.current = requireNonNull(current, "Impossible to compare null current feature.");
-        return this;
-    }
-
-    @Override
-    public ArtifactId getResultId() {
-        return resultId;
-    }
-
-    public DefaultDiffRequest setResultId(String resultId) {
-        resultId = requireNonNull(resultId, "Impossible to create the Feature diff with a null id");
-        return setResultId(ArtifactId.parse(resultId));
-    }
-
-    public DefaultDiffRequest setResultId(ArtifactId resultId) {
-        this.resultId = requireNonNull(resultId, "Impossible to create the Feature diff with a null id");
-        return this;
-    }
-
-    public DefaultDiffRequest addIncludeComparator(String includeComparator) {
-        includeComparators.add(requireNonNull(includeComparator, "A null include comparator id is not valid"));
-        return this;
-    }
-
-    @Override
-    public Set<String> getIncludeComparators() {
-        return includeComparators;
-    }
-
-    public DefaultDiffRequest addExcludeComparator(String excludeComparator) {
-        excludeComparators.add(requireNonNull(excludeComparator, "A null exclude comparator id is not valid"));
-        return this;
-    }
-
-    @Override
-    public Set<String> getExcludeComparators() {
-        return excludeComparators;
-    }
-
-}
diff --git a/feature-diff/src/main/java/org/apache/sling/feature/diff/DiffRequest.java b/feature-diff/src/main/java/org/apache/sling/feature/diff/DiffRequest.java
index b5f4e39..75cd24e 100644
--- a/feature-diff/src/main/java/org/apache/sling/feature/diff/DiffRequest.java
+++ b/feature-diff/src/main/java/org/apache/sling/feature/diff/DiffRequest.java
@@ -16,21 +16,74 @@
  */
 package org.apache.sling.feature.diff;
 
+import static java.util.Objects.requireNonNull;
+
+import java.util.HashSet;
 import java.util.Set;
 
 import org.apache.sling.feature.ArtifactId;
 import org.apache.sling.feature.Feature;
 
-public interface DiffRequest {
+public final class DiffRequest {
+
+    private final Set<String> includeComparators = new HashSet<>();
+
+    private final Set<String> excludeComparators = new HashSet<>();
+
+    private Feature previous;
+
+    private Feature current;
+
+    private ArtifactId resultId;
+
+    public Feature getPrevious() {
+        return previous;
+    }
+
+    public DiffRequest setPrevious(Feature previous) {
+        this.previous = requireNonNull(previous, "Impossible to compare null previous feature.");
+        return this;
+    }
+
+    public Feature getCurrent() {
+        return current;
+    }
+
+    public DiffRequest setCurrent(Feature current) {
+        this.current = requireNonNull(current, "Impossible to compare null current feature.");
+        return this;
+    }
+
+    public ArtifactId getResultId() {
+        return resultId;
+    }
+
+    public DiffRequest setResultId(String resultId) {
+        resultId = requireNonNull(resultId, "Impossible to create the Feature diff with a null id");
+        return setResultId(ArtifactId.parse(resultId));
+    }
 
-    Feature getPrevious();
+    public DiffRequest setResultId(ArtifactId resultId) {
+        this.resultId = requireNonNull(resultId, "Impossible to create the Feature diff with a null id");
+        return this;
+    }
 
-    Feature getCurrent();
+    public DiffRequest addIncludeComparator(String includeComparator) {
+        includeComparators.add(requireNonNull(includeComparator, "A null include comparator id is not valid"));
+        return this;
+    }
 
-    ArtifactId getResultId();
+    public Set<String> getIncludeComparators() {
+        return includeComparators;
+    }
 
-    Set<String> getIncludeComparators();
+    public DiffRequest addExcludeComparator(String excludeComparator) {
+        excludeComparators.add(requireNonNull(excludeComparator, "A null exclude comparator id is not valid"));
+        return this;
+    }
 
-    Set<String> getExcludeComparators();
+    public Set<String> getExcludeComparators() {
+        return excludeComparators;
+    }
 
 }
diff --git a/feature-diff/src/test/java/org/apache/sling/feature/diff/FeatureDiffTest.java b/feature-diff/src/test/java/org/apache/sling/feature/diff/FeatureDiffTest.java
index 853cd18..87f4c67 100644
--- a/feature-diff/src/test/java/org/apache/sling/feature/diff/FeatureDiffTest.java
+++ b/feature-diff/src/test/java/org/apache/sling/feature/diff/FeatureDiffTest.java
@@ -30,14 +30,14 @@ public final class FeatureDiffTest {
 
     @Test
     public void loadAllComparators() {
-        Set<String> comparators = filterComparators(new DefaultDiffRequest());
+        Set<String> comparators = filterComparators(new DiffRequest());
 
         assertTrue(comparators.isEmpty());
     }
 
     @Test
     public void loadIncludedComparators() {
-        Set<String> comparators = filterComparators(new DefaultDiffRequest()
+        Set<String> comparators = filterComparators(new DiffRequest()
                                                     .addIncludeComparator("bundles")
                                                     .addIncludeComparator("configurations"));
 
@@ -50,7 +50,7 @@ public final class FeatureDiffTest {
 
     @Test
     public void loadExcludedComparators() {
-        Set<String> comparators = filterComparators(new DefaultDiffRequest()
+        Set<String> comparators = filterComparators(new DiffRequest()
                                                     .addExcludeComparator("bundles")
                                                     .addExcludeComparator("configurations"));
 


[sling-whiteboard] 03/06: [featire-diff] updated documentation

Posted by si...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

simonetripodi pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-whiteboard.git

commit b49b3e270098a19a4bee1071c97b2b5cee0979e8
Author: Simo Tripodi <st...@adobe.com>
AuthorDate: Wed Jun 19 14:54:48 2019 +0200

    [featire-diff] updated documentation
---
 feature-diff/README.md                                   |  6 +++---
 .../sling/feature/diff/spi/FeatureElementComparator.java | 16 ++++++++++++++++
 2 files changed, 19 insertions(+), 3 deletions(-)

diff --git a/feature-diff/README.md b/feature-diff/README.md
index 69b8d47..7213b28 100644
--- a/feature-diff/README.md
+++ b/feature-diff/README.md
@@ -13,14 +13,14 @@ import static org.apache.sling.feature.diff.FeatureDiff.compareFeatures;
 
 import org.apache.sling.feature.Feature
 import org.apache.sling.feature.diff.DiffRequest;
-import org.apache.sling.feature.diff.DefaultDiffRequest;
+import org.apache.sling.feature.diff.DiffRequest;
 
 ...
 
 Feature previous = // somehow obtained
 Feature current = // somehow obtained
 
-DiffRequest diffRequest = new DefaultDiffRequest()
+DiffRequest diffRequest = new DiffRequest()
                           .setPrevious(previous)
                           .setCurrent(current)
                           .setResultId("org.apache.sling:org.apache.sling.diff:1.0.0");
@@ -49,7 +49,7 @@ The `DiffRequest` data object can be configured in order to include/exclude one
 Users can simply add via the include/exclude methods the section(s) they are interested:
 
 ```
-DiffRequest diffRequest = new DefaultDiffRequest()
+DiffRequest diffRequest = new DiffRequest()
                           .setPrevious(previous)
                           .setCurrent(current)
                           .addIncludeComparator("bundles")
diff --git a/feature-diff/src/main/java/org/apache/sling/feature/diff/spi/FeatureElementComparator.java b/feature-diff/src/main/java/org/apache/sling/feature/diff/spi/FeatureElementComparator.java
index 7c697f4..536c775 100644
--- a/feature-diff/src/main/java/org/apache/sling/feature/diff/spi/FeatureElementComparator.java
+++ b/feature-diff/src/main/java/org/apache/sling/feature/diff/spi/FeatureElementComparator.java
@@ -18,10 +18,26 @@ package org.apache.sling.feature.diff.spi;
 
 import org.apache.sling.feature.Feature;
 
+/**
+ * A simple service to compare a specific Feature section.
+ */
 public interface FeatureElementComparator {
 
+    /**
+     * Returns a short id which identifies the Feature section for which differences will be computed.
+     *
+     * @return a short id which identifies the Feature section for which differences will be computed.
+     */
     String getId();
 
+    /**
+     * Compares a specific Feature sections between the previous and the current,
+     * reporting additions/updates/removals in the target.
+     *
+     * @param previous
+     * @param current
+     * @param target
+     */
     public void computeDiff(Feature previous, Feature current, Feature target);
 
 }


[sling-whiteboard] 05/06: [r2f] refactored implementation according to OSGi best practice

Posted by si...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

simonetripodi pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-whiteboard.git

commit 6a2a99a260ba8f6cd1f953f631f723f76cff943f
Author: Simo Tripodi <st...@adobe.com>
AuthorDate: Wed Jun 19 16:49:39 2019 +0200

    [r2f] refactored implementation according to OSGi best practice
---
 runtime2feature/pom.xml                            | 27 ++++++++---
 .../sling/feature/r2f/ConversionRequest.java       | 28 -----------
 .../feature/r2f/DefaultConversionRequest.java      | 55 ----------------------
 .../r2f/RuntimeEnvironment2FeatureModel.java       |  5 +-
 .../RuntimeEnvironment2FeatureModelActivator.java  | 51 --------------------
 .../RuntimeEnvironment2FeatureModelService.java    | 41 ++++++++++++----
 .../org/apache/sling/feature/r2f/package-info.java |  2 +
 7 files changed, 55 insertions(+), 154 deletions(-)

diff --git a/runtime2feature/pom.xml b/runtime2feature/pom.xml
index 8ea9c87..8b344df 100644
--- a/runtime2feature/pom.xml
+++ b/runtime2feature/pom.xml
@@ -29,7 +29,6 @@
 
   <artifactId>org.apache.sling.feature.r2f</artifactId>
   <version>0.0.1-SNAPSHOT</version>
-  <packaging>bundle</packaging>
 
   <name>Apache Sling Feature Model runtime creator</name>
   <description>Feature Model runtime creator tool for Apache Sling</description>
@@ -54,6 +53,16 @@
       <version>5.0.0</version>
       <scope>provided</scope>
     </dependency>
+    <dependency>
+      <groupId>org.osgi</groupId>
+      <artifactId>org.osgi.annotation.versioning</artifactId>
+      <scope>provided</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.osgi</groupId>
+      <artifactId>org.osgi.service.component.annotations</artifactId>
+      <scope>provided</scope>
+    </dependency>
     <!--
      | Apache Sling Feature APIs
     -->
@@ -88,15 +97,19 @@
   <build>
     <plugins>
       <plugin>
-        <groupId>org.apache.felix</groupId>
-        <artifactId>maven-bundle-plugin</artifactId>
-        <extensions>true</extensions>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-jar-plugin</artifactId>
         <configuration>
-          <instructions>
-              <Bundle-Activator>org.apache.sling.feature.r2f.impl.RuntimeEnvironment2FeatureModelActivator</Bundle-Activator>
-          </instructions>
+          <archive>
+            <manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
+          </archive>
         </configuration>
       </plugin>
+      <plugin>
+        <groupId>biz.aQute.bnd</groupId>
+        <artifactId>bnd-maven-plugin</artifactId>
+        <version>4.1.0</version>
+      </plugin>
     </plugins>
   </build>
 
diff --git a/runtime2feature/src/main/java/org/apache/sling/feature/r2f/ConversionRequest.java b/runtime2feature/src/main/java/org/apache/sling/feature/r2f/ConversionRequest.java
deleted file mode 100644
index f0fea30..0000000
--- a/runtime2feature/src/main/java/org/apache/sling/feature/r2f/ConversionRequest.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.r2f;
-
-import org.apache.sling.feature.ArtifactId;
-import org.osgi.framework.BundleContext;
-
-public interface ConversionRequest {
-
-    ArtifactId getResultId();
-
-    BundleContext getBundleContext();
-
-}
diff --git a/runtime2feature/src/main/java/org/apache/sling/feature/r2f/DefaultConversionRequest.java b/runtime2feature/src/main/java/org/apache/sling/feature/r2f/DefaultConversionRequest.java
deleted file mode 100644
index 467aba3..0000000
--- a/runtime2feature/src/main/java/org/apache/sling/feature/r2f/DefaultConversionRequest.java
+++ /dev/null
@@ -1,55 +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.r2f;
-
-import static java.util.Objects.requireNonNull;
-
-import org.apache.sling.feature.ArtifactId;
-import org.osgi.framework.BundleContext;
-
-public class DefaultConversionRequest implements ConversionRequest {
-
-    private ArtifactId resultId;
-
-    private BundleContext bundleContext;
-
-    @Override
-    public ArtifactId getResultId() {
-        return resultId;
-    }
-
-    public DefaultConversionRequest setResultId(String resultId) {
-        resultId = requireNonNull(resultId, "Impossible to create the Feature diff with a null id");
-        return setResultId(ArtifactId.parse(resultId));
-    }
-
-    public DefaultConversionRequest setResultId(ArtifactId resultId) {
-        this.resultId = requireNonNull(resultId, "Impossible to create the Feature diff with a null id");
-        return this;
-    }
-
-    @Override
-    public BundleContext getBundleContext() {
-        return bundleContext;
-    }
-
-    public DefaultConversionRequest setBundleContext(BundleContext bundleContext) {
-        this.bundleContext = requireNonNull(bundleContext, "Impossible to create the Feature from a null BundleContext");
-        return this;
-    }
-
-}
diff --git a/runtime2feature/src/main/java/org/apache/sling/feature/r2f/RuntimeEnvironment2FeatureModel.java b/runtime2feature/src/main/java/org/apache/sling/feature/r2f/RuntimeEnvironment2FeatureModel.java
index c236708..c034a04 100644
--- a/runtime2feature/src/main/java/org/apache/sling/feature/r2f/RuntimeEnvironment2FeatureModel.java
+++ b/runtime2feature/src/main/java/org/apache/sling/feature/r2f/RuntimeEnvironment2FeatureModel.java
@@ -17,12 +17,11 @@
 package org.apache.sling.feature.r2f;
 
 import org.apache.sling.feature.Feature;
-import org.osgi.framework.BundleContext;
 
 public interface RuntimeEnvironment2FeatureModel {
 
-    Feature getLaunchFeature(BundleContext bundleContext);
+    Feature getLaunchFeature();
 
-    Feature getRuntimeFeature(ConversionRequest conversionRequest);
+    Feature getRuntimeFeature();
 
 }
diff --git a/runtime2feature/src/main/java/org/apache/sling/feature/r2f/impl/RuntimeEnvironment2FeatureModelActivator.java b/runtime2feature/src/main/java/org/apache/sling/feature/r2f/impl/RuntimeEnvironment2FeatureModelActivator.java
deleted file mode 100644
index c34a64b..0000000
--- a/runtime2feature/src/main/java/org/apache/sling/feature/r2f/impl/RuntimeEnvironment2FeatureModelActivator.java
+++ /dev/null
@@ -1,51 +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.r2f.impl;
-
-import static org.osgi.framework.Constants.BUNDLE_VENDOR;
-import static org.osgi.framework.Constants.SERVICE_DESCRIPTION;
-import static org.osgi.framework.Constants.SERVICE_VENDOR;
-
-import java.util.Dictionary;
-import java.util.Hashtable;
-
-import org.apache.sling.feature.r2f.RuntimeEnvironment2FeatureModel;
-import org.osgi.framework.BundleActivator;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.ServiceRegistration;
-
-public final class RuntimeEnvironment2FeatureModelActivator implements BundleActivator {
-
-    private static final String SERVICE_TITLE = "Apache Sling Runtime Environment to Feature Model converter";
-
-    private ServiceRegistration<RuntimeEnvironment2FeatureModel> registration;
-
-    @Override
-    public void start(BundleContext bundleContext) throws Exception {
-        Dictionary<String, Object> properties = new Hashtable<>();
-        properties.put(SERVICE_VENDOR, bundleContext.getBundle().getHeaders(BUNDLE_VENDOR));
-        properties.put(SERVICE_DESCRIPTION, SERVICE_TITLE);
-
-        registration = bundleContext.registerService(RuntimeEnvironment2FeatureModel.class, new RuntimeEnvironment2FeatureModelService(), properties);
-    }
-
-    @Override
-    public void stop(BundleContext context) throws Exception {
-        registration.unregister();
-    }
-
-}
diff --git a/runtime2feature/src/main/java/org/apache/sling/feature/r2f/impl/RuntimeEnvironment2FeatureModelService.java b/runtime2feature/src/main/java/org/apache/sling/feature/r2f/impl/RuntimeEnvironment2FeatureModelService.java
index e1f6356..f727261 100644
--- a/runtime2feature/src/main/java/org/apache/sling/feature/r2f/impl/RuntimeEnvironment2FeatureModelService.java
+++ b/runtime2feature/src/main/java/org/apache/sling/feature/r2f/impl/RuntimeEnvironment2FeatureModelService.java
@@ -17,7 +17,6 @@
 package org.apache.sling.feature.r2f.impl;
 
 import static java.nio.file.Files.newBufferedReader;
-import static java.util.Objects.requireNonNull;
 import static org.apache.sling.feature.io.json.FeatureJSONReader.read;
 
 import java.io.BufferedReader;
@@ -30,20 +29,29 @@ import java.util.stream.Stream;
 
 import org.apache.sling.feature.ArtifactId;
 import org.apache.sling.feature.Feature;
-import org.apache.sling.feature.r2f.ConversionRequest;
 import org.apache.sling.feature.r2f.RuntimeEnvironment2FeatureModel;
 import org.osgi.framework.Bundle;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.ServiceReference;
 import org.osgi.service.cm.Configuration;
 import org.osgi.service.cm.ConfigurationAdmin;
+import org.osgi.service.component.annotations.Activate;
+import org.osgi.service.component.annotations.Component;
+import org.osgi.service.component.annotations.Deactivate;
 
-public final class RuntimeEnvironment2FeatureModelService implements RuntimeEnvironment2FeatureModel {
+@Component(service = RuntimeEnvironment2FeatureModel.class)
+public class RuntimeEnvironment2FeatureModelService implements RuntimeEnvironment2FeatureModel {
 
     private static final String SLING_FEATURE_PROPERTY_NAME = "sling.feature";
 
-    @Override
-    public Feature getLaunchFeature(BundleContext bundleContext) {
+    protected BundleContext bundleContext;
+
+    private Feature launchFeature;
+
+    @Activate
+    public void start(BundleContext bundleContext) {
+        this.bundleContext = bundleContext;
+
         String launchFeatureLocation = bundleContext.getProperty(SLING_FEATURE_PROPERTY_NAME);
 
         if (launchFeatureLocation == null) {
@@ -54,18 +62,31 @@ public final class RuntimeEnvironment2FeatureModelService implements RuntimeEnvi
         Path launchFeaturePath = Paths.get(launchFeatureURI);
 
         try (BufferedReader reader = newBufferedReader(launchFeaturePath)) {
-            return read(reader, launchFeatureLocation);
+            launchFeature = read(reader, launchFeatureLocation);
         } catch (IOException cause) {
             throw new UncheckedIOException(cause);
         }
     }
 
+    @Deactivate
+    public void stop() {
+        bundleContext = null;
+        launchFeature = null;
+    }
+
+    @Override
+    public Feature getLaunchFeature() {
+        return launchFeature;
+    }
+
     @Override
-    public Feature getRuntimeFeature(ConversionRequest conversionRequest) {
-        ArtifactId resultId = requireNonNull(conversionRequest.getResultId(), "Impossible to create the Feature with a null id");
-        BundleContext bundleContext = requireNonNull(conversionRequest.getBundleContext(), "Impossible to create the Feature from a null BundleContext");
+    public Feature getRuntimeFeature() {
+        String groupId = launchFeature.getId().getGroupId();
+        String artifactId = launchFeature.getId().getArtifactId();
+        String version = launchFeature.getId().getArtifactId();
+        String classifier = launchFeature.getId().getArtifactId() + "-RUNTIME";
 
-        Feature targetFeature = new Feature(resultId);
+        Feature targetFeature = new Feature(new ArtifactId(groupId, artifactId, version, classifier, null));
 
         // collect all bundles
 
diff --git a/runtime2feature/src/main/java/org/apache/sling/feature/r2f/package-info.java b/runtime2feature/src/main/java/org/apache/sling/feature/r2f/package-info.java
index 15549c4..151085c 100644
--- a/runtime2feature/src/main/java/org/apache/sling/feature/r2f/package-info.java
+++ b/runtime2feature/src/main/java/org/apache/sling/feature/r2f/package-info.java
@@ -14,4 +14,6 @@
  * 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.r2f;


[sling-whiteboard] 04/06: [feature-diff] added package OSGi metadata Version

Posted by si...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

simonetripodi pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-whiteboard.git

commit 9869c6dac6f6938111d07bd101b148aad9d3800e
Author: Simo Tripodi <st...@adobe.com>
AuthorDate: Wed Jun 19 16:14:55 2019 +0200

    [feature-diff] added package OSGi metadata Version
---
 feature-diff/pom.xml                                               | 7 ++++++-
 .../src/main/java/org/apache/sling/feature/diff/package-info.java  | 1 +
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/feature-diff/pom.xml b/feature-diff/pom.xml
index 3c0e36d..d94467e 100644
--- a/feature-diff/pom.xml
+++ b/feature-diff/pom.xml
@@ -41,6 +41,11 @@
   </properties>
 
   <dependencies>
+    <dependency>
+      <groupId>org.osgi</groupId>
+      <artifactId>org.osgi.annotation.versioning</artifactId>
+      <scope>provided</scope>
+    </dependency>
     <!--
      | utilities
     -->
@@ -124,7 +129,7 @@
         <extensions>true</extensions>
         <configuration>
           <instructions>
-            <Export-Package>org.apache.sling.feature.diff*;version=${project.version}</Export-Package>
+            <Export-Package>org.apache.sling.feature.diff*</Export-Package>
             <Import-Package>
               org.apache.sling.feature*,
               org.apache.commons.collections4*,
diff --git a/feature-diff/src/main/java/org/apache/sling/feature/diff/package-info.java b/feature-diff/src/main/java/org/apache/sling/feature/diff/package-info.java
index c8c9fa8..8a67aff 100644
--- a/feature-diff/src/main/java/org/apache/sling/feature/diff/package-info.java
+++ b/feature-diff/src/main/java/org/apache/sling/feature/diff/package-info.java
@@ -18,4 +18,5 @@
 /**
  * Core APIs to compare different Apache Sling Feature models.
  */
+@org.osgi.annotation.versioning.Version("1.0.0")
 package org.apache.sling.feature.diff;


[sling-whiteboard] 01/06: [feature-diff] comparators are implementations, a good style is to name the package "impl" or "internal" They don't need a package-info file

Posted by si...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

simonetripodi pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-whiteboard.git

commit 5b959883d8d8639ddcb40a6428db6fbf37a61728
Author: Simo Tripodi <st...@adobe.com>
AuthorDate: Wed Jun 19 14:46:04 2019 +0200

    [feature-diff] comparators are implementations, a good style is to name
    the package "impl" or "internal" They don't need a package-info file
---
 .../sling/feature/diff/comparators/package-info.java    | 17 -----------------
 .../AbstractFeatureElementComparator.java               |  2 +-
 .../diff/{comparators => impl}/BundlesComparator.java   |  2 +-
 .../{comparators => impl}/ConfigurationsComparator.java |  2 +-
 .../{comparators => impl}/ExtensionsComparator.java     |  2 +-
 .../FrameworkPropertiesComparator.java                  |  2 +-
 .../{comparators => impl}/AbstractComparatorTest.java   |  2 +-
 .../{comparators => impl}/BundlesComparatorTest.java    |  4 ++--
 .../ConfigurationsComparatorTest.java                   |  4 ++--
 .../FrameworkPropertiesComparatorTest.java              |  4 ++--
 10 files changed, 12 insertions(+), 29 deletions(-)

diff --git a/feature-diff/src/main/java/org/apache/sling/feature/diff/comparators/package-info.java b/feature-diff/src/main/java/org/apache/sling/feature/diff/comparators/package-info.java
deleted file mode 100644
index 4a7639a..0000000
--- a/feature-diff/src/main/java/org/apache/sling/feature/diff/comparators/package-info.java
+++ /dev/null
@@ -1,17 +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.diff.comparators;
diff --git a/feature-diff/src/main/java/org/apache/sling/feature/diff/comparators/AbstractFeatureElementComparator.java b/feature-diff/src/main/java/org/apache/sling/feature/diff/impl/AbstractFeatureElementComparator.java
similarity index 96%
rename from feature-diff/src/main/java/org/apache/sling/feature/diff/comparators/AbstractFeatureElementComparator.java
rename to feature-diff/src/main/java/org/apache/sling/feature/diff/impl/AbstractFeatureElementComparator.java
index d34ae1c..9949a59 100644
--- a/feature-diff/src/main/java/org/apache/sling/feature/diff/comparators/AbstractFeatureElementComparator.java
+++ b/feature-diff/src/main/java/org/apache/sling/feature/diff/impl/AbstractFeatureElementComparator.java
@@ -14,7 +14,7 @@
  * License for the specific language governing permissions and limitations under
  * the License.
  */
-package org.apache.sling.feature.diff.comparators;
+package org.apache.sling.feature.diff.impl;
 
 import org.apache.sling.feature.diff.spi.FeatureElementComparator;
 
diff --git a/feature-diff/src/main/java/org/apache/sling/feature/diff/comparators/BundlesComparator.java b/feature-diff/src/main/java/org/apache/sling/feature/diff/impl/BundlesComparator.java
similarity index 97%
rename from feature-diff/src/main/java/org/apache/sling/feature/diff/comparators/BundlesComparator.java
rename to feature-diff/src/main/java/org/apache/sling/feature/diff/impl/BundlesComparator.java
index f9806ad..618ede9 100644
--- a/feature-diff/src/main/java/org/apache/sling/feature/diff/comparators/BundlesComparator.java
+++ b/feature-diff/src/main/java/org/apache/sling/feature/diff/impl/BundlesComparator.java
@@ -14,7 +14,7 @@
  * License for the specific language governing permissions and limitations under
  * the License.
  */
-package org.apache.sling.feature.diff.comparators;
+package org.apache.sling.feature.diff.impl;
 
 import org.apache.sling.feature.Artifact;
 import org.apache.sling.feature.Artifacts;
diff --git a/feature-diff/src/main/java/org/apache/sling/feature/diff/comparators/ConfigurationsComparator.java b/feature-diff/src/main/java/org/apache/sling/feature/diff/impl/ConfigurationsComparator.java
similarity index 98%
rename from feature-diff/src/main/java/org/apache/sling/feature/diff/comparators/ConfigurationsComparator.java
rename to feature-diff/src/main/java/org/apache/sling/feature/diff/impl/ConfigurationsComparator.java
index 1b22a21..e9d05e4 100644
--- a/feature-diff/src/main/java/org/apache/sling/feature/diff/comparators/ConfigurationsComparator.java
+++ b/feature-diff/src/main/java/org/apache/sling/feature/diff/impl/ConfigurationsComparator.java
@@ -14,7 +14,7 @@
  * License for the specific language governing permissions and limitations under
  * the License.
  */
-package org.apache.sling.feature.diff.comparators;
+package org.apache.sling.feature.diff.impl;
 
 import static org.apache.commons.lang3.builder.EqualsBuilder.reflectionEquals;
 
diff --git a/feature-diff/src/main/java/org/apache/sling/feature/diff/comparators/ExtensionsComparator.java b/feature-diff/src/main/java/org/apache/sling/feature/diff/impl/ExtensionsComparator.java
similarity index 99%
rename from feature-diff/src/main/java/org/apache/sling/feature/diff/comparators/ExtensionsComparator.java
rename to feature-diff/src/main/java/org/apache/sling/feature/diff/impl/ExtensionsComparator.java
index f4c59c8..33bb11b 100644
--- a/feature-diff/src/main/java/org/apache/sling/feature/diff/comparators/ExtensionsComparator.java
+++ b/feature-diff/src/main/java/org/apache/sling/feature/diff/impl/ExtensionsComparator.java
@@ -14,7 +14,7 @@
  * License for the specific language governing permissions and limitations under
  * the License.
  */
-package org.apache.sling.feature.diff.comparators;
+package org.apache.sling.feature.diff.impl;
 
 import java.io.IOException;
 import java.util.LinkedList;
diff --git a/feature-diff/src/main/java/org/apache/sling/feature/diff/comparators/FrameworkPropertiesComparator.java b/feature-diff/src/main/java/org/apache/sling/feature/diff/impl/FrameworkPropertiesComparator.java
similarity index 98%
rename from feature-diff/src/main/java/org/apache/sling/feature/diff/comparators/FrameworkPropertiesComparator.java
rename to feature-diff/src/main/java/org/apache/sling/feature/diff/impl/FrameworkPropertiesComparator.java
index 1ef3815..b9f56dd 100644
--- a/feature-diff/src/main/java/org/apache/sling/feature/diff/comparators/FrameworkPropertiesComparator.java
+++ b/feature-diff/src/main/java/org/apache/sling/feature/diff/impl/FrameworkPropertiesComparator.java
@@ -14,7 +14,7 @@
  * License for the specific language governing permissions and limitations under
  * the License.
  */
-package org.apache.sling.feature.diff.comparators;
+package org.apache.sling.feature.diff.impl;
 
 import java.util.Map;
 import java.util.Map.Entry;
diff --git a/feature-diff/src/test/java/org/apache/sling/feature/diff/comparators/AbstractComparatorTest.java b/feature-diff/src/test/java/org/apache/sling/feature/diff/impl/AbstractComparatorTest.java
similarity index 97%
rename from feature-diff/src/test/java/org/apache/sling/feature/diff/comparators/AbstractComparatorTest.java
rename to feature-diff/src/test/java/org/apache/sling/feature/diff/impl/AbstractComparatorTest.java
index 4dacbc3..2840bbb 100644
--- a/feature-diff/src/test/java/org/apache/sling/feature/diff/comparators/AbstractComparatorTest.java
+++ b/feature-diff/src/test/java/org/apache/sling/feature/diff/impl/AbstractComparatorTest.java
@@ -14,7 +14,7 @@
  * License for the specific language governing permissions and limitations under
  * the License.
  */
-package org.apache.sling.feature.diff.comparators;
+package org.apache.sling.feature.diff.impl;
 
 import org.apache.sling.feature.ArtifactId;
 import org.apache.sling.feature.Feature;
diff --git a/feature-diff/src/test/java/org/apache/sling/feature/diff/comparators/BundlesComparatorTest.java b/feature-diff/src/test/java/org/apache/sling/feature/diff/impl/BundlesComparatorTest.java
similarity index 96%
rename from feature-diff/src/test/java/org/apache/sling/feature/diff/comparators/BundlesComparatorTest.java
rename to feature-diff/src/test/java/org/apache/sling/feature/diff/impl/BundlesComparatorTest.java
index b38edf8..0d60724 100644
--- a/feature-diff/src/test/java/org/apache/sling/feature/diff/comparators/BundlesComparatorTest.java
+++ b/feature-diff/src/test/java/org/apache/sling/feature/diff/impl/BundlesComparatorTest.java
@@ -14,7 +14,7 @@
  * License for the specific language governing permissions and limitations under
  * the License.
  */
-package org.apache.sling.feature.diff.comparators;
+package org.apache.sling.feature.diff.impl;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
@@ -23,7 +23,7 @@ import static org.junit.Assert.assertTrue;
 import org.apache.sling.feature.Artifact;
 import org.apache.sling.feature.ArtifactId;
 import org.apache.sling.feature.Artifacts;
-import org.apache.sling.feature.diff.comparators.BundlesComparator;
+import org.apache.sling.feature.diff.impl.BundlesComparator;
 import org.junit.Test;
 
 public class BundlesComparatorTest extends AbstractComparatorTest<BundlesComparator> {
diff --git a/feature-diff/src/test/java/org/apache/sling/feature/diff/comparators/ConfigurationsComparatorTest.java b/feature-diff/src/test/java/org/apache/sling/feature/diff/impl/ConfigurationsComparatorTest.java
similarity index 97%
rename from feature-diff/src/test/java/org/apache/sling/feature/diff/comparators/ConfigurationsComparatorTest.java
rename to feature-diff/src/test/java/org/apache/sling/feature/diff/impl/ConfigurationsComparatorTest.java
index 68bd5b6..1e333fc 100644
--- a/feature-diff/src/test/java/org/apache/sling/feature/diff/comparators/ConfigurationsComparatorTest.java
+++ b/feature-diff/src/test/java/org/apache/sling/feature/diff/impl/ConfigurationsComparatorTest.java
@@ -14,7 +14,7 @@
  * License for the specific language governing permissions and limitations under
  * the License.
  */
-package org.apache.sling.feature.diff.comparators;
+package org.apache.sling.feature.diff.impl;
 
 import static org.junit.Assert.assertArrayEquals;
 import static org.junit.Assert.assertEquals;
@@ -25,7 +25,7 @@ import java.util.Dictionary;
 
 import org.apache.sling.feature.Configuration;
 import org.apache.sling.feature.Configurations;
-import org.apache.sling.feature.diff.comparators.ConfigurationsComparator;
+import org.apache.sling.feature.diff.impl.ConfigurationsComparator;
 import org.junit.Test;
 
 public class ConfigurationsComparatorTest extends AbstractComparatorTest<ConfigurationsComparator> {
diff --git a/feature-diff/src/test/java/org/apache/sling/feature/diff/comparators/FrameworkPropertiesComparatorTest.java b/feature-diff/src/test/java/org/apache/sling/feature/diff/impl/FrameworkPropertiesComparatorTest.java
similarity index 95%
rename from feature-diff/src/test/java/org/apache/sling/feature/diff/comparators/FrameworkPropertiesComparatorTest.java
rename to feature-diff/src/test/java/org/apache/sling/feature/diff/impl/FrameworkPropertiesComparatorTest.java
index 30cb04e..9c4122f 100644
--- a/feature-diff/src/test/java/org/apache/sling/feature/diff/comparators/FrameworkPropertiesComparatorTest.java
+++ b/feature-diff/src/test/java/org/apache/sling/feature/diff/impl/FrameworkPropertiesComparatorTest.java
@@ -14,7 +14,7 @@
  * License for the specific language governing permissions and limitations under
  * the License.
  */
-package org.apache.sling.feature.diff.comparators;
+package org.apache.sling.feature.diff.impl;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
@@ -23,7 +23,7 @@ import static org.junit.Assert.assertTrue;
 import java.util.HashMap;
 import java.util.Map;
 
-import org.apache.sling.feature.diff.comparators.FrameworkPropertiesComparator;
+import org.apache.sling.feature.diff.impl.FrameworkPropertiesComparator;
 import org.junit.Test;
 
 public class FrameworkPropertiesComparatorTest extends AbstractComparatorTest<FrameworkPropertiesComparator> {