jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r638099 - /jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/util/Locked.java
Date Mon, 17 Mar 2008 22:24:30 GMT
Author: jukka
Date: Mon Mar 17 15:24:26 2008
New Revision: 638099

URL: http://svn.apache.org/viewvc?rev=638099&view=rev
Log:
JCR-1331: Improper deprecation of Locked class
    - Re-applied revision 613834

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

Modified: jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/util/Locked.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/util/Locked.java?rev=638099&r1=638098&r2=638099&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/util/Locked.java
(original)
+++ jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/util/Locked.java
Mon Mar 17 15:24:26 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