Class AbstractRepository<T>
java.lang.Object
org.eclipse.core.runtime.PlatformObject
org.eclipse.equinox.p2.repository.spi.AbstractRepository<T>
- Type Parameters:
T
- the type of object that can be queried for in this repository
- All Implemented Interfaces:
IAdaptable
,IQueryable<T>
,IRepository<T>
- Direct Known Subclasses:
AbstractArtifactRepository
,AbstractMetadataRepository
AbstractRepository defines common properties that may be provided by various kinds
of repositories.
Clients may extend this class.
- Since:
- 2.0
-
Field Summary
Fields inherited from interface org.eclipse.equinox.p2.repository.IRepository
ENABLED, NONE, PREFERENCE_NODE, PROP_COMPRESSED, PROP_DESCRIPTION, PROP_MIRRORS_BASE_URL, PROP_MIRRORS_URL, PROP_NAME, PROP_NICKNAME, PROP_PASSWORD, PROP_SYSTEM, PROP_TIMESTAMP, PROP_USERNAME, TYPE_ARTIFACT, TYPE_METADATA
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
Asserts that this repository is modifiable, throwing a runtime exception if it is not.Returns a brief description of the repository.Returns the location of this repository.getName()
Returns the name of the repository.Returns a read-only collection of the properties of the repository.getProperty
(String key) Returns the repository property with the given key, ornull
if no such property is definedReturns the name of the provider of the repository.Returns the provisioning agent used by this repositorygetType()
Returns a string representing the type of the repository.Returns a string representing the version for the repository type.boolean
Returnstrue
if this repository can be modified, andfalse
otherwise.void
setDescription
(String description) Sets the description of this repositoryprotected void
setLocation
(URI location) Sets the location of this repositoryvoid
Sets the name of this repositoryprotected void
setProperties
(Map<String, String> properties) Sets the properties of this repositorysetProperty
(String key, String value) Sets the value of the property with the given key.setProperty
(String key, String value, IProgressMonitor monitor) Sets the value of the property with the given key.void
setProvider
(String provider) Sets the provider of this repositoryprotected void
Sets the type of this repositoryprotected void
setVersion
(String version) Sets the version of this repositorytoString()
Methods inherited from class org.eclipse.core.runtime.PlatformObject
getAdapter
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.eclipse.core.runtime.IAdaptable
getAdapter
Methods inherited from interface org.eclipse.equinox.p2.query.IQueryable
query
Methods inherited from interface org.eclipse.equinox.p2.repository.IRepository
contains
-
Constructor Details
-
AbstractRepository
protected AbstractRepository(IProvisioningAgent agent, String name, String type, String version, URI location, String description, String provider, Map<String, String> properties) Creates a new repository with the given attributes.- Parameters:
agent
- the provisioning agent to be used by this repositoryname
- the repository nametype
- the repository typeversion
- the repository versionlocation
- the repository locationdescription
- the repository descriptionprovider
- the repository providerproperties
- the repository properties
-
-
Method Details
-
assertModifiable
protected void assertModifiable()Asserts that this repository is modifiable, throwing a runtime exception if it is not. This is suitable for use by subclasses when an attempt is made to write to a repository. -
getDescription
Returns a brief description of the repository.- Specified by:
getDescription
in interfaceIRepository<T>
- Returns:
- the description of the repository.
-
getLocation
Returns the location of this repository.- Specified by:
getLocation
in interfaceIRepository<T>
- Returns:
- the URI of the repository.
-
getName
Returns the name of the repository.- Specified by:
getName
in interfaceIRepository<T>
- Returns:
- the name of the repository.
-
getProperties
Returns a read-only collection of the properties of the repository.- Specified by:
getProperties
in interfaceIRepository<T>
- Returns:
- the properties of this repository.
-
getProperty
Description copied from interface:IRepository
Returns the repository property with the given key, ornull
if no such property is defined- Specified by:
getProperty
in interfaceIRepository<T>
- Parameters:
key
- the property key- Returns:
- the property value, or
null
-
getProvider
Returns the name of the provider of the repository.- Specified by:
getProvider
in interfaceIRepository<T>
- Returns:
- the provider of this repository.
-
getProvisioningAgent
Returns the provisioning agent used by this repository- Specified by:
getProvisioningAgent
in interfaceIRepository<T>
- Returns:
- the provisioning agent
-
getType
Returns a string representing the type of the repository.- Specified by:
getType
in interfaceIRepository<T>
- Returns:
- the type of the repository.
-
getVersion
Returns a string representing the version for the repository type.- Specified by:
getVersion
in interfaceIRepository<T>
- Returns:
- the version of the type of the repository.
-
isModifiable
public boolean isModifiable()Description copied from interface:IRepository
Returnstrue
if this repository can be modified, andfalse
otherwise. Attempts to change the contents of an unmodifiable repository will fail.- Specified by:
isModifiable
in interfaceIRepository<T>
- Returns:
- whether or not this repository can be modified
-
setDescription
Sets the description of this repository- Parameters:
description
- the repository description
-
setName
Sets the name of this repository- Parameters:
value
- the repository name
-
setProperty
Description copied from interface:IRepository
Sets the value of the property with the given key. Returns the old property associated with that key, if any. Setting a value ofnull
will remove the corresponding key from the properties of this repository.- Specified by:
setProperty
in interfaceIRepository<T>
- Parameters:
key
- The property keyvalue
- The new property value, ornull
to remove the keymonitor
- A progress monitor use to track progress and cancel the operation. This may be a long running operation if another process holds the lock on this location- Returns:
- The old property value, or
null
if there was no old value - Since:
- 2.1
-
setProperty
Description copied from interface:IRepository
Sets the value of the property with the given key. Returns the old property associated with that key, if any. Setting a value ofnull
will remove the corresponding key from the properties of this repository.- Specified by:
setProperty
in interfaceIRepository<T>
- Parameters:
key
- The property keyvalue
- The new property value, ornull
to remove the key- Returns:
- The old property value, or
null
if there was no old value
-
setProvider
Sets the provider of this repository- Parameters:
provider
- the repository provider
-
setType
Sets the type of this repository- Parameters:
type
- the repository type
-
setLocation
Sets the location of this repository- Parameters:
location
- the repository location
-
setVersion
Sets the version of this repository- Parameters:
version
- the repository version
-
setProperties
Sets the properties of this repository- Parameters:
properties
- the repository provider
-
toString
-