jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ste...@apache.org
Subject svn commit: r1209574 - in /jackrabbit/sandbox/microkernel: ./ src/main/java/org/apache/jackrabbit/mk/model/ src/main/java/org/apache/jackrabbit/mk/store/
Date Fri, 02 Dec 2011 16:44:20 GMT
Author: stefan
Date: Fri Dec  2 16:44:20 2011
New Revision: 1209574

URL: http://svn.apache.org/viewvc?rev=1209574&view=rev
Log:
some minor tweaking

Modified:
    jackrabbit/sandbox/microkernel/pom.xml
    jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/model/AbstractCommit.java
    jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/model/AbstractNode.java
    jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/model/StoredCommit.java
    jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/model/StoredNode.java
    jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/store/AbstractPersistenceManager.java
    jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/store/BDbPersistenceManager.java
    jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/store/H2PersistenceManager.java

Modified: jackrabbit/sandbox/microkernel/pom.xml
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/microkernel/pom.xml?rev=1209574&r1=1209573&r2=1209574&view=diff
==============================================================================
--- jackrabbit/sandbox/microkernel/pom.xml (original)
+++ jackrabbit/sandbox/microkernel/pom.xml Fri Dec  2 16:44:20 2011
@@ -77,7 +77,12 @@
                     <target>1.5</target>
                 </configuration>
             </plugin>
-            <!--
+            <plugin>
+                <artifactId>maven-surefire-plugin</artifactId>
+                <configuration>
+                    <argLine>-Xmx1024m</argLine>
+                </configuration>
+            </plugin>            <!--
             run mutation tests using: 
             mvn org.pitest:pitest-maven:mutationCoverage
             -->

Modified: jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/model/AbstractCommit.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/model/AbstractCommit.java?rev=1209574&r1=1209573&r2=1209574&view=diff
==============================================================================
--- jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/model/AbstractCommit.java
(original)
+++ jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/model/AbstractCommit.java
Fri Dec  2 16:44:20 2011
@@ -33,6 +33,16 @@ public abstract class AbstractCommit imp
     // id of parent commit
     protected String parentId;
 
+    protected AbstractCommit() {
+    }
+
+    protected AbstractCommit(Commit other) {
+        this.parentId = other.getParentId();
+        this.rootNodeId = other.getRootNodeId();
+        this.msg = other.getMsg();
+        this.commitTS = other.getCommitTS();
+    }
+
     public String getParentId() {
         return parentId;
     }

Modified: jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/model/AbstractNode.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/model/AbstractNode.java?rev=1209574&r1=1209573&r2=1209574&view=diff
==============================================================================
--- jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/model/AbstractNode.java
(original)
+++ jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/model/AbstractNode.java
Fri Dec  2 16:44:20 2011
@@ -39,13 +39,13 @@ public abstract class AbstractNode imple
     //final protected LinkedHashMap<String, Node> children;
     final protected LinkedHashMap<String, String> childEntries;
 
