org.imemex.componentmappings.content.fsreplica
Class AbstractContentComponentReplica

java.lang.Object
  extended by org.imemex.componentmappings.content.fsreplica.AbstractContentComponentReplica
All Implemented Interfaces:
ContentComponentReplica, ComponentMapping<Content>, ComponentReplica<Content>
Direct Known Subclasses:
FilesystemContentComponentReplica, HashFilesystemContentComponentReplica

public abstract class AbstractContentComponentReplica
extends java.lang.Object
implements ContentComponentReplica

Provides a generic implementation of some of the ComponentReplica interface methods. These implementations use the other methods in the interface itself.

Author:
marcos

Constructor Summary
AbstractContentComponentReplica()
           
 
Method Summary
 void clear()
          Clears all entries from this replica.
 int getBufferSize()
          Get the number of elements which are buffered before being stored persistently by the index
 boolean insertAll(PullOperator<Mapping<Content>> entries)
          Inserts all entries of the given PullOperator into this ComponentMap.
 boolean isEmpty()
          Returns true if this instance does not contain any entries.
 void removeAll(PullOperator<java.lang.Long> internalRVIDs)
          Removes the given entries for resource view internalRVID.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.imemex.componentmappings.impl.ComponentReplica
entries, getEntry
 
Methods inherited from interface org.imemex.componentmappings.impl.ComponentMapping
close, flushMapping, insert, rebuildMapping, remove, size
 

Constructor Detail

AbstractContentComponentReplica

public AbstractContentComponentReplica()
Method Detail

getBufferSize

public int getBufferSize()
Description copied from interface: ComponentMapping
Get the number of elements which are buffered before being stored persistently by the index

Specified by:
getBufferSize in interface ComponentMapping<Content>
Returns:
the number of elements which are buffered before being stored persistently by the index

insertAll

public boolean insertAll(PullOperator<Mapping<Content>> entries)
Description copied from interface: ComponentMapping
Inserts all entries of the given PullOperator into this ComponentMap. Every entry that already exists will be updated. Note, that all implementations of this method are responsible themselves to copy the newEntry instances. This is very important for ComponentReplicas.

Specified by:
insertAll in interface ComponentMapping<Content>
Parameters:
entries - - is a PullOperator with Map.Entry instances.
Returns:
true if all RV components were added to the index, false otherwise (i.e., at least one of the entries already existed in the index which was then updated)
See Also:
Map.Entry

isEmpty

public boolean isEmpty()
Description copied from interface: ComponentMapping
Returns true if this instance does not contain any entries.

Specified by:
isEmpty in interface ComponentMapping<Content>
Returns:

removeAll

public void removeAll(PullOperator<java.lang.Long> internalRVIDs)
Description copied from interface: ComponentMapping
Removes the given entries for resource view internalRVID.

Specified by:
removeAll in interface ComponentMapping<Content>
Parameters:
internalRVIDs - - a PullOperator of Long instances representing internalRVIDs

clear

public void clear()
Clears all entries from this replica. For doing so, an iterator is opened and entries are removed one by one with . Note that we must be able to at the same time scan and remove for the implementation of this method to work properly.

Specified by:
clear in interface ComponentMapping<Content>
See Also:
ComponentMapping.clear()