Eclipse Platform
Release 3.6

org.eclipse.equinox.p2.operations
Class RepositoryTracker

java.lang.Object
  extended by 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
static int STATUS_INVALID_REPOSITORY_LOCATION
          A status code used to indicate that a repository location was not valid.
 
Constructor Summary
RepositoryTracker()
           
 
Method Summary
 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.
 int getArtifactRepositoryFlags()
          Return the repository flags suitable for retrieving known repositories from a repository manager
 IStatus 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 manager
 boolean 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 locations
abstract  void removeRepositories(URI[] locations, ProvisioningSession session)
          Remove the repositories at the specified locations
 void 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 manager
 void setMetadataRepositoryFlags(int flags)
          Set the repository flags suitable for retrieving known repositories from a repository manager
 IStatus validateRepositoryLocation(ProvisioningSession session, URI location, boolean contactRepositories, IProgressMonitor monitor)
          Validate the specified repository location.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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
Constructor Detail

RepositoryTracker

public RepositoryTracker()
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 services
location - the location in question
contactRepositories - true if the appropriate repository manager(s) should be consulted regarding the validity of the location, or false if the repository manager should not be consulted.
monitor - the progress monitor
Returns:
a status indicating the current status of the repository

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 repository
exception - 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 repository
nickname - the nickname for the repository, or null if there is no nickname
session - 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 locations
session - 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 locations
session - the session to use for provisioning services
monitor - the progress monitor to use

Eclipse Platform
Release 3.6

Guidelines for using Eclipse APIs.

Copyright (c) Eclipse contributors and others 2000, 2010. All rights reserved.