Eclipse Platform
Release 3.6

org.eclipse.equinox.p2.repository.artifact.spi
Class ArtifactRepositoryFactory

java.lang.Object
  extended by org.eclipse.equinox.p2.repository.artifact.spi.ArtifactRepositoryFactory

public abstract class ArtifactRepositoryFactory
extends Object

An artifact repository factory is responsible for creating and loading instances of a particular type of artifact repository. Factories are provided via the org.eclipse.equinox.p2.artifact.repository.artifactRepositories extension point.

Since:
2.0

Constructor Summary
ArtifactRepositoryFactory()
           
 
Method Summary
abstract  IArtifactRepository create(URI location, String name, String type, Map<String,String> properties)
          Creates and returns a new empty artifact repository of the given type at the given location.
protected  IProvisioningAgent getAgent()
          Returns the provisioning agent associated with this factory, or null if this factory is not associated with an agent.
abstract  IArtifactRepository load(URI location, int flags, IProgressMonitor monitor)
          Loads and returns the repository of this factory's type at the given location.
 void setAgent(IProvisioningAgent agent)
          Sets the provisioning agent associated with this repository factory.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ArtifactRepositoryFactory

public ArtifactRepositoryFactory()
Method Detail

create

public abstract IArtifactRepository create(URI location,
                                           String name,
                                           String type,
                                           Map<String,String> properties)
                                    throws ProvisionException
Creates and returns a new empty artifact repository of the given type at the given location.

Parameters:
location - the location for the new repository
name - the name of the new repository
type - the kind of repository to create
properties - the properties to set on the repository
Returns:
the newly created repository
Throws:
ProvisionException - if the repository could not be created. Reasons include:
  • The repository type is unknown.
  • There was an error writing to the given repository location.
  • A repository already exists at that location.

getAgent

protected IProvisioningAgent getAgent()
Returns the provisioning agent associated with this factory, or null if this factory is not associated with an agent.

Returns:
The provisioning agent, or null

load

public abstract IArtifactRepository load(URI location,
                                         int flags,
                                         IProgressMonitor monitor)
                                  throws ProvisionException
Loads and returns the repository of this factory's type at the given location.

The error code returned in the case of failure is significant. In particular an error code of ProvisionException.REPOSITORY_FAILED_READ indicates that the location definitely identifies a repository of this type, but an error occurred while loading the repository. The repository manager will not attempt to load a repository from that location using any other factory. An error code of ProvisionException.REPOSITORY_NOT_FOUND indicates there is no repository of this type at the given location, and the repository manager is free to try again with a different repository factory.

The flags passed in should be taken as a hint for the type of repository to load. If the factory knows it will not load a repository that satisfies these hints, it can fail fast and return null.

Parameters:
location - the location in which to look for a repository description
flags - to consider while loading the repository
monitor - a progress monitor, or null if progress reporting is not desired
Returns:
a repository object for the given location
Throws:
ProvisionException - if the repository could not be created. Reasons include:
  • There is no existing repository at that location.
  • The repository at that location could not be read.
See Also:


setAgent

public void setAgent(IProvisioningAgent agent)
Sets the provisioning agent associated with this repository factory. This method is called by the provisioning agent to provide access to the agent instance. This method is not intended to be called by clients.

Parameters:
agent - The provisioning agent

Eclipse Platform
Release 3.6

Guidelines for using Eclipse APIs.

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