jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r1004230 - /jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/util/
Date Mon, 04 Oct 2010 13:26:07 GMT
Author: jukka
Date: Mon Oct  4 13:26:07 2010
New Revision: 1004230

URL: http://svn.apache.org/viewvc?rev=1004230&view=rev
Log:
JCR-2762: Optimize bundle serialization

Remove unused code from BundleReader and BundleWriter.

Un-deprecate the BLOBStore class to avoid deprecation warnings from all over the place where
we still need id for backwards compatibility.

Modified:
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/util/BLOBStore.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/util/BundleBinding.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/util/BundleReader.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/util/BundleWriter.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/util/FileSystemBLOBStore.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/util/NodePropBundle.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/util/ResourceBasedBLOBStore.java

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/util/BLOBStore.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/util/BLOBStore.java?rev=1004230&r1=1004229&r2=1004230&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/util/BLOBStore.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/util/BLOBStore.java
Mon Oct  4 13:26:07 2010
@@ -23,8 +23,10 @@ import java.io.InputStream;
 /**
  * <code>BLOBStore</code> represents an abstract store for binary property
  * values (BLOBs).
- *
- * @deprecated the DataStore should be used instead
+ * <p>
+ * Note that The DataStore should nowadays be used instead of the BLOBStore.
+ * This interface and the implementing classes are kept mostly for backwards
+ * compatibility.
  *
  * @see ResourceBasedBLOBStore
  */

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/util/BundleBinding.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/util/BundleBinding.java?rev=1004230&r1=1004229&r2=1004230&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/util/BundleBinding.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/util/BundleBinding.java
Mon Oct  4 13:26:07 2010
@@ -61,7 +61,6 @@ public class BundleBinding {
     /**
      * the blob store
      */
-    @SuppressWarnings("deprecation")
     protected final BLOBStore blobStore;
 
     /**
@@ -88,7 +87,6 @@ public class BundleBinding {
      * @param nameIndex the name index
      * @param dataStore the data store
      */
-    @SuppressWarnings("deprecation")
     public BundleBinding(
             ErrorHandling errorHandling, BLOBStore blobStore,
             StringIndex nsIndex, StringIndex nameIndex, DataStore dataStore) {
@@ -123,7 +121,6 @@ public class BundleBinding {
      * Returns the blob store that is assosiated with this binding.
      * @return the blob store
      */
-    @SuppressWarnings("deprecation")
     public BLOBStore getBlobStore() {
         return blobStore;
     }

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/util/BundleReader.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/util/BundleReader.java?rev=1004230&r1=1004229&r2=1004230&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/util/BundleReader.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/util/BundleReader.java
Mon Oct  4 13:26:07 2010
@@ -20,8 +20,6 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.apache.jackrabbit.core.id.NodeId;
 import org.apache.jackrabbit.core.id.PropertyId;
-import org.apache.jackrabbit.core.persistence.PersistenceManager;
-import org.apache.jackrabbit.core.state.NodeState;
 import org.apache.jackrabbit.core.value.InternalValue;
 import org.apache.jackrabbit.spi.Name;
 import org.apache.jackrabbit.spi.commons.name.NameFactoryImpl;
@@ -504,64 +502,6 @@ class BundleReader {
     }
 
     /**
-     * Deserializes a <code>NodeState</code> from the data input stream.
-     *
-     * @param id the id of the nodestate to read
-     * @param pMgr the persistence manager
-     * @return the node state
-     * @throws IOException in an I/O error occurs.
-     */
-    private NodeState readState(NodeId id, PersistenceManager pMgr)
-            throws IOException {
-        NodeState state = pMgr.createNew(id);
-        // primaryType & version
-        int index = in.readInt();
-        int version = (index >> 24) & 0x0ff;
-        String uri = binding.nsIndex.indexToString(index & 0x0ffffff);
-        String local = in.readUTF();
-        state.setNodeTypeName(NameFactoryImpl.getInstance().create(uri, local));
-
-        // parentUUID
-        state.setParentId(readNodeId());
-        // definitionId
-        in.readUTF();
-
-        // mixin types
-        int count = in.readInt();   // count
-        Set<Name> set = new HashSet<Name>(count);
-        for (int i = 0; i < count; i++) {
-            set.add(readQName()); // name
-        }
-        if (set.size() > 0) {
-            state.setMixinTypeNames(set);
-        }
-        // properties (names)
-        count = in.readInt();   // count
-        for (int i = 0; i < count; i++) {
-            state.addPropertyName(readIndexedQName()); // name
-        }
-        // child nodes (list of name/uuid pairs)
-        count = in.readInt();   // count
-        for (int i = 0; i < count; i++) {
-            Name name = readQName();
-            NodeId parentId = readNodeId();
-            state.addChildNodeEntry(name, parentId);
-        }
-
-        if (version >= BundleBinding.VERSION_1) {
-            state.setModCount(readModCount());
-        }
-        if (version >= BundleBinding.VERSION_2) {
-            // shared set (list of parent uuids)
-            count = in.readInt();   // count
-            for (int i = 0; i < count; i++) {
-                state.addShare(readNodeId());
-            }
-        }
-        return state;
-    }
-
-    /**
      * Deserializes a node identifier
      *
      * @return the node id

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/util/BundleWriter.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/util/BundleWriter.java?rev=1004230&r1=1004229&r2=1004230&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/util/BundleWriter.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/util/BundleWriter.java
Mon Oct  4 13:26:07 2010
@@ -16,29 +16,25 @@
  */
 package org.apache.jackrabbit.core.persistence.util;
 
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.apache.commons.io.IOUtils;
-import org.apache.jackrabbit.core.id.NodeId;
-import org.apache.jackrabbit.core.state.ChildNodeEntry;
-import org.apache.jackrabbit.core.state.NodeState;
-import org.apache.jackrabbit.core.value.InternalValue;
-import org.apache.jackrabbit.core.data.DataStore;
-import org.apache.jackrabbit.spi.Name;
-import org.apache.jackrabbit.spi.commons.name.NameConstants;
-
 import java.io.DataInputStream;
 import java.io.DataOutputStream;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.OutputStream;
 import java.math.BigDecimal;
-import java.util.Collection;
-import java.util.Iterator;
 
 import javax.jcr.PropertyType;
 import javax.jcr.RepositoryException;
 
+import org.apache.commons.io.IOUtils;
+import org.apache.jackrabbit.core.data.DataStore;
+import org.apache.jackrabbit.core.id.NodeId;
+import org.apache.jackrabbit.core.value.InternalValue;
+import org.apache.jackrabbit.spi.Name;
+import org.apache.jackrabbit.spi.commons.name.NameConstants;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
 /**
  * Bundle serializater.
  *
@@ -316,52 +312,6 @@ class BundleWriter {
     }
 
     /**
-     * Serializes a <code>NodeState</code> to the data output stream
-     *
-     * @param state the state to write
-     * @throws IOException in an I/O error occurs.
-     */
-    private void writeState(NodeState state) throws IOException {
-        // primaryType & version
-        out.writeInt((BundleBinding.VERSION_CURRENT << 24)
-                | binding.nsIndex.stringToIndex(state.getNodeTypeName().getNamespaceURI()));
-        out.writeUTF(state.getNodeTypeName().getLocalName());
-        // parentUUID
-        writeNodeId(state.getParentId());
-        // definitionId
-        out.writeUTF("");
-        // mixin types
-        Collection<Name> c = state.getMixinTypeNames();
-        out.writeInt(c.size()); // count
-        for (Iterator<Name> iter = c.iterator(); iter.hasNext();) {
-            writeQName(iter.next());
-        }
-        // properties (names)
-        c = state.getPropertyNames();
-        out.writeInt(c.size()); // count
-        for (Iterator<Name> iter = c.iterator(); iter.hasNext();) {
-            Name pName = iter.next();
-            writeIndexedQName(pName);
-        }
-        // child nodes (list of name/uuid pairs)
-        Collection<ChildNodeEntry> collChild = state.getChildNodeEntries();
-        out.writeInt(collChild.size()); // count
-        for (Iterator<ChildNodeEntry> iter = collChild.iterator(); iter.hasNext();)
{
-            ChildNodeEntry entry = iter.next();
-            writeQName(entry.getName());   // name
-            writeNodeId(entry.getId());  // uuid
-        }
-        writeModCount(state.getModCount());
-        
-        // shared set (list of parent uuids)
-        Collection<NodeId> collShared = state.getSharedSet();
-        out.writeInt(collShared.size()); // count
-        for (Iterator<NodeId> iter = collShared.iterator(); iter.hasNext();) {
-            writeNodeId(iter.next());
-        }
-    }
-
-    /**
      * Serializes a node identifier
      *
      * @param id the node id

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/util/FileSystemBLOBStore.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/util/FileSystemBLOBStore.java?rev=1004230&r1=1004229&r2=1004230&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/util/FileSystemBLOBStore.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/util/FileSystemBLOBStore.java
Mon Oct  4 13:26:07 2010
@@ -28,8 +28,8 @@ import java.io.OutputStream;
 /**
  * <code>FileSystemBLOBStore</code> is a <code>ResourceBasedBLOBStore</code>
  * implementation that stores BLOB data in a <code>FileSystem</code>.
- *
- * @deprecated the FileDataStore should be used instead
+ * <p>
+ * Note that The DataStore should nowadays be used instead of the BLOBStore.
  */
 public class FileSystemBLOBStore implements ResourceBasedBLOBStore {
 

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/util/NodePropBundle.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/util/NodePropBundle.java?rev=1004230&r1=1004229&r2=1004230&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/util/NodePropBundle.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/util/NodePropBundle.java
Mon Oct  4 13:26:07 2010
@@ -331,7 +331,6 @@ public class NodePropBundle {
      * @param state the property state
      * @param blobStore BLOB store from where to delete previous property value
      */
-    @SuppressWarnings("deprecation")
     public void addProperty(PropertyState state, BLOBStore blobStore) {
         PropertyEntry old =
             properties.put(state.getName(), new PropertyEntry(state));
@@ -383,7 +382,6 @@ public class NodePropBundle {
      *
      * @param blobStore BLOB store from where to delete property values
      */
-    @SuppressWarnings("deprecation")
     public void removeAllProperties(BLOBStore blobStore) {
         for (Name name : new HashSet<Name>(properties.keySet())) {
             removeProperty(name, blobStore);
@@ -396,7 +394,6 @@ public class NodePropBundle {
      * @param name the name of the property
      * @param blobStore BLOB store from where to delete the property value
      */
-    @SuppressWarnings("deprecation")
     public void removeProperty(Name name, BLOBStore blobStore) {
         PropertyEntry pe = properties.remove(name);
         if (pe != null) {
@@ -726,7 +723,6 @@ public class NodePropBundle {
          * Destroys this property state and deletes temporary blob file values.
          * @param blobStore the blobstore that will destroy the blobs
          */
-        @SuppressWarnings("deprecation")
         private void destroy(BLOBStore blobStore) {
             // delete blobs if needed
             for (int i = 0; blobIds != null && i < blobIds.length; i++) {

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/util/ResourceBasedBLOBStore.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/util/ResourceBasedBLOBStore.java?rev=1004230&r1=1004229&r2=1004230&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/util/ResourceBasedBLOBStore.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/util/ResourceBasedBLOBStore.java
Mon Oct  4 13:26:07 2010
@@ -21,8 +21,8 @@ import org.apache.jackrabbit.core.fs.Fil
 /**
  * <code>ResourceBasedBLOBStore</code> extends the <code>BLOBStore</code>
  * interface with the method {@link #getResource(String)}
- *
- * @deprecated the DataStore should be used instead
+ * <p>
+ * Note that The DataStore should nowadays be used instead of the BLOBStore.
  */
 public interface ResourceBasedBLOBStore extends BLOBStore {
     /**



Mime
View raw message