aboutsummaryrefslogtreecommitdiffstats
path: root/archiva-modules/metadata
diff options
context:
space:
mode:
Diffstat (limited to 'archiva-modules/metadata')
-rw-r--r--archiva-modules/metadata/metadata-repository-api/src/main/java/org/apache/archiva/metadata/repository/DefaultMetadataResolver.java31
-rw-r--r--archiva-modules/metadata/metadata-repository-api/src/main/java/org/apache/archiva/metadata/repository/MetadataRepository.java3
-rw-r--r--archiva-modules/metadata/metadata-repository-api/src/main/java/org/apache/archiva/metadata/repository/MetadataResolver.java4
-rw-r--r--archiva-modules/metadata/metadata-repository-api/src/main/java/org/apache/archiva/metadata/repository/storage/RepositoryPathTranslator.java2
-rw-r--r--archiva-modules/metadata/metadata-repository-api/src/main/java/org/apache/archiva/metadata/repository/storage/StorageMetadataResolver.java16
5 files changed, 47 insertions, 9 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 d189f761e..aa762a2ab 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
@@ -22,6 +22,7 @@ package org.apache.archiva.metadata.repository;
import java.util.ArrayList;
import java.util.Collection;
+import org.apache.archiva.metadata.model.ArtifactMetadata;
import org.apache.archiva.metadata.model.Dependency;
import org.apache.archiva.metadata.model.ProjectMetadata;
import org.apache.archiva.metadata.model.ProjectVersionMetadata;
@@ -187,4 +188,34 @@ public class DefaultMetadataResolver
}
return projectVersions;
}
+
+ public Collection<ArtifactMetadata> getArtifacts( String repoId, String namespace, String projectId,
+ String projectVersion )
+ {
+ Collection<ArtifactMetadata> artifacts =
+ metadataRepository.getArtifacts( repoId, namespace, projectId, projectVersion );
+ Collection<ArtifactMetadata> storageArtifacts =
+ storageResolver.getArtifacts( repoId, namespace, projectId, projectVersion,
+ new ExcludesFilter<String>( createArtifactIdList( artifacts ) ) );
+ if ( storageArtifacts != null && !storageArtifacts.isEmpty() )
+ {
+ for ( ArtifactMetadata artifact : storageArtifacts )
+ {
+ metadataRepository.updateArtifact( repoId, namespace, projectId, projectVersion, artifact );
+ }
+ artifacts = new ArrayList<ArtifactMetadata>( artifacts );
+ artifacts.addAll( storageArtifacts );
+ }
+ return artifacts;
+ }
+
+ private Collection<String> createArtifactIdList( Collection<ArtifactMetadata> artifacts )
+ {
+ Collection<String> artifactIds = new ArrayList<String>();
+ for ( ArtifactMetadata artifact : artifacts )
+ {
+ artifactIds.add( artifact.getId() );
+ }
+ return artifactIds;
+ }
}
diff --git a/archiva-modules/metadata/metadata-repository-api/src/main/java/org/apache/archiva/metadata/repository/MetadataRepository.java b/archiva-modules/metadata/metadata-repository-api/src/main/java/org/apache/archiva/metadata/repository/MetadataRepository.java
index 6aeb13515..44354f690 100644
--- a/archiva-modules/metadata/metadata-repository-api/src/main/java/org/apache/archiva/metadata/repository/MetadataRepository.java
+++ b/archiva-modules/metadata/metadata-repository-api/src/main/java/org/apache/archiva/metadata/repository/MetadataRepository.java
@@ -62,7 +62,4 @@ public interface MetadataRepository
List<ArtifactMetadata> getArtifactsByDateRange( String repoId, Date startTime, Date endTime );
Collection<String> getRepositories();
-
- public Collection<ArtifactMetadata> getArtifacts( String repoId, String namespace, String projectId,
- String projectVersion );
}
diff --git a/archiva-modules/metadata/metadata-repository-api/src/main/java/org/apache/archiva/metadata/repository/MetadataResolver.java b/archiva-modules/metadata/metadata-repository-api/src/main/java/org/apache/archiva/metadata/repository/MetadataResolver.java
index d804b60fc..d677a70f1 100644
--- a/archiva-modules/metadata/metadata-repository-api/src/main/java/org/apache/archiva/metadata/repository/MetadataResolver.java
+++ b/archiva-modules/metadata/metadata-repository-api/src/main/java/org/apache/archiva/metadata/repository/MetadataResolver.java
@@ -21,6 +21,7 @@ package org.apache.archiva.metadata.repository;
import java.util.Collection;
+import org.apache.archiva.metadata.model.ArtifactMetadata;
import org.apache.archiva.metadata.model.ProjectMetadata;
import org.apache.archiva.metadata.model.ProjectVersionMetadata;
import org.apache.archiva.metadata.model.ProjectVersionReference;
@@ -56,4 +57,7 @@ public interface MetadataResolver
Collection<String> getProjectVersions( String repoId, String namespace, String projectId )
throws MetadataResolverException;
+
+ Collection<ArtifactMetadata> getArtifacts( String repoId, String namespace, String projectId,
+ String projectVersion );
}
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 196cb516f..c877ec8ec 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
@@ -30,4 +30,6 @@ public interface RepositoryPathTranslator
File toFile( File basedir, String namespace, String projectId );
File toFile( File basedir, String namespace );
+
+ File toFile( File basedir, String namespace, String projectId, String projectVersion );
}
diff --git a/archiva-modules/metadata/metadata-repository-api/src/main/java/org/apache/archiva/metadata/repository/storage/StorageMetadataResolver.java b/archiva-modules/metadata/metadata-repository-api/src/main/java/org/apache/archiva/metadata/repository/storage/StorageMetadataResolver.java
index a83bb9ca1..236b97bb3 100644
--- a/archiva-modules/metadata/metadata-repository-api/src/main/java/org/apache/archiva/metadata/repository/storage/StorageMetadataResolver.java
+++ b/archiva-modules/metadata/metadata-repository-api/src/main/java/org/apache/archiva/metadata/repository/storage/StorageMetadataResolver.java
@@ -1,10 +1,5 @@
package org.apache.archiva.metadata.repository.storage;
-import java.util.Collection;
-
-import org.apache.archiva.metadata.repository.MetadataResolver;
-import org.apache.archiva.metadata.repository.filter.Filter;
-
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -24,6 +19,12 @@ import org.apache.archiva.metadata.repository.filter.Filter;
* under the License.
*/
+import java.util.Collection;
+
+import org.apache.archiva.metadata.model.ArtifactMetadata;
+import org.apache.archiva.metadata.repository.MetadataResolver;
+import org.apache.archiva.metadata.repository.filter.Filter;
+
public interface StorageMetadataResolver
extends MetadataResolver
{
@@ -33,5 +34,8 @@ public interface StorageMetadataResolver
Collection<String> getProjects( String repoId, String namespace, Filter<String> filter );
- Collection<String> getProjectVersions( String repoId, String namespace, String projectId, Filter<String> filter );
+ Collection<String> getProjectVersions( String repoId, String namespace, String projectId, Filter<String> filter );
+
+ Collection<ArtifactMetadata> getArtifacts( String repoId, String namespace, String projectId, String projectVersion,
+ Filter<String> filter );
}