diff options
author | Brett Porter <brett@apache.org> | 2009-11-28 08:32:21 +0000 |
---|---|---|
committer | Brett Porter <brett@apache.org> | 2009-11-28 08:32:21 +0000 |
commit | 61745667ab1f4775ca2b73ccfae6f7a53d6fc305 (patch) | |
tree | aeee7f8f0af3d16b1eed46ea90a8ef27e3093ff2 /archiva-modules/metadata | |
parent | c79221c9974357e953e8f670274eba8377b18b96 (diff) | |
download | archiva-61745667ab1f4775ca2b73ccfae6f7a53d6fc305.tar.gz archiva-61745667ab1f4775ca2b73ccfae6f7a53d6fc305.zip |
[MRM-1283] intercept requests for browsing and use the repository storage to determine values if not in metadata
git-svn-id: https://svn.apache.org/repos/asf/archiva/branches/MRM-1025@885072 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'archiva-modules/metadata')
2 files changed, 44 insertions, 12 deletions
diff --git a/archiva-modules/metadata/metadata-repository-api/src/main/java/org/apache/archiva/metadata/repository/DefaultMetadataResolver.java b/archiva-modules/metadata/metadata-repository-api/src/main/java/org/apache/archiva/metadata/repository/DefaultMetadataResolver.java index 8e54a6ea2..09b3fd93f 100644 --- a/archiva-modules/metadata/metadata-repository-api/src/main/java/org/apache/archiva/metadata/repository/DefaultMetadataResolver.java +++ b/archiva-modules/metadata/metadata-repository-api/src/main/java/org/apache/archiva/metadata/repository/DefaultMetadataResolver.java @@ -104,29 +104,57 @@ public class DefaultMetadataResolver public Collection<String> getRootNamespaces( String repoId ) { - // TODO: is this assumption correct? could a storage mech. actually know all references in a non-Maven scenario? - // not passed to the storage mechanism as resolving references would require iterating all groups - return metadataRepository.getRootNamespaces( repoId ); + Collection<String> rootNamespaces = metadataRepository.getRootNamespaces( repoId ); + + // TODO: may want caching on this + Collection<String> storageRootNamespaces = storageResolver.getRootNamespaces( repoId ); + if ( storageRootNamespaces != null && !storageRootNamespaces.equals( rootNamespaces ) ) + { + // TODO: update the metadata repository + rootNamespaces = storageRootNamespaces; + } + + return rootNamespaces; } public Collection<String> getNamespaces( String repoId, String namespace ) { - // TODO: is this assumption correct? could a storage mech. actually know all references in a non-Maven scenario? - // not passed to the storage mechanism as resolving references would require iterating all groups - return metadataRepository.getNamespaces( repoId, namespace ); + Collection<String> namespaces = metadataRepository.getNamespaces( repoId, namespace ); + // TODO: may want caching on this + Collection<String> storageNamespaces = storageResolver.getNamespaces( repoId, namespace ); + if ( storageNamespaces != null && !storageNamespaces.equals( namespaces ) ) + { + // TODO: update the metadata repository + namespaces = storageNamespaces; + } + + return namespaces; } public Collection<String> getProjects( String repoId, String namespace ) { - // TODO: is this assumption correct? could a storage mech. actually know all references in a non-Maven scenario? - // not passed to the storage mechanism as resolving references would require iterating all projects - return metadataRepository.getProjects( repoId, namespace ); + Collection<String> projects = metadataRepository.getProjects( repoId, namespace ); + // TODO: may want caching on this + Collection<String> storageProjects = storageResolver.getProjects( repoId, namespace ); + if ( storageProjects != null && !storageProjects.equals( projects ) ) + { + // TODO: update the metadata repository + projects = storageProjects; + } + + return projects; } public Collection<String> getProjectVersions( String repoId, String namespace, String projectId ) { - // TODO: is this assumption correct? could a storage mech. actually know all references in a non-Maven scenario? - // not passed to the storage mechanism as resolving references would require iterating all versions - return metadataRepository.getProjectVersions( repoId, namespace, projectId ); + Collection<String> projectVersions = metadataRepository.getProjectVersions( repoId, namespace, projectId ); + // TODO: may want caching on this + Collection<String> storageProjectVersions = storageResolver.getProjectVersions( repoId, namespace, projectId ); + if ( storageProjectVersions != null && !storageProjectVersions.equals( projectVersions ) ) + { + // TODO: update the metadata repository + projectVersions = storageProjectVersions; + } + return projectVersions; } } diff --git a/archiva-modules/metadata/metadata-repository-api/src/main/java/org/apache/archiva/metadata/repository/storage/RepositoryPathTranslator.java b/archiva-modules/metadata/metadata-repository-api/src/main/java/org/apache/archiva/metadata/repository/storage/RepositoryPathTranslator.java index f7a50e7d5..196cb516f 100644 --- a/archiva-modules/metadata/metadata-repository-api/src/main/java/org/apache/archiva/metadata/repository/storage/RepositoryPathTranslator.java +++ b/archiva-modules/metadata/metadata-repository-api/src/main/java/org/apache/archiva/metadata/repository/storage/RepositoryPathTranslator.java @@ -26,4 +26,8 @@ public interface RepositoryPathTranslator File toFile( File basedir, String namespace, String projectId, String projectVersion, String filename ); String toPath( String namespace, String projectId, String projectVersion, String filename ); + + File toFile( File basedir, String namespace, String projectId ); + + File toFile( File basedir, String namespace ); } |