jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r770600 - in /jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi: ./ lock/
Date Fri, 01 May 2009 09:47:10 GMT
Author: jukka
Date: Fri May  1 09:47:10 2009
New Revision: 770600

URL: http://svn.apache.org/viewvc?rev=770600&view=rev
Log:
JCR-1104: JSR 283 support

Rename LockManager to LockStateManager to avoid naming conflict with javax.jcr.lock.LockManager.

Make LockStateManager extend javax.jcr.lock.LockManager to keep the Workspace.getLockManager()
signature valid. This is in line with previous work that extended the Lock(State)Manager in
jcr2spi towards the JCR 2.0 LockManager.

Added:
    jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/lock/LockStateManager.java
Removed:
    jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/lock/DefaultLockManager.java
    jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/lock/LockManager.java
Modified:
    jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/ManagerProvider.java
    jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/NodeImpl.java
    jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/SessionImpl.java
    jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/WorkspaceImpl.java
    jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/lock/LockManagerImpl.java

Modified: jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/ManagerProvider.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/ManagerProvider.java?rev=770600&r1=770599&r2=770600&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/ManagerProvider.java
(original)
+++ jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/ManagerProvider.java
Fri May  1 09:47:10 2009
@@ -19,7 +19,7 @@
 import org.apache.jackrabbit.spi.commons.namespace.NamespaceResolver;
 import org.apache.jackrabbit.jcr2spi.hierarchy.HierarchyManager;
 import org.apache.jackrabbit.jcr2spi.security.AccessManager;
-import org.apache.jackrabbit.jcr2spi.lock.LockManager;
+import org.apache.jackrabbit.jcr2spi.lock.LockStateManager;
 import org.apache.jackrabbit.jcr2spi.version.VersionManager;
 import org.apache.jackrabbit.jcr2spi.nodetype.ItemDefinitionProvider;
 import org.apache.jackrabbit.jcr2spi.nodetype.EffectiveNodeTypeProvider;
@@ -54,7 +54,7 @@
      * @return the <code>AccessManager</code> associated with this
      * <code>ManagerProvider</code>
      */
-    public LockManager getLockManager();
+    public LockStateManager getLockManager();
 
     /**
      * Returns the <code>VersionManager</code> associated with this

Modified: jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/NodeImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/NodeImpl.java?rev=770600&r1=770599&r2=770600&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/NodeImpl.java
(original)
+++ jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/NodeImpl.java
Fri May  1 09:47:10 2009
@@ -21,6 +21,7 @@
 import org.apache.jackrabbit.jcr2spi.hierarchy.NodeEntry;
 import org.apache.jackrabbit.jcr2spi.hierarchy.PropertyEntry;
 import org.apache.jackrabbit.jcr2spi.lock.LockManager;
+import org.apache.jackrabbit.jcr2spi.lock.LockStateManager;
 import org.apache.jackrabbit.jcr2spi.nodetype.EffectiveNodeType;
 import org.apache.jackrabbit.jcr2spi.nodetype.NodeTypeImpl;
 import org.apache.jackrabbit.jcr2spi.nodetype.NodeTypeManagerImpl;
@@ -1129,7 +1130,7 @@
             // a node that is new or not lockable never holds a lock
             return false;
         } else {
-            LockManager lMgr = session.getLockManager();
+            LockStateManager lMgr = session.getLockManager();
             return (lMgr.isLocked(getNodeState()) && lMgr.getLock(getNodeState()).getNode().isSame(this));
         }
     }

Modified: jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/SessionImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/SessionImpl.java?rev=770600&r1=770599&r2=770600&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/SessionImpl.java
(original)
+++ jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/SessionImpl.java
Fri May  1 09:47:10 2009
@@ -24,7 +24,7 @@
 import org.apache.jackrabbit.jcr2spi.hierarchy.HierarchyManager;
 import org.apache.jackrabbit.jcr2spi.hierarchy.NodeEntry;
 import org.apache.jackrabbit.jcr2spi.hierarchy.HierarchyManagerImpl;
-import org.apache.jackrabbit.jcr2spi.lock.LockManager;
+import org.apache.jackrabbit.jcr2spi.lock.LockStateManager;
 import org.apache.jackrabbit.jcr2spi.nodetype.EffectiveNodeTypeProvider;
 import org.apache.jackrabbit.jcr2spi.nodetype.ItemDefinitionProvider;
 import org.apache.jackrabbit.jcr2spi.nodetype.NodeTypeManagerImpl;
@@ -618,7 +618,7 @@
     /**
      * @see ManagerProvider#getLockManager()
      */
-    public LockManager getLockManager() {
+    public LockStateManager getLockManager() {
         return workspace.getLockManager();
     }
 

Modified: jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/WorkspaceImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/WorkspaceImpl.java?rev=770600&r1=770599&r2=770600&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/WorkspaceImpl.java
(original)
+++ jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/WorkspaceImpl.java
Fri May  1 09:47:10 2009
@@ -19,8 +19,8 @@
 import org.apache.jackrabbit.jcr2spi.config.CacheBehaviour;
 import org.apache.jackrabbit.jcr2spi.config.RepositoryConfig;
 import org.apache.jackrabbit.jcr2spi.hierarchy.HierarchyManager;
-import org.apache.jackrabbit.jcr2spi.lock.LockManager;
 import org.apache.jackrabbit.jcr2spi.lock.LockManagerImpl;
+import org.apache.jackrabbit.jcr2spi.lock.LockStateManager;
 import org.apache.jackrabbit.jcr2spi.nodetype.EffectiveNodeTypeProvider;
 import org.apache.jackrabbit.jcr2spi.nodetype.ItemDefinitionProvider;
 import org.apache.jackrabbit.jcr2spi.nodetype.NodeTypeRegistry;
@@ -99,7 +99,7 @@
      */
     private final WorkspaceManager wspManager;
 
-    private LockManager lockManager;
+    private LockStateManager lockManager;
     private ObservationManager obsManager;
     private QueryManager qManager;
     private VersionManager versionManager;
@@ -390,7 +390,7 @@
     /**
      * @see ManagerProvider#getLockManager()
      */
-    public LockManager getLockManager() {
+    public LockStateManager getLockManager() {
         if (lockManager == null) {
             lockManager = createLockManager(wspManager, session.getItemManager());
         }
@@ -492,8 +492,8 @@
      * @param itemManager
      * @return a new <code>LockManager</code> instance.
      */
-    protected LockManager createLockManager(WorkspaceManager wspManager, ItemManager itemManager)
{
-        LockManager lMgr = new LockManagerImpl(wspManager, itemManager, session.getCacheBehaviour(),
getPathResolver());
+    protected LockStateManager createLockManager(WorkspaceManager wspManager, ItemManager
itemManager) {
+        LockManagerImpl lMgr = new LockManagerImpl(wspManager, itemManager, session.getCacheBehaviour(),
getPathResolver());
         session.addListener((LockManagerImpl) lMgr);
         return lMgr;
     }

Modified: jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/lock/LockManagerImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/lock/LockManagerImpl.java?rev=770600&r1=770599&r2=770600&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/lock/LockManagerImpl.java
(original)
+++ jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/lock/LockManagerImpl.java
Fri May  1 09:47:10 2009
@@ -54,7 +54,7 @@
  * <code>LockManagerImpl</code>...
  * TODO: TOBEFIXED. Lock objects obtained through this mgr are not informed if another session
is or becomes lock-holder and removes the lock again.
  */
-public class LockManagerImpl implements LockManager, javax.jcr.lock.LockManager, SessionListener
{
+public class LockManagerImpl implements LockStateManager, SessionListener {
 
     private static Logger log = LoggerFactory.getLogger(LockManagerImpl.class);
 

Added: jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/lock/LockStateManager.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/lock/LockStateManager.java?rev=770600&view=auto
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/lock/LockStateManager.java
(added)
+++ jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/lock/LockStateManager.java
Fri May  1 09:47:10 2009
@@ -0,0 +1,133 @@
+/*
+ * 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.jcr2spi.lock;
+
+import javax.jcr.RepositoryException;
+import javax.jcr.lock.Lock;
+import javax.jcr.lock.LockException;
+import javax.jcr.lock.LockManager;
+
+import org.apache.jackrabbit.jcr2spi.state.NodeState;
+
+/**
+ * Defines the functionality needed for locking and unlocking nodes.
+ */
+public interface LockStateManager extends LockManager {
+
+    /**
+     * Lock a node. Checks whether the node is not locked and then
+     * returns a lock object for this node.
+     *
+     * @param nodeState
+     * @param isDeep whether the lock applies to this node only
+     * @param isSessionScoped whether the lock is session scoped
+     * @return lock object
+     * @throws LockException if this node already is locked, or some descendant
+     *         node is locked and <code>isDeep</code> is <code>true</code>
+     * @see javax.jcr.Node#lock
+     */
+    Lock lock(NodeState nodeState, boolean isDeep, boolean isSessionScoped)
+        throws LockException, RepositoryException;
+
+    /**
+     * Lock a node. Checks whether the node is not locked and then
+     * returns a lock object for this node.
+     *
+     * @param nodeState
+     * @param isDeep whether the lock applies to this node only
+     * @param isSessionScoped whether the lock is session scoped
+     * @param timeoutHint optional timeout hint.
+     * @param ownerHint optional String defining the lock owner info to be
+     * displayed.
+     * @return lock object
+     * @throws LockException if this node already is locked, or some descendant
+     *         node is locked and <code>isDeep</code> is <code>true</code>
+     * @see javax.jcr.Node#lock
+     */
+    Lock lock(NodeState nodeState, boolean isDeep, boolean isSessionScoped, long timeoutHint,
String ownerHint)
+        throws LockException, RepositoryException;
+
+    /**
+     * Removes the lock on a node.
+     *
+     * @param nodeState
+     * @throws LockException if this node is not locked or the session does not
+     * have the correct lock token
+     * @see javax.jcr.Node#unlock
+     */
+    void unlock(NodeState nodeState) throws LockException, RepositoryException;
+
+
+    /**
+     * Returns the Lock object that applies to a node. This may be either a lock
+     * on this node itself or a deep lock on a node above this node.
+     *
+     * @param nodeState
+     * @return lock object
+     * @throws LockException if this node is not locked
+     * @see javax.jcr.Node#getLock
+     */
+    Lock getLock(NodeState nodeState) throws LockException, RepositoryException;
+
+    /**
+     * Returns <code>true</code> if this node is locked either as a result
+     * of a lock held by this node or by a deep lock on a node above this
+     * node; otherwise returns <code>false</code>.
+     *
+     * @param nodeState
+     * @return <code>true</code> if this node is locked either as a result
+     * of a lock held by this node or by a deep lock on a node above this
+     * node; otherwise returns <code>false</code>
+     * @throws RepositoryException If an error occurs.
+     * @see javax.jcr.Node#isLocked
+     */
+    boolean isLocked(NodeState nodeState) throws RepositoryException;
+
+    /**
+     * Check whether the given node state is locked by somebody else than the
+     * current session. Access is allowed if the node is not locked or
+     * if the session itself holds the lock to this node, i.e. the session
+     * contains the lock token for the lock. If the node is not locked at
+     * all this method returns silently.
+     *
+     * @param nodeState
+     * @throws LockException if write access to the specified node is not allowed
+     * @throws RepositoryException if some other error occurs
+     */
+    void checkLock(NodeState nodeState) throws LockException, RepositoryException;
+
+    /**
+     *
+     * @return The lock tokens associated with the <code>Session</code> this
+     * lock manager has been created for.
+     */
+    public String[] getLockTokens();
+
+    /**
+     * Invoked by a session to inform that a lock token has been added.
+     *
+     * @param lt added lock token
+     */
+    void addLockToken(String lt) throws LockException, RepositoryException;
+
+    /**
+     * Invoked by a session to inform that a lock token has been removed.
+     *
+     * @param lt removed lock token
+     */
+    void removeLockToken(String lt) throws LockException, RepositoryException;
+}



Mime
View raw message