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 18:08:07 UTC
[sling-org-apache-sling-feature-inventoryprinter] branch r2f
updated: Fixed the Service declaration via SCR annotations
This is an automated email from the ASF dual-hosted git repository.
simonetripodi pushed a commit to branch r2f
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-feature-inventoryprinter.git
The following commit(s) were added to refs/heads/r2f by this push:
new 04430ef Fixed the Service declaration via SCR annotations
04430ef is described below
commit 04430ef8b51fe2968dad97d8da645311bda7440a
Author: Simo Tripodi <st...@adobe.com>
AuthorDate: Tue Jun 18 20:07:58 2019 +0200
Fixed the Service declaration via SCR annotations
---
.../impl/AbstractFeatureInventoryPrinter.java | 4 +---
.../impl/AbstractRuntimeEnvironment2FeatureModelPrinter.java | 4 +---
.../impl/BaseFeature2CurrentRuntimePrinter.java | 12 ++++++++++++
.../inventoryservice/impl/FeaturesInventoryPrinter.java | 12 ++++++++++++
.../impl/RuntimeEnvironment2FeatureModelPrinter.java | 12 ++++++++++++
5 files changed, 38 insertions(+), 6 deletions(-)
diff --git a/src/main/java/org/apache/sling/feature/inventoryservice/impl/AbstractFeatureInventoryPrinter.java b/src/main/java/org/apache/sling/feature/inventoryservice/impl/AbstractFeatureInventoryPrinter.java
index c11efa2..b3d55eb 100644
--- a/src/main/java/org/apache/sling/feature/inventoryservice/impl/AbstractFeatureInventoryPrinter.java
+++ b/src/main/java/org/apache/sling/feature/inventoryservice/impl/AbstractFeatureInventoryPrinter.java
@@ -30,14 +30,12 @@ import java.nio.file.Paths;
import org.apache.felix.inventory.Format;
import org.apache.felix.inventory.InventoryPrinter;
import org.osgi.framework.BundleContext;
-import org.osgi.service.component.annotations.Activate;
abstract class AbstractFeatureInventoryPrinter implements InventoryPrinter {
private static final String SLING_FEATURE_PROPERTY_NAME = "sling.feature";
- @Activate
- BundleContext bundleContext;
+ protected BundleContext bundleContext;
@Override
public final void print(PrintWriter printWriter, Format format, boolean isZip) {
diff --git a/src/main/java/org/apache/sling/feature/inventoryservice/impl/AbstractRuntimeEnvironment2FeatureModelPrinter.java b/src/main/java/org/apache/sling/feature/inventoryservice/impl/AbstractRuntimeEnvironment2FeatureModelPrinter.java
index 6d71c9d..ab03c50 100644
--- a/src/main/java/org/apache/sling/feature/inventoryservice/impl/AbstractRuntimeEnvironment2FeatureModelPrinter.java
+++ b/src/main/java/org/apache/sling/feature/inventoryservice/impl/AbstractRuntimeEnvironment2FeatureModelPrinter.java
@@ -27,12 +27,10 @@ import org.apache.sling.feature.Feature;
import org.apache.sling.feature.r2f.ConversionRequest;
import org.apache.sling.feature.r2f.DefaultConversionRequest;
import org.apache.sling.feature.r2f.RuntimeEnvironment2FeatureModel;
-import org.osgi.service.component.annotations.Reference;
abstract class AbstractRuntimeEnvironment2FeatureModelPrinter extends AbstractFeatureInventoryPrinter {
- @Reference
- RuntimeEnvironment2FeatureModel generator;
+ private RuntimeEnvironment2FeatureModel generator;
@Override
protected void onFeature(String featureLocation, BufferedReader reader, PrintWriter printWriter) throws Exception {
diff --git a/src/main/java/org/apache/sling/feature/inventoryservice/impl/BaseFeature2CurrentRuntimePrinter.java b/src/main/java/org/apache/sling/feature/inventoryservice/impl/BaseFeature2CurrentRuntimePrinter.java
index 9730e8a..13dca76 100644
--- a/src/main/java/org/apache/sling/feature/inventoryservice/impl/BaseFeature2CurrentRuntimePrinter.java
+++ b/src/main/java/org/apache/sling/feature/inventoryservice/impl/BaseFeature2CurrentRuntimePrinter.java
@@ -25,7 +25,11 @@ import org.apache.felix.inventory.InventoryPrinter;
import org.apache.sling.feature.ArtifactId;
import org.apache.sling.feature.Feature;
import org.apache.sling.feature.diff.DefaultDiffRequest;
+import org.apache.sling.feature.r2f.RuntimeEnvironment2FeatureModel;
+import org.osgi.framework.BundleContext;
+import org.osgi.service.component.annotations.Activate;
import org.osgi.service.component.annotations.Component;
+import org.osgi.service.component.annotations.Reference;
@Component(
service = InventoryPrinter.class,
@@ -33,10 +37,18 @@ import org.osgi.service.component.annotations.Component;
NAME + "=r2f_base2runtime",
TITLE + "=Apache Sling Runtime Environment to Feature Model converter - Base 2 Runtime diff Generator",
FORMAT + "=JSON"
+ },
+ reference = {
+ @Reference(field = "generator", name = "generator", service = RuntimeEnvironment2FeatureModel.class)
}
)
public class BaseFeature2CurrentRuntimePrinter extends AbstractRuntimeEnvironment2FeatureModelPrinter {
+ @Activate
+ public void start(BundleContext bundleContext) {
+ this.bundleContext = bundleContext;
+ }
+
@Override
protected Feature compute(Feature previousFeature, Feature currentFeature) {
Feature featureDiff = compareFeatures(new DefaultDiffRequest()
diff --git a/src/main/java/org/apache/sling/feature/inventoryservice/impl/FeaturesInventoryPrinter.java b/src/main/java/org/apache/sling/feature/inventoryservice/impl/FeaturesInventoryPrinter.java
index a706046..618f8bc 100644
--- a/src/main/java/org/apache/sling/feature/inventoryservice/impl/FeaturesInventoryPrinter.java
+++ b/src/main/java/org/apache/sling/feature/inventoryservice/impl/FeaturesInventoryPrinter.java
@@ -26,7 +26,11 @@ import java.io.BufferedReader;
import java.io.PrintWriter;
import org.apache.felix.inventory.InventoryPrinter;
+import org.apache.sling.feature.r2f.RuntimeEnvironment2FeatureModel;
+import org.osgi.framework.BundleContext;
+import org.osgi.service.component.annotations.Activate;
import org.osgi.service.component.annotations.Component;
+import org.osgi.service.component.annotations.Reference;
@Component(
service = InventoryPrinter.class,
@@ -34,10 +38,18 @@ import org.osgi.service.component.annotations.Component;
NAME + "=launch_feature",
TITLE + "=Launch Feature",
FORMAT + "=JSON"
+ },
+ reference = {
+ @Reference(field = "generator", name = "generator", service = RuntimeEnvironment2FeatureModel.class)
}
)
public class FeaturesInventoryPrinter extends AbstractFeatureInventoryPrinter {
+ @Activate
+ public void start(BundleContext bundleContext) {
+ this.bundleContext = bundleContext;
+ }
+
@Override
protected void onFeature(String featureLocation, BufferedReader reader, PrintWriter printWriter) throws Exception {
String line = null;
diff --git a/src/main/java/org/apache/sling/feature/inventoryservice/impl/RuntimeEnvironment2FeatureModelPrinter.java b/src/main/java/org/apache/sling/feature/inventoryservice/impl/RuntimeEnvironment2FeatureModelPrinter.java
index ca6147b..3fe5c4b 100644
--- a/src/main/java/org/apache/sling/feature/inventoryservice/impl/RuntimeEnvironment2FeatureModelPrinter.java
+++ b/src/main/java/org/apache/sling/feature/inventoryservice/impl/RuntimeEnvironment2FeatureModelPrinter.java
@@ -22,7 +22,11 @@ import static org.apache.felix.inventory.InventoryPrinter.TITLE;
import org.apache.felix.inventory.InventoryPrinter;
import org.apache.sling.feature.Feature;
+import org.apache.sling.feature.r2f.RuntimeEnvironment2FeatureModel;
+import org.osgi.framework.BundleContext;
+import org.osgi.service.component.annotations.Activate;
import org.osgi.service.component.annotations.Component;
+import org.osgi.service.component.annotations.Reference;
@Component(
service = InventoryPrinter.class,
@@ -30,10 +34,18 @@ import org.osgi.service.component.annotations.Component;
NAME + "=r2f_runtime",
TITLE + "=Apache Sling Runtime Environment to Feature Model converter - Runtime Generator",
FORMAT + "=JSON"
+ },
+ reference = {
+ @Reference(field = "generator", name = "generator", service = RuntimeEnvironment2FeatureModel.class)
}
)
public final class RuntimeEnvironment2FeatureModelPrinter extends AbstractRuntimeEnvironment2FeatureModelPrinter {
+ @Activate
+ public void start(BundleContext bundleContext) {
+ this.bundleContext = bundleContext;
+ }
+
@Override
protected Feature compute(Feature previousFeature, Feature currentFeature) {
return currentFeature;