jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r638100 - /jackrabbit/branches/1.4/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/util/Locked.java
Date Mon, 17 Mar 2008 22:27:56 GMT
Author: jukka
Date: Mon Mar 17 15:27:53 2008
New Revision: 638100

URL: http://svn.apache.org/viewvc?rev=638100&view=rev
Log:
1.4: Merged revision 638099 (JCR-1331)

Modified:
    jackrabbit/branches/1.4/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/util/Locked.java

Modified: jackrabbit/branches/1.4/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/util/Locked.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/1.4/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/util/Locked.java?rev=638100&r1=638099&r2=638100&view=diff
==============================================================================
--- jackrabbit/branches/1.4/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/util/Locked.java
(original)
+++ jackrabbit/branches/1.4/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/util/Locked.java
Mon Mar 17 15:27:53 2008
@@ -16,11 +16,6 @@
  */
 package org.apache.jackrabbit.util;
 
-import org.apache.jackrabbit.name.NameFormat;
-import org.apache.jackrabbit.name.NoPrefixDeclaredException;
-import org.apache.jackrabbit.name.QName;
-import org.apache.jackrabbit.name.SessionNamespaceResolver;
-
 import javax.jcr.Node;
 import javax.jcr.Repository;
 import javax.jcr.RepositoryException;
@@ -75,13 +70,12 @@
  *     long nextValue = ((Long) ret).longValue();
  * }
  * </pre>
- *
- * @deprecated Use the Locked class from 
- *             the org.apache.jackrabbit.spi.commons.lock package of
- *             the jackrabbit-spi-commons component.
  */
 public abstract class Locked {
 
+    /** The mixin namespace */
+    private static final String MIX = "http://www.jcp.org/jcr/mix/1.0";
+
     /**
      * Object returned when timeout is reached without being able to call
      * {@link #run} while holding the lock.
@@ -137,17 +131,16 @@
         }
 
         Session session = lockable.getSession();
-        SessionNamespaceResolver resolver = new SessionNamespaceResolver(session);
 
-        Lock lock;
         EventListener listener = null;
         try {
             // check whether the lockable can be locked at all
-            if (!lockable.isNodeType(NameFormat.format(QName.MIX_LOCKABLE, resolver))) {
+            String mix = session.getNamespacePrefix(MIX);
+            if (!lockable.isNodeType(mix + ":lockable")) {
                 throw new IllegalArgumentException("Node is not lockable");
             }
 
-            lock = tryLock(lockable, isDeep);
+            Lock lock = tryLock(lockable, isDeep);
             if (lock != null) {
                 return runAndUnlock(lock);
             }
@@ -205,8 +198,6 @@
                     }
                 }
             }
-        } catch (NoPrefixDeclaredException e) {
-            throw new RepositoryException(e);
         } finally {
             if (listener != null) {
                 session.getWorkspace().getObservationManager().removeEventListener(listener);



Mime
View raw message