Class ProviderOnlyArtifactRepository
- java.lang.Object
-
- org.eclipse.core.runtime.PlatformObject
-
- org.eclipse.equinox.p2.repository.spi.AbstractRepository<org.eclipse.equinox.p2.metadata.IArtifactKey>
-
- org.eclipse.equinox.p2.repository.artifact.spi.AbstractArtifactRepository
-
- org.eclipse.tycho.repository.p2base.artifact.repository.AbstractArtifactRepository2
-
- org.eclipse.tycho.repository.p2base.artifact.repository.ProviderOnlyArtifactRepository
-
- All Implemented Interfaces:
org.eclipse.core.runtime.IAdaptable,org.eclipse.equinox.p2.query.IQueryable<org.eclipse.equinox.p2.metadata.IArtifactKey>,org.eclipse.equinox.p2.repository.artifact.IArtifactRepository,org.eclipse.equinox.p2.repository.artifact.IFileArtifactRepository,org.eclipse.equinox.p2.repository.IRepository<org.eclipse.equinox.p2.metadata.IArtifactKey>,IArtifactFileProvider,IArtifactProvider,IRawArtifactFileProvider,IRawArtifactProvider
public class ProviderOnlyArtifactRepository extends AbstractArtifactRepository2 implements org.eclipse.equinox.p2.repository.artifact.IFileArtifactRepository, IRawArtifactFileProvider
Read-only repository which delegates artifact read operations to a provider instance. Adapter fromIRawArtifactFileProvidertoIFileArtifactRepository.
-
-
Field Summary
Fields Modifier and Type Field Description private IRawArtifactFileProviderdelegate
-
Constructor Summary
Constructors Constructor Description ProviderOnlyArtifactRepository(IRawArtifactFileProvider delegate, org.eclipse.equinox.p2.core.IProvisioningAgent agent, java.net.URI location)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancontains(org.eclipse.equinox.p2.metadata.IArtifactKey key)Returnstrueif this is a provider for the given artifact.booleancontains(org.eclipse.equinox.p2.repository.artifact.IArtifactDescriptor descriptor)Returnstrueif this a provider for an artifact in the given formatorg.eclipse.equinox.p2.query.IQueryable<org.eclipse.equinox.p2.repository.artifact.IArtifactDescriptor>descriptorQueryable()org.eclipse.core.runtime.IStatusgetArtifact(IArtifactSink sink, org.eclipse.core.runtime.IProgressMonitor monitor)Writes the requested artifact to the givenIArtifactSink.org.eclipse.equinox.p2.repository.artifact.IArtifactDescriptor[]getArtifactDescriptors(org.eclipse.equinox.p2.metadata.IArtifactKey key)Return the raw artifact formats in which the given artifact can be provided.java.io.FilegetArtifactFile(org.eclipse.equinox.p2.metadata.IArtifactKey key)Returns the file system location of the given artifact.java.io.FilegetArtifactFile(org.eclipse.equinox.p2.repository.artifact.IArtifactDescriptor descriptor)Returns the file system location of the given artifact in the given format.org.eclipse.core.runtime.IStatusgetRawArtifact(IRawArtifactSink sink, org.eclipse.core.runtime.IProgressMonitor monitor)Writes the requested artifact in the specified raw format to the givenIRawArtifactSink.protected voidinternalAddDescriptor(org.eclipse.equinox.p2.repository.artifact.IArtifactDescriptor descriptor)protected voidinternalRemoveAllDescriptors()protected voidinternalRemoveDescriptor(org.eclipse.equinox.p2.repository.artifact.IArtifactDescriptor descriptor)protected voidinternalRemoveDescriptors(org.eclipse.equinox.p2.metadata.IArtifactKey key)protected voidinternalRemoveDescriptors(org.eclipse.equinox.p2.metadata.IArtifactKey[] keys)protected voidinternalRemoveDescriptors(org.eclipse.equinox.p2.repository.artifact.IArtifactDescriptor[] descriptors)protected voidinternalStore(org.eclipse.core.runtime.IProgressMonitor monitor)booleanisModifiable()IArtifactSinknewAddingArtifactSink(org.eclipse.equinox.p2.metadata.IArtifactKey key)Returns a newIArtifactSinkinstance that adds the received artifact to this repository onIArtifactSink.commitWrite().IRawArtifactSinknewAddingRawArtifactSink(org.eclipse.equinox.p2.repository.artifact.IArtifactDescriptor descriptor)Returns a newIRawArtifactSinkinstance that adds the received artifact to this repository onIArtifactSink.commitWrite().org.eclipse.equinox.p2.query.IQueryResult<org.eclipse.equinox.p2.metadata.IArtifactKey>query(org.eclipse.equinox.p2.query.IQuery<org.eclipse.equinox.p2.metadata.IArtifactKey> query, org.eclipse.core.runtime.IProgressMonitor monitor)-
Methods inherited from class org.eclipse.tycho.repository.p2base.artifact.repository.AbstractArtifactRepository2
addDescriptor, addDescriptor, addDescriptors, addDescriptors, getArtifact, getArtifacts, getOutputStream, getRawArtifact, isFatal, removeAll, removeAll, removeDescriptor, removeDescriptor, removeDescriptor, removeDescriptor, removeDescriptors, removeDescriptors, removeDescriptors, removeDescriptors, setStatusOnStreamIfPossible
-
Methods inherited from class org.eclipse.equinox.p2.repository.artifact.spi.AbstractArtifactRepository
createArtifactDescriptor, createArtifactKey, equals, executeBatch, hashCode
-
Methods inherited from class org.eclipse.equinox.p2.repository.spi.AbstractRepository
assertModifiable, getDescription, getLocation, getName, getProperties, getProperty, getProvider, getProvisioningAgent, getType, getVersion, setDescription, setLocation, setName, setProperties, setProperty, setProperty, setProvider, setType, setVersion
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.eclipse.equinox.p2.repository.artifact.IArtifactRepository
addDescriptor, addDescriptor, addDescriptors, addDescriptors, createArtifactDescriptor, createArtifactKey, executeBatch, getArtifact, getArtifacts, getOutputStream, getRawArtifact, removeAll, removeAll, removeDescriptor, removeDescriptor, removeDescriptor, removeDescriptor, removeDescriptors, removeDescriptors, removeDescriptors, removeDescriptors
-
-
-
-
Field Detail
-
delegate
private final IRawArtifactFileProvider delegate
-
-
Constructor Detail
-
ProviderOnlyArtifactRepository
public ProviderOnlyArtifactRepository(IRawArtifactFileProvider delegate, org.eclipse.equinox.p2.core.IProvisioningAgent agent, java.net.URI location)
-
-
Method Detail
-
contains
public boolean contains(org.eclipse.equinox.p2.metadata.IArtifactKey key)
Description copied from interface:IArtifactProviderReturnstrueif this is a provider for the given artifact.- Specified by:
containsin interfaceIArtifactProvider- Specified by:
containsin interfaceorg.eclipse.equinox.p2.repository.artifact.IArtifactRepository- Specified by:
containsin classorg.eclipse.equinox.p2.repository.artifact.spi.AbstractArtifactRepository- Parameters:
key- An artifact key- Returns:
trueif this instance can provide the artifact for the given key
-
query
public org.eclipse.equinox.p2.query.IQueryResult<org.eclipse.equinox.p2.metadata.IArtifactKey> query(org.eclipse.equinox.p2.query.IQuery<org.eclipse.equinox.p2.metadata.IArtifactKey> query, org.eclipse.core.runtime.IProgressMonitor monitor)- Specified by:
queryin interfaceorg.eclipse.equinox.p2.query.IQueryable<org.eclipse.equinox.p2.metadata.IArtifactKey>
-
getArtifactFile
public java.io.File getArtifactFile(org.eclipse.equinox.p2.metadata.IArtifactKey key)
Description copied from interface:IArtifactFileProviderReturns the file system location of the given artifact.- Specified by:
getArtifactFilein interfaceIArtifactFileProvider- Specified by:
getArtifactFilein interfaceorg.eclipse.equinox.p2.repository.artifact.IFileArtifactRepository- Parameters:
key- An artifact key- Returns:
- The location of the specified artifact, or
nullthe given artifact does not exist.
-
getArtifact
public org.eclipse.core.runtime.IStatus getArtifact(IArtifactSink sink, org.eclipse.core.runtime.IProgressMonitor monitor) throws ArtifactSinkException
Description copied from interface:IArtifactProviderWrites the requested artifact to the givenIArtifactSink.The implementation is free to pick the most suitable internal storage format to serve the request, e.g. it may extract the artifact from a pack200-compressed format. If an error is detected while streaming the artifact (e.g. an MD5 checksum error), the implementation may re-attempt the read from all other available sources. In case there were multiple read attempts, a multi-status with the results of all attempts is returned.
- Specified by:
getArtifactin interfaceIArtifactProvider- Parameters:
sink- A sink for a specific artifact. When this method returns, the sink will either be closed (withIArtifactSink.commitWrite()orIArtifactSink.abortWrite(), depending on the status), or not have received any content.monitor- A progress monitor, ornull- Returns:
- A non-fatal status (warning or better) if the read operation was successful.
- Throws:
ArtifactSinkException- if that exception is thrown by the givenIArtifactSink- See Also:
IArtifactSink.getArtifactToBeWritten()
-
getArtifactDescriptors
public org.eclipse.equinox.p2.repository.artifact.IArtifactDescriptor[] getArtifactDescriptors(org.eclipse.equinox.p2.metadata.IArtifactKey key)
Description copied from interface:IRawArtifactProviderReturn the raw artifact formats in which the given artifact can be provided.- Specified by:
getArtifactDescriptorsin interfaceorg.eclipse.equinox.p2.repository.artifact.IArtifactRepository- Specified by:
getArtifactDescriptorsin interfaceIRawArtifactProvider- Specified by:
getArtifactDescriptorsin classorg.eclipse.equinox.p2.repository.artifact.spi.AbstractArtifactRepository- Parameters:
key- An artifact key- Returns:
- The descriptors associated with the given key
-
contains
public boolean contains(org.eclipse.equinox.p2.repository.artifact.IArtifactDescriptor descriptor)
Description copied from interface:IRawArtifactProviderReturnstrueif this a provider for an artifact in the given format- Specified by:
containsin interfaceorg.eclipse.equinox.p2.repository.artifact.IArtifactRepository- Specified by:
containsin interfaceIRawArtifactProvider- Specified by:
containsin classorg.eclipse.equinox.p2.repository.artifact.spi.AbstractArtifactRepository- Parameters:
descriptor- An artifact descriptor- Returns:
trueif this instance can provide the artifact as raw artifact in the described format
-
getArtifactFile
public java.io.File getArtifactFile(org.eclipse.equinox.p2.repository.artifact.IArtifactDescriptor descriptor)
Description copied from interface:IRawArtifactFileProviderReturns the file system location of the given artifact in the given format.- Specified by:
getArtifactFilein interfaceorg.eclipse.equinox.p2.repository.artifact.IFileArtifactRepository- Specified by:
getArtifactFilein interfaceIRawArtifactFileProvider- Parameters:
descriptor- The key and format of an artifact- Returns:
- The location of the specified raw artifact, or
nullthe that artifact does not exist in the given format.
-
getRawArtifact
public org.eclipse.core.runtime.IStatus getRawArtifact(IRawArtifactSink sink, org.eclipse.core.runtime.IProgressMonitor monitor) throws ArtifactSinkException
Description copied from interface:IRawArtifactProviderWrites the requested artifact in the specified raw format to the givenIRawArtifactSink.If an error is detected while streaming the artifact (e.g. an MD5 checksum error) and there are other sources available (e.g. in a composite provider), the implementation may re-attempt the read from these other sources. In case there were multiple read attempts, a multi-status with the results of all attempts is returned.
- Specified by:
getRawArtifactin interfaceIRawArtifactProvider- Parameters:
sink- A sink for a specific artifact in a specific format. When this method returns, the sink will either be closed (withIArtifactSink.commitWrite()orIArtifactSink.abortWrite(), depending on the status), or not have received any content.monitor- A progress monitor, ornull- Returns:
- A non-fatal status (warning or better) if the read operation was successful.
- Throws:
ArtifactSinkException- if that exception is thrown by the givenIArtifactSink- See Also:
IArtifactSink.getArtifactToBeWritten(),IRawArtifactSink.getArtifactFormatToBeWritten()
-
descriptorQueryable
public org.eclipse.equinox.p2.query.IQueryable<org.eclipse.equinox.p2.repository.artifact.IArtifactDescriptor> descriptorQueryable()
- Specified by:
descriptorQueryablein interfaceorg.eclipse.equinox.p2.repository.artifact.IArtifactRepository
-
isModifiable
public boolean isModifiable()
- Specified by:
isModifiablein interfaceorg.eclipse.equinox.p2.repository.IRepository<org.eclipse.equinox.p2.metadata.IArtifactKey>- Overrides:
isModifiablein classorg.eclipse.equinox.p2.repository.spi.AbstractRepository<org.eclipse.equinox.p2.metadata.IArtifactKey>
-
internalAddDescriptor
protected void internalAddDescriptor(org.eclipse.equinox.p2.repository.artifact.IArtifactDescriptor descriptor)
- Specified by:
internalAddDescriptorin classAbstractArtifactRepository2
-
internalRemoveDescriptor
protected void internalRemoveDescriptor(org.eclipse.equinox.p2.repository.artifact.IArtifactDescriptor descriptor)
- Specified by:
internalRemoveDescriptorin classAbstractArtifactRepository2
-
internalRemoveDescriptors
protected void internalRemoveDescriptors(org.eclipse.equinox.p2.repository.artifact.IArtifactDescriptor[] descriptors)
- Specified by:
internalRemoveDescriptorsin classAbstractArtifactRepository2
-
internalRemoveDescriptors
protected void internalRemoveDescriptors(org.eclipse.equinox.p2.metadata.IArtifactKey key)
- Specified by:
internalRemoveDescriptorsin classAbstractArtifactRepository2
-
internalRemoveDescriptors
protected void internalRemoveDescriptors(org.eclipse.equinox.p2.metadata.IArtifactKey[] keys)
- Specified by:
internalRemoveDescriptorsin classAbstractArtifactRepository2
-
internalRemoveAllDescriptors
protected void internalRemoveAllDescriptors()
- Specified by:
internalRemoveAllDescriptorsin classAbstractArtifactRepository2
-
internalStore
protected void internalStore(org.eclipse.core.runtime.IProgressMonitor monitor)
- Specified by:
internalStorein classAbstractArtifactRepository2
-
newAddingArtifactSink
public IArtifactSink newAddingArtifactSink(org.eclipse.equinox.p2.metadata.IArtifactKey key) throws org.eclipse.equinox.p2.core.ProvisionException
Description copied from class:AbstractArtifactRepository2Returns a newIArtifactSinkinstance that adds the received artifact to this repository onIArtifactSink.commitWrite().- Specified by:
newAddingArtifactSinkin classAbstractArtifactRepository2- Parameters:
key- The artifact key to be added to this repository- Throws:
org.eclipse.equinox.p2.core.ProvisionException- if the artifact is already stored in the repository (in canonical format)
-
newAddingRawArtifactSink
public IRawArtifactSink newAddingRawArtifactSink(org.eclipse.equinox.p2.repository.artifact.IArtifactDescriptor descriptor) throws org.eclipse.equinox.p2.core.ProvisionException
Description copied from class:AbstractArtifactRepository2Returns a newIRawArtifactSinkinstance that adds the received artifact to this repository onIArtifactSink.commitWrite().- Specified by:
newAddingRawArtifactSinkin classAbstractArtifactRepository2- Parameters:
descriptor- The artifact descriptor to the added to this repository- Throws:
org.eclipse.equinox.p2.core.ProvisionException- if the artifact is already stored in the repository in the given format.
-
-