org.trippi.impl.base
Class MemUpdateBuffer

java.lang.Object
  extended by org.trippi.impl.base.MemUpdateBuffer
All Implemented Interfaces:
UpdateBuffer

public class MemUpdateBuffer
extends java.lang.Object
implements UpdateBuffer

A memory buffer for triplestore updates.

Author:
cwilper@cs.cornell.edu

Field Summary
 
Fields inherited from interface org.trippi.impl.base.UpdateBuffer
ADD_UPDATE_TYPE, DELETE_UPDATE_TYPE, EITHER_UPDATE_TYPE
 
Constructor Summary
MemUpdateBuffer(int safeCapacity, int flushBatchSize)
           
 
Method Summary
 void add(java.util.List triples)
          Buffer the addition of the given triples.
 void add(org.jrdf.graph.Triple triple)
          Buffer the addition of the given triple.
 void close()
          Close the buffer, releasing any associated system resources.
 void delete(java.util.List triples)
          Buffer the deletion of the given triples.
 void delete(org.jrdf.graph.Triple triple)
          Buffer the deletion of the given triple.
 java.util.List findBufferedUpdates(org.jrdf.graph.SubjectNode subject, org.jrdf.graph.PredicateNode predicate, org.jrdf.graph.ObjectNode object, int updateType)
          Returns an unmodifiable List of the TripleUpdates currently in queue.
 void flush(TriplestoreSession session)
          Flush the contents of the buffer to the triplestore.
 int safeCapacity()
          Get the number of triples that the buffer can safely contain.
 void setFlushErrorHandler(FlushErrorHandler h)
          Set the (optional) handler that will recieve failed flush notification.
 int size()
          Get the number of triples currently in the buffer.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MemUpdateBuffer

public MemUpdateBuffer(int safeCapacity,
                       int flushBatchSize)
Method Detail

add

public void add(java.util.List triples)
Description copied from interface: UpdateBuffer
Buffer the addition of the given triples.

Specified by:
add in interface UpdateBuffer

add

public void add(org.jrdf.graph.Triple triple)
Description copied from interface: UpdateBuffer
Buffer the addition of the given triple.

Specified by:
add in interface UpdateBuffer

delete

public void delete(java.util.List triples)
Description copied from interface: UpdateBuffer
Buffer the deletion of the given triples.

Specified by:
delete in interface UpdateBuffer

delete

public void delete(org.jrdf.graph.Triple triple)
Description copied from interface: UpdateBuffer
Buffer the deletion of the given triple.

Specified by:
delete in interface UpdateBuffer

size

public int size()
Description copied from interface: UpdateBuffer
Get the number of triples currently in the buffer.

Specified by:
size in interface UpdateBuffer

safeCapacity

public int safeCapacity()
Description copied from interface: UpdateBuffer
Get the number of triples that the buffer can safely contain. This is not an absolute maximum size.

Specified by:
safeCapacity in interface UpdateBuffer

flush

public void flush(TriplestoreSession session)
           throws TrippiException
Flush the contents of the buffer to the triplestore.

Specified by:
flush in interface UpdateBuffer
Throws:
TrippiException

setFlushErrorHandler

public void setFlushErrorHandler(FlushErrorHandler h)
Description copied from interface: UpdateBuffer
Set the (optional) handler that will recieve failed flush notification. Applications can use this to ensure that the contents of the buffer are not lost when a flushing error occurs.

Specified by:
setFlushErrorHandler in interface UpdateBuffer

close

public void close()
Close the buffer, releasing any associated system resources.

Specified by:
close in interface UpdateBuffer

findBufferedUpdates

public java.util.List findBufferedUpdates(org.jrdf.graph.SubjectNode subject,
                                          org.jrdf.graph.PredicateNode predicate,
                                          org.jrdf.graph.ObjectNode object,
                                          int updateType)
Description copied from interface: UpdateBuffer
Returns an unmodifiable List of the TripleUpdates currently in queue.

Specified by:
findBufferedUpdates in interface UpdateBuffer
Returns:
List of TripleUpdates