You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jackrabbit.apache.org by ju...@apache.org on 2009/04/30 14:47:34 UTC

svn commit: r770208 - /jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/repository/ProxyRepository.java

Author: jukka
Date: Thu Apr 30 12:47:33 2009
New Revision: 770208

URL: http://svn.apache.org/viewvc?rev=770208&view=rev
Log:
JCR-2062: JSR 283: Repository Compliance

Add missing methods in ProxyRepository.

Modified:
    jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/repository/ProxyRepository.java

Modified: jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/repository/ProxyRepository.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/repository/ProxyRepository.java?rev=770208&r1=770207&r2=770208&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/repository/ProxyRepository.java (original)
+++ jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/repository/ProxyRepository.java Thu Apr 30 12:47:33 2009
@@ -19,6 +19,7 @@
 import javax.jcr.Credentials;
 import javax.jcr.RepositoryException;
 import javax.jcr.Session;
+import javax.jcr.Value;
 
 import org.apache.jackrabbit.commons.AbstractRepository;
 
@@ -61,10 +62,28 @@
     }
 
     /**
+     * Checks whether the given key identifies a valid single-valued
+     * descriptor key in the proxied repository. Returns <code>false</code>
+     * if the proxied repository can not be accessed.
+     *
+     * @return <code>true</code> if the key identifies a valid single-valued
+     *         descriptor in the proxied repository,
+     *         <code>false</code> otherwise
+     */
+    public boolean isSingleValueDescriptor(String key) {
+        try {
+            return factory.getRepository().isSingleValueDescriptor(key);
+        } catch (RepositoryException e) {
+            return false;
+        }
+    }
+
+    /**
      * Returns the descriptor with the given key from the proxied repository.
      * Returns <code>null</code> if the descriptor does not exist or if the
      * proxied repository can not be accessed.
      *
+     * @param key descriptor key
      * @return descriptor value, or <code>null</code>
      */
     public String getDescriptor(String key) {
@@ -76,6 +95,38 @@
     }
 
     /**
+     * Returns the value of the descriptor with the given key from the proxied
+     * repository. Returns <code>null</code> if the descriptor does not exist
+     * or if the proxied repository can not be accessed.
+     *
+     * @param key descriptor key
+     * @return descriptor value, or <code>null</code>
+     */
+    public Value getDescriptorValue(String key) {
+        try {
+            return factory.getRepository().getDescriptorValue(key);
+        } catch (RepositoryException e) {
+            return null;
+        }
+    }
+
+    /**
+     * Returns the values of the descriptor with the given key from the proxied
+     * repository. Returns <code>null</code> if the descriptor does not exist
+     * or if the proxied repository can not be accessed.
+     *
+     * @param key descriptor key
+     * @return descriptor values, or <code>null</code>
+     */
+    public Value[] getDescriptorValues(String key) {
+        try {
+            return factory.getRepository().getDescriptorValues(key);
+        } catch (RepositoryException e) {
+            return null;
+        }
+    }
+
+    /**
      * Logs in to the proxied repository and returns the resulting session.
      * <p>
      * Note that the {@link Session#getRepository()} method of the resulting