messif.operations.data
Class BulkInsertOperation

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

public class BulkInsertOperation
extends AbstractOperation

Operation for inserting several objects at once. The operation keeps a list of abstract objects that are going to be inserted into 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
BulkInsertOperation(AbstractObjectList<? extends LocalAbstractObject> insertedObjects)
          Creates a new instance of BulkInsertOperation.
BulkInsertOperation(AbstractStreamObjectIterator<LocalAbstractObject> stream, int count)
          Creates a new instance of BulkInsertOperation.
BulkInsertOperation(java.util.Collection<? extends LocalAbstractObject> insertedObjects)
          Creates a new instance of BulkInsertOperation.
BulkInsertOperation(java.util.Iterator<? extends LocalAbstractObject> insertedObjects)
          Creates a new instance of BulkInsertOperation.
 
Method Summary
 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.
 AbstractObjectList<? extends LocalAbstractObject> getInsertedObjects()
          Returns the list of objects to insert.
 java.lang.String toString()
          Returns a string representation of this operation.
 void updateFrom(AbstractOperation operation)
          Update the error code of this operation from another operation.
 boolean wasSuccessful()
          Returns true if this operation has finished successfuly.
 
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
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

BulkInsertOperation

public BulkInsertOperation(AbstractObjectList<? extends LocalAbstractObject> insertedObjects)
Creates a new instance of BulkInsertOperation.

Parameters:
insertedObjects - a list of objects to be inserted by this operation

BulkInsertOperation

public BulkInsertOperation(java.util.Collection<? extends LocalAbstractObject> insertedObjects)
Creates a new instance of BulkInsertOperation.

Parameters:
insertedObjects - a list of objects to be inserted by this operation

BulkInsertOperation

public BulkInsertOperation(java.util.Iterator<? extends LocalAbstractObject> insertedObjects)
Creates a new instance of BulkInsertOperation.

Parameters:
insertedObjects - a list of objects to be inserted by this operation

BulkInsertOperation

public BulkInsertOperation(AbstractStreamObjectIterator<LocalAbstractObject> stream,
                           int count)
Creates a new instance of BulkInsertOperation.

Parameters:
stream - a stream from which to read the list of objects to be inserted
count - the number of objects to read from the stream
Method Detail

getInsertedObjects

public AbstractObjectList<? extends LocalAbstractObject> getInsertedObjects()
Returns the list of objects to insert.

Returns:
the list of objects to insert

getArgument

public java.lang.Object getArgument(int index)
                             throws java.lang.IndexOutOfBoundsException
Description copied from class: AbstractOperation
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 - zero-based 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()
Description copied from class: AbstractOperation
Returns number of arguments that were passed while constructing this instance. Negative number is returned if this operation doesn't support construction argument retrieval.

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

wasSuccessful

public boolean wasSuccessful()
Description copied from class: AbstractOperation
Returns true if this operation has finished successfuly. Otherwise, false is returned - the operation was either unsuccessful or is has not finished yet.

Specified by:
wasSuccessful in class AbstractOperation
Returns:
true if this operation has finished successfuly

endOperation

public void endOperation()
Description copied from class: AbstractOperation
End operation successfully.

Specified by:
endOperation in class AbstractOperation

updateFrom

public void updateFrom(AbstractOperation operation)
Update the error code of this operation from another operation. All codes other than OBJECT_INSERTED have priority and should propagete up.

Overrides:
updateFrom in class AbstractOperation
Parameters:
operation - the source operation from which to get the update

toString

public java.lang.String toString()
Description copied from class: AbstractOperation
Returns a string representation of this operation.

Overrides:
toString in class AbstractOperation
Returns:
a string representation of this operation.

clearSurplusData

public void clearSurplusData()
Description copied from class: AbstractOperation
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)
Description copied from class: AbstractOperation
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()
Description copied from class: AbstractOperation
Returns a hash code value for the data of this operation. Override this method if the operation has its own data.

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