T
- the type of contents in the repositories controlled by this managerpublic interface IRepositoryManager<T> extends IQueryable<T>
A repository manager keeps track of a set of known repositories, and provides caching of these known repositories to avoid unnecessary loading of repositories from the disk or network.
All URI
instances provided to a repository manager must be absolute.
Modifier and Type | Field and Description |
---|---|
static int |
REPOSITORIES_ALL
Constant used to indicate that all enabled repositories are of interest.
|
static int |
REPOSITORIES_DISABLED
Constant used to indicate that only disabled repositories are of interest.
|
static int |
REPOSITORIES_LOCAL
Constant used to indicate that only local repositories are of interest.
|
static int |
REPOSITORIES_NON_LOCAL
Constant used to indicate that only remote repositories are of interest.
|
static int |
REPOSITORIES_NON_SYSTEM
Constant used to indicate that only non-system repositories are of interest.
|
static int |
REPOSITORIES_SYSTEM
Constant used to indicate that only system repositories are of interest.
|
static int |
REPOSITORY_HINT_MODIFIABLE
Constant used to indicate that a repository manager should only load the
repository if the repository is modifiable.
|
Modifier and Type | Method and Description |
---|---|
void |
addRepository(URI location)
Adds the repository at the given location to the list of repositories tracked by
this repository manager.
|
boolean |
contains(URI location)
Returns whether a repository at the given location is in the list of repositories
tracked by this repository manager.
|
IProvisioningAgent |
getAgent()
Returns the provisioning agent in charge of this repository manager
|
URI[] |
getKnownRepositories(int flags)
Returns the repository locations known to the repository manager.
|
String |
getRepositoryProperty(URI location,
String key)
Returns the property associated with the repository at the given URI,
without loading the repository.
|
boolean |
isEnabled(URI location)
Returns the enablement value of a repository.
|
boolean |
removeRepository(URI location)
Removes the repository at the given location from the list of
repositories known to this repository manager.
|
void |
setEnabled(URI location,
boolean enablement)
Sets the enablement of a repository.
|
void |
setRepositoryProperty(URI location,
String key,
String value)
Sets the property associated with the repository at the given URI,
without loading the repository.
|
query
static final int REPOSITORIES_ALL
static final int REPOSITORIES_SYSTEM
static final int REPOSITORIES_NON_SYSTEM
static final int REPOSITORIES_LOCAL
getKnownRepositories(int)
,
Constant Field Valuesstatic final int REPOSITORIES_NON_LOCAL
getKnownRepositories(int)
,
Constant Field Valuesstatic final int REPOSITORIES_DISABLED
getKnownRepositories(int)
,
Constant Field Valuesstatic final int REPOSITORY_HINT_MODIFIABLE
IRepository.isModifiable()
,
Constant Field Valuesvoid addRepository(URI location)
If there is a known disabled repository at the given location, it will become enabled as a result of this method. Thus the caller can be guaranteed that there is a known, enabled repository at the given location when this method returns.
location
- The absolute location of the repository to addisEnabled(URI)
boolean contains(URI location)
location
- The absolute location of the repository to look fortrue
if the repository is known to this manager,
and false
otherwiseIProvisioningAgent getAgent()
URI[] getKnownRepositories(int flags)
Note that the repository manager does not guarantee that a valid repository exists at any of the returned locations at any particular moment in time. A subsequent attempt to load a repository at any of the given locations may or may not succeed.
flags
- an integer bit-mask indicating which repositories should be
returned. REPOSITORIES_ALL
can be used as the mask when
all enabled repositories should be returned. Disabled repositories are automatically
excluded unless the REPOSITORIES_DISABLED
flag is set.REPOSITORIES_ALL
,
REPOSITORIES_SYSTEM
,
REPOSITORIES_NON_SYSTEM
,
REPOSITORIES_LOCAL
,
REPOSITORIES_DISABLED
String getRepositoryProperty(URI location, String key)
Note that only the repository properties referenced below are tracked by the
repository manager itself. For all other properties, this method will return null
.
Only values for the properties that are already known by a repository manager will be returned.
If a client wishes to retrieve a property value from a repository regardless of the cost of retrieving it, the client should load the repository and then retrieve the property from the repository itself.
location
- the absolute URI of the repository in questionkey
- the String key of the property desirednull
if the repository
does not exist, the value does not exist, or the property value
could not be determined without loading the repository.IRepository.getProperties()
,
setRepositoryProperty(URI, String, String)
,
IRepository.PROP_NAME
,
IRepository.PROP_NICKNAME
,
IRepository.PROP_DESCRIPTION
,
IRepository.PROP_SYSTEM
void setRepositoryProperty(URI location, String key, String value)
This method stores properties in a cache in the repository manager and does not write the property to the backing repository. This is useful for making repository properties available without incurring the cost of loading the repository. When the repository is loaded, it will overwrite any conflicting properties that have been set using this method. Only the repository properties referenced below can be stored by the repository manager; attempts to set other repository properties will be ignored.
To persistently set a property on a repository, clients must load
the repository and call IRepository.setProperty(String, String)
.
location
- the absolute URI of the repository in questionkey
- the String key of the property desiredvalue
- the value to set the property togetRepositoryProperty(URI, String)
,
IRepository.setProperty(String, String)
,
IRepository.PROP_NAME
,
IRepository.PROP_NICKNAME
,
IRepository.PROP_DESCRIPTION
,
IRepository.PROP_SYSTEM
boolean isEnabled(URI location)
Note that enablement is a property of the repository manager and not a property of the affected repository. The enablement of the repository is discarded when a repository is removed from the repository manager.
location
- The absolute location of the repository whose enablement is requestedtrue
if the repository is enabled, and
false
if it is not enabled, or if the repository location
is not known to the repository manager.REPOSITORIES_DISABLED
,
setEnabled(URI, boolean)
boolean removeRepository(URI location)
location
- The absolute location of the repository to removetrue
if a repository was removed, and
false
otherwise.void setEnabled(URI location, boolean enablement)
Note that enablement is a property of the repository manager and not a property of the affected repository. The enablement of the repository is discarded when a repository is removed from the repository manager.
This method has no effect if the given repository location is not known to the repository manager.
location
- The absolute location of the repository to enable or disableenablement
- true
to enable the repository, and
false
to disable the repositoryREPOSITORIES_DISABLED
,
isEnabled(URI)
Copyright (c) 2000, 2015 Eclipse Contributors and others. All rights reserved.Guidelines for using Eclipse APIs.