org.trippi.impl.base
Interface UpdateBuffer

All Known Implementing Classes:
MemUpdateBuffer

public interface UpdateBuffer

A buffer for triplestore updates.

Author:
cwilper@cs.cornell.edu

Field Summary
static int ADD_UPDATE_TYPE
           
static int DELETE_UPDATE_TYPE
           
static int EITHER_UPDATE_TYPE
           
 
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.
 

Field Detail

ADD_UPDATE_TYPE

static final int ADD_UPDATE_TYPE
See Also:
Constant Field Values

DELETE_UPDATE_TYPE

static final int DELETE_UPDATE_TYPE
See Also:
Constant Field Values

EITHER_UPDATE_TYPE

static final int EITHER_UPDATE_TYPE
See Also:
Constant Field Values
Method Detail

add

void add(java.util.List triples)
         throws java.io.IOException
Buffer the addition of the given triples.

Throws:
java.io.IOException

add

void add(org.jrdf.graph.Triple triple)
         throws java.io.IOException
Buffer the addition of the given triple.

Throws:
java.io.IOException

delete

void delete(java.util.List triples)
            throws java.io.IOException
Buffer the deletion of the given triples.

Throws:
java.io.IOException

delete

void delete(org.jrdf.graph.Triple triple)
            throws java.io.IOException
Buffer the deletion of the given triple.

Throws:
java.io.IOException

size

int size()
Get the number of triples currently in the buffer.


safeCapacity

int safeCapacity()
Get the number of triples that the buffer can safely contain. This is not an absolute maximum size.


flush

void flush(TriplestoreSession session)
           throws java.io.IOException,
                  TrippiException
Flush the contents of the buffer to the triplestore. Implementations should ensure that adds and deletes to the buffer can still happen during flushes.

Throws:
java.io.IOException
TrippiException

setFlushErrorHandler

void setFlushErrorHandler(FlushErrorHandler h)
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.


close

void close()
           throws java.io.IOException
Close the buffer, releasing any associated system resources.

Throws:
java.io.IOException

findBufferedUpdates

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.

Returns:
List of TripleUpdates