jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r638066 - in /jackrabbit/branches/1.4/jackrabbit-core/src: main/java/org/apache/jackrabbit/core/data/ test/java/org/apache/jackrabbit/core/data/
Date Mon, 17 Mar 2008 21:07:20 GMT
Author: jukka
Date: Mon Mar 17 14:07:19 2008
New Revision: 638066

URL: http://svn.apache.org/viewvc?rev=638066&view=rev
Log:
1.4: Merged revision 636774 (JCR-1469)

Added:
    jackrabbit/branches/1.4/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/data/GCEventListenerTest.java
      - copied unchanged from r636774, jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/data/GCEventListenerTest.java
Modified:
    jackrabbit/branches/1.4/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/data/GarbageCollector.java
    jackrabbit/branches/1.4/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/data/GarbageCollectorTest.java
    jackrabbit/branches/1.4/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/data/TestAll.java

Modified: jackrabbit/branches/1.4/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/data/GarbageCollector.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/1.4/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/data/GarbageCollector.java?rev=638066&r1=638065&r2=638066&view=diff
==============================================================================
--- jackrabbit/branches/1.4/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/data/GarbageCollector.java
(original)
+++ jackrabbit/branches/1.4/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/data/GarbageCollector.java
Mon Mar 17 14:07:19 2008
@@ -84,6 +84,8 @@
     
     private final Session[] sessionList;
 
+    private boolean persistenceManagerScan;
+
     // TODO It should be possible to stop and restart a garbage collection scan.
 
     /**
@@ -97,6 +99,7 @@
         RepositoryImpl rep = (RepositoryImpl) session.getRepository();
         store = rep.getDataStore();
         this.pmList = list;
+        this.persistenceManagerScan = list != null;
         this.sessionList = sessionList;
     }
 
@@ -150,7 +153,7 @@
             store.updateModifiedDateOnAccess(startScanTimestamp);
         }
         
-        if (pmList == null) {
+        if (pmList == null || !persistenceManagerScan) {
             for (int i = 0; i < sessionList.length; i++) {
                 scanNodes(sessionList[i]);
             }
@@ -170,12 +173,36 @@
         recurse(session.getRootNode(), sleepBetweenNodes);
     }
     
+    /**
+     * Enable or disable using the IterablePersistenceManager interface
+     * to scan the items. This is important for clients that need
+     * the complete Node implementation in the ScanEventListener
+     * callback.
+     *
+     * @param allow true if using the IterablePersistenceManager interface is allowed
+     */
+    public void setPersistenceManagerScan(boolean allow) {
+        persistenceManagerScan = allow;
+    }
+
+    /**
+     * Check if using the IterablePersistenceManager interface is allowed.
+     *
+     * @return true if using IterablePersistenceManager is possible.
+     */
+    public boolean getPersistenceManagerScan() {
+        return persistenceManagerScan;
+    }
+
     private void scanPersistenceManagers() throws ItemStateException, RepositoryException
{
         for (int i = 0; i < pmList.length; i++) {
             IterablePersistenceManager pm = pmList[i];
             Iterator it = pm.getAllNodeIds(null, 0);
             while (it.hasNext()) {
                 NodeId id = (NodeId) it.next();
+                if (callback != null) {
+                    callback.beforeScanning(null);
+                }
                 try {
                     NodeState state = pm.load(id);
                     Set propertyNames = state.getPropertyNames();
@@ -194,6 +221,9 @@
                 } catch (NoSuchItemStateException e) {
                     // the node may have been deleted or moved in the meantime
                     // ignore it
+                }
+                if (callback != null) {
+                    callback.afterScanning(null);
                 }
             }
         }

Modified: jackrabbit/branches/1.4/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/data/GarbageCollectorTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/1.4/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/data/GarbageCollectorTest.java?rev=638066&r1=638065&r2=638066&view=diff
==============================================================================
--- jackrabbit/branches/1.4/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/data/GarbageCollectorTest.java
(original)
+++ jackrabbit/branches/1.4/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/data/GarbageCollectorTest.java
Mon Mar 17 14:07:19 2008
@@ -151,7 +151,7 @@
     }
 
     public void afterScanning(Node n) throws RepositoryException {
-        if (n.getPath().startsWith("/testroot/node")) {
+        if (n != null && n.getPath().startsWith("/testroot/node")) {
             String path = n.getPath();
             LOG.debug("scanned: " + path);
         }
@@ -166,7 +166,7 @@
     }
 
     public void beforeScanning(Node n) throws RepositoryException {
-        if (n.getPath().equals("/testroot/node2")) {
+        if (n != null && n.getPath().equals("/testroot/node2")) {
             Session session = n.getSession();
             list(session.getRootNode());
             session.move("/testroot/node2/nodeWithBlob", "/testroot/node1/nodeWithBlob");

Modified: jackrabbit/branches/1.4/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/data/TestAll.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/1.4/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/data/TestAll.java?rev=638066&r1=638065&r2=638066&view=diff
==============================================================================
--- jackrabbit/branches/1.4/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/data/TestAll.java
(original)
+++ jackrabbit/branches/1.4/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/data/TestAll.java
Mon Mar 17 14:07:19 2008
@@ -36,6 +36,7 @@
         suite.addTestSuite(ExportImportTest.class);
         suite.addTestSuite(GarbageCollectorTest.class);
         suite.addTestSuite(GCConcurrentTest.class);
+        suite.addTestSuite(GCEventListenerTest.class);
         suite.addTestSuite(PersistenceManagerIteratorTest.class);
         suite.addTestSuite(CopyValueTest.class);
         return suite;



Mime
View raw message