jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ang...@apache.org
Subject svn commit: r1309769 - in /jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr: RepositoryImpl.java SessionImpl.java
Date Thu, 05 Apr 2012 11:25:50 GMT
Author: angela
Date: Thu Apr  5 11:25:50 2012
New Revision: 1309769

URL: http://svn.apache.org/viewvc?rev=1309769&view=rev
Log:
OAK-49 - Session.getRepository() should return the object through which the Session was acquired

Modified:
    jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/RepositoryImpl.java
    jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/SessionImpl.java

Modified: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/RepositoryImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/RepositoryImpl.java?rev=1309769&r1=1309768&r2=1309769&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/RepositoryImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/RepositoryImpl.java
Thu Apr  5 11:25:50 2012
@@ -16,6 +16,7 @@
  */
 package org.apache.jackrabbit.oak.jcr;
 
+import org.apache.jackrabbit.commons.SimpleValueFactory;
 import org.apache.jackrabbit.mk.core.MicroKernelImpl;
 import org.apache.jackrabbit.oak.api.Connection;
 import org.apache.jackrabbit.oak.api.RepositoryService;
@@ -40,6 +41,7 @@ public class RepositoryImpl implements R
     private static final Logger log = LoggerFactory.getLogger(RepositoryImpl.class);
 
     private final GlobalContext context;
+    private final Descriptors descriptors = new Descriptors(new SimpleValueFactory());
 
     /**
      * Utility constructor that creates a JCR binding for an initially empty,
@@ -54,40 +56,61 @@ public class RepositoryImpl implements R
     }
 
     //---------------------------------------------------------< Repository >---
+    /**
+     * @see javax.jcr.Repository#getDescriptorKeys()
+     */
     @Override
     public String[] getDescriptorKeys() {
-        // TODO
-        throw new UnsupportedOperationException();
+        return descriptors.getKeys();
     }
 
+    /**
+     * @see Repository#isStandardDescriptor(String)
+     */
     @Override
     public boolean isStandardDescriptor(String key) {
-        // TODO
-        throw new UnsupportedOperationException();
+        return descriptors.isStandardDescriptor(key);
     }
 
+    /**
+     * @see javax.jcr.Repository#getDescriptor(String)
+     */
     @Override
     public String getDescriptor(String key) {
-        // TODO
-        throw new UnsupportedOperationException();
+        try {
+            Value v = getDescriptorValue(key);
+            return v == null
+                    ? null
+                    : v.getString();
+        }
+        catch (RepositoryException e) {
+            log.debug("Error converting value for descriptor with key {} to string", key);
+            return null;
+        }
     }
 
+    /**
+     * @see javax.jcr.Repository#getDescriptorValue(String)
+     */
     @Override
     public Value getDescriptorValue(String key) {
-        // TODO
-        throw new UnsupportedOperationException();
+        return descriptors.getValue(key);
     }
 
+    /**
+     * @see javax.jcr.Repository#getDescriptorValues(String)
+     */
     @Override
     public Value[] getDescriptorValues(String key) {
-        // TODO
-        throw new UnsupportedOperationException();
+        return descriptors.getValues(key);
     }
 
+    /**
+     * @see javax.jcr.Repository#isSingleValueDescriptor(String)
+     */
     @Override
     public boolean isSingleValueDescriptor(String key) {
-        // TODO
-        throw new UnsupportedOperationException();
+        return descriptors.isSingleValueDescriptor(key);
     }
 
     /**
@@ -100,7 +123,7 @@ public class RepositoryImpl implements R
         RepositoryService service = context.getInstance(RepositoryService.class);
         try {
             Connection connection = service.login(credentials, workspaceName);
-            return new SessionImpl(context, connection);
+            return new SessionImpl(context, this, connection);
         } catch (LoginException e) {
             throw new javax.jcr.LoginException(e.getMessage());
         }

Modified: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/SessionImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/SessionImpl.java?rev=1309769&r1=1309768&r2=1309769&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/SessionImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/SessionImpl.java
Thu Apr  5 11:25:50 2012
@@ -69,13 +69,13 @@ public class SessionImpl extends Abstrac
 
     private final SessionContext<SessionImpl> sessionContext = new Context();
 
-    SessionImpl(GlobalContext globalContext, Connection connection) {
+    SessionImpl(GlobalContext globalContext, Repository repository, Connection connection)
{
 
         this.globalContext = globalContext;
+        this.repository = repository;
         this.connection = connection;
 
         valueFactory = new ValueFactoryImpl();
-        repository = new RepositoryAdaptor(globalContext.getInstance(Repository.class), valueFactory);
         workspace = new WorkspaceImpl(sessionContext);
 
         transientSpace = new TransientSpace(sessionContext.getWorkspaceName(), sessionContext.getMicrokernel());



Mime
View raw message