You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by tm...@apache.org on 2022/03/18 16:32:26 UTC
[sling-org-apache-sling-distribution-api] branch master updated: SLING-10585 - Add INVALIDATE distribution request type (#11)
This is an automated email from the ASF dual-hosted git repository.
tmaret pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-distribution-api.git
The following commit(s) were added to refs/heads/master by this push:
new c0a9277 SLING-10585 - Add INVALIDATE distribution request type (#11)
c0a9277 is described below
commit c0a9277a38809127cc55fe67692c2624a1366b31
Author: balasoiuroxana <99...@users.noreply.github.com>
AuthorDate: Fri Mar 18 17:32:20 2022 +0100
SLING-10585 - Add INVALIDATE distribution request type (#11)
* Add InvalidationProcessor interface
Co-authored-by: balasoiu <ba...@adobe.com>
---
.../distribution/DistributionRequestType.java | 6 ++++
.../distribution/InvalidationProcessException.java | 37 ++++++++++++++++++++++
.../sling/distribution/InvalidationProcessor.java | 33 +++++++++++++++++++
3 files changed, 76 insertions(+)
diff --git a/src/main/java/org/apache/sling/distribution/DistributionRequestType.java b/src/main/java/org/apache/sling/distribution/DistributionRequestType.java
index d183a57..ff3eb38 100644
--- a/src/main/java/org/apache/sling/distribution/DistributionRequestType.java
+++ b/src/main/java/org/apache/sling/distribution/DistributionRequestType.java
@@ -33,6 +33,7 @@ import org.osgi.annotation.versioning.ProviderType;
* to actually remove the resources specified in {@link DistributionRequest#getPaths()}.
* {@code PULL} requests can for example lead to the creation of a "command package" that will trigger fetching of content
* from the target instance.
+ * {@code INVALIDATE} requests can for example lead to the cache invalidation without importing content.
* </p>
*/
@ProviderType
@@ -54,6 +55,11 @@ public enum DistributionRequestType {
PULL,
/**
+ * Action type for invalidating content
+ */
+ INVALIDATE,
+
+ /**
* Action type for testing connection. No content is modified.
*/
TEST;
diff --git a/src/main/java/org/apache/sling/distribution/InvalidationProcessException.java b/src/main/java/org/apache/sling/distribution/InvalidationProcessException.java
new file mode 100644
index 0000000..6499966
--- /dev/null
+++ b/src/main/java/org/apache/sling/distribution/InvalidationProcessException.java
@@ -0,0 +1,37 @@
+/*
+ * 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.distribution;
+
+/**
+ * Exception thrown by the Invalidation processor implementations
+ */
+public class InvalidationProcessException extends Exception {
+
+ public InvalidationProcessException(String message) {
+ super(message);
+ }
+
+ public InvalidationProcessException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public InvalidationProcessException(Throwable cause) {
+ super(cause);
+ }
+}
diff --git a/src/main/java/org/apache/sling/distribution/InvalidationProcessor.java b/src/main/java/org/apache/sling/distribution/InvalidationProcessor.java
new file mode 100644
index 0000000..a1c3d58
--- /dev/null
+++ b/src/main/java/org/apache/sling/distribution/InvalidationProcessor.java
@@ -0,0 +1,33 @@
+/*
+ * 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.distribution;
+
+import java.util.Map;
+
+/**
+ * Executes cache invalidation requests
+ */
+public interface InvalidationProcessor {
+ /**
+ * Process invalidation requests
+ *
+ * @param props properties defining the invalidated content
+ */
+ void process(Map<String, Object> props) throws InvalidationProcessException;
+}