incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: r1144209 - /sling/trunk/bundles/jcr/base/src/main/java/org/apache/sling/jcr/base/internal/SlingRepositoryWrapper.java
Date Fri, 08 Jul 2011 09:32:04 GMT
Author: cziegeler
Date: Fri Jul  8 09:32:04 2011
New Revision: 1144209

URL: http://svn.apache.org/viewvc?rev=1144209&view=rev
Log:
SLING-2128 : Provide plain Repository services as SlingRepository services

Modified:
    sling/trunk/bundles/jcr/base/src/main/java/org/apache/sling/jcr/base/internal/SlingRepositoryWrapper.java

Modified: sling/trunk/bundles/jcr/base/src/main/java/org/apache/sling/jcr/base/internal/SlingRepositoryWrapper.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/jcr/base/src/main/java/org/apache/sling/jcr/base/internal/SlingRepositoryWrapper.java?rev=1144209&r1=1144208&r2=1144209&view=diff
==============================================================================
--- sling/trunk/bundles/jcr/base/src/main/java/org/apache/sling/jcr/base/internal/SlingRepositoryWrapper.java
(original)
+++ sling/trunk/bundles/jcr/base/src/main/java/org/apache/sling/jcr/base/internal/SlingRepositoryWrapper.java
Fri Jul  8 09:32:04 2011
@@ -40,9 +40,25 @@ public class SlingRepositoryWrapper
 
     private final Repository delegatee;
 
+    private final String defaultWorkspaceName;
+
     public SlingRepositoryWrapper(final Repository delegatee, final BundleContext bundleContext)
{
         this.delegatee = delegatee;
         this.setup(bundleContext);
+        // try to get the default workspace name
+        String workspaceName = null;
+        Session adminSession = null;
+        try {
+            adminSession = this.loginAdministrative(null);
+            workspaceName = adminSession.getWorkspace().getName();
+        } catch (final RepositoryException re) {
+            // ignore
+        } finally {
+            if ( adminSession != null ) {
+                adminSession.logout();
+            }
+        }
+        this.defaultWorkspaceName = workspaceName;
     }
 
     public void dispose() {
@@ -50,12 +66,10 @@ public class SlingRepositoryWrapper
     }
 
     /**
-     * Return <code>null</code> to indicate the default workspace
-     * of the repository is used.
      * @see org.apache.sling.jcr.api.SlingRepository#getDefaultWorkspace()
      */
     public String getDefaultWorkspace() {
-        return null;
+        return this.defaultWorkspaceName;
     }
 
     /**



Mime
View raw message