org.apache.jackrabbit.spi.commons.batch
Class ConsolidatingChangeLog

java.lang.Object
  extended by org.apache.jackrabbit.spi.commons.batch.AbstractChangeLog<ConsolidatingChangeLog.CancelableOperation>
      extended by org.apache.jackrabbit.spi.commons.batch.ConsolidatingChangeLog
All Implemented Interfaces:
Batch, ChangeLog

public class ConsolidatingChangeLog
extends AbstractChangeLog<ConsolidatingChangeLog.CancelableOperation>

A ChangeLog implementation which does basic consolidation on its Operations. That is, cancelling operations are removed if possible. In general this is not possible across move operations. The individual CancelableOperation implementations document their behavior concerning cancellation.


Nested Class Summary
protected static interface ConsolidatingChangeLog.CancelableOperation
          This class represent an Operation which can be cancelled by another operation or which cancels another operation.
protected static class ConsolidatingChangeLog.CancelableOperations
          Factory for creating CancelableOperations.
 
Field Summary
 
Fields inherited from class org.apache.jackrabbit.spi.commons.batch.AbstractChangeLog
operations
 
Constructor Summary
ConsolidatingChangeLog()
          Create a new instance of a consolidating change log.
 
Method Summary
 void addNode(NodeId parentId, Name nodeName, Name nodetypeName, String uuid)
           
 void addOperation(ConsolidatingChangeLog.CancelableOperation op)
          Determines the cancellation behavior from the list of operations and the current operation op: When the current operation is cancelled by the last operation, the list of operations is not modified. When the current operation and the last operation cancel each other, the last operation is removed from the list of operations. When the last operation is cancelled by this operation, the last operation is removed from the list of operations and determination of cancellation starts from scratch. Otherwise add the current operation to the list of operations.
 void addProperty(NodeId parentId, Name propertyName, QValue value)
           
 void addProperty(NodeId parentId, Name propertyName, QValue[] values)
           
protected static Path getPath(ItemId itemId)
          Determine the Path from an ItemId.
protected static Path getPath(NodeId parentId, Name name)
          Create a Path from the NodeId of a parent and the Name of a child.
 void move(NodeId srcNodeId, NodeId destParentNodeId, Name destName)
           
 void remove(ItemId itemId)
           
 void reorderNodes(NodeId parentId, NodeId srcNodeId, NodeId beforeNodeId)
           
 void setMixins(NodeId nodeId, Name[] mixinNodeTypeNames)
           
 void setPrimaryType(NodeId nodeId, Name primaryNodeTypeName)
           
 void setValue(PropertyId propertyId, QValue value)
           
 void setValue(PropertyId propertyId, QValue[] values)
           
 
Methods inherited from class org.apache.jackrabbit.spi.commons.batch.AbstractChangeLog
apply, equals, equals, hashCode, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ConsolidatingChangeLog

public ConsolidatingChangeLog()
Create a new instance of a consolidating change log.

Method Detail

getPath

protected static Path getPath(NodeId parentId,
                              Name name)
                       throws RepositoryException
Create a Path from the NodeId of a parent and the Name of a child.

Parameters:
parentId - node id of the parent
name - name of the child
Returns:
the path of the item name
Throws:
RepositoryException

getPath

protected static Path getPath(ItemId itemId)
Determine the Path from an ItemId.

Parameters:
itemId -
Returns:
path of the item itemId

addNode

public void addNode(NodeId parentId,
                    Name nodeName,
                    Name nodetypeName,
                    String uuid)
             throws RepositoryException
Throws:
RepositoryException

addProperty

public void addProperty(NodeId parentId,
                        Name propertyName,
                        QValue value)
                 throws RepositoryException
Throws:
RepositoryException

addProperty

public void addProperty(NodeId parentId,
                        Name propertyName,
                        QValue[] values)
                 throws RepositoryException
Throws:
RepositoryException

move

public void move(NodeId srcNodeId,
                 NodeId destParentNodeId,
                 Name destName)
          throws RepositoryException
Throws:
RepositoryException

remove

public void remove(ItemId itemId)
            throws RepositoryException
Throws:
RepositoryException

reorderNodes

public void reorderNodes(NodeId parentId,
                         NodeId srcNodeId,
                         NodeId beforeNodeId)
                  throws RepositoryException
Throws:
RepositoryException

setMixins

public void setMixins(NodeId nodeId,
                      Name[] mixinNodeTypeNames)
               throws RepositoryException
Throws:
RepositoryException

setPrimaryType

public void setPrimaryType(NodeId nodeId,
                           Name primaryNodeTypeName)
                    throws RepositoryException
Throws:
RepositoryException

setValue

public void setValue(PropertyId propertyId,
                     QValue value)
              throws RepositoryException
Throws:
RepositoryException

setValue

public void setValue(PropertyId propertyId,
                     QValue[] values)
              throws RepositoryException
Throws:
RepositoryException

addOperation

public void addOperation(ConsolidatingChangeLog.CancelableOperation op)
                  throws RepositoryException
Determines the cancellation behavior from the list of operations and the current operation op:

Overrides:
addOperation in class AbstractChangeLog<ConsolidatingChangeLog.CancelableOperation>
Parameters:
op - Operation to add
Throws:
RepositoryException


Copyright © 2004-2009 The Apache Software Foundation. All Rights Reserved.