public interface ArtifactStore extends Serializable
Artifacts and can provide Metadata about the artifacts that it holds.| Modifier and Type | Method and Description |
|---|---|
InputStream |
get(Artifact artifact)
Retrieves the the artifact as an
InputStream. |
org.apache.maven.archetype.catalog.ArchetypeCatalog |
getArchetypeCatalog() |
long |
getArchetypeCatalogLastModified() |
Set<String> |
getArtifactIds(String groupId)
Returns the set of artifactIds that belong in the specified groupId.
|
Set<Artifact> |
getArtifacts(String groupId,
String artifactId,
String version)
Returns the set of artifacts at the specified groupId:artifactId:version.
|
Set<String> |
getGroupIds(String parentGroupId)
Returns the set of groupIds that begin with the specified prefix.
|
long |
getLastModified(Artifact artifact)
Returns the time that the specified artifact was last modified.
|
org.apache.maven.artifact.repository.metadata.Metadata |
getMetadata(String path)
Returns the specified metadata.
|
long |
getMetadataLastModified(String path)
Returns the time that the specified metadata was last modified.
|
long |
getSize(Artifact artifact)
Returns the size in bytes of the specified artifact.
|
Set<String> |
getVersions(String groupId,
String artifactId)
Returns the set of versions of the specified groupId:artifactId.
|
void |
set(Artifact artifact,
InputStream content)
Create/update the specified artifact.
|
void |
setArchetypeCatalog(InputStream content) |
void |
setMetadata(String path,
org.apache.maven.artifact.repository.metadata.Metadata content)
Create/update the specified metadata.
|
Set<String> getGroupIds(String parentGroupId)
Returns the set of groupIds that begin with the specified prefix. Some implementations may be lazy caching
implementations, in which case it is permitted to return either the empty set, or only those entries which
have been loaded into the cache, so consumers should not assume that a missing entry implies non-existence.
The only way to be sure that an artifact does not exist is to call the get(Artifact) method.
// Query root level
assertEquals(new HashSet<String>(Arrays.asList("commons-io","org")), getGroupIds(""));
// query with a prefix
assertEquals(new HashSet<String>(Arrays.asList("org.codehaus", "org.apache")), getGroupIds("org"));
assertEquals(new HashSet<String>(Arrays.asList("org.codehaus.mojo")), getGroupIds("org.codehaus"));
Note that while the existence of groupId org.codehaus.mojo implies that there must be groupIds
org and org.codehaus there is no requirement that an implementation should
report these inferred parent groupIds, it is just strongly encouraged.
parentGroupId - The prefix to query or the empty string to query the root, cannot be null.String) of groupIds that are known to have
parentGroupId as their prefix. All returned elements must start with parentGroupId and must have
one and only one additional segment.Set<String> getArtifactIds(String groupId)
Returns the set of artifactIds that belong in the specified groupId. Some implementations may be lazy caching
implementations, in which case it is permitted to return either the empty set, or only those entries which
have been loaded into the cache, so consumers should not assume that a missing entry implies non-existence.
The only way to be sure that an artifact does not exist is to call the get(Artifact) method.
groupId - The groupId to query cannot be empty or null.String) of artifactIds that are known to belong to
groupId.Set<String> getVersions(String groupId, String artifactId)
Returns the set of versions of the specified groupId:artifactId. Some implementations may be lazy caching
implementations, in which case it is permitted to return either the empty set, or only those entries which
have been loaded into the cache, so consumers should not assume that a missing entry implies non-existence.
The only way to be sure that an artifact does not exist is to call the get(Artifact) method.
groupId - The groupId to query cannot be empty or null.artifactId - The artifactId to query cannot be empty or null.String) of versions that are known to exist for
groupId:artifactId.Set<Artifact> getArtifacts(String groupId, String artifactId, String version)
get(Artifact) method.groupId - The groupId to query cannot be empty or null.artifactId - The artifactId to query cannot be empty or null.version - The version to query cannot be empty or null.Artifact of artifacts that are known to exist of the
specified groupId:artifactId:version.long getLastModified(Artifact artifact) throws IOException, ArtifactNotFoundException
artifact - the artifact.long value representing the time the file was
last modified, measured in milliseconds since the epoch
(00:00:00 GMT, January 1, 1970), or 0L if the
artifact might not exist (where the artifact is known to not exist an
ArtifactNotFoundException must be thrown.IOException - if an I/O error occurs.ArtifactNotFoundException - if the artifact definitely does not exist.long getSize(Artifact artifact) throws IOException, ArtifactNotFoundException
artifact - the artifact.-1L if the length cannot be determined.IOException - if an I/O error occurs.ArtifactNotFoundException - if the artifact definitely does not exist.InputStream get(Artifact artifact) throws IOException, ArtifactNotFoundException
InputStream. The caller is responsible for closing the stream.artifact - the artifact.IOException - if the artifact could not be retrieved.ArtifactNotFoundException - if the artifact does not exist.void set(Artifact artifact, InputStream content) throws IOException
artifact - the artifact to create/update.content - the stream of contents (implementer is responsible for closing).IOException - if the content could not be read/written.UnsupportedOperationException - if the implementation is a read-only implementation.org.apache.maven.artifact.repository.metadata.Metadata getMetadata(String path) throws IOException, MetadataNotFoundException
path - of the metadata (should not include the maven-metadata.xml.null.IOException - if an I/O error occurs.MetadataNotFoundException - if the metadata does not exist.void setMetadata(String path, org.apache.maven.artifact.repository.metadata.Metadata content) throws IOException
path - of the metadata (should not include the maven-metadata.xml.content - the metadata, never null.IOException - if an I/O error occurs.long getMetadataLastModified(String path) throws IOException, MetadataNotFoundException
path - of the metadata (should not include the maven-metadata.xml.long value representing the time the file was
last modified, measured in milliseconds since the epoch
(00:00:00 GMT, January 1, 1970), or 0L if the
metadata might not exist (where the metadtat is known to not exist a
MetadataNotFoundException must be thrown.IOException - if an I/O error occurs.MetadataNotFoundException - if the metadata definitely does not exist.org.apache.maven.archetype.catalog.ArchetypeCatalog getArchetypeCatalog()
throws IOException,
ArchetypeCatalogNotFoundException
IOException - if an I/O error occurs.ArchetypeCatalogNotFoundException - if the archetypeCatalog does not exist.long getArchetypeCatalogLastModified()
throws IOException,
ArchetypeCatalogNotFoundException
IOException - if an I/O error occurs.ArchetypeCatalogNotFoundException - if the archetypeCatalog does not exist.void setArchetypeCatalog(InputStream content) throws IOException
content - the contentIOException - if an I/O error occurs.Copyright © 2009–2022 MojoHaus. All rights reserved.