org.openrdf.repository.event.base
Class NotifyingRepositoryWrapper

java.lang.Object
  extended by org.openrdf.repository.base.RepositoryWrapper
      extended by org.openrdf.repository.event.base.NotifyingRepositoryWrapper
All Implemented Interfaces:
DelegatingRepository, NotifyingRepository, Repository
Direct Known Subclasses:
SystemRepository

public class NotifyingRepositoryWrapper
extends RepositoryWrapper
implements NotifyingRepository

This notifying decorator allows listeners to register with the repository or connection and be notified when events occur.

Author:
James Leigh, Herko ter Horst, Arjohn Kampman
See Also:
NotifyingRepositoryConnectionWrapper

Constructor Summary
NotifyingRepositoryWrapper()
           
NotifyingRepositoryWrapper(Repository delegate)
           
NotifyingRepositoryWrapper(Repository delegate, boolean defaultReportDeltas)
           
 
Method Summary
 void addRepositoryConnectionListener(RepositoryConnectionListener listener)
          Registers a RepositoryConnectionListener that will receive notifications of operations that are performed on any< connections that are created by this repository.
 void addRepositoryListener(RepositoryListener listener)
          Registers a RepositoryListener that will receive notifications of operations that are performed on this repository.
 NotifyingRepositoryConnection getConnection()
          Opens a connection to this repository that can be used for querying and updating the contents of the repository.
 boolean getDefaultReportDeltas()
           
 void initialize()
          Initializes this repository.
 void removeRepositoryConnectionListener(RepositoryConnectionListener listener)
          Removes a registered RepositoryConnectionListener from this repository.
 void removeRepositoryListener(RepositoryListener listener)
          Removes a registered RepositoryListener from this repository.
 void setDataDir(File dataDir)
          Set the directory where data and logging for this repository is stored.
 void setDefaultReportDeltas(boolean defaultReportDeltas)
           
 void shutDown()
          Shuts the repository down, releasing any resources that it keeps hold of.
 
Methods inherited from class org.openrdf.repository.base.RepositoryWrapper
getDataDir, getDelegate, getValueFactory, isWritable, setDelegate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.openrdf.repository.Repository
getDataDir, getValueFactory, isWritable
 

Constructor Detail

NotifyingRepositoryWrapper

public NotifyingRepositoryWrapper()

NotifyingRepositoryWrapper

public NotifyingRepositoryWrapper(Repository delegate)

NotifyingRepositoryWrapper

public NotifyingRepositoryWrapper(Repository delegate,
                                  boolean defaultReportDeltas)
Method Detail

getDefaultReportDeltas

public boolean getDefaultReportDeltas()

setDefaultReportDeltas

public void setDefaultReportDeltas(boolean defaultReportDeltas)

addRepositoryListener

public void addRepositoryListener(RepositoryListener listener)
Registers a RepositoryListener that will receive notifications of operations that are performed on this repository.

Specified by:
addRepositoryListener in interface NotifyingRepository

removeRepositoryListener

public void removeRepositoryListener(RepositoryListener listener)
Removes a registered RepositoryListener from this repository.

Specified by:
removeRepositoryListener in interface NotifyingRepository

addRepositoryConnectionListener

public void addRepositoryConnectionListener(RepositoryConnectionListener listener)
Registers a RepositoryConnectionListener that will receive notifications of operations that are performed on any< connections that are created by this repository.

Specified by:
addRepositoryConnectionListener in interface NotifyingRepository

removeRepositoryConnectionListener

public void removeRepositoryConnectionListener(RepositoryConnectionListener listener)
Removes a registered RepositoryConnectionListener from this repository.

Specified by:
removeRepositoryConnectionListener in interface NotifyingRepository

getConnection

public NotifyingRepositoryConnection getConnection()
                                            throws RepositoryException
Description copied from interface: Repository
Opens a connection to this repository that can be used for querying and updating the contents of the repository. Created connections need to be closed to make sure that any resources they keep hold of are released. The best way to do this is to use a try-finally-block as follows:
 Connection con = repository.getConnection();
 try {
        // perform operations on the connection
 }
 finally {
        con.close();
 }
 

Specified by:
getConnection in interface Repository
Overrides:
getConnection in class RepositoryWrapper
Returns:
A connection that allows operations on this repository.
Throws:
RepositoryException - If something went wrong during the creation of the Connection.

initialize

public void initialize()
                throws RepositoryException
Description copied from interface: Repository
Initializes this repository. A repository needs to be initialized before it can be used.

Specified by:
initialize in interface Repository
Overrides:
initialize in class RepositoryWrapper
Throws:
RepositoryException - If the initialization failed.

setDataDir

public void setDataDir(File dataDir)
Description copied from interface: Repository
Set the directory where data and logging for this repository is stored.

Specified by:
setDataDir in interface Repository
Overrides:
setDataDir in class RepositoryWrapper
Parameters:
dataDir - the directory where data for this repository is stored

shutDown

public void shutDown()
              throws RepositoryException
Description copied from interface: Repository
Shuts the repository down, releasing any resources that it keeps hold of. Once shut down, the repository can no longer be used until it is re-initialized.

Specified by:
shutDown in interface Repository
Overrides:
shutDown in class RepositoryWrapper
Throws:
RepositoryException


Copyright © 2001-2008 Aduna. All Rights Reserved.