Interface IRepositoryService


public interface IRepositoryService
Stores arbitrary files in a hierarchical (folders-files) structure.

Transactional support is mandatory. However implementations that can't support it may choose to implement the lowest isolation level where concurrent transactions influence each other.

File change reporting through IFileChangesListener is mandatory. Events must be fired on a transaction commit.

Author:
Stepan Roh, Polarion Software, Stanislav Spiridonov
  • Field Details

  • Method Details

    • getRepository

      IRepositoryInfo getRepository(String repositoryName) throws RepositoryException
      Returns the repository by repository name. (The name of repository must be unique.)

      The name can't be null.

      Parameters:
      repositoryName -
      Returns:
      The repository information or null.
      Throws:
      RepositoryException
    • getRepository

      IRepositoryInfo getRepository(ILocation loc) throws RepositoryException
      A convenient method, that determines the repository name from the given location. If the location contains no repository name or if the location is null, then the DEFAULT is used as the repository name.

      Otherwise this method behaves the same as getRepository(String).

      Parameters:
      loc -
      Returns:
      The repository information or null.
      Throws:
      RepositoryException
    • getRepositories

      Returns the registered repositories.
      Returns:
      Collection of IRepositoryInfo
      Throws:
      RepositoryException
    • getConnection

      IRepositoryConnection getConnection(String repositoryName) throws RepositoryException
      Return the connection to a specific repository.

      The name can't be null.

      Can only be used inside a transaction. The returned connection object is not valid after the end of the current transaction.

      Parameters:
      repositoryName - the name of the registered repository.
      Returns:
      A connection to the requested repository.
      Throws:
      RepositoryException
    • getConnection

      IRepositoryConnection getConnection(ILocation location) throws RepositoryException
      The convenient method that determines the repository name from the given location. If the location contains no repository name or if the location is null, then the DEFAULT is used as the repository name.

      Otherwise this method behaves the same as getConnection(String).

      Parameters:
      location -
      Returns:
      A connection to the requested location.
      Throws:
      RepositoryException
    • getReadOnlyConnection

      IRepositoryReadOnlyConnection getReadOnlyConnection(String repositoryName) throws RepositoryException
      Returns a read only connection to a specific repository.

      The name can't be a null.

      Can be used outside a transaction. However, if called inside a transaction, the resulting connection object is not valid after the transaction is completed. Therefore clients should not perform long-term caching of the connection objects.

      Parameters:
      repositoryName - - The name of the registered repository.
      Returns:
      A connection to the requested repository.
      Throws:
      RepositoryException
    • getReadOnlyConnection

      IRepositoryReadOnlyConnection getReadOnlyConnection(ILocation location) throws RepositoryException
      The convenient method, that determines the repository name from the given location. If the location contains no repository name or if the location is null, then the DEFAULT is used as the repository name.

      Otherwise this method behaves the same as getReadOnlyConnection(String).

      Parameters:
      location -
      Returns:
      A connection to the requested location.
      Throws:
      RepositoryException
    • addFileChangesListener

      void addFileChangesListener(IFileChangesListener listener)
      The register file changes the listener on all changes.

      The listener can't be a null.

      Parameters:
      listener - listener
    • addFileChangesListener

      void addFileChangesListener(IFileChangesListener l, Collection<ILocation> locations)
      The register file changes the listener on changes of given locations and their sublocations.

      No checking of the validity or existence of the given locations is performed. Incorrect locations will be ignored.

      The Listener can't be a null

      Parameters:
      l - listener
      locations - Collection of ILocations
    • removeFileChangesListener

      void removeFileChangesListener(IFileChangesListener l)
      The unregister file changes the listener.

      The listener can't be a null

      Parameters:
      l - listener
    • stuffFileChangesListener

      void stuffFileChangesListener(IFileChangesListener l, Collection<ILocation> locations, String repositoryState) throws RepositoryException
      Will feed the listener all changes since the given repository state (inclusive) in the given locations (if specified).

      If such a listener is already registered it will get both normal and stuffed events and it may get them asynchronously.

      Some changes may occur multiple times (even double creations of the same resource). Callers must be aware of this and be able to deal with it.

      It is ensured that notifications are sent in the proper order (from oldest to newest changes).

      Blocks until all objects were stuffed into the listener.

      The listener and repository state can't be a null

      Parameters:
      l - listener
      locations - Collection of ILocations (null is the same as an empty collection).
      repositoryState - The state to start from.
      Throws:
      RepositoryException - if an error occurs.
    • getAccessibleURLForLocation

      URI getAccessibleURLForLocation(ILocation location) throws RepositoryException
      Parameters:
      location - - location in repository
      Returns:
      repository URL to a specific location.
      Throws:
      RepositoryException
    • getLocationForAccessibleURL

      ILocation getLocationForAccessibleURL(URI url) throws RepositoryException
      Returns the location for a universally accessible URL.

      The URL can't be a null and must belong to the connected repository.

      Parameters:
      url -
      Returns:
      location (not null)
      Throws:
      RepositoryException
      See Also:
    • getDriver

      Class<?> getDriver(String schema)
      Parameters:
      schema - URI schema
      Returns:
      The registered class name for a given schema or null if there are no drivers registered for such a schema.
    • startPulling

      void startPulling()
      Internal API, do not use.
      Since:
      3.8.0