public class LocalRepoManagerFactoryImpl extends Object implements LocalRepoManagerFactory
LocalRepoManager
s.
There is one single instance of this registry. It serves as the central point to obtain
LocalRepoManager
s.
LocalRepoManagerFactory.Helper
Constructor and Description |
---|
LocalRepoManagerFactoryImpl() |
Modifier and Type | Method and Description |
---|---|
void |
addLocalRepoManagerCloseListener(LocalRepoManagerCloseListener listener) |
void |
close() |
LocalRepoManager |
createLocalRepoManagerForExistingRepository(File localRoot)
Creates a
LocalRepoManager for the given localRoot . |
LocalRepoManager |
createLocalRepoManagerForNewRepository(File localRoot)
Creates a
LocalRepoManager for the given localRoot . |
Set<File> |
getLocalRoots() |
void |
removeLocalRepoManagerCloseListener(LocalRepoManagerCloseListener listener) |
public LocalRepoManagerFactoryImpl()
public Set<File> getLocalRoots()
getLocalRoots
in interface LocalRepoManagerFactory
public LocalRepoManager createLocalRepoManagerForExistingRepository(File localRoot) throws LocalRepoManagerException
LocalRepoManagerFactory
LocalRepoManager
for the given localRoot
.
Important: You must call LocalRepoManager.close()
. Use a try-finally block or a
similar construction to prevent resource leakage!
If there is already a LocalRepoManager
implementation instance for this localRoot
, the same
instance is re-used in the background. If there is none, yet, it is implicitly instantiated and enlisted.
However, this method always returns a new proxy instance! It never returns the same instance twice.
If localRoot
is not an existing repository in the file system, one of the following
exceptions is thrown:
createLocalRepoManagerForExistingRepository
in interface LocalRepoManagerFactory
localRoot
- the root-directory of the repository. Must not be null
. Can be
relative or absolute.LocalRepoManagerImpl
for the given localRoot
. Never null
.LocalRepoManagerException
- if the given localRoot
does not denote the root-directory
of an existing repository.LocalRepoManagerFactory.createLocalRepoManagerForNewRepository(File)
public LocalRepoManager createLocalRepoManagerForNewRepository(File localRoot) throws LocalRepoManagerException
LocalRepoManagerFactory
LocalRepoManager
for the given localRoot
.
Important: You must call LocalRepoManager.close()
. Use a try-finally block or a
similar construction to prevent resource leakage!
This method turns an existing directory into a repository. If localRoot
already is a repository,
a FileAlreadyRepositoryException
is thrown.
If localRoot
is not an existing directory in the file system, one of the following
exceptions is thrown:
createLocalRepoManagerForNewRepository
in interface LocalRepoManagerFactory
localRoot
- the directory which is turned into the repository's root. Must not be null
.
Can be relative or absolute.LocalRepoManager
for the given localRoot
. Never null
.LocalRepoManagerException
- if the given localRoot
does not denote an existing directory
or if it is a directory inside an existing repository.public void close()
close
in interface LocalRepoManagerFactory
public void addLocalRepoManagerCloseListener(LocalRepoManagerCloseListener listener)
addLocalRepoManagerCloseListener
in interface LocalRepoManagerFactory
public void removeLocalRepoManagerCloseListener(LocalRepoManagerCloseListener listener)
removeLocalRepoManagerCloseListener
in interface LocalRepoManagerFactory
Copyright © 2013-2014. All Rights Reserved.