mirror of https://github.com/apache/archiva.git
Changing method names and adding javadoc for metarepository
This commit is contained in:
parent
811c445f04
commit
8f42ce002c
|
@ -259,7 +259,7 @@ public abstract class AbstractRepositoryPurge
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// metadataRepository.removeArtifact( artifactMetadata, baseVersion );
|
// metadataRepository.removeTimestampedArtifact( artifactMetadata, baseVersion );
|
||||||
metaRemovalList.put( info, artifactMetadata );
|
metaRemovalList.put( info, artifactMetadata );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -366,7 +366,7 @@ public abstract class AbstractRepositoryPurge
|
||||||
version = artifactInfo.getProjectVersion( );
|
version = artifactInfo.getProjectVersion( );
|
||||||
MavenArtifactFacet mavenArtifactFacetToCompare = new MavenArtifactFacet( );
|
MavenArtifactFacet mavenArtifactFacetToCompare = new MavenArtifactFacet( );
|
||||||
mavenArtifactFacetToCompare.setClassifier( artifactInfo.getClassifier( ) );
|
mavenArtifactFacetToCompare.setClassifier( artifactInfo.getClassifier( ) );
|
||||||
metadataRepository.removeArtifact(repositorySession , repository.getId( ), groupId,
|
metadataRepository.removeFacetFromArtifact(repositorySession , repository.getId( ), groupId,
|
||||||
artifactId, version, mavenArtifactFacetToCompare );
|
artifactId, version, mavenArtifactFacetToCompare );
|
||||||
try {
|
try {
|
||||||
repositorySession.save( );
|
repositorySession.save( );
|
||||||
|
@ -377,7 +377,7 @@ public abstract class AbstractRepositoryPurge
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
metadataRepository.removeArtifact(repositorySession , artifactMetadata, artifactInfo.getProjectVersion( ) );
|
metadataRepository.removeTimestampedArtifact(repositorySession , artifactMetadata, artifactInfo.getProjectVersion( ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -345,8 +345,8 @@ public class CleanupReleasedSnapshotsRepositoryPurgeTest
|
||||||
verify(metadataRepository, never()).removeProjectVersion(eq(repositorySession) , eq(TEST_REPO_ID), eq(projectNs), eq(projectName), eq(projectVersion) );
|
verify(metadataRepository, never()).removeProjectVersion(eq(repositorySession) , eq(TEST_REPO_ID), eq(projectNs), eq(projectName), eq(projectVersion) );
|
||||||
verify(metadataRepository, never()).removeProjectVersion(eq(repositorySession) , eq(TEST_REPO_ID), eq(projectNs), eq(projectName), eq("2.0.3-SNAPSHOT") );
|
verify(metadataRepository, never()).removeProjectVersion(eq(repositorySession) , eq(TEST_REPO_ID), eq(projectNs), eq(projectName), eq("2.0.3-SNAPSHOT") );
|
||||||
verify(metadataRepository, never()).removeProjectVersion(eq(repositorySession) , eq(TEST_REPO_ID), eq(projectNs), eq(projectName), eq("2.0.4-SNAPSHOT") );
|
verify(metadataRepository, never()).removeProjectVersion(eq(repositorySession) , eq(TEST_REPO_ID), eq(projectNs), eq(projectName), eq("2.0.4-SNAPSHOT") );
|
||||||
verify(metadataRepository, never()).removeArtifact(eq(repositorySession) , any(ArtifactMetadata.class), any(String.class) );
|
verify(metadataRepository, never()).removeTimestampedArtifact(eq(repositorySession) , any(ArtifactMetadata.class), any(String.class) );
|
||||||
verify(metadataRepository, never()).removeArtifact(eq(repositorySession) , any(String.class), any(String.class), any(String.class), any(String.class), any( MetadataFacet.class) );
|
verify(metadataRepository, never()).removeFacetFromArtifact(eq(repositorySession) , any(String.class), any(String.class), any(String.class), any(String.class), any( MetadataFacet.class) );
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -134,7 +134,7 @@ public class DaysOldRepositoryPurgeTest
|
||||||
// Verify the metadataRepository invocations
|
// Verify the metadataRepository invocations
|
||||||
verify(metadataRepository, never()).removeProjectVersion(eq(repositorySession) , eq(TEST_REPO_ID), eq(projectNs), eq(projectName), eq(projectVersion) );
|
verify(metadataRepository, never()).removeProjectVersion(eq(repositorySession) , eq(TEST_REPO_ID), eq(projectNs), eq(projectName), eq(projectVersion) );
|
||||||
ArgumentCaptor<ArtifactMetadata> metadataArg = ArgumentCaptor.forClass(ArtifactMetadata.class);
|
ArgumentCaptor<ArtifactMetadata> metadataArg = ArgumentCaptor.forClass(ArtifactMetadata.class);
|
||||||
verify(metadataRepository, times(2)).removeArtifact(eq(repositorySession) , metadataArg.capture(), eq(projectVersion) );
|
verify(metadataRepository, times(2)).removeTimestampedArtifact(eq(repositorySession) , metadataArg.capture(), eq(projectVersion) );
|
||||||
List<ArtifactMetadata> metaL = metadataArg.getAllValues();
|
List<ArtifactMetadata> metaL = metadataArg.getAllValues();
|
||||||
for (ArtifactMetadata meta : metaL) {
|
for (ArtifactMetadata meta : metaL) {
|
||||||
assertTrue(meta.getId().startsWith(projectName));
|
assertTrue(meta.getId().startsWith(projectName));
|
||||||
|
@ -229,7 +229,7 @@ public class DaysOldRepositoryPurgeTest
|
||||||
// Verify the metadataRepository invocations
|
// Verify the metadataRepository invocations
|
||||||
verify(metadataRepository, never()).removeProjectVersion(eq(repositorySession) , eq(TEST_REPO_ID), eq(projectNs), eq(projectName), eq(projectVersion) );
|
verify(metadataRepository, never()).removeProjectVersion(eq(repositorySession) , eq(TEST_REPO_ID), eq(projectNs), eq(projectName), eq(projectVersion) );
|
||||||
ArgumentCaptor<ArtifactMetadata> metadataArg = ArgumentCaptor.forClass(ArtifactMetadata.class);
|
ArgumentCaptor<ArtifactMetadata> metadataArg = ArgumentCaptor.forClass(ArtifactMetadata.class);
|
||||||
verify(metadataRepository, times(deletedVersions.size())).removeArtifact(eq(repositorySession) , metadataArg.capture(), eq(projectVersion) );
|
verify(metadataRepository, times(deletedVersions.size())).removeTimestampedArtifact(eq(repositorySession) , metadataArg.capture(), eq(projectVersion) );
|
||||||
List<ArtifactMetadata> metaL = metadataArg.getAllValues();
|
List<ArtifactMetadata> metaL = metadataArg.getAllValues();
|
||||||
for (ArtifactMetadata meta : metaL) {
|
for (ArtifactMetadata meta : metaL) {
|
||||||
assertTrue(meta.getId().startsWith(projectName));
|
assertTrue(meta.getId().startsWith(projectName));
|
||||||
|
@ -337,7 +337,7 @@ public class DaysOldRepositoryPurgeTest
|
||||||
// Verify the metadataRepository invocations
|
// Verify the metadataRepository invocations
|
||||||
verify(metadataRepository, never()).removeProjectVersion(eq(repositorySession) , eq(TEST_REPO_ID), eq(projectNs), eq(projectName), eq(projectVersion) );
|
verify(metadataRepository, never()).removeProjectVersion(eq(repositorySession) , eq(TEST_REPO_ID), eq(projectNs), eq(projectName), eq(projectVersion) );
|
||||||
ArgumentCaptor<ArtifactMetadata> metadataArg = ArgumentCaptor.forClass(ArtifactMetadata.class);
|
ArgumentCaptor<ArtifactMetadata> metadataArg = ArgumentCaptor.forClass(ArtifactMetadata.class);
|
||||||
verify(metadataRepository, times(deletedVersions.size())).removeArtifact( eq(repositorySession), metadataArg.capture(), eq(projectVersion) );
|
verify(metadataRepository, times(deletedVersions.size())).removeTimestampedArtifact( eq(repositorySession), metadataArg.capture(), eq(projectVersion) );
|
||||||
List<ArtifactMetadata> metaL = metadataArg.getAllValues();
|
List<ArtifactMetadata> metaL = metadataArg.getAllValues();
|
||||||
for (ArtifactMetadata meta : metaL) {
|
for (ArtifactMetadata meta : metaL) {
|
||||||
assertTrue(meta.getId().startsWith(projectName));
|
assertTrue(meta.getId().startsWith(projectName));
|
||||||
|
|
|
@ -27,7 +27,6 @@ import org.apache.archiva.consumers.KnownRepositoryContentConsumer;
|
||||||
import org.apache.archiva.consumers.functors.ConsumerWantsFilePredicate;
|
import org.apache.archiva.consumers.functors.ConsumerWantsFilePredicate;
|
||||||
import org.apache.archiva.metadata.model.ArtifactMetadata;
|
import org.apache.archiva.metadata.model.ArtifactMetadata;
|
||||||
import org.apache.archiva.metadata.model.MetadataFacet;
|
import org.apache.archiva.metadata.model.MetadataFacet;
|
||||||
import org.apache.archiva.mock.MockRepositorySessionFactory;
|
|
||||||
import org.apache.archiva.repository.RepositoryRegistry;
|
import org.apache.archiva.repository.RepositoryRegistry;
|
||||||
import org.apache.archiva.repository.features.ArtifactCleanupFeature;
|
import org.apache.archiva.repository.features.ArtifactCleanupFeature;
|
||||||
import org.custommonkey.xmlunit.XMLAssert;
|
import org.custommonkey.xmlunit.XMLAssert;
|
||||||
|
@ -210,7 +209,7 @@ public class RepositoryPurgeConsumerTest
|
||||||
// Verify the metadataRepository invocations
|
// Verify the metadataRepository invocations
|
||||||
verify(metadataRepository, never()).removeProjectVersion( eq(repositorySession), eq(TEST_REPO_ID), eq(projectNs), eq(projectName), eq(projectVersion) );
|
verify(metadataRepository, never()).removeProjectVersion( eq(repositorySession), eq(TEST_REPO_ID), eq(projectNs), eq(projectName), eq(projectVersion) );
|
||||||
ArgumentCaptor<ArtifactMetadata> metadataArg = ArgumentCaptor.forClass(ArtifactMetadata.class);
|
ArgumentCaptor<ArtifactMetadata> metadataArg = ArgumentCaptor.forClass(ArtifactMetadata.class);
|
||||||
verify(metadataRepository, times(2)).removeArtifact( eq(repositorySession), metadataArg.capture(), eq(projectVersion) );
|
verify(metadataRepository, times(2)).removeTimestampedArtifact( eq(repositorySession), metadataArg.capture(), eq(projectVersion) );
|
||||||
List<ArtifactMetadata> metaL = metadataArg.getAllValues();
|
List<ArtifactMetadata> metaL = metadataArg.getAllValues();
|
||||||
for (ArtifactMetadata meta : metaL) {
|
for (ArtifactMetadata meta : metaL) {
|
||||||
assertTrue(meta.getId().startsWith(projectName));
|
assertTrue(meta.getId().startsWith(projectName));
|
||||||
|
@ -323,7 +322,7 @@ public class RepositoryPurgeConsumerTest
|
||||||
// Verify the metadataRepository invocations
|
// Verify the metadataRepository invocations
|
||||||
verify(metadataRepository, never()).removeProjectVersion( eq(repositorySession), eq(TEST_REPO_ID), eq(projectNs), eq(projectName), eq(projectVersion) );
|
verify(metadataRepository, never()).removeProjectVersion( eq(repositorySession), eq(TEST_REPO_ID), eq(projectNs), eq(projectName), eq(projectVersion) );
|
||||||
ArgumentCaptor<ArtifactMetadata> metadataArg = ArgumentCaptor.forClass(ArtifactMetadata.class);
|
ArgumentCaptor<ArtifactMetadata> metadataArg = ArgumentCaptor.forClass(ArtifactMetadata.class);
|
||||||
verify(metadataRepository, times(2)).removeArtifact( eq(repositorySession), metadataArg.capture(), eq(projectVersion) );
|
verify(metadataRepository, times(2)).removeTimestampedArtifact( eq(repositorySession), metadataArg.capture(), eq(projectVersion) );
|
||||||
List<ArtifactMetadata> metaL = metadataArg.getAllValues();
|
List<ArtifactMetadata> metaL = metadataArg.getAllValues();
|
||||||
assertTrue( metaL.size( ) > 0 );
|
assertTrue( metaL.size( ) > 0 );
|
||||||
for (ArtifactMetadata meta : metaL) {
|
for (ArtifactMetadata meta : metaL) {
|
||||||
|
@ -403,8 +402,8 @@ public class RepositoryPurgeConsumerTest
|
||||||
|
|
||||||
verify(metadataRepository, never()).removeProjectVersion( eq(repositorySession), eq(TEST_REPO_ID), eq(projectNs), eq(projectName), eq(projectVersion) );
|
verify(metadataRepository, never()).removeProjectVersion( eq(repositorySession), eq(TEST_REPO_ID), eq(projectNs), eq(projectName), eq(projectVersion) );
|
||||||
ArgumentCaptor<ArtifactMetadata> metadataArg = ArgumentCaptor.forClass(ArtifactMetadata.class);
|
ArgumentCaptor<ArtifactMetadata> metadataArg = ArgumentCaptor.forClass(ArtifactMetadata.class);
|
||||||
verify(metadataRepository, never()).removeArtifact( eq(repositorySession), any(), any() );
|
verify(metadataRepository, never()).removeTimestampedArtifact( eq(repositorySession), any(), any() );
|
||||||
verify(metadataRepository, never()).removeArtifact( eq(repositorySession), any(), any(), any(), any(), any(MetadataFacet.class) );
|
verify(metadataRepository, never()).removeFacetFromArtifact( eq(repositorySession), any(), any(), any(), any(), any(MetadataFacet.class) );
|
||||||
|
|
||||||
// check if the snapshot wasn't removed
|
// check if the snapshot wasn't removed
|
||||||
|
|
||||||
|
@ -473,7 +472,7 @@ public class RepositoryPurgeConsumerTest
|
||||||
|
|
||||||
verify(metadataRepository, times(1)).removeProjectVersion( eq(repositorySession), eq(TEST_REPO_ID), eq(projectNs), eq(projectName), eq(projectVersion) );
|
verify(metadataRepository, times(1)).removeProjectVersion( eq(repositorySession), eq(TEST_REPO_ID), eq(projectNs), eq(projectName), eq(projectVersion) );
|
||||||
ArgumentCaptor<ArtifactMetadata> metadataArg = ArgumentCaptor.forClass(ArtifactMetadata.class);
|
ArgumentCaptor<ArtifactMetadata> metadataArg = ArgumentCaptor.forClass(ArtifactMetadata.class);
|
||||||
verify(metadataRepository, never()).removeArtifact( eq(repositorySession), any(), any() );
|
verify(metadataRepository, never()).removeTimestampedArtifact( eq(repositorySession), any(), any() );
|
||||||
|
|
||||||
// check if the snapshot was removed
|
// check if the snapshot was removed
|
||||||
assertDeleted( projectRoot + "/2.3-SNAPSHOT" );
|
assertDeleted( projectRoot + "/2.3-SNAPSHOT" );
|
||||||
|
|
|
@ -137,7 +137,7 @@ public class RetentionCountRepositoryPurgeTest
|
||||||
// Verify the metadataRepository invocations
|
// Verify the metadataRepository invocations
|
||||||
verify(metadataRepository, never()).removeProjectVersion( eq(repositorySession), eq(TEST_REPO_ID), eq(projectNs), eq(projectName), eq(projectVersion) );
|
verify(metadataRepository, never()).removeProjectVersion( eq(repositorySession), eq(TEST_REPO_ID), eq(projectNs), eq(projectName), eq(projectVersion) );
|
||||||
ArgumentCaptor<ArtifactMetadata> metadataArg = ArgumentCaptor.forClass(ArtifactMetadata.class);
|
ArgumentCaptor<ArtifactMetadata> metadataArg = ArgumentCaptor.forClass(ArtifactMetadata.class);
|
||||||
verify(metadataRepository, times(deletedVersions.size())).removeArtifact( eq(repositorySession), metadataArg.capture(), eq(projectVersion) );
|
verify(metadataRepository, times(deletedVersions.size())).removeTimestampedArtifact( eq(repositorySession), metadataArg.capture(), eq(projectVersion) );
|
||||||
List<ArtifactMetadata> metaL = metadataArg.getAllValues();
|
List<ArtifactMetadata> metaL = metadataArg.getAllValues();
|
||||||
for (ArtifactMetadata meta : metaL) {
|
for (ArtifactMetadata meta : metaL) {
|
||||||
assertTrue(meta.getId().startsWith(projectName));
|
assertTrue(meta.getId().startsWith(projectName));
|
||||||
|
@ -223,7 +223,7 @@ public class RetentionCountRepositoryPurgeTest
|
||||||
// Verify the metadataRepository invocations
|
// Verify the metadataRepository invocations
|
||||||
verify(metadataRepository, never()).removeProjectVersion( eq(repositorySession), eq(TEST_REPO_ID), eq(projectNs), eq(projectName), eq(projectVersion) );
|
verify(metadataRepository, never()).removeProjectVersion( eq(repositorySession), eq(TEST_REPO_ID), eq(projectNs), eq(projectName), eq(projectVersion) );
|
||||||
ArgumentCaptor<ArtifactMetadata> metadataArg = ArgumentCaptor.forClass(ArtifactMetadata.class);
|
ArgumentCaptor<ArtifactMetadata> metadataArg = ArgumentCaptor.forClass(ArtifactMetadata.class);
|
||||||
verify(metadataRepository, times(deletedVersions.size())).removeArtifact( eq(repositorySession), metadataArg.capture(), eq(projectVersion) );
|
verify(metadataRepository, times(deletedVersions.size())).removeTimestampedArtifact( eq(repositorySession), metadataArg.capture(), eq(projectVersion) );
|
||||||
List<ArtifactMetadata> metaL = metadataArg.getAllValues();
|
List<ArtifactMetadata> metaL = metadataArg.getAllValues();
|
||||||
for (ArtifactMetadata meta : metaL) {
|
for (ArtifactMetadata meta : metaL) {
|
||||||
assertTrue(meta.getId().startsWith(projectName));
|
assertTrue(meta.getId().startsWith(projectName));
|
||||||
|
@ -311,7 +311,7 @@ public class RetentionCountRepositoryPurgeTest
|
||||||
// Verify the metadataRepository invocations
|
// Verify the metadataRepository invocations
|
||||||
verify(metadataRepository, never()).removeProjectVersion( eq(repositorySession), eq(TEST_REPO_ID), eq(projectNs), eq(projectName), eq(projectVersion) );
|
verify(metadataRepository, never()).removeProjectVersion( eq(repositorySession), eq(TEST_REPO_ID), eq(projectNs), eq(projectName), eq(projectVersion) );
|
||||||
ArgumentCaptor<ArtifactMetadata> metadataArg = ArgumentCaptor.forClass(ArtifactMetadata.class);
|
ArgumentCaptor<ArtifactMetadata> metadataArg = ArgumentCaptor.forClass(ArtifactMetadata.class);
|
||||||
verify(metadataRepository, times(deletedVersions.size())).removeArtifact( eq(repositorySession), metadataArg.capture(), eq(projectVersion) );
|
verify(metadataRepository, times(deletedVersions.size())).removeTimestampedArtifact( eq(repositorySession), metadataArg.capture(), eq(projectVersion) );
|
||||||
List<ArtifactMetadata> metaL = metadataArg.getAllValues();
|
List<ArtifactMetadata> metaL = metadataArg.getAllValues();
|
||||||
for (ArtifactMetadata meta : metaL) {
|
for (ArtifactMetadata meta : metaL) {
|
||||||
assertTrue(meta.getId().startsWith(projectName));
|
assertTrue(meta.getId().startsWith(projectName));
|
||||||
|
|
|
@ -1019,7 +1019,7 @@ public class DefaultBrowseService
|
||||||
}
|
}
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
List<ArtifactMetadata> artifactMetadatas = repositorySession.getRepository().getArtifactsByProjectVersionMetadata(repositorySession , key, value, repositoryId );
|
List<ArtifactMetadata> artifactMetadatas = repositorySession.getRepository().getArtifactsByProjectVersionFacet(repositorySession , key, value, repositoryId );
|
||||||
return buildArtifacts( artifactMetadatas, repositoryId );
|
return buildArtifacts( artifactMetadatas, repositoryId );
|
||||||
}
|
}
|
||||||
catch ( MetadataRepositoryException e )
|
catch ( MetadataRepositoryException e )
|
||||||
|
@ -1047,7 +1047,7 @@ public class DefaultBrowseService
|
||||||
}
|
}
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
List<ArtifactMetadata> artifactMetadatas = repositorySession.getRepository().getArtifactsByMetadata(repositorySession , key, value, repositoryId );
|
List<ArtifactMetadata> artifactMetadatas = repositorySession.getRepository().getArtifactsByAttribute(repositorySession , key, value, repositoryId );
|
||||||
return buildArtifacts( artifactMetadatas, repositoryId );
|
return buildArtifacts( artifactMetadatas, repositoryId );
|
||||||
}
|
}
|
||||||
catch ( MetadataRepositoryException e )
|
catch ( MetadataRepositoryException e )
|
||||||
|
@ -1075,7 +1075,7 @@ public class DefaultBrowseService
|
||||||
}
|
}
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
List<ArtifactMetadata> artifactMetadatas = repositorySession.getRepository().getArtifactsByProperty(repositorySession , key, value, repositoryId );
|
List<ArtifactMetadata> artifactMetadatas = repositorySession.getRepository().getArtifactsByProjectVersionAttribute(repositorySession , key, value, repositoryId );
|
||||||
return buildArtifacts( artifactMetadatas, repositoryId );
|
return buildArtifacts( artifactMetadatas, repositoryId );
|
||||||
}
|
}
|
||||||
catch ( MetadataRepositoryException e )
|
catch ( MetadataRepositoryException e )
|
||||||
|
|
|
@ -703,7 +703,7 @@ public class DefaultRepositoriesService
|
||||||
|
|
||||||
for ( ArtifactMetadata artifactMetadata : artifacts )
|
for ( ArtifactMetadata artifactMetadata : artifacts )
|
||||||
{
|
{
|
||||||
metadataRepository.removeArtifact(repositorySession , artifactMetadata, version );
|
metadataRepository.removeTimestampedArtifact(repositorySession , artifactMetadata, version );
|
||||||
}
|
}
|
||||||
|
|
||||||
metadataRepository.removeProjectVersion(repositorySession , repositoryId, namespace, projectId, version );
|
metadataRepository.removeProjectVersion(repositorySession , repositoryId, namespace, projectId, version );
|
||||||
|
@ -920,7 +920,7 @@ public class DefaultRepositoriesService
|
||||||
artifact.getVersion();
|
artifact.getVersion();
|
||||||
MavenArtifactFacet mavenArtifactFacetToCompare = new MavenArtifactFacet();
|
MavenArtifactFacet mavenArtifactFacetToCompare = new MavenArtifactFacet();
|
||||||
mavenArtifactFacetToCompare.setClassifier( artifact.getClassifier() );
|
mavenArtifactFacetToCompare.setClassifier( artifact.getClassifier() );
|
||||||
metadataRepository.removeArtifact(repositorySession , repositoryId, groupId, artifactId,
|
metadataRepository.removeFacetFromArtifact(repositorySession , repositoryId, groupId, artifactId,
|
||||||
version, mavenArtifactFacetToCompare );
|
version, mavenArtifactFacetToCompare );
|
||||||
repositorySession.save();
|
repositorySession.save();
|
||||||
}
|
}
|
||||||
|
@ -930,7 +930,7 @@ public class DefaultRepositoriesService
|
||||||
{
|
{
|
||||||
if ( snapshotVersion )
|
if ( snapshotVersion )
|
||||||
{
|
{
|
||||||
metadataRepository.removeArtifact(repositorySession ,
|
metadataRepository.removeTimestampedArtifact(repositorySession ,
|
||||||
artifactMetadata, VersionUtil.getBaseVersion( artifact.getVersion() ) );
|
artifactMetadata, VersionUtil.getBaseVersion( artifact.getVersion() ) );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -28,8 +28,6 @@ import org.apache.archiva.metadata.model.ProjectVersionMetadata;
|
||||||
import org.apache.archiva.metadata.model.ProjectVersionReference;
|
import org.apache.archiva.metadata.model.ProjectVersionReference;
|
||||||
import org.apache.commons.collections4.ComparatorUtils;
|
import org.apache.commons.collections4.ComparatorUtils;
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
|
||||||
import javax.management.Query;
|
|
||||||
import java.time.ZonedDateTime;
|
import java.time.ZonedDateTime;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.stream.Stream;
|
import java.util.stream.Stream;
|
||||||
|
@ -127,21 +125,21 @@ public abstract class AbstractMetadataRepository
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<ArtifactMetadata> getArtifactsByProjectVersionMetadata( RepositorySession session, String key, String value, String repositoryId )
|
public List<ArtifactMetadata> getArtifactsByProjectVersionFacet( RepositorySession session, String key, String value, String repositoryId )
|
||||||
throws MetadataRepositoryException
|
throws MetadataRepositoryException
|
||||||
{
|
{
|
||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<ArtifactMetadata> getArtifactsByMetadata( RepositorySession session, String key, String value, String repositoryId )
|
public List<ArtifactMetadata> getArtifactsByAttribute( RepositorySession session, String key, String value, String repositoryId )
|
||||||
throws MetadataRepositoryException
|
throws MetadataRepositoryException
|
||||||
{
|
{
|
||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<ArtifactMetadata> getArtifactsByProperty( RepositorySession session, String key, String value, String repositoryId )
|
public List<ArtifactMetadata> getArtifactsByProjectVersionAttribute( RepositorySession session, String key, String value, String repositoryId )
|
||||||
throws MetadataRepositoryException
|
throws MetadataRepositoryException
|
||||||
{
|
{
|
||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
|
@ -155,14 +153,14 @@ public abstract class AbstractMetadataRepository
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void removeArtifact( RepositorySession session, ArtifactMetadata artifactMetadata, String baseVersion )
|
public void removeTimestampedArtifact( RepositorySession session, ArtifactMetadata artifactMetadata, String baseVersion )
|
||||||
throws MetadataRepositoryException
|
throws MetadataRepositoryException
|
||||||
{
|
{
|
||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void removeArtifact( RepositorySession session, String repositoryId, String namespace, String project, String version,
|
public void removeFacetFromArtifact( RepositorySession session, String repositoryId, String namespace, String project, String version,
|
||||||
MetadataFacet metadataFacet )
|
MetadataFacet metadataFacet )
|
||||||
throws MetadataRepositoryException
|
throws MetadataRepositoryException
|
||||||
{
|
{
|
||||||
|
@ -229,7 +227,7 @@ public abstract class AbstractMetadataRepository
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Collection<String> getNamespaces( RepositorySession session, String repoId, String namespace )
|
public Collection<String> getChildNamespaces( RepositorySession session, String repoId, String namespace )
|
||||||
throws MetadataResolutionException
|
throws MetadataResolutionException
|
||||||
{
|
{
|
||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
|
@ -317,19 +315,6 @@ public abstract class AbstractMetadataRepository
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean canObtainAccess( Class<?> aClass )
|
|
||||||
{
|
|
||||||
throw new UnsupportedOperationException();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public <T> T obtainAccess( RepositorySession session, Class<T> aClass )
|
|
||||||
throws MetadataRepositoryException
|
|
||||||
{
|
|
||||||
throw new UnsupportedOperationException();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<ArtifactMetadata> searchArtifacts( RepositorySession session, String repositoryId, String text, boolean exact )
|
public List<ArtifactMetadata> searchArtifacts( RepositorySession session, String repositoryId, String text, boolean exact )
|
||||||
throws MetadataRepositoryException
|
throws MetadataRepositoryException
|
||||||
|
|
|
@ -249,7 +249,7 @@ public class DefaultMetadataResolver
|
||||||
Collection<String> namespaces = namespacesCache.get( cacheKey );
|
Collection<String> namespaces = namespacesCache.get( cacheKey );
|
||||||
if ( namespaces == null )
|
if ( namespaces == null )
|
||||||
{
|
{
|
||||||
namespaces = metadataRepository.getNamespaces( session, repoId, namespace );
|
namespaces = metadataRepository.getChildNamespaces( session, repoId, namespace );
|
||||||
namespacesCache.put( cacheKey, namespaces );
|
namespacesCache.put( cacheKey, namespaces );
|
||||||
}
|
}
|
||||||
Collection<String> exclusions = new ArrayList<>( namespaces );
|
Collection<String> exclusions = new ArrayList<>( namespaces );
|
||||||
|
@ -302,7 +302,7 @@ public class DefaultMetadataResolver
|
||||||
Collection<String> namespaces = namespacesCache.get( cacheKey );
|
Collection<String> namespaces = namespacesCache.get( cacheKey );
|
||||||
if ( namespaces == null )
|
if ( namespaces == null )
|
||||||
{
|
{
|
||||||
namespaces = metadataRepository.getNamespaces( session, repoId, namespace );
|
namespaces = metadataRepository.getChildNamespaces( session, repoId, namespace );
|
||||||
namespacesCache.put( cacheKey, namespaces );
|
namespacesCache.put( cacheKey, namespaces );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -37,16 +37,16 @@ import java.util.stream.Stream;
|
||||||
* A Metadata repository provides information about artifact metadata. It does not provide the artifact data itself.
|
* A Metadata repository provides information about artifact metadata. It does not provide the artifact data itself.
|
||||||
* It may be possible to use the same backend for metadata and storage, but this depends on the backends and they are
|
* It may be possible to use the same backend for metadata and storage, but this depends on the backends and they are
|
||||||
* provided by different APIs.
|
* provided by different APIs.
|
||||||
*
|
* <p>
|
||||||
* The motivation for this API is to provide fast access to the repository metadata and fulltext search. Also dependencies
|
* The motivation for this API is to provide fast access to the repository metadata and fulltext search. Also dependencies
|
||||||
* are stored in this repository.
|
* are stored in this repository.
|
||||||
*
|
* <p>
|
||||||
* The methods here do not update the artifacts itself. They are only updating the data in the metadata repository.
|
* The methods here do not update the artifacts itself. They are only updating the data in the metadata repository.
|
||||||
* That means, if you want to update some artifact, you should make sure to update the artifact itself and the metadata
|
* That means, if you want to update some artifact, you should make sure to update the artifact itself and the metadata
|
||||||
* repository (either directly or by repository scanning).
|
* repository (either directly or by repository scanning).
|
||||||
*
|
* <p>
|
||||||
* Currently we are providing JCR, File based and Cassandra as backend for the metadata.
|
* Currently we are providing JCR, File based and Cassandra as backend for the metadata.
|
||||||
*
|
* <p>
|
||||||
* The metadata repository uses sessions for accessing the data. Please make sure to always close the sessions after using it.
|
* The metadata repository uses sessions for accessing the data. Please make sure to always close the sessions after using it.
|
||||||
* Best idiom for using the sessions:
|
* Best idiom for using the sessions:
|
||||||
* <code>
|
* <code>
|
||||||
|
@ -54,18 +54,18 @@ import java.util.stream.Stream;
|
||||||
* // do your stuff
|
* // do your stuff
|
||||||
* }
|
* }
|
||||||
* </code>
|
* </code>
|
||||||
*
|
* <p>
|
||||||
* It is implementation dependent, if the sessions are really used by the backend. E.g. the file based implementation ignores
|
* It is implementation dependent, if the sessions are really used by the backend. E.g. the file based implementation ignores
|
||||||
* the sessions completely.
|
* the sessions completely.
|
||||||
*
|
* <p>
|
||||||
* Sessions should be closed immediately after usage. If it is expensive to open a session for a given backend. The backend
|
* Sessions should be closed immediately after usage. If it is expensive to open a session for a given backend. The backend
|
||||||
* should provide a session pool if possible. There are methods for refreshing a session if needed.
|
* should provide a session pool if possible. There are methods for refreshing a session if needed.
|
||||||
*
|
* <p>
|
||||||
* You should avoid stacking sessions, that means, do not create a new session in the same thread, when a session is opened already.
|
* You should avoid stacking sessions, which means, you should not create a new session in the same thread, when a session is opened already.
|
||||||
*
|
* <p>
|
||||||
* Some backend implementations (JCR) update the metadata in the background, that means update of the metadata is not reflected
|
* Some backend implementations (JCR) update the metadata in the background, that means update of the metadata is not reflected
|
||||||
* immediately.
|
* immediately.
|
||||||
*
|
* <p>
|
||||||
* The base metadata coordinates are:
|
* The base metadata coordinates are:
|
||||||
* <ul>
|
* <ul>
|
||||||
* <li>Repository ID: The identifier of the repository, where the artifact resides</li>
|
* <li>Repository ID: The identifier of the repository, where the artifact resides</li>
|
||||||
|
@ -74,10 +74,10 @@ import java.util.stream.Stream;
|
||||||
* <li>Version: Each project may have different versions.</li>
|
* <li>Version: Each project may have different versions.</li>
|
||||||
* <li>Artifact: Artifacts correspond to files / blob data. Each artifact has additional metadata, like name, version, modification time, ...</li>
|
* <li>Artifact: Artifacts correspond to files / blob data. Each artifact has additional metadata, like name, version, modification time, ...</li>
|
||||||
* </ul>
|
* </ul>
|
||||||
*
|
* <p>
|
||||||
* As the repository connects to some backend either locally or remote, the access to the repository may fail. The methods capsule the
|
* As the repository connects to some backend either locally or remote, the access to the repository may fail. The methods capsule the
|
||||||
* backend errors into <code>{@link MetadataRepositoryException}</code>.
|
* backend errors into <code>{@link MetadataRepositoryException}</code>.
|
||||||
*
|
* <p>
|
||||||
* Facets are the way to provide additional metadata that is not part of the base API. It depends on the repository type (e.g. Maven, NPM,
|
* Facets are the way to provide additional metadata that is not part of the base API. It depends on the repository type (e.g. Maven, NPM,
|
||||||
* not the metadata backend) what facets are stored in addition to the standard metadata.
|
* not the metadata backend) what facets are stored in addition to the standard metadata.
|
||||||
* Facets have a specific facet ID that represents the schema for the data stored. For creating specific objects for a given
|
* Facets have a specific facet ID that represents the schema for the data stored. For creating specific objects for a given
|
||||||
|
@ -86,20 +86,19 @@ import java.util.stream.Stream;
|
||||||
* a hierarchical path.
|
* a hierarchical path.
|
||||||
* The data in each facet instance is stored in properties (key-value pairs). The properties are converted into / from the specific
|
* The data in each facet instance is stored in properties (key-value pairs). The properties are converted into / from the specific
|
||||||
* facet object.
|
* facet object.
|
||||||
*
|
* <p>
|
||||||
* Facets can be stored on repository, project, version and artifact level.
|
* Facets can be stored on repository, project, version and artifact level.
|
||||||
*
|
* <p>
|
||||||
* For retrieving artifacts there are methods that return lists and streaming based methods. Some implementations (e.g. JCR) use
|
* For retrieving artifacts there are methods that return lists and streaming based methods. Some implementations (e.g. JCR) use
|
||||||
* lazy loading for the retrieved objects. So the streaming methods may be faster and use less memory than the list based methods.
|
* lazy loading for the retrieved objects. So the streaming methods may be faster and use less memory than the list based methods.
|
||||||
* But for some backends there is no difference.
|
* But for some backends there is no difference.
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings( "NullableProblems" )
|
||||||
@ParametersAreNonnullByDefault
|
@ParametersAreNonnullByDefault
|
||||||
public interface MetadataRepository
|
public interface MetadataRepository
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update metadata for a particular project in the metadata repository, or create it, if it does not already exist.
|
* Update metadata for a particular project in the metadata repository, or create it, if it does not already exist.
|
||||||
*
|
*
|
||||||
|
@ -169,42 +168,39 @@ public interface MetadataRepository
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* The same as {@link #getMetadataFacetStream(RepositorySession, String, Class, QueryParameter)}
|
||||||
* The same as
|
|
||||||
* @see #getMetadataFacetStream(RepositorySession, String, Class, QueryParameter queryParameter)
|
|
||||||
* but uses default query parameters.
|
* but uses default query parameters.
|
||||||
*
|
* <p>
|
||||||
* There is no limitation of the number of result objects returned, but implementations may have a hard upper bound for
|
* There is no limitation of the number of result objects returned, but implementations may have a hard upper bound for
|
||||||
* the number of results.
|
* the number of results.
|
||||||
*
|
*
|
||||||
* @param session
|
* @param session The repository session.
|
||||||
* @param repositoryId
|
* @param repositoryId The repository id.
|
||||||
* @param facetClazz
|
* @param facetClazz The facet class
|
||||||
* @param <T>
|
* @param <T> The facet type
|
||||||
* @return
|
* @return A stream of facet objects, or a empty stream if no facet was found.
|
||||||
* @throws MetadataRepositoryException
|
* @throws MetadataRepositoryException if the facet retrieval fails.
|
||||||
* @since 3.0
|
* @since 3.0
|
||||||
*/
|
*/
|
||||||
<T extends MetadataFacet> Stream<T> getMetadataFacetStream( RepositorySession session,
|
<T extends MetadataFacet> Stream<T> getMetadataFacetStream( RepositorySession session,
|
||||||
String repositoryId, Class<T> facetClazz)
|
String repositoryId, Class<T> facetClazz )
|
||||||
throws MetadataRepositoryException;
|
throws MetadataRepositoryException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a stream of MetadataFacet elements that match the given facet class.
|
* Returns a stream of MetadataFacet elements that match the given facet class.
|
||||||
* Implementations should order the resulting stream by facet name.
|
* Implementations should order the resulting stream by facet name.
|
||||||
*
|
*
|
||||||
*
|
|
||||||
* @param session The repository session
|
* @param session The repository session
|
||||||
* @param repositoryId The repository id
|
* @param repositoryId The repository id
|
||||||
* @param facetClazz The class of the facet
|
* @param facetClazz The class of the facet
|
||||||
* @param <T> The facet type
|
* @param <T> The facet type
|
||||||
* @return
|
* @return A stream of facet objects, or a empty stream if no facet was found.
|
||||||
* @throws MetadataRepositoryException
|
* @throws MetadataRepositoryException if the facet retrieval fails
|
||||||
* @since 3.0
|
* @since 3.0
|
||||||
*/
|
*/
|
||||||
<T extends MetadataFacet> Stream<T> getMetadataFacetStream( RepositorySession session,
|
<T extends MetadataFacet> Stream<T> getMetadataFacetStream( RepositorySession session,
|
||||||
String repositoryId, Class<T> facetClazz,
|
String repositoryId, Class<T> facetClazz,
|
||||||
QueryParameter queryParameter)
|
QueryParameter queryParameter )
|
||||||
throws MetadataRepositoryException;
|
throws MetadataRepositoryException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -251,7 +247,7 @@ public interface MetadataRepository
|
||||||
* @since 3.0
|
* @since 3.0
|
||||||
*/
|
*/
|
||||||
<T extends MetadataFacet> T getMetadataFacet( RepositorySession session, String repositoryId,
|
<T extends MetadataFacet> T getMetadataFacet( RepositorySession session, String repositoryId,
|
||||||
Class<T> clazz, String name)
|
Class<T> clazz, String name )
|
||||||
throws MetadataRepositoryException;
|
throws MetadataRepositoryException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -292,18 +288,15 @@ public interface MetadataRepository
|
||||||
/**
|
/**
|
||||||
* Is the same as {@link #getArtifactsByDateRange(RepositorySession, String, ZonedDateTime, ZonedDateTime, QueryParameter)}, but
|
* Is the same as {@link #getArtifactsByDateRange(RepositorySession, String, ZonedDateTime, ZonedDateTime, QueryParameter)}, but
|
||||||
* uses default query parameters.
|
* uses default query parameters.
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
List<ArtifactMetadata> getArtifactsByDateRange( RepositorySession session, String repositoryId,
|
List<ArtifactMetadata> getArtifactsByDateRange( RepositorySession session, String repositoryId,
|
||||||
@Nullable ZonedDateTime startTime, @Nullable ZonedDateTime endTime )
|
@Nullable ZonedDateTime startTime, @Nullable ZonedDateTime endTime )
|
||||||
throws MetadataRepositoryException;
|
throws MetadataRepositoryException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* Searches for artifacts where the 'whenGathered' attribute value is between the given start and end time.
|
* Searches for artifacts where the 'whenGathered' attribute value is between the given start and end time.
|
||||||
* If start or end time or both are <code>null</code>, the time range for the search is unbounded for this parameter.
|
* If start or end time or both are <code>null</code>, the time range for the search is unbounded for this parameter.
|
||||||
*
|
*
|
||||||
*
|
|
||||||
* @param session The repository session
|
* @param session The repository session
|
||||||
* @param repositoryId The repository id
|
* @param repositoryId The repository id
|
||||||
* @param startTime The start time/date as zoned date, can be <code>null</code>
|
* @param startTime The start time/date as zoned date, can be <code>null</code>
|
||||||
|
@ -321,15 +314,15 @@ public interface MetadataRepository
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns all the artifacts who's 'whenGathered' attribute value is inside the given time range (inclusive) as stream of objects.
|
* Returns all the artifacts who's 'whenGathered' attribute value is inside the given time range (inclusive) as stream of objects.
|
||||||
*
|
* <p>
|
||||||
* Implementations should return a stream of sorted objects. The objects should be sorted by the 'whenGathered' date in ascending order.
|
* Implementations should return a stream of sorted objects. The objects should be sorted by the 'whenGathered' date in ascending order.
|
||||||
*
|
*
|
||||||
* @param session The repository session
|
* @param session The repository session
|
||||||
* @param repositoryId The repository id
|
* @param repositoryId The repository id
|
||||||
* @param startTime The start time, can be <code>null</code>
|
* @param startTime The start time, can be <code>null</code>
|
||||||
* @param endTime The end time, can be <code>null</code>
|
* @param endTime The end time, can be <code>null</code>
|
||||||
* @return A stream of artifact metadata objects.
|
* @return A stream of artifact metadata objects, or a empty stream if no artifact was found.
|
||||||
* @throws MetadataRepositoryException
|
* @throws MetadataRepositoryException if the artifact retrieval fails.
|
||||||
* @since 3.0
|
* @since 3.0
|
||||||
*/
|
*/
|
||||||
Stream<ArtifactMetadata> getArtifactByDateRangeStream( RepositorySession session, String repositoryId,
|
Stream<ArtifactMetadata> getArtifactByDateRangeStream( RepositorySession session, String repositoryId,
|
||||||
|
@ -338,7 +331,7 @@ public interface MetadataRepository
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns all the artifacts who's 'whenGathered' attribute value is inside the given time range (inclusive) as stream of objects.
|
* Returns all the artifacts who's 'whenGathered' attribute value is inside the given time range (inclusive) as stream of objects.
|
||||||
*
|
* <p>
|
||||||
* If no sort attributes are given by the queryParameter, the result is sorted by the 'whenGathered' date.
|
* If no sort attributes are given by the queryParameter, the result is sorted by the 'whenGathered' date.
|
||||||
*
|
*
|
||||||
* @param session The repository session
|
* @param session The repository session
|
||||||
|
@ -347,12 +340,12 @@ public interface MetadataRepository
|
||||||
* @param endTime The end time, can be <code>null</code>
|
* @param endTime The end time, can be <code>null</code>
|
||||||
* @param queryParameter Additional parameters for the query that affect ordering and number of returned results.
|
* @param queryParameter Additional parameters for the query that affect ordering and number of returned results.
|
||||||
* @return A stream of artifact metadata objects.
|
* @return A stream of artifact metadata objects.
|
||||||
* @throws MetadataRepositoryException
|
* @throws MetadataRepositoryException if the artifact retrieval fails.
|
||||||
* @since 3.0
|
* @since 3.0
|
||||||
*/
|
*/
|
||||||
Stream<ArtifactMetadata> getArtifactByDateRangeStream( RepositorySession session, String repositoryId,
|
Stream<ArtifactMetadata> getArtifactByDateRangeStream( RepositorySession session, String repositoryId,
|
||||||
@Nullable ZonedDateTime startTime, @Nullable ZonedDateTime endTime,
|
@Nullable ZonedDateTime startTime, @Nullable ZonedDateTime endTime,
|
||||||
QueryParameter queryParameter)
|
QueryParameter queryParameter )
|
||||||
throws MetadataRepositoryException;
|
throws MetadataRepositoryException;
|
||||||
|
|
||||||
|
|
||||||
|
@ -363,7 +356,7 @@ public interface MetadataRepository
|
||||||
* @param repositoryId The repository id
|
* @param repositoryId The repository id
|
||||||
* @param checksum The checksum as string of numbers
|
* @param checksum The checksum as string of numbers
|
||||||
* @return The list of artifacts that match the given checksum.
|
* @return The list of artifacts that match the given checksum.
|
||||||
* @throws MetadataRepositoryException
|
* @throws MetadataRepositoryException if the artifact retrieval fails
|
||||||
*/
|
*/
|
||||||
List<ArtifactMetadata> getArtifactsByChecksum( RepositorySession session, String repositoryId, String checksum )
|
List<ArtifactMetadata> getArtifactsByChecksum( RepositorySession session, String repositoryId, String checksum )
|
||||||
throws MetadataRepositoryException;
|
throws MetadataRepositoryException;
|
||||||
|
@ -371,101 +364,121 @@ public interface MetadataRepository
|
||||||
/**
|
/**
|
||||||
* Get artifacts with a project version metadata key that matches the passed value.
|
* Get artifacts with a project version metadata key that matches the passed value.
|
||||||
*
|
*
|
||||||
*
|
* @param session The repository session
|
||||||
* @param session
|
* @param key The attribute key to search
|
||||||
* @param key
|
* @param value The attribute value used for search
|
||||||
* @param value
|
* @param repositoryId can be <code>null</code>, meaning search in all repositories
|
||||||
* @param repositoryId can be null, meaning search in all repositories
|
* @return a list of artifacts. A empty list, if no artifact was found.
|
||||||
* @return a list of artifacts
|
* @throws MetadataRepositoryException if the artifact retrieval fails.
|
||||||
* @throws MetadataRepositoryException
|
|
||||||
*/
|
*/
|
||||||
List<ArtifactMetadata> getArtifactsByProjectVersionMetadata( RepositorySession session, String key, String value,
|
List<ArtifactMetadata> getArtifactsByProjectVersionFacet( RepositorySession session, String key, String value,
|
||||||
@Nullable String repositoryId )
|
@Nullable String repositoryId )
|
||||||
throws MetadataRepositoryException;
|
throws MetadataRepositoryException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get artifacts with an artifact metadata key that matches the passed value.
|
* Get artifacts with an artifact metadata key that matches the passed value.
|
||||||
|
* <code>key</code> ist the string representation of one of the metadata attributes. Only artifacts are returned where
|
||||||
|
* the attribute value matches exactly the given search value.
|
||||||
*
|
*
|
||||||
*
|
* @param session The repository session.
|
||||||
* @param session
|
* @param key The string representation of the artifact metadata attribute.
|
||||||
* @param key
|
* @param value The search value.
|
||||||
* @param value
|
* @param repositoryId can be <code>null</code>, meaning search in all repositories
|
||||||
* @param repositoryId can be null, meaning search in all repositories
|
* @return a list of artifact objects for each artifact that matches the search string
|
||||||
* @return a list of artifacts
|
* @throws MetadataRepositoryException if the artifact retrieval fails.
|
||||||
* @throws MetadataRepositoryException
|
|
||||||
*/
|
*/
|
||||||
List<ArtifactMetadata> getArtifactsByMetadata( RepositorySession session, String key, String value, String repositoryId )
|
List<ArtifactMetadata> getArtifactsByAttribute( RepositorySession session, String key, String value, @Nullable String repositoryId )
|
||||||
throws MetadataRepositoryException;
|
throws MetadataRepositoryException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get artifacts with a property key that matches the passed value.
|
* Get artifacts with a attribute on project version level that matches the passed value.
|
||||||
* Possible keys are 'scm.url', 'org.name', 'url', 'mailingList.0.name', 'license.0.name',...
|
* Possible keys are 'scm.url', 'org.name', 'url', 'mailingList.0.name', 'license.0.name',...
|
||||||
*
|
*
|
||||||
*
|
* @param session the repository session.
|
||||||
* @param session
|
* @param key The name of the attribute (may be nested like scm.url, mailinglist.0.name)
|
||||||
* @param key
|
* @param value The value to search for
|
||||||
* @param value
|
* @param repositoryId can be <code>null</code>, which means to search in all repositories
|
||||||
* @param repositoryId can be null, meaning search in all repositories
|
* @return a list of artifacts or a empty list, if no artifact was found
|
||||||
* @return a list of artifacts
|
* @throws MetadataRepositoryException if the artifact retrieval fails
|
||||||
* @throws MetadataRepositoryException
|
|
||||||
*/
|
*/
|
||||||
List<ArtifactMetadata> getArtifactsByProperty( RepositorySession session, String key, String value, String repositoryId )
|
List<ArtifactMetadata> getArtifactsByProjectVersionAttribute( RepositorySession session, String key, String value, @Nullable String repositoryId )
|
||||||
throws MetadataRepositoryException;
|
throws MetadataRepositoryException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Removes the data for the artifact with the given coordinates from the metadata repository. This will not remove the artifact itself
|
||||||
|
* from the storage. It will only remove the metadata.
|
||||||
|
*
|
||||||
|
* @param session The repository session
|
||||||
|
* @param repositoryId The repository id
|
||||||
|
* @param namespace The namespace of the project
|
||||||
|
* @param project The project name
|
||||||
|
* @param version The project version
|
||||||
|
* @param id The artifact id
|
||||||
|
* @throws MetadataRepositoryException if the artifact retrieval fails, or if the artifact cannot be found.
|
||||||
|
*/
|
||||||
void removeArtifact( RepositorySession session, String repositoryId, String namespace, String project, String version, String id )
|
void removeArtifact( RepositorySession session, String repositoryId, String namespace, String project, String version, String id )
|
||||||
throws MetadataRepositoryException;
|
throws MetadataRepositoryException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* used for deleting timestamped version of SNAPSHOT artifacts
|
* Remove timestamped version of artifact. This removes a snapshot artifact by giving the artifact metadata
|
||||||
|
* and the base version of the project.
|
||||||
*
|
*
|
||||||
*
|
* @param session The repository session
|
||||||
* @param session
|
|
||||||
* @param artifactMetadata the artifactMetadata with the timestamped version (2.0-20120618.214135-2)
|
* @param artifactMetadata the artifactMetadata with the timestamped version (2.0-20120618.214135-2)
|
||||||
* @param baseVersion the base version of the snapshot (2.0-SNAPSHOT)
|
* @param baseVersion the base version of the snapshot (2.0-SNAPSHOT)
|
||||||
* @throws MetadataRepositoryException
|
* @throws MetadataRepositoryException if the removal fails.
|
||||||
* @since 1.4-M3
|
* @since 1.4-M3
|
||||||
*/
|
*/
|
||||||
void removeArtifact( RepositorySession session, ArtifactMetadata artifactMetadata, String baseVersion )
|
void removeTimestampedArtifact( RepositorySession session, ArtifactMetadata artifactMetadata, String baseVersion )
|
||||||
throws MetadataRepositoryException;
|
throws MetadataRepositoryException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* FIXME need a unit test!!!
|
* FIXME need a unit test!!!
|
||||||
* Only remove {@link MetadataFacet} for the artifact
|
* Removes the {@link MetadataFacet} of the given artifact.
|
||||||
*
|
*
|
||||||
*
|
* @param session The repository session
|
||||||
* @param session
|
* @param repositoryId The repository id.
|
||||||
* @param repositoryId
|
* @param namespace The namespace
|
||||||
* @param namespace
|
* @param project The project name
|
||||||
* @param project
|
* @param version The project version
|
||||||
* @param version
|
* @param metadataFacet The facet data
|
||||||
* @param metadataFacet
|
* @throws MetadataRepositoryException if the removal failed
|
||||||
* @throws MetadataRepositoryException
|
|
||||||
* @since 1.4-M3
|
* @since 1.4-M3
|
||||||
*/
|
*/
|
||||||
void removeArtifact( RepositorySession session, String repositoryId, String namespace, String project, String version,
|
void removeFacetFromArtifact( RepositorySession session, String repositoryId, String namespace, String project, String version,
|
||||||
MetadataFacet metadataFacet )
|
MetadataFacet metadataFacet )
|
||||||
throws MetadataRepositoryException;
|
throws MetadataRepositoryException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Delete a repository's metadata. This includes all associated metadata facets.
|
* Deletes all metadata of the given repository. This includes artifact metadata and all associated metadata facets.
|
||||||
*
|
*
|
||||||
* @param session
|
* @param session The repository session
|
||||||
* @param repositoryId the repository to delete
|
* @param repositoryId the repository to delete
|
||||||
|
* @throws MetadataRepositoryException if the removal failed
|
||||||
*/
|
*/
|
||||||
void removeRepository( RepositorySession session, String repositoryId )
|
void removeRepository( RepositorySession session, String repositoryId )
|
||||||
throws MetadataRepositoryException;
|
throws MetadataRepositoryException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Removes the given namespace and its contents from the metadata repository.
|
||||||
*
|
*
|
||||||
* @param session
|
* @param session The repository session
|
||||||
* @param repositoryId
|
* @param repositoryId The repository id
|
||||||
* @param namespace (groupId for maven )
|
* @param namespace The namespace '.' separated ( it's the groupId for maven )
|
||||||
* @throws MetadataRepositoryException
|
* @throws MetadataRepositoryException if the removal failed
|
||||||
* @since 1.4-M3
|
* @since 1.4-M3
|
||||||
*/
|
*/
|
||||||
void removeNamespace( RepositorySession session, String repositoryId, String namespace )
|
void removeNamespace( RepositorySession session, String repositoryId, String namespace )
|
||||||
throws MetadataRepositoryException;
|
throws MetadataRepositoryException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the metadata for all artifacts of the given repository.
|
||||||
|
*
|
||||||
|
* @param session The repository session
|
||||||
|
* @param repositoryId The repository id
|
||||||
|
* @return a list of artifact metadata objects. A empty list if no artifacts where found.
|
||||||
|
* @throws MetadataRepositoryException if the retrieval failed.
|
||||||
|
*/
|
||||||
List<ArtifactMetadata> getArtifacts( RepositorySession session, String repositoryId )
|
List<ArtifactMetadata> getArtifacts( RepositorySession session, String repositoryId )
|
||||||
throws MetadataRepositoryException;
|
throws MetadataRepositoryException;
|
||||||
|
|
||||||
|
@ -477,8 +490,8 @@ public interface MetadataRepository
|
||||||
* If there are no <code>sortFields</code> defined in the query parameter, the order of elements in the stream is undefined and depends
|
* If there are no <code>sortFields</code> defined in the query parameter, the order of elements in the stream is undefined and depends
|
||||||
* on the implementation.
|
* on the implementation.
|
||||||
*
|
*
|
||||||
* @param session
|
* @param session The repository session.
|
||||||
* @param repositoryId
|
* @param repositoryId The repository id.
|
||||||
* @return A stream of artifact metadata objects for each artifact found in the repository.
|
* @return A stream of artifact metadata objects for each artifact found in the repository.
|
||||||
* @since 3.0
|
* @since 3.0
|
||||||
*/
|
*/
|
||||||
|
@ -495,10 +508,10 @@ public interface MetadataRepository
|
||||||
* @param session The repository session
|
* @param session The repository session
|
||||||
* @param repositoryId The repository id
|
* @param repositoryId The repository id
|
||||||
* @return A (unlimited) stream of artifact metadata elements that are found in this repository
|
* @return A (unlimited) stream of artifact metadata elements that are found in this repository
|
||||||
* @since 3.0
|
|
||||||
* @see #getArtifactStream(RepositorySession, String, QueryParameter)
|
* @see #getArtifactStream(RepositorySession, String, QueryParameter)
|
||||||
|
* @since 3.0
|
||||||
*/
|
*/
|
||||||
Stream<ArtifactMetadata> getArtifactStream( RepositorySession session, String repositoryId)
|
Stream<ArtifactMetadata> getArtifactStream( RepositorySession session, String repositoryId )
|
||||||
throws MetadataResolutionException;
|
throws MetadataResolutionException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -510,8 +523,8 @@ public interface MetadataRepository
|
||||||
* @param projectId The project id. May not be <code>null</code>.
|
* @param projectId The project id. May not be <code>null</code>.
|
||||||
* @param projectVersion The project version. May not be <code>null</code>.
|
* @param projectVersion The project version. May not be <code>null</code>.
|
||||||
* @return A stream of artifact metadata object. Order and number of elements returned, depends on the <code>queryParameter</code>.
|
* @return A stream of artifact metadata object. Order and number of elements returned, depends on the <code>queryParameter</code>.
|
||||||
* @since 3.0
|
|
||||||
* @throws MetadataResolutionException if there are no elements for the given artifact coordinates.
|
* @throws MetadataResolutionException if there are no elements for the given artifact coordinates.
|
||||||
|
* @since 3.0
|
||||||
*/
|
*/
|
||||||
Stream<ArtifactMetadata> getArtifactStream( RepositorySession session, String repoId,
|
Stream<ArtifactMetadata> getArtifactStream( RepositorySession session, String repoId,
|
||||||
String namespace, String projectId,
|
String namespace, String projectId,
|
||||||
|
@ -528,30 +541,54 @@ public interface MetadataRepository
|
||||||
* @param projectId The project id. May not be <code>null</code>.
|
* @param projectId The project id. May not be <code>null</code>.
|
||||||
* @param projectVersion The project version. May not be <code>null</code>.
|
* @param projectVersion The project version. May not be <code>null</code>.
|
||||||
* @return A stream of artifact metadata object. Order and number of elements returned, depends on the <code>queryParameter</code>.
|
* @return A stream of artifact metadata object. Order and number of elements returned, depends on the <code>queryParameter</code>.
|
||||||
* @since 3.0
|
|
||||||
* @throws MetadataResolutionException if there are no elements for the given artifact coordinates.
|
* @throws MetadataResolutionException if there are no elements for the given artifact coordinates.
|
||||||
|
* @since 3.0
|
||||||
*/
|
*/
|
||||||
Stream<ArtifactMetadata> getArtifactStream( RepositorySession session, String repoId,
|
Stream<ArtifactMetadata> getArtifactStream( RepositorySession session, String repoId,
|
||||||
String namespace, String projectId,
|
String namespace, String projectId,
|
||||||
String projectVersion)
|
String projectVersion )
|
||||||
throws MetadataResolutionException;
|
throws MetadataResolutionException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* basically just checking it exists not complete data returned
|
* Returns the metadata for the given project. If there are no custom properties stored on the project, it will
|
||||||
|
* just return a <code>ProjectMetadata</code> object with the data provided by parameters.
|
||||||
*
|
*
|
||||||
*
|
* @param session The session id
|
||||||
* @param session
|
* @param repoId The repository id
|
||||||
* @param repoId
|
* @param namespace The namespace '.'-separated.
|
||||||
* @param namespace
|
* @param projectId The project name
|
||||||
* @param projectId
|
* @return The project metadata or <code>null</code> if not found.
|
||||||
* @return
|
* @throws MetadataResolutionException if the metadata retrieval failed
|
||||||
* @throws MetadataResolutionException
|
|
||||||
*/
|
*/
|
||||||
ProjectMetadata getProject( RepositorySession session, String repoId, String namespace, String projectId )
|
ProjectMetadata getProject( RepositorySession session, String repoId, String namespace, String projectId )
|
||||||
throws MetadataResolutionException;
|
throws MetadataResolutionException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the metadata for the project version.
|
||||||
|
*
|
||||||
|
* @param session The repository session.
|
||||||
|
* @param repoId The repository id.
|
||||||
|
* @param namespace The namespace '.'-separated
|
||||||
|
* @param projectId The project name
|
||||||
|
* @param projectVersion The project version
|
||||||
|
* @return The version metadata object, or <code>null</code>, if not found.
|
||||||
|
* @throws MetadataResolutionException if the retrieval of the metadata failed.
|
||||||
|
*/
|
||||||
ProjectVersionMetadata getProjectVersion( RepositorySession session, String repoId, String namespace, String projectId, String projectVersion )
|
ProjectVersionMetadata getProjectVersion( RepositorySession session, String repoId, String namespace, String projectId, String projectVersion )
|
||||||
throws MetadataResolutionException;
|
throws MetadataResolutionException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns all artifact version strings for a given project version. This is for snapshot versions and returns the timestamped
|
||||||
|
* versions, if available.
|
||||||
|
*
|
||||||
|
* @param session The repository session.
|
||||||
|
* @param repoId The repository id.
|
||||||
|
* @param namespace The namespace '.'-separated
|
||||||
|
* @param projectId The project name.
|
||||||
|
* @param projectVersion The project version.
|
||||||
|
* @return A list of version strings, or a empty list if no versions are found, or this is not a snapshot version.
|
||||||
|
* @throws MetadataResolutionException if the retrieval of the metadata failed.
|
||||||
|
*/
|
||||||
Collection<String> getArtifactVersions( RepositorySession session, String repoId, String namespace, String projectId, String projectVersion )
|
Collection<String> getArtifactVersions( RepositorySession session, String repoId, String namespace, String projectId, String projectVersion )
|
||||||
throws MetadataResolutionException;
|
throws MetadataResolutionException;
|
||||||
|
|
||||||
|
@ -560,131 +597,145 @@ public interface MetadataRepository
|
||||||
* a project version as a reference may be present (due to reverse-lookup of dependencies) before the actual
|
* a project version as a reference may be present (due to reverse-lookup of dependencies) before the actual
|
||||||
* project is, and we want to avoid adding a stub model to the content repository.
|
* project is, and we want to avoid adding a stub model to the content repository.
|
||||||
*
|
*
|
||||||
*
|
* @param session The repository session.
|
||||||
* @param session
|
* @param repoId The repository ID to look within
|
||||||
* @param repoId the repository ID to look within
|
* @param namespace The namespace of the project to get references to
|
||||||
* @param namespace the namespace of the project to get references to
|
* @param projectId The identifier of the project to get references to
|
||||||
* @param projectId the identifier of the project to get references to
|
* @param projectVersion The version of the project to get references to
|
||||||
* @param projectVersion the version of the project to get references to
|
|
||||||
* @return a list of project references
|
* @return a list of project references
|
||||||
|
* @throws MetadataResolutionException if the version could not be found.
|
||||||
*/
|
*/
|
||||||
Collection<ProjectVersionReference> getProjectReferences( RepositorySession session, String repoId, String namespace, String projectId,
|
Collection<ProjectVersionReference> getProjectReferences( RepositorySession session, String repoId, String namespace, String projectId,
|
||||||
String projectVersion )
|
String projectVersion )
|
||||||
throws MetadataResolutionException;
|
throws MetadataResolutionException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the names of the root namespaces stored for this repository.
|
||||||
|
*
|
||||||
|
* @param session The repository session.
|
||||||
|
* @param repoId The repository id.
|
||||||
|
* @return A list of namespace names, or empty list, if no namespace is stored for this repository.
|
||||||
|
* @throws MetadataResolutionException If the retrieval failed.
|
||||||
|
*/
|
||||||
Collection<String> getRootNamespaces( RepositorySession session, String repoId )
|
Collection<String> getRootNamespaces( RepositorySession session, String repoId )
|
||||||
throws MetadataResolutionException;
|
throws MetadataResolutionException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Returns the list of namespace names that are children of the given namespace. It does not descend recursively.
|
||||||
*
|
*
|
||||||
* @param session
|
* @param session The repository session.
|
||||||
* @param repoId
|
* @param repoId The repository id.
|
||||||
* @param namespace
|
* @param namespace The parent namespace '.'-separated.
|
||||||
* @return {@link Collection} of child namespaces of the namespace argument
|
* @return {@link Collection} of child namespace names, or a empty list, if there are no children for the given parent namespace.
|
||||||
* @throws MetadataResolutionException
|
* @throws MetadataResolutionException if the retrieval failed.
|
||||||
*/
|
*/
|
||||||
Collection<String> getNamespaces( RepositorySession session, String repoId, String namespace )
|
Collection<String> getChildNamespaces( RepositorySession session, String repoId, String namespace )
|
||||||
throws MetadataResolutionException;
|
throws MetadataResolutionException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Return the project names that of all projects stored under the given namespace.
|
||||||
*
|
*
|
||||||
* @param session
|
* @param session The repository session.
|
||||||
* @param repoId
|
* @param repoId The repository id.
|
||||||
* @param namespace
|
* @param namespace The namespace '.'-separated.
|
||||||
* @return
|
* @return The list of project names or empty list if no project exists at the given namespace.
|
||||||
* @throws MetadataResolutionException
|
* @throws MetadataResolutionException if the retrieval failed.
|
||||||
*/
|
*/
|
||||||
Collection<String> getProjects( RepositorySession session, String repoId, String namespace )
|
Collection<String> getProjects( RepositorySession session, String repoId, String namespace )
|
||||||
throws MetadataResolutionException;
|
throws MetadataResolutionException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Returns the names of all versions stored under the given project.
|
||||||
*
|
*
|
||||||
* @param session
|
* @param session The repository session.
|
||||||
* @param repoId
|
* @param repoId The repository id.
|
||||||
* @param namespace
|
* @param namespace The namespace '.'-separated.
|
||||||
* @param projectId
|
* @param projectId The project name.
|
||||||
* @return
|
* @return The list of versions or a empty list, if not version was found.
|
||||||
* @throws MetadataResolutionException
|
* @throws MetadataResolutionException if the retrieval failed.
|
||||||
*/
|
*/
|
||||||
Collection<String> getProjectVersions( RepositorySession session, String repoId, String namespace, String projectId )
|
Collection<String> getProjectVersions( RepositorySession session, String repoId, String namespace, String projectId )
|
||||||
throws MetadataResolutionException;
|
throws MetadataResolutionException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Removes a project version and all its artifact and facet metadata under it.
|
||||||
*
|
*
|
||||||
* @param session
|
* @param session The repository session.
|
||||||
* @param repoId
|
* @param repoId The repository id.
|
||||||
* @param namespace
|
* @param namespace The namespace '.'-separated.
|
||||||
* @param projectId
|
* @param projectId The project name
|
||||||
* @param projectVersion
|
* @param projectVersion The project version.
|
||||||
* @throws MetadataRepositoryException
|
* @throws MetadataRepositoryException if the removal failed.
|
||||||
* @since 1.4-M4
|
* @since 1.4-M4
|
||||||
*/
|
*/
|
||||||
void removeProjectVersion( RepositorySession session, String repoId, String namespace, String projectId, String projectVersion )
|
void removeProjectVersion( RepositorySession session, String repoId, String namespace, String projectId, String projectVersion )
|
||||||
throws MetadataRepositoryException;
|
throws MetadataRepositoryException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Returns the metadata of all artifacts stored for the given project version.
|
||||||
*
|
*
|
||||||
* @param session
|
* @param session The repository session.
|
||||||
* @param repoId
|
* @param repoId The repository id.
|
||||||
* @param namespace
|
* @param namespace The namespace '.'-separated.
|
||||||
* @param projectId
|
* @param projectId The project name.
|
||||||
* @param projectVersion
|
* @param projectVersion The project version.
|
||||||
* @return
|
* @return The list of artifact metadata objects, or a empty list, if no artifact exists for this version.
|
||||||
* @throws MetadataResolutionException
|
* @throws MetadataResolutionException if the retrieval failed.
|
||||||
*/
|
*/
|
||||||
Collection<ArtifactMetadata> getArtifacts( RepositorySession session, String repoId, String namespace, String projectId,
|
Collection<ArtifactMetadata> getArtifacts( RepositorySession session, String repoId, String namespace, String projectId,
|
||||||
String projectVersion )
|
String projectVersion )
|
||||||
throws MetadataResolutionException;
|
throws MetadataResolutionException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* remove a project
|
* Removes the project metadata and metadata for all stored versions, artifacts and facets of this project.
|
||||||
*
|
*
|
||||||
*
|
* @param session The repository session.
|
||||||
* @param session
|
* @param repositoryId The repository id.
|
||||||
* @param repositoryId
|
* @param namespace The namespace '.'-separated.
|
||||||
* @param namespace
|
* @param projectId The project name.
|
||||||
* @param projectId
|
* @throws MetadataRepositoryException if the removal failed.
|
||||||
* @throws MetadataRepositoryException
|
|
||||||
* @since 1.4-M4
|
* @since 1.4-M4
|
||||||
*/
|
*/
|
||||||
void removeProject( RepositorySession session, String repositoryId, String namespace, String projectId )
|
void removeProject( RepositorySession session, String repositoryId, String namespace, String projectId )
|
||||||
throws MetadataRepositoryException;
|
throws MetadataRepositoryException;
|
||||||
|
|
||||||
|
/**
|
||||||
void close()
|
* Closes the repository.
|
||||||
|
* Repositories are normally opened during startup and closed on shutdown. The closing of a repository stops all
|
||||||
|
* invalidates all connections to it.
|
||||||
|
* Sessions that are open are invalidated too. The repository will throw exceptions if it is used after closing.
|
||||||
|
*
|
||||||
|
* @throws MetadataRepositoryException if the something went wrong or if the repository was closed already.
|
||||||
|
*/
|
||||||
|
void close( )
|
||||||
throws MetadataRepositoryException;
|
throws MetadataRepositoryException;
|
||||||
|
|
||||||
|
|
||||||
boolean canObtainAccess( Class<?> aClass );
|
|
||||||
|
|
||||||
<T> T obtainAccess( RepositorySession session, Class<T> aClass )
|
|
||||||
throws MetadataRepositoryException;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Full text artifacts search.
|
* Full text artifacts search. Searches for the given string in all metadata and returns artifacts where the
|
||||||
|
* text was found.
|
||||||
*
|
*
|
||||||
*
|
* @param session The repository session.
|
||||||
* @param session
|
* @param repositoryId can be <code>null</code> to search in all repositories
|
||||||
* @param repositoryId can be null to search in all repositories
|
* @param text The search text
|
||||||
* @param text
|
* @param exact if true, the value must exactly match the text.
|
||||||
* @param exact running an exact search, the value must exactly match the text.
|
* @return a list of artifacts or empty list if no results where found.
|
||||||
* @return a list of artifacts
|
* @throws MetadataRepositoryException if the retrieval failed.
|
||||||
* @throws MetadataRepositoryException
|
|
||||||
*/
|
*/
|
||||||
List<ArtifactMetadata> searchArtifacts( RepositorySession session, String repositoryId, String text, boolean exact )
|
List<ArtifactMetadata> searchArtifacts( RepositorySession session, String repositoryId, String text, boolean exact )
|
||||||
throws MetadataRepositoryException;
|
throws MetadataRepositoryException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Full text artifacts search inside the specified key.
|
* Full text artifacts search inside the specified key. Searches for the given text in all attributes with the given
|
||||||
|
* name.
|
||||||
*
|
*
|
||||||
*
|
* @param session The repository session.
|
||||||
* @param session
|
* @param repositoryId can be <code>null</code> to search in all repositories
|
||||||
* @param repositoryId can be null to search in all repositories
|
* @param key search only inside this attribute.
|
||||||
* @param key search only inside this key
|
* @param text The search string.
|
||||||
* @param text
|
* @param exact if true, the value must exactly match the text.
|
||||||
* @param exact running an exact search, the value must exactly match the text.
|
* @return a list of artifacts or empty list if no results were found.
|
||||||
* @return a list of artifacts
|
* @throws MetadataRepositoryException if the retrieval failed.
|
||||||
* @throws MetadataRepositoryException
|
|
||||||
*/
|
*/
|
||||||
List<ArtifactMetadata> searchArtifacts( RepositorySession session, String repositoryId, String key, String text, boolean exact )
|
List<ArtifactMetadata> searchArtifacts( RepositorySession session, String repositoryId, String key, String text, boolean exact )
|
||||||
throws MetadataRepositoryException;
|
throws MetadataRepositoryException;
|
||||||
|
|
|
@ -177,7 +177,7 @@ public abstract class AbstractMetadataRepositoryTest
|
||||||
}
|
}
|
||||||
} );
|
} );
|
||||||
|
|
||||||
// for the getArtifactsByProjectVersionMetadata tests
|
// for the getArtifactsByProjectVersionFacet tests
|
||||||
factories.add( new GenericMetadataFacetFactory( ) );
|
factories.add( new GenericMetadataFacetFactory( ) );
|
||||||
|
|
||||||
return factories;
|
return factories;
|
||||||
|
@ -1540,13 +1540,13 @@ public abstract class AbstractMetadataRepositoryTest
|
||||||
|
|
||||||
assertThat( namespaces ).isNotNull( ).isNotEmpty( ).hasSize( 1 ).contains( "org" );
|
assertThat( namespaces ).isNotNull( ).isNotEmpty( ).hasSize( 1 ).contains( "org" );
|
||||||
|
|
||||||
namespaces = getRepository( ).getNamespaces( session, TEST_REPO_ID, "org" );
|
namespaces = getRepository( ).getChildNamespaces( session, TEST_REPO_ID, "org" );
|
||||||
assertThat( namespaces ).isNotNull( ).isNotEmpty( ).hasSize( 1 ).contains( "apache" );
|
assertThat( namespaces ).isNotNull( ).isNotEmpty( ).hasSize( 1 ).contains( "apache" );
|
||||||
|
|
||||||
namespaces = getRepository( ).getNamespaces( session, TEST_REPO_ID, "org.apache" );
|
namespaces = getRepository( ).getChildNamespaces( session, TEST_REPO_ID, "org.apache" );
|
||||||
assertThat( namespaces ).isNotNull( ).isNotEmpty( ).hasSize( 1 ).contains( "maven" );
|
assertThat( namespaces ).isNotNull( ).isNotEmpty( ).hasSize( 1 ).contains( "maven" );
|
||||||
|
|
||||||
namespaces = getRepository( ).getNamespaces( session, TEST_REPO_ID, "org.apache.maven" );
|
namespaces = getRepository( ).getChildNamespaces( session, TEST_REPO_ID, "org.apache.maven" );
|
||||||
assertThat( namespaces ).isNotNull( ).isNotEmpty( ).hasSize( 1 ).contains( "shared" );
|
assertThat( namespaces ).isNotNull( ).isNotEmpty( ).hasSize( 1 ).contains( "shared" );
|
||||||
|
|
||||||
} );
|
} );
|
||||||
|
@ -1566,7 +1566,7 @@ public abstract class AbstractMetadataRepositoryTest
|
||||||
metadata.setId( TEST_PROJECT_VERSION );
|
metadata.setId( TEST_PROJECT_VERSION );
|
||||||
getRepository( ).updateProjectVersion( session, TEST_REPO_ID, namespace, TEST_PROJECT, metadata );
|
getRepository( ).updateProjectVersion( session, TEST_REPO_ID, namespace, TEST_PROJECT, metadata );
|
||||||
|
|
||||||
Collection<String> namespaces = getRepository( ).getNamespaces( session, TEST_REPO_ID, namespace );
|
Collection<String> namespaces = getRepository( ).getChildNamespaces( session, TEST_REPO_ID, namespace );
|
||||||
|
|
||||||
assertThat( namespaces ).isNotNull( ).isEmpty( );
|
assertThat( namespaces ).isNotNull( ).isEmpty( );
|
||||||
|
|
||||||
|
@ -1754,7 +1754,7 @@ public abstract class AbstractMetadataRepositoryTest
|
||||||
|
|
||||||
tryAssert( ( ) -> {
|
tryAssert( ( ) -> {
|
||||||
Collection<ArtifactMetadata> artifactsByMetadata =
|
Collection<ArtifactMetadata> artifactsByMetadata =
|
||||||
getRepository( ).getArtifactsByProjectVersionMetadata( session, TEST_METADATA_KEY, TEST_METADATA_VALUE, TEST_REPO_ID );
|
getRepository( ).getArtifactsByProjectVersionFacet( session, TEST_METADATA_KEY, TEST_METADATA_VALUE, TEST_REPO_ID );
|
||||||
|
|
||||||
assertThat( artifactsByMetadata ).hasSize( 1 );
|
assertThat( artifactsByMetadata ).hasSize( 1 );
|
||||||
ArtifactMetadata artifactMetadata = artifactsByMetadata.iterator( ).next( );
|
ArtifactMetadata artifactMetadata = artifactsByMetadata.iterator( ).next( );
|
||||||
|
@ -1775,7 +1775,7 @@ public abstract class AbstractMetadataRepositoryTest
|
||||||
tryAssert( ( ) -> {
|
tryAssert( ( ) -> {
|
||||||
|
|
||||||
Collection<ArtifactMetadata> artifactsByMetadata =
|
Collection<ArtifactMetadata> artifactsByMetadata =
|
||||||
getRepository( ).getArtifactsByProjectVersionMetadata( session, TEST_METADATA_KEY, TEST_METADATA_VALUE, null );
|
getRepository( ).getArtifactsByProjectVersionFacet( session, TEST_METADATA_KEY, TEST_METADATA_VALUE, null );
|
||||||
assertThat( artifactsByMetadata ).hasSize( 1 );
|
assertThat( artifactsByMetadata ).hasSize( 1 );
|
||||||
assertThat( artifactsByMetadata.iterator( ).next( ).getRepositoryId( ) ).isNotNull( ).isNotEmpty( );
|
assertThat( artifactsByMetadata.iterator( ).next( ).getRepositoryId( ) ).isNotNull( ).isNotEmpty( );
|
||||||
} );
|
} );
|
||||||
|
@ -1792,7 +1792,7 @@ public abstract class AbstractMetadataRepositoryTest
|
||||||
tryAssert( ( ) -> {
|
tryAssert( ( ) -> {
|
||||||
|
|
||||||
Collection<ArtifactMetadata> artifactsByMetadata =
|
Collection<ArtifactMetadata> artifactsByMetadata =
|
||||||
getRepository( ).getArtifactsByProjectVersionMetadata( session, TEST_METADATA_KEY, TEST_METADATA_VALUE, null );
|
getRepository( ).getArtifactsByProjectVersionFacet( session, TEST_METADATA_KEY, TEST_METADATA_VALUE, null );
|
||||||
assertThat( artifactsByMetadata ).hasSize( 1 );
|
assertThat( artifactsByMetadata ).hasSize( 1 );
|
||||||
} );
|
} );
|
||||||
}
|
}
|
||||||
|
@ -1807,7 +1807,7 @@ public abstract class AbstractMetadataRepositoryTest
|
||||||
createArtifactWithMavenArtifactFacet( session );
|
createArtifactWithMavenArtifactFacet( session );
|
||||||
tryAssert( ( ) -> {
|
tryAssert( ( ) -> {
|
||||||
Collection<ArtifactMetadata> artifactsByMetadata =
|
Collection<ArtifactMetadata> artifactsByMetadata =
|
||||||
getRepository( ).getArtifactsByMetadata( session, "foo", TEST_METADATA_VALUE, null );
|
getRepository( ).getArtifactsByAttribute( session, "foo", TEST_METADATA_VALUE, null );
|
||||||
assertThat( artifactsByMetadata ).hasSize( 1 );
|
assertThat( artifactsByMetadata ).hasSize( 1 );
|
||||||
ArtifactMetadata artifactMetadata = artifactsByMetadata.iterator( ).next( );
|
ArtifactMetadata artifactMetadata = artifactsByMetadata.iterator( ).next( );
|
||||||
assertThat( artifactMetadata.getId( ) ).isEqualTo( TEST_PROJECT + "-" + TEST_PROJECT_VERSION + ".jar" );
|
assertThat( artifactMetadata.getId( ) ).isEqualTo( TEST_PROJECT + "-" + TEST_PROJECT_VERSION + ".jar" );
|
||||||
|
@ -1828,10 +1828,10 @@ public abstract class AbstractMetadataRepositoryTest
|
||||||
{
|
{
|
||||||
createArtifactWithData( session );
|
createArtifactWithData( session );
|
||||||
// only works on JCR implementation
|
// only works on JCR implementation
|
||||||
// Collection<ArtifactMetadata> artifactsByProperty = getRepository().getArtifactsByProperty( "org.name", TEST_ORGANIZATION.getName(), TEST_REPO_ID );
|
// Collection<ArtifactMetadata> artifactsByProperty = getRepository().getArtifactsByProjectVersionAttribute( "org.name", TEST_ORGANIZATION.getName(), TEST_REPO_ID );
|
||||||
tryAssert( ( ) -> {
|
tryAssert( ( ) -> {
|
||||||
|
|
||||||
Collection<ArtifactMetadata> artifactsByProperty = getRepository( ).getArtifactsByProperty( session, "url", TEST_URL, TEST_REPO_ID );
|
Collection<ArtifactMetadata> artifactsByProperty = getRepository( ).getArtifactsByProjectVersionAttribute( session, "url", TEST_URL, TEST_REPO_ID );
|
||||||
assertThat( artifactsByProperty ).hasSize( 1 );
|
assertThat( artifactsByProperty ).hasSize( 1 );
|
||||||
ArtifactMetadata artifactMetadata = artifactsByProperty.iterator( ).next( );
|
ArtifactMetadata artifactMetadata = artifactsByProperty.iterator( ).next( );
|
||||||
assertThat( artifactMetadata.getId( ) ).isEqualTo( TEST_PROJECT + "-" + TEST_PROJECT_VERSION + ".jar" );
|
assertThat( artifactMetadata.getId( ) ).isEqualTo( TEST_PROJECT + "-" + TEST_PROJECT_VERSION + ".jar" );
|
||||||
|
@ -2046,13 +2046,13 @@ public abstract class AbstractMetadataRepositoryTest
|
||||||
|
|
||||||
log.info( "artifactMetadatas: {}", artifactMetadatas );
|
log.info( "artifactMetadatas: {}", artifactMetadatas );
|
||||||
|
|
||||||
getRepository( ).removeArtifact( session, artifactOne, "2.0-SNAPSHOT" );
|
getRepository( ).removeTimestampedArtifact( session, artifactOne, "2.0-SNAPSHOT" );
|
||||||
|
|
||||||
artifactMetadatas = getRepository( ).getArtifacts( session, TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT, "2.0-SNAPSHOT" );
|
artifactMetadatas = getRepository( ).getArtifacts( session, TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT, "2.0-SNAPSHOT" );
|
||||||
|
|
||||||
assertThat( artifactMetadatas ).isNotNull( ).isNotEmpty( ).hasSize( 1 );
|
assertThat( artifactMetadatas ).isNotNull( ).isNotEmpty( ).hasSize( 1 );
|
||||||
|
|
||||||
getRepository( ).removeArtifact( session, artifactTwo, "2.0-SNAPSHOT" );
|
getRepository( ).removeTimestampedArtifact( session, artifactTwo, "2.0-SNAPSHOT" );
|
||||||
|
|
||||||
artifactMetadatas = getRepository( ).getArtifacts( session, TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT, "2.0-SNAPSHOT" );
|
artifactMetadatas = getRepository( ).getArtifacts( session, TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT, "2.0-SNAPSHOT" );
|
||||||
|
|
||||||
|
|
|
@ -73,7 +73,7 @@ public class RepositoryWalkingStatisticsProvider implements RepositoryStatistics
|
||||||
String ns )
|
String ns )
|
||||||
throws MetadataResolutionException
|
throws MetadataResolutionException
|
||||||
{
|
{
|
||||||
for ( String namespace : metadataRepository.getNamespaces( repositorySession , repositoryId, ns ) )
|
for ( String namespace : metadataRepository.getChildNamespaces( repositorySession , repositoryId, ns ) )
|
||||||
{
|
{
|
||||||
walkRepository( repositorySession, metadataRepository, stats, repositoryId, ns + "." + namespace );
|
walkRepository( repositorySession, metadataRepository, stats, repositoryId, ns + "." + namespace );
|
||||||
}
|
}
|
||||||
|
|
|
@ -482,7 +482,7 @@ public class CassandraMetadataRepository
|
||||||
|
|
||||||
// FIXME this one need peformance improvement maybe a cache?
|
// FIXME this one need peformance improvement maybe a cache?
|
||||||
@Override
|
@Override
|
||||||
public Collection<String> getNamespaces( RepositorySession session, final String repoId, final String namespaceId )
|
public Collection<String> getChildNamespaces( RepositorySession session, final String repoId, final String namespaceId )
|
||||||
throws MetadataResolutionException
|
throws MetadataResolutionException
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -2032,17 +2032,17 @@ public class CassandraMetadataRepository
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Project version and artifact level metadata are stored in the same place, no distinctions in Cassandra
|
* Project version and artifact level metadata are stored in the same place, no distinctions in Cassandra
|
||||||
* implementation, just calls {@link MetadataRepository#getArtifactsByMetadata(RepositorySession, String, String, String)}
|
* implementation, just calls {@link MetadataRepository#getArtifactsByAttribute(RepositorySession, String, String, String)}
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<ArtifactMetadata> getArtifactsByProjectVersionMetadata( RepositorySession session, String key, String value, String repositoryId )
|
public List<ArtifactMetadata> getArtifactsByProjectVersionFacet( RepositorySession session, String key, String value, String repositoryId )
|
||||||
throws MetadataRepositoryException
|
throws MetadataRepositoryException
|
||||||
{
|
{
|
||||||
return getArtifactsByMetadata( session, key, value, repositoryId );
|
return this.getArtifactsByAttribute( session, key, value, repositoryId );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<ArtifactMetadata> getArtifactsByMetadata( RepositorySession session, String key, String value, String repositoryId )
|
public List<ArtifactMetadata> getArtifactsByAttribute( RepositorySession session, String key, String value, String repositoryId )
|
||||||
throws MetadataRepositoryException
|
throws MetadataRepositoryException
|
||||||
{
|
{
|
||||||
RangeSlicesQuery<String, String, String> query =
|
RangeSlicesQuery<String, String, String> query =
|
||||||
|
@ -2101,7 +2101,7 @@ public class CassandraMetadataRepository
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<ArtifactMetadata> getArtifactsByProperty( RepositorySession session, String key, String value, String repositoryId )
|
public List<ArtifactMetadata> getArtifactsByProjectVersionAttribute( RepositorySession session, String key, String value, String repositoryId )
|
||||||
throws MetadataRepositoryException
|
throws MetadataRepositoryException
|
||||||
{
|
{
|
||||||
QueryResult<OrderedRows<String, String, String>> result =
|
QueryResult<OrderedRows<String, String, String>> result =
|
||||||
|
@ -2146,7 +2146,7 @@ public class CassandraMetadataRepository
|
||||||
final String version, final String id )
|
final String version, final String id )
|
||||||
throws MetadataRepositoryException
|
throws MetadataRepositoryException
|
||||||
{
|
{
|
||||||
logger.debug( "removeArtifact repositoryId: '{}', namespace: '{}', project: '{}', version: '{}', id: '{}'",
|
logger.debug( "removeTimestampedArtifact repositoryId: '{}', namespace: '{}', project: '{}', version: '{}', id: '{}'",
|
||||||
repositoryId, namespace, project, version, id );
|
repositoryId, namespace, project, version, id );
|
||||||
String key =
|
String key =
|
||||||
new ArtifactMetadataModel.KeyBuilder().withRepositoryId( repositoryId ).withNamespace( namespace ).withId(
|
new ArtifactMetadataModel.KeyBuilder().withRepositoryId( repositoryId ).withNamespace( namespace ).withId(
|
||||||
|
@ -2166,10 +2166,10 @@ public class CassandraMetadataRepository
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void removeArtifact( RepositorySession session, ArtifactMetadata artifactMetadata, String baseVersion )
|
public void removeTimestampedArtifact( RepositorySession session, ArtifactMetadata artifactMetadata, String baseVersion )
|
||||||
throws MetadataRepositoryException
|
throws MetadataRepositoryException
|
||||||
{
|
{
|
||||||
logger.debug( "removeArtifact repositoryId: '{}', namespace: '{}', project: '{}', version: '{}', id: '{}'",
|
logger.debug( "removeTimestampedArtifact repositoryId: '{}', namespace: '{}', project: '{}', version: '{}', id: '{}'",
|
||||||
artifactMetadata.getRepositoryId(), artifactMetadata.getNamespace(),
|
artifactMetadata.getRepositoryId(), artifactMetadata.getNamespace(),
|
||||||
artifactMetadata.getProject(), baseVersion, artifactMetadata.getId() );
|
artifactMetadata.getProject(), baseVersion, artifactMetadata.getId() );
|
||||||
String key =
|
String key =
|
||||||
|
@ -2182,7 +2182,7 @@ public class CassandraMetadataRepository
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void removeArtifact( RepositorySession session, final String repositoryId, final String namespace, final String project,
|
public void removeFacetFromArtifact( RepositorySession session, final String repositoryId, final String namespace, final String project,
|
||||||
final String version, final MetadataFacet metadataFacet )
|
final String version, final MetadataFacet metadataFacet )
|
||||||
throws MetadataRepositoryException
|
throws MetadataRepositoryException
|
||||||
{
|
{
|
||||||
|
@ -2447,21 +2447,6 @@ public class CassandraMetadataRepository
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean canObtainAccess( Class<?> aClass )
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public <T> T obtainAccess( RepositorySession session, Class<T> aClass )
|
|
||||||
throws MetadataRepositoryException
|
|
||||||
{
|
|
||||||
throw new IllegalArgumentException(
|
|
||||||
"Access using " + aClass + " is not supported on the cassandra metadata storage" );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private static class ModelMapperHolder
|
private static class ModelMapperHolder
|
||||||
{
|
{
|
||||||
private static ModelMapper MODEL_MAPPER = new ModelMapper();
|
private static ModelMapper MODEL_MAPPER = new ModelMapper();
|
||||||
|
@ -2473,7 +2458,7 @@ public class CassandraMetadataRepository
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This implementation just calls getArtifactsByMetadata( null, text, repositoryId ). We can't search artifacts by
|
* This implementation just calls getArtifactsByAttribute( null, text, repositoryId ). We can't search artifacts by
|
||||||
* any property.
|
* any property.
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
@ -2481,7 +2466,7 @@ public class CassandraMetadataRepository
|
||||||
final String text, final boolean exact )
|
final String text, final boolean exact )
|
||||||
throws MetadataRepositoryException
|
throws MetadataRepositoryException
|
||||||
{
|
{
|
||||||
return getArtifactsByMetadata( session, null, text, repositoryId );
|
return this.getArtifactsByAttribute( session, null, text, repositoryId );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -2494,8 +2479,8 @@ public class CassandraMetadataRepository
|
||||||
{
|
{
|
||||||
// TODO optimize
|
// TODO optimize
|
||||||
List<ArtifactMetadata> artifacts = new LinkedList<ArtifactMetadata>();
|
List<ArtifactMetadata> artifacts = new LinkedList<ArtifactMetadata>();
|
||||||
artifacts.addAll( getArtifactsByMetadata( session, key, text, repositoryId ) );
|
artifacts.addAll( this.getArtifactsByAttribute( session, key, text, repositoryId ) );
|
||||||
artifacts.addAll( getArtifactsByProperty( session, key, text, repositoryId ) );
|
artifacts.addAll( this.getArtifactsByProjectVersionAttribute( session, key, text, repositoryId ) );
|
||||||
return artifacts;
|
return artifacts;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -476,7 +476,7 @@ public class FileMetadataRepository
|
||||||
ZonedDateTime endTime)
|
ZonedDateTime endTime)
|
||||||
throws MetadataRepositoryException {
|
throws MetadataRepositoryException {
|
||||||
try {
|
try {
|
||||||
for (String namespace : getNamespaces(session, repoId, ns)) {
|
for (String namespace : this.getChildNamespaces(session, repoId, ns)) {
|
||||||
getArtifactsByDateRange(session, artifacts, repoId, ns + "." + namespace, startTime, endTime);
|
getArtifactsByDateRange(session, artifacts, repoId, ns + "." + namespace, startTime, endTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -580,17 +580,6 @@ public class FileMetadataRepository
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean canObtainAccess(Class<?> aClass) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public <T> T obtainAccess(RepositorySession session, Class<T> aClass) {
|
|
||||||
throw new IllegalArgumentException(
|
|
||||||
"Access using " + aClass + " is not supported on the file metadata storage");
|
|
||||||
}
|
|
||||||
|
|
||||||
private void updateArtifactFacets(ArtifactMetadata artifact, Properties properties) {
|
private void updateArtifactFacets(ArtifactMetadata artifact, Properties properties) {
|
||||||
String propertyPrefix = "artifact:facet:" + artifact.getId() + ":";
|
String propertyPrefix = "artifact:facet:" + artifact.getId() + ":";
|
||||||
for (MetadataFacet facet : artifact.getFacetList()) {
|
for (MetadataFacet facet : artifact.getFacetList()) {
|
||||||
|
@ -634,7 +623,7 @@ public class FileMetadataRepository
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void removeArtifact(RepositorySession session, ArtifactMetadata artifactMetadata, String baseVersion)
|
public void removeTimestampedArtifact( RepositorySession session, ArtifactMetadata artifactMetadata, String baseVersion)
|
||||||
throws MetadataRepositoryException {
|
throws MetadataRepositoryException {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -712,7 +701,7 @@ public class FileMetadataRepository
|
||||||
* @throws MetadataRepositoryException
|
* @throws MetadataRepositoryException
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void removeArtifact(RepositorySession session, String repositoryId, String namespace, String project, String projectVersion,
|
public void removeFacetFromArtifact( RepositorySession session, String repositoryId, String namespace, String project, String projectVersion,
|
||||||
MetadataFacet metadataFacet)
|
MetadataFacet metadataFacet)
|
||||||
throws MetadataRepositoryException {
|
throws MetadataRepositoryException {
|
||||||
throw new UnsupportedOperationException("not implemented");
|
throw new UnsupportedOperationException("not implemented");
|
||||||
|
@ -731,21 +720,21 @@ public class FileMetadataRepository
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<ArtifactMetadata> getArtifactsByProjectVersionMetadata(RepositorySession session, String key, String value, String repositoryId)
|
public List<ArtifactMetadata> getArtifactsByProjectVersionFacet( RepositorySession session, String key, String value, String repositoryId)
|
||||||
throws MetadataRepositoryException {
|
throws MetadataRepositoryException {
|
||||||
throw new UnsupportedOperationException("not yet implemented in File backend");
|
throw new UnsupportedOperationException("not yet implemented in File backend");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<ArtifactMetadata> getArtifactsByMetadata(RepositorySession session, String key, String value, String repositoryId)
|
public List<ArtifactMetadata> getArtifactsByAttribute( RepositorySession session, String key, String value, String repositoryId)
|
||||||
throws MetadataRepositoryException {
|
throws MetadataRepositoryException {
|
||||||
throw new UnsupportedOperationException("not yet implemented in File backend");
|
throw new UnsupportedOperationException("not yet implemented in File backend");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<ArtifactMetadata> getArtifactsByProperty(RepositorySession session, String key, String value, String repositoryId)
|
public List<ArtifactMetadata> getArtifactsByProjectVersionAttribute( RepositorySession session, String key, String value, String repositoryId)
|
||||||
throws MetadataRepositoryException {
|
throws MetadataRepositoryException {
|
||||||
throw new UnsupportedOperationException("getArtifactsByProperty not yet implemented in File backend");
|
throw new UnsupportedOperationException("getArtifactsByProjectVersionAttribute not yet implemented in File backend");
|
||||||
}
|
}
|
||||||
|
|
||||||
private Path getMetadataDirectory(String repoId, String facetId)
|
private Path getMetadataDirectory(String repoId, String facetId)
|
||||||
|
@ -1057,7 +1046,7 @@ public class FileMetadataRepository
|
||||||
@Override
|
@Override
|
||||||
public Collection<String> getRootNamespaces(RepositorySession session, String repoId)
|
public Collection<String> getRootNamespaces(RepositorySession session, String repoId)
|
||||||
throws MetadataResolutionException {
|
throws MetadataResolutionException {
|
||||||
return getNamespaces(session, repoId, null);
|
return this.getChildNamespaces(session, repoId, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
private Stream<String> getAllNamespacesStream(RepositorySession session, String repoId) {
|
private Stream<String> getAllNamespacesStream(RepositorySession session, String repoId) {
|
||||||
|
@ -1087,7 +1076,7 @@ public class FileMetadataRepository
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Collection<String> getNamespaces(RepositorySession session, String repoId, String baseNamespace)
|
public Collection<String> getChildNamespaces( RepositorySession session, String repoId, String baseNamespace)
|
||||||
throws MetadataResolutionException {
|
throws MetadataResolutionException {
|
||||||
try {
|
try {
|
||||||
List<String> allNamespaces;
|
List<String> allNamespaces;
|
||||||
|
@ -1305,7 +1294,7 @@ public class FileMetadataRepository
|
||||||
|
|
||||||
private void getArtifacts(RepositorySession session, List<ArtifactMetadata> artifacts, String repoId, String ns)
|
private void getArtifacts(RepositorySession session, List<ArtifactMetadata> artifacts, String repoId, String ns)
|
||||||
throws MetadataResolutionException {
|
throws MetadataResolutionException {
|
||||||
for (String namespace : getNamespaces(session, repoId, ns)) {
|
for (String namespace : this.getChildNamespaces(session, repoId, ns)) {
|
||||||
getArtifacts(session, artifacts, repoId, ns + "." + namespace);
|
getArtifacts(session, artifacts, repoId, ns + "." + namespace);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -963,7 +963,7 @@ public class JcrMetadataRepository
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<ArtifactMetadata> getArtifactsByProjectVersionMetadata( RepositorySession session, String key, String value, String repositoryId )
|
public List<ArtifactMetadata> getArtifactsByProjectVersionFacet( RepositorySession session, String key, String value, String repositoryId )
|
||||||
throws MetadataRepositoryException
|
throws MetadataRepositoryException
|
||||||
{
|
{
|
||||||
final Session jcrSession = getSession( session );
|
final Session jcrSession = getSession( session );
|
||||||
|
@ -973,7 +973,7 @@ public class JcrMetadataRepository
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<ArtifactMetadata> getArtifactsByMetadata( RepositorySession session, String key, String value, String repositoryId )
|
public List<ArtifactMetadata> getArtifactsByAttribute( RepositorySession session, String key, String value, String repositoryId )
|
||||||
throws MetadataRepositoryException
|
throws MetadataRepositoryException
|
||||||
{
|
{
|
||||||
final Session jcrSession = getSession( session );
|
final Session jcrSession = getSession( session );
|
||||||
|
@ -983,7 +983,7 @@ public class JcrMetadataRepository
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<ArtifactMetadata> getArtifactsByProperty( RepositorySession session, String key, String value, String repositoryId )
|
public List<ArtifactMetadata> getArtifactsByProjectVersionAttribute( RepositorySession session, String key, String value, String repositoryId )
|
||||||
throws MetadataRepositoryException
|
throws MetadataRepositoryException
|
||||||
{
|
{
|
||||||
final Session jcrSession = getSession( session );
|
final Session jcrSession = getSession( session );
|
||||||
|
@ -1367,11 +1367,11 @@ public class JcrMetadataRepository
|
||||||
public Collection<String> getRootNamespaces( RepositorySession session, String repositoryId )
|
public Collection<String> getRootNamespaces( RepositorySession session, String repositoryId )
|
||||||
throws MetadataResolutionException
|
throws MetadataResolutionException
|
||||||
{
|
{
|
||||||
return getNamespaces(session , repositoryId, null );
|
return this.getChildNamespaces(session , repositoryId, null );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Collection<String> getNamespaces( RepositorySession session, String repositoryId, String baseNamespace )
|
public Collection<String> getChildNamespaces( RepositorySession session, String repositoryId, String baseNamespace )
|
||||||
throws MetadataResolutionException
|
throws MetadataResolutionException
|
||||||
{
|
{
|
||||||
String path = baseNamespace != null
|
String path = baseNamespace != null
|
||||||
|
@ -1417,7 +1417,7 @@ public class JcrMetadataRepository
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void removeArtifact( RepositorySession session, ArtifactMetadata artifactMetadata, String baseVersion )
|
public void removeTimestampedArtifact( RepositorySession session, ArtifactMetadata artifactMetadata, String baseVersion )
|
||||||
throws MetadataRepositoryException
|
throws MetadataRepositoryException
|
||||||
{
|
{
|
||||||
final Session jcrSession = getSession( session );
|
final Session jcrSession = getSession( session );
|
||||||
|
@ -1525,7 +1525,7 @@ public class JcrMetadataRepository
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void removeArtifact( RepositorySession session, String repositoryId, String namespace, String project, String projectVersion,
|
public void removeFacetFromArtifact( RepositorySession session, String repositoryId, String namespace, String project, String projectVersion,
|
||||||
MetadataFacet metadataFacet )
|
MetadataFacet metadataFacet )
|
||||||
throws MetadataRepositoryException
|
throws MetadataRepositoryException
|
||||||
{
|
{
|
||||||
|
@ -1603,25 +1603,6 @@ public class JcrMetadataRepository
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean canObtainAccess( Class<?> aClass )
|
|
||||||
{
|
|
||||||
return aClass == Session.class;
|
|
||||||
}
|
|
||||||
|
|
||||||
@SuppressWarnings( "unchecked" )
|
|
||||||
@Override
|
|
||||||
public <T> T obtainAccess( RepositorySession session, Class<T> aClass )
|
|
||||||
throws MetadataRepositoryException
|
|
||||||
{
|
|
||||||
if ( aClass == Session.class )
|
|
||||||
{
|
|
||||||
return (T) getSession( session );
|
|
||||||
}
|
|
||||||
throw new IllegalArgumentException(
|
|
||||||
"Access using " + aClass + " is not supported on the JCR metadata storage" );
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void close()
|
public void close()
|
||||||
throws MetadataRepositoryException
|
throws MetadataRepositoryException
|
||||||
|
|
|
@ -628,9 +628,9 @@ public class RepositoryStatisticsManagerTest
|
||||||
|
|
||||||
expect( metadataRepository.getProjects(session , TEST_REPO_ID, "com" ) ).andReturn( Arrays.<String>asList() );
|
expect( metadataRepository.getProjects(session , TEST_REPO_ID, "com" ) ).andReturn( Arrays.<String>asList() );
|
||||||
|
|
||||||
expect( metadataRepository.getNamespaces(session , TEST_REPO_ID, "com" ) ).andReturn( Arrays.asList( "example" ) );
|
expect( metadataRepository.getChildNamespaces(session , TEST_REPO_ID, "com" ) ).andReturn( Arrays.asList( "example" ) );
|
||||||
|
|
||||||
expect( metadataRepository.getNamespaces(session , TEST_REPO_ID, "com.example" ) ).andReturn(
|
expect( metadataRepository.getChildNamespaces(session , TEST_REPO_ID, "com.example" ) ).andReturn(
|
||||||
Arrays.<String>asList() );
|
Arrays.<String>asList() );
|
||||||
|
|
||||||
expect( metadataRepository.getProjects(session , TEST_REPO_ID, "com.example" ) ).andReturn(
|
expect( metadataRepository.getProjects(session , TEST_REPO_ID, "com.example" ) ).andReturn(
|
||||||
|
@ -650,14 +650,14 @@ public class RepositoryStatisticsManagerTest
|
||||||
createArtifact( "com.example", "example-project", "1.1", "pom" ) ) );
|
createArtifact( "com.example", "example-project", "1.1", "pom" ) ) );
|
||||||
|
|
||||||
|
|
||||||
expect( metadataRepository.getNamespaces(session , TEST_REPO_ID, "org" ) ).andReturn( Arrays.asList( "apache", "codehaus" ) );
|
expect( metadataRepository.getChildNamespaces(session , TEST_REPO_ID, "org" ) ).andReturn( Arrays.asList( "apache", "codehaus" ) );
|
||||||
|
|
||||||
expect( metadataRepository.getNamespaces(session , TEST_REPO_ID, "org.apache" ) ).andReturn( Arrays.asList( "archiva", "maven" ) );
|
expect( metadataRepository.getChildNamespaces(session , TEST_REPO_ID, "org.apache" ) ).andReturn( Arrays.asList( "archiva", "maven" ) );
|
||||||
|
|
||||||
|
|
||||||
expect( metadataRepository.getProjects(session , TEST_REPO_ID, "org.apache" ) ).andReturn( Arrays.<String>asList() );
|
expect( metadataRepository.getProjects(session , TEST_REPO_ID, "org.apache" ) ).andReturn( Arrays.<String>asList() );
|
||||||
|
|
||||||
expect( metadataRepository.getNamespaces(session , TEST_REPO_ID, "org.apache.archiva" ) ).andReturn( Arrays.<String>asList() );
|
expect( metadataRepository.getChildNamespaces(session , TEST_REPO_ID, "org.apache.archiva" ) ).andReturn( Arrays.<String>asList() );
|
||||||
|
|
||||||
expect( metadataRepository.getProjects(session , TEST_REPO_ID, "org.apache.archiva" ) ).andReturn( Arrays.asList( "metadata-repository-api", "metadata-model" ) );
|
expect( metadataRepository.getProjects(session , TEST_REPO_ID, "org.apache.archiva" ) ).andReturn( Arrays.asList( "metadata-repository-api", "metadata-model" ) );
|
||||||
|
|
||||||
|
@ -685,7 +685,7 @@ public class RepositoryStatisticsManagerTest
|
||||||
.andReturn( Arrays.asList( createArtifact( "org.apache.archiva", "metadata-model", "1.3", "jar" ),
|
.andReturn( Arrays.asList( createArtifact( "org.apache.archiva", "metadata-model", "1.3", "jar" ),
|
||||||
createArtifact( "org.apache.archiva", "metadata-model", "1.3", "pom" ) ) );
|
createArtifact( "org.apache.archiva", "metadata-model", "1.3", "pom" ) ) );
|
||||||
|
|
||||||
expect( metadataRepository.getNamespaces(session , TEST_REPO_ID, "org.apache.maven" ) ).andReturn( Arrays.<String>asList() );
|
expect( metadataRepository.getChildNamespaces(session , TEST_REPO_ID, "org.apache.maven" ) ).andReturn( Arrays.<String>asList() );
|
||||||
|
|
||||||
expect( metadataRepository.getProjects(session , TEST_REPO_ID, "org.apache.maven" ) )
|
expect( metadataRepository.getProjects(session , TEST_REPO_ID, "org.apache.maven" ) )
|
||||||
.andReturn( Arrays.asList( "maven-model" ) );
|
.andReturn( Arrays.asList( "maven-model" ) );
|
||||||
|
@ -697,14 +697,14 @@ public class RepositoryStatisticsManagerTest
|
||||||
.andReturn( Arrays.asList( createArtifact( "org.apache.archiva", "maven-model", "2.2.1", "jar" ),
|
.andReturn( Arrays.asList( createArtifact( "org.apache.archiva", "maven-model", "2.2.1", "jar" ),
|
||||||
createArtifact( "org.apache.archiva", "maven-model", "2.2.1", "pom" ) ) );
|
createArtifact( "org.apache.archiva", "maven-model", "2.2.1", "pom" ) ) );
|
||||||
|
|
||||||
expect( metadataRepository.getNamespaces(session , TEST_REPO_ID, "org.codehaus" ) ).andReturn( Arrays.asList( "plexus" ) );
|
expect( metadataRepository.getChildNamespaces(session , TEST_REPO_ID, "org.codehaus" ) ).andReturn( Arrays.asList( "plexus" ) );
|
||||||
|
|
||||||
expect( metadataRepository.getProjects(session , TEST_REPO_ID, "org" ) ).andReturn( Arrays.<String>asList( ) );
|
expect( metadataRepository.getProjects(session , TEST_REPO_ID, "org" ) ).andReturn( Arrays.<String>asList( ) );
|
||||||
|
|
||||||
expect( metadataRepository.getProjects(session , TEST_REPO_ID, "org.codehaus" ) )
|
expect( metadataRepository.getProjects(session , TEST_REPO_ID, "org.codehaus" ) )
|
||||||
.andReturn( Arrays.<String>asList( ) );
|
.andReturn( Arrays.<String>asList( ) );
|
||||||
|
|
||||||
expect( metadataRepository.getNamespaces(session , TEST_REPO_ID, "org.codehaus.plexus" ) )
|
expect( metadataRepository.getChildNamespaces(session , TEST_REPO_ID, "org.codehaus.plexus" ) )
|
||||||
.andReturn( Arrays.<String>asList( ) );
|
.andReturn( Arrays.<String>asList( ) );
|
||||||
|
|
||||||
expect( metadataRepository.getProjects(session , TEST_REPO_ID, "org.codehaus.plexus" ) )
|
expect( metadataRepository.getProjects(session , TEST_REPO_ID, "org.codehaus.plexus" ) )
|
||||||
|
|
Loading…
Reference in New Issue