Index: jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/BundleDbPersistenceManager.java =================================================================== --- jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/BundleDbPersistenceManager.java (revision 604121) +++ jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/BundleDbPersistenceManager.java (working copy) @@ -580,6 +580,13 @@ } /** + * {@inheritDoc} + */ + protected BundleBinding getBinding() { + return binding; + } + + /** * Creates a suitable blobstore * @return a blobstore * @throws Exception if an unspecified error occurs @@ -1036,8 +1043,6 @@ protected synchronized void destroyBundle(NodePropBundle bundle) throws ItemStateException { try { connectionManager.executeStmt(bundleDeleteSQL, getKey(bundle.getId().getUUID())); - // also delete all - bundle.removeAllProperties(); } catch (Exception e) { if (e instanceof NoSuchItemStateException) { throw (NoSuchItemStateException) e; @@ -1086,13 +1091,13 @@ } /** + * {@inheritDoc} + * * This method uses shared PreparedStatements, which must * be used strictly sequentially. Because this method synchronizes on the * persistence manager instance, there is no need to synchronize on the * shared statement. If the method would not be synchronized, the shared * statement must be synchronized. - * - * @see AbstractPersistenceManager#store(NodeReferences) */ public synchronized void store(NodeReferences refs) throws ItemStateException { if (!initialized) { Index: jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/BundleFsPersistenceManager.java =================================================================== --- jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/BundleFsPersistenceManager.java (revision 604121) +++ jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/BundleFsPersistenceManager.java (working copy) @@ -212,6 +212,13 @@ /** * {@inheritDoc} */ + protected BundleBinding getBinding() { + return binding; + } + + /** + * {@inheritDoc} + */ public synchronized void close() throws Exception { if (!initialized) { throw new IllegalStateException("not initialized"); Index: jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/AbstractBundlePersistenceManager.java =================================================================== --- jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/AbstractBundlePersistenceManager.java (revision 604121) +++ jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/AbstractBundlePersistenceManager.java (working copy) @@ -42,6 +42,7 @@ import org.apache.jackrabbit.core.persistence.bundle.util.BundleCache; import org.apache.jackrabbit.core.persistence.bundle.util.LRUNodeIdCache; import org.apache.jackrabbit.core.persistence.bundle.util.HashMapIndex; +import org.apache.jackrabbit.core.persistence.bundle.util.BundleBinding; import org.apache.jackrabbit.spi.Name; import org.apache.jackrabbit.name.NameConstants; @@ -392,6 +393,12 @@ protected abstract void store(NodeReferences refs) throws ItemStateException; + /** + * Returns the bundle binding that is used for serializing the bundles. + * @return the bundle binding + */ + protected abstract BundleBinding getBinding(); + //-------------------------------------------------< PersistenceManager >--- /** @@ -536,7 +543,7 @@ while (iter.hasNext()) { ItemState state = (ItemState) iter.next(); if (state.isNode()) { - NodePropBundle bundle = new NodePropBundle((NodeState) state); + NodePropBundle bundle = new NodePropBundle(getBinding(), (NodeState) state); modified.put(state.getId(), bundle); } } @@ -682,6 +689,7 @@ */ private void deleteBundle(NodePropBundle bundle) throws ItemStateException { destroyBundle(bundle); + bundle.removeAllProperties(); bundles.remove(bundle.getId()); missing.put(bundle.getId()); } Index: jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/util/BundleBinding.java =================================================================== --- jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/util/BundleBinding.java (revision 604121) +++ jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/util/BundleBinding.java (working copy) @@ -63,6 +63,7 @@ * @param blobStore the blobstore for retrieving blobs * @param nsIndex the namespace index * @param nameIndex the name index + * @param dataStore the data store */ public BundleBinding(ErrorHandling errorHandling, BLOBStore blobStore, StringIndex nsIndex, StringIndex nameIndex, DataStore dataStore) { @@ -80,7 +81,7 @@ public NodePropBundle readBundle(DataInputStream in, NodeId id) throws IOException { - NodePropBundle bundle = new NodePropBundle(id); + NodePropBundle bundle = new NodePropBundle(this, id); // read version and primary type...special handling int index = in.readInt(); Index: jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/util/NodePropBundle.java =================================================================== --- jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/util/NodePropBundle.java (revision 604121) +++ jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/util/NodePropBundle.java (working copy) @@ -28,6 +28,7 @@ import org.apache.jackrabbit.core.NodeId; import org.apache.jackrabbit.core.PropertyId; import org.apache.jackrabbit.core.persistence.PersistenceManager; +import org.apache.jackrabbit.core.persistence.util.BLOBStore; import org.apache.jackrabbit.core.value.InternalValue; import org.apache.jackrabbit.core.state.PropertyState; import org.apache.jackrabbit.core.state.NodeState; @@ -35,6 +36,8 @@ import org.apache.jackrabbit.core.nodetype.PropDefId; import org.apache.jackrabbit.spi.Name; import org.apache.jackrabbit.name.NameConstants; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * This Class provides a simple structure to hold the nodestate and related @@ -46,6 +49,16 @@ static final String CVS_ID = "$URL$ $Rev$ $Date$"; /** + * default logger + */ + private static Logger log = LoggerFactory.getLogger(NodePropBundle.class); + + /** + * the bundle binding that handles this bundle + */ + private final BundleBinding binding; + + /** * the node id */ private final NodeId id; @@ -102,18 +115,21 @@ /** * Creates a "new" bundle with the given id + * @param binding the bundle binding * @param id the node id */ - public NodePropBundle(NodeId id) { + public NodePropBundle(BundleBinding binding, NodeId id) { + this.binding = binding; this.id = id; } /** * Creates a bundle from the given state + * @param binding the bundle binding * @param state the node state */ - public NodePropBundle(NodeState state) { - this((NodeId) state.getId()); + public NodePropBundle(BundleBinding binding, NodeState state) { + this(binding, (NodeId) state.getId()); update(state); } @@ -346,7 +362,7 @@ public void addProperty(PropertyState state) { PropertyEntry old = (PropertyEntry) properties.put(state.getName(), new PropertyEntry(state)); if (old != null) { - old.destroy(); + old.destroy(binding.getBlobStore()); } } @@ -407,7 +423,7 @@ public void removeProperty(Name name) { PropertyEntry pe = (PropertyEntry) properties.remove(name); if (pe != null) { - pe.destroy(); + pe.destroy(binding.getBlobStore()); } } @@ -678,18 +694,22 @@ /** * Destroys this property state and deletes temporary blob file values. + * @param blobStore the blobstore that will destroy the blobs */ - private void destroy() { - if (type == PropertyType.BINARY) { - // destroy binary property values - for (int i=0; iNodeReferences from the data input stream. * * @param in the input stream