Class CacheProcess
java.lang.Object
org.savantbuild.dep.workflow.process.CacheProcess
- All Implemented Interfaces:
Process
This is an implementation of the Process that uses local caches to fetch and publish artifacts.
It manages up to three cache directories: one for Savant-sourced artifacts, one for integration-version
artifacts, and one for Maven-sourced artifacts. Any directory can be null to disable that cache.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionCacheProcess(org.savantbuild.output.Output output, String savantDir, String integrationDir, String mavenDir) -
Method Summary
Modifier and TypeMethodDescriptionfetch(ResolvableItem item, PublishWorkflow publishWorkflow) Checks the cache directories for the item.publish(FetchResult fetchResult) Publishes the given artifact item into the appropriate cache.toString()
-
Field Details
-
integrationDir
-
mavenDir
-
output
public final org.savantbuild.output.Output output -
savantDir
-
-
Constructor Details
-
CacheProcess
-
-
Method Details
-
fetch
public FetchResult fetch(ResolvableItem item, PublishWorkflow publishWorkflow) throws NegativeCacheException Checks the cache directories for the item. Tries the Savant cache first (tagging hits as SAVANT), then the Maven cache (tagging hits as MAVEN). If found in either, the result is returned. If not found in either, null is returned.- Specified by:
fetchin interfaceProcess- Parameters:
item- The item being fetched.publishWorkflow- The PublishWorkflow that is used to store the item if it can be found.- Returns:
- The FetchResult from the cache or null if it doesn't exist.
- Throws:
NegativeCacheException- If there is a negative cache record of the file, meaning it doesn't exist anywhere in the world.
-
publish
Publishes the given artifact item into the appropriate cache. Items are routed based on the FetchResult's source: SAVANT items go to savantDir, MAVEN items go to mavenDir. Returns null if the relevant directory is null or the source doesn't match either cache.- Specified by:
publishin interfaceProcess- Parameters:
fetchResult- The fetch result containing the item, file, and source.- Returns:
- The path to the published file, or null if the source doesn't match.
- Throws:
ProcessFailureException- If the publish fails.
-
toString
-