public class MirroringArtifactProvider extends Object implements IRawArtifactFileProvider
IRawArtifactFileProvider
which caches all accessed artifacts in the local Maven
repository.
Note that a MirroringArtifactProvider is not a transparent cache of the remote providers. The content provided by this instance differs from the remote providers' content in the following ways:
Modifier and Type | Class and Description |
---|---|
static class |
MirroringArtifactProvider.MirroringFailedException |
Modifier and Type | Field and Description |
---|---|
protected LocalArtifactRepository |
localArtifactRepository |
protected MavenLogger |
logger |
protected org.eclipse.core.runtime.IProgressMonitor |
monitor |
protected IRawArtifactProvider |
remoteProviders |
protected MavenLogger |
splittingLogger |
Modifier and Type | Method and Description |
---|---|
boolean |
contains(org.eclipse.equinox.p2.repository.artifact.IArtifactDescriptor descriptor)
Returns
true if this a provider for an artifact in the given format |
boolean |
contains(org.eclipse.equinox.p2.metadata.IArtifactKey key)
Returns
true if this is a provider for the given artifact. |
static MirroringArtifactProvider |
createInstance(LocalArtifactRepository localArtifactRepository,
IRawArtifactProvider remoteProviders,
boolean mirrorPacked,
MavenLogger logger)
Creates a new
MirroringArtifactProvider instance. |
protected void |
downloadArtifact(org.eclipse.equinox.p2.metadata.IArtifactKey key) |
protected org.eclipse.core.runtime.IStatus |
downloadCanonicalArtifact(org.eclipse.equinox.p2.metadata.IArtifactKey key) |
protected org.eclipse.core.runtime.IStatus |
downloadMostSpecificNeededFormatOfArtifact(org.eclipse.equinox.p2.metadata.IArtifactKey key) |
org.eclipse.core.runtime.IStatus |
getArtifact(IArtifactSink sink,
org.eclipse.core.runtime.IProgressMonitor monitor)
Writes the requested artifact to the given
IArtifactSink . |
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.repository.artifact.IArtifactDescriptor descriptor)
Returns the file system location of the given artifact in the given format.
|
File |
getArtifactFile(org.eclipse.equinox.p2.metadata.IArtifactKey key)
Returns the file system location of the given artifact.
|
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 given
IRawArtifactSink . |
protected boolean |
makeOneFormatLocallyAvailable(org.eclipse.equinox.p2.metadata.IArtifactKey key) |
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) |
protected final MavenLogger logger
protected final MavenLogger splittingLogger
protected final IRawArtifactProvider remoteProviders
protected final LocalArtifactRepository localArtifactRepository
protected final org.eclipse.core.runtime.IProgressMonitor monitor
public static MirroringArtifactProvider createInstance(LocalArtifactRepository localArtifactRepository, IRawArtifactProvider remoteProviders, boolean mirrorPacked, MavenLogger logger)
MirroringArtifactProvider
instance.localArtifactRepository
- The local Maven repositoryremoteProviders
- The provider that will be queried by this instance when it is asked for an
artifact which is not (yet) available in the local Maven repository. Typically
this provider is backed by remote p2 repositories.mirrorPacked
- If true
, the returned instance will also mirror the packed format of
all artifacts it is asked for.logger
- a logger for progress outputpublic final boolean contains(org.eclipse.equinox.p2.metadata.IArtifactKey key)
IArtifactProvider
true
if this is a provider for the given artifact.contains
in interface IArtifactProvider
key
- An artifact keytrue
if this instance can provide the artifact for the given keypublic final 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)
query
in interface org.eclipse.equinox.p2.query.IQueryable<org.eclipse.equinox.p2.metadata.IArtifactKey>
public final File getArtifactFile(org.eclipse.equinox.p2.metadata.IArtifactKey key) throws MirroringArtifactProvider.MirroringFailedException
IArtifactFileProvider
getArtifactFile
in interface IArtifactFileProvider
key
- An artifact keynull
the given artifact does
not exist.MirroringArtifactProvider.MirroringFailedException
public final File getArtifactFile(org.eclipse.equinox.p2.repository.artifact.IArtifactDescriptor descriptor) throws MirroringArtifactProvider.MirroringFailedException
IRawArtifactFileProvider
getArtifactFile
in interface IRawArtifactFileProvider
descriptor
- The key and format of an artifactnull
the that artifact
does not exist in the given format.MirroringArtifactProvider.MirroringFailedException
public final org.eclipse.core.runtime.IStatus getArtifact(IArtifactSink sink, org.eclipse.core.runtime.IProgressMonitor monitor) throws ArtifactSinkException, MirroringArtifactProvider.MirroringFailedException
IArtifactProvider
IArtifactSink
.
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.
getArtifact
in interface IArtifactProvider
sink
- A sink for a specific artifact. When this method returns, the sink will either be
closed (with IArtifactSink.commitWrite()
or
IArtifactSink.abortWrite()
, depending on the status), or not have received
any content.monitor
- A progress monitor, or null
ArtifactSinkException
- if that exception is thrown by the given IArtifactSink
MirroringArtifactProvider.MirroringFailedException
IArtifactSink.getArtifactToBeWritten()
public final org.eclipse.core.runtime.IStatus getRawArtifact(IRawArtifactSink sink, org.eclipse.core.runtime.IProgressMonitor monitor) throws ArtifactSinkException, MirroringArtifactProvider.MirroringFailedException
IRawArtifactProvider
IRawArtifactSink
.
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.
getRawArtifact
in interface IRawArtifactProvider
sink
- A sink for a specific artifact in a specific format. When this method returns, the
sink will either be closed (with IArtifactSink.commitWrite()
or
IArtifactSink.abortWrite()
, depending on the status), or not have
received any content.monitor
- A progress monitor, or null
ArtifactSinkException
- if that exception is thrown by the given IArtifactSink
MirroringArtifactProvider.MirroringFailedException
IArtifactSink.getArtifactToBeWritten()
,
IRawArtifactSink.getArtifactFormatToBeWritten()
public final org.eclipse.equinox.p2.repository.artifact.IArtifactDescriptor[] getArtifactDescriptors(org.eclipse.equinox.p2.metadata.IArtifactKey key) throws MirroringArtifactProvider.MirroringFailedException
IRawArtifactProvider
getArtifactDescriptors
in interface IRawArtifactProvider
key
- An artifact keyMirroringArtifactProvider.MirroringFailedException
public final boolean contains(org.eclipse.equinox.p2.repository.artifact.IArtifactDescriptor descriptor) throws MirroringArtifactProvider.MirroringFailedException
IRawArtifactProvider
true
if this a provider for an artifact in the given formatcontains
in interface IRawArtifactProvider
descriptor
- An artifact descriptortrue
if this instance can provide the artifact as raw artifact in the
described formatMirroringArtifactProvider.MirroringFailedException
protected boolean makeOneFormatLocallyAvailable(org.eclipse.equinox.p2.metadata.IArtifactKey key) throws MirroringArtifactProvider.MirroringFailedException, org.eclipse.equinox.p2.core.ProvisionException, ArtifactSinkException
MirroringArtifactProvider.MirroringFailedException
org.eclipse.equinox.p2.core.ProvisionException
ArtifactSinkException
protected final void downloadArtifact(org.eclipse.equinox.p2.metadata.IArtifactKey key) throws MirroringArtifactProvider.MirroringFailedException, org.eclipse.equinox.p2.core.ProvisionException, ArtifactSinkException
MirroringArtifactProvider.MirroringFailedException
org.eclipse.equinox.p2.core.ProvisionException
ArtifactSinkException
protected org.eclipse.core.runtime.IStatus downloadMostSpecificNeededFormatOfArtifact(org.eclipse.equinox.p2.metadata.IArtifactKey key) throws org.eclipse.equinox.p2.core.ProvisionException, ArtifactSinkException
org.eclipse.equinox.p2.core.ProvisionException
ArtifactSinkException
protected final org.eclipse.core.runtime.IStatus downloadCanonicalArtifact(org.eclipse.equinox.p2.metadata.IArtifactKey key) throws org.eclipse.equinox.p2.core.ProvisionException, ArtifactSinkException
org.eclipse.equinox.p2.core.ProvisionException
ArtifactSinkException
Copyright © 2008-2016 Eclipse Foundation. All Rights Reserved.