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/05/07 23:15:15 UTC

[sling-org-apache-sling-feature-cpconverter] branch master updated: moving interpolator stuff in a dedicated package

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-org-apache-sling-feature-cpconverter.git


The following commit(s) were added to refs/heads/master by this push:
     new 4a49b40  moving interpolator stuff in a dedicated package
4a49b40 is described below

commit 4a49b4021283d69c31b9afa28ded810679c9a64c
Author: stripodi <st...@simos-mbp>
AuthorDate: Wed May 8 01:15:02 2019 +0200

    moving interpolator stuff in a dedicated package
---
 .../ContentPackage2FeatureModelConverter.java      |  4 +++-
 .../SimpleVariablesInterpolator.java               |  4 ++--
 .../interpolator/VariablesInterpolator.java        | 25 ++++++++++++++++++++++
 .../cpconverter/interpolator/package-info.java     | 21 ++++++++++++++++++
 .../SimpleVariablesInterpolatorTest.java           |  4 ++--
 5 files changed, 53 insertions(+), 5 deletions(-)

diff --git a/src/main/java/org/apache/sling/feature/cpconverter/ContentPackage2FeatureModelConverter.java b/src/main/java/org/apache/sling/feature/cpconverter/ContentPackage2FeatureModelConverter.java
index 609e080..2c76343 100644
--- a/src/main/java/org/apache/sling/feature/cpconverter/ContentPackage2FeatureModelConverter.java
+++ b/src/main/java/org/apache/sling/feature/cpconverter/ContentPackage2FeatureModelConverter.java
@@ -43,6 +43,8 @@ import org.apache.sling.feature.ExtensionType;
 import org.apache.sling.feature.Extensions;
 import org.apache.sling.feature.Feature;
 import org.apache.sling.feature.cpconverter.acl.AclManager;
+import org.apache.sling.feature.cpconverter.interpolator.SimpleVariablesInterpolator;
+import org.apache.sling.feature.cpconverter.interpolator.VariablesInterpolator;
 import org.apache.sling.feature.cpconverter.spi.BundlesDeployer;
 import org.apache.sling.feature.cpconverter.spi.EntryHandler;
 import org.apache.sling.feature.cpconverter.vltpkg.VaultPackageAssembler;
@@ -77,7 +79,7 @@ public class ContentPackage2FeatureModelConverter {
 
     private final RegexBasedResourceFilter filter = new RegexBasedResourceFilter();
 
-    private final SimpleVariablesInterpolator interpolator = new SimpleVariablesInterpolator();
+    private final VariablesInterpolator interpolator = new SimpleVariablesInterpolator();
 
     private BundlesDeployer artifactDeployer;
 
diff --git a/src/main/java/org/apache/sling/feature/cpconverter/SimpleVariablesInterpolator.java b/src/main/java/org/apache/sling/feature/cpconverter/interpolator/SimpleVariablesInterpolator.java
similarity index 92%
rename from src/main/java/org/apache/sling/feature/cpconverter/SimpleVariablesInterpolator.java
rename to src/main/java/org/apache/sling/feature/cpconverter/interpolator/SimpleVariablesInterpolator.java
index bc76cf4..0513bd6 100644
--- a/src/main/java/org/apache/sling/feature/cpconverter/SimpleVariablesInterpolator.java
+++ b/src/main/java/org/apache/sling/feature/cpconverter/interpolator/SimpleVariablesInterpolator.java
@@ -14,7 +14,7 @@
  * License for the specific language governing permissions and limitations under
  * the License.
  */
-package org.apache.sling.feature.cpconverter;
+package org.apache.sling.feature.cpconverter.interpolator;
 
 import static java.util.Objects.requireNonNull;
 
@@ -22,7 +22,7 @@ import java.util.Map;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
-final class SimpleVariablesInterpolator {
+public final class SimpleVariablesInterpolator implements VariablesInterpolator {
 
     private final Pattern replacementPattern = Pattern.compile("\\$\\{\\{(.+?)\\}\\}");
 
diff --git a/src/main/java/org/apache/sling/feature/cpconverter/interpolator/VariablesInterpolator.java b/src/main/java/org/apache/sling/feature/cpconverter/interpolator/VariablesInterpolator.java
new file mode 100644
index 0000000..f2e13a8
--- /dev/null
+++ b/src/main/java/org/apache/sling/feature/cpconverter/interpolator/VariablesInterpolator.java
@@ -0,0 +1,25 @@
+/*
+ * 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.cpconverter.interpolator;
+
+import java.util.Map;
+
+public interface VariablesInterpolator {
+
+    String interpolate(String format, Map<String, String> properties);
+
+}
diff --git a/src/main/java/org/apache/sling/feature/cpconverter/interpolator/package-info.java b/src/main/java/org/apache/sling/feature/cpconverter/interpolator/package-info.java
new file mode 100644
index 0000000..e5610c3
--- /dev/null
+++ b/src/main/java/org/apache/sling/feature/cpconverter/interpolator/package-info.java
@@ -0,0 +1,21 @@
+/*
+ * 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.
+ */
+
+/**
+ * Variables interpolator definition and implementation.
+ */
+package org.apache.sling.feature.cpconverter.interpolator;
diff --git a/src/test/java/org/apache/sling/feature/cpconverter/SimpleVariablesInterpolatorTest.java b/src/test/java/org/apache/sling/feature/cpconverter/interpolator/SimpleVariablesInterpolatorTest.java
similarity index 96%
rename from src/test/java/org/apache/sling/feature/cpconverter/SimpleVariablesInterpolatorTest.java
rename to src/test/java/org/apache/sling/feature/cpconverter/interpolator/SimpleVariablesInterpolatorTest.java
index f1bd636..11deba6 100644
--- a/src/test/java/org/apache/sling/feature/cpconverter/SimpleVariablesInterpolatorTest.java
+++ b/src/test/java/org/apache/sling/feature/cpconverter/interpolator/SimpleVariablesInterpolatorTest.java
@@ -14,7 +14,7 @@
  * License for the specific language governing permissions and limitations under
  * the License.
  */
-package org.apache.sling.feature.cpconverter;
+package org.apache.sling.feature.cpconverter.interpolator;
 
 import static org.junit.Assert.assertEquals;
 
@@ -27,7 +27,7 @@ import org.junit.Test;
 
 public class SimpleVariablesInterpolatorTest {
 
-    private SimpleVariablesInterpolator interpolator;
+    private VariablesInterpolator interpolator;
 
     @Before
     public void setUp() {