org.gcube.indexmanagement.storagehandling
Class DeltaFileConsumer

java.lang.Object
  extended by org.gcube.indexmanagement.storagehandling.DeltaFileConsumer

public class DeltaFileConsumer
extends java.lang.Object

This class implements a consumer for delta files that make up an index. Each time a new delta file is added to the index, the DeltaFileConsumer fetches it from the Content Management layer and stores it locally.


Nested Class Summary
 class DeltaFileConsumer.AdditionConsumerNotification
          Class that handles the consuming of received addition notifications
 class DeltaFileConsumer.DeletionConsumerNotification
          Class that handles the consuming of received deletion notifications
 class DeltaFileConsumer.ManagerCreationConsumerNotification
          Class that handles the consuming of received manager creation notifications
 class DeltaFileConsumer.RemovalConsumerNotification
          Class that handles the consuming of received deletion notifications
 
Constructor Summary
DeltaFileConsumer()
          Constructs a new, empty (uninitialized) DeltaFileConsumer
DeltaFileConsumer(IndexLookupWSResource resource, IndexReplicator replicator, int startIdx)
          Constructs a new DeltaFileConsumer
 
Method Summary
 void close()
          Closes the DeltaFileConsumer
 void loadState(java.io.ObjectInputStream ois, boolean firstLoad, IndexLookupWSResource resource, IndexReplicator replicator, int startIdx)
          Loads the current state of this DeltaFileConsumer from an object stream.
 void setDoesHandleAdditions(boolean doesHandleAdditions)
          Enables or disables delta file addition notification handling
 void setDoesHandleDeletions(boolean doesHandleDeletions)
          Enables or disables delta file deletion notification handling
 void setEnforceStrictOrder(boolean enforceStrictOrder)
          Enables or disables enforcement of strict ordering
 void storeState(java.io.ObjectOutputStream oos)
          Stores the current state of this DeltaFileConsumer to an object stream.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DeltaFileConsumer

public DeltaFileConsumer()
Constructs a new, empty (uninitialized) DeltaFileConsumer


DeltaFileConsumer

public DeltaFileConsumer(IndexLookupWSResource resource,
                         IndexReplicator replicator,
                         int startIdx)
                  throws java.lang.Exception
Constructs a new DeltaFileConsumer

Parameters:
resource - the index lookup resource that uses this DeltaFileConsumer
replicator - the index replicator to use
startIdx - the index of the first delta file
Throws:
java.lang.Exception - an error occured
Method Detail

storeState

public void storeState(java.io.ObjectOutputStream oos)
Stores the current state of this DeltaFileConsumer to an object stream.

Parameters:
oos - the output stream

loadState

public void loadState(java.io.ObjectInputStream ois,
                      boolean firstLoad,
                      IndexLookupWSResource resource,
                      IndexReplicator replicator,
                      int startIdx)
               throws java.lang.Exception
Loads the current state of this DeltaFileConsumer from an object stream.

Parameters:
ois - the input stream
firstLoad - specifies whether this resource is being loaded for the first time or not
resource - the index lookup resource that uses this DeltaFileConsumer
replicator - the index replicator to use
startIdx - the index of the first delta file
Throws:
java.lang.Exception

setDoesHandleAdditions

public void setDoesHandleAdditions(boolean doesHandleAdditions)
                            throws java.lang.Exception
Enables or disables delta file addition notification handling

Parameters:
doesHandleAdditions - specifies whether delta file addition notifications should be handled or not
Throws:
java.lang.Exception - an error occured

setDoesHandleDeletions

public void setDoesHandleDeletions(boolean doesHandleDeletions)
                            throws java.lang.Exception
Enables or disables delta file deletion notification handling

Parameters:
doesHandleAdditions - specifies whether delta file deletion notifications should be handled or not
Throws:
java.lang.Exception - an error occured

setEnforceStrictOrder

public void setEnforceStrictOrder(boolean enforceStrictOrder)
                           throws java.lang.Exception
Enables or disables enforcement of strict ordering

Parameters:
enforceStrictOrder - specifies whether strict ordering should be enforced or not
Throws:
java.lang.Exception - an error occured

close

public void close()
           throws java.lang.Exception
Closes the DeltaFileConsumer

Throws:
java.lang.Exception - an error occured