jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r614158 - in /jackrabbit/trunk: jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/util/Locked.java jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/lock/Locked.java
Date Tue, 22 Jan 2008 09:53:11 GMT
Author: jukka
Date: Tue Jan 22 01:53:09 2008
New Revision: 614158

URL: http://svn.apache.org/viewvc?rev=614158&view=rev
Log:
JCR-1331: Improper deprecation of Locked class
    - Reverted revisions 613834 and 613841 as requested by Angela

Modified:
    jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/util/Locked.java
    jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/lock/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=614158&r1=614157&r2=614158&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
Tue Jan 22 01:53:09 2008
@@ -16,6 +16,11 @@
  */
 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;
@@ -70,12 +75,13 @@
  *     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.
@@ -131,16 +137,17 @@
         }
 
         Session session = lockable.getSession();
+        SessionNamespaceResolver resolver = new SessionNamespaceResolver(session);
 
+        Lock lock;
         EventListener listener = null;
         try {
             // check whether the lockable can be locked at all
-            String mix = session.getNamespacePrefix(MIX);
-            if (!lockable.isNodeType(mix + ":lockable")) {
+            if (!lockable.isNodeType(NameFormat.format(QName.MIX_LOCKABLE, resolver))) {
                 throw new IllegalArgumentException("Node is not lockable");
             }
 
-            Lock lock = tryLock(lockable, isDeep);
+            lock = tryLock(lockable, isDeep);
             if (lock != null) {
                 return runAndUnlock(lock);
             }
@@ -198,6 +205,8 @@
                     }
                 }
             }
+        } catch (NoPrefixDeclaredException e) {
+            throw new RepositoryException(e);
         } finally {
             if (listener != null) {
                 session.getWorkspace().getObservationManager().removeEventListener(listener);

Modified: jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/lock/Locked.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/lock/Locked.java?rev=614158&r1=614157&r2=614158&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/lock/Locked.java
(original)
+++ jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/lock/Locked.java
Tue Jan 22 01:53:09 2008
@@ -76,8 +76,6 @@
  *     long nextValue = ((Long) ret).longValue();
  * }
  * </pre>
- *
- * @deprecated use the Locked class in the jackrabbit-jcr-commons component
  */
 public abstract class Locked {
 



Mime
View raw message