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/18 11:45:30 UTC

[sling-whiteboard] branch master updated (34da23e -> 0e5508c)

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 34da23e  Tweak comments in pom.xml
     new 6e9daa0  [r2f] accessing to the base Feature Model via 'sling.feature' framework-property
     new 518881b  [r2f] correctly retrieved the sling.feature framework property
     new ce4c32a  [r2f] assemble right ArtifactId for runtime and diff Feature
     new 1967a95  [feature-diff][r2f] artifacts correctly made bundles
     new 0e5508c  Merge branch 'master' of github.com:apache/sling-whiteboard

The 5 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/pom.xml                               | 11 +++++++
 runtime2feature/pom.xml                            |  1 +
 ...ractRuntimeEnvironment2FeatureModelPrinter.java | 35 +++++++++++++++++-----
 .../impl/BaseFeature2CurrentRuntimePrinter.java    | 15 ++--------
 .../RuntimeEnvironment2FeatureModelActivator.java  | 10 +++++--
 .../RuntimeEnvironment2FeatureModelPrinter.java    |  2 +-
 6 files changed, 51 insertions(+), 23 deletions(-)


[sling-whiteboard] 01/05: [r2f] accessing to the base Feature Model via 'sling.feature' framework-property

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 6e9daa0fc525f4031ebd384cf93d8c8d3265b18b
Author: Simo Tripodi <st...@adobe.com>
AuthorDate: Mon Jun 17 14:28:21 2019 +0200

    [r2f] accessing to the base Feature Model via 'sling.feature'
    framework-property
---
 .../impl/BaseFeature2CurrentRuntimePrinter.java    | 30 +++++++++++++++++++++-
 1 file changed, 29 insertions(+), 1 deletion(-)

diff --git a/runtime2feature/src/main/java/org/apache/sling/feature/r2f/impl/BaseFeature2CurrentRuntimePrinter.java b/runtime2feature/src/main/java/org/apache/sling/feature/r2f/impl/BaseFeature2CurrentRuntimePrinter.java
index a083969..df6312c 100644
--- a/runtime2feature/src/main/java/org/apache/sling/feature/r2f/impl/BaseFeature2CurrentRuntimePrinter.java
+++ b/runtime2feature/src/main/java/org/apache/sling/feature/r2f/impl/BaseFeature2CurrentRuntimePrinter.java
@@ -16,6 +16,11 @@
  */
 package org.apache.sling.feature.r2f.impl;
 
+import static org.apache.sling.feature.io.json.FeatureJSONReader.read;
+
+import java.io.IOException;
+import java.io.StringReader;
+
 import static org.apache.sling.feature.diff.FeatureDiff.compareFeatures;
 
 import org.apache.sling.feature.ArtifactId;
@@ -32,8 +37,31 @@ public class BaseFeature2CurrentRuntimePrinter extends AbstractRuntimeEnvironmen
 
     @Override
     protected Feature compute(Feature currentFeature) {
-        // TODO
         Feature previousFeature = null;
+        Object previousFeatureObject = getBundleContext().getProperty("sling.feature");
+
+        if (previousFeatureObject == null) {
+            throw new IllegalStateException("'sling.feature' framework-property is not available");
+        }
+
+        if (previousFeatureObject instanceof String) {
+            String previousFeatureString = (String) previousFeatureObject;
+            try (StringReader reader = new StringReader(previousFeatureString)) {
+                previousFeature = read(reader, "framework-properties.sling.feature");
+            } catch (IOException e) {
+                throw new RuntimeException("An error occurred while reading 'sling.feature' framework-property "
+                                           + previousFeatureObject
+                                           + ", see causing error(s):",
+                                           e);
+            }
+        } else if (previousFeatureObject instanceof Feature) {
+            previousFeature = (Feature) previousFeatureObject;
+        } else {
+            throw new RuntimeException("'sling.feature' framework property "
+                                       + previousFeatureObject
+                                       + " is of unmanagede type "
+                                       + previousFeatureObject.getClass());
+        }
 
         StringBuilder classifier = new StringBuilder()
                                    .append(previousFeature.getId().getVersion())


[sling-whiteboard] 05/05: 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 0e5508c4f0b7907efc4c3e82574031af3091d9be
Merge: 1967a95 34da23e
Author: Simo Tripodi <st...@adobe.com>
AuthorDate: Tue Jun 18 13:29:32 2019 +0200

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

 url-connection-agent/README.md                     | 14 ++--
 url-connection-agent/pom.xml                       |  5 +-
 .../main/java/org/apache/sling/uca/impl/Agent.java | 28 ++++++--
 .../java/org/apache/sling/uca/impl/AgentInfo.java  | 77 ++++++++++++++++++++++
 ...TimeoutTransformer.java => AgentInfoMBean.java} | 42 ++++++++----
 .../uca/impl/HttpClient3TimeoutTransformer.java    | 51 ++++++--------
 .../uca/impl/HttpClient4TimeoutTransformer.java    |  6 +-
 .../sling/uca/impl/JavaNetTimeoutTransformer.java  | 51 ++++----------
 .../uca/impl/MBeanAwareTimeoutTransformer.java     | 75 +++++++++++++++++++++
 .../sling/uca/impl/OkHttpTimeoutTransformer.java   |  4 +-
 ...pdateFieldsInConstructorTimeoutTransformer.java | 52 ++++++---------
 .../uca/impl/JaveNetTimeoutTransformerTest.java    | 51 --------------
 12 files changed, 269 insertions(+), 187 deletions(-)


[sling-whiteboard] 02/05: [r2f] correctly retrieved the sling.feature framework property

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 518881bc053e0b7dcad16e8f128a7b6f50a37672
Author: Simo Tripodi <st...@adobe.com>
AuthorDate: Tue Jun 18 12:23:05 2019 +0200

    [r2f] correctly retrieved the sling.feature framework property
---
 .../impl/BaseFeature2CurrentRuntimePrinter.java    | 43 +++++++++-------------
 .../RuntimeEnvironment2FeatureModelActivator.java  | 10 ++++-
 2 files changed, 26 insertions(+), 27 deletions(-)

diff --git a/runtime2feature/src/main/java/org/apache/sling/feature/r2f/impl/BaseFeature2CurrentRuntimePrinter.java b/runtime2feature/src/main/java/org/apache/sling/feature/r2f/impl/BaseFeature2CurrentRuntimePrinter.java
index df6312c..9e1fb82 100644
--- a/runtime2feature/src/main/java/org/apache/sling/feature/r2f/impl/BaseFeature2CurrentRuntimePrinter.java
+++ b/runtime2feature/src/main/java/org/apache/sling/feature/r2f/impl/BaseFeature2CurrentRuntimePrinter.java
@@ -16,12 +16,15 @@
  */
 package org.apache.sling.feature.r2f.impl;
 
+import static java.nio.file.Files.newBufferedReader;
+import static org.apache.sling.feature.diff.FeatureDiff.compareFeatures;
 import static org.apache.sling.feature.io.json.FeatureJSONReader.read;
 
 import java.io.IOException;
-import java.io.StringReader;
-
-import static org.apache.sling.feature.diff.FeatureDiff.compareFeatures;
+import java.io.Reader;
+import java.net.URI;
+import java.nio.file.Path;
+import java.nio.file.Paths;
 
 import org.apache.sling.feature.ArtifactId;
 import org.apache.sling.feature.Feature;
@@ -31,36 +34,26 @@ import org.osgi.framework.BundleContext;
 
 public class BaseFeature2CurrentRuntimePrinter extends AbstractRuntimeEnvironment2FeatureModelPrinter {
 
+    private static final String SLING_FEATURE_PROPERTY_NAME = "sling.feature";
+
     public BaseFeature2CurrentRuntimePrinter(RuntimeEnvironment2FeatureModel generator, BundleContext bundleContext) {
         super(generator, bundleContext);
     }
 
     @Override
     protected Feature compute(Feature currentFeature) {
+        String previousFeatureLocation = getBundleContext().getProperty(SLING_FEATURE_PROPERTY_NAME);
+        URI previousFeatureURI = URI.create(previousFeatureLocation);
+        Path previousFeaturePath = Paths.get(previousFeatureURI);
         Feature previousFeature = null;
-        Object previousFeatureObject = getBundleContext().getProperty("sling.feature");
-
-        if (previousFeatureObject == null) {
-            throw new IllegalStateException("'sling.feature' framework-property is not available");
-        }
 
-        if (previousFeatureObject instanceof String) {
-            String previousFeatureString = (String) previousFeatureObject;
-            try (StringReader reader = new StringReader(previousFeatureString)) {
-                previousFeature = read(reader, "framework-properties.sling.feature");
-            } catch (IOException e) {
-                throw new RuntimeException("An error occurred while reading 'sling.feature' framework-property "
-                                           + previousFeatureObject
-                                           + ", see causing error(s):",
-                                           e);
-            }
-        } else if (previousFeatureObject instanceof Feature) {
-            previousFeature = (Feature) previousFeatureObject;
-        } else {
-            throw new RuntimeException("'sling.feature' framework property "
-                                       + previousFeatureObject
-                                       + " is of unmanagede type "
-                                       + previousFeatureObject.getClass());
+        try (Reader reader = newBufferedReader(previousFeaturePath)) {
+            previousFeature = read(reader, previousFeatureLocation);
+        } catch (IOException e) {
+            throw new RuntimeException("An error occurred while reading 'sling.feature' framework-property "
+                    + previousFeatureLocation
+                    + ", see causing error(s):",
+                    e);
         }
 
         StringBuilder classifier = new StringBuilder()
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
index 6e26d76..0811d94 100644
--- 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
@@ -16,6 +16,8 @@
  */
 package org.apache.sling.feature.r2f.impl;
 
+import static org.apache.felix.inventory.Format.JSON;
+import static org.apache.felix.inventory.InventoryPrinter.FORMAT;
 import static org.apache.felix.inventory.InventoryPrinter.NAME;
 import static org.apache.felix.inventory.InventoryPrinter.TITLE;
 import static org.osgi.framework.Constants.BUNDLE_VENDOR;
@@ -62,8 +64,12 @@ public final class RuntimeEnvironment2FeatureModelActivator implements BundleAct
         properties.put(SERVICE_VENDOR, bundleContext.getBundle().getHeaders(BUNDLE_VENDOR));
         putProperty(SERVICE_DESCRIPTION, SERVICE_TITLE, classifier, properties);
         putProperty(SERVICE_DESCRIPTION, SERVICE_TITLE, classifier, properties);
-        putProperty(NAME, SERVICE_NAME, classifier, properties);
-        putProperty(TITLE, SERVICE_TITLE, classifier, properties);
+
+        if (InventoryPrinter.class.isAssignableFrom(type)) {
+            putProperty(NAME, SERVICE_NAME, classifier, properties);
+            putProperty(TITLE, SERVICE_TITLE, classifier, properties);
+            putProperty(FORMAT, JSON.toString(), classifier, properties);
+        }
 
         registrations.add(bundleContext.registerService(type, service, properties));
     }


[sling-whiteboard] 04/05: [feature-diff][r2f] artifacts correctly made bundles

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 1967a95f1a9737851e6be80007b8e610ff52286a
Author: Simo Tripodi <st...@adobe.com>
AuthorDate: Tue Jun 18 13:29:15 2019 +0200

    [feature-diff][r2f] artifacts correctly made bundles
---
 feature-diff/pom.xml    | 11 +++++++++++
 runtime2feature/pom.xml |  1 +
 2 files changed, 12 insertions(+)

diff --git a/feature-diff/pom.xml b/feature-diff/pom.xml
index 7e18df3..365744d 100644
--- a/feature-diff/pom.xml
+++ b/feature-diff/pom.xml
@@ -29,6 +29,7 @@
 
   <artifactId>org.apache.sling.feature.diff</artifactId>
   <version>0.0.1-SNAPSHOT</version>
+  <packaging>bundle</packaging>
 
   <name>Apache Sling Feature Model diff tool</name>
   <description>Feature Model diff tool for Apache Sling</description>
@@ -90,4 +91,14 @@
     </dependency>
   </dependencies>
 
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.felix</groupId>
+        <artifactId>maven-bundle-plugin</artifactId>
+        <extensions>true</extensions>
+      </plugin>
+    </plugins>
+  </build>
+
 </project>
diff --git a/runtime2feature/pom.xml b/runtime2feature/pom.xml
index 85563a6..d0046be 100644
--- a/runtime2feature/pom.xml
+++ b/runtime2feature/pom.xml
@@ -29,6 +29,7 @@
 
   <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>


[sling-whiteboard] 03/05: [r2f] assemble right ArtifactId for runtime and diff Feature

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 ce4c32a9f369ceffc9840e0b23240ab73ec56fc4
Author: Simo Tripodi <st...@adobe.com>
AuthorDate: Tue Jun 18 12:34:35 2019 +0200

    [r2f] assemble right ArtifactId for runtime and diff Feature
---
 ...ractRuntimeEnvironment2FeatureModelPrinter.java | 35 ++++++++++++++++-----
 .../impl/BaseFeature2CurrentRuntimePrinter.java    | 36 ++--------------------
 .../RuntimeEnvironment2FeatureModelPrinter.java    |  2 +-
 3 files changed, 31 insertions(+), 42 deletions(-)

diff --git a/runtime2feature/src/main/java/org/apache/sling/feature/r2f/impl/AbstractRuntimeEnvironment2FeatureModelPrinter.java b/runtime2feature/src/main/java/org/apache/sling/feature/r2f/impl/AbstractRuntimeEnvironment2FeatureModelPrinter.java
index cb7a1cb..c3df2e4 100644
--- a/runtime2feature/src/main/java/org/apache/sling/feature/r2f/impl/AbstractRuntimeEnvironment2FeatureModelPrinter.java
+++ b/runtime2feature/src/main/java/org/apache/sling/feature/r2f/impl/AbstractRuntimeEnvironment2FeatureModelPrinter.java
@@ -16,10 +16,16 @@
  */
 package org.apache.sling.feature.r2f.impl;
 
+import static java.nio.file.Files.newBufferedReader;
+import static org.apache.sling.feature.io.json.FeatureJSONReader.read;
 import static org.apache.sling.feature.io.json.FeatureJSONWriter.write;
 
 import java.io.IOException;
 import java.io.PrintWriter;
+import java.io.Reader;
+import java.net.URI;
+import java.nio.file.Path;
+import java.nio.file.Paths;
 
 import org.apache.felix.inventory.Format;
 import org.apache.felix.inventory.InventoryPrinter;
@@ -32,6 +38,8 @@ import org.osgi.framework.BundleContext;
 
 abstract class AbstractRuntimeEnvironment2FeatureModelPrinter implements InventoryPrinter {
 
+    private static final String SLING_FEATURE_PROPERTY_NAME = "sling.feature";
+
     private final RuntimeEnvironment2FeatureModel generator;
 
     private final BundleContext bundleContext;
@@ -48,18 +56,31 @@ abstract class AbstractRuntimeEnvironment2FeatureModelPrinter implements Invento
 
     @Override
     public final void print(PrintWriter printWriter, Format format, boolean isZip) {
-        // TODO
-        String groupId = bundleContext.getProperty(null);
-        String artifactId = bundleContext.getProperty(null);
-        String version = bundleContext.getProperty(null);
-        String classifier = bundleContext.getProperty(null);
+        String previousFeatureLocation = getBundleContext().getProperty(SLING_FEATURE_PROPERTY_NAME);
+        URI previousFeatureURI = URI.create(previousFeatureLocation);
+        Path previousFeaturePath = Paths.get(previousFeatureURI);
+        Feature previousFeature = null;
+
+        try (Reader reader = newBufferedReader(previousFeaturePath)) {
+            previousFeature = read(reader, previousFeatureLocation);
+        } catch (IOException e) {
+            throw new RuntimeException("An error occurred while reading 'sling.feature' framework-property "
+                    + previousFeatureLocation
+                    + ", see causing error(s):",
+                    e);
+        }
+
+        String groupId = previousFeature.getId().getGroupId();
+        String artifactId = previousFeature.getId().getArtifactId();
+        String version = previousFeature.getId().getArtifactId();
+        String classifier = previousFeature.getId().getArtifactId() + "-RUNTIME";
 
         ConversionRequest request = new DefaultConversionRequest()
                                     .setBundleContext(bundleContext)
                                     .setResultId(new ArtifactId(groupId, artifactId, version, classifier, null));
         Feature currentFeature = generator.scanAndAssemble(request);
 
-        Feature computedFeature = compute(currentFeature);
+        Feature computedFeature = compute(previousFeature, currentFeature);
 
         try {
             write(printWriter, computedFeature);
@@ -72,6 +93,6 @@ abstract class AbstractRuntimeEnvironment2FeatureModelPrinter implements Invento
         }
     }
 
-    protected abstract Feature compute(Feature currentFeature);
+    protected abstract Feature compute(Feature previousFeature, Feature currentFeature);
 
 }
diff --git a/runtime2feature/src/main/java/org/apache/sling/feature/r2f/impl/BaseFeature2CurrentRuntimePrinter.java b/runtime2feature/src/main/java/org/apache/sling/feature/r2f/impl/BaseFeature2CurrentRuntimePrinter.java
index 9e1fb82..f09e581 100644
--- a/runtime2feature/src/main/java/org/apache/sling/feature/r2f/impl/BaseFeature2CurrentRuntimePrinter.java
+++ b/runtime2feature/src/main/java/org/apache/sling/feature/r2f/impl/BaseFeature2CurrentRuntimePrinter.java
@@ -16,15 +16,7 @@
  */
 package org.apache.sling.feature.r2f.impl;
 
-import static java.nio.file.Files.newBufferedReader;
 import static org.apache.sling.feature.diff.FeatureDiff.compareFeatures;
-import static org.apache.sling.feature.io.json.FeatureJSONReader.read;
-
-import java.io.IOException;
-import java.io.Reader;
-import java.net.URI;
-import java.nio.file.Path;
-import java.nio.file.Paths;
 
 import org.apache.sling.feature.ArtifactId;
 import org.apache.sling.feature.Feature;
@@ -34,36 +26,12 @@ import org.osgi.framework.BundleContext;
 
 public class BaseFeature2CurrentRuntimePrinter extends AbstractRuntimeEnvironment2FeatureModelPrinter {
 
-    private static final String SLING_FEATURE_PROPERTY_NAME = "sling.feature";
-
     public BaseFeature2CurrentRuntimePrinter(RuntimeEnvironment2FeatureModel generator, BundleContext bundleContext) {
         super(generator, bundleContext);
     }
 
     @Override
-    protected Feature compute(Feature currentFeature) {
-        String previousFeatureLocation = getBundleContext().getProperty(SLING_FEATURE_PROPERTY_NAME);
-        URI previousFeatureURI = URI.create(previousFeatureLocation);
-        Path previousFeaturePath = Paths.get(previousFeatureURI);
-        Feature previousFeature = null;
-
-        try (Reader reader = newBufferedReader(previousFeaturePath)) {
-            previousFeature = read(reader, previousFeatureLocation);
-        } catch (IOException e) {
-            throw new RuntimeException("An error occurred while reading 'sling.feature' framework-property "
-                    + previousFeatureLocation
-                    + ", see causing error(s):",
-                    e);
-        }
-
-        StringBuilder classifier = new StringBuilder()
-                                   .append(previousFeature.getId().getVersion())
-                                   .append("-to-")
-                                   .append(currentFeature.getId().getVersion())
-                                   .append('-')
-                                   .append(currentFeature.getId().getClassifier())
-                                   .append("-upgrade");
-
+    protected Feature compute(Feature previousFeature, Feature currentFeature) {
         Feature featureDiff = compareFeatures(new DefaultDiffRequest()
                                               .setPrevious(previousFeature)
                                               .setCurrent(currentFeature)
@@ -72,7 +40,7 @@ public class BaseFeature2CurrentRuntimePrinter extends AbstractRuntimeEnvironmen
                                               .setResultId(new ArtifactId(currentFeature.getId().getGroupId(),
                                                            currentFeature.getId().getArtifactId(), 
                                                            currentFeature.getId().getVersion(),
-                                                           classifier.toString(),
+                                                           currentFeature.getId().getClassifier() + "_upgrade",
                                                            currentFeature.getId().getType())));
 
         return featureDiff;
diff --git a/runtime2feature/src/main/java/org/apache/sling/feature/r2f/impl/RuntimeEnvironment2FeatureModelPrinter.java b/runtime2feature/src/main/java/org/apache/sling/feature/r2f/impl/RuntimeEnvironment2FeatureModelPrinter.java
index 82eec3d..9e53c2e 100644
--- a/runtime2feature/src/main/java/org/apache/sling/feature/r2f/impl/RuntimeEnvironment2FeatureModelPrinter.java
+++ b/runtime2feature/src/main/java/org/apache/sling/feature/r2f/impl/RuntimeEnvironment2FeatureModelPrinter.java
@@ -27,7 +27,7 @@ public final class RuntimeEnvironment2FeatureModelPrinter extends AbstractRuntim
     }
 
     @Override
-    protected Feature compute(Feature currentFeature) {
+    protected Feature compute(Feature previousFeature, Feature currentFeature) {
         return currentFeature;
     }