jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ang...@apache.org
Subject svn commit: r1567172 - in /jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/xml: ImportHandler.java ImporterImpl.java
Date Tue, 11 Feb 2014 15:13:37 GMT
Author: angela
Date: Tue Feb 11 15:13:37 2014
New Revision: 1567172

URL: http://svn.apache.org/r1567172
Log:
OAK-931 : Importer: review usage of write-root and objects obtained from the sessioncontext

Modified:
    jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/xml/ImportHandler.java
    jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/xml/ImporterImpl.java

Modified: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/xml/ImportHandler.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/xml/ImportHandler.java?rev=1567172&r1=1567171&r2=1567172&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/xml/ImportHandler.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/xml/ImportHandler.java
Tue Feb 11 15:13:37 2014
@@ -57,7 +57,6 @@ public class ImportHandler extends Defau
     private static final Logger log = LoggerFactory.getLogger(ImportHandler.class);
 
     private final Root root;
-    private final Root initialRoot;
 
     private final SessionContext sessionContext;
     private final Importer importer;
@@ -73,9 +72,8 @@ public class ImportHandler extends Defau
         this.isWorkspaceImport = isWorkspaceImport;
 
         SessionDelegate sd = sessionContext.getSessionDelegate();
-        initialRoot = sd.getContentSession().getLatestRoot();
         root = (isWorkspaceImport) ? sd.getContentSession().getLatestRoot() : sd.getRoot();
-        importer = new ImporterImpl(absPath, sessionContext, root, initialRoot, uuidBehavior,
isWorkspaceImport);
+        importer = new ImporterImpl(absPath, sessionContext, root, uuidBehavior, isWorkspaceImport);
     }
 
     //---------------------------------------------------------< ErrorHandler >

Modified: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/xml/ImporterImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/xml/ImporterImpl.java?rev=1567172&r1=1567171&r2=1567172&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/xml/ImporterImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/xml/ImporterImpl.java
Tue Feb 11 15:13:37 2014
@@ -45,8 +45,10 @@ import org.apache.jackrabbit.oak.api.Roo
 import org.apache.jackrabbit.oak.api.Tree;
 import org.apache.jackrabbit.oak.api.Type;
 import org.apache.jackrabbit.oak.commons.PathUtils;
+import org.apache.jackrabbit.oak.jcr.delegate.SessionDelegate;
 import org.apache.jackrabbit.oak.jcr.security.AccessManager;
 import org.apache.jackrabbit.oak.jcr.session.SessionContext;
+import org.apache.jackrabbit.oak.jcr.session.WorkspaceImpl;
 import org.apache.jackrabbit.oak.plugins.identifier.IdentifierManager;
 import org.apache.jackrabbit.oak.plugins.memory.PropertyStates;
 import org.apache.jackrabbit.oak.plugins.nodetype.DefinitionProvider;
@@ -78,15 +80,15 @@ public class ImporterImpl implements Imp
     /**
      * There are two IdentifierManagers used.
      *
-     * baseStateIdManager - Associated with the initial root on which
-     *   no modifications are performed
-     *
-     * currentStateIdManager - Associated with current root on which all import
-     *   operations are being performed
+     * 1) currentStateIdManager - Associated with current root on which all import
+     *    operations are being performed
      *
+     * 2) baseStateIdManager - Associated with the initial root on which
+     *    no modifications are performed
      */
-    private final IdentifierManager baseStateIdManager;
     private final IdentifierManager currentStateIdManager;
+    private final IdentifierManager baseStateIdManager;
+
     private final EffectiveNodeTypeProvider effectiveNodeTypeProvider;
     private final DefinitionProvider definitionProvider;
 
@@ -117,7 +119,6 @@ public class ImporterImpl implements Imp
      * @param sessionContext The context of the editing session
      * @param root The write {@code Root}, which in case of a workspace import
      * is different from the {@code Root} associated with the editing session.
-     * @param initialRoot
      * @param uuidBehavior The uuid behavior
      * @param isWorkspaceImport {@code true} if this is a workspace import,
      * {@code false} otherwise.
@@ -127,7 +128,6 @@ public class ImporterImpl implements Imp
     public ImporterImpl(String absPath,
                         SessionContext sessionContext,
                         Root root,
-                        Root initialRoot,
                         int uuidBehavior,
                         boolean isWorkspaceImport) throws RepositoryException {
         if (!PathUtils.isAbsolute(absPath)) {
@@ -138,34 +138,35 @@ public class ImporterImpl implements Imp
             throw new RepositoryException("Invalid name or path: " + absPath);
         }
 
-        if (isWorkspaceImport && sessionContext.getSessionDelegate().hasPendingChanges())
{
+        SessionDelegate sd = sessionContext.getSessionDelegate();
+        if (isWorkspaceImport && sd.hasPendingChanges()) {
             throw new RepositoryException("Pending changes on session. Cannot run workspace
import.");
         }
 
         this.uuidBehavior = uuidBehavior;
-        userID = sessionContext.getSessionDelegate().getAuthInfo().getUserID();
+        userID = sd.getAuthInfo().getUserID();
 
         importTargetTree = root.getTree(absPath);
         if (!importTargetTree.exists()) {
             throw new PathNotFoundException(absPath);
         }
 
-        // TODO: review usage of write-root and object obtained from session-context (OAK-931)
-        VersionManager vMgr = sessionContext.getWorkspace().getVersionManager();
+        WorkspaceImpl wsp = sessionContext.getWorkspace();
+        VersionManager vMgr = wsp.getVersionManager();
         if (!vMgr.isCheckedOut(absPath)) {
             throw new VersionException("Target node is checked in.");
         }
-        if (importTargetTree.getStatus() != Tree.Status.NEW
-                && sessionContext.getWorkspace().getLockManager().isLocked(absPath))
{
+        if (importTargetTree.getStatus() != Tree.Status.NEW && wsp.getLockManager().isLocked(absPath))
{
             throw new LockException("Target node is locked.");
         }
+        effectiveNodeTypeProvider = wsp.getNodeTypeManager();
+        definitionProvider = wsp.getNodeTypeManager();
         ntTypesRoot = root.getTree(NODE_TYPES_PATH);
+
         accessManager = sessionContext.getAccessManager();
-        baseStateIdManager = new IdentifierManager(initialRoot);
+
         currentStateIdManager = new IdentifierManager(root);
-        effectiveNodeTypeProvider = sessionContext.getWorkspace().getNodeTypeManager();
-        definitionProvider = sessionContext.getWorkspace().getNodeTypeManager();
-        // TODO: end
+        baseStateIdManager = new IdentifierManager(sd.getContentSession().getLatestRoot());
 
         refTracker = new ReferenceChangeTracker();
 



Mime
View raw message