org.apache.archiva.repository
Interface ManagedRepositoryContent

All Known Implementing Classes:
ManagedDefaultRepositoryContent, ManagedLegacyRepositoryContent

public interface ManagedRepositoryContent

ManagedRepositoryContent interface for interacting with a managed repository in an abstract way, without the need for processing based on filesystem paths, or working with the database.


Method Summary
 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.
 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)
          Given a specific ProjectReference, return the list of available versions for that project reference.
 Set<String> getVersions(VersionedReference reference)
           Given a specific VersionedReference, return the list of available versions for that versioned 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 setRepository(ManagedRepository repo)
          Set the repository configuration to associate with this repository content.
 ArtifactReference toArtifactReference(String path)
          Given a repository relative path to a filename, return the VersionedReference object suitable for the path.
 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.
 String toMetadataPath(ProjectReference reference)
          Given a ProjectReference, return the path to the metadata for the project.
 String toMetadataPath(VersionedReference reference)
          Given a VersionedReference, return the path to the metadata for the specific version of the project.
 String toPath(ArchivaArtifact reference)
          Given an ArchivaArtifact, return the relative path to the artifact.
 String toPath(ArtifactReference reference)
          Given an ArtifactReference, return the relative path to the artifact.
 

Method Detail

deleteVersion

void deleteVersion(VersionedReference reference)
                   throws ContentNotFoundException
Delete from the managed repository all files / directories associated with the provided version reference.

Parameters:
reference - the version reference to delete.
Throws:
ContentNotFoundException

deleteArtifact

void deleteArtifact(ArtifactReference artifactReference)
                    throws ContentNotFoundException
delete a specified artifact from the repository

Parameters:
artifactReference -
Throws:
ContentNotFoundException

deleteGroupId

void deleteGroupId(String groupId)
                   throws ContentNotFoundException
Parameters:
groupId -
Throws:
ContentNotFoundException
Since:
1.4-M3

deleteProject

void deleteProject(String namespace,
                   String projectId)
                   throws RepositoryException
Parameters:
namespace - groupId for maven
projectId - artifactId for maven
Throws:
ContentNotFoundException
RepositoryException

getId

String getId()

Convenience method to get the repository id.

Equivalent to calling .getRepository().getId()

Returns:
the repository id.

getRelatedArtifacts

Set<ArtifactReference> getRelatedArtifacts(ArtifactReference reference)
                                           throws ContentNotFoundException

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.

Parameters:
reference - the reference to work off of.
Returns:
the set of ArtifactReferences for related artifacts.
Throws:
ContentNotFoundException - if the initial artifact reference does not exist within the repository.
LayoutException

getRepoRoot

String getRepoRoot()

Convenience method to get the repository (on disk) root directory.

Equivalent to calling .getRepository().getLocation()

Returns:
the repository (on disk) root directory.

getRepository

ManagedRepository getRepository()
Get the repository configuration associated with this repository content.

Returns:
the repository that is associated with this repository content.

getVersions

Set<String> getVersions(ProjectReference reference)
                        throws ContentNotFoundException,
                               LayoutException
Given a specific ProjectReference, return the list of available versions for that project reference.

Parameters:
reference - the project reference to work off of.
Returns:
the list of versions found for that project reference.
Throws:
ContentNotFoundException - if the project reference does nto exist within the repository.
LayoutException

getVersions

Set<String> getVersions(VersionedReference reference)
                        throws ContentNotFoundException

Given a specific VersionedReference, return the list of available versions for that versioned reference.

NOTE: This is really only useful when working with SNAPSHOTs.

Parameters:
reference - the versioned reference to work off of.
Returns:
the set of versions found.
Throws:
ContentNotFoundException - if the versioned reference does not exist within the repository.
LayoutException

hasContent

boolean hasContent(ArtifactReference reference)
Determines if the artifact referenced exists in the repository.

Parameters:
reference - the artifact reference to check for.
Returns:
true if the artifact referenced exists.

hasContent

boolean hasContent(ProjectReference reference)
Determines if the project referenced exists in the repository.

Parameters:
reference - the project reference to check for.
Returns:
true it the project referenced exists.

hasContent

boolean hasContent(VersionedReference reference)
Determines if the version reference exists in the repository.

Parameters:
reference - the version reference to check for.
Returns:
true if the version referenced exists.

setRepository

void setRepository(ManagedRepository repo)
Set the repository configuration to associate with this repository content.

Parameters:
repo - the repository to associate with this repository content.

toArtifactReference

ArtifactReference toArtifactReference(String path)
                                      throws LayoutException
Given a repository relative path to a filename, return the VersionedReference object suitable for the path.

Parameters:
path - the path relative to the repository base dir for the artifact.
Returns:
the ArtifactReference representing the path. (or null if path cannot be converted to a ArtifactReference)
Throws:
LayoutException - if there was a problem converting the path to an artifact.

toFile

File toFile(ArtifactReference reference)
Given an ArtifactReference, return the file reference to the artifact.

Parameters:
reference - the artifact reference to use.
Returns:
the relative path to the artifact.

toFile

File toFile(ArchivaArtifact reference)
Given an ArchivaArtifact, return the file reference to the artifact.

Parameters:
reference - the archiva artifact to use.
Returns:
the relative path to the artifact.

toMetadataPath

String toMetadataPath(ProjectReference reference)
Given a ProjectReference, return the path to the metadata for the project.

Parameters:
reference - the reference to use.
Returns:
the path to the metadata file, or null if no metadata is appropriate.

toMetadataPath

String toMetadataPath(VersionedReference reference)
Given a VersionedReference, return the path to the metadata for the specific version of the project.

Parameters:
reference - the reference to use.
Returns:
the path to the metadata file, or null if no metadata is appropriate.

toPath

String toPath(ArtifactReference reference)
Given an ArtifactReference, return the relative path to the artifact.

Parameters:
reference - the artifact reference to use.
Returns:
the relative path to the artifact.

toPath

String toPath(ArchivaArtifact reference)
Given an ArchivaArtifact, return the relative path to the artifact.

Parameters:
reference - the archiva artifact to use.
Returns:
the relative path to the artifact.


Copyright © 2006-2013 The Apache Software Foundation. All Rights Reserved.