Interface IRepositoryService
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 Summary
Modifier and TypeFieldDescriptionstatic final String
static final IContextId
IContextId
of the root of theDEFAULT
repository. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addFileChangesListener
(IFileChangesListener listener) The register file changes the listener on all changes.void
addFileChangesListener
(IFileChangesListener l, Collection<ILocation> locations) The register file changes the listener on changes of given locations and their sublocations.getAccessibleURLForLocation
(ILocation location) getConnection
(ILocation location) The convenient method that determines the repository name from the givenlocation
.getConnection
(String repositoryName) Return the connection to a specific repository.Class<?>
Returns the location for a universally accessible URL.getReadOnlyConnection
(ILocation location) The convenient method, that determines the repository name from the givenlocation
.getReadOnlyConnection
(String repositoryName) Returns a read only connection to a specific repository.Returns the registered repositories.getRepository
(ILocation loc) A convenient method, that determines the repository name from the givenlocation
.getRepository
(String repositoryName) Returns the repository by repository name.void
The unregister file changes the listener.void
Internal API, do not use.void
stuffFileChangesListener
(IFileChangesListener l, Collection<ILocation> locations, String repositoryState) Will feed the listener all changes since the given repository state (inclusive) in the given locations (if specified).
-
Field Details
-
DEFAULT
- See Also:
-
DEFAULT_REPO_ROOT_CONTEXT_ID
IContextId
of the root of theDEFAULT
repository.- Since:
- 3.19.2
-
-
Method Details
-
getRepository
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
A convenient method, that determines the repository name from the givenlocation
. If thelocation
contains no repository name or if thelocation
isnull
, then theDEFAULT
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
ofIRepositoryInfo
- Throws:
RepositoryException
-
getConnection
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
The convenient method that determines the repository name from the givenlocation
. If thelocation
contains no repository name or if thelocation
isnull
, then theDEFAULT
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
The convenient method, that determines the repository name from the givenlocation
. If thelocation
contains no repository name or if thelocation
isnull
, then theDEFAULT
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
The register file changes the listener on all changes.The listener can't be a
null
.- Parameters:
listener
- listener
-
addFileChangesListener
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
- listenerlocations
-Collection
ofILocation
s
-
removeFileChangesListener
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
- listenerlocations
-Collection
ofILocation
s (null
is the same as an empty collection).repositoryState
- The state to start from.- Throws:
RepositoryException
- if an error occurs.
-
getAccessibleURLForLocation
- Parameters:
location
- - location in repository- Returns:
- repository URL to a specific location.
- Throws:
RepositoryException
-
getLocationForAccessibleURL
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
- 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
-