messif.operations.data
Class DeleteByLocatorOperation

java.lang.Object
  extended by messif.operations.AbstractOperation
      extended by messif.operations.data.DeleteByLocatorOperation
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, Clearable

public class DeleteByLocatorOperation
extends AbstractOperation

Operation for deleting an object. The operation contains a set of locator URIs. All the objects that have any of these locators set are deleted from an index structure.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class messif.operations.AbstractOperation
AbstractOperation.DataEqualOperation, AbstractOperation.OperationConstructor, AbstractOperation.OperationName
 
Field Summary
 
Fields inherited from class messif.operations.AbstractOperation
errValue, operID, suppData
 
Constructor Summary
  DeleteByLocatorOperation(java.util.Collection<java.lang.String> locators)
          Creates a new instance of DeleteByLocatorOperation.
  DeleteByLocatorOperation(java.util.Collection<java.lang.String> locators, int deleteLimit)
          Creates a new instance of DeleteByLocatorOperation.
protected DeleteByLocatorOperation(java.util.Set<java.lang.String> locators, int deleteLimit)
          Creates a new instance of DeleteByLocatorOperation.
  DeleteByLocatorOperation(java.lang.String[] locators)
          Creates a new instance of DeleteByLocatorOperation.
  DeleteByLocatorOperation(java.lang.String[] locators, int deleteLimit)
          Creates a new instance of DeleteByLocatorOperation.
 
Method Summary
 void addDeletedObject(LocalAbstractObject deletedObject)
          Mark the specified object as deleted by this operation.
 void clearSurplusData()
          Clear non-messif data stored in operation.
protected  boolean dataEqualsImpl(AbstractOperation obj)
          Indicates whether some other operation has the same data as this one.
 int dataHashCode()
          Returns a hash code value for the data of this operation.
 void endOperation()
          End operation successfully.
 java.lang.Object getArgument(int index)
          Returns argument that was passed while constructing instance.
 int getArgumentCount()
          Returns number of arguments that were passed while constructing this instance.
 int getDeleteLimit()
          Returns the maximal number of deleted objects.
 java.util.Set<java.lang.String> getLocators()
          Returns the locators of objects to delete.
 java.util.List<LocalAbstractObject> getObjects()
          Returns the list of all actually deleted objects.
 boolean isLimitReached()
          Returns whether the number of deleted objects has reached the deleteLimit.
 void updateFrom(AbstractOperation operation)
          Update the operation result.
 boolean wasSuccessful()
          Returns true if this operation was successfuly completed.
 
Methods inherited from class messif.operations.AbstractOperation
appendArguments, appendErrorCode, clone, createOperation, dataEquals, endOperation, equals, getAnnotatedConstructor, getAnnotatedConstructor, getConstructorArgumentDescriptions, getConstructorArgumentDescriptions, getConstructorArguments, getConstructorArguments, getConstructorDescription, getErrorCode, getName, getName, getOperationID, hashCode, isFinished, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DeleteByLocatorOperation

protected DeleteByLocatorOperation(java.util.Set<java.lang.String> locators,
                                   int deleteLimit)
Creates a new instance of DeleteByLocatorOperation. The given set is directly used.

Parameters:
locators - collection of locators of objects to delete
deleteLimit - the maximal number of deleted objects (zero means unlimited)

DeleteByLocatorOperation

public DeleteByLocatorOperation(java.util.Collection<java.lang.String> locators,
                                int deleteLimit)
Creates a new instance of DeleteByLocatorOperation.

Parameters:
locators - collection of locators of objects to delete
deleteLimit - the maximal number of deleted objects (zero means unlimited)

DeleteByLocatorOperation

public DeleteByLocatorOperation(java.util.Collection<java.lang.String> locators)
Creates a new instance of DeleteByLocatorOperation. Number of objects to delete is unlimited

Parameters:
locators - collection of locators of objects to delete

DeleteByLocatorOperation

public DeleteByLocatorOperation(java.lang.String[] locators,
                                int deleteLimit)
Creates a new instance of DeleteByLocatorOperation.

Parameters:
locators - collection of locators of objects to delete
deleteLimit - the maximal number of deleted objects (zero means unlimited)

DeleteByLocatorOperation

public DeleteByLocatorOperation(java.lang.String[] locators)
Creates a new instance of DeleteByLocatorOperation. Number of objects to delete is unlimited

Parameters:
locators - collection of locators of objects to delete
Method Detail

getLocators

public java.util.Set<java.lang.String> getLocators()
Returns the locators of objects to delete.

Returns:
the locators of objects to delete

getDeleteLimit

public int getDeleteLimit()
Returns the maximal number of deleted objects. Zero means unlimited.

Returns:
the maximal number of deleted objects.

isLimitReached

public boolean isLimitReached()
Returns whether the number of deleted objects has reached the deleteLimit.

Returns:
true if the limit on the number of deleted objects was reached

getObjects

public java.util.List<LocalAbstractObject> getObjects()
Returns the list of all actually deleted objects.

Returns:
the list of all actually deleted objects

getArgument

public java.lang.Object getArgument(int index)
                             throws java.lang.IndexOutOfBoundsException
Returns argument that was passed while constructing instance. If the argument is not stored within operation, null is returned.

Overrides:
getArgument in class AbstractOperation
Parameters:
index - index of an argument passed to constructor
Returns:
argument that was passed while constructing instance
Throws:
java.lang.IndexOutOfBoundsException - if index parameter is out of range

getArgumentCount

public int getArgumentCount()
Returns number of arguments that were passed while constructing this instance.

Overrides:
getArgumentCount in class AbstractOperation
Returns:
number of arguments that were passed while constructing this instance

wasSuccessful

public boolean wasSuccessful()
Returns true if this operation was successfuly completed.

Specified by:
wasSuccessful in class AbstractOperation
Returns:
true if this operation was successfuly completed

endOperation

public void endOperation()
End operation successfully.

Specified by:
endOperation in class AbstractOperation

addDeletedObject

public void addDeletedObject(LocalAbstractObject deletedObject)
Mark the specified object as deleted by this operation.

Parameters:
deletedObject - the object that was deleted

updateFrom

public void updateFrom(AbstractOperation operation)
Update the operation result.

Overrides:
updateFrom in class AbstractOperation
Parameters:
operation - foreign operation from which to update this one

clearSurplusData

public void clearSurplusData()
Clear non-messif data stored in operation. This method is intended to be called whenever the operation is sent back to client in order to minimize problems with unknown classes after deserialization.

Specified by:
clearSurplusData in interface Clearable
Overrides:
clearSurplusData in class AbstractOperation

dataEqualsImpl

protected boolean dataEqualsImpl(AbstractOperation obj)
Indicates whether some other operation has the same data as this one.

Specified by:
dataEqualsImpl in class AbstractOperation
Parameters:
obj - the reference object with which to compare.
Returns:
true if this object has the same data as the obj argument; false otherwise.

dataHashCode

public int dataHashCode()
Returns a hash code value for the data of this operation.

Specified by:
dataHashCode in class AbstractOperation
Returns:
a hash code value for the data of this operation