jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mdue...@apache.org
Subject svn commit: r1351414 - in /jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak: api/ChangeSet.java api/ContentSession.java core/ContentSessionImpl.java
Date Mon, 18 Jun 2012 16:48:24 GMT
Author: mduerig
Date: Mon Jun 18 16:48:24 2012
New Revision: 1351414

URL: http://svn.apache.org/viewvc?rev=1351414&view=rev
Log:
OAK-144: Implement observation
 oak-core API draft

Added:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/ChangeSet.java
Modified:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/ContentSession.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/ContentSessionImpl.java

Added: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/ChangeSet.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/ChangeSet.java?rev=1351414&view=auto
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/ChangeSet.java
(added)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/ChangeSet.java
Mon Jun 18 16:48:24 2012
@@ -0,0 +1,59 @@
+/*
+ * 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.jackrabbit.oak.api;
+
+import javax.annotation.Nonnull;
+
+
+/**
+ * A {@code ChangeSet} instance describes a set of changes which was applied atomically
+ * to a (sub-)tree.
+ */
+public interface ChangeSet {
+
+    /**
+     * Timestamp for when the changes occurred.
+     * @return  time stamp in milliseconds
+     */
+    long getTimeStamp();
+
+    /**
+     * Commit message from the underlying Microkernel.
+     *
+     * TODO: implementation detail: we might need to encode JCR user data and session
+     * IDs (for no-local support) here but we should expose them separately.
+     * @return
+     */
+    @Nonnull
+    String getCommitMessage();
+
+    /**
+     * The {@link Tree} how it was before the changes.
+     * @return a read only tree.
+     */
+    @Nonnull
+    Tree getTreeBeforeChange();
+
+    /**
+     * The {@link Tree} how it was after the changes.
+     * @return a read only tree.
+     */
+    @Nonnull
+    Tree getTreeAfterChange();
+}

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/ContentSession.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/ContentSession.java?rev=1351414&r1=1351413&r2=1351414&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/ContentSession.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/ContentSession.java
Mon Jun 18 16:48:24 2012
@@ -16,6 +16,7 @@
  */
 package org.apache.jackrabbit.oak.api;
 
+import javax.annotation.CheckForNull;
 import javax.annotation.Nonnull;
 import java.io.Closeable;
 
@@ -90,6 +91,19 @@ public interface ContentSession extends 
     @Nonnull
     CoreValueFactory getCoreValueFactory();
 
+    /**
+     * Wait for changes to occur at {@code path} in the underlying repository.
+     * If {@code previous} is not {@code null} returns the {@link ChangeSet}
+     * instance following the one given in {@code previous}.
+     *
+     * @param path  path to the subtree to watch for changes
+     * @param previous  previous {@code ChangeSet} or {@code null}.
+     * @param timeout the maximum time to wait in milliseconds
+     * @return  the next {@code ChangeSet} or {@code null} if a timeout occurred.
+     */
+    @CheckForNull
+    ChangeSet waitForChanges(String path, ChangeSet previous, long timeout);
+
     // TODO : add versioning operations
 
 }
\ No newline at end of file

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/ContentSessionImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/ContentSessionImpl.java?rev=1351414&r1=1351413&r2=1351414&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/ContentSessionImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/ContentSessionImpl.java
Mon Jun 18 16:48:24 2012
@@ -16,7 +16,15 @@
  */
 package org.apache.jackrabbit.oak.core;
 
+import java.io.IOException;
+import java.util.Set;
+
+import javax.annotation.Nonnull;
+import javax.security.auth.login.LoginContext;
+import javax.security.auth.login.LoginException;
+
 import org.apache.jackrabbit.oak.api.AuthInfo;
+import org.apache.jackrabbit.oak.api.ChangeSet;
 import org.apache.jackrabbit.oak.api.ContentSession;
 import org.apache.jackrabbit.oak.api.CoreValueFactory;
 import org.apache.jackrabbit.oak.api.QueryEngine;
@@ -25,12 +33,6 @@ import org.apache.jackrabbit.oak.spi.sta
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import javax.annotation.Nonnull;
-import javax.security.auth.login.LoginContext;
-import javax.security.auth.login.LoginException;
-import java.io.IOException;
-import java.util.Set;
-
 /**
  * {@code MicroKernel}-based implementation of the {@link ContentSession} interface.
  */
@@ -97,4 +99,8 @@ class ContentSessionImpl implements Cont
         return store.getValueFactory();
     }
 
+    @Override
+    public ChangeSet waitForChanges(String path, ChangeSet previous, long timeout) {
+        return null; // todo implement waitForChanges
+    }
 }
\ No newline at end of file



Mime
View raw message