Package org.apache.maven.buildcache
Class RemoteCacheRepositoryImpl
- java.lang.Object
-
- org.apache.maven.buildcache.RemoteCacheRepositoryImpl
-
- All Implemented Interfaces:
Closeable
,AutoCloseable
,CacheRepository
,RemoteCacheRepository
@Named("resolver") public class RemoteCacheRepositoryImpl extends Object implements RemoteCacheRepository, Closeable
Remote cache repository implementation.
-
-
Field Summary
-
Fields inherited from interface org.apache.maven.buildcache.RemoteCacheRepository
BUILDINFO_XML, CACHE_REPORT_XML
-
-
Constructor Summary
Constructors Constructor Description RemoteCacheRepositoryImpl(XmlService xmlService, CacheConfig cacheConfig, org.apache.maven.execution.MavenSession mavenSession, org.eclipse.aether.spi.connector.transport.TransporterProvider transporterProvider)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
Optional<Build>
findBaselineBuild(org.apache.maven.project.MavenProject project)
Optional<Build>
findBuild(CacheContext context)
boolean
getArtifactContent(CacheContext context, Artifact artifact, Path target)
Download an artifact to the given location.Optional<byte[]>
getResourceContent(String url)
Downloads content of the resourceboolean
getResourceContent(String url, Path target)
String
getResourceUrl(CacheContext context, String filename)
void
saveArtifactFile(CacheResult cacheResult, org.apache.maven.artifact.Artifact artifact)
void
saveBuildInfo(CacheResult cacheResult, Build build)
void
saveCacheReport(String buildId, org.apache.maven.execution.MavenSession session, CacheReport cacheReport)
-
-
-
Constructor Detail
-
RemoteCacheRepositoryImpl
@Inject public RemoteCacheRepositoryImpl(XmlService xmlService, CacheConfig cacheConfig, org.apache.maven.execution.MavenSession mavenSession, org.eclipse.aether.spi.connector.transport.TransporterProvider transporterProvider) throws Exception
- Throws:
Exception
-
-
Method Detail
-
close
public void close() throws IOException
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Throws:
IOException
-
findBuild
@Nonnull public Optional<Build> findBuild(CacheContext context) throws IOException
- Specified by:
findBuild
in interfaceCacheRepository
- Throws:
IOException
-
getArtifactContent
public boolean getArtifactContent(CacheContext context, Artifact artifact, Path target)
Description copied from interface:RemoteCacheRepository
Download an artifact to the given location. Returnstrue
if success,false
if the artifact does not exists and throws anIOException
if a problem occurs.- Specified by:
getArtifactContent
in interfaceRemoteCacheRepository
-
saveBuildInfo
public void saveBuildInfo(CacheResult cacheResult, Build build) throws IOException
- Specified by:
saveBuildInfo
in interfaceCacheRepository
- Throws:
IOException
-
saveCacheReport
public void saveCacheReport(String buildId, org.apache.maven.execution.MavenSession session, CacheReport cacheReport) throws IOException
- Specified by:
saveCacheReport
in interfaceCacheRepository
- Throws:
IOException
-
saveArtifactFile
public void saveArtifactFile(CacheResult cacheResult, org.apache.maven.artifact.Artifact artifact) throws IOException
- Specified by:
saveArtifactFile
in interfaceCacheRepository
- Throws:
IOException
-
getResourceContent
@Nonnull public Optional<byte[]> getResourceContent(String url)
Downloads content of the resource- Returns:
- null or content
-
getResourceUrl
@Nonnull public String getResourceUrl(CacheContext context, String filename)
- Specified by:
getResourceUrl
in interfaceRemoteCacheRepository
-
findBaselineBuild
@Nonnull public Optional<Build> findBaselineBuild(org.apache.maven.project.MavenProject project)
- Specified by:
findBaselineBuild
in interfaceRemoteCacheRepository
-
-