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)
IArtifactProvidertrue if this is a provider for the given artifact.contains in interface IArtifactProviderkey - 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
IArtifactFileProvidergetArtifactFile in interface IArtifactFileProviderkey - An artifact keynull the given artifact does
not exist.MirroringArtifactProvider.MirroringFailedExceptionpublic final File getArtifactFile(org.eclipse.equinox.p2.repository.artifact.IArtifactDescriptor descriptor) throws MirroringArtifactProvider.MirroringFailedException
IRawArtifactFileProvidergetArtifactFile in interface IRawArtifactFileProviderdescriptor - The key and format of an artifactnull the that artifact
does not exist in the given format.MirroringArtifactProvider.MirroringFailedExceptionpublic final org.eclipse.core.runtime.IStatus getArtifact(IArtifactSink sink, org.eclipse.core.runtime.IProgressMonitor monitor) throws ArtifactSinkException, MirroringArtifactProvider.MirroringFailedException
IArtifactProviderIArtifactSink.
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 IArtifactProvidersink - 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 nullArtifactSinkException - if that exception is thrown by the given IArtifactSinkMirroringArtifactProvider.MirroringFailedExceptionIArtifactSink.getArtifactToBeWritten()public final org.eclipse.core.runtime.IStatus getRawArtifact(IRawArtifactSink sink, org.eclipse.core.runtime.IProgressMonitor monitor) throws ArtifactSinkException, MirroringArtifactProvider.MirroringFailedException
IRawArtifactProviderIRawArtifactSink.
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 IRawArtifactProvidersink - 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 nullArtifactSinkException - if that exception is thrown by the given IArtifactSinkMirroringArtifactProvider.MirroringFailedExceptionIArtifactSink.getArtifactToBeWritten(),
IRawArtifactSink.getArtifactFormatToBeWritten()public final org.eclipse.equinox.p2.repository.artifact.IArtifactDescriptor[] getArtifactDescriptors(org.eclipse.equinox.p2.metadata.IArtifactKey key)
throws MirroringArtifactProvider.MirroringFailedException
IRawArtifactProvidergetArtifactDescriptors in interface IRawArtifactProviderkey - An artifact keyMirroringArtifactProvider.MirroringFailedExceptionpublic final boolean contains(org.eclipse.equinox.p2.repository.artifact.IArtifactDescriptor descriptor)
throws MirroringArtifactProvider.MirroringFailedException
IRawArtifactProvidertrue if this a provider for an artifact in the given formatcontains in interface IRawArtifactProviderdescriptor - An artifact descriptortrue if this instance can provide the artifact as raw artifact in the
described formatMirroringArtifactProvider.MirroringFailedExceptionprotected boolean makeOneFormatLocallyAvailable(org.eclipse.equinox.p2.metadata.IArtifactKey key)
throws MirroringArtifactProvider.MirroringFailedException,
org.eclipse.equinox.p2.core.ProvisionException,
ArtifactSinkException
MirroringArtifactProvider.MirroringFailedExceptionorg.eclipse.equinox.p2.core.ProvisionExceptionArtifactSinkExceptionprotected final void downloadArtifact(org.eclipse.equinox.p2.metadata.IArtifactKey key)
throws MirroringArtifactProvider.MirroringFailedException,
org.eclipse.equinox.p2.core.ProvisionException,
ArtifactSinkException
MirroringArtifactProvider.MirroringFailedExceptionorg.eclipse.equinox.p2.core.ProvisionExceptionArtifactSinkExceptionprotected 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.ProvisionExceptionArtifactSinkExceptionprotected 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.ProvisionExceptionArtifactSinkExceptionCopyright © 2008-2015 Eclipse Foundation. All Rights Reserved.