Package aQute.bnd.maven.support
Class MavenEntry
- java.lang.Object
-
- aQute.bnd.maven.support.MavenEntry
-
- All Implemented Interfaces:
java.io.Closeable,java.lang.AutoCloseable
public class MavenEntry extends java.lang.Object implements java.io.CloseableAn entry (a group/artifact) in the maven cache in the .m2/repository directory. It provides methods to get the pom and the artifact.
-
-
Field Summary
Fields Modifier and Type Field Description (package private) java.util.concurrent.FutureTask<java.io.File>artifact(package private) java.io.FileartifactFile(package private) java.lang.StringartifactPath(package private) java.io.Filedir(package private) DirectoryLocklock(package private) Mavenmaven(package private) java.lang.Stringpath(package private) java.io.FilepomFile(package private) java.lang.StringpomPath(package private) java.util.Map<java.net.URI,CachedPom>poms(package private) UTF8Propertiespropertiesprivate booleanpropertiesChanged(package private) java.io.FilepropertiesFile(package private) Reporterreporter(package private) java.io.Fileroot
-
Constructor Summary
Constructors Constructor Description MavenEntry(Maven maven, java.lang.String path)Constructor.MavenEntry(Maven maven, java.lang.String path, Reporter reporter)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()private CachedPomcreatePom(java.net.URI url)Help function to create the POM and record its source.(package private) booleandownload(java.net.URI repo, java.lang.String path)Download a resource from the given repo.java.io.FilegetArtifact()java.io.FilegetArtifactFile()CachedPomgetPom(java.net.URI[] urls)This is the method to get the POM for a cached entry.java.io.FilegetPomFile()protected java.util.PropertiesgetProperties()Answer the properties, loading if needed.private java.lang.StringgetProperty(java.lang.String key)Answer a property.private booleanisValid()Check if this is a valid cache directory, might probably need some more stuff.voidremove()private voidsaveProperties()private voidsetProperty(java.lang.String key, java.lang.String value)We maintain a set of bnd properties in the cache directory.(package private) java.net.URLtoURL(java.net.URI base, java.lang.String path)Converts a repo + path to a URL..(package private) booleanverify(java.net.URI repo, java.lang.String path)Verify that the repo has a checksum file for the given path and that this checksum matchs.private booleanverify(java.net.URI repo, java.lang.String path, java.lang.String algorithm)Verify the path against its digest for the given algorithm.
-
-
-
Field Detail
-
maven
final Maven maven
-
root
final java.io.File root
-
dir
final java.io.File dir
-
path
final java.lang.String path
-
lock
final DirectoryLock lock
-
poms
final java.util.Map<java.net.URI,CachedPom> poms
-
pomFile
final java.io.File pomFile
-
artifactFile
final java.io.File artifactFile
-
pomPath
final java.lang.String pomPath
-
propertiesFile
final java.io.File propertiesFile
-
reporter
final Reporter reporter
-
properties
UTF8Properties properties
-
propertiesChanged
private boolean propertiesChanged
-
artifact
java.util.concurrent.FutureTask<java.io.File> artifact
-
artifactPath
java.lang.String artifactPath
-
-
Method Detail
-
getArtifactFile
public java.io.File getArtifactFile()
-
getPom
public CachedPom getPom(java.net.URI[] urls) throws java.lang.Exception
This is the method to get the POM for a cached entry.- Parameters:
urls- The allowed URLs- Returns:
- a CachedPom for this maven entry
- Throws:
java.lang.Exception- If something goes haywire
-
download
boolean download(java.net.URI repo, java.lang.String path) throws java.net.MalformedURLExceptionDownload a resource from the given repo.- Parameters:
repo- The base url for the repopath- The path part- Throws:
java.net.MalformedURLException
-
toURL
java.net.URL toURL(java.net.URI base, java.lang.String path) throws java.net.MalformedURLExceptionConverts a repo + path to a URL..- Parameters:
base- The base repopath- The path in the directory + url- Returns:
- a URL that points to the file in the repo
- Throws:
java.net.MalformedURLException
-
isValid
private boolean isValid()
Check if this is a valid cache directory, might probably need some more stuff.- Returns:
- true if valid
-
setProperty
private void setProperty(java.lang.String key, java.lang.String value)We maintain a set of bnd properties in the cache directory.- Parameters:
key- The key for the propertyvalue- The value for the property
-
getProperties
protected java.util.Properties getProperties()
Answer the properties, loading if needed.
-
getProperty
private java.lang.String getProperty(java.lang.String key)
Answer a property.- Parameters:
key- The key- Returns:
- The value
-
saveProperties
private void saveProperties() throws java.io.IOException- Throws:
java.io.IOException
-
createPom
private CachedPom createPom(java.net.URI url) throws java.lang.Exception
Help function to create the POM and record its source.- Parameters:
url- the repo from which it was constructed- Returns:
- the new pom
- Throws:
java.lang.Exception
-
verify
boolean verify(java.net.URI repo, java.lang.String path) throws java.lang.ExceptionVerify that the repo has a checksum file for the given path and that this checksum matchs.- Parameters:
repo- The repopath- The file id- Returns:
- true if there is a digest and it matches one of the algorithms
- Throws:
java.lang.Exception
-
verify
private boolean verify(java.net.URI repo, java.lang.String path, java.lang.String algorithm) throws java.lang.ExceptionVerify the path against its digest for the given algorithm.- Parameters:
repo-path-algorithm-- Throws:
java.lang.Exception
-
getArtifact
public java.io.File getArtifact() throws java.lang.Exception- Throws:
java.lang.Exception
-
getPomFile
public java.io.File getPomFile()
-
close
public void close() throws java.io.IOException- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.io.Closeable- Throws:
java.io.IOException
-
remove
public void remove()
-
-