Class RepositoryTracker
- java.lang.Object
-
- org.eclipse.equinox.p2.operations.RepositoryTracker
-
public abstract class RepositoryTracker extends Object
RepositoryTracker defines a service that retrieves repositories, tracks their status, and reports errors.- Since:
- 2.0
-
-
Field Summary
Fields Modifier and Type Field Description static int
STATUS_INVALID_REPOSITORY_LOCATION
A status code used to indicate that a repository location was not valid.
-
Constructor Summary
Constructors Constructor Description RepositoryTracker()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
addNotFound(URI location)
Add the specified location to the list of "not found" repositories.abstract void
addRepository(URI location, String nickname, ProvisioningSession session)
Add a repository at the specified location.void
clearRepositoriesNotFound()
Clear the list of repositories that have already been reported as not found.void
clearRepositoryNotFound(URI location)
Remove the specified repository from the list of repositories that have already been reported as not found.protected boolean
contains(URI location, ProvisioningSession session)
Return a boolean indicating whether this tracker already contains the specified repository location.int
getArtifactRepositoryFlags()
Return the repository flags suitable for retrieving known repositories from a repository managerIStatus
getInvalidLocationStatus(String locationText)
Return a status appropriate for reporting an invalid repository location.abstract URI[]
getKnownRepositories(ProvisioningSession session)
Return an array of repository locations known for the specified provisioning session.int
getMetadataRepositoryFlags()
Return the repository flags suitable for retrieving known repositories from a repository managerboolean
hasNotFoundStatusBeenReported(URI location)
Answer a boolean indicating whether not found status has already been reported for the specified location.URI
locationFromString(String locationString)
Return a repository location represented by the supplied string.abstract void
refreshRepositories(URI[] locations, ProvisioningSession session, IProgressMonitor monitor)
Refresh the repositories at the specified locationsabstract void
removeRepositories(URI[] locations, ProvisioningSession session)
Remove the repositories at the specified locationsvoid
reportLoadFailure(URI location, ProvisionException exception)
Report a failure to load the specified repository.void
setArtifactRepositoryFlags(int flags)
Set the repository flags suitable for retrieving known repositories from a repository managervoid
setMetadataRepositoryFlags(int flags)
Set the repository flags suitable for retrieving known repositories from a repository managerIStatus
validateRepositoryLocation(ProvisioningSession session, URI location, boolean contactRepositories, IProgressMonitor monitor)
Validate the specified repository location.
-
-
-
Field Detail
-
STATUS_INVALID_REPOSITORY_LOCATION
public static final int STATUS_INVALID_REPOSITORY_LOCATION
A status code used to indicate that a repository location was not valid.- See Also:
- Constant Field Values
-
-
Method Detail
-
getKnownRepositories
public abstract URI[] getKnownRepositories(ProvisioningSession session)
Return an array of repository locations known for the specified provisioning session.- Parameters:
session
- the provisioning session providing the provisioning services- Returns:
- an array of repository locations known by this tracker
-
getInvalidLocationStatus
public IStatus getInvalidLocationStatus(String locationText)
Return a status appropriate for reporting an invalid repository location.- Parameters:
locationText
- the text representation of the location- Returns:
- a status that describes an invalid location
-
locationFromString
public URI locationFromString(String locationString)
Return a repository location represented by the supplied string. The provided string should either be an unencoded string representation of a URI, or a local file system path. This method is generally suitable for converting a location string entered by an end user into a suitable URI representation.- Parameters:
locationString
- a text representation of the location- Returns:
- a repository location URI, or
null
if the text could not be interpreted.
-
validateRepositoryLocation
public IStatus validateRepositoryLocation(ProvisioningSession session, URI location, boolean contactRepositories, IProgressMonitor monitor)
Validate the specified repository location.- Parameters:
session
- the provisioning session providing the repository serviceslocation
- the location in questioncontactRepositories
-true
if the appropriate repository manager(s) should be consulted regarding the validity of the location, orfalse
if the repository manager should not be consulted.monitor
- the progress monitor- Returns:
- a status indicating the current status of the repository
-
contains
protected boolean contains(URI location, ProvisioningSession session)
Return a boolean indicating whether this tracker already contains the specified repository location.- Parameters:
location
- the location in questionsession
- the provisioning session providing the repository services- Since:
- 2.1
-
addNotFound
public void addNotFound(URI location)
Add the specified location to the list of "not found" repositories. This list is used to ensure that errors are not reported multiple times for the same repository. The caller is already assumed to have reported any errors if necessary.- Parameters:
location
- the location of the repository that cannot be found
-
hasNotFoundStatusBeenReported
public boolean hasNotFoundStatusBeenReported(URI location)
Answer a boolean indicating whether not found status has already been reported for the specified location.- Parameters:
location
- the location in question- Returns:
true
if the repository has already been reported as being not found,false
if no status has been reported for this location.
-
clearRepositoriesNotFound
public void clearRepositoriesNotFound()
Clear the list of repositories that have already been reported as not found.
-
clearRepositoryNotFound
public void clearRepositoryNotFound(URI location)
Remove the specified repository from the list of repositories that have already been reported as not found. This method has no effect if the repository has never been reported as not found.- Parameters:
location
- the location in question
-
getArtifactRepositoryFlags
public int getArtifactRepositoryFlags()
Return the repository flags suitable for retrieving known repositories from a repository manager- Returns:
- the repository flags
-
setArtifactRepositoryFlags
public void setArtifactRepositoryFlags(int flags)
Set the repository flags suitable for retrieving known repositories from a repository manager- Parameters:
flags
- the repository flags
-
getMetadataRepositoryFlags
public int getMetadataRepositoryFlags()
Return the repository flags suitable for retrieving known repositories from a repository manager- Returns:
- the repository flags
-
setMetadataRepositoryFlags
public void setMetadataRepositoryFlags(int flags)
Set the repository flags suitable for retrieving known repositories from a repository manager- Parameters:
flags
- the repository flags
-
reportLoadFailure
public void reportLoadFailure(URI location, ProvisionException exception)
Report a failure to load the specified repository.This default implementation simply logs the failure. Subclasses may override to provide additional error reporting.
- Parameters:
location
- the location of the failed repositoryexception
- the failure that occurred
-
addRepository
public abstract void addRepository(URI location, String nickname, ProvisioningSession session)
Add a repository at the specified location.- Parameters:
location
- the location of the new repositorynickname
- the nickname for the repository, ornull
if there is no nicknamesession
- the session to use for provisioning services
-
removeRepositories
public abstract void removeRepositories(URI[] locations, ProvisioningSession session)
Remove the repositories at the specified locations- Parameters:
locations
- the locationssession
- the session to use for provisioning services
-
refreshRepositories
public abstract void refreshRepositories(URI[] locations, ProvisioningSession session, IProgressMonitor monitor)
Refresh the repositories at the specified locations- Parameters:
locations
- the locationssession
- the session to use for provisioning servicesmonitor
- the progress monitor to use
-
-