Interface NotifyingRepository

    • Method Detail

      • addRepositoryListener

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

        void removeRepositoryListener​(RepositoryListener listener)
        Removes a registered RepositoryListener from this repository.
      • addRepositoryConnectionListener

        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.
      • removeRepositoryConnectionListener

        void removeRepositoryConnectionListener​(RepositoryConnectionListener listener)
        Removes a registered RepositoryConnectionListener from this repository.
      • getConnection

        NotifyingRepositoryConnection getConnection()
                                             throws RepositoryException
        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();
         }
         

        Note that RepositoryConnection is not guaranteed to be thread-safe! The recommended pattern for repository access in a multithreaded application is to share the Repository object between threads, but have each thread create and use its own RepositoryConnections.

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