Author: cziegeler
Date: Tue May 5 14:12:53 2015
New Revision: 1677831
URL: http://svn.apache.org/r1677831
Log:
Update observation api
Added:
sling/whiteboard/cziegeler/api-v3/src/main/java/org/apache/sling/api/resource/observation/ResourceChange.java
(with props)
Modified:
sling/whiteboard/cziegeler/api-v3/src/main/java/org/apache/sling/api/resource/observation/ResourceListener.java
sling/whiteboard/cziegeler/api-v3/src/main/java/org/apache/sling/api/resource/provider/ObservationHandler.java
Added:
sling/whiteboard/cziegeler/api-v3/src/main/java/org/apache/sling/api/resource/observation/ResourceChange.java
URL:
http://svn.apache.org/viewvc/sling/whiteboard/cziegeler/api-v3/src/main/java/org/apache/sling/api/resource/observation/ResourceChange.java?rev=1677831&view=auto
==============================================================================
---
sling/whiteboard/cziegeler/api-v3/src/main/java/org/apache/sling/api/resource/observation/ResourceChange.java
(added)
+++
sling/whiteboard/cziegeler/api-v3/src/main/java/org/apache/sling/api/resource/observation/ResourceChange.java
Tue May 5 14:12:53 2015
@@ -0,0 +1,100 @@
+/*
+ * 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.api.resource.observation;
+
+/**
+ * TODO properties
+ */
+public class ResourceChange {
+
+ private final ChangeType type;
+
+ private final String path;
+
+ private final String userId;
+
+ private final String resourceType;
+
+ public String getPath() {
+ return path;
+ }
+
+ public String getUserId() {
+ return userId;
+ }
+
+ public String getResourceType() {
+ return resourceType;
+ }
+
+ public String getResourceSuperType() {
+ return resourceSuperType;
+ }
+
+ private final String resourceSuperType;
+
+ public enum ChangeType {
+ ADDED,
+ REMOVED,
+ CHANGED
+ }
+
+ public ChangeType getType() {
+ return this.type;
+ }
+
+ private ResourceChange(final ChangeType type,
+ final String path,
+ final String userId,
+ final String resourceType,
+ final String resourceSuperType) {
+ this.type = type;
+ this.path = path;
+ this.userId = userId;
+ this.resourceType = resourceType;
+ this.resourceSuperType = resourceSuperType;
+ }
+
+ public static ResourceChange resourceChanged(String path,
+ String userId,
+ String resourceType,
+ String resourceSuperType) {
+ return new ResourceChange(ChangeType.CHANGED,
+ path,
+ userId, resourceType, resourceSuperType);
+ }
+
+ public static ResourceChange resourceAdded(String path,
+ String userId,
+ String resourceType,
+ String resourceSuperType) {
+ return new ResourceChange(ChangeType.ADDED,
+ path,
+ userId, resourceType, resourceSuperType);
+ }
+
+ public static ResourceChange resourceRemoved(String path,
+ String userId,
+ String resourceType,
+ String resourceSuperType) {
+ return new ResourceChange(ChangeType.REMOVED,
+ path,
+ userId, resourceType, resourceSuperType);
+ }
+}
Propchange:
sling/whiteboard/cziegeler/api-v3/src/main/java/org/apache/sling/api/resource/observation/ResourceChange.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
sling/whiteboard/cziegeler/api-v3/src/main/java/org/apache/sling/api/resource/observation/ResourceChange.java
------------------------------------------------------------------------------
svn:keywords = author date id revision rev url
Propchange:
sling/whiteboard/cziegeler/api-v3/src/main/java/org/apache/sling/api/resource/observation/ResourceChange.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified:
sling/whiteboard/cziegeler/api-v3/src/main/java/org/apache/sling/api/resource/observation/ResourceListener.java
URL:
http://svn.apache.org/viewvc/sling/whiteboard/cziegeler/api-v3/src/main/java/org/apache/sling/api/resource/observation/ResourceListener.java?rev=1677831&r1=1677830&r2=1677831&view=diff
==============================================================================
---
sling/whiteboard/cziegeler/api-v3/src/main/java/org/apache/sling/api/resource/observation/ResourceListener.java
(original)
+++
sling/whiteboard/cziegeler/api-v3/src/main/java/org/apache/sling/api/resource/observation/ResourceListener.java
Tue May 5 14:12:53 2015
@@ -18,9 +18,14 @@
*/
package org.apache.sling.api.resource.observation;
+import javax.annotation.Nonnull;
+
+import
org.apache.sling.api.resource.provider.ObservationHandler.ResourceChange;
+
import aQute.bnd.annotation.ConsumerType;
@ConsumerType
-public class ResourceListener {
+public interface ResourceListener {
+ void onChange(@Nonnull ResourceChange change);
}
Modified:
sling/whiteboard/cziegeler/api-v3/src/main/java/org/apache/sling/api/resource/provider/ObservationHandler.java
URL:
http://svn.apache.org/viewvc/sling/whiteboard/cziegeler/api-v3/src/main/java/org/apache/sling/api/resource/provider/ObservationHandler.java?rev=1677831&r1=1677830&r2=1677831&view=diff
==============================================================================
---
sling/whiteboard/cziegeler/api-v3/src/main/java/org/apache/sling/api/resource/provider/ObservationHandler.java
(original)
+++
sling/whiteboard/cziegeler/api-v3/src/main/java/org/apache/sling/api/resource/provider/ObservationHandler.java
Tue May 5 14:12:53 2015
@@ -20,6 +20,8 @@ package org.apache.sling.api.resource.pr
import javax.annotation.Nonnull;
+import org.apache.sling.api.resource.observation.ResourceChange;
+
import aQute.bnd.annotation.ProviderType;
/**
@@ -28,30 +30,4 @@ import aQute.bnd.annotation.ProviderType
public interface ObservationHandler {
void reportChanges(@Nonnull ResourceChange... changes);
-
- /**
- * TODO move to separate class
- */
- public class ResourceChange {
-
- public static ResourceChange resourceChanged(String path,
- String userId,
- String resourceType) {
- // TODO props;
- return null;
- }
-
- public static ResourceChange resourceAdded(String path,
- String userId,
- String resourceType) {
- // TODO props;
- return null;
- }
- public static ResourceChange resourceRemoved(String path,
- String userId,
- String resourceType) {
- // TODO props;
- return null;
- }
- }
}