org.apache.archiva.repository.content.legacy
Class ManagedLegacyRepositoryContent

java.lang.Object
  extended by org.apache.archiva.repository.content.legacy.AbstractLegacyRepositoryContent
      extended by org.apache.archiva.repository.content.legacy.ManagedLegacyRepositoryContent
All Implemented Interfaces:
ManagedRepositoryContent

@Service(value="managedRepositoryContent#legacy")
@Scope(value="prototype")
public class ManagedLegacyRepositoryContent
extends AbstractLegacyRepositoryContent
implements ManagedRepositoryContent

ManagedLegacyRepositoryContent

To Do:
no need to be a component when filetypes, legacy path parser is not

Field Summary
private  FileTypes filetypes
           
private  ManagedRepository repository
           
 
Constructor Summary
ManagedLegacyRepositoryContent()
           
 
Method Summary
 void deleteArtifact(ArtifactReference artifactReference)
          delete a specified artifact from the repository
 void deleteGroupId(String groupId)
           
 void deleteProject(String namespace, String projectId)
           
private  void deleteSupportFile(File repoFile, String supportExtension)
           
private  void deleteSupportFiles(File repoFile)
           
 void deleteVersion(VersionedReference reference)
          Delete from the managed repository all files / directories associated with the provided version reference.
private  void deleteVersions(File typeDir, VersionedReference reference)
           
 String getId()
           Convenience method to get the repository id.
private  void getProjectVersions(File typeDir, ProjectReference reference, Set<String> foundVersions)
           
 Set<ArtifactReference> getRelatedArtifacts(ArtifactReference reference)
           Gather up the list of related artifacts to the ArtifactReference provided.
private  void getRelatedArtifacts(File typeDir, ArtifactReference reference, Set<ArtifactReference> foundArtifacts)
           
 String getRepoRoot()
           Convenience method to get the repository (on disk) root directory.
 ManagedRepository getRepository()
          Get the repository configuration associated with this repository content.
private  void getVersionedVersions(File typeDir, VersionedReference reference, Set<String> foundVersions)
           
 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 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.
 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.
 
Methods inherited from class org.apache.archiva.repository.content.legacy.AbstractLegacyRepositoryContent
setLegacyPathParser, toPath, toPath
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.archiva.repository.ManagedRepositoryContent
toPath, toPath
 

Field Detail

filetypes

@Inject
private FileTypes filetypes

repository

private ManagedRepository repository
Constructor Detail

ManagedLegacyRepositoryContent

public ManagedLegacyRepositoryContent()
Method Detail

deleteVersion

public void deleteVersion(VersionedReference reference)
                   throws ContentNotFoundException
Description copied from interface: ManagedRepositoryContent
Delete from the managed repository all files / directories associated with the provided version reference.

Specified by:
deleteVersion in interface ManagedRepositoryContent
Parameters:
reference - the version reference to delete.
Throws:
ContentNotFoundException

deleteVersions

private void deleteVersions(File typeDir,
                            VersionedReference reference)

deleteProject

public void deleteProject(String namespace,
                          String projectId)
                   throws RepositoryException
Specified by:
deleteProject in interface ManagedRepositoryContent
Parameters:
namespace - groupId for maven
projectId - artifactId for maven
Throws:
ContentNotFoundException
RepositoryException

deleteSupportFiles

private void deleteSupportFiles(File repoFile)

deleteSupportFile

private void deleteSupportFile(File repoFile,
                               String supportExtension)

getId

public String getId()
Description copied from interface: ManagedRepositoryContent

Convenience method to get the repository id.

Equivalent to calling .getRepository().getId()

Specified by:
getId in interface ManagedRepositoryContent
Returns:
the repository id.

getRelatedArtifacts

public Set<ArtifactReference> getRelatedArtifacts(ArtifactReference reference)
                                           throws ContentNotFoundException
Description copied from interface: 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.

Specified by:
getRelatedArtifacts in interface ManagedRepositoryContent
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.

getRepoRoot

public String getRepoRoot()
Description copied from interface: ManagedRepositoryContent

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

Equivalent to calling .getRepository().getLocation()

Specified by:
getRepoRoot in interface ManagedRepositoryContent
Returns:
the repository (on disk) root directory.

getRepository

public ManagedRepository getRepository()
Description copied from interface: ManagedRepositoryContent
Get the repository configuration associated with this repository content.

Specified by:
getRepository in interface ManagedRepositoryContent
Returns:
the repository that is associated with this repository content.

getVersions

public Set<String> getVersions(ProjectReference reference)
                        throws ContentNotFoundException
Description copied from interface: ManagedRepositoryContent
Given a specific ProjectReference, return the list of available versions for that project reference.

Specified by:
getVersions in interface ManagedRepositoryContent
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.

getVersions

public Set<String> getVersions(VersionedReference reference)
                        throws ContentNotFoundException
Description copied from interface: 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.

Specified by:
getVersions in interface ManagedRepositoryContent
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.

hasContent

public boolean hasContent(ArtifactReference reference)
Description copied from interface: ManagedRepositoryContent
Determines if the artifact referenced exists in the repository.

Specified by:
hasContent in interface ManagedRepositoryContent
Parameters:
reference - the artifact reference to check for.
Returns:
true if the artifact referenced exists.

hasContent

public boolean hasContent(ProjectReference reference)
Description copied from interface: ManagedRepositoryContent
Determines if the project referenced exists in the repository.

Specified by:
hasContent in interface ManagedRepositoryContent
Parameters:
reference - the project reference to check for.
Returns:
true it the project referenced exists.

hasContent

public boolean hasContent(VersionedReference reference)
Description copied from interface: ManagedRepositoryContent
Determines if the version reference exists in the repository.

Specified by:
hasContent in interface ManagedRepositoryContent
Parameters:
reference - the version reference to check for.
Returns:
true if the version referenced exists.

setRepository

public void setRepository(ManagedRepository repository)
Description copied from interface: ManagedRepositoryContent
Set the repository configuration to associate with this repository content.

Specified by:
setRepository in interface ManagedRepositoryContent
Parameters:
repository - the repository to associate with this repository content.

toArtifactReference

public ArtifactReference toArtifactReference(String path)
                                      throws LayoutException
Convert a path to an artifact reference.

Specified by:
toArtifactReference in interface ManagedRepositoryContent
Overrides:
toArtifactReference in class AbstractLegacyRepositoryContent
Parameters:
path - the path to convert. (relative or full location path)
Returns:
the ArtifactReference representing the path. (or null if path cannot be converted to a ArtifactReference)
Throws:
LayoutException - if the path cannot be converted to an artifact reference.

toFile

public File toFile(ArchivaArtifact reference)
Description copied from interface: ManagedRepositoryContent
Given an ArchivaArtifact, return the file reference to the artifact.

Specified by:
toFile in interface ManagedRepositoryContent
Parameters:
reference - the archiva artifact to use.
Returns:
the relative path to the artifact.

toFile

public File toFile(ArtifactReference reference)
Description copied from interface: ManagedRepositoryContent
Given an ArtifactReference, return the file reference to the artifact.

Specified by:
toFile in interface ManagedRepositoryContent
Parameters:
reference - the artifact reference to use.
Returns:
the relative path to the artifact.

toMetadataPath

public String toMetadataPath(ProjectReference reference)
Description copied from interface: ManagedRepositoryContent
Given a ProjectReference, return the path to the metadata for the project.

Specified by:
toMetadataPath in interface ManagedRepositoryContent
Parameters:
reference - the reference to use.
Returns:
the path to the metadata file, or null if no metadata is appropriate.

toMetadataPath

public String toMetadataPath(VersionedReference reference)
Description copied from interface: ManagedRepositoryContent
Given a VersionedReference, return the path to the metadata for the specific version of the project.

Specified by:
toMetadataPath in interface ManagedRepositoryContent
Parameters:
reference - the reference to use.
Returns:
the path to the metadata file, or null if no metadata is appropriate.

getProjectVersions

private void getProjectVersions(File typeDir,
                                ProjectReference reference,
                                Set<String> foundVersions)

getRelatedArtifacts

private void getRelatedArtifacts(File typeDir,
                                 ArtifactReference reference,
                                 Set<ArtifactReference> foundArtifacts)

getVersionedVersions

private void getVersionedVersions(File typeDir,
                                  VersionedReference reference,
                                  Set<String> foundVersions)

setFileTypes

public void setFileTypes(FileTypes fileTypes)

deleteArtifact

public void deleteArtifact(ArtifactReference artifactReference)
                    throws ContentNotFoundException
Description copied from interface: ManagedRepositoryContent
delete a specified artifact from the repository

Specified by:
deleteArtifact in interface ManagedRepositoryContent
Throws:
ContentNotFoundException

deleteGroupId

public void deleteGroupId(String groupId)
                   throws ContentNotFoundException
Specified by:
deleteGroupId in interface ManagedRepositoryContent
Throws:
ContentNotFoundException


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