jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r948857 - in /jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core: SessionImpl.java WorkspaceImpl.java XASessionImpl.java XAWorkspace.java
Date Thu, 27 May 2010 15:02:19 GMT
Author: jukka
Date: Thu May 27 15:02:18 2010
New Revision: 948857

URL: http://svn.apache.org/viewvc?rev=948857&view=rev
Log:
JCR-2640: Internal repository context

Streamline WorkspaceImpl creation with the new WorkspaceManager class.

Modified:
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/SessionImpl.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/WorkspaceImpl.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/XASessionImpl.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/XAWorkspace.java

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/SessionImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/SessionImpl.java?rev=948857&r1=948856&r2=948857&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/SessionImpl.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/SessionImpl.java
Thu May 27 15:02:18 2010
@@ -40,7 +40,6 @@ import org.apache.jackrabbit.core.securi
 import org.apache.jackrabbit.core.state.LocalItemStateManager;
 import org.apache.jackrabbit.core.state.NodeState;
 import org.apache.jackrabbit.core.state.SessionItemStateManager;
-import org.apache.jackrabbit.core.state.SharedItemStateManager;
 import org.apache.jackrabbit.core.util.Dumpable;
 import org.apache.jackrabbit.core.value.ValueFactoryImpl;
 import org.apache.jackrabbit.core.version.InternalVersionManager;
@@ -287,10 +286,7 @@ public class SessionImpl extends Abstrac
         ntMgr = new NodeTypeManagerImpl(
                 repositoryContext.getNodeTypeRegistry(), this,
                 repositoryContext.getDataStore());
-        String wspName = wspConfig.getName();
-        wsp = createWorkspaceInstance(
-                wspConfig,
-                repositoryContext.getWorkspaceManager().getWorkspaceStateManager(wspName));
+        wsp = createWorkspaceInstance(wspConfig);
         itemStateMgr = createSessionItemStateManager(wsp.getItemStateManager());
         hierMgr = itemStateMgr.getHierarchyMgr();
         itemMgr = createItemManager(itemStateMgr, hierMgr);
@@ -324,13 +320,13 @@ public class SessionImpl extends Abstrac
      * Creates the workspace instance backing this session.
      *
      * @param wspConfig The workspace configuration
-     * @param stateMgr  The shared item state manager
      * @return An instance of the {@link WorkspaceImpl} class or an extension
      *         thereof.
+     * @throws RepositoryException if the workspace can not be accessed
      */
-    protected WorkspaceImpl createWorkspaceInstance(
-            WorkspaceConfig wspConfig, SharedItemStateManager stateMgr) {
-        return new WorkspaceImpl(wspConfig, stateMgr, repositoryContext, this);
+    protected WorkspaceImpl createWorkspaceInstance(WorkspaceConfig wspConfig)
+            throws RepositoryException {
+        return new WorkspaceImpl(wspConfig, repositoryContext, this);
     }
 
     /**

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/WorkspaceImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/WorkspaceImpl.java?rev=948857&r1=948856&r2=948857&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/WorkspaceImpl.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/WorkspaceImpl.java
Thu May 27 15:02:18 2010
@@ -143,12 +143,12 @@ public class WorkspaceImpl extends Abstr
      * @param session   The session
      */
     protected WorkspaceImpl(
-            WorkspaceConfig wspConfig, SharedItemStateManager stateMgr,
-            RepositoryContext repositoryContext, SessionImpl session) {
+            WorkspaceConfig wspConfig, RepositoryContext repositoryContext,
+            SessionImpl session) throws RepositoryException {
         this.wspConfig = wspConfig;
         this.repositoryContext = repositoryContext;
         this.rep = repositoryContext.getRepository();
-        this.stateMgr = createItemStateManager(stateMgr);
+        this.stateMgr = createItemStateManager();
         this.hierMgr = new CachingHierarchyManager(
                 repositoryContext.getRootNodeId(), this.stateMgr);
         this.stateMgr.addListener(hierMgr);
@@ -848,13 +848,27 @@ public class WorkspaceImpl extends Abstr
     }
 
     /**
+     * Returns the shared item state manager of this workspace.
+     *
+     * @return shared item state manager
+     * @throws RepositoryException if the workspace can not be accessed
+     */
+    protected SharedItemStateManager getSharedItemStateManager()
+            throws RepositoryException {
+        WorkspaceManager manager = repositoryContext.getWorkspaceManager();
+        return manager.getWorkspaceStateManager(getName());
+    }
+
+    /**
      * Create the persistent item state manager on top of the shared item
      * state manager. May be overridden by subclasses.
      * @param shared shared item state manager
      * @return local item state manager
      */
-    protected LocalItemStateManager createItemStateManager(SharedItemStateManager shared)
{
-        return LocalItemStateManager.createInstance(shared, this, rep.getItemStateCacheFactory());
+    protected LocalItemStateManager createItemStateManager()
+            throws RepositoryException {
+        return LocalItemStateManager.createInstance(
+                getSharedItemStateManager(), this, rep.getItemStateCacheFactory());
     }
 
     //------------------------------------------< EventStateCollectionFactory >

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/XASessionImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/XASessionImpl.java?rev=948857&r1=948856&r2=948857&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/XASessionImpl.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/XASessionImpl.java
Thu May 27 15:02:18 2010
@@ -22,7 +22,6 @@ import org.apache.jackrabbit.core.lock.L
 import org.apache.jackrabbit.core.lock.LockManagerImpl;
 import org.apache.jackrabbit.core.lock.XALockManager;
 import org.apache.jackrabbit.core.security.authentication.AuthContext;
-import org.apache.jackrabbit.core.state.SharedItemStateManager;
 import org.apache.jackrabbit.core.state.XAItemStateManager;
 import org.apache.jackrabbit.core.version.InternalVersionManager;
 import org.apache.jackrabbit.core.version.InternalXAVersionManager;
@@ -42,6 +41,7 @@ import java.util.Map;
 /**
  * Session extension that provides XA support.
  */
+@SuppressWarnings("deprecation")
 public class XASessionImpl extends SessionImpl
         implements XASession, XAResource {
 
@@ -158,9 +158,9 @@ public class XASessionImpl extends Sessi
      * {@inheritDoc}
      */
     @Override
-    protected WorkspaceImpl createWorkspaceInstance(
-            WorkspaceConfig wspConfig, SharedItemStateManager stateMgr) {
-        return new XAWorkspace(wspConfig, stateMgr, repositoryContext, this);
+    protected WorkspaceImpl createWorkspaceInstance(WorkspaceConfig wspConfig)
+            throws RepositoryException {
+        return new XAWorkspace(wspConfig, repositoryContext, this);
     }
 
     /**

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/XAWorkspace.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/XAWorkspace.java?rev=948857&r1=948856&r2=948857&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/XAWorkspace.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/XAWorkspace.java
Thu May 27 15:02:18 2010
@@ -16,10 +16,11 @@
  */
 package org.apache.jackrabbit.core;
 
+import javax.jcr.RepositoryException;
+
 import org.apache.jackrabbit.core.config.WorkspaceConfig;
-import org.apache.jackrabbit.core.state.SharedItemStateManager;
-import org.apache.jackrabbit.core.state.XAItemStateManager;
 import org.apache.jackrabbit.core.state.LocalItemStateManager;
+import org.apache.jackrabbit.core.state.XAItemStateManager;
 
 /**
  * Workspace extension that works in an XA environment.
@@ -30,20 +31,20 @@ public class XAWorkspace extends Workspa
      * Protected constructor.
      *
      * @param wspConfig The workspace configuration
-     * @param stateMgr  The shared item state manager
      * @param repositoryContext repository context
      * @param session   The session
      */
     protected XAWorkspace(
-            WorkspaceConfig wspConfig, SharedItemStateManager stateMgr,
-            RepositoryContext repositoryContext, SessionImpl session) {
-        super(wspConfig, stateMgr, repositoryContext, session);
+            WorkspaceConfig wspConfig, RepositoryContext repositoryContext,
+            SessionImpl session) throws RepositoryException {
+        super(wspConfig, repositoryContext, session);
     }
 
-    /**
-     * {@inheritDoc}
-     */
-    protected LocalItemStateManager createItemStateManager(SharedItemStateManager shared)
{
-        return XAItemStateManager.createInstance(shared, this, null, rep.getItemStateCacheFactory());
+    @Override
+    protected LocalItemStateManager createItemStateManager()
+            throws RepositoryException {
+        return XAItemStateManager.createInstance(
+                getSharedItemStateManager(), this, null,
+                rep.getItemStateCacheFactory());
     }
 }



Mime
View raw message