Class AbstractArtifactRepository
java.lang.Object
org.eclipse.core.runtime.PlatformObject
org.eclipse.equinox.p2.repository.spi.AbstractRepository<IArtifactKey>
org.eclipse.equinox.p2.repository.artifact.spi.AbstractArtifactRepository
- All Implemented Interfaces:
IAdaptable,IQueryable<IArtifactKey>,IArtifactRepository,IRepository<IArtifactKey>
public abstract class AbstractArtifactRepository
extends AbstractRepository<IArtifactKey>
implements IArtifactRepository
The common base class for all artifact repository implementations. Clients must
subclass this class to create their own repository implementations.
This base class provides default implementations of all methods that modify the repository.
These default methods throw an exception if AbstractRepository.isModifiable() returns false.
Therefore a client can implement a read-only repository by overriding only the abstract methods.
- Since:
- 2.0
-
Field Summary
Fields inherited from interface org.eclipse.equinox.p2.repository.artifact.IArtifactRepository
CODE_RETRY, PROP_RUNNABLEFields 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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddDescriptor(IArtifactDescriptor descriptor) Deprecated.voidaddDescriptor(IArtifactDescriptor descriptor, IProgressMonitor monitor) Add the given descriptor to the set of descriptors in this repository.voidaddDescriptors(IArtifactDescriptor[] descriptors) Deprecated.voidaddDescriptors(IArtifactDescriptor[] descriptors, IProgressMonitor monitor) Add the given artifact descriptors to this repositoryabstract booleancontains(IArtifactKey key) Returns true if this repository contains the given artifact key.abstract booleancontains(IArtifactDescriptor descriptor) Returns true if this repository contains the given descriptor.Create an instance ofIArtifactDescriptorbased on the given keycreateArtifactKey(String classifier, String id, Version version) Create an instance ofIArtifactKeybooleanexecuteBatch(IRunnableWithProgress runnable, IProgressMonitor monitor) Executes a runnable against this repository.abstract IStatusgetArtifact(IArtifactDescriptor descriptor, OutputStream destination, IProgressMonitor monitor) Writes to the given output stream the bytes represented by the artifact descriptor.abstract IArtifactDescriptor[]Return the set of artifact descriptors describing the ways that this repository can supply the artifact associated with the given artifact keyabstract IStatusgetArtifacts(IArtifactRequest[] requests, IProgressMonitor monitor) Executes the given artifact requests on this byte server.abstract OutputStreamgetOutputStream(IArtifactDescriptor descriptor) Open an output stream to which a client can write the data for the given artifact descriptor.inthashCode()voidDeprecated.UseremoveAll(IProgressMonitor)instead.voidremoveAll(IProgressMonitor monitor) Remove the all keys, descriptors, and contents from this repository.voidDeprecated.UseremoveDescriptor(IArtifactKey, IProgressMonitor)instead.voidremoveDescriptor(IArtifactKey key, IProgressMonitor monitor) Remove the given key and all related content and descriptors from this repository.voidremoveDescriptor(IArtifactDescriptor descriptor) Deprecated.voidremoveDescriptor(IArtifactDescriptor descriptor, IProgressMonitor monitor) Remove the given descriptor and its corresponding content in this repository.voidremoveDescriptors(IArtifactKey[] keys) Deprecated.UseremoveDescriptors(IArtifactKey[], IProgressMonitor)instead.voidremoveDescriptors(IArtifactKey[] keys, IProgressMonitor monitor) Remove the given list of keys and all related content and descriptors from this repository.voidremoveDescriptors(IArtifactDescriptor[] descriptors) Deprecated.voidremoveDescriptors(IArtifactDescriptor[] descriptors, IProgressMonitor monitor) Remove the given list of artifact descriptors and their corresponding content in this repository.Methods inherited from class org.eclipse.equinox.p2.repository.spi.AbstractRepository
assertModifiable, getDescription, getLocation, getName, getProperties, getProperty, getProvider, getProvisioningAgent, getType, getVersion, isModifiable, setDescription, setLocation, setName, setProperties, setProperty, setProperty, setProvider, setType, setVersion, toStringMethods inherited from class org.eclipse.core.runtime.PlatformObject
getAdapterMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.eclipse.core.runtime.IAdaptable
getAdapterMethods inherited from interface org.eclipse.equinox.p2.repository.artifact.IArtifactRepository
descriptorQueryable, getRawArtifactMethods inherited from interface org.eclipse.equinox.p2.query.IQueryable
queryMethods inherited from interface org.eclipse.equinox.p2.repository.IRepository
getDescription, getLocation, getName, getProperties, getProperty, getProvider, getProvisioningAgent, getType, getVersion, isModifiable, setProperty, setProperty
-
Constructor Details
-
AbstractArtifactRepository
-
-
Method Details
-
contains
Description copied from interface:IArtifactRepositoryReturns true if this repository contains the given descriptor.- Specified by:
containsin interfaceIArtifactRepository- Parameters:
descriptor- the descriptor to query- Returns:
- true if the given descriptor is already in this repository
-
contains
Description copied from interface:IArtifactRepositoryReturns true if this repository contains the given artifact key.- Specified by:
containsin interfaceIArtifactRepository- Specified by:
containsin interfaceIQueryable<IArtifactKey>- Specified by:
containsin interfaceIRepository<IArtifactKey>- Parameters:
key- the key to query- Returns:
- true if the given key is already in this repository
-
getArtifact
public abstract IStatus getArtifact(IArtifactDescriptor descriptor, OutputStream destination, IProgressMonitor monitor) Description copied from interface:IArtifactRepositoryWrites to the given output stream the bytes represented by the artifact descriptor. Any processing steps defined by the descriptor will be applied to the artifact bytes before they are sent to the provided output stream.- Specified by:
getArtifactin interfaceIArtifactRepository- Parameters:
descriptor- the descriptor to transferdestination- the stream to write the final artifact output tomonitor- a progress monitor, ornullif progress reporting and cancellation are not desired- Returns:
- the result of the artifact transfer
-
getArtifactDescriptors
Description copied from interface:IArtifactRepositoryReturn the set of artifact descriptors describing the ways that this repository can supply the artifact associated with the given artifact key- Specified by:
getArtifactDescriptorsin interfaceIArtifactRepository- Parameters:
key- the artifact key to lookup- Returns:
- the descriptors associated with the given key
-
getArtifacts
Description copied from interface:IArtifactRepositoryExecutes the given artifact requests on this byte server.- Specified by:
getArtifactsin interfaceIArtifactRepository- Parameters:
requests- The artifact requestsmonitor- A progress monitor use to track progress and cancel the operation.- Returns:
- a status object that is
OKif requests were processed successfully. Otherwise, a status indicating information, warnings, or errors that occurred while executing the artifact requests
-
getOutputStream
public abstract OutputStream getOutputStream(IArtifactDescriptor descriptor) throws ProvisionException Description copied from interface:IArtifactRepositoryOpen an output stream to which a client can write the data for the given artifact descriptor.- Specified by:
getOutputStreamin interfaceIArtifactRepository- Parameters:
descriptor- the descriptor describing the artifact data to be written to the resultant stream- Returns:
- the stream to which the artifact content can be written. The returned output
stream may implement
IStateful. - Throws:
ProvisionException- if the output stream could not be created. Reasons include:- An I/O exception occurred (@link
ProvisionException.REPOSITORY_FAILED_WRITE) . - An artifact already exists at that location (
ProvisionException.ARTIFACT_EXISTS).
- An I/O exception occurred (@link
-
addDescriptor
Description copied from interface:IArtifactRepositoryAdd the given descriptor to the set of descriptors in this repository. This is a relatively low-level operation that should be used only when the actual related content is in this repository and the given descriptor accurately describes that content.- Specified by:
addDescriptorin interfaceIArtifactRepository- Parameters:
descriptor- the descriptor to add.monitor- 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- Since:
- 2.1
-
addDescriptor
Deprecated.UseaddDescriptor(IArtifactDescriptor, IProgressMonitor)instead.Description copied from interface:IArtifactRepositoryAdd the given descriptor to the set of descriptors in this repository. This is a relatively low-level operation that should be used only when the actual related content is in this repository and the given descriptor accurately describes that content.- Specified by:
addDescriptorin interfaceIArtifactRepository- Parameters:
descriptor- the descriptor to add.
-
addDescriptors
Add the given artifact descriptors to this repository- Specified by:
addDescriptorsin interfaceIArtifactRepository- Parameters:
descriptors- the artifact descriptors to addmonitor- 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- Since:
- 2.1
-
addDescriptors
Deprecated.Description copied from interface:IArtifactRepositoryAdd the given artifact descriptors to this repository- Specified by:
addDescriptorsin interfaceIArtifactRepository- Parameters:
descriptors- the artifact descriptors to add
-
removeDescriptor
Remove the given descriptor and its corresponding content in this repository.- Specified by:
removeDescriptorin interfaceIArtifactRepository- Parameters:
descriptor- the descriptor to remove.monitor- 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- Since:
- 2.1
-
removeDescriptor
Deprecated.Description copied from interface:IArtifactRepositoryRemove the given descriptor and its corresponding content in this repository.- Specified by:
removeDescriptorin interfaceIArtifactRepository- Parameters:
descriptor- the descriptor to remove.
-
removeDescriptors
Remove the given list of artifact descriptors and their corresponding content in this repository.- Specified by:
removeDescriptorsin interfaceIArtifactRepository- Parameters:
descriptors- the list of descriptors to removemonitor- 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- Since:
- 2.1
-
removeDescriptors
Deprecated.Remove the given list of artifact descriptors and their corresponding content in this repository.- Specified by:
removeDescriptorsin interfaceIArtifactRepository- Parameters:
descriptors- the list of descriptors to remove- Since:
- 2.1
-
removeDescriptor
Remove the given key and all related content and descriptors from this repository.- Specified by:
removeDescriptorin interfaceIArtifactRepository- Parameters:
key- the key to remove.monitor- 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- Since:
- 2.1
-
removeDescriptor
Deprecated.UseremoveDescriptor(IArtifactKey, IProgressMonitor)instead.Description copied from interface:IArtifactRepositoryRemove the given key and all related content and descriptors from this repository.- Specified by:
removeDescriptorin interfaceIArtifactRepository- Parameters:
key- the key to remove.
-
removeDescriptors
Remove the given list of keys and all related content and descriptors from this repository.- Specified by:
removeDescriptorsin interfaceIArtifactRepository- Parameters:
keys- The keys to remove.monitor- 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- Since:
- 2.1
-
removeDescriptors
Deprecated.UseremoveDescriptors(IArtifactKey[], IProgressMonitor)instead.Remove the given list of keys and all related content and descriptors from this repository.- Specified by:
removeDescriptorsin interfaceIArtifactRepository- Parameters:
keys- The keys to remove.- Since:
- 2.1
-
removeAll
Description copied from interface:IArtifactRepositoryRemove the all keys, descriptors, and contents from this repository.- Specified by:
removeAllin interfaceIArtifactRepository- Parameters:
monitor- 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- Since:
- 2.1
-
removeAll
Deprecated.UseremoveAll(IProgressMonitor)instead.Description copied from interface:IArtifactRepositoryRemove the all keys, descriptors, and contents from this repository.- Specified by:
removeAllin interfaceIArtifactRepository
-
equals
-
hashCode
public int hashCode() -
createArtifactDescriptor
Description copied from interface:IArtifactRepositoryCreate an instance ofIArtifactDescriptorbased on the given key- Specified by:
createArtifactDescriptorin interfaceIArtifactRepository- Parameters:
key-IArtifactKey- Returns:
- a new instance of IArtifactDescriptor
-
createArtifactKey
Description copied from interface:IArtifactRepositoryCreate an instance ofIArtifactKey- Specified by:
createArtifactKeyin interfaceIArtifactRepository- Parameters:
classifier- The classifier for this artifact key.id- The id for this artifact key.version- The version for this artifact key.- Returns:
- a new IArtifactKey
-
executeBatch
Description copied from interface:IArtifactRepositoryExecutes a runnable against this repository. It is up to the repository implementor to determine what "batch process" means, for example, it may mean that the repository index is not stored until after the runnable completes. The runnable should not execute anything in a separate thread.- Specified by:
executeBatchin interfaceIArtifactRepository- Parameters:
runnable- The runnable to executemonitor- A progress monitor that will be passed to the runnable- Returns:
- The result of running the runnable. Any exceptions thrown during the execution will be returned in the status.
-
addDescriptor(IArtifactDescriptor, IProgressMonitor)instead.