jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r1368588 - in /jackrabbit/oak/trunk: oak-core/src/main/java/org/apache/jackrabbit/oak/util/ oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/ oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/version/
Date Thu, 02 Aug 2012 16:30:37 GMT
Author: jukka
Date: Thu Aug  2 16:30:37 2012
New Revision: 1368588

URL: http://svn.apache.org/viewvc?rev=1368588&view=rev
Log:
OAK-168: Basic JCR VersionManager support

Add dummy VersionManager class that for now throws exceptions on all methods

Added:
    jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/version/
    jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/version/VersionManagerImpl.java
  (with props)
Modified:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/util/TODO.java
    jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/WorkspaceImpl.java

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/util/TODO.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/util/TODO.java?rev=1368588&r1=1368587&r2=1368588&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/util/TODO.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/util/TODO.java Thu
Aug  2 16:30:37 2012
@@ -20,7 +20,6 @@ import java.util.concurrent.Callable;
 
 import javax.jcr.UnsupportedRepositoryOperationException;
 
-import org.apache.jackrabbit.oak.spi.security.privilege.PrivilegeDefinition;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -74,13 +73,16 @@ public class TODO {
 
     public void doNothing() throws UnsupportedRepositoryOperationException {
         if (strict) {
-            throw new UnsupportedRepositoryOperationException(
-                    message, exception);
+            throw exception();
         } else if (log) {
             logger.warn(message, exception);
         }
     }
 
+    public UnsupportedRepositoryOperationException exception() {
+        return new UnsupportedRepositoryOperationException(message, exception);
+    }
+
     public <T> T returnValue(final T value)
             throws UnsupportedRepositoryOperationException {
         return call(new Callable<T>() {
@@ -94,8 +96,7 @@ public class TODO {
     public <T> T call(Callable<T> callable)
             throws UnsupportedRepositoryOperationException {
         if (strict) {
-            throw new UnsupportedRepositoryOperationException(
-                    message, exception);
+            throw exception();
         } else if (log) {
             logger.warn(message, exception);
         }

Modified: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/WorkspaceImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/WorkspaceImpl.java?rev=1368588&r1=1368587&r2=1368588&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/WorkspaceImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/WorkspaceImpl.java
Thu Aug  2 16:30:37 2012
@@ -36,6 +36,7 @@ import org.apache.jackrabbit.oak.commons
 import org.apache.jackrabbit.oak.jcr.lock.LockManagerImpl;
 import org.apache.jackrabbit.oak.jcr.query.QueryManagerImpl;
 import org.apache.jackrabbit.oak.jcr.security.privilege.PrivilegeManagerImpl;
+import org.apache.jackrabbit.oak.jcr.version.VersionManagerImpl;
 import org.apache.jackrabbit.oak.plugins.name.NamespaceRegistryImpl;
 import org.apache.jackrabbit.oak.plugins.type.NodeTypeManagerImpl;
 import org.slf4j.Logger;
@@ -168,11 +169,8 @@ public class WorkspaceImpl implements Ja
     }
 
     @Override
-    public VersionManager getVersionManager() throws RepositoryException {
-        ensureIsAlive();
-
-        // TODO
-        throw new UnsupportedRepositoryOperationException("TODO: Workspace.getVersionManager");
+    public VersionManager getVersionManager() {
+        return new VersionManagerImpl();
     }
 
     @Override

Added: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/version/VersionManagerImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/version/VersionManagerImpl.java?rev=1368588&view=auto
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/version/VersionManagerImpl.java
(added)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/version/VersionManagerImpl.java
Thu Aug  2 16:30:37 2012
@@ -0,0 +1,160 @@
+/*
+ * 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.jcr.version;
+
+import javax.jcr.InvalidItemStateException;
+import javax.jcr.ItemExistsException;
+import javax.jcr.Node;
+import javax.jcr.NodeIterator;
+import javax.jcr.RepositoryException;
+import javax.jcr.UnsupportedRepositoryOperationException;
+import javax.jcr.lock.LockException;
+import javax.jcr.version.Version;
+import javax.jcr.version.VersionException;
+import javax.jcr.version.VersionHistory;
+import javax.jcr.version.VersionManager;
+
+import org.apache.jackrabbit.commons.iterator.NodeIteratorAdapter;
+import org.apache.jackrabbit.oak.util.TODO;
+
+public class VersionManagerImpl implements VersionManager {
+
+    @Override
+    public Node setActivity(Node activity) throws RepositoryException {
+        return TODO.unimplemented().returnValue(null);
+    }
+
+    @Override
+    public void restoreByLabel(
+            String absPath, String versionLabel, boolean removeExisting)
+            throws RepositoryException {
+        TODO.unimplemented().doNothing();
+    }
+
+    @Override
+    public void restore(
+            String absPath, Version version, boolean removeExisting)
+            throws RepositoryException {
+        TODO.unimplemented().doNothing();
+    }
+
+    @Override
+    public void restore(
+            String absPath, String versionName, boolean removeExisting)
+            throws RepositoryException {
+        TODO.unimplemented().doNothing();
+    }
+
+    @Override
+    public void restore(Version version, boolean removeExisting)
+            throws RepositoryException {
+        TODO.unimplemented().doNothing();
+    }
+
+    @Override
+    public void restore(Version[] versions, boolean removeExisting)
+            throws ItemExistsException,
+            UnsupportedRepositoryOperationException, VersionException,
+            LockException, InvalidItemStateException, RepositoryException {
+        TODO.unimplemented().doNothing();
+    }
+
+    @Override
+    public void removeActivity(Node activityNode)
+            throws RepositoryException {
+        TODO.unimplemented().doNothing();
+    }
+
+    @Override
+    public NodeIterator merge(
+            String absPath, String srcWorkspace,
+            boolean bestEffort, boolean isShallow)
+            throws RepositoryException {
+        return TODO.unimplemented().returnValue(NodeIteratorAdapter.EMPTY);
+    }
+
+    @Override
+    public NodeIterator merge(
+            String absPath, String srcWorkspace, boolean bestEffort)
+            throws RepositoryException {
+        return TODO.unimplemented().returnValue(NodeIteratorAdapter.EMPTY);
+    }
+
+    @Override
+    public NodeIterator merge(Node activityNode) throws RepositoryException {
+        return TODO.unimplemented().returnValue(NodeIteratorAdapter.EMPTY);
+    }
+
+    @Override
+    public boolean isCheckedOut(String absPath) throws RepositoryException {
+        return TODO.unimplemented().returnValue(true);
+    }
+
+    @Override
+    public VersionHistory getVersionHistory(String absPath)
+            throws RepositoryException {
+        throw new UnsupportedRepositoryOperationException();
+    }
+
+    @Override
+    public Version getBaseVersion(String absPath) throws RepositoryException {
+        throw new UnsupportedRepositoryOperationException();
+    }
+
+    @Override
+    public Node getActivity() throws RepositoryException {
+        throw new UnsupportedRepositoryOperationException();
+    }
+
+    @Override
+    public void doneMerge(String absPath, Version version)
+            throws RepositoryException {
+        TODO.unimplemented().doNothing();
+    }
+
+    @Override
+    public Node createConfiguration(String absPath) throws RepositoryException {
+        throw TODO.unimplemented().exception();
+    }
+
+    @Override
+    public Node createActivity(String title) throws RepositoryException {
+        throw TODO.unimplemented().exception();
+    }
+
+    @Override
+    public Version checkpoint(String absPath) throws RepositoryException {
+        throw TODO.unimplemented().exception();
+    }
+
+    @Override
+    public void checkout(String absPath) throws RepositoryException {
+        TODO.unimplemented().doNothing();
+    }
+
+    @Override
+    public Version checkin(String absPath) throws RepositoryException {
+        throw TODO.unimplemented().exception();
+    }
+
+    @Override
+    public void cancelMerge(String absPath, Version version)
+            throws RepositoryException {
+        TODO.unimplemented().doNothing();
+    }
+
+}

Propchange: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/version/VersionManagerImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message