jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r896152 - in /jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi: client/ClientRepository.java value/StringValue.java
Date Tue, 05 Jan 2010 17:57:03 GMT
Author: jukka
Date: Tue Jan  5 17:57:03 2010
New Revision: 896152

URL: http://svn.apache.org/viewvc?rev=896152&view=rev
Log:
JCRRMI-26: JSR-283 support

Implement new repository descriptor methods.

Modified:
    jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/client/ClientRepository.java
    jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/value/StringValue.java

Modified: jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/client/ClientRepository.java
URL: http://svn.apache.org/viewvc/jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/client/ClientRepository.java?rev=896152&r1=896151&r2=896152&view=diff
==============================================================================
--- jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/client/ClientRepository.java
(original)
+++ jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/client/ClientRepository.java
Tue Jan  5 17:57:03 2010
@@ -24,8 +24,10 @@
 import javax.jcr.Session;
 import javax.jcr.Value;
 
+import org.apache.jackrabbit.commons.AbstractRepository;
 import org.apache.jackrabbit.rmi.remote.RemoteRepository;
 import org.apache.jackrabbit.rmi.remote.RemoteSession;
+import org.apache.jackrabbit.rmi.value.StringValue;
 
 /**
  * Local adapter for the JCR-RMI
@@ -36,10 +38,13 @@
  * @see javax.jcr.Repository
  * @see org.apache.jackrabbit.rmi.remote.RemoteRepository
  */
-public class ClientRepository extends ClientObject implements Repository {
+public class ClientRepository extends AbstractRepository implements Repository {
 
     /** The adapted remote repository. */
-    private RemoteRepository remote;
+    private final RemoteRepository remote;
+
+    /** Local adapter factory. */
+    private final LocalAdapterFactory factory;
 
     /**
      * Creates a client adapter for the given remote repository.
@@ -49,8 +54,8 @@
      */
     public ClientRepository(
             RemoteRepository remote, LocalAdapterFactory factory) {
-        super(factory);
         this.remote = remote;
+        this.factory = factory;
     }
 
     /** {@inheritDoc} */
@@ -63,42 +68,37 @@
     }
 
     /** {@inheritDoc} */
-    public String[] getDescriptorKeys() {
-        try {
-            return remote.getDescriptorKeys();
-        } catch (RemoteException ex) {
-            throw new RemoteRuntimeException(ex);
+    public Value getDescriptorValue(String key) {
+        String descriptor = getDescriptor(key);
+        if (descriptor != null) {
+            return new StringValue(descriptor);
+        } else {
+            return null;
         }
     }
 
     /** {@inheritDoc} */
-    public Session login() throws RepositoryException {
-        try {
-            RemoteSession session = remote.login();
-            return getFactory().getSession(this, session);
-        } catch (RemoteException ex) {
-            throw new RemoteRepositoryException(ex);
+    public Value[] getDescriptorValues(String key) {
+        Value value = getDescriptorValue(key);
+        if (value != null) {
+            return new Value[] { value };
+        } else {
+            return null;
         }
     }
 
     /** {@inheritDoc} */
-    public Session login(String workspace) throws RepositoryException {
+    public String[] getDescriptorKeys() {
         try {
-            RemoteSession session = remote.login(workspace);
-            return getFactory().getSession(this, session);
+            return remote.getDescriptorKeys();
         } catch (RemoteException ex) {
-            throw new RemoteRepositoryException(ex);
+            throw new RemoteRuntimeException(ex);
         }
     }
 
     /** {@inheritDoc} */
-    public Session login(Credentials credentials) throws RepositoryException {
-        try {
-            RemoteSession session = remote.login(credentials);
-            return getFactory().getSession(this, session);
-        } catch (RemoteException ex) {
-            throw new RemoteRepositoryException(ex);
-        }
+    public boolean isSingleValueDescriptor(String key) {
+        return getDescriptor(key) != null;
     }
 
     /** {@inheritDoc} */
@@ -106,26 +106,10 @@
             throws RepositoryException {
         try {
             RemoteSession session = remote.login(credentials, workspace);
-            return getFactory().getSession(this, session);
+            return factory.getSession(this, session);
         } catch (RemoteException ex) {
             throw new RemoteRepositoryException(ex);
         }
     }
 
-    public Value getDescriptorValue(String key) {
-        throw new RuntimeException("TODO: JCRRMI-26");
-    }
-
-    public Value[] getDescriptorValues(String key) {
-        throw new RuntimeException("TODO: JCRRMI-26");
-    }
-
-    public boolean isSingleValueDescriptor(String key) {
-        throw new RuntimeException("TODO: JCRRMI-26");
-    }
-
-    public boolean isStandardDescriptor(String key) {
-        throw new RuntimeException("TODO: JCRRMI-26");
-    }
-
 }

Modified: jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/value/StringValue.java
URL: http://svn.apache.org/viewvc/jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/value/StringValue.java?rev=896152&r1=896151&r2=896152&view=diff
==============================================================================
--- jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/value/StringValue.java
(original)
+++ jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/value/StringValue.java
Tue Jan  5 17:57:03 2010
@@ -41,7 +41,7 @@
     /**
      * Creates an instance for the given string <code>value</code>.
      */
-    protected StringValue(String value) {
+    public StringValue(String value) {
         this.value = value;
     }
 



Mime
View raw message