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 fromIRawArtifactFileProvider
toIFileArtifactRepository
.
-
-
Constructor Summary
Constructors Constructor Description ProviderOnlyArtifactRepository(IRawArtifactFileProvider delegate, org.eclipse.equinox.p2.core.IProvisioningAgent agent, URI location)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
contains(org.eclipse.equinox.p2.metadata.IArtifactKey key)
Returnstrue
if this is a provider for the given artifact.boolean
contains(org.eclipse.equinox.p2.repository.artifact.IArtifactDescriptor descriptor)
Returnstrue
if 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.IStatus
getArtifact(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.File
getArtifactFile(org.eclipse.equinox.p2.metadata.IArtifactKey key)
Returns the file system location of the given artifact.File
getArtifactFile(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.IStatus
getRawArtifact(IRawArtifactSink sink, org.eclipse.core.runtime.IProgressMonitor monitor)
Writes the requested artifact in the specified raw format to the givenIRawArtifactSink
.protected void
internalAddDescriptor(org.eclipse.equinox.p2.repository.artifact.IArtifactDescriptor descriptor)
protected void
internalRemoveAllDescriptors()
protected void
internalRemoveDescriptor(org.eclipse.equinox.p2.repository.artifact.IArtifactDescriptor descriptor)
protected void
internalRemoveDescriptors(org.eclipse.equinox.p2.metadata.IArtifactKey key)
protected void
internalRemoveDescriptors(org.eclipse.equinox.p2.metadata.IArtifactKey[] keys)
protected void
internalRemoveDescriptors(org.eclipse.equinox.p2.repository.artifact.IArtifactDescriptor[] descriptors)
protected void
internalStore(org.eclipse.core.runtime.IProgressMonitor monitor)
boolean
isModifiable()
IArtifactSink
newAddingArtifactSink(org.eclipse.equinox.p2.metadata.IArtifactKey key)
Returns a newIArtifactSink
instance that adds the received artifact to this repository onIArtifactSink.commitWrite()
.IRawArtifactSink
newAddingRawArtifactSink(org.eclipse.equinox.p2.repository.artifact.IArtifactDescriptor descriptor)
Returns a newIRawArtifactSink
instance 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
-
-
-
-
Constructor Detail
-
ProviderOnlyArtifactRepository
public ProviderOnlyArtifactRepository(IRawArtifactFileProvider delegate, org.eclipse.equinox.p2.core.IProvisioningAgent agent, URI location)
-
-
Method Detail
-
contains
public boolean contains(org.eclipse.equinox.p2.metadata.IArtifactKey key)
Description copied from interface:IArtifactProvider
Returnstrue
if this is a provider for the given artifact.- Specified by:
contains
in interfaceIArtifactProvider
- Specified by:
contains
in interfaceorg.eclipse.equinox.p2.repository.artifact.IArtifactRepository
- Specified by:
contains
in classorg.eclipse.equinox.p2.repository.artifact.spi.AbstractArtifactRepository
- Parameters:
key
- An artifact key- Returns:
true
if 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:
query
in interfaceorg.eclipse.equinox.p2.query.IQueryable<org.eclipse.equinox.p2.metadata.IArtifactKey>
-
getArtifactFile
public File getArtifactFile(org.eclipse.equinox.p2.metadata.IArtifactKey key)
Description copied from interface:IArtifactFileProvider
Returns the file system location of the given artifact.- Specified by:
getArtifactFile
in interfaceIArtifactFileProvider
- Specified by:
getArtifactFile
in interfaceorg.eclipse.equinox.p2.repository.artifact.IFileArtifactRepository
- Parameters:
key
- An artifact key- Returns:
- The location of the specified artifact, or
null
the 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:IArtifactProvider
Writes 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:
getArtifact
in 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:IRawArtifactProvider
Return the raw artifact formats in which the given artifact can be provided.- Specified by:
getArtifactDescriptors
in interfaceorg.eclipse.equinox.p2.repository.artifact.IArtifactRepository
- Specified by:
getArtifactDescriptors
in interfaceIRawArtifactProvider
- Specified by:
getArtifactDescriptors
in 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:IRawArtifactProvider
Returnstrue
if this a provider for an artifact in the given format- Specified by:
contains
in interfaceorg.eclipse.equinox.p2.repository.artifact.IArtifactRepository
- Specified by:
contains
in interfaceIRawArtifactProvider
- Specified by:
contains
in classorg.eclipse.equinox.p2.repository.artifact.spi.AbstractArtifactRepository
- Parameters:
descriptor
- An artifact descriptor- Returns:
true
if this instance can provide the artifact as raw artifact in the described format
-
getArtifactFile
public File getArtifactFile(org.eclipse.equinox.p2.repository.artifact.IArtifactDescriptor descriptor)
Description copied from interface:IRawArtifactFileProvider
Returns the file system location of the given artifact in the given format.- Specified by:
getArtifactFile
in interfaceorg.eclipse.equinox.p2.repository.artifact.IFileArtifactRepository
- Specified by:
getArtifactFile
in interfaceIRawArtifactFileProvider
- Parameters:
descriptor
- The key and format of an artifact- Returns:
- The location of the specified raw artifact, or
null
the 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:IRawArtifactProvider
Writes 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:
getRawArtifact
in 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:
descriptorQueryable
in interfaceorg.eclipse.equinox.p2.repository.artifact.IArtifactRepository
-
isModifiable
public boolean isModifiable()
- Specified by:
isModifiable
in interfaceorg.eclipse.equinox.p2.repository.IRepository<org.eclipse.equinox.p2.metadata.IArtifactKey>
- Overrides:
isModifiable
in 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:
internalAddDescriptor
in classAbstractArtifactRepository2
-
internalRemoveDescriptor
protected void internalRemoveDescriptor(org.eclipse.equinox.p2.repository.artifact.IArtifactDescriptor descriptor)
- Specified by:
internalRemoveDescriptor
in classAbstractArtifactRepository2
-
internalRemoveDescriptors
protected void internalRemoveDescriptors(org.eclipse.equinox.p2.repository.artifact.IArtifactDescriptor[] descriptors)
- Specified by:
internalRemoveDescriptors
in classAbstractArtifactRepository2
-
internalRemoveDescriptors
protected void internalRemoveDescriptors(org.eclipse.equinox.p2.metadata.IArtifactKey key)
- Specified by:
internalRemoveDescriptors
in classAbstractArtifactRepository2
-
internalRemoveDescriptors
protected void internalRemoveDescriptors(org.eclipse.equinox.p2.metadata.IArtifactKey[] keys)
- Specified by:
internalRemoveDescriptors
in classAbstractArtifactRepository2
-
internalRemoveAllDescriptors
protected void internalRemoveAllDescriptors()
- Specified by:
internalRemoveAllDescriptors
in classAbstractArtifactRepository2
-
internalStore
protected void internalStore(org.eclipse.core.runtime.IProgressMonitor monitor)
- Specified by:
internalStore
in classAbstractArtifactRepository2
-
newAddingArtifactSink
public IArtifactSink newAddingArtifactSink(org.eclipse.equinox.p2.metadata.IArtifactKey key) throws org.eclipse.equinox.p2.core.ProvisionException
Description copied from class:AbstractArtifactRepository2
Returns a newIArtifactSink
instance that adds the received artifact to this repository onIArtifactSink.commitWrite()
.- Specified by:
newAddingArtifactSink
in 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:AbstractArtifactRepository2
Returns a newIRawArtifactSink
instance that adds the received artifact to this repository onIArtifactSink.commitWrite()
.- Specified by:
newAddingRawArtifactSink
in 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.
-
-