@Service(value="managedRepositoryContent#default") @Scope(value="prototype") public class ManagedDefaultRepositoryContent extends AbstractDefaultRepositoryContent implements ManagedRepositoryContent
Modifier and Type | Field and Description |
---|---|
private FileTypes |
filetypes |
private ManagedRepository |
repository |
ARTIFACT_SEPARATOR, artifactMappingProviders, GROUP_SEPARATOR, log, MAVEN_METADATA, PATH_SEPARATOR
Constructor and Description |
---|
ManagedDefaultRepositoryContent() |
Modifier and Type | Method and Description |
---|---|
void |
deleteArtifact(ArtifactReference artifactReference)
delete a specified artifact from the repository
|
void |
deleteGroupId(String groupId) |
void |
deleteProject(String namespace,
String projectId) |
void |
deleteVersion(VersionedReference reference)
Delete from the managed repository all files / directories associated with the
provided version reference.
|
private ArtifactReference |
getFirstArtifact(VersionedReference reference)
Get the first Artifact found in the provided VersionedReference location.
|
String |
getId()
Convenience method to get the repository id.
|
Set<ArtifactReference> |
getRelatedArtifacts(ArtifactReference reference)
Gather up the list of related artifacts to the ArtifactReference provided.
|
String |
getRepoRoot()
Convenience method to get the repository (on disk) root directory.
|
ManagedRepository |
getRepository()
Get the repository configuration associated with this
repository content.
|
Set<String> |
getVersions(ProjectReference reference)
Gather the Available Versions (on disk) for a specific Project Reference, based on filesystem
information.
|
Set<String> |
getVersions(VersionedReference reference)
Given a specific
VersionedReference , return the list of available versions for that
versioned reference. |
private boolean |
hasArtifact(VersionedReference reference) |
boolean |
hasContent(ArtifactReference reference)
Determines if the artifact referenced exists in the repository.
|
boolean |
hasContent(ProjectReference reference)
Determines if the project referenced exists in the repository.
|
boolean |
hasContent(VersionedReference reference)
Determines if the version reference exists in the repository.
|
void |
setFiletypes(FileTypes filetypes) |
void |
setRepository(ManagedRepository repository)
Set the repository configuration to associate with this
repository content.
|
ArtifactReference |
toArtifactReference(String path)
Convert a path to an artifact reference.
|
File |
toFile(ArchivaArtifact reference)
Given an
ArchivaArtifact , return the file reference to the artifact. |
File |
toFile(ArtifactReference reference)
Given an
ArtifactReference , return the file reference to the artifact. |
initialize, toMetadataPath, toMetadataPath, toPath, toPath
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
toMetadataPath, toMetadataPath, toPath, toPath
private ManagedRepository repository
public ManagedDefaultRepositoryContent()
public void deleteVersion(VersionedReference reference)
ManagedRepositoryContent
deleteVersion
in interface ManagedRepositoryContent
reference
- the version reference to delete.public void deleteProject(String namespace, String projectId) throws RepositoryException, ContentNotFoundException
deleteProject
in interface ManagedRepositoryContent
namespace
- groupId for mavenprojectId
- artifactId for mavenContentNotFoundException
RepositoryException
public void deleteArtifact(ArtifactReference artifactReference)
ManagedRepositoryContent
deleteArtifact
in interface ManagedRepositoryContent
public void deleteGroupId(String groupId) throws ContentNotFoundException
deleteGroupId
in interface ManagedRepositoryContent
ContentNotFoundException
public String getId()
ManagedRepositoryContent
Convenience method to get the repository id.
Equivalent to calling .getRepository().getId()
getId
in interface ManagedRepositoryContent
public Set<ArtifactReference> getRelatedArtifacts(ArtifactReference reference) throws ContentNotFoundException
ManagedRepositoryContent
Gather up the list of related artifacts to the ArtifactReference provided. This typically inclues the pom files, and those things with classifiers (such as doc, source code, test libs, etc...)
NOTE: Some layouts (such as maven 1 "legacy") are not compatible with this query.
getRelatedArtifacts
in interface ManagedRepositoryContent
reference
- the reference to work off of.ContentNotFoundException
- if the initial artifact reference does not exist within the repository.public String getRepoRoot()
ManagedRepositoryContent
Convenience method to get the repository (on disk) root directory.
Equivalent to calling .getRepository().getLocation()
getRepoRoot
in interface ManagedRepositoryContent
public ManagedRepository getRepository()
ManagedRepositoryContent
getRepository
in interface ManagedRepositoryContent
public Set<String> getVersions(ProjectReference reference) throws ContentNotFoundException, LayoutException
getVersions
in interface ManagedRepositoryContent
reference
- the project reference to work off of.LayoutException
LayoutException
ContentNotFoundException
- if the project reference does nto exist within the repository.public Set<String> getVersions(VersionedReference reference) throws ContentNotFoundException
ManagedRepositoryContent
Given a specific VersionedReference
, return the list of available versions for that
versioned reference.
NOTE: This is really only useful when working with SNAPSHOTs.
getVersions
in interface ManagedRepositoryContent
reference
- the versioned reference to work off of.ContentNotFoundException
- if the versioned reference does not exist within the repository.public boolean hasContent(ArtifactReference reference)
ManagedRepositoryContent
hasContent
in interface ManagedRepositoryContent
reference
- the artifact reference to check for.public boolean hasContent(ProjectReference reference)
ManagedRepositoryContent
hasContent
in interface ManagedRepositoryContent
reference
- the project reference to check for.public boolean hasContent(VersionedReference reference)
ManagedRepositoryContent
hasContent
in interface ManagedRepositoryContent
reference
- the version reference to check for.public void setRepository(ManagedRepository repository)
ManagedRepositoryContent
setRepository
in interface ManagedRepositoryContent
repository
- the repository to associate with this repository content.public ArtifactReference toArtifactReference(String path) throws LayoutException
toArtifactReference
in interface ManagedRepositoryContent
toArtifactReference
in class AbstractDefaultRepositoryContent
path
- the path to convert. (relative or full location path)ArtifactReference
representing the path. (or null if path cannot be converted to
a ArtifactReference
)LayoutException
- if the path cannot be converted to an artifact reference.public File toFile(ArtifactReference reference)
ManagedRepositoryContent
ArtifactReference
, return the file reference to the artifact.toFile
in interface ManagedRepositoryContent
reference
- the artifact reference to use.public File toFile(ArchivaArtifact reference)
ManagedRepositoryContent
ArchivaArtifact
, return the file reference to the artifact.toFile
in interface ManagedRepositoryContent
reference
- the archiva artifact to use.private ArtifactReference getFirstArtifact(VersionedReference reference) throws LayoutException, IOException
reference
- the reference to the versioned reference to search withinIOException
- if the versioned reference is invalid (example: doesn't exist, or isn't a directory)LayoutException
private boolean hasArtifact(VersionedReference reference) throws LayoutException
LayoutException
public void setFiletypes(FileTypes filetypes)
Copyright © 2006–2022 The Apache Software Foundation. All rights reserved.