SLING-9492 - Add deep paths
diff --git a/src/main/java/org/apache/sling/distribution/event/DistributionEvent.java b/src/main/java/org/apache/sling/distribution/event/DistributionEvent.java
index 7512065..068a2b3 100644
--- a/src/main/java/org/apache/sling/distribution/event/DistributionEvent.java
+++ b/src/main/java/org/apache/sling/distribution/event/DistributionEvent.java
@@ -20,6 +20,7 @@
import static org.apache.sling.distribution.event.DistributionEventProperties.DISTRIBUTION_COMPONENT_KIND;
import static org.apache.sling.distribution.event.DistributionEventProperties.DISTRIBUTION_COMPONENT_NAME;
+import static org.apache.sling.distribution.event.DistributionEventProperties.DISTRIBUTION_DEEP_PATHS;
import static org.apache.sling.distribution.event.DistributionEventProperties.DISTRIBUTION_PACKAGE_ID;
import static org.apache.sling.distribution.event.DistributionEventProperties.DISTRIBUTION_PATHS;
import static org.apache.sling.distribution.event.DistributionEventProperties.DISTRIBUTION_TYPE;
@@ -36,18 +37,21 @@
private final String componentKind;
private final String distType;
private final String[] distPaths;
+ private final String[] distDeepPaths;
public DistributionEvent(
String packageId,
String componentName,
String componentKind,
String distType,
- String[] distPaths) {
+ String[] distPaths,
+ String[] distDeepPaths) {
this.packageId = packageId;
this.componentName = componentName;
this.componentKind = componentKind;
this.distType = distType;
this.distPaths = distPaths;
+ this.distDeepPaths = distDeepPaths == null ? new String[] {} : distDeepPaths;
}
public String getPackageId() {
@@ -70,6 +74,10 @@
return distPaths;
}
+ public String[] getDistDeepPaths() {
+ return distDeepPaths;
+ }
+
public Event toEvent(String topic) {
Dictionary<String, Object> props = new Hashtable<String, Object>();
props.put(DISTRIBUTION_PACKAGE_ID, packageId);
@@ -77,6 +85,7 @@
props.put(DISTRIBUTION_COMPONENT_KIND, componentKind);
props.put(DISTRIBUTION_TYPE, distType);
props.put(DISTRIBUTION_PATHS, distPaths);
+ props.put(DISTRIBUTION_DEEP_PATHS, distDeepPaths);
return new Event(topic, props);
}
@@ -86,6 +95,7 @@
event.getProperty(DISTRIBUTION_COMPONENT_NAME).toString(),
event.getProperty(DISTRIBUTION_COMPONENT_KIND).toString(),
event.getProperty(DISTRIBUTION_TYPE).toString(),
- (String[])event.getProperty(DISTRIBUTION_PATHS));
+ (String[])event.getProperty(DISTRIBUTION_PATHS),
+ (String[])event.getProperty(DISTRIBUTION_DEEP_PATHS));
}
}
diff --git a/src/main/java/org/apache/sling/distribution/event/DistributionEventProperties.java b/src/main/java/org/apache/sling/distribution/event/DistributionEventProperties.java
index dd5da1e..3a13b55 100644
--- a/src/main/java/org/apache/sling/distribution/event/DistributionEventProperties.java
+++ b/src/main/java/org/apache/sling/distribution/event/DistributionEventProperties.java
@@ -48,6 +48,11 @@
String DISTRIBUTION_PATHS= "distribution.paths";
/**
+ * property containing the type of the distribution paths
+ */
+ String DISTRIBUTION_DEEP_PATHS= "distribution.deep.paths";
+
+ /**
* Package id
*/
String DISTRIBUTION_PACKAGE_ID = "distribution.package.id";
diff --git a/src/test/java/org/apache/sling/distribution/event/DistributionEventTest.java b/src/test/java/org/apache/sling/distribution/event/DistributionEventTest.java
index ce9a006..c51e14e 100644
--- a/src/test/java/org/apache/sling/distribution/event/DistributionEventTest.java
+++ b/src/test/java/org/apache/sling/distribution/event/DistributionEventTest.java
@@ -31,6 +31,7 @@
public class DistributionEventTest {
private static final String PATH1 = "/test";
+ private static final String DEEP_PATH = "/deep";
private static final String DIST_TYPE = "ADD";
private static final String NAME = "myagent";
private static final String KIND = "agent";
@@ -39,7 +40,7 @@
@Before
public void before() {
- event = new DistributionEvent(PKG_ID, NAME, KIND, DIST_TYPE, new String[] {PATH1});
+ event = new DistributionEvent(PKG_ID, NAME, KIND, DIST_TYPE, new String[] {PATH1, DEEP_PATH}, new String[] {DEEP_PATH});
}
@Test
@@ -63,7 +64,9 @@
assertThat(event2.getComponentName(), equalTo(NAME));
assertThat(event2.getDistType(), equalTo(DIST_TYPE));
String[] paths = event2.getDistPaths();
- assertThat(Arrays.asList(paths), CoreMatchers.hasItems(PATH1));
+ assertThat(Arrays.asList(paths), CoreMatchers.hasItems(PATH1, DEEP_PATH));
+ String[] deepPaths = event2.getDistDeepPaths();
+ assertThat(Arrays.asList(deepPaths), CoreMatchers.hasItems(DEEP_PATH));
}
}