public abstract static class Repository.LocalProvider extends Object
Lookups.executeWith(org.openide.util.Lookup, java.lang.Runnable)
to temporarily modify the default
Lookup contents and route Repository requests to a Repository private to some task. The
LocalProvider
is responsible for caching and lifecycle of the Repository instance;
it can expire the Repository if the Provider's execution context terminates. Implementations
must be prepared to handle requests for Repository already shutdown etc.Constructor and Description |
---|
LocalProvider() |
Modifier and Type | Method and Description |
---|---|
protected Repository |
delayFilesystemAttach(Callable<Repository> init)
Allows to delay attaching filesystems to the Repository.
|
abstract Repository |
getRepository()
Returns the local repository instance.
|
public abstract Repository getRepository() throws IOException
null
to indicate
the main Repository should be used. The method must return the very same instance
of Repository for the whole duration of the execution context. It must return the same
Repository instance even after the execution context shuts down; the contents of Repository and
its FileSystems may be limited in that case.
Implementations must be reentrant (a call to getLocalRepository
can be made during
construction of the Repository instance) and must not recurse infinitely.
IOException
protected final Repository delayFilesystemAttach(Callable<Repository> init) throws IOException
Repository.getDefault()
or
getLocalRepository()
.
This method wraps the Repository creation so that the default FileSystem is attached after the repository is fully constructed. The `init' callable must create a new Repository instance. This method will then add the default FS for newly created repository instances.
init
- Callable which produces a new Repository instance or null
to abort creationnull
, if no instance was created.IOException
- if the Callable fails. All exceptions are wrapped into IOException
.