NIHVIVO-3641 listener interface and methods for registering it for RDFService

This commit is contained in:
stellamit 2012-05-03 20:09:39 +00:00
parent a60c3a2bc1
commit f3a5814bdc
2 changed files with 54 additions and 0 deletions

View file

@ -0,0 +1,39 @@
/* $This file is distributed under the terms of the license in /doc/license.txt$ */
package edu.cornell.mannlib.vitro.webapp.rdfservice;
/*
*
* A listener that filters all its listening down to the single-statement level. Users of
* this class override addedStatement(statement) and removedStatement(statement).
*
*/
public interface ChangeListener {
/**
* Override this to listen to all statements added to the RDF store.
*
* @param String serializedTriple - the added statement
* @param RDFService.ModelSerializationFormat format - RDF format of serializedTriple
* @param String graphURI - the graph to which the statement was added
*/
public void addedStatement(String serializedTriple, RDFService.ModelSerializationFormat format, String graphURI);
/**
* Override this to listen to all statements removed from the RDF store.
*
* @param String serializedTriple - the removed statement
* @param RDFService.ModelSerializationFormat format - RDF format of serializedTriple
* @param String graphURI - the graph from which the statement was removed
*/
public void removedStatement(String serializedTriple, RDFService.ModelSerializationFormat format, String graphURI);
/**
* Override this to listen to events pertaining to the given graphURI.
*
* @param String graphURI - the graph to which the event pertains
* @param Object event - the event which occurred.
*/
public void notifyEvent(String graphURI, Object event);
}

View file

@ -90,6 +90,21 @@ public interface RDFService {
*/
public String getDefaultReadGraphURI() throws RDFServiceException;
/**
* Register a listener to listen to changes in any graph in
* the RDF store.
*
* @return String URI of default read graph
*/
public void registerListener(ChangeListener changeListener) throws RDFServiceException;
/**
* Unregister a listener to listen to changes in any graph in
* the RDF store.
*
* @return String URI of default read graph
*/
public void unregisterListener(ChangeListener changeListener) throws RDFServiceException;
/**
* Create a ChangeSet object