-    public AbstractNode() {
+    protected AbstractNode() {
         this.properties = new HashMap<String, String>();
         //this.children = new LinkedHashMap<String, Node>();
         this.childEntries = new LinkedHashMap<String, String>();
     }
 
-    public AbstractNode(Node other) {
+    protected AbstractNode(Node other) {
         this.properties = new HashMap<String, String>(other.getProperties());
         //this.children = new LinkedHashMap<String, Node>(other.getChildNodes(0, -1));
         this.childEntries = new LinkedHashMap<String, String>(other.getChildNodeEntries());

Modified: jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/model/StoredCommit.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/model/StoredCommit.java?rev=1209574&r1=1209573&r2=1209574&view=diff
==============================================================================
--- jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/model/StoredCommit.java
(original)
+++ jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/model/StoredCommit.java
Fri Dec  2 16:44:20 2011
@@ -31,6 +31,11 @@ public class StoredCommit extends Abstra
         this.msg = msg;
     }
 
+    public StoredCommit(String id, Commit commit) {
+        super(commit);
+        this.id = id;
+    }
+
     public String getId() {
         return id;
     }

Modified: jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/model/StoredNode.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/model/StoredNode.java?rev=1209574&r1=1209573&r2=1209574&view=diff
==============================================================================
--- jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/model/StoredNode.java
(original)
+++ jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/model/StoredNode.java
Fri Dec  2 16:44:20 2011
@@ -20,6 +20,7 @@ import org.apache.jackrabbit.mk.store.Re
 import org.apache.jackrabbit.mk.store.NotFoundException;
 
 import java.util.Collections;
+import java.util.HashMap;
 import java.util.LinkedHashMap;
 import java.util.List;
 import java.util.Map;
@@ -31,12 +32,17 @@ public class StoredNode extends Abstract
 
     private final String id;
 
-    public StoredNode(String id, Map<String, String> properties, LinkedHashMap<String,
String> childEntries) {
+    public StoredNode(String id, Map<String, String> properties, Map<String, String>
childEntries) {
         this.id = id;
         this.properties.putAll(properties);
         this.childEntries.putAll(childEntries);
     }
 
+    public StoredNode(String id, Node node) {
+        super(node);
+        this.id = id;
+    }
+
     public String getId() {
         return id;
     }

Modified: jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/store/AbstractPersistenceManager.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/store/AbstractPersistenceManager.java?rev=1209574&r1=1209573&r2=1209574&view=diff
==============================================================================
--- jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/store/AbstractPersistenceManager.java
(original)
+++ jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/store/AbstractPersistenceManager.java
Fri Dec  2 16:44:20 2011
@@ -35,7 +35,7 @@ import java.util.concurrent.locks.Reentr
  */
 public abstract class AbstractPersistenceManager implements RevisionStore {
 
-    public static final String CACHE_SIZE = "microKernel.cacheSize";
+    public static final String CACHE_SIZE = "mk.cacheSize";
     public static final int DEFAULT_CACHE_SIZE = 10000;
 
     private boolean initialized;
@@ -117,13 +117,19 @@ public abstract class AbstractPersistenc
     public String putNode(Node node) throws Exception {
         verifyInitialized();
 
-        return writeNode(node);
+        String id = writeNode(node);
+        cache.put(id, new StoredNode(id, node));
+
+        return id;
     }
 
     public String putCommit(Commit commit) throws Exception {
         verifyInitialized();
 
-        return writeCommit(commit);
+        String id = writeCommit(commit);
+        cache.put(id, new StoredCommit(id, commit));
+
+        return id;
     }
 
     public void setHeadCommitId(String commitId) throws Exception {

Modified: jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/store/BDbPersistenceManager.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/store/BDbPersistenceManager.java?rev=1209574&r1=1209573&r2=1209574&view=diff
==============================================================================
--- jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/store/BDbPersistenceManager.java
(original)
+++ jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/store/BDbPersistenceManager.java
Fri Dec  2 16:44:20 2011
@@ -79,7 +79,7 @@ public class BDbPersistenceManager exten
         // TODO FIXME workaround in case we're not closed properly
         Runtime.getRuntime().addShutdownHook(new Thread() {
             public void run() {
-                close();
+                try { close(); } catch (Throwable ignore) {}
             }
         });
     }
@@ -91,6 +91,7 @@ public class BDbPersistenceManager exten
                 db.sync();
             }
             db.close();
+            head.close();
             dbEnv.close();
 
             db = null;

Modified: jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/store/H2PersistenceManager.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/store/H2PersistenceManager.java?rev=1209574&r1=1209573&r2=1209574&view=diff
==============================================================================
--- jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/store/H2PersistenceManager.java
(original)
+++ jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/store/H2PersistenceManager.java
Fri Dec  2 16:44:20 2011
@@ -16,7 +16,9 @@
  */
 package org.apache.jackrabbit.mk.store;
 
+import org.apache.jackrabbit.mk.blobs.BlobStore;
 import org.apache.jackrabbit.mk.blobs.DbBlobStore;
+import org.apache.jackrabbit.mk.blobs.FileBlobStore;
 import org.apache.jackrabbit.mk.model.Commit;
 import org.apache.jackrabbit.mk.model.Node;
 import org.apache.jackrabbit.mk.model.StoredCommit;
@@ -41,7 +43,7 @@ public class H2PersistenceManager extend
     private static final boolean FAST = Boolean.getBoolean("mk.fastDb");
 
     private JdbcConnectionPool cp;
-    private DbBlobStore blobStore;
+    private BlobStore blobStore;
 
     @Override
     protected void doInitialize(File homeDir) throws Exception {
@@ -63,8 +65,12 @@ public class H2PersistenceManager extend
             stmt.execute("create table if not exists REVS (ID binary primary key, DATA binary)");
             stmt.execute("create table if not exists head(id varchar) as select ''");
             stmt.execute("create sequence if not exists datastore_id");
-            blobStore = new DbBlobStore();
-            blobStore.setConnectionPool(cp);
+/*
+            DbBlobStore store = new DbBlobStore();
+            store.setConnectionPool(cp);
+            blobStore = store;
+*/
+            blobStore = new FileBlobStore(new File(homeDir, "blobs").getCanonicalPath());
         } finally {
             con.close();
         }



Mime
View raw message