aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/archiva/consumers/core/repository/AbstractRepositoryPurge.java29
-rw-r--r--archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/archiva/consumers/core/repository/CleanupReleasedSnapshotsRepositoryPurge.java4
-rw-r--r--archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/archiva/consumers/core/repository/RepositoryPurgeConsumer.java9
-rw-r--r--archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/archiva/consumers/core/repository/CleanupReleasedSnapshotsRepositoryPurgeTest.java42
-rw-r--r--archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/archiva/consumers/core/repository/DaysOldRepositoryPurgeTest.java24
-rw-r--r--archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/archiva/consumers/core/repository/RepositoryPurgeConsumerTest.java34
-rw-r--r--archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/archiva/consumers/core/repository/RetentionCountRepositoryPurgeTest.java24
-rw-r--r--archiva-modules/archiva-base/archiva-consumers/archiva-metadata-consumer/src/main/java/org/apache/archiva/consumers/metadata/ArchivaMetadataCreationConsumer.java28
-rw-r--r--archiva-modules/archiva-base/archiva-mock/src/main/java/org/apache/archiva/mock/MockRepositorySessionFactory.java6
-rw-r--r--archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/managed/DefaultManagedRepositoryAdmin.java30
-rw-r--r--archiva-modules/archiva-scheduler/archiva-scheduler-repository/src/main/java/org/apache/archiva/scheduler/repository/ArchivaRepositoryScanningTaskExecutor.java8
-rw-r--r--archiva-modules/archiva-scheduler/archiva-scheduler-repository/src/main/java/org/apache/archiva/scheduler/repository/DefaultRepositoryArchivaTaskScheduler.java10
-rw-r--r--archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultBrowseService.java159
-rw-r--r--archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultManagedRepositoriesService.java10
-rw-r--r--archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultMergeRepositoriesService.java34
-rw-r--r--archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultReportRepositoriesService.java38
-rw-r--r--archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultRepositoriesService.java90
-rw-r--r--archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultSearchService.java12
-rw-r--r--archiva-modules/archiva-web/archiva-rss/src/main/java/org/apache/archiva/rss/processor/NewArtifactsRssFeedProcessor.java2
-rw-r--r--archiva-modules/archiva-web/archiva-rss/src/main/java/org/apache/archiva/rss/processor/NewVersionsOfArtifactRssFeedProcessor.java4
-rw-r--r--archiva-modules/archiva-web/archiva-rss/src/test/java/org/apache/archiva/rss/processor/NewArtifactsRssFeedProcessorTest.java5
-rw-r--r--archiva-modules/archiva-web/archiva-rss/src/test/java/org/apache/archiva/rss/processor/NewVersionsOfArtifactRssFeedProcessorTest.java8
-rw-r--r--archiva-modules/archiva-web/archiva-web-common/src/main/java/org/apache/archiva/web/rss/RssFeedServlet.java4
-rw-r--r--archiva-modules/archiva-web/archiva-web-common/src/test/java/org/apache/archiva/webtest/memory/TestMetadataRepository.java13
-rw-r--r--archiva-modules/archiva-web/archiva-web-common/src/test/java/org/apache/archiva/webtest/memory/TestRepositorySessionFactory.java3
-rw-r--r--archiva-modules/metadata/metadata-repository-api/src/main/java/org/apache/archiva/metadata/repository/AbstractMetadataRepository.java86
-rw-r--r--archiva-modules/metadata/metadata-repository-api/src/main/java/org/apache/archiva/metadata/repository/DefaultMetadataResolver.java30
-rw-r--r--archiva-modules/metadata/metadata-repository-api/src/main/java/org/apache/archiva/metadata/repository/MetadataRepository.java132
-rw-r--r--archiva-modules/metadata/metadata-repository-api/src/main/java/org/apache/archiva/metadata/repository/MetadataSessionException.java52
-rw-r--r--archiva-modules/metadata/metadata-repository-api/src/main/java/org/apache/archiva/metadata/repository/RepositorySession.java32
-rw-r--r--archiva-modules/metadata/metadata-repository-api/src/main/java/org/apache/archiva/metadata/repository/RepositorySessionFactory.java6
-rw-r--r--archiva-modules/metadata/metadata-repository-api/src/test/java/org/apache/archiva/metadata/repository/AbstractMetadataRepositoryTest.java492
-rw-r--r--archiva-modules/metadata/metadata-statistics-api/src/main/java/org/apache/archiva/metadata/repository/stats/model/RepositoryStatisticsProvider.java5
-rw-r--r--archiva-modules/metadata/metadata-statistics-api/src/main/java/org/apache/archiva/metadata/repository/stats/model/RepositoryWalkingStatisticsProvider.java19
-rw-r--r--archiva-modules/plugins/audit/src/main/java/org/apache/archiva/audit/DefaultAuditManager.java20
-rw-r--r--archiva-modules/plugins/audit/src/main/java/org/apache/archiva/audit/MetadataAuditListener.java14
-rw-r--r--archiva-modules/plugins/audit/src/test/java/org/apache/archiva/audit/AuditManagerTest.java96
-rw-r--r--archiva-modules/plugins/metadata-store-cassandra/src/main/java/org/apache/archiva/metadata/repository/cassandra/CassandraMetadataRepository.java141
-rw-r--r--archiva-modules/plugins/metadata-store-cassandra/src/main/java/org/apache/archiva/metadata/repository/cassandra/CassandraRepositorySessionFactory.java3
-rw-r--r--archiva-modules/plugins/metadata-store-cassandra/src/test/java/org/apache/archiva/metadata/repository/cassandra/CassandraMetadataRepositoryTest.java4
-rw-r--r--archiva-modules/plugins/metadata-store-cassandra/src/test/java/org/apache/archiva/metadata/repository/cassandra/RepositoriesNamespaceTest.java16
-rw-r--r--archiva-modules/plugins/metadata-store-file/src/main/java/org/apache/archiva/metadata/repository/file/FileMetadataRepository.java154
-rw-r--r--archiva-modules/plugins/metadata-store-file/src/main/java/org/apache/archiva/metadata/repository/file/FileRepositorySessionFactory.java3
-rw-r--r--archiva-modules/plugins/metadata-store-jcr/src/main/java/org/apache/archiva/metadata/repository/jcr/JcrMetadataRepository.java521
-rw-r--r--archiva-modules/plugins/metadata-store-jcr/src/main/java/org/apache/archiva/metadata/repository/jcr/JcrRepositorySessionFactory.java33
-rw-r--r--archiva-modules/plugins/metadata-store-jcr/src/main/java/org/apache/archiva/metadata/repository/jcr/JcrSession.java108
-rw-r--r--archiva-modules/plugins/metadata-store-jcr/src/test/java/org/apache/archiva/metadata/repository/jcr/JcrMetadataRepositoryTest.java2
-rw-r--r--archiva-modules/plugins/metadata-store-jcr/src/test/java/org/apache/archiva/metadata/repository/stats/JcrRepositoryStatisticsGatheringTest.java4
-rw-r--r--archiva-modules/plugins/problem-reports/src/main/java/org/apache/archiva/reports/RepositoryProblemEventListener.java6
-rw-r--r--archiva-modules/plugins/problem-reports/src/main/java/org/apache/archiva/reports/consumers/DuplicateArtifactsConsumer.java13
-rw-r--r--archiva-modules/plugins/problem-reports/src/test/java/org/apache/archiva/reports/consumers/DuplicateArtifactsConsumerTest.java20
-rw-r--r--archiva-modules/plugins/repository-statistics/src/main/java/org/apache/archiva/metadata/repository/stats/DefaultRepositoryStatisticsManager.java26
-rw-r--r--archiva-modules/plugins/repository-statistics/src/test/java/org/apache/archiva/metadata/repository/stats/RepositoryStatisticsManagerTest.java126
-rw-r--r--archiva-modules/plugins/stage-repository-merge/src/main/java/org/apache/archiva/stagerepository/merge/Maven2RepositoryMerger.java8
-rw-r--r--archiva-modules/plugins/stage-repository-merge/src/test/java/org/apache/archiva/stagerepository/merge/Maven2RepositoryMergerTest.java10
55 files changed, 1615 insertions, 1197 deletions
diff --git a/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/archiva/consumers/core/repository/AbstractRepositoryPurge.java b/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/archiva/consumers/core/repository/AbstractRepositoryPurge.java
index 9ec198b73..c4706158c 100644
--- a/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/archiva/consumers/core/repository/AbstractRepositoryPurge.java
+++ b/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/archiva/consumers/core/repository/AbstractRepositoryPurge.java
@@ -38,8 +38,6 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.IOException;
-import java.nio.file.Files;
-import java.nio.file.Path;
import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
@@ -205,8 +203,8 @@ public abstract class AbstractRepositoryPurge
{
try
{
- metaResolved.put( metaBaseId, metadataRepository.getArtifacts( repository.getId( ), reference.getGroupId( ),
- reference.getArtifactId( ), baseVersion ) );
+ metaResolved.put( metaBaseId, metadataRepository.getArtifacts( , repository.getId( ),
+ reference.getGroupId( ), reference.getArtifactId( ), baseVersion ) );
}
catch ( MetadataResolutionException e )
{
@@ -284,7 +282,14 @@ public abstract class AbstractRepositoryPurge
purgeSupportFiles( artifactFile );
}
purgeMetadata( metadataRepository, metaRemovalList );
- repositorySession.save( );
+ try
+ {
+ repositorySession.save( );
+ }
+ catch ( org.apache.archiva.metadata.repository.MetadataSessionException e )
+ {
+ e.printStackTrace( );
+ }
}
}
@@ -316,12 +321,12 @@ public abstract class AbstractRepositoryPurge
{
try
{
- artifacts = metadataRepository.getArtifacts( repository.getId( ), info.getNamespace( ), info.getName( ),
- info.getProjectVersion( ) );
+ artifacts = metadataRepository.getArtifacts( , repository.getId( ), info.getNamespace( ),
+ info.getName( ), info.getProjectVersion( ) );
if ( artifacts.size( ) == 0 )
{
- metadataRepository.removeProjectVersion( repository.getId( ), info.getNamespace( ),
- info.getName( ), info.getProjectVersion( ) );
+ metadataRepository.removeProjectVersion( , repository.getId( ),
+ info.getNamespace( ), info.getName( ), info.getProjectVersion( ) );
log.debug( "Removed project version from MetadataRepository {}", info );
}
}
@@ -355,14 +360,14 @@ public abstract class AbstractRepositoryPurge
version = artifactInfo.getProjectVersion( );
MavenArtifactFacet mavenArtifactFacetToCompare = new MavenArtifactFacet( );
mavenArtifactFacetToCompare.setClassifier( artifactInfo.getClassifier( ) );
- metadataRepository.removeArtifact( repository.getId( ), groupId, artifactId,
- version, mavenArtifactFacetToCompare );
+ metadataRepository.removeArtifact( , repository.getId( ), groupId,
+ artifactId, version, mavenArtifactFacetToCompare );
metadataRepository.save( );
}
}
else
{
- metadataRepository.removeArtifact( artifactMetadata, artifactInfo.getProjectVersion( ) );
+ metadataRepository.removeArtifact( , artifactMetadata, artifactInfo.getProjectVersion( ) );
}
}
diff --git a/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/archiva/consumers/core/repository/CleanupReleasedSnapshotsRepositoryPurge.java b/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/archiva/consumers/core/repository/CleanupReleasedSnapshotsRepositoryPurge.java
index e36b394d7..5c33d44b9 100644
--- a/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/archiva/consumers/core/repository/CleanupReleasedSnapshotsRepositoryPurge.java
+++ b/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/archiva/consumers/core/repository/CleanupReleasedSnapshotsRepositoryPurge.java
@@ -158,8 +158,8 @@ public class CleanupReleasedSnapshotsRepositoryPurge
artifactRef.getArtifactId( ), artifactRef.getVersion( ),
artifactFile.getFileName().toString() );
}
- metadataRepository.removeProjectVersion( repository.getId( ), artifactRef.getGroupId( ),
- artifactRef.getArtifactId( ), artifactRef.getVersion( ) );
+ metadataRepository.removeProjectVersion( , repository.getId( ),
+ artifactRef.getGroupId( ), artifactRef.getArtifactId( ), artifactRef.getVersion( ) );
needsMetadataUpdate = true;
}
diff --git a/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/archiva/consumers/core/repository/RepositoryPurgeConsumer.java b/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/archiva/consumers/core/repository/RepositoryPurgeConsumer.java
index e1d91563a..6c153f215 100644
--- a/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/archiva/consumers/core/repository/RepositoryPurgeConsumer.java
+++ b/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/archiva/consumers/core/repository/RepositoryPurgeConsumer.java
@@ -137,7 +137,14 @@ public class RepositoryPurgeConsumer
ManagedRepositoryContent repositoryContent;
repositoryContent = repository.getContent();
- repositorySession = repositorySessionFactory.createSession( );
+ try
+ {
+ repositorySession = repositorySessionFactory.createSession( );
+ }
+ catch ( org.apache.archiva.metadata.repository.MetadataRepositoryException e )
+ {
+ e.printStackTrace( );
+ }
if (repository.supportsFeature( ArtifactCleanupFeature.class ))
{
diff --git a/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/archiva/consumers/core/repository/CleanupReleasedSnapshotsRepositoryPurgeTest.java b/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/archiva/consumers/core/repository/CleanupReleasedSnapshotsRepositoryPurgeTest.java
index 01f9a2919..034aab925 100644
--- a/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/archiva/consumers/core/repository/CleanupReleasedSnapshotsRepositoryPurgeTest.java
+++ b/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/archiva/consumers/core/repository/CleanupReleasedSnapshotsRepositoryPurgeTest.java
@@ -127,8 +127,8 @@ public class CleanupReleasedSnapshotsRepositoryPurgeTest
// Provide the metadata list
List<ArtifactMetadata> ml = getArtifactMetadataFromDir(TEST_REPO_ID , projectName, repo.getParent(), vDir );
- when(metadataRepository.getArtifacts(TEST_REPO_ID, projectNs,
- projectName, projectVersion)).thenReturn(ml);
+ when(metadataRepository.getArtifacts( , TEST_REPO_ID,
+ projectNs, projectName, projectVersion )).thenReturn(ml);
repoPurge.process( PATH_TO_RELEASED_SNAPSHOT_IN_SAME_REPO );
@@ -137,8 +137,8 @@ public class CleanupReleasedSnapshotsRepositoryPurgeTest
// Verify the metadataRepository invocations
// complete snapshot version removal for released
- verify(metadataRepository, times(1)).removeProjectVersion(eq(TEST_REPO_ID), eq(projectNs), eq(projectName), eq(projectVersion));
- verify(metadataRepository, never()).removeProjectVersion(eq(TEST_REPO_ID), eq(projectNs), eq(projectName), eq("2.3"));
+ verify(metadataRepository, times(1)).removeProjectVersion( , eq(TEST_REPO_ID), eq(projectNs), eq(projectName), eq(projectVersion) );
+ verify(metadataRepository, never()).removeProjectVersion( , eq(TEST_REPO_ID), eq(projectNs), eq(projectName), eq("2.3") );
// check if the snapshot was removed
assertDeleted( projectRoot + "/2.3-SNAPSHOT" );
@@ -246,12 +246,12 @@ public class CleanupReleasedSnapshotsRepositoryPurgeTest
// Provide the metadata list
List<ArtifactMetadata> ml = getArtifactMetadataFromDir(TEST_REPO_ID , projectName, repo.getParent(), vDir );
- when(metadataRepository.getArtifacts(TEST_REPO_ID, projectNs,
- projectName, projectVersion)).thenReturn(ml);
+ when(metadataRepository.getArtifacts( , TEST_REPO_ID,
+ projectNs, projectName, projectVersion )).thenReturn(ml);
List<ArtifactMetadata> ml2 = getArtifactMetadataFromDir(RELEASES_TEST_REPO_ID , projectName, repo.getParent(), releaseDir );
- when(metadataRepository.getArtifacts(RELEASES_TEST_REPO_ID, projectNs,
- projectName, releaseVersion)).thenReturn(ml2);
+ when(metadataRepository.getArtifacts( , RELEASES_TEST_REPO_ID,
+ projectNs, projectName, releaseVersion )).thenReturn(ml2);
repoPurge.process( PATH_TO_RELEASED_SNAPSHOT_IN_DIFF_REPO );
@@ -260,8 +260,8 @@ public class CleanupReleasedSnapshotsRepositoryPurgeTest
// Verify the metadataRepository invocations
// Complete version removal for cleanup
- verify(metadataRepository, times(1)).removeProjectVersion(eq(TEST_REPO_ID), eq(projectNs), eq(projectName), eq(projectVersion));
- verify(metadataRepository, never()).removeProjectVersion(eq(RELEASES_TEST_REPO_ID), eq(projectNs), eq(projectName), eq(releaseVersion));
+ verify(metadataRepository, times(1)).removeProjectVersion( , eq(TEST_REPO_ID), eq(projectNs), eq(projectName), eq(projectVersion) );
+ verify(metadataRepository, never()).removeProjectVersion( , eq(RELEASES_TEST_REPO_ID), eq(projectNs), eq(projectName), eq(releaseVersion) );
// check if the snapshot was removed
@@ -317,14 +317,14 @@ public class CleanupReleasedSnapshotsRepositoryPurgeTest
// Provide the metadata list
List<ArtifactMetadata> ml = getArtifactMetadataFromDir(TEST_REPO_ID , projectName, repo.getParent(), vDir );
- when(metadataRepository.getArtifacts(TEST_REPO_ID, projectNs,
- projectName, projectVersion)).thenReturn(ml);
+ when(metadataRepository.getArtifacts( , TEST_REPO_ID,
+ projectNs, projectName, projectVersion )).thenReturn(ml);
List<ArtifactMetadata> m2 = getArtifactMetadataFromDir(TEST_REPO_ID , projectName, repo.getParent(), vDir2 );
- when(metadataRepository.getArtifacts(TEST_REPO_ID, projectNs,
- projectName, "2.0.3-SNAPSHOT")).thenReturn(ml);
+ when(metadataRepository.getArtifacts( , TEST_REPO_ID,
+ projectNs, projectName, "2.0.3-SNAPSHOT" )).thenReturn(ml);
List<ArtifactMetadata> m3 = getArtifactMetadataFromDir(TEST_REPO_ID , projectName, repo.getParent(), vDir3 );
- when(metadataRepository.getArtifacts(TEST_REPO_ID, projectNs,
- projectName, "2.0.4-SNAPSHOT")).thenReturn(ml);
+ when(metadataRepository.getArtifacts( , TEST_REPO_ID,
+ projectNs, projectName, "2.0.4-SNAPSHOT" )).thenReturn(ml);
repoPurge.process( CleanupReleasedSnapshotsRepositoryPurgeTest.PATH_TO_HIGHER_SNAPSHOT_EXISTS_IN_SAME_REPO );
@@ -333,11 +333,11 @@ public class CleanupReleasedSnapshotsRepositoryPurgeTest
// Verify the metadataRepository invocations
// No removal
- verify(metadataRepository, never()).removeProjectVersion(eq(TEST_REPO_ID), eq(projectNs), eq(projectName), eq(projectVersion));
- verify(metadataRepository, never()).removeProjectVersion(eq(TEST_REPO_ID), eq(projectNs), eq(projectName), eq("2.0.3-SNAPSHOT"));
- verify(metadataRepository, never()).removeProjectVersion(eq(TEST_REPO_ID), eq(projectNs), eq(projectName), eq("2.0.4-SNAPSHOT"));
- verify(metadataRepository, never()).removeArtifact(any(ArtifactMetadata.class), any(String.class));
- verify(metadataRepository, never()).removeArtifact(any(String.class), any(String.class), any(String.class), any(String.class), any( MetadataFacet.class));
+ verify(metadataRepository, never()).removeProjectVersion( , eq(TEST_REPO_ID), eq(projectNs), eq(projectName), eq(projectVersion) );
+ verify(metadataRepository, never()).removeProjectVersion( , eq(TEST_REPO_ID), eq(projectNs), eq(projectName), eq("2.0.3-SNAPSHOT") );
+ verify(metadataRepository, never()).removeProjectVersion( , eq(TEST_REPO_ID), eq(projectNs), eq(projectName), eq("2.0.4-SNAPSHOT") );
+ verify(metadataRepository, never()).removeArtifact( , any(ArtifactMetadata.class), any(String.class) );
+ verify(metadataRepository, never()).removeArtifact( , any(String.class), any(String.class), any(String.class), any(String.class), any( MetadataFacet.class) );
diff --git a/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/archiva/consumers/core/repository/DaysOldRepositoryPurgeTest.java b/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/archiva/consumers/core/repository/DaysOldRepositoryPurgeTest.java
index 3c7083700..36b225e47 100644
--- a/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/archiva/consumers/core/repository/DaysOldRepositoryPurgeTest.java
+++ b/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/archiva/consumers/core/repository/DaysOldRepositoryPurgeTest.java
@@ -112,17 +112,17 @@ public class DaysOldRepositoryPurgeTest
// Provide the metadata list
List<ArtifactMetadata> ml = getArtifactMetadataFromDir(TEST_REPO_ID , projectName, repo.getParent(), vDir );
- when(metadataRepository.getArtifacts(TEST_REPO_ID, projectNs,
- projectName, projectVersion)).thenReturn(ml);
+ when(metadataRepository.getArtifacts( , TEST_REPO_ID,
+ projectNs, projectName, projectVersion )).thenReturn(ml);
repoPurge.process( PATH_TO_BY_DAYS_OLD_ARTIFACT );
listenerControl.verify();
// Verify the metadataRepository invocations
- verify(metadataRepository, never()).removeProjectVersion(eq(TEST_REPO_ID), eq(projectNs), eq(projectName), eq(projectVersion));
+ verify(metadataRepository, never()).removeProjectVersion( , eq(TEST_REPO_ID), eq(projectNs), eq(projectName), eq(projectVersion) );
ArgumentCaptor<ArtifactMetadata> metadataArg = ArgumentCaptor.forClass(ArtifactMetadata.class);
- verify(metadataRepository, times(2)).removeArtifact(metadataArg.capture(), eq(projectVersion));
+ verify(metadataRepository, times(2)).removeArtifact( , metadataArg.capture(), eq(projectVersion) );
List<ArtifactMetadata> metaL = metadataArg.getAllValues();
for (ArtifactMetadata meta : metaL) {
assertTrue(meta.getId().startsWith(projectName));
@@ -197,8 +197,8 @@ public class DaysOldRepositoryPurgeTest
// Provide the metadata list
List<ArtifactMetadata> ml = getArtifactMetadataFromDir(TEST_REPO_ID , projectName, repo.getParent(), vDir );
- when(metadataRepository.getArtifacts(TEST_REPO_ID, projectNs,
- projectName, projectVersion)).thenReturn(ml);
+ when(metadataRepository.getArtifacts( , TEST_REPO_ID,
+ projectNs, projectName, projectVersion )).thenReturn(ml);
repoPurge.process( PATH_TO_TEST_ORDER_OF_DELETION );
@@ -206,9 +206,9 @@ public class DaysOldRepositoryPurgeTest
listenerControl.verify();
// Verify the metadataRepository invocations
- verify(metadataRepository, never()).removeProjectVersion(eq(TEST_REPO_ID), eq(projectNs), eq(projectName), eq(projectVersion));
+ verify(metadataRepository, never()).removeProjectVersion( , eq(TEST_REPO_ID), eq(projectNs), eq(projectName), eq(projectVersion) );
ArgumentCaptor<ArtifactMetadata> metadataArg = ArgumentCaptor.forClass(ArtifactMetadata.class);
- verify(metadataRepository, times(deletedVersions.size())).removeArtifact(metadataArg.capture(), eq(projectVersion));
+ verify(metadataRepository, times(deletedVersions.size())).removeArtifact( , metadataArg.capture(), eq(projectVersion) );
List<ArtifactMetadata> metaL = metadataArg.getAllValues();
for (ArtifactMetadata meta : metaL) {
assertTrue(meta.getId().startsWith(projectName));
@@ -296,8 +296,8 @@ public class DaysOldRepositoryPurgeTest
// Provide the metadata list
List<ArtifactMetadata> ml = getArtifactMetadataFromDir(TEST_REPO_ID , projectName, repo.getParent(), vDir );
- when(metadataRepository.getArtifacts(TEST_REPO_ID, projectNs,
- projectName, projectVersion)).thenReturn(ml);
+ when(metadataRepository.getArtifacts( , TEST_REPO_ID,
+ projectNs, projectName, projectVersion )).thenReturn(ml);
repoPurge.process( PATH_TO_BY_DAYS_OLD_METADATA_DRIVEN_ARTIFACT );
@@ -305,9 +305,9 @@ public class DaysOldRepositoryPurgeTest
listenerControl.verify();
// Verify the metadataRepository invocations
- verify(metadataRepository, never()).removeProjectVersion(eq(TEST_REPO_ID), eq(projectNs), eq(projectName), eq(projectVersion));
+ verify(metadataRepository, never()).removeProjectVersion( , eq(TEST_REPO_ID), eq(projectNs), eq(projectName), eq(projectVersion) );
ArgumentCaptor<ArtifactMetadata> metadataArg = ArgumentCaptor.forClass(ArtifactMetadata.class);
- verify(metadataRepository, times(deletedVersions.size())).removeArtifact(metadataArg.capture(), eq(projectVersion));
+ verify(metadataRepository, times(deletedVersions.size())).removeArtifact( , metadataArg.capture(), eq(projectVersion) );
List<ArtifactMetadata> metaL = metadataArg.getAllValues();
for (ArtifactMetadata meta : metaL) {
assertTrue(meta.getId().startsWith(projectName));
diff --git a/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/archiva/consumers/core/repository/RepositoryPurgeConsumerTest.java b/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/archiva/consumers/core/repository/RepositoryPurgeConsumerTest.java
index 9ad64bd47..2e63c3307 100644
--- a/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/archiva/consumers/core/repository/RepositoryPurgeConsumerTest.java
+++ b/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/archiva/consumers/core/repository/RepositoryPurgeConsumerTest.java
@@ -188,8 +188,8 @@ public class RepositoryPurgeConsumerTest
// Provide the metadata list
List<ArtifactMetadata> ml = getArtifactMetadataFromDir( TEST_REPO_ID, projectName, repo, vDir );
- when(metadataRepository.getArtifacts(TEST_REPO_ID, projectNs,
- projectName, projectVersion)).thenReturn(ml);
+ when(metadataRepository.getArtifacts( , TEST_REPO_ID,
+ projectNs, projectName, projectVersion )).thenReturn(ml);
Set<String> deletedVersions = new HashSet<>();
deletedVersions.add("1.0RC1-20070504.153317-1");
deletedVersions.add("1.0RC1-20070504.160758-2");
@@ -197,9 +197,9 @@ public class RepositoryPurgeConsumerTest
repoPurgeConsumer.processFile( PATH_TO_BY_RETENTION_COUNT_ARTIFACT );
// Verify the metadataRepository invocations
- verify(metadataRepository, never()).removeProjectVersion(eq(TEST_REPO_ID), eq(projectNs), eq(projectName), eq(projectVersion));
+ verify(metadataRepository, never()).removeProjectVersion( , eq(TEST_REPO_ID), eq(projectNs), eq(projectName), eq(projectVersion) );
ArgumentCaptor<ArtifactMetadata> metadataArg = ArgumentCaptor.forClass(ArtifactMetadata.class);
- verify(metadataRepository, times(2)).removeArtifact(metadataArg.capture(), eq(projectVersion));
+ verify(metadataRepository, times(2)).removeArtifact( , metadataArg.capture(), eq(projectVersion) );
List<ArtifactMetadata> metaL = metadataArg.getAllValues();
for (ArtifactMetadata meta : metaL) {
assertTrue(meta.getId().startsWith(projectName));
@@ -291,8 +291,8 @@ public class RepositoryPurgeConsumerTest
// Provide the metadata list
List<ArtifactMetadata> ml = getArtifactMetadataFromDir( TEST_REPO_ID, projectName, repo, vDir );
- when(metadataRepository.getArtifacts(TEST_REPO_ID, projectNs,
- projectName, projectVersion)).thenReturn(ml);
+ when(metadataRepository.getArtifacts( , TEST_REPO_ID,
+ projectNs, projectName, projectVersion )).thenReturn(ml);
Set<String> deletedVersions = new HashSet<>();
deletedVersions.add("2.2-SNAPSHOT");
deletedVersions.add("2.2-20061118.060401-2");
@@ -300,9 +300,9 @@ public class RepositoryPurgeConsumerTest
repoPurgeConsumer.processFile( PATH_TO_BY_DAYS_OLD_ARTIFACT );
// Verify the metadataRepository invocations
- verify(metadataRepository, never()).removeProjectVersion(eq(TEST_REPO_ID), eq(projectNs), eq(projectName), eq(projectVersion));
+ verify(metadataRepository, never()).removeProjectVersion( , eq(TEST_REPO_ID), eq(projectNs), eq(projectName), eq(projectVersion) );
ArgumentCaptor<ArtifactMetadata> metadataArg = ArgumentCaptor.forClass(ArtifactMetadata.class);
- verify(metadataRepository, times(2)).removeArtifact(metadataArg.capture(), eq(projectVersion));
+ verify(metadataRepository, times(2)).removeArtifact( , metadataArg.capture(), eq(projectVersion) );
List<ArtifactMetadata> metaL = metadataArg.getAllValues();
for (ArtifactMetadata meta : metaL) {
assertTrue(meta.getId().startsWith(projectName));
@@ -373,16 +373,16 @@ public class RepositoryPurgeConsumerTest
// Provide the metadata list
List<ArtifactMetadata> ml = getArtifactMetadataFromDir( TEST_REPO_ID, projectName, repo, vDir );
- when(metadataRepository.getArtifacts(TEST_REPO_ID, projectNs,
- projectName, projectVersion)).thenReturn(ml);
+ when(metadataRepository.getArtifacts( , TEST_REPO_ID,
+ projectNs, projectName, projectVersion )).thenReturn(ml);
repoPurgeConsumer.processFile(
CleanupReleasedSnapshotsRepositoryPurgeTest.PATH_TO_RELEASED_SNAPSHOT_IN_SAME_REPO );
- verify(metadataRepository, never()).removeProjectVersion(eq(TEST_REPO_ID), eq(projectNs), eq(projectName), eq(projectVersion));
+ verify(metadataRepository, never()).removeProjectVersion( , eq(TEST_REPO_ID), eq(projectNs), eq(projectName), eq(projectVersion) );
ArgumentCaptor<ArtifactMetadata> metadataArg = ArgumentCaptor.forClass(ArtifactMetadata.class);
- verify(metadataRepository, never()).removeArtifact(any(), any());
- verify(metadataRepository, never()).removeArtifact( any(), any(), any(), any(), any(MetadataFacet.class) );
+ verify(metadataRepository, never()).removeArtifact( , any(), any() );
+ verify(metadataRepository, never()).removeArtifact( , any(), any(), any(), any(), any(MetadataFacet.class) );
// check if the snapshot wasn't removed
@@ -436,15 +436,15 @@ public class RepositoryPurgeConsumerTest
// Provide the metadata list
List<ArtifactMetadata> ml = getArtifactMetadataFromDir(TEST_REPO_ID , projectName, repo.getParent(), vDir );
- when(metadataRepository.getArtifacts(TEST_REPO_ID, projectNs,
- projectName, projectVersion)).thenReturn(ml);
+ when(metadataRepository.getArtifacts( , TEST_REPO_ID,
+ projectNs, projectName, projectVersion )).thenReturn(ml);
repoPurgeConsumer.processFile(
CleanupReleasedSnapshotsRepositoryPurgeTest.PATH_TO_RELEASED_SNAPSHOT_IN_SAME_REPO );
- verify(metadataRepository, times(1)).removeProjectVersion(eq(TEST_REPO_ID), eq(projectNs), eq(projectName), eq(projectVersion));
+ verify(metadataRepository, times(1)).removeProjectVersion( , eq(TEST_REPO_ID), eq(projectNs), eq(projectName), eq(projectVersion) );
ArgumentCaptor<ArtifactMetadata> metadataArg = ArgumentCaptor.forClass(ArtifactMetadata.class);
- verify(metadataRepository, never()).removeArtifact(any(), any());
+ verify(metadataRepository, never()).removeArtifact( , any(), any() );
// check if the snapshot was removed
assertDeleted( projectRoot + "/2.3-SNAPSHOT" );
diff --git a/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/archiva/consumers/core/repository/RetentionCountRepositoryPurgeTest.java b/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/archiva/consumers/core/repository/RetentionCountRepositoryPurgeTest.java
index d80a0b693..734df37a4 100644
--- a/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/archiva/consumers/core/repository/RetentionCountRepositoryPurgeTest.java
+++ b/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/archiva/consumers/core/repository/RetentionCountRepositoryPurgeTest.java
@@ -115,8 +115,8 @@ public class RetentionCountRepositoryPurgeTest
// Provide the metadata list
List<ArtifactMetadata> ml = getArtifactMetadataFromDir(TEST_REPO_ID , projectName, repo.getParent(), vDir );
- when(metadataRepository.getArtifacts(TEST_REPO_ID, projectNs,
- projectName, projectVersion)).thenReturn(ml);
+ when(metadataRepository.getArtifacts( , TEST_REPO_ID,
+ projectNs, projectName, projectVersion )).thenReturn(ml);
repoPurge.process( PATH_TO_BY_RETENTION_COUNT_ARTIFACT );
@@ -124,9 +124,9 @@ public class RetentionCountRepositoryPurgeTest
listenerControl.verify();
// Verify the metadataRepository invocations
- verify(metadataRepository, never()).removeProjectVersion(eq(TEST_REPO_ID), eq(projectNs), eq(projectName), eq(projectVersion));
+ verify(metadataRepository, never()).removeProjectVersion( , eq(TEST_REPO_ID), eq(projectNs), eq(projectName), eq(projectVersion) );
ArgumentCaptor<ArtifactMetadata> metadataArg = ArgumentCaptor.forClass(ArtifactMetadata.class);
- verify(metadataRepository, times(deletedVersions.size())).removeArtifact(metadataArg.capture(), eq(projectVersion));
+ verify(metadataRepository, times(deletedVersions.size())).removeArtifact( , metadataArg.capture(), eq(projectVersion) );
List<ArtifactMetadata> metaL = metadataArg.getAllValues();
for (ArtifactMetadata meta : metaL) {
assertTrue(meta.getId().startsWith(projectName));
@@ -202,17 +202,17 @@ public class RetentionCountRepositoryPurgeTest
// Provide the metadata list
List<ArtifactMetadata> ml = getArtifactMetadataFromDir(TEST_REPO_ID , projectName, repo.getParent(), vDir );
- when(metadataRepository.getArtifacts(TEST_REPO_ID, projectNs,
- projectName, projectVersion)).thenReturn(ml);
+ when(metadataRepository.getArtifacts( , TEST_REPO_ID,
+ projectNs, projectName, projectVersion )).thenReturn(ml);
repoPurge.process( PATH_TO_BY_RETENTION_COUNT_POM );
listenerControl.verify();
// Verify the metadataRepository invocations
- verify(metadataRepository, never()).removeProjectVersion(eq(TEST_REPO_ID), eq(projectNs), eq(projectName), eq(projectVersion));
+ verify(metadataRepository, never()).removeProjectVersion( , eq(TEST_REPO_ID), eq(projectNs), eq(projectName), eq(projectVersion) );
ArgumentCaptor<ArtifactMetadata> metadataArg = ArgumentCaptor.forClass(ArtifactMetadata.class);
- verify(metadataRepository, times(deletedVersions.size())).removeArtifact(metadataArg.capture(), eq(projectVersion));
+ verify(metadataRepository, times(deletedVersions.size())).removeArtifact( , metadataArg.capture(), eq(projectVersion) );
List<ArtifactMetadata> metaL = metadataArg.getAllValues();
for (ArtifactMetadata meta : metaL) {
assertTrue(meta.getId().startsWith(projectName));
@@ -290,17 +290,17 @@ public class RetentionCountRepositoryPurgeTest
// Provide the metadata list
List<ArtifactMetadata> ml = getArtifactMetadataFromDir(TEST_REPO_ID , projectName, repo.getParent(), vDir );
- when(metadataRepository.getArtifacts(TEST_REPO_ID, projectNs,
- projectName, projectVersion)).thenReturn(ml);
+ when(metadataRepository.getArtifacts( , TEST_REPO_ID,
+ projectNs, projectName, projectVersion )).thenReturn(ml);
repoPurge.process( PATH_TO_TEST_ORDER_OF_DELETION );
listenerControl.verify();
// Verify the metadataRepository invocations
- verify(metadataRepository, never()).removeProjectVersion(eq(TEST_REPO_ID), eq(projectNs), eq(projectName), eq(projectVersion));
+ verify(metadataRepository, never()).removeProjectVersion( , eq(TEST_REPO_ID), eq(projectNs), eq(projectName), eq(projectVersion) );
ArgumentCaptor<ArtifactMetadata> metadataArg = ArgumentCaptor.forClass(ArtifactMetadata.class);
- verify(metadataRepository, times(deletedVersions.size())).removeArtifact(metadataArg.capture(), eq(projectVersion));
+ verify(metadataRepository, times(deletedVersions.size())).removeArtifact( , metadataArg.capture(), eq(projectVersion) );
List<ArtifactMetadata> metaL = metadataArg.getAllValues();
for (ArtifactMetadata meta : metaL) {
assertTrue(meta.getId().startsWith(projectName));
diff --git a/archiva-modules/archiva-base/archiva-consumers/archiva-metadata-consumer/src/main/java/org/apache/archiva/consumers/metadata/ArchivaMetadataCreationConsumer.java b/archiva-modules/archiva-base/archiva-consumers/archiva-metadata-consumer/src/main/java/org/apache/archiva/consumers/metadata/ArchivaMetadataCreationConsumer.java
index 407b2399b..e93b032ac 100644
--- a/archiva-modules/archiva-base/archiva-consumers/archiva-metadata-consumer/src/main/java/org/apache/archiva/consumers/metadata/ArchivaMetadataCreationConsumer.java
+++ b/archiva-modules/archiva-base/archiva-consumers/archiva-metadata-consumer/src/main/java/org/apache/archiva/consumers/metadata/ArchivaMetadataCreationConsumer.java
@@ -138,7 +138,15 @@ public class ArchivaMetadataCreationConsumer
throws ConsumerException
{
- RepositorySession repositorySession = repositorySessionFactory.createSession();
+ RepositorySession repositorySession = null;
+ try
+ {
+ repositorySession = repositorySessionFactory.createSession();
+ }
+ catch ( MetadataRepositoryException e )
+ {
+ e.printStackTrace( );
+ }
try
{
// note that we do minimal processing including checksums and POM information for performance of
@@ -185,14 +193,14 @@ public class ArchivaMetadataCreationConsumer
// read the metadata and update it if it is newer or doesn't exist
artifact.setWhenGathered( whenGathered );
- metadataRepository.updateArtifact( repoId, project.getNamespace(), project.getId(), projectVersion,
- artifact );
+ metadataRepository.updateArtifact( , repoId, project.getNamespace(), project.getId(),
+ projectVersion, artifact );
if ( createVersionMetadata )
{
- metadataRepository.updateProjectVersion( repoId, project.getNamespace(), project.getId(),
- versionMetadata );
+ metadataRepository.updateProjectVersion( , repoId, project.getNamespace(),
+ project.getId(), versionMetadata );
}
- metadataRepository.updateProject( repoId, project );
+ metadataRepository.updateProject( , repoId, project );
repositorySession.save();
}
catch ( MetadataRepositoryException e )
@@ -213,6 +221,14 @@ public class ArchivaMetadataCreationConsumer
{
repositorySession.close();
}
+ catch ( org.apache.archiva.metadata.repository.MetadataSessionException e )
+ {
+ e.printStackTrace( );
+ }
+ catch ( org.apache.archiva.metadata.repository.MetadataSessionException e )
+ {
+ e.printStackTrace( );
+ }
}
@Override
diff --git a/archiva-modules/archiva-base/archiva-mock/src/main/java/org/apache/archiva/mock/MockRepositorySessionFactory.java b/archiva-modules/archiva-base/archiva-mock/src/main/java/org/apache/archiva/mock/MockRepositorySessionFactory.java
index 0a8ba431a..be33011cd 100644
--- a/archiva-modules/archiva-base/archiva-mock/src/main/java/org/apache/archiva/mock/MockRepositorySessionFactory.java
+++ b/archiva-modules/archiva-base/archiva-mock/src/main/java/org/apache/archiva/mock/MockRepositorySessionFactory.java
@@ -22,7 +22,9 @@ package org.apache.archiva.mock;
import org.apache.archiva.metadata.repository.AbstractMetadataRepository;
import org.apache.archiva.metadata.repository.AbstractRepositorySessionFactory;
import org.apache.archiva.metadata.repository.MetadataRepository;
+import org.apache.archiva.metadata.repository.MetadataRepositoryException;
import org.apache.archiva.metadata.repository.MetadataResolver;
+import org.apache.archiva.metadata.repository.MetadataSessionException;
import org.apache.archiva.metadata.repository.RepositorySession;
import org.apache.archiva.metadata.repository.RepositorySessionFactory;
import org.springframework.stereotype.Service;
@@ -51,7 +53,7 @@ public class MockRepositorySessionFactory extends AbstractRepositorySessionFacto
}
@Override
- public RepositorySession createSession()
+ public RepositorySession createSession() throws MetadataRepositoryException
{
return new RepositorySession( repository, resolver )
{
@@ -62,7 +64,7 @@ public class MockRepositorySessionFactory extends AbstractRepositorySessionFacto
}
@Override
- public void save()
+ public void save() throws MetadataSessionException
{
// no op
}
diff --git a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/managed/DefaultManagedRepositoryAdmin.java b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/managed/DefaultManagedRepositoryAdmin.java
index 445d920b1..c8cf62aac 100644
--- a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/managed/DefaultManagedRepositoryAdmin.java
+++ b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/managed/DefaultManagedRepositoryAdmin.java
@@ -340,11 +340,19 @@ public class DefaultManagedRepositoryAdmin
if ( !stagedOne )
{
- RepositorySession repositorySession = getRepositorySessionFactory().createSession();
+ RepositorySession repositorySession = null;
+ try
+ {
+ repositorySession = getRepositorySessionFactory().createSession();
+ }
+ catch ( MetadataRepositoryException e )
+ {
+ e.printStackTrace( );
+ }
try
{
MetadataRepository metadataRepository = repositorySession.getRepository();
- metadataRepository.removeRepository( repository.getId() );
+ metadataRepository.removeRepository( , repository.getId() );
//invalidate cache
namespacesCache.remove( repository.getId() );
log.debug( "call repositoryStatisticsManager.deleteStatistics" );
@@ -360,6 +368,10 @@ public class DefaultManagedRepositoryAdmin
{
repositorySession.close();
}
+ catch ( org.apache.archiva.metadata.repository.MetadataSessionException e )
+ {
+ e.printStackTrace( );
+ }
}
if ( deleteContent )
@@ -492,7 +504,15 @@ public class DefaultManagedRepositoryAdmin
}
// Save the repository configuration.
- RepositorySession repositorySession = getRepositorySessionFactory().createSession();
+ RepositorySession repositorySession = null;
+ try
+ {
+ repositorySession = getRepositorySessionFactory().createSession();
+ }
+ catch ( MetadataRepositoryException e )
+ {
+ e.printStackTrace( );
+ }
try
{
@@ -514,6 +534,10 @@ public class DefaultManagedRepositoryAdmin
{
repositorySession.close();
}
+ catch ( org.apache.archiva.metadata.repository.MetadataSessionException e )
+ {
+ e.printStackTrace( );
+ }
if ( updateIndexContext )
{
diff --git a/archiva-modules/archiva-scheduler/archiva-scheduler-repository/src/main/java/org/apache/archiva/scheduler/repository/ArchivaRepositoryScanningTaskExecutor.java b/archiva-modules/archiva-scheduler/archiva-scheduler-repository/src/main/java/org/apache/archiva/scheduler/repository/ArchivaRepositoryScanningTaskExecutor.java
index ea2cb2688..a2d5c6a1d 100644
--- a/archiva-modules/archiva-scheduler/archiva-scheduler-repository/src/main/java/org/apache/archiva/scheduler/repository/ArchivaRepositoryScanningTaskExecutor.java
+++ b/archiva-modules/archiva-scheduler/archiva-scheduler-repository/src/main/java/org/apache/archiva/scheduler/repository/ArchivaRepositoryScanningTaskExecutor.java
@@ -180,6 +180,10 @@ public class ArchivaRepositoryScanningTaskExecutor
{
repositorySession.close();
}
+ catch ( org.apache.archiva.metadata.repository.MetadataSessionException e )
+ {
+ e.printStackTrace( );
+ }
// log.info( "Scanning for removed repository content" );
@@ -196,6 +200,10 @@ public class ArchivaRepositoryScanningTaskExecutor
log.error( e.getMessage(), e );
throw new TaskExecutionException( e.getMessage(), e );
}
+ catch ( MetadataRepositoryException e )
+ {
+ e.printStackTrace( );
+ }
}
public Task getCurrentTaskInExecution()
diff --git a/archiva-modules/archiva-scheduler/archiva-scheduler-repository/src/main/java/org/apache/archiva/scheduler/repository/DefaultRepositoryArchivaTaskScheduler.java b/archiva-modules/archiva-scheduler/archiva-scheduler-repository/src/main/java/org/apache/archiva/scheduler/repository/DefaultRepositoryArchivaTaskScheduler.java
index 4da5b23b7..ef9067df5 100644
--- a/archiva-modules/archiva-scheduler/archiva-scheduler-repository/src/main/java/org/apache/archiva/scheduler/repository/DefaultRepositoryArchivaTaskScheduler.java
+++ b/archiva-modules/archiva-scheduler/archiva-scheduler-repository/src/main/java/org/apache/archiva/scheduler/repository/DefaultRepositoryArchivaTaskScheduler.java
@@ -117,7 +117,15 @@ public class DefaultRepositoryArchivaTaskScheduler
List<ManagedRepositoryConfiguration> repositories =
archivaConfiguration.getConfiguration().getManagedRepositories();
- RepositorySession repositorySession = repositorySessionFactory.createSession();
+ RepositorySession repositorySession = null;
+ try
+ {
+ repositorySession = repositorySessionFactory.createSession();
+ }
+ catch ( MetadataRepositoryException e )
+ {
+ e.printStackTrace( );
+ }
try
{
MetadataRepository metadataRepository = repositorySession.getRepository();
diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultBrowseService.java b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultBrowseService.java
index 56117836d..1f508702d 100644
--- a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultBrowseService.java
+++ b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultBrowseService.java
@@ -63,9 +63,6 @@ import java.io.IOException;
import java.io.InputStream;
import java.nio.charset.Charset;
import java.nio.file.Files;
-import java.nio.file.Path;
-import java.nio.file.StandardCopyOption;
-import java.nio.file.StandardOpenOption;
import java.util.*;
import java.util.jar.JarEntry;
import java.util.jar.JarFile;
@@ -114,7 +111,15 @@ public class DefaultBrowseService
// it is located here to avoid the content repository implementation needing to do too much for what
// is essentially presentation code
Set<String> namespacesToCollapse = new LinkedHashSet<String>();
- RepositorySession repositorySession = repositorySessionFactory.createSession();
+ RepositorySession repositorySession = null;
+ try
+ {
+ repositorySession = repositorySessionFactory.createSession();
+ }
+ catch ( MetadataRepositoryException e )
+ {
+ e.printStackTrace( );
+ }
try
{
MetadataResolver metadataResolver = repositorySession.getResolver();
@@ -157,7 +162,15 @@ public class DefaultBrowseService
Set<String> projects = new LinkedHashSet<>();
- RepositorySession repositorySession = repositorySessionFactory.createSession();
+ RepositorySession repositorySession = null;
+ try
+ {
+ repositorySession = repositorySessionFactory.createSession();
+ }
+ catch ( MetadataRepositoryException e )
+ {
+ e.printStackTrace( );
+ }
Set<String> namespaces;
try
{
@@ -229,7 +242,15 @@ public class DefaultBrowseService
throws MetadataResolutionException
{
- RepositorySession repositorySession = repositorySessionFactory.createSession();
+ RepositorySession repositorySession = null;
+ try
+ {
+ repositorySession = repositorySessionFactory.createSession();
+ }
+ catch ( MetadataRepositoryException e )
+ {
+ e.printStackTrace( );
+ }
try
{
MetadataResolver metadataResolver = repositorySession.getResolver();
@@ -304,6 +325,10 @@ public class DefaultBrowseService
repositorySession.close();
}
}
+ catch ( MetadataRepositoryException e )
+ {
+ e.printStackTrace( );
+ }
}
@@ -466,6 +491,10 @@ public class DefaultBrowseService
repositorySession.close();
}
}
+ catch ( MetadataRepositoryException e )
+ {
+ e.printStackTrace( );
+ }
}
@Override
@@ -520,7 +549,15 @@ public class DefaultBrowseService
{
List<ProjectVersionReference> references = new ArrayList<>();
// TODO: what if we get duplicates across repositories?
- RepositorySession repositorySession = repositorySessionFactory.createSession();
+ RepositorySession repositorySession = null;
+ try
+ {
+ repositorySession = repositorySessionFactory.createSession();
+ }
+ catch ( MetadataRepositoryException e )
+ {
+ e.printStackTrace( );
+ }
try
{
MetadataResolver metadataResolver = repositorySession.getResolver();
@@ -611,13 +648,21 @@ public class DefaultBrowseService
projectVersionMetadata.addFacet( metadataFacet );
- RepositorySession repositorySession = repositorySessionFactory.createSession();
+ RepositorySession repositorySession = null;
+ try
+ {
+ repositorySession = repositorySessionFactory.createSession();
+ }
+ catch ( MetadataRepositoryException e )
+ {
+ e.printStackTrace( );
+ }
try
{
MetadataRepository metadataRepository = repositorySession.getRepository();
- metadataRepository.updateProjectVersion( repositoryId, groupId, artifactId, projectVersionMetadata );
+ metadataRepository.updateProjectVersion( , repositoryId, groupId, artifactId, projectVersionMetadata );
repositorySession.save();
}
@@ -631,6 +676,10 @@ public class DefaultBrowseService
{
repositorySession.close();
}
+ catch ( MetadataSessionException e )
+ {
+ e.printStackTrace( );
+ }
return Boolean.TRUE;
}
@@ -660,13 +709,21 @@ public class DefaultBrowseService
return Boolean.TRUE;
}
- RepositorySession repositorySession = repositorySessionFactory.createSession();
+ RepositorySession repositorySession = null;
+ try
+ {
+ repositorySession = repositorySessionFactory.createSession();
+ }
+ catch ( MetadataRepositoryException e )
+ {
+ e.printStackTrace( );
+ }
try
{
MetadataRepository metadataRepository = repositorySession.getRepository();
- metadataRepository.updateProjectVersion( repositoryId, groupId, artifactId, projectVersionMetadata );
+ metadataRepository.updateProjectVersion( , repositoryId, groupId, artifactId, projectVersionMetadata );
repositorySession.save();
}
@@ -680,6 +737,10 @@ public class DefaultBrowseService
{
repositorySession.close();
}
+ catch ( MetadataSessionException e )
+ {
+ e.printStackTrace( );
+ }
return Boolean.TRUE;
}
@@ -757,6 +818,10 @@ public class DefaultBrowseService
throw new ArchivaRestServiceException( e.getMessage(),
Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), e );
}
+ catch ( MetadataRepositoryException e )
+ {
+ e.printStackTrace( );
+ }
return artifactDownloadInfos;
}
@@ -930,10 +995,18 @@ public class DefaultBrowseService
public List<Artifact> getArtifacts( String repositoryId )
throws ArchivaRestServiceException
{
- RepositorySession repositorySession = repositorySessionFactory.createSession();
+ RepositorySession repositorySession = null;
+ try
+ {
+ repositorySession = repositorySessionFactory.createSession();
+ }
+ catch ( MetadataRepositoryException e )
+ {
+ e.printStackTrace( );
+ }
try
{
- List<ArtifactMetadata> artifactMetadatas = repositorySession.getRepository().getArtifacts( repositoryId );
+ List<ArtifactMetadata> artifactMetadatas = repositorySession.getRepository().getArtifacts( , repositoryId );
return buildArtifacts( artifactMetadatas, repositoryId );
}
catch ( MetadataRepositoryException e )
@@ -950,10 +1023,18 @@ public class DefaultBrowseService
public List<Artifact> getArtifactsByProjectVersionMetadata( String key, String value, String repositoryId )
throws ArchivaRestServiceException
{
- RepositorySession repositorySession = repositorySessionFactory.createSession();
+ RepositorySession repositorySession = null;
try
{
- List<ArtifactMetadata> artifactMetadatas = repositorySession.getRepository().getArtifactsByProjectVersionMetadata( key, value, repositoryId );
+ repositorySession = repositorySessionFactory.createSession();
+ }
+ catch ( MetadataRepositoryException e )
+ {
+ e.printStackTrace( );
+ }
+ try
+ {
+ List<ArtifactMetadata> artifactMetadatas = repositorySession.getRepository().getArtifactsByProjectVersionMetadata( , key, value, repositoryId );
return buildArtifacts( artifactMetadatas, repositoryId );
}
catch ( MetadataRepositoryException e )
@@ -970,10 +1051,18 @@ public class DefaultBrowseService
public List<Artifact> getArtifactsByMetadata( String key, String value, String repositoryId )
throws ArchivaRestServiceException
{
- RepositorySession repositorySession = repositorySessionFactory.createSession();
+ RepositorySession repositorySession = null;
+ try
+ {
+ repositorySession = repositorySessionFactory.createSession();
+ }
+ catch ( MetadataRepositoryException e )
+ {
+ e.printStackTrace( );
+ }
try
{
- List<ArtifactMetadata> artifactMetadatas = repositorySession.getRepository().getArtifactsByMetadata( key, value, repositoryId );
+ List<ArtifactMetadata> artifactMetadatas = repositorySession.getRepository().getArtifactsByMetadata( , key, value, repositoryId );
return buildArtifacts( artifactMetadatas, repositoryId );
}
catch ( MetadataRepositoryException e )
@@ -990,10 +1079,18 @@ public class DefaultBrowseService
public List<Artifact> getArtifactsByProperty( String key, String value, String repositoryId )
throws ArchivaRestServiceException
{
- RepositorySession repositorySession = repositorySessionFactory.createSession();
+ RepositorySession repositorySession = null;
+ try
+ {
+ repositorySession = repositorySessionFactory.createSession();
+ }
+ catch ( MetadataRepositoryException e )
+ {
+ e.printStackTrace( );
+ }
try
{
- List<ArtifactMetadata> artifactMetadatas = repositorySession.getRepository().getArtifactsByProperty( key, value, repositoryId );
+ List<ArtifactMetadata> artifactMetadatas = repositorySession.getRepository().getArtifactsByProperty( , key, value, repositoryId );
return buildArtifacts( artifactMetadatas, repositoryId );
}
catch ( MetadataRepositoryException e )
@@ -1028,11 +1125,19 @@ public class DefaultBrowseService
public List<Artifact> searchArtifacts( String text, String repositoryId, Boolean exact )
throws ArchivaRestServiceException
{
- RepositorySession repositorySession = repositorySessionFactory.createSession();
+ RepositorySession repositorySession = null;
+ try
+ {
+ repositorySession = repositorySessionFactory.createSession();
+ }
+ catch ( MetadataRepositoryException e )
+ {
+ e.printStackTrace( );
+ }
try
{
List<ArtifactMetadata> artifactMetadatas =
- repositorySession.getRepository().searchArtifacts( text, repositoryId, exact == null ? false : exact );
+ repositorySession.getRepository().searchArtifacts( , repositoryId, text, exact == null ? false : exact );
return buildArtifacts( artifactMetadatas, repositoryId );
}
catch ( MetadataRepositoryException e )
@@ -1049,11 +1154,19 @@ public class DefaultBrowseService
public List<Artifact> searchArtifacts( String key, String text, String repositoryId, Boolean exact )
throws ArchivaRestServiceException
{
- RepositorySession repositorySession = repositorySessionFactory.createSession();
+ RepositorySession repositorySession = null;
+ try
+ {
+ repositorySession = repositorySessionFactory.createSession();
+ }
+ catch ( MetadataRepositoryException e )
+ {
+ e.printStackTrace( );
+ }
try
{
List<ArtifactMetadata> artifactMetadatas =
- repositorySession.getRepository().searchArtifacts( key, text, repositoryId, exact == null ? false : exact );
+ repositorySession.getRepository().searchArtifacts( , repositoryId, key, text, exact == null ? false : exact );
return buildArtifacts( artifactMetadatas, repositoryId );
}
catch ( MetadataRepositoryException e )
diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultManagedRepositoriesService.java b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultManagedRepositoriesService.java
index 0f66207be..b1e72fe5a 100644
--- a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultManagedRepositoriesService.java
+++ b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultManagedRepositoriesService.java
@@ -163,7 +163,15 @@ public class DefaultManagedRepositoriesService
public ArchivaRepositoryStatistics getManagedRepositoryStatistics( String repositoryId, String lang )
throws ArchivaRestServiceException
{
- RepositorySession repositorySession = repositorySessionFactory.createSession();
+ RepositorySession repositorySession = null;
+ try
+ {
+ repositorySession = repositorySessionFactory.createSession();
+ }
+ catch ( MetadataRepositoryException e )
+ {
+ e.printStackTrace( );
+ }
SimpleDateFormat sdf = new SimpleDateFormat( "EEE, d MMM yyyy HH:mm:ss Z", new Locale( lang ) );
try
{
diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultMergeRepositoriesService.java b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultMergeRepositoriesService.java
index 0f95ae133..39bdc5883 100644
--- a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultMergeRepositoriesService.java
+++ b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultMergeRepositoriesService.java
@@ -60,7 +60,15 @@ public class DefaultMergeRepositoriesService
public List<Artifact> getMergeConflictedArtifacts( String sourceRepositoryId, String targetRepositoryId )
throws ArchivaRestServiceException
{
- RepositorySession repositorySession = repositorySessionFactory.createSession();
+ RepositorySession repositorySession = null;
+ try
+ {
+ repositorySession = repositorySessionFactory.createSession();
+ }
+ catch ( MetadataRepositoryException e )
+ {
+ e.printStackTrace( );
+ }
try
{
List<ArtifactMetadata> artifactMetadatas =
@@ -106,13 +114,21 @@ public class DefaultMergeRepositoriesService
protected void doMerge( String sourceRepositoryId, String targetRepositoryId )
throws RepositoryMergerException, ArchivaRestServiceException
{
- RepositorySession repositorySession = repositorySessionFactory.createSession();
+ RepositorySession repositorySession = null;
+ try
+ {
+ repositorySession = repositorySessionFactory.createSession();
+ }
+ catch ( MetadataRepositoryException e )
+ {
+ e.printStackTrace( );
+ }
try
{
org.apache.archiva.repository.ManagedRepository managedRepo = repositoryRegistry.getManagedRepository(targetRepositoryId);
MetadataRepository metadataRepository = repositorySession.getRepository();
- List<ArtifactMetadata> sourceArtifacts = metadataRepository.getArtifacts( sourceRepositoryId );
+ List<ArtifactMetadata> sourceArtifacts = metadataRepository.getArtifacts( , sourceRepositoryId );
if ( managedRepo.getActiveReleaseSchemes().contains(ReleaseScheme.RELEASE) && !managedRepo.getActiveReleaseSchemes().contains(ReleaseScheme.SNAPSHOT) )
{
@@ -143,14 +159,22 @@ public class DefaultMergeRepositoriesService
throws RepositoryMergerException, ArchivaRestServiceException
{
- RepositorySession repositorySession = repositorySessionFactory.createSession();
+ RepositorySession repositorySession = null;
+ try
+ {
+ repositorySession = repositorySessionFactory.createSession();
+ }
+ catch ( MetadataRepositoryException e )
+ {
+ e.printStackTrace( );
+ }
try
{
List<ArtifactMetadata> conflictSourceArtifacts =
repositoryMerger.getConflictingArtifacts( repositorySession.getRepository(), sourceRepositoryId,
targetRepositoryId );
MetadataRepository metadataRepository = repositorySession.getRepository();
- List<ArtifactMetadata> sourceArtifacts = metadataRepository.getArtifacts( sourceRepositoryId );
+ List<ArtifactMetadata> sourceArtifacts = metadataRepository.getArtifacts( , sourceRepositoryId );
sourceArtifacts.removeAll( conflictSourceArtifacts );
org.apache.archiva.repository.ManagedRepository managedRepo = repositoryRegistry.getManagedRepository(targetRepositoryId);
diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultReportRepositoriesService.java b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultReportRepositoriesService.java
index 755b7a506..76d4f774a 100644
--- a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultReportRepositoriesService.java
+++ b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultReportRepositoriesService.java
@@ -70,7 +70,15 @@ public class DefaultReportRepositoriesService
private List<RepositoryStatistics> getMultipleRepositoriesReport( List<String> repositoriesId, int rowCount )
{
- RepositorySession repositorySession = repositorySessionFactory.createSession();
+ RepositorySession repositorySession = null;
+ try
+ {
+ repositorySession = repositorySessionFactory.createSession();
+ }
+ catch ( MetadataRepositoryException e )
+ {
+ e.printStackTrace( );
+ }
try
{
MetadataRepository metadataRepository = repositorySession.getRepository();
@@ -98,7 +106,15 @@ public class DefaultReportRepositoriesService
private List<RepositoryStatistics> getUniqueRepositoryReport( String repositoryId, int rowCount, Date startDate,
Date endDate )
{
- RepositorySession repositorySession = repositorySessionFactory.createSession();
+ RepositorySession repositorySession = null;
+ try
+ {
+ repositorySession = repositorySessionFactory.createSession();
+ }
+ catch ( MetadataRepositoryException e )
+ {
+ e.printStackTrace( );
+ }
try
{
MetadataRepository metadataRepository = repositorySession.getRepository();
@@ -129,7 +145,15 @@ public class DefaultReportRepositoriesService
public List<RepositoryProblemFacet> getHealthReport( String repository, String groupId, int rowCount )
throws ArchivaRestServiceException
{
- RepositorySession repositorySession = repositorySessionFactory.createSession();
+ RepositorySession repositorySession = null;
+ try
+ {
+ repositorySession = repositorySessionFactory.createSession();
+ }
+ catch ( MetadataRepositoryException e )
+ {
+ e.printStackTrace( );
+ }
try
{
List<String> observableRepositories = getObservableRepos();
@@ -149,12 +173,12 @@ public class DefaultReportRepositoriesService
MetadataRepository metadataRepository = repositorySession.getRepository();
for ( String repoId : observableRepositories )
{
- for ( String name : metadataRepository.getMetadataFacets( repoId, RepositoryProblemFacet.FACET_ID ) )
+ for ( String name : metadataRepository.getMetadataFacets( , repoId, RepositoryProblemFacet.FACET_ID ) )
{
RepositoryProblemFacet metadataFacet =
- (RepositoryProblemFacet) metadataRepository.getMetadataFacet( repoId,
- RepositoryProblemFacet.FACET_ID,
- name );
+ (RepositoryProblemFacet) metadataRepository.getMetadataFacet( ,
+ repoId,
+ RepositoryProblemFacet.FACET_ID, name );
if ( StringUtils.isEmpty( groupId ) || groupId.equals( metadataFacet.getNamespace() ) )
{
problemArtifacts.add( metadataFacet );
diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultRepositoriesService.java b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultRepositoriesService.java
index cc30f5e3b..7e8fa2c8c 100644
--- a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultRepositoriesService.java
+++ b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultRepositoriesService.java
@@ -659,7 +659,15 @@ public class DefaultRepositoriesService
throw new ArchivaRestServiceException( "version cannot be null", 400, null );
}
- RepositorySession repositorySession = repositorySessionFactory.createSession();
+ RepositorySession repositorySession = null;
+ try
+ {
+ repositorySession = repositorySessionFactory.createSession();
+ }
+ catch ( MetadataRepositoryException e )
+ {
+ e.printStackTrace( );
+ }
try
{
@@ -695,14 +703,14 @@ public class DefaultRepositoriesService
}
Collection<ArtifactMetadata> artifacts =
- metadataRepository.getArtifacts( repositoryId, namespace, projectId, version );
+ metadataRepository.getArtifacts( , repositoryId, namespace, projectId, version );
for ( ArtifactMetadata artifactMetadata : artifacts )
{
- metadataRepository.removeArtifact( artifactMetadata, version );
+ metadataRepository.removeArtifact( , artifactMetadata, version );
}
- metadataRepository.removeProjectVersion( repositoryId, namespace, projectId, version );
+ metadataRepository.removeProjectVersion( , repositoryId, namespace, projectId, version );
}
catch ( MetadataRepositoryException e )
{
@@ -723,6 +731,10 @@ public class DefaultRepositoriesService
repositorySession.close();
}
+ catch ( org.apache.archiva.metadata.repository.MetadataSessionException e )
+ {
+ e.printStackTrace( );
+ }
return Boolean.TRUE;
}
@@ -769,7 +781,15 @@ public class DefaultRepositoriesService
boolean snapshotVersion =
VersionUtil.isSnapshot( artifact.getVersion() ) | VersionUtil.isGenericSnapshot( artifact.getVersion() );
- RepositorySession repositorySession = repositorySessionFactory.createSession();
+ RepositorySession repositorySession = null;
+ try
+ {
+ repositorySession = repositorySessionFactory.createSession();
+ }
+ catch ( MetadataRepositoryException e )
+ {
+ e.printStackTrace( );
+ }
try
{
Date lastUpdatedTimestamp = Calendar.getInstance().getTime();
@@ -849,14 +869,14 @@ public class DefaultRepositoriesService
{
String baseVersion = VersionUtil.getBaseVersion( artifact.getVersion() );
artifacts =
- metadataRepository.getArtifacts( repositoryId, artifact.getGroupId(), artifact.getArtifactId(),
- baseVersion );
+ metadataRepository.getArtifacts( , repositoryId, artifact.getGroupId(),
+ artifact.getArtifactId(), baseVersion );
}
else
{
artifacts =
- metadataRepository.getArtifacts( repositoryId, artifact.getGroupId(), artifact.getArtifactId(),
- artifact.getVersion() );
+ metadataRepository.getArtifacts( , repositoryId, artifact.getGroupId(),
+ artifact.getArtifactId(), artifact.getVersion() );
}
log.debug( "artifacts: {}", artifacts );
@@ -867,14 +887,14 @@ public class DefaultRepositoriesService
{
// verify metata repository doesn't contains anymore the version
Collection<String> projectVersions =
- metadataRepository.getProjectVersions( repositoryId, artifact.getGroupId(),
- artifact.getArtifactId() );
+ metadataRepository.getProjectVersions( , repositoryId,
+ artifact.getGroupId(), artifact.getArtifactId() );
if ( projectVersions.contains( artifact.getVersion() ) )
{
log.warn( "artifact not found when deleted but version still here ! so force cleanup" );
- metadataRepository.removeProjectVersion( repositoryId, artifact.getGroupId(),
- artifact.getArtifactId(), artifact.getVersion() );
+ metadataRepository.removeProjectVersion( , repositoryId,
+ artifact.getGroupId(), artifact.getArtifactId(), artifact.getVersion() );
}
}
@@ -904,8 +924,8 @@ public class DefaultRepositoriesService
artifact.getVersion();
MavenArtifactFacet mavenArtifactFacetToCompare = new MavenArtifactFacet();
mavenArtifactFacetToCompare.setClassifier( artifact.getClassifier() );
- metadataRepository.removeArtifact( repositoryId, groupId, artifactId, version,
- mavenArtifactFacetToCompare );
+ metadataRepository.removeArtifact( , repositoryId, groupId, artifactId,
+ version, mavenArtifactFacetToCompare );
metadataRepository.save();
}
@@ -914,15 +934,15 @@ public class DefaultRepositoriesService
{
if ( snapshotVersion )
{
- metadataRepository.removeArtifact( artifactMetadata,
- VersionUtil.getBaseVersion( artifact.getVersion() ) );
+ metadataRepository.removeArtifact( ,
+ artifactMetadata, VersionUtil.getBaseVersion( artifact.getVersion() ) );
}
else
{
- metadataRepository.removeArtifact( artifactMetadata.getRepositoryId(),
- artifactMetadata.getNamespace(),
- artifactMetadata.getProject(), artifact.getVersion(),
- artifactMetadata.getId() );
+ metadataRepository.removeArtifact( ,
+ artifactMetadata.getRepositoryId(),
+ artifactMetadata.getNamespace(), artifactMetadata.getProject(),
+ artifact.getVersion(), artifactMetadata.getId() );
}
}
// TODO: move into the metadata repository proper - need to differentiate attachment of
@@ -965,6 +985,10 @@ public class DefaultRepositoriesService
repositorySession.close();
}
+ catch ( org.apache.archiva.metadata.repository.MetadataSessionException e )
+ {
+ e.printStackTrace( );
+ }
return Boolean.TRUE;
}
@@ -987,7 +1011,15 @@ public class DefaultRepositoriesService
throw new ArchivaRestServiceException( "groupId cannot be null", 400, null );
}
- RepositorySession repositorySession = repositorySessionFactory.createSession();
+ RepositorySession repositorySession = null;
+ try
+ {
+ repositorySession = repositorySessionFactory.createSession();
+ }
+ catch ( MetadataRepositoryException e )
+ {
+ e.printStackTrace( );
+ }
try
{
@@ -997,7 +1029,7 @@ public class DefaultRepositoriesService
MetadataRepository metadataRepository = repositorySession.getRepository();
- metadataRepository.removeNamespace( repositoryId, groupId );
+ metadataRepository.removeNamespace( , repositoryId, groupId );
// just invalidate cache entry
String cacheKey = repositoryId + "-" + groupId;
@@ -1048,7 +1080,15 @@ public class DefaultRepositoriesService
throw new ArchivaRestServiceException( "artifactId cannot be null", 400, null );
}
- RepositorySession repositorySession = repositorySessionFactory.createSession();
+ RepositorySession repositorySession = null;
+ try
+ {
+ repositorySession = repositorySessionFactory.createSession();
+ }
+ catch ( MetadataRepositoryException e )
+ {
+ e.printStackTrace( );
+ }
try
{
@@ -1071,7 +1111,7 @@ public class DefaultRepositoriesService
MetadataRepository metadataRepository = repositorySession.getRepository();
- metadataRepository.removeProject( repositoryId, groupId, projectId );
+ metadataRepository.removeProject( , repositoryId, groupId, projectId );
metadataRepository.save();
}
diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultSearchService.java b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultSearchService.java
index 7a12256ca..10caa3004 100644
--- a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultSearchService.java
+++ b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultSearchService.java
@@ -215,7 +215,15 @@ public class DefaultSearchService
checksumSearch.setRepositories( getObservableRepos() );
}
- RepositorySession repositorySession = repositorySessionFactory.createSession();
+ RepositorySession repositorySession = null;
+ try
+ {
+ repositorySession = repositorySessionFactory.createSession();
+ }
+ catch ( MetadataRepositoryException e )
+ {
+ e.printStackTrace( );
+ }
MetadataRepository metadataRepository = repositorySession.getRepository();
@@ -226,7 +234,7 @@ public class DefaultSearchService
for ( String repoId : checksumSearch.getRepositories() )
{
Collection<ArtifactMetadata> artifactMetadatas =
- metadataRepository.getArtifactsByChecksum( repoId, checksumSearch.getChecksum() );
+ metadataRepository.getArtifactsByChecksum( , repoId, checksumSearch.getChecksum() );
artifactSet.addAll( buildArtifacts( artifactMetadatas, repoId ) );
}
diff --git a/archiva-modules/archiva-web/archiva-rss/src/main/java/org/apache/archiva/rss/processor/NewArtifactsRssFeedProcessor.java b/archiva-modules/archiva-web/archiva-rss/src/main/java/org/apache/archiva/rss/processor/NewArtifactsRssFeedProcessor.java
index 019c9e16a..789d0845d 100644
--- a/archiva-modules/archiva-web/archiva-rss/src/main/java/org/apache/archiva/rss/processor/NewArtifactsRssFeedProcessor.java
+++ b/archiva-modules/archiva-web/archiva-rss/src/main/java/org/apache/archiva/rss/processor/NewArtifactsRssFeedProcessor.java
@@ -93,7 +93,7 @@ public class NewArtifactsRssFeedProcessor
List<ArtifactMetadata> artifacts;
try
{
- artifacts = metadataRepository.getArtifactsByDateRange( repoId, greaterThanThisDate.getTime(), null );
+ artifacts = metadataRepository.getArtifactsByDateRange( , repoId, greaterThanThisDate.getTime(), null );
}
catch ( MetadataRepositoryException e )
{
diff --git a/archiva-modules/archiva-web/archiva-rss/src/main/java/org/apache/archiva/rss/processor/NewVersionsOfArtifactRssFeedProcessor.java b/archiva-modules/archiva-web/archiva-rss/src/main/java/org/apache/archiva/rss/processor/NewVersionsOfArtifactRssFeedProcessor.java
index f9c24bd5c..68ddc45e1 100644
--- a/archiva-modules/archiva-web/archiva-rss/src/main/java/org/apache/archiva/rss/processor/NewVersionsOfArtifactRssFeedProcessor.java
+++ b/archiva-modules/archiva-web/archiva-rss/src/main/java/org/apache/archiva/rss/processor/NewVersionsOfArtifactRssFeedProcessor.java
@@ -84,10 +84,10 @@ public class NewVersionsOfArtifactRssFeedProcessor
{
for ( String repoId : metadataRepository.getRepositories() )
{
- Collection<String> versions = metadataRepository.getProjectVersions( repoId, groupId, artifactId );
+ Collection<String> versions = metadataRepository.getProjectVersions( , repoId, groupId, artifactId );
for ( String version : versions )
{
- artifacts.addAll( metadataRepository.getArtifacts( repoId, groupId, artifactId, version ) );
+ artifacts.addAll( metadataRepository.getArtifacts( , repoId, groupId, artifactId, version ) );
}
}
}
diff --git a/archiva-modules/archiva-web/archiva-rss/src/test/java/org/apache/archiva/rss/processor/NewArtifactsRssFeedProcessorTest.java b/archiva-modules/archiva-web/archiva-rss/src/test/java/org/apache/archiva/rss/processor/NewArtifactsRssFeedProcessorTest.java
index 328ef91ea..0706d6491 100644
--- a/archiva-modules/archiva-web/archiva-rss/src/test/java/org/apache/archiva/rss/processor/NewArtifactsRssFeedProcessorTest.java
+++ b/archiva-modules/archiva-web/archiva-rss/src/test/java/org/apache/archiva/rss/processor/NewArtifactsRssFeedProcessorTest.java
@@ -24,6 +24,7 @@ import com.sun.syndication.feed.synd.SyndFeed;
import junit.framework.TestCase;
import org.apache.archiva.metadata.model.ArtifactMetadata;
import org.apache.archiva.metadata.repository.AbstractMetadataRepository;
+import org.apache.archiva.metadata.repository.RepositorySession;
import org.apache.archiva.rss.RssFeedGenerator;
import org.apache.archiva.test.utils.ArchivaBlockJUnit4ClassRunner;
import org.junit.Before;
@@ -129,7 +130,7 @@ public class NewArtifactsRssFeedProcessorTest
private List<ArtifactMetadata> artifactsByDateRange;
@Override
- public List<ArtifactMetadata> getArtifactsByDateRange( String repoId, Date from, Date to )
+ public List<ArtifactMetadata> getArtifactsByDateRange( RepositorySession session, String repoId, Date from, Date to )
{
setRepoId( repoId );
setFrom( from );
@@ -174,7 +175,7 @@ public class NewArtifactsRssFeedProcessorTest
}
@Override
- public List<ArtifactMetadata> getArtifacts( String repositoryId )
+ public List<ArtifactMetadata> getArtifacts( RepositorySession session, String repositoryId )
{
return artifactsByDateRange;
}
diff --git a/archiva-modules/archiva-web/archiva-rss/src/test/java/org/apache/archiva/rss/processor/NewVersionsOfArtifactRssFeedProcessorTest.java b/archiva-modules/archiva-web/archiva-rss/src/test/java/org/apache/archiva/rss/processor/NewVersionsOfArtifactRssFeedProcessorTest.java
index 2b71c0f5c..2a60ae2bc 100644
--- a/archiva-modules/archiva-web/archiva-rss/src/test/java/org/apache/archiva/rss/processor/NewVersionsOfArtifactRssFeedProcessorTest.java
+++ b/archiva-modules/archiva-web/archiva-rss/src/test/java/org/apache/archiva/rss/processor/NewVersionsOfArtifactRssFeedProcessorTest.java
@@ -90,13 +90,13 @@ public class NewVersionsOfArtifactRssFeedProcessorTest
reqParams.put( RssFeedProcessor.KEY_ARTIFACT_ID, ARTIFACT_ID );
expect( metadataRepository.getRepositories() ).andReturn( Collections.singletonList( TEST_REPO ) );
- expect( metadataRepository.getProjectVersions( TEST_REPO, GROUP_ID, ARTIFACT_ID ) ).andReturn(
+ expect( metadataRepository.getProjectVersions( , TEST_REPO, GROUP_ID, ARTIFACT_ID ) ).andReturn(
Arrays.asList( "1.0.1", "1.0.2", "1.0.3-SNAPSHOT" ) );
- expect( metadataRepository.getArtifacts( TEST_REPO, GROUP_ID, ARTIFACT_ID, "1.0.1" ) ).andReturn(
+ expect( metadataRepository.getArtifacts( , TEST_REPO, GROUP_ID, ARTIFACT_ID, "1.0.1" ) ).andReturn(
Collections.singletonList( artifact1 ) );
- expect( metadataRepository.getArtifacts( TEST_REPO, GROUP_ID, ARTIFACT_ID, "1.0.2" ) ).andReturn(
+ expect( metadataRepository.getArtifacts( , TEST_REPO, GROUP_ID, ARTIFACT_ID, "1.0.2" ) ).andReturn(
Collections.singletonList( artifact2 ) );
- expect( metadataRepository.getArtifacts( TEST_REPO, GROUP_ID, ARTIFACT_ID, "1.0.3-SNAPSHOT" ) ).andReturn(
+ expect( metadataRepository.getArtifacts( , TEST_REPO, GROUP_ID, ARTIFACT_ID, "1.0.3-SNAPSHOT" ) ).andReturn(
Collections.singletonList( artifact3 ) );
metadataRepositoryControl.replay();
diff --git a/archiva-modules/archiva-web/archiva-web-common/src/main/java/org/apache/archiva/web/rss/RssFeedServlet.java b/archiva-modules/archiva-web/archiva-web-common/src/main/java/org/apache/archiva/web/rss/RssFeedServlet.java
index a0994cd25..0da0c61e5 100644
--- a/archiva-modules/archiva-web/archiva-web-common/src/main/java/org/apache/archiva/web/rss/RssFeedServlet.java
+++ b/archiva-modules/archiva-web/archiva-web-common/src/main/java/org/apache/archiva/web/rss/RssFeedServlet.java
@@ -242,6 +242,10 @@ public class RssFeedServlet
res.sendError( HttpServletResponse.SC_UNAUTHORIZED, USER_NOT_AUTHORIZED );
}
+ catch ( org.apache.archiva.metadata.repository.MetadataRepositoryException e )
+ {
+ e.printStackTrace( );
+ }
}
/**
diff --git a/archiva-modules/archiva-web/archiva-web-common/src/test/java/org/apache/archiva/webtest/memory/TestMetadataRepository.java b/archiva-modules/archiva-web/archiva-web-common/src/test/java/org/apache/archiva/webtest/memory/TestMetadataRepository.java
index aa55d47f6..1557fc6c1 100644
--- a/archiva-modules/archiva-web/archiva-web-common/src/test/java/org/apache/archiva/webtest/memory/TestMetadataRepository.java
+++ b/archiva-modules/archiva-web/archiva-web-common/src/test/java/org/apache/archiva/webtest/memory/TestMetadataRepository.java
@@ -21,6 +21,7 @@ package org.apache.archiva.webtest.memory;
import org.apache.archiva.metadata.model.ArtifactMetadata;
import org.apache.archiva.metadata.repository.AbstractMetadataRepository;
+import org.apache.archiva.metadata.repository.RepositorySession;
import java.util.ArrayList;
import java.util.Collection;
@@ -70,25 +71,25 @@ public class TestMetadataRepository
}
@Override
- public Collection<String> getProjectVersions( String repoId, String namespace, String projectId )
+ public Collection<String> getProjectVersions( RepositorySession session, String repoId, String namespace, String projectId )
{
return versions;
}
@Override
- public List<String> getMetadataFacets( String repodId, String facetId )
+ public List<String> getMetadataFacets( RepositorySession session, String repodId, String facetId )
{
return Collections.emptyList();
}
@Override
- public void removeMetadataFacet( String repoId, String facetId, String name )
+ public void removeMetadataFacet( RepositorySession session, String repoId, String facetId, String name )
{
//To change body of implemented methods use File | Settings | File Templates.
}
@Override
- public List<ArtifactMetadata> getArtifactsByDateRange( String repoId, Date startTime, Date endTime )
+ public List<ArtifactMetadata> getArtifactsByDateRange( RepositorySession session, String repoId, Date startTime, Date endTime )
{
return artifacts;
}
@@ -100,14 +101,14 @@ public class TestMetadataRepository
}
@Override
- public Collection<ArtifactMetadata> getArtifacts( String repoId, String namespace, String projectId,
+ public Collection<ArtifactMetadata> getArtifacts( RepositorySession session, String repoId, String namespace, String projectId,
String projectVersion )
{
return artifacts;
}
@Override
- public List<ArtifactMetadata> getArtifacts( String repositoryId )
+ public List<ArtifactMetadata> getArtifacts( RepositorySession session, String repositoryId )
{
return artifacts;
}
diff --git a/archiva-modules/archiva-web/archiva-web-common/src/test/java/org/apache/archiva/webtest/memory/TestRepositorySessionFactory.java b/archiva-modules/archiva-web/archiva-web-common/src/test/java/org/apache/archiva/webtest/memory/TestRepositorySessionFactory.java
index b2aab9de8..1fd8b35f2 100644
--- a/archiva-modules/archiva-web/archiva-web-common/src/test/java/org/apache/archiva/webtest/memory/TestRepositorySessionFactory.java
+++ b/archiva-modules/archiva-web/archiva-web-common/src/test/java/org/apache/archiva/webtest/memory/TestRepositorySessionFactory.java
@@ -19,6 +19,7 @@ package org.apache.archiva.webtest.memory;
* under the License.
*/
+import org.apache.archiva.metadata.repository.MetadataRepositoryException;
import org.apache.archiva.metadata.repository.RepositorySession;
import org.apache.archiva.metadata.repository.RepositorySessionFactory;
import org.springframework.beans.factory.config.AbstractFactoryBean;
@@ -47,7 +48,7 @@ public class TestRepositorySessionFactory
}
@Override
- public RepositorySession createSession()
+ public RepositorySession createSession() throws MetadataRepositoryException
{
return repositorySession != null ? repositorySession : new RepositorySession( new TestMetadataRepository(),
new TestMetadataResolver() );
diff --git a/archiva-modules/metadata/metadata-repository-api/src/main/java/org/apache/archiva/metadata/repository/AbstractMetadataRepository.java b/archiva-modules/metadata/metadata-repository-api/src/main/java/org/apache/archiva/metadata/repository/AbstractMetadataRepository.java
index 6b9b845f8..86fbde676 100644
--- a/archiva-modules/metadata/metadata-repository-api/src/main/java/org/apache/archiva/metadata/repository/AbstractMetadataRepository.java
+++ b/archiva-modules/metadata/metadata-repository-api/src/main/java/org/apache/archiva/metadata/repository/AbstractMetadataRepository.java
@@ -34,14 +34,14 @@ public abstract class AbstractMetadataRepository
{
@Override
- public void updateProject( String repositoryId, ProjectMetadata project )
+ public void updateProject( RepositorySession session, String repositoryId, ProjectMetadata project )
throws MetadataRepositoryException
{
throw new UnsupportedOperationException();
}
@Override
- public void updateArtifact( String repositoryId, String namespace, String projectId, String projectVersion,
+ public void updateArtifact( RepositorySession session, String repositoryId, String namespace, String projectId, String projectVersion,
ArtifactMetadata artifactMeta )
throws MetadataRepositoryException
{
@@ -49,7 +49,7 @@ public abstract class AbstractMetadataRepository
}
@Override
- public void updateProjectVersion( String repositoryId, String namespace, String projectId,
+ public void updateProjectVersion( RepositorySession session, String repositoryId, String namespace, String projectId,
ProjectVersionMetadata versionMetadata )
throws MetadataRepositoryException
{
@@ -57,110 +57,103 @@ public abstract class AbstractMetadataRepository
}
@Override
- public void updateNamespace( String repositoryId, String namespace )
+ public void updateNamespace( RepositorySession session, String repositoryId, String namespace )
throws MetadataRepositoryException
{
throw new UnsupportedOperationException();
}
@Override
- public List<String> getMetadataFacets( String repositoryId, String facetId )
+ public List<String> getMetadataFacets( RepositorySession session, String repositoryId, String facetId )
throws MetadataRepositoryException
{
throw new UnsupportedOperationException();
}
@Override
- public boolean hasMetadataFacet( String repositoryId, String facetId )
+ public boolean hasMetadataFacet( RepositorySession session, String repositoryId, String facetId )
throws MetadataRepositoryException
{
return false;
}
@Override
- public MetadataFacet getMetadataFacet( String repositoryId, String facetId, String name )
+ public MetadataFacet getMetadataFacet( RepositorySession session, String repositoryId, String facetId, String name )
throws MetadataRepositoryException
{
throw new UnsupportedOperationException();
}
@Override
- public void addMetadataFacet( String repositoryId, MetadataFacet metadataFacet )
+ public void addMetadataFacet( RepositorySession session, String repositoryId, MetadataFacet metadataFacet )
throws MetadataRepositoryException
{
}
@Override
- public void removeMetadataFacets( String repositoryId, String facetId )
+ public void removeMetadataFacets( RepositorySession session, String repositoryId, String facetId )
throws MetadataRepositoryException
{
}
@Override
- public void removeMetadataFacet( String repositoryId, String facetId, String name )
+ public void removeMetadataFacet( RepositorySession session, String repositoryId, String facetId, String name )
throws MetadataRepositoryException
{
throw new UnsupportedOperationException();
}
@Override
- public List<ArtifactMetadata> getArtifactsByDateRange( String repositoryId, Date startTime, Date endTime )
+ public List<ArtifactMetadata> getArtifactsByDateRange( RepositorySession session, String repositoryId, Date startTime, Date endTime )
throws MetadataRepositoryException
{
throw new UnsupportedOperationException();
}
@Override
- public Collection<String> getRepositories()
+ public Collection<ArtifactMetadata> getArtifactsByChecksum( RepositorySession session, String repositoryId, String checksum )
throws MetadataRepositoryException
{
throw new UnsupportedOperationException();
}
@Override
- public Collection<ArtifactMetadata> getArtifactsByChecksum( String repositoryId, String checksum )
+ public List<ArtifactMetadata> getArtifactsByProjectVersionMetadata( RepositorySession session, String key, String value, String repositoryId )
throws MetadataRepositoryException
{
throw new UnsupportedOperationException();
}
@Override
- public List<ArtifactMetadata> getArtifactsByProjectVersionMetadata( String key , String value , String repositoryId )
+ public List<ArtifactMetadata> getArtifactsByMetadata( RepositorySession session, String key, String value, String repositoryId )
throws MetadataRepositoryException
{
throw new UnsupportedOperationException();
}
@Override
- public List<ArtifactMetadata> getArtifactsByMetadata( String key , String value , String repositoryId )
+ public List<ArtifactMetadata> getArtifactsByProperty( RepositorySession session, String key, String value, String repositoryId )
throws MetadataRepositoryException
{
throw new UnsupportedOperationException();
}
@Override
- public List<ArtifactMetadata> getArtifactsByProperty( String key, String value, String repositoryId )
+ public void removeArtifact( RepositorySession session, String repositoryId, String namespace, String project, String version, String id )
throws MetadataRepositoryException
{
throw new UnsupportedOperationException();
}
@Override
- public void removeArtifact( String repositoryId, String namespace, String project, String version, String id )
+ public void removeArtifact( RepositorySession session, ArtifactMetadata artifactMetadata, String baseVersion )
throws MetadataRepositoryException
{
throw new UnsupportedOperationException();
}
@Override
- public void removeArtifact( ArtifactMetadata artifactMetadata, String baseVersion )
- throws MetadataRepositoryException
- {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public void removeArtifact( String repositoryId, String namespace, String project, String version,
+ public void removeArtifact( RepositorySession session, String repositoryId, String namespace, String project, String version,
MetadataFacet metadataFacet )
throws MetadataRepositoryException
{
@@ -168,13 +161,13 @@ public abstract class AbstractMetadataRepository
}
@Override
- public void removeRepository( String repositoryId )
+ public void removeRepository( RepositorySession session, String repositoryId )
throws MetadataRepositoryException
{
}
@Override
- public void removeNamespace( String repositoryId, String namespace )
+ public void removeNamespace( RepositorySession session, String repositoryId, String namespace )
throws MetadataRepositoryException
{
throw new UnsupportedOperationException();
@@ -182,21 +175,21 @@ public abstract class AbstractMetadataRepository
}
@Override
- public List<ArtifactMetadata> getArtifacts( String repositoryId )
+ public List<ArtifactMetadata> getArtifacts( RepositorySession session, String repositoryId )
throws MetadataRepositoryException
{
throw new UnsupportedOperationException();
}
@Override
- public ProjectMetadata getProject( String repoId, String namespace, String projectId )
+ public ProjectMetadata getProject( RepositorySession session, String repoId, String namespace, String projectId )
throws MetadataResolutionException
{
throw new UnsupportedOperationException();
}
@Override
- public ProjectVersionMetadata getProjectVersion( String repoId, String namespace, String projectId,
+ public ProjectVersionMetadata getProjectVersion( RepositorySession session, String repoId, String namespace, String projectId,
String projectVersion )
throws MetadataResolutionException
{
@@ -204,7 +197,7 @@ public abstract class AbstractMetadataRepository
}
@Override
- public Collection<String> getArtifactVersions( String repoId, String namespace, String projectId,
+ public Collection<String> getArtifactVersions( RepositorySession session, String repoId, String namespace, String projectId,
String projectVersion )
throws MetadataResolutionException
{
@@ -212,7 +205,7 @@ public abstract class AbstractMetadataRepository
}
@Override
- public Collection<ProjectVersionReference> getProjectReferences( String repoId, String namespace, String projectId,
+ public Collection<ProjectVersionReference> getProjectReferences( RepositorySession session, String repoId, String namespace, String projectId,
String projectVersion )
throws MetadataResolutionException
{
@@ -220,42 +213,42 @@ public abstract class AbstractMetadataRepository
}
@Override
- public Collection<String> getRootNamespaces( String repoId )
+ public Collection<String> getRootNamespaces( RepositorySession session, String repoId )
throws MetadataResolutionException
{
throw new UnsupportedOperationException();
}
@Override
- public Collection<String> getNamespaces( String repoId, String namespace )
+ public Collection<String> getNamespaces( RepositorySession session, String repoId, String namespace )
throws MetadataResolutionException
{
throw new UnsupportedOperationException();
}
@Override
- public Collection<String> getProjects( String repoId, String namespace )
+ public Collection<String> getProjects( RepositorySession session, String repoId, String namespace )
throws MetadataResolutionException
{
throw new UnsupportedOperationException();
}
@Override
- public Collection<String> getProjectVersions( String repoId, String namespace, String projectId )
+ public Collection<String> getProjectVersions( RepositorySession session, String repoId, String namespace, String projectId )
throws MetadataResolutionException
{
throw new UnsupportedOperationException();
}
@Override
- public void removeProjectVersion( String repoId, String namespace, String projectId, String projectVersion )
+ public void removeProjectVersion( RepositorySession session, String repoId, String namespace, String projectId, String projectVersion )
throws MetadataRepositoryException
{
throw new UnsupportedOperationException();
}
@Override
- public Collection<ArtifactMetadata> getArtifacts( String repoId, String namespace, String projectId,
+ public Collection<ArtifactMetadata> getArtifacts( RepositorySession session, String repoId, String namespace, String projectId,
String projectVersion )
throws MetadataResolutionException
{
@@ -263,16 +256,12 @@ public abstract class AbstractMetadataRepository
}
@Override
- public void removeProject( String repositoryId, String namespace, String projectId )
+ public void removeProject( RepositorySession session, String repositoryId, String namespace, String projectId )
throws MetadataRepositoryException
{
throw new UnsupportedOperationException();
}
- @Override
- public void save()
- {
- }
@Override
public void close()
@@ -281,32 +270,27 @@ public abstract class AbstractMetadataRepository
}
@Override
- public void revert()
- {
- }
-
- @Override
public boolean canObtainAccess( Class<?> aClass )
{
throw new UnsupportedOperationException();
}
@Override
- public <T> T obtainAccess( Class<T> aClass )
+ public <T> T obtainAccess( RepositorySession session, Class<T> aClass )
throws MetadataRepositoryException
{
throw new UnsupportedOperationException();
}
@Override
- public List<ArtifactMetadata> searchArtifacts( String text, String repositoryId, boolean exact )
+ public List<ArtifactMetadata> searchArtifacts( RepositorySession session, String repositoryId, String text, boolean exact )
throws MetadataRepositoryException
{
throw new UnsupportedOperationException();
}
@Override
- public List<ArtifactMetadata> searchArtifacts( String key, String text, String repositoryId, boolean exact )
+ public List<ArtifactMetadata> searchArtifacts( RepositorySession session, String repositoryId, String key, String text, boolean exact )
throws MetadataRepositoryException
{
throw new UnsupportedOperationException();
diff --git a/archiva-modules/metadata/metadata-repository-api/src/main/java/org/apache/archiva/metadata/repository/DefaultMetadataResolver.java b/archiva-modules/metadata/metadata-repository-api/src/main/java/org/apache/archiva/metadata/repository/DefaultMetadataResolver.java
index b3f6f43b8..ba8e0fc41 100644
--- a/archiva-modules/metadata/metadata-repository-api/src/main/java/org/apache/archiva/metadata/repository/DefaultMetadataResolver.java
+++ b/archiva-modules/metadata/metadata-repository-api/src/main/java/org/apache/archiva/metadata/repository/DefaultMetadataResolver.java
@@ -103,7 +103,7 @@ public class DefaultMetadataResolver
MetadataRepository metadataRepository = session.getRepository();
ProjectVersionMetadata metadata =
- metadataRepository.getProjectVersion( repoId, namespace, projectId, projectVersion );
+ metadataRepository.getProjectVersion( session, repoId, namespace, projectId, projectVersion );
// TODO: do we want to detect changes as well by comparing timestamps? isProjectVersionNewerThan(updated)
// in such cases we might also remove/update stale metadata, including adjusting plugin-based facets
// This would also be better than checking for completeness - we can then refresh only when fixed (though
@@ -136,7 +136,7 @@ public class DefaultMetadataResolver
{
listener.addArtifact( session, repoId, namespace, projectId, metadata );
}
- metadataRepository.updateProjectVersion( repoId, namespace, projectId, metadata );
+ metadataRepository.updateProjectVersion( session, repoId, namespace, projectId, metadata );
}
catch ( MetadataRepositoryException e )
{
@@ -183,7 +183,7 @@ public class DefaultMetadataResolver
// TODO: is this assumption correct? could a storage mech. actually know all references in a non-Maven scenario?
// not passed to the storage mechanism as resolving references would require iterating all artifacts
MetadataRepository metadataRepository = session.getRepository();
- return metadataRepository.getProjectReferences( repoId, namespace, projectId, projectVersion );
+ return metadataRepository.getProjectReferences( session, repoId, namespace, projectId, projectVersion );
}
@Override
@@ -200,7 +200,7 @@ public class DefaultMetadataResolver
}
MetadataRepository metadataRepository = session.getRepository();
- namespaces = metadataRepository.getRootNamespaces( repoId );
+ namespaces = metadataRepository.getRootNamespaces( session, repoId );
Collection<String> storageNamespaces =
repositoryStorage.listRootNamespaces( repoId, new ExcludesFilter<String>( namespaces ) );
if ( storageNamespaces != null && !storageNamespaces.isEmpty() )
@@ -212,7 +212,7 @@ public class DefaultMetadataResolver
{
try
{
- metadataRepository.updateNamespace( repoId, n );
+ metadataRepository.updateNamespace( session, repoId, n );
// just invalidate cache entry
String cacheKey = repoId + "-" + n;
namespacesCache.remove( cacheKey );
@@ -249,11 +249,11 @@ public class DefaultMetadataResolver
Collection<String> namespaces = namespacesCache.get( cacheKey );
if ( namespaces == null )
{
- namespaces = metadataRepository.getNamespaces( repoId, namespace );
+ namespaces = metadataRepository.getNamespaces( session, repoId, namespace );
namespacesCache.put( cacheKey, namespaces );
}
Collection<String> exclusions = new ArrayList<>( namespaces );
- exclusions.addAll( metadataRepository.getProjects( repoId, namespace ) );
+ exclusions.addAll( metadataRepository.getProjects( session, repoId, namespace ) );
Collection<String> storageNamespaces =
repositoryStorage.listNamespaces( repoId, namespace, new ExcludesFilter<String>( exclusions ) );
if ( storageNamespaces != null && !storageNamespaces.isEmpty() )
@@ -265,7 +265,7 @@ public class DefaultMetadataResolver
{
try
{
- metadataRepository.updateNamespace( repoId, namespace + "." + n );
+ metadataRepository.updateNamespace( session, repoId, namespace + "." + n );
// just invalidate cache entry
cacheKey = repoId + "-" + namespace + "." + n;
namespacesCache.remove( cacheKey );
@@ -295,14 +295,14 @@ public class DefaultMetadataResolver
try
{
MetadataRepository metadataRepository = session.getRepository();
- Collection<String> projects = metadataRepository.getProjects( repoId, namespace );
+ Collection<String> projects = metadataRepository.getProjects( session, repoId, namespace );
Collection<String> exclusions = new ArrayList<>( projects );
String cacheKey = repoId + "-" + namespace;
Collection<String> namespaces = namespacesCache.get( cacheKey );
if ( namespaces == null )
{
- namespaces = metadataRepository.getNamespaces( repoId, namespace );
+ namespaces = metadataRepository.getNamespaces( session, repoId, namespace );
namespacesCache.put( cacheKey, namespaces );
}
@@ -322,7 +322,7 @@ public class DefaultMetadataResolver
{
try
{
- metadataRepository.updateProject( repoId, projectMetadata );
+ metadataRepository.updateProject( session, repoId, projectMetadata );
}
catch ( MetadataRepositoryException e )
{
@@ -352,7 +352,7 @@ public class DefaultMetadataResolver
{
MetadataRepository metadataRepository = session.getRepository();
- Collection<String> projectVersions = metadataRepository.getProjectVersions( repoId, namespace, projectId );
+ Collection<String> projectVersions = metadataRepository.getProjectVersions( session, repoId, namespace, projectId );
Collection<String> storageProjectVersions =
repositoryStorage.listProjectVersions( repoId, namespace, projectId,
new ExcludesFilter<String>( projectVersions ) );
@@ -374,7 +374,7 @@ public class DefaultMetadataResolver
listener.addArtifact( session, repoId, namespace, projectId, versionMetadata );
}
- metadataRepository.updateProjectVersion( repoId, namespace, projectId, versionMetadata );
+ metadataRepository.updateProjectVersion( session, repoId, namespace, projectId, versionMetadata );
}
catch ( MetadataRepositoryException e )
{
@@ -421,7 +421,7 @@ public class DefaultMetadataResolver
{
MetadataRepository metadataRepository = session.getRepository();
Collection<ArtifactMetadata> artifacts =
- metadataRepository.getArtifacts( repoId, namespace, projectId, projectVersion );
+ metadataRepository.getArtifacts( session, repoId, namespace, projectId, projectVersion );
ExcludesFilter<String> filter = new ExcludesFilter<String>( createArtifactIdList( artifacts ) );
ReadMetadataRequest readMetadataRequest =
@@ -439,7 +439,7 @@ public class DefaultMetadataResolver
{
try
{
- metadataRepository.updateArtifact( repoId, namespace, projectId, projectVersion, artifact );
+ metadataRepository.updateArtifact( session, repoId, namespace, projectId, projectVersion, artifact );
}
catch ( MetadataRepositoryException e )
{
diff --git a/archiva-modules/metadata/metadata-repository-api/src/main/java/org/apache/archiva/metadata/repository/MetadataRepository.java b/archiva-modules/metadata/metadata-repository-api/src/main/java/org/apache/archiva/metadata/repository/MetadataRepository.java
index 421eccd91..5048353b5 100644
--- a/archiva-modules/metadata/metadata-repository-api/src/main/java/org/apache/archiva/metadata/repository/MetadataRepository.java
+++ b/archiva-modules/metadata/metadata-repository-api/src/main/java/org/apache/archiva/metadata/repository/MetadataRepository.java
@@ -34,129 +34,142 @@ public interface MetadataRepository
/**
* Update metadata for a particular project in the metadata repository, or create it if it does not already exist.
*
+ * @param session
* @param repositoryId the repository the project is in
* @param project the project metadata to create or update
*/
- void updateProject( String repositoryId, ProjectMetadata project )
+ void updateProject( RepositorySession session, String repositoryId, ProjectMetadata project )
throws MetadataRepositoryException;
- void updateArtifact( String repositoryId, String namespace, String projectId, String projectVersion,
+ void updateArtifact( RepositorySession session, String repositoryId, String namespace, String projectId, String projectVersion,
ArtifactMetadata artifactMeta )
throws MetadataRepositoryException;
- void updateProjectVersion( String repositoryId, String namespace, String projectId,
+ void updateProjectVersion( RepositorySession session, String repositoryId, String namespace, String projectId,
ProjectVersionMetadata versionMetadata )
throws MetadataRepositoryException;
/**
* create the namespace in the repository. (if not exist)
*
+ *
+ * @param session
* @param repositoryId
* @param namespace
* @throws MetadataRepositoryException
*/
- void updateNamespace( String repositoryId, String namespace )
+ void updateNamespace( RepositorySession session, String repositoryId, String namespace )
throws MetadataRepositoryException;
- List<String> getMetadataFacets( String repositoryId, String facetId )
+ List<String> getMetadataFacets( RepositorySession session, String repositoryId, String facetId )
throws MetadataRepositoryException;
/**
+ *
+ * @param session
* @param repositoryId
* @param facetId
* @return true if the repository datas for this facetId
* @throws MetadataRepositoryException
* @since 1.4-M4
*/
- boolean hasMetadataFacet( String repositoryId, String facetId )
+ boolean hasMetadataFacet( RepositorySession session, String repositoryId, String facetId )
throws MetadataRepositoryException;
- MetadataFacet getMetadataFacet( String repositoryId, String facetId, String name )
+ MetadataFacet getMetadataFacet( RepositorySession session, String repositoryId, String facetId, String name )
throws MetadataRepositoryException;
- void addMetadataFacet( String repositoryId, MetadataFacet metadataFacet )
+ void addMetadataFacet( RepositorySession session, String repositoryId, MetadataFacet metadataFacet )
throws MetadataRepositoryException;
- void removeMetadataFacets( String repositoryId, String facetId )
+ void removeMetadataFacets( RepositorySession session, String repositoryId, String facetId )
throws MetadataRepositoryException;
- void removeMetadataFacet( String repositoryId, String facetId, String name )
+ void removeMetadataFacet( RepositorySession session, String repositoryId, String facetId, String name )
throws MetadataRepositoryException;
/**
* if startTime or endTime are <code>null</code> they are not used for search
*
+ *
+ * @param session
* @param repositoryId
* @param startTime can be <code>null</code>
* @param endTime can be <code>null</code>
* @return
* @throws MetadataRepositoryException
*/
- List<ArtifactMetadata> getArtifactsByDateRange( String repositoryId, Date startTime, Date endTime )
- throws MetadataRepositoryException;
-
- // TODO: remove from API, just use configuration
- Collection<String> getRepositories()
+ List<ArtifactMetadata> getArtifactsByDateRange( RepositorySession session, String repositoryId, Date startTime, Date endTime )
throws MetadataRepositoryException;
- Collection<ArtifactMetadata> getArtifactsByChecksum( String repositoryId, String checksum )
+ Collection<ArtifactMetadata> getArtifactsByChecksum( RepositorySession session, String repositoryId, String checksum )
throws MetadataRepositoryException;
/**
* Get artifacts with a project version metadata key that matches the passed value.
*
+ *
+ * @param session
* @param key
* @param value
* @param repositoryId can be null, meaning search in all repositories
* @return a list of artifacts
* @throws MetadataRepositoryException
*/
- List<ArtifactMetadata> getArtifactsByProjectVersionMetadata( String key, String value, String repositoryId )
+ List<ArtifactMetadata> getArtifactsByProjectVersionMetadata( RepositorySession session, String key, String value, String repositoryId )
throws MetadataRepositoryException;
/**
* Get artifacts with an artifact metadata key that matches the passed value.
*
+ *
+ * @param session
* @param key
* @param value
* @param repositoryId can be null, meaning search in all repositories
* @return a list of artifacts
* @throws MetadataRepositoryException
*/
- List<ArtifactMetadata> getArtifactsByMetadata( String key, String value, String repositoryId )
+ List<ArtifactMetadata> getArtifactsByMetadata( RepositorySession session, String key, String value, String repositoryId )
throws MetadataRepositoryException;
/**
* Get artifacts with a property key that matches the passed value.
* Possible keys are 'scm.url', 'org.name', 'url', 'mailingList.0.name', 'license.0.name',...
*
+ *
+ * @param session
* @param key
* @param value
* @param repositoryId can be null, meaning search in all repositories
* @return a list of artifacts
* @throws MetadataRepositoryException
*/
- List<ArtifactMetadata> getArtifactsByProperty( String key, String value, String repositoryId )
+ List<ArtifactMetadata> getArtifactsByProperty( RepositorySession session, String key, String value, String repositoryId )
throws MetadataRepositoryException;
- void removeArtifact( 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;
/**
* used for deleting timestamped version of SNAPSHOT artifacts
*
+ *
+ * @param session
* @param artifactMetadata the artifactMetadata with the timestamped version (2.0-20120618.214135-2)
* @param baseVersion the base version of the snapshot (2.0-SNAPSHOT)
* @throws MetadataRepositoryException
* @since 1.4-M3
*/
- void removeArtifact( ArtifactMetadata artifactMetadata, String baseVersion )
+ void removeArtifact( RepositorySession session, ArtifactMetadata artifactMetadata, String baseVersion )
throws MetadataRepositoryException;
/**
* FIXME need a unit test!!!
* Only remove {@link MetadataFacet} for the artifact
*
+ *
+ * @param session
* @param repositoryId
* @param namespace
* @param project
@@ -165,46 +178,51 @@ public interface MetadataRepository
* @throws MetadataRepositoryException
* @since 1.4-M3
*/
- void removeArtifact( String repositoryId, String namespace, String project, String version,
+ void removeArtifact( RepositorySession session, String repositoryId, String namespace, String project, String version,
MetadataFacet metadataFacet )
throws MetadataRepositoryException;
/**
* Delete a repository's metadata. This includes all associated metadata facets.
*
+ * @param session
* @param repositoryId the repository to delete
*/
- void removeRepository( String repositoryId )
+ void removeRepository( RepositorySession session, String repositoryId )
throws MetadataRepositoryException;
/**
+ *
+ * @param session
* @param repositoryId
* @param namespace (groupId for maven )
* @throws MetadataRepositoryException
* @since 1.4-M3
*/
- void removeNamespace( String repositoryId, String namespace )
+ void removeNamespace( RepositorySession session, String repositoryId, String namespace )
throws MetadataRepositoryException;
- List<ArtifactMetadata> getArtifacts( String repositoryId )
+ List<ArtifactMetadata> getArtifacts( RepositorySession session, String repositoryId )
throws MetadataRepositoryException;
/**
* basically just checking it exists not complete data returned
*
+ *
+ * @param session
* @param repoId
* @param namespace
* @param projectId
* @return
* @throws MetadataResolutionException
*/
- ProjectMetadata getProject( String repoId, String namespace, String projectId )
+ ProjectMetadata getProject( RepositorySession session, String repoId, String namespace, String projectId )
throws MetadataResolutionException;
- ProjectVersionMetadata getProjectVersion( String repoId, String namespace, String projectId, String projectVersion )
+ ProjectVersionMetadata getProjectVersion( RepositorySession session, String repoId, String namespace, String projectId, String projectVersion )
throws MetadataResolutionException;
- Collection<String> getArtifactVersions( String repoId, String namespace, String projectId, String projectVersion )
+ Collection<String> getArtifactVersions( RepositorySession session, String repoId, String namespace, String projectId, String projectVersion )
throws MetadataResolutionException;
/**
@@ -212,48 +230,58 @@ public interface MetadataRepository
* 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.
*
+ *
+ * @param session
* @param repoId the repository ID to look within
* @param namespace the namespace 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
* @return a list of project references
*/
- Collection<ProjectVersionReference> getProjectReferences( String repoId, String namespace, String projectId,
+ Collection<ProjectVersionReference> getProjectReferences( RepositorySession session, String repoId, String namespace, String projectId,
String projectVersion )
throws MetadataResolutionException;
- Collection<String> getRootNamespaces( String repoId )
+ Collection<String> getRootNamespaces( RepositorySession session, String repoId )
throws MetadataResolutionException;
/**
+ *
+ * @param session
* @param repoId
* @param namespace
* @return {@link Collection} of child namespaces of the namespace argument
* @throws MetadataResolutionException
*/
- Collection<String> getNamespaces( String repoId, String namespace )
+ Collection<String> getNamespaces( RepositorySession session, String repoId, String namespace )
throws MetadataResolutionException;
/**
+ *
+ * @param session
* @param repoId
* @param namespace
* @return
* @throws MetadataResolutionException
*/
- Collection<String> getProjects( String repoId, String namespace )
+ Collection<String> getProjects( RepositorySession session, String repoId, String namespace )
throws MetadataResolutionException;
/**
+ *
+ * @param session
* @param repoId
* @param namespace
* @param projectId
* @return
* @throws MetadataResolutionException
*/
- Collection<String> getProjectVersions( String repoId, String namespace, String projectId )
+ Collection<String> getProjectVersions( RepositorySession session, String repoId, String namespace, String projectId )
throws MetadataResolutionException;
/**
+ *
+ * @param session
* @param repoId
* @param namespace
* @param projectId
@@ -261,10 +289,12 @@ public interface MetadataRepository
* @throws MetadataRepositoryException
* @since 1.4-M4
*/
- void removeProjectVersion( String repoId, String namespace, String projectId, String projectVersion )
+ void removeProjectVersion( RepositorySession session, String repoId, String namespace, String projectId, String projectVersion )
throws MetadataRepositoryException;
/**
+ *
+ * @param session
* @param repoId
* @param namespace
* @param projectId
@@ -272,65 +302,61 @@ public interface MetadataRepository
* @return
* @throws MetadataResolutionException
*/
- Collection<ArtifactMetadata> getArtifacts( String repoId, String namespace, String projectId,
+ Collection<ArtifactMetadata> getArtifacts( RepositorySession session, String repoId, String namespace, String projectId,
String projectVersion )
throws MetadataResolutionException;
/**
* remove a project
*
+ *
+ * @param session
* @param repositoryId
* @param namespace
* @param projectId
* @throws MetadataRepositoryException
* @since 1.4-M4
*/
- void removeProject( String repositoryId, String namespace, String projectId )
+ void removeProject( RepositorySession session, String repositoryId, String namespace, String projectId )
throws MetadataRepositoryException;
- /**
- * <b>implementations can throw RuntimeException</b>
- */
- void save();
-
-
void close()
throws MetadataRepositoryException;
- /**
- * <b>implementations can throw RuntimeException</b>
- */
- void revert();
boolean canObtainAccess( Class<?> aClass );
- <T> T obtainAccess( Class<T> aClass )
+ <T> T obtainAccess( RepositorySession session, Class<T> aClass )
throws MetadataRepositoryException;
/**
* Full text artifacts search.
*
- * @param text
+ *
+ * @param session
* @param repositoryId can be null to search in all repositories
- * @param exact running an exact search, the value must exactly match the text.
+ * @param text
+ * @param exact running an exact search, the value must exactly match the text.
* @return a list of artifacts
* @throws MetadataRepositoryException
*/
- List<ArtifactMetadata> searchArtifacts( String text, String repositoryId, boolean exact )
+ List<ArtifactMetadata> searchArtifacts( RepositorySession session, String repositoryId, String text, boolean exact )
throws MetadataRepositoryException;
/**
* Full text artifacts search inside the specified key.
*
+ *
+ * @param session
+ * @param repositoryId can be null to search in all repositories
* @param key search only inside this key
* @param text
- * @param repositoryId can be null to search in all repositories
- * @param exact running an exact search, 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
* @throws MetadataRepositoryException
*/
- List<ArtifactMetadata> searchArtifacts( String key, String text, String repositoryId, boolean exact )
+ List<ArtifactMetadata> searchArtifacts( RepositorySession session, String repositoryId, String key, String text, boolean exact )
throws MetadataRepositoryException;
}
diff --git a/archiva-modules/metadata/metadata-repository-api/src/main/java/org/apache/archiva/metadata/repository/MetadataSessionException.java b/archiva-modules/metadata/metadata-repository-api/src/main/java/org/apache/archiva/metadata/repository/MetadataSessionException.java
new file mode 100644
index 000000000..1371d8aa7
--- /dev/null
+++ b/archiva-modules/metadata/metadata-repository-api/src/main/java/org/apache/archiva/metadata/repository/MetadataSessionException.java
@@ -0,0 +1,52 @@
+package org.apache.archiva.metadata.repository;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+/**
+ * Exception thrown if the session method fails.
+ *
+ * @author Martin Stockhammer <martin_s@apache.org>
+ */
+public class MetadataSessionException extends Exception
+{
+ public MetadataSessionException( )
+ {
+ }
+
+ public MetadataSessionException( String message )
+ {
+ super( message );
+ }
+
+ public MetadataSessionException( String message, Throwable cause )
+ {
+ super( message, cause );
+ }
+
+ public MetadataSessionException( Throwable cause )
+ {
+ super( cause );
+ }
+
+ public MetadataSessionException( String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace )
+ {
+ super( message, cause, enableSuppression, writableStackTrace );
+ }
+}
diff --git a/archiva-modules/metadata/metadata-repository-api/src/main/java/org/apache/archiva/metadata/repository/RepositorySession.java b/archiva-modules/metadata/metadata-repository-api/src/main/java/org/apache/archiva/metadata/repository/RepositorySession.java
index 07424033a..9ebde6a53 100644
--- a/archiva-modules/metadata/metadata-repository-api/src/main/java/org/apache/archiva/metadata/repository/RepositorySession.java
+++ b/archiva-modules/metadata/metadata-repository-api/src/main/java/org/apache/archiva/metadata/repository/RepositorySession.java
@@ -65,17 +65,22 @@ public class RepositorySession
return resolver;
}
- public void save()
- {
- repository.save();
+ protected boolean isDirty() {
+ return dirty;
+ }
- dirty = false;
+ protected void setDirty(boolean value) {
+ this.dirty = value;
+ }
+
+ public void save() throws MetadataSessionException
+ {
+ setDirty( false );
}
- public void revert()
+ public void revert() throws MetadataSessionException
{
- repository.revert();
- dirty = false;
+ setDirty( false );
}
/**
@@ -90,21 +95,14 @@ public class RepositorySession
{
try
{
- if ( dirty )
+ if ( isDirty() )
{
save();
}
}
- finally
+ catch ( MetadataSessionException e )
{
- try
- {
- repository.close();
- }
- catch ( MetadataRepositoryException e )
- {
- throw new RuntimeException( e.getMessage(), e );
- }
+ throw new RuntimeException( "Could not save the session " + e.getMessage( ), e );
}
}
diff --git a/archiva-modules/metadata/metadata-repository-api/src/main/java/org/apache/archiva/metadata/repository/RepositorySessionFactory.java b/archiva-modules/metadata/metadata-repository-api/src/main/java/org/apache/archiva/metadata/repository/RepositorySessionFactory.java
index 929c3c1a5..17e7c13d8 100644
--- a/archiva-modules/metadata/metadata-repository-api/src/main/java/org/apache/archiva/metadata/repository/RepositorySessionFactory.java
+++ b/archiva-modules/metadata/metadata-repository-api/src/main/java/org/apache/archiva/metadata/repository/RepositorySessionFactory.java
@@ -21,11 +21,11 @@ package org.apache.archiva.metadata.repository;
public interface RepositorySessionFactory
{
- public void open();
+ void open( );
- public boolean isOpen();
+ boolean isOpen( );
- RepositorySession createSession();
+ RepositorySession createSession() throws MetadataRepositoryException;
void close();
}
diff --git a/archiva-modules/metadata/metadata-repository-api/src/test/java/org/apache/archiva/metadata/repository/AbstractMetadataRepositoryTest.java b/archiva-modules/metadata/metadata-repository-api/src/test/java/org/apache/archiva/metadata/repository/AbstractMetadataRepositoryTest.java
index 5d033f54f..59de1babb 100644
--- a/archiva-modules/metadata/metadata-repository-api/src/test/java/org/apache/archiva/metadata/repository/AbstractMetadataRepositoryTest.java
+++ b/archiva-modules/metadata/metadata-repository-api/src/test/java/org/apache/archiva/metadata/repository/AbstractMetadataRepositoryTest.java
@@ -184,7 +184,7 @@ public abstract class AbstractMetadataRepositoryTest
public void testRootNamespaceWithNoMetadataRepository()
throws Exception
{
- Collection<String> namespaces = repository.getRootNamespaces( TEST_REPO_ID );
+ Collection<String> namespaces = repository.getRootNamespaces( , TEST_REPO_ID );
assertThat( namespaces ).isNotNull().isEmpty();
}
@@ -192,16 +192,16 @@ public abstract class AbstractMetadataRepositoryTest
public void testGetNamespaceOnly()
throws Exception
{
- assertThat( repository.getRootNamespaces( TEST_REPO_ID ) ).isNotNull().isEmpty();
+ assertThat( repository.getRootNamespaces( , TEST_REPO_ID ) ).isNotNull().isEmpty();
- repository.updateNamespace( TEST_REPO_ID, TEST_NAMESPACE );
+ repository.updateNamespace( , TEST_REPO_ID, TEST_NAMESPACE );
- assertThat( repository.getRootNamespaces( TEST_REPO_ID ) ).isNotNull().isNotEmpty().contains(
+ assertThat( repository.getRootNamespaces( , TEST_REPO_ID ) ).isNotNull().isNotEmpty().contains(
TEST_NAMESPACE ).hasSize( 1 );
- repository.removeNamespace( TEST_REPO_ID, TEST_NAMESPACE );
+ repository.removeNamespace( , TEST_REPO_ID, TEST_NAMESPACE );
- assertThat( repository.getRootNamespaces( TEST_REPO_ID ) ).isNotNull().isEmpty();
+ assertThat( repository.getRootNamespaces( , TEST_REPO_ID ) ).isNotNull().isEmpty();
}
@@ -209,22 +209,22 @@ public abstract class AbstractMetadataRepositoryTest
public void testGetProjectOnly()
throws Exception
{
- assertNull( repository.getProject( TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT ) );
- assertThat( repository.getRootNamespaces( TEST_REPO_ID ) ).isNotNull().isEmpty();
+ assertNull( repository.getProject( , TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT ) );
+ assertThat( repository.getRootNamespaces( , TEST_REPO_ID ) ).isNotNull().isEmpty();
ProjectMetadata project = new ProjectMetadata();
project.setId( TEST_PROJECT );
project.setNamespace( TEST_NAMESPACE );
- repository.updateProject( TEST_REPO_ID, project );
+ repository.updateProject( , TEST_REPO_ID, project );
- project = repository.getProject( TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT );
+ project = repository.getProject( , TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT );
assertEquals( TEST_PROJECT, project.getId() );
assertEquals( TEST_NAMESPACE, project.getNamespace() );
// test that namespace is also constructed
- Collection<String> namespaces = repository.getRootNamespaces( TEST_REPO_ID );
+ Collection<String> namespaces = repository.getRootNamespaces( , TEST_REPO_ID );
assertThat( namespaces ).isNotNull().isNotEmpty().contains( TEST_NAMESPACE ).hasSize( 1 );
}
@@ -233,24 +233,24 @@ public abstract class AbstractMetadataRepositoryTest
public void testGetProjectVersionOnly()
throws Exception
{
- assertNull( repository.getProjectVersion( TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT, TEST_PROJECT_VERSION ) );
- assertNull( repository.getProject( TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT ) );
- assertThat( repository.getRootNamespaces( TEST_REPO_ID ) ).isNotNull().isEmpty();
+ assertNull( repository.getProjectVersion( , TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT, TEST_PROJECT_VERSION ) );
+ assertNull( repository.getProject( , TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT ) );
+ assertThat( repository.getRootNamespaces( , TEST_REPO_ID ) ).isNotNull().isEmpty();
ProjectVersionMetadata metadata = new ProjectVersionMetadata();
metadata.setId( TEST_PROJECT_VERSION );
- repository.updateProjectVersion( TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT, metadata );
+ repository.updateProjectVersion( , TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT, metadata );
- metadata = repository.getProjectVersion( TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT, TEST_PROJECT_VERSION );
+ metadata = repository.getProjectVersion( , TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT, TEST_PROJECT_VERSION );
assertEquals( TEST_PROJECT_VERSION, metadata.getId() );
// test that namespace and project is also constructed
- Collection<String> namespaces = repository.getRootNamespaces( TEST_REPO_ID );
+ Collection<String> namespaces = repository.getRootNamespaces( , TEST_REPO_ID );
assertThat( namespaces ).isNotNull().isNotEmpty().hasSize( 1 ).contains( TEST_NAMESPACE );
- ProjectMetadata projectMetadata = repository.getProject( TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT );
+ ProjectMetadata projectMetadata = repository.getProject( , TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT );
assertNotNull( projectMetadata );
assertEquals( TEST_PROJECT, projectMetadata.getId() );
assertEquals( TEST_NAMESPACE, projectMetadata.getNamespace() );
@@ -261,33 +261,33 @@ public abstract class AbstractMetadataRepositoryTest
throws Exception
{
assertThat( new ArrayList<>(
- repository.getArtifacts( TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT,
- TEST_PROJECT_VERSION ) ) ).isNotNull().isEmpty();
+ repository.getArtifacts( , TEST_REPO_ID, TEST_NAMESPACE,
+ TEST_PROJECT, TEST_PROJECT_VERSION ) ) ).isNotNull().isEmpty();
assertThat(
- repository.getProjectVersion( TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT, TEST_PROJECT_VERSION ) ).isNull();
- assertThat( repository.getProject( TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT ) ).isNull();
+ repository.getProjectVersion( , TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT, TEST_PROJECT_VERSION ) ).isNull();
+ assertThat( repository.getProject( , TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT ) ).isNull();
- assertThat( repository.getRootNamespaces( TEST_REPO_ID ) ).isNotNull().isEmpty();
+ assertThat( repository.getRootNamespaces( , TEST_REPO_ID ) ).isNotNull().isEmpty();
ArtifactMetadata metadata = createArtifact();
- repository.updateArtifact( TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT, TEST_PROJECT_VERSION, metadata );
+ repository.updateArtifact( , TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT, TEST_PROJECT_VERSION, metadata );
Collection<ArtifactMetadata> artifacts =
- repository.getArtifacts( TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT, TEST_PROJECT_VERSION );
+ repository.getArtifacts( , TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT, TEST_PROJECT_VERSION );
//assertEquals( Collections.singletonList( metadata ), new ArrayList<ArtifactMetadata>( artifacts ) );
assertThat( artifacts ).containsExactly( metadata );
// test that namespace, project and project version is also constructed
- assertThat( repository.getRootNamespaces( TEST_REPO_ID ) ).isNotNull().isNotEmpty().contains(
+ assertThat( repository.getRootNamespaces( , TEST_REPO_ID ) ).isNotNull().isNotEmpty().contains(
TEST_NAMESPACE ).hasSize( 1 );
- ProjectMetadata projectMetadata = repository.getProject( TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT );
+ ProjectMetadata projectMetadata = repository.getProject( , TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT );
assertEquals( TEST_PROJECT, projectMetadata.getId() );
assertEquals( TEST_NAMESPACE, projectMetadata.getNamespace() );
ProjectVersionMetadata projectVersionMetadata =
- repository.getProjectVersion( TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT, TEST_PROJECT_VERSION );
+ repository.getProjectVersion( , TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT, TEST_PROJECT_VERSION );
assertEquals( TEST_PROJECT_VERSION, projectVersionMetadata.getId() );
}
@@ -301,9 +301,9 @@ public abstract class AbstractMetadataRepositoryTest
mailingList.setName( "Foo List" );
mailingList.setOtherArchives( Collections.<String>emptyList() );
metadata.setMailingLists( Arrays.asList( mailingList ) );
- repository.updateProjectVersion( TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT, metadata );
+ repository.updateProjectVersion( , TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT, metadata );
- metadata = repository.getProjectVersion( TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT, TEST_PROJECT_VERSION );
+ metadata = repository.getProjectVersion( , TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT, TEST_PROJECT_VERSION );
assertEquals( TEST_PROJECT_VERSION, metadata.getId() );
List<MailingList> mailingLists = metadata.getMailingLists();
@@ -371,9 +371,9 @@ public abstract class AbstractMetadataRepositoryTest
d.setOptional( true );
metadata.addDependency( d );
- repository.updateProjectVersion( TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT, metadata );
+ repository.updateProjectVersion( , TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT, metadata );
- metadata = repository.getProjectVersion( TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT, TEST_PROJECT_VERSION );
+ metadata = repository.getProjectVersion( , TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT, TEST_PROJECT_VERSION );
assertEquals( TEST_PROJECT_VERSION, metadata.getId() );
assertEquals( TEST_PROJECT_VERSION, metadata.getVersion() );
assertEquals( "project name", metadata.getName() );
@@ -429,8 +429,8 @@ public abstract class AbstractMetadataRepositoryTest
{
// currently set up this way so the behaviour of both the test and the mock config return the same repository
// set as the File implementation just uses the config rather than the content
- repository.updateNamespace( TEST_REPO_ID, "namespace" );
- repository.updateNamespace( OTHER_REPO_ID, "namespace" );
+ repository.updateNamespace( , TEST_REPO_ID, "namespace" );
+ repository.updateNamespace( , OTHER_REPO_ID, "namespace" );
Collection<String> repositories = repository.getRepositories();
@@ -446,9 +446,9 @@ public abstract class AbstractMetadataRepositoryTest
ProjectVersionMetadata metadata = new ProjectVersionMetadata();
metadata.setId( TEST_PROJECT_VERSION );
metadata.setIncomplete( true );
- repository.updateProjectVersion( TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT, metadata );
+ repository.updateProjectVersion( , TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT, metadata );
- metadata = repository.getProjectVersion( TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT, TEST_PROJECT_VERSION );
+ metadata = repository.getProjectVersion( , TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT, TEST_PROJECT_VERSION );
assertEquals( true, metadata.isIncomplete() );
assertNull( metadata.getCiManagement() );
assertNull( metadata.getScm() );
@@ -471,16 +471,16 @@ public abstract class AbstractMetadataRepositoryTest
metadata.setId( TEST_PROJECT_VERSION );
MetadataFacet facet = new TestMetadataFacet( "baz" );
metadata.addFacet( facet );
- repository.updateProjectVersion( TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT, metadata );
+ repository.updateProjectVersion( , TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT, metadata );
- metadata = repository.getProjectVersion( TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT, TEST_PROJECT_VERSION );
+ metadata = repository.getProjectVersion( , TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT, TEST_PROJECT_VERSION );
assertEquals( Collections.singleton( TEST_FACET_ID ), metadata.getFacetIds() );
metadata = new ProjectVersionMetadata();
metadata.setId( TEST_PROJECT_VERSION );
- repository.updateProjectVersion( TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT, metadata );
+ repository.updateProjectVersion( , TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT, metadata );
- metadata = repository.getProjectVersion( TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT, TEST_PROJECT_VERSION );
+ metadata = repository.getProjectVersion( , TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT, TEST_PROJECT_VERSION );
assertEquals( Collections.singleton( TEST_FACET_ID ), metadata.getFacetIds() );
TestMetadataFacet testFacet = (TestMetadataFacet) metadata.getFacet( TEST_FACET_ID );
assertEquals( "baz", testFacet.getValue() );
@@ -492,17 +492,17 @@ public abstract class AbstractMetadataRepositoryTest
{
ProjectVersionMetadata metadata = new ProjectVersionMetadata();
metadata.setId( TEST_PROJECT_VERSION );
- repository.updateProjectVersion( TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT, metadata );
+ repository.updateProjectVersion( , TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT, metadata );
- metadata = repository.getProjectVersion( TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT, TEST_PROJECT_VERSION );
+ metadata = repository.getProjectVersion( , TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT, TEST_PROJECT_VERSION );
assertThat( metadata.getFacetIds() ).isNotNull().isEmpty();
metadata = new ProjectVersionMetadata();
metadata.setId( TEST_PROJECT_VERSION );
- repository.updateProjectVersion( TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT, metadata );
+ repository.updateProjectVersion( , TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT, metadata );
- metadata = repository.getProjectVersion( TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT, TEST_PROJECT_VERSION );
+ metadata = repository.getProjectVersion( , TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT, TEST_PROJECT_VERSION );
assertThat( metadata.getFacetIds() ).isNotNull().isEmpty();
}
@@ -519,9 +519,9 @@ public abstract class AbstractMetadataRepositoryTest
MetadataFacet facet = new TestMetadataFacet( TEST_FACET_ID, "baz", additionalProps );
metadata.addFacet( facet );
- repository.updateProjectVersion( TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT, metadata );
+ repository.updateProjectVersion( , TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT, metadata );
- metadata = repository.getProjectVersion( TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT, TEST_PROJECT_VERSION );
+ metadata = repository.getProjectVersion( , TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT, TEST_PROJECT_VERSION );
assertThat( metadata.getFacetIds() ).isNotNull().isNotEmpty().hasSize( 1 ).contains( TEST_FACET_ID );
@@ -535,9 +535,9 @@ public abstract class AbstractMetadataRepositoryTest
TestMetadataFacet newTestFacet = new TestMetadataFacet( TEST_FACET_ID, testFacet.getValue(), facetProperties );
metadata.addFacet( newTestFacet );
- repository.updateProjectVersion( TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT, metadata );
+ repository.updateProjectVersion( , TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT, metadata );
- metadata = repository.getProjectVersion( TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT, TEST_PROJECT_VERSION );
+ metadata = repository.getProjectVersion( , TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT, TEST_PROJECT_VERSION );
assertThat( metadata.getFacetIds() ).isNotNull().isNotEmpty().hasSize( 1 ).contains( TEST_FACET_ID );
testFacet = (TestMetadataFacet) metadata.getFacet( TEST_FACET_ID );
@@ -553,26 +553,26 @@ public abstract class AbstractMetadataRepositoryTest
MetadataFacet facet = new TestMetadataFacet( TEST_FACET_ID, "baz" );
versionMetadata.addFacet( facet );
- repository.updateProjectVersion( TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT, versionMetadata );
+ repository.updateProjectVersion( , TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT, versionMetadata );
ArtifactMetadata artifactMetadata = createArtifact();
- repository.updateArtifact( TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT, TEST_PROJECT_VERSION, artifactMetadata );
+ repository.updateArtifact( , TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT, TEST_PROJECT_VERSION, artifactMetadata );
repository.save();
Collection<ArtifactMetadata> artifacts =
- repository.getArtifacts( TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT, TEST_PROJECT_VERSION );
+ repository.getArtifacts( , TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT, TEST_PROJECT_VERSION );
assertEquals( Collections.singletonList( artifactMetadata ), new ArrayList<>( artifacts ) );
- artifacts = repository.getArtifacts( TEST_REPO_ID );
+ artifacts = repository.getArtifacts( , TEST_REPO_ID );
assertEquals( Collections.singletonList( artifactMetadata ), new ArrayList<>( artifacts ) );
- artifacts = repository.getArtifactsByChecksum( TEST_REPO_ID, TEST_SHA1 );
+ artifacts = repository.getArtifactsByChecksum( , TEST_REPO_ID, TEST_SHA1 );
assertEquals( Collections.singletonList( artifactMetadata ), new ArrayList<>( artifacts ) );
- artifacts = repository.getArtifactsByChecksum( TEST_REPO_ID, TEST_MD5 );
+ artifacts = repository.getArtifactsByChecksum( , TEST_REPO_ID, TEST_MD5 );
assertEquals( Collections.singletonList( artifactMetadata ), new ArrayList<>( artifacts ) );
- artifacts = repository.getArtifactsByDateRange( TEST_REPO_ID, null, null );
+ artifacts = repository.getArtifactsByDateRange( , TEST_REPO_ID, null, null );
assertEquals( Collections.singletonList( artifactMetadata ), new ArrayList<>( artifacts ) );
}
@@ -587,10 +587,10 @@ public abstract class AbstractMetadataRepositoryTest
MetadataFacet facet = new TestMetadataFacet( TEST_FACET_ID, "baz", additionalProps );
metadata.addFacet( facet );
- repository.updateArtifact( TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT, TEST_PROJECT_VERSION, metadata );
+ repository.updateArtifact( , TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT, TEST_PROJECT_VERSION, metadata );
Collection<ArtifactMetadata> artifacts =
- repository.getArtifacts( TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT, TEST_PROJECT_VERSION );
+ repository.getArtifacts( , TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT, TEST_PROJECT_VERSION );
assertThat( artifacts ).isNotNull().isNotEmpty().hasSize( 1 );
metadata = artifacts.iterator().next();
@@ -608,9 +608,9 @@ public abstract class AbstractMetadataRepositoryTest
TestMetadataFacet newTestFacet = new TestMetadataFacet( TEST_FACET_ID, testFacet.getValue(), facetProperties );
metadata.addFacet( newTestFacet );
- repository.updateArtifact( TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT, TEST_PROJECT_VERSION, metadata );
+ repository.updateArtifact( , TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT, TEST_PROJECT_VERSION, metadata );
- artifacts = repository.getArtifacts( TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT, TEST_PROJECT_VERSION );
+ artifacts = repository.getArtifacts( , TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT, TEST_PROJECT_VERSION );
assertThat( artifacts ).isNotNull().isNotEmpty().hasSize( 1 );
metadata = artifacts.iterator().next();
@@ -631,17 +631,17 @@ public abstract class AbstractMetadataRepositoryTest
ArtifactMetadata metadata = createArtifact();
MetadataFacet facet = new TestMetadataFacet( "baz" );
metadata.addFacet( facet );
- repository.updateArtifact( TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT, TEST_PROJECT_VERSION, metadata );
+ repository.updateArtifact( , TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT, TEST_PROJECT_VERSION, metadata );
- metadata = repository.getArtifacts( TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT,
- TEST_PROJECT_VERSION ).iterator().next();
+ metadata = repository.getArtifacts( , TEST_REPO_ID, TEST_NAMESPACE,
+ TEST_PROJECT, TEST_PROJECT_VERSION ).iterator().next();
assertEquals( Collections.singleton( TEST_FACET_ID ), metadata.getFacetIds() );
metadata = createArtifact();
- repository.updateArtifact( TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT, TEST_PROJECT_VERSION, metadata );
+ repository.updateArtifact( , TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT, TEST_PROJECT_VERSION, metadata );
- metadata = repository.getArtifacts( TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT,
- TEST_PROJECT_VERSION ).iterator().next();
+ metadata = repository.getArtifacts( , TEST_REPO_ID, TEST_NAMESPACE,
+ TEST_PROJECT, TEST_PROJECT_VERSION ).iterator().next();
assertEquals( Collections.singleton( TEST_FACET_ID ), metadata.getFacetIds() );
TestMetadataFacet testFacet = (TestMetadataFacet) metadata.getFacet( TEST_FACET_ID );
assertEquals( "baz", testFacet.getValue() );
@@ -652,17 +652,17 @@ public abstract class AbstractMetadataRepositoryTest
throws Exception
{
ArtifactMetadata metadata = createArtifact();
- repository.updateArtifact( TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT, TEST_PROJECT_VERSION, metadata );
+ repository.updateArtifact( , TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT, TEST_PROJECT_VERSION, metadata );
- metadata = repository.getArtifacts( TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT,
- TEST_PROJECT_VERSION ).iterator().next();
+ metadata = repository.getArtifacts( , TEST_REPO_ID, TEST_NAMESPACE,
+ TEST_PROJECT, TEST_PROJECT_VERSION ).iterator().next();
assertEquals( Collections.<String>emptyList(), new ArrayList<String>( metadata.getFacetIds() ) );
metadata = createArtifact();
- repository.updateArtifact( TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT, TEST_PROJECT_VERSION, metadata );
+ repository.updateArtifact( , TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT, TEST_PROJECT_VERSION, metadata );
- metadata = repository.getArtifacts( TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT,
- TEST_PROJECT_VERSION ).iterator().next();
+ metadata = repository.getArtifacts( , TEST_REPO_ID, TEST_NAMESPACE,
+ TEST_PROJECT, TEST_PROJECT_VERSION ).iterator().next();
assertEquals( Collections.<String>emptyList(), new ArrayList<String>( metadata.getFacetIds() ) );
}
@@ -670,10 +670,10 @@ public abstract class AbstractMetadataRepositoryTest
public void testGetMetadataFacet()
throws Exception
{
- repository.addMetadataFacet( TEST_REPO_ID, new TestMetadataFacet( TEST_VALUE ) );
+ repository.addMetadataFacet( , TEST_REPO_ID, new TestMetadataFacet( TEST_VALUE ) );
TestMetadataFacet test =
- (TestMetadataFacet) repository.getMetadataFacet( TEST_REPO_ID, TEST_FACET_ID, TEST_NAME );
+ (TestMetadataFacet) repository.getMetadataFacet( , TEST_REPO_ID, TEST_FACET_ID, TEST_NAME );
assertEquals( new TestMetadataFacet( TEST_VALUE ), test );
}
@@ -682,25 +682,25 @@ public abstract class AbstractMetadataRepositoryTest
public void testGetMetadataFacetWhenEmpty()
throws Exception
{
- assertNull( repository.getMetadataFacet( TEST_REPO_ID, TEST_FACET_ID, TEST_NAME ) );
+ assertNull( repository.getMetadataFacet( , TEST_REPO_ID, TEST_FACET_ID, TEST_NAME ) );
}
@Test
public void testGetMetadataFacetWhenUnknownName()
throws Exception
{
- repository.addMetadataFacet( TEST_REPO_ID, new TestMetadataFacet( TEST_VALUE ) );
+ repository.addMetadataFacet( , TEST_REPO_ID, new TestMetadataFacet( TEST_VALUE ) );
- assertNull( repository.getMetadataFacet( TEST_REPO_ID, TEST_FACET_ID, UNKNOWN ) );
+ assertNull( repository.getMetadataFacet( , TEST_REPO_ID, TEST_FACET_ID, UNKNOWN ) );
}
@Test
public void testGetMetadataFacetWhenDefaultValue()
throws Exception
{
- repository.addMetadataFacet( TEST_REPO_ID, new TestMetadataFacet( null ) );
+ repository.addMetadataFacet( , TEST_REPO_ID, new TestMetadataFacet( null ) );
- MetadataFacet metadataFacet = repository.getMetadataFacet( TEST_REPO_ID, TEST_FACET_ID, TEST_NAME );
+ MetadataFacet metadataFacet = repository.getMetadataFacet( , TEST_REPO_ID, TEST_FACET_ID, TEST_NAME );
assertEquals( new TestMetadataFacet( TEST_METADATA_VALUE ), metadataFacet );
}
@@ -709,17 +709,17 @@ public abstract class AbstractMetadataRepositoryTest
public void testGetMetadataFacetWhenUnknownFacetId()
throws Exception
{
- assertNull( repository.getMetadataFacet( TEST_REPO_ID, UNKNOWN, TEST_NAME ) );
+ assertNull( repository.getMetadataFacet( , TEST_REPO_ID, UNKNOWN, TEST_NAME ) );
}
@Test
public void testGetMetadataFacets()
throws Exception
{
- repository.addMetadataFacet( TEST_REPO_ID, new TestMetadataFacet( TEST_VALUE ) );
+ repository.addMetadataFacet( , TEST_REPO_ID, new TestMetadataFacet( TEST_VALUE ) );
assertEquals( Collections.singletonList( TEST_NAME ),
- repository.getMetadataFacets( TEST_REPO_ID, TEST_FACET_ID ) );
+ repository.getMetadataFacets( , TEST_REPO_ID, TEST_FACET_ID ) );
}
@Test
@@ -727,7 +727,7 @@ public abstract class AbstractMetadataRepositoryTest
throws Exception
{
- List<String> facets = repository.getMetadataFacets( TEST_REPO_ID, TEST_FACET_ID );
+ List<String> facets = repository.getMetadataFacets( , TEST_REPO_ID, TEST_FACET_ID );
assertTrue( facets.isEmpty() );
}
@@ -735,14 +735,14 @@ public abstract class AbstractMetadataRepositoryTest
public void testRemoveFacets()
throws Exception
{
- repository.addMetadataFacet( TEST_REPO_ID, new TestMetadataFacet( TEST_VALUE ) );
+ repository.addMetadataFacet( , TEST_REPO_ID, new TestMetadataFacet( TEST_VALUE ) );
- List<String> facets = repository.getMetadataFacets( TEST_REPO_ID, TEST_FACET_ID );
+ List<String> facets = repository.getMetadataFacets( , TEST_REPO_ID, TEST_FACET_ID );
assertFalse( facets.isEmpty() );
- repository.removeMetadataFacets( TEST_REPO_ID, TEST_FACET_ID );
+ repository.removeMetadataFacets( , TEST_REPO_ID, TEST_FACET_ID );
- facets = repository.getMetadataFacets( TEST_REPO_ID, TEST_FACET_ID );
+ facets = repository.getMetadataFacets( , TEST_REPO_ID, TEST_FACET_ID );
assertTrue( facets.isEmpty() );
}
@@ -750,12 +750,12 @@ public abstract class AbstractMetadataRepositoryTest
public void testRemoveFacetsWhenEmpty()
throws Exception
{
- List<String> facets = repository.getMetadataFacets( TEST_REPO_ID, TEST_FACET_ID );
+ List<String> facets = repository.getMetadataFacets( , TEST_REPO_ID, TEST_FACET_ID );
assertTrue( facets.isEmpty() );
- repository.removeMetadataFacets( TEST_REPO_ID, TEST_FACET_ID );
+ repository.removeMetadataFacets( , TEST_REPO_ID, TEST_FACET_ID );
- facets = repository.getMetadataFacets( TEST_REPO_ID, TEST_FACET_ID );
+ facets = repository.getMetadataFacets( , TEST_REPO_ID, TEST_FACET_ID );
assertTrue( facets.isEmpty() );
}
@@ -764,7 +764,7 @@ public abstract class AbstractMetadataRepositoryTest
throws Exception
{
// testing no exception
- repository.removeMetadataFacets( TEST_REPO_ID, UNKNOWN );
+ repository.removeMetadataFacets( , TEST_REPO_ID, UNKNOWN );
}
@Test
@@ -772,7 +772,7 @@ public abstract class AbstractMetadataRepositoryTest
throws Exception
{
// testing no exception
- repository.removeMetadataFacet( TEST_REPO_ID, UNKNOWN, TEST_NAME );
+ repository.removeMetadataFacet( , TEST_REPO_ID, UNKNOWN, TEST_NAME );
}
@Test
@@ -780,16 +780,16 @@ public abstract class AbstractMetadataRepositoryTest
throws Exception
{
TestMetadataFacet metadataFacet = new TestMetadataFacet( TEST_VALUE );
- repository.addMetadataFacet( TEST_REPO_ID, metadataFacet );
+ repository.addMetadataFacet( , TEST_REPO_ID, metadataFacet );
- assertEquals( metadataFacet, repository.getMetadataFacet( TEST_REPO_ID, TEST_FACET_ID, TEST_NAME ) );
- List<String> facets = repository.getMetadataFacets( TEST_REPO_ID, TEST_FACET_ID );
+ assertEquals( metadataFacet, repository.getMetadataFacet( , TEST_REPO_ID, TEST_FACET_ID, TEST_NAME ) );
+ List<String> facets = repository.getMetadataFacets( , TEST_REPO_ID, TEST_FACET_ID );
assertFalse( facets.isEmpty() );
- repository.removeMetadataFacet( TEST_REPO_ID, TEST_FACET_ID, TEST_NAME );
+ repository.removeMetadataFacet( , TEST_REPO_ID, TEST_FACET_ID, TEST_NAME );
- assertNull( repository.getMetadataFacet( TEST_REPO_ID, TEST_FACET_ID, TEST_NAME ) );
- facets = repository.getMetadataFacets( TEST_REPO_ID, TEST_FACET_ID );
+ assertNull( repository.getMetadataFacet( , TEST_REPO_ID, TEST_FACET_ID, TEST_NAME ) );
+ facets = repository.getMetadataFacets( , TEST_REPO_ID, TEST_FACET_ID );
assertTrue( facets.isEmpty() );
}
@@ -797,22 +797,22 @@ public abstract class AbstractMetadataRepositoryTest
public void testRemoveFacetWhenEmpty()
throws Exception
{
- List<String> facets = repository.getMetadataFacets( TEST_REPO_ID, TEST_FACET_ID );
+ List<String> facets = repository.getMetadataFacets( , TEST_REPO_ID, TEST_FACET_ID );
assertThat( facets ).isNotNull().isEmpty();
- assertThat( repository.getMetadataFacet( TEST_REPO_ID, TEST_FACET_ID, TEST_NAME ) ).isNull();
+ assertThat( repository.getMetadataFacet( , TEST_REPO_ID, TEST_FACET_ID, TEST_NAME ) ).isNull();
- repository.removeMetadataFacet( TEST_REPO_ID, TEST_FACET_ID, TEST_NAME );
+ repository.removeMetadataFacet( , TEST_REPO_ID, TEST_FACET_ID, TEST_NAME );
- facets = repository.getMetadataFacets( TEST_REPO_ID, TEST_FACET_ID );
+ facets = repository.getMetadataFacets( , TEST_REPO_ID, TEST_FACET_ID );
assertThat( facets ).isNotNull().isEmpty();
- assertThat( repository.getMetadataFacet( TEST_REPO_ID, TEST_FACET_ID, TEST_NAME ) ).isNull();
+ assertThat( repository.getMetadataFacet( , TEST_REPO_ID, TEST_FACET_ID, TEST_NAME ) ).isNull();
}
@Test
public void hasMetadataFacetStart()
throws Exception
{
- assertFalse( repository.hasMetadataFacet( TEST_REPO_ID, KindOfRepositoryStatistics.class.getName() ) );
+ assertFalse( repository.hasMetadataFacet( , TEST_REPO_ID, KindOfRepositoryStatistics.class.getName() ) );
}
@@ -821,33 +821,33 @@ public abstract class AbstractMetadataRepositoryTest
throws Exception
{
- assertFalse( repository.hasMetadataFacet( TEST_REPO_ID, KindOfRepositoryStatistics.class.getName() ) );
+ assertFalse( repository.hasMetadataFacet( , TEST_REPO_ID, KindOfRepositoryStatistics.class.getName() ) );
Calendar cal = Calendar.getInstance();
- repository.addMetadataFacet( TEST_REPO_ID, new KindOfRepositoryStatistics( "first", cal.getTime() ) );
+ repository.addMetadataFacet( , TEST_REPO_ID, new KindOfRepositoryStatistics( "first", cal.getTime() ) );
- assertTrue( repository.hasMetadataFacet( TEST_REPO_ID, KindOfRepositoryStatistics.class.getName() ) );
+ assertTrue( repository.hasMetadataFacet( , TEST_REPO_ID, KindOfRepositoryStatistics.class.getName() ) );
cal.add( Calendar.MINUTE, 2 );
- repository.addMetadataFacet( TEST_REPO_ID, new KindOfRepositoryStatistics( "second", cal.getTime() ) );
+ repository.addMetadataFacet( , TEST_REPO_ID, new KindOfRepositoryStatistics( "second", cal.getTime() ) );
cal.add( Calendar.MINUTE, 2 );
- repository.addMetadataFacet( TEST_REPO_ID, new KindOfRepositoryStatistics( "third", cal.getTime() ) );
+ repository.addMetadataFacet( , TEST_REPO_ID, new KindOfRepositoryStatistics( "third", cal.getTime() ) );
- List<String> facets = repository.getMetadataFacets( TEST_REPO_ID, KindOfRepositoryStatistics.class.getName() );
+ List<String> facets = repository.getMetadataFacets( , TEST_REPO_ID, KindOfRepositoryStatistics.class.getName() );
assertThat( facets ).isNotNull().isNotEmpty().hasSize( 3 );
- assertTrue( repository.hasMetadataFacet( TEST_REPO_ID, KindOfRepositoryStatistics.class.getName() ) );
+ assertTrue( repository.hasMetadataFacet( , TEST_REPO_ID, KindOfRepositoryStatistics.class.getName() ) );
- repository.removeMetadataFacets( TEST_REPO_ID, KindOfRepositoryStatistics.class.getName() );
+ repository.removeMetadataFacets( , TEST_REPO_ID, KindOfRepositoryStatistics.class.getName() );
- assertFalse( repository.hasMetadataFacet( TEST_REPO_ID, KindOfRepositoryStatistics.class.getName() ) );
+ assertFalse( repository.hasMetadataFacet( , TEST_REPO_ID, KindOfRepositoryStatistics.class.getName() ) );
- facets = repository.getMetadataFacets( TEST_REPO_ID, KindOfRepositoryStatistics.class.getName() );
+ facets = repository.getMetadataFacets( , TEST_REPO_ID, KindOfRepositoryStatistics.class.getName() );
assertThat( facets ).isNotNull().isEmpty();
@@ -860,11 +860,11 @@ public abstract class AbstractMetadataRepositoryTest
{
ArtifactMetadata artifact1 = createArtifact();
ArtifactMetadata artifact2 = createArtifact( "pom" );
- repository.updateArtifact( TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT, TEST_PROJECT_VERSION, artifact1 );
- repository.updateArtifact( TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT, TEST_PROJECT_VERSION, artifact2 );
+ repository.updateArtifact( , TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT, TEST_PROJECT_VERSION, artifact1 );
+ repository.updateArtifact( , TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT, TEST_PROJECT_VERSION, artifact2 );
Collection<ArtifactMetadata> artifacts =
- repository.getArtifacts( TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT, TEST_PROJECT_VERSION );
+ repository.getArtifacts( , TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT, TEST_PROJECT_VERSION );
ArrayList<ArtifactMetadata> actual = new ArrayList<>( artifacts );
Collections.sort( actual,( o1, o2 ) -> o1.getId().compareTo( o2.getId() ) );
assertEquals( Arrays.asList( artifact1, artifact2 ), actual );
@@ -882,11 +882,11 @@ public abstract class AbstractMetadataRepositoryTest
String version2 = "1.0-20091212.123456-2";
artifact2.setId( artifact2.getProject() + "-" + version2 + ".jar" );
artifact2.setVersion( version2 );
- repository.updateArtifact( TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT, TEST_PROJECT_VERSION, artifact1 );
- repository.updateArtifact( TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT, TEST_PROJECT_VERSION, artifact2 );
+ repository.updateArtifact( , TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT, TEST_PROJECT_VERSION, artifact1 );
+ repository.updateArtifact( , TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT, TEST_PROJECT_VERSION, artifact2 );
Collection<String> versions =
- repository.getArtifactVersions( TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT, TEST_PROJECT_VERSION );
+ repository.getArtifactVersions( , TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT, TEST_PROJECT_VERSION );
assertThat( versions ).isNotNull().isNotEmpty().contains( version1, version2 );
}
@@ -899,11 +899,11 @@ public abstract class AbstractMetadataRepositoryTest
artifact1.setId( TEST_PROJECT + "-" + TEST_PROJECT_VERSION + ".jar" );
ArtifactMetadata artifact2 = createArtifact();
artifact2.setId( TEST_PROJECT + "-" + TEST_PROJECT_VERSION + "-sources.jar" );
- repository.updateArtifact( TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT, TEST_PROJECT_VERSION, artifact1 );
- repository.updateArtifact( TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT, TEST_PROJECT_VERSION, artifact2 );
+ repository.updateArtifact( , TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT, TEST_PROJECT_VERSION, artifact1 );
+ repository.updateArtifact( , TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT, TEST_PROJECT_VERSION, artifact2 );
Collection<String> versions =
- repository.getArtifactVersions( TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT, TEST_PROJECT_VERSION );
+ repository.getArtifactVersions( , TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT, TEST_PROJECT_VERSION );
assertThat( versions ).isNotNull().isNotEmpty().hasSize( 1 ).containsExactly( TEST_PROJECT_VERSION );
@@ -914,10 +914,10 @@ public abstract class AbstractMetadataRepositoryTest
throws Exception
{
ArtifactMetadata artifact = createArtifact();
- repository.updateArtifact( TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT, TEST_PROJECT_VERSION, artifact );
+ repository.updateArtifact( , TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT, TEST_PROJECT_VERSION, artifact );
repository.save();
- List<ArtifactMetadata> artifacts = repository.getArtifactsByDateRange( TEST_REPO_ID, null, null );
+ List<ArtifactMetadata> artifacts = repository.getArtifactsByDateRange( , TEST_REPO_ID, null, null );
assertEquals( Collections.singletonList( artifact ), artifacts );
}
@@ -929,10 +929,10 @@ public abstract class AbstractMetadataRepositoryTest
String namespace = "org.apache.archiva";
ArtifactMetadata artifact = createArtifact();
artifact.setNamespace( namespace );
- repository.updateArtifact( TEST_REPO_ID, namespace, TEST_PROJECT, TEST_PROJECT_VERSION, artifact );
+ repository.updateArtifact( , TEST_REPO_ID, namespace, TEST_PROJECT, TEST_PROJECT_VERSION, artifact );
repository.save();
- List<ArtifactMetadata> artifacts = repository.getArtifactsByDateRange( TEST_REPO_ID, null, null );
+ List<ArtifactMetadata> artifacts = repository.getArtifactsByDateRange( , TEST_REPO_ID, null, null );
tryAssert(()->assertEquals( Collections.singletonList( artifact ), artifacts ));
}
@@ -942,12 +942,12 @@ public abstract class AbstractMetadataRepositoryTest
throws Exception
{
ArtifactMetadata artifact = createArtifact();
- repository.updateArtifact( TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT, TEST_PROJECT_VERSION, artifact );
+ repository.updateArtifact( , TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT, TEST_PROJECT_VERSION, artifact );
repository.save();
Date date = new Date( artifact.getWhenGathered().getTime() - 10000 );
- List<ArtifactMetadata> artifacts = repository.getArtifactsByDateRange( TEST_REPO_ID, date, null );
+ List<ArtifactMetadata> artifacts = repository.getArtifactsByDateRange( , TEST_REPO_ID, date, null );
assertEquals( Collections.singletonList( artifact ), artifacts );
}
@@ -957,11 +957,11 @@ public abstract class AbstractMetadataRepositoryTest
throws Exception
{
ArtifactMetadata artifact = createArtifact();
- repository.updateArtifact( TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT, TEST_PROJECT_VERSION, artifact );
+ repository.updateArtifact( , TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT, TEST_PROJECT_VERSION, artifact );
Date date = new Date( artifact.getWhenGathered().getTime() + 10000 );
- List<ArtifactMetadata> artifacts = repository.getArtifactsByDateRange( TEST_REPO_ID, date, null );
+ List<ArtifactMetadata> artifacts = repository.getArtifactsByDateRange( , TEST_REPO_ID, date, null );
assertThat( artifacts ).isNotNull().isEmpty();
}
@@ -971,13 +971,13 @@ public abstract class AbstractMetadataRepositoryTest
throws Exception
{
ArtifactMetadata artifact = createArtifact();
- repository.updateArtifact( TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT, TEST_PROJECT_VERSION, artifact );
+ repository.updateArtifact( , TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT, TEST_PROJECT_VERSION, artifact );
repository.save();
Date lower = new Date( artifact.getWhenGathered().getTime() - 10000 );
Date upper = new Date( artifact.getWhenGathered().getTime() + 10000 );
- List<ArtifactMetadata> artifacts = repository.getArtifactsByDateRange( TEST_REPO_ID, lower, upper );
+ List<ArtifactMetadata> artifacts = repository.getArtifactsByDateRange( , TEST_REPO_ID, lower, upper );
assertEquals( Collections.singletonList( artifact ), artifacts );
}
@@ -987,12 +987,12 @@ public abstract class AbstractMetadataRepositoryTest
throws Exception
{
ArtifactMetadata artifact = createArtifact();
- repository.updateArtifact( TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT, TEST_PROJECT_VERSION, artifact );
+ repository.updateArtifact( , TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT, TEST_PROJECT_VERSION, artifact );
repository.save();
Date upper = new Date( artifact.getWhenGathered().getTime() + 10000 );
- List<ArtifactMetadata> artifacts = repository.getArtifactsByDateRange( TEST_REPO_ID, null, upper );
+ List<ArtifactMetadata> artifacts = repository.getArtifactsByDateRange( , TEST_REPO_ID, null, upper );
assertEquals( Collections.singletonList( artifact ), artifacts );
}
@@ -1002,12 +1002,12 @@ public abstract class AbstractMetadataRepositoryTest
throws Exception
{
ArtifactMetadata artifact = createArtifact();
- repository.updateArtifact( TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT, TEST_PROJECT_VERSION, artifact );
+ repository.updateArtifact( , TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT, TEST_PROJECT_VERSION, artifact );
repository.save();
Date upper = new Date( artifact.getWhenGathered().getTime() - 10000 );
- List<ArtifactMetadata> artifacts = repository.getArtifactsByDateRange( TEST_REPO_ID, null, upper );
+ List<ArtifactMetadata> artifacts = repository.getArtifactsByDateRange( , TEST_REPO_ID, null, upper );
assertThat( artifacts ).isNotNull().isEmpty();
}
@@ -1017,11 +1017,11 @@ public abstract class AbstractMetadataRepositoryTest
throws Exception
{
ArtifactMetadata artifact = createArtifact();
- repository.updateArtifact( TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT, TEST_PROJECT_VERSION, artifact );
+ repository.updateArtifact( , TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT, TEST_PROJECT_VERSION, artifact );
repository.save();
tryAssert(()-> {
- List<ArtifactMetadata> artifacts = repository.getArtifacts(TEST_REPO_ID);
+ List<ArtifactMetadata> artifacts = repository.getArtifacts( , TEST_REPO_ID );
assertEquals(Collections.singletonList(artifact), artifacts);
});
}
@@ -1031,16 +1031,16 @@ public abstract class AbstractMetadataRepositoryTest
throws Exception
{
ArtifactMetadata artifact = createArtifact();
- repository.updateArtifact( TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT, TEST_PROJECT_VERSION, artifact );
+ repository.updateArtifact( , TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT, TEST_PROJECT_VERSION, artifact );
ArtifactMetadata secondArtifact = createArtifact();
secondArtifact.setRepositoryId( OTHER_REPO_ID );
- repository.updateArtifact( OTHER_REPO_ID, TEST_NAMESPACE, TEST_PROJECT, TEST_PROJECT_VERSION, secondArtifact );
+ repository.updateArtifact( , OTHER_REPO_ID, TEST_NAMESPACE, TEST_PROJECT, TEST_PROJECT_VERSION, secondArtifact );
repository.save();
// test it restricts to the appropriate repository
- tryAssert(() -> assertEquals( Collections.singletonList( artifact ), repository.getArtifacts( TEST_REPO_ID ) ));
- tryAssert(() -> assertEquals( Collections.singletonList( secondArtifact ), repository.getArtifacts( OTHER_REPO_ID ) ));
+ tryAssert(() -> assertEquals( Collections.singletonList( artifact ), repository.getArtifacts( , TEST_REPO_ID ) ));
+ tryAssert(() -> assertEquals( Collections.singletonList( secondArtifact ), repository.getArtifacts( , OTHER_REPO_ID ) ));
}
@@ -1049,18 +1049,18 @@ public abstract class AbstractMetadataRepositoryTest
throws Exception
{
ArtifactMetadata artifact = createArtifact();
- repository.updateArtifact( TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT, TEST_PROJECT_VERSION, artifact );
+ repository.updateArtifact( , TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT, TEST_PROJECT_VERSION, artifact );
ArtifactMetadata secondArtifact = createArtifact();
secondArtifact.setRepositoryId( OTHER_REPO_ID );
- repository.updateArtifact( OTHER_REPO_ID, TEST_NAMESPACE, TEST_PROJECT, TEST_PROJECT_VERSION, secondArtifact );
+ repository.updateArtifact( , OTHER_REPO_ID, TEST_NAMESPACE, TEST_PROJECT, TEST_PROJECT_VERSION, secondArtifact );
repository.save();
// test it restricts to the appropriate repository
assertEquals( Collections.singletonList( artifact ),
- repository.getArtifactsByDateRange( TEST_REPO_ID, null, null ) );
+ repository.getArtifactsByDateRange( , TEST_REPO_ID, null, null ) );
assertEquals( Collections.singletonList( secondArtifact ),
- repository.getArtifactsByDateRange( OTHER_REPO_ID, null, null ) );
+ repository.getArtifactsByDateRange( , OTHER_REPO_ID, null, null ) );
}
@Test
@@ -1068,41 +1068,41 @@ public abstract class AbstractMetadataRepositoryTest
throws Exception
{
ArtifactMetadata artifact = createArtifact();
- repository.updateArtifact( TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT, TEST_PROJECT_VERSION, artifact );
+ repository.updateArtifact( , TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT, TEST_PROJECT_VERSION, artifact );
ArtifactMetadata secondArtifact = createArtifact();
secondArtifact.setRepositoryId( OTHER_REPO_ID );
- repository.updateArtifact( OTHER_REPO_ID, TEST_NAMESPACE, TEST_PROJECT, TEST_PROJECT_VERSION, secondArtifact );
+ repository.updateArtifact( , OTHER_REPO_ID, TEST_NAMESPACE, TEST_PROJECT, TEST_PROJECT_VERSION, secondArtifact );
repository.save();
// test it restricts to the appropriate repository
assertEquals( Collections.singletonList( artifact ),
- new ArrayList<>( repository.getArtifactsByChecksum( TEST_REPO_ID, TEST_SHA1 ) ) );
+ new ArrayList<>( repository.getArtifactsByChecksum( , TEST_REPO_ID, TEST_SHA1 ) ) );
assertEquals( Collections.singletonList( secondArtifact ), new ArrayList<>(
- repository.getArtifactsByChecksum( OTHER_REPO_ID, TEST_SHA1 ) ) );
+ repository.getArtifactsByChecksum( , OTHER_REPO_ID, TEST_SHA1 ) ) );
assertEquals( Collections.singletonList( artifact ),
- new ArrayList<>( repository.getArtifactsByChecksum( TEST_REPO_ID, TEST_MD5 ) ) );
+ new ArrayList<>( repository.getArtifactsByChecksum( , TEST_REPO_ID, TEST_MD5 ) ) );
assertEquals( Collections.singletonList( secondArtifact ),
- new ArrayList<>( repository.getArtifactsByChecksum( OTHER_REPO_ID, TEST_MD5 ) ) );
+ new ArrayList<>( repository.getArtifactsByChecksum( , OTHER_REPO_ID, TEST_MD5 ) ) );
}
@Test
public void testGetNamespacesWithSparseDepth()
throws Exception
{
- repository.updateNamespace( TEST_REPO_ID, "org.apache.maven.shared" );
+ repository.updateNamespace( , TEST_REPO_ID, "org.apache.maven.shared" );
- Collection<String> namespaces = repository.getRootNamespaces( TEST_REPO_ID );
+ Collection<String> namespaces = repository.getRootNamespaces( , TEST_REPO_ID );
assertThat( namespaces ).isNotNull().isNotEmpty().hasSize( 1 ).contains( "org" );
- namespaces = repository.getNamespaces( TEST_REPO_ID, "org" );
+ namespaces = repository.getNamespaces( , TEST_REPO_ID, "org" );
assertThat( namespaces ).isNotNull().isNotEmpty().hasSize( 1 ).contains( "apache" );
- namespaces = repository.getNamespaces( TEST_REPO_ID, "org.apache" );
+ namespaces = repository.getNamespaces( , TEST_REPO_ID, "org.apache" );
assertThat( namespaces ).isNotNull().isNotEmpty().hasSize( 1 ).contains( "maven" );
- namespaces = repository.getNamespaces( TEST_REPO_ID, "org.apache.maven" );
+ namespaces = repository.getNamespaces( , TEST_REPO_ID, "org.apache.maven" );
assertThat( namespaces ).isNotNull().isNotEmpty().hasSize( 1 ).contains( "shared" );
}
@@ -1111,13 +1111,13 @@ public abstract class AbstractMetadataRepositoryTest
throws Exception
{
String namespace = "org.apache.maven.shared";
- repository.updateNamespace( TEST_REPO_ID, namespace );
+ repository.updateNamespace( , TEST_REPO_ID, namespace );
ProjectVersionMetadata metadata = new ProjectVersionMetadata();
metadata.setId( TEST_PROJECT_VERSION );
- repository.updateProjectVersion( TEST_REPO_ID, namespace, TEST_PROJECT, metadata );
+ repository.updateProjectVersion( , TEST_REPO_ID, namespace, TEST_PROJECT, metadata );
- Collection<String> namespaces = repository.getNamespaces( TEST_REPO_ID, namespace );
+ Collection<String> namespaces = repository.getNamespaces( , TEST_REPO_ID, namespace );
assertThat( namespaces ).isNotNull().isEmpty();
@@ -1130,11 +1130,11 @@ public abstract class AbstractMetadataRepositoryTest
ProjectMetadata projectMetadata = new ProjectMetadata();
projectMetadata.setId( TEST_PROJECT );
projectMetadata.setNamespace( "org.apache.maven" );
- repository.updateProject( TEST_REPO_ID, projectMetadata );
+ repository.updateProject( , TEST_REPO_ID, projectMetadata );
- repository.updateNamespace( TEST_REPO_ID, "org.apache.maven.shared" );
+ repository.updateNamespace( , TEST_REPO_ID, "org.apache.maven.shared" );
- Collection<String> projects = repository.getProjects( TEST_REPO_ID, "org.apache.maven" );
+ Collection<String> projects = repository.getProjects( , TEST_REPO_ID, "org.apache.maven" );
assertThat( projects ).isNotNull().isNotEmpty().hasSize( 1 ).contains( TEST_PROJECT );
}
@@ -1147,16 +1147,16 @@ public abstract class AbstractMetadataRepositoryTest
ProjectVersionMetadata versionMetadata = new ProjectVersionMetadata();
versionMetadata.setId( TEST_PROJECT_VERSION );
- repository.updateProjectVersion( TEST_REPO_ID, "org.apache.maven", TEST_PROJECT, versionMetadata );
+ repository.updateProjectVersion( , TEST_REPO_ID, "org.apache.maven", TEST_PROJECT, versionMetadata );
- repository.updateProjectVersion( TEST_REPO_ID, "org.apache.maven." + TEST_PROJECT, "other-project",
- versionMetadata );
+ repository.updateProjectVersion( , TEST_REPO_ID, "org.apache.maven." + TEST_PROJECT,
+ "other-project", versionMetadata );
Collection<String> versions =
- repository.getProjectVersions( TEST_REPO_ID, "org.apache.maven." + TEST_PROJECT, "other-project" );
+ repository.getProjectVersions( , TEST_REPO_ID, "org.apache.maven." + TEST_PROJECT, "other-project" );
assertThat( versions ).isNotNull().isNotEmpty().contains( TEST_PROJECT_VERSION );
- versions = repository.getProjectVersions( TEST_REPO_ID, "org.apache.maven", TEST_PROJECT );
+ versions = repository.getProjectVersions( , TEST_REPO_ID, "org.apache.maven", TEST_PROJECT );
assertThat( versions ).isNotNull().isNotEmpty().contains( TEST_PROJECT_VERSION );
}
@@ -1166,11 +1166,11 @@ public abstract class AbstractMetadataRepositoryTest
throws Exception
{
ArtifactMetadata artifact = createArtifact();
- repository.updateArtifact( TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT, TEST_PROJECT_VERSION, artifact );
+ repository.updateArtifact( , TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT, TEST_PROJECT_VERSION, artifact );
repository.save();
assertEquals( Collections.singletonList( artifact ),
- new ArrayList<>( repository.getArtifactsByChecksum( TEST_REPO_ID, TEST_MD5 ) ) );
+ new ArrayList<>( repository.getArtifactsByChecksum( , TEST_REPO_ID, TEST_MD5 ) ) );
}
@Test
@@ -1178,11 +1178,11 @@ public abstract class AbstractMetadataRepositoryTest
throws Exception
{
ArtifactMetadata artifact = createArtifact();
- repository.updateArtifact( TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT, TEST_PROJECT_VERSION, artifact );
+ repository.updateArtifact( , TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT, TEST_PROJECT_VERSION, artifact );
repository.save();
assertEquals( Collections.singletonList( artifact ),
- new ArrayList<>( repository.getArtifactsByChecksum( TEST_REPO_ID, TEST_SHA1 ) ) );
+ new ArrayList<>( repository.getArtifactsByChecksum( , TEST_REPO_ID, TEST_SHA1 ) ) );
}
@Test
@@ -1192,13 +1192,13 @@ public abstract class AbstractMetadataRepositoryTest
ArtifactMetadata artifact = createArtifact();
String namespace = "multi.level.ns";
artifact.setNamespace( namespace );
- repository.updateArtifact( TEST_REPO_ID, namespace, TEST_PROJECT, TEST_PROJECT_VERSION, artifact );
+ repository.updateArtifact( , TEST_REPO_ID, namespace, TEST_PROJECT, TEST_PROJECT_VERSION, artifact );
repository.save();
tryAssert(()->assertEquals( Collections.singletonList( artifact ),
- new ArrayList<>( repository.getArtifactsByChecksum( TEST_REPO_ID, TEST_SHA1 ) ) ));
+ new ArrayList<>( repository.getArtifactsByChecksum( , TEST_REPO_ID, TEST_SHA1 ) ) ));
tryAssert(()->assertEquals( Collections.singletonList( artifact ),
- new ArrayList<>( repository.getArtifactsByChecksum( TEST_REPO_ID, TEST_MD5 ) ) ) );
+ new ArrayList<>( repository.getArtifactsByChecksum( , TEST_REPO_ID, TEST_MD5 ) ) ) );
}
@Test
@@ -1206,23 +1206,23 @@ public abstract class AbstractMetadataRepositoryTest
throws Exception
{
ArtifactMetadata artifact1 = createArtifact();
- repository.updateArtifact( TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT, TEST_PROJECT_VERSION, artifact1 );
+ repository.updateArtifact( , TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT, TEST_PROJECT_VERSION, artifact1 );
String newProjectId = "another-project";
ArtifactMetadata artifact2 = createArtifact();
artifact2.setProject( newProjectId );
- repository.updateArtifact( TEST_REPO_ID, TEST_NAMESPACE, newProjectId, TEST_PROJECT_VERSION, artifact2 );
+ repository.updateArtifact( , TEST_REPO_ID, TEST_NAMESPACE, newProjectId, TEST_PROJECT_VERSION, artifact2 );
repository.save();
tryAssert(()-> {
List<ArtifactMetadata> artifacts =
- new ArrayList<>(repository.getArtifactsByChecksum(TEST_REPO_ID, TEST_SHA1));
+ new ArrayList<>(repository.getArtifactsByChecksum( , TEST_REPO_ID, TEST_SHA1 ));
Collections.sort(artifacts, new ArtifactMetadataComparator());
assertEquals(Arrays.asList(artifact2, artifact1), artifacts);
});
tryAssert(() -> {
- ArrayList<ArtifactMetadata> artifacts = new ArrayList<>(repository.getArtifactsByChecksum(TEST_REPO_ID, TEST_MD5));
+ ArrayList<ArtifactMetadata> artifacts = new ArrayList<>(repository.getArtifactsByChecksum( , TEST_REPO_ID, TEST_MD5 ));
Collections.sort(artifacts, new ArtifactMetadataComparator());
assertEquals(Arrays.asList(artifact2, artifact1), artifacts);
});
@@ -1233,10 +1233,10 @@ public abstract class AbstractMetadataRepositoryTest
throws Exception
{
ArtifactMetadata artifact = createArtifact();
- repository.updateArtifact( TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT, TEST_PROJECT_VERSION, artifact );
+ repository.updateArtifact( , TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT, TEST_PROJECT_VERSION, artifact );
Collection<ArtifactMetadata> artifactsByChecksum =
- repository.getArtifactsByChecksum( TEST_REPO_ID, "not checksum" );
+ repository.getArtifactsByChecksum( , TEST_REPO_ID, "not checksum" );
assertThat( artifactsByChecksum ).isNotNull().isEmpty();
}
@@ -1246,7 +1246,7 @@ public abstract class AbstractMetadataRepositoryTest
{
createArtifactWithGenericMetadataFacet( 10 );
Collection<ArtifactMetadata> artifactsByMetadata =
- repository.getArtifactsByProjectVersionMetadata( TEST_METADATA_KEY, TEST_METADATA_VALUE, TEST_REPO_ID );
+ repository.getArtifactsByProjectVersionMetadata( , TEST_METADATA_KEY, TEST_METADATA_VALUE, TEST_REPO_ID );
assertThat( artifactsByMetadata ).hasSize( 1 );
ArtifactMetadata artifactMetadata = artifactsByMetadata.iterator().next();
assertThat( artifactMetadata.getId() ).isEqualTo( "projectId-1.0.jar" );
@@ -1260,7 +1260,7 @@ public abstract class AbstractMetadataRepositoryTest
{
createArtifactWithGenericMetadataFacet();
Collection<ArtifactMetadata> artifactsByMetadata =
- repository.getArtifactsByProjectVersionMetadata( TEST_METADATA_KEY, TEST_METADATA_VALUE, null );
+ repository.getArtifactsByProjectVersionMetadata( , TEST_METADATA_KEY, TEST_METADATA_VALUE, null );
assertThat( artifactsByMetadata ).hasSize( 1 );
assertThat( artifactsByMetadata.iterator().next().getRepositoryId() ).isNotNull().isNotEmpty();
}
@@ -1271,7 +1271,7 @@ public abstract class AbstractMetadataRepositoryTest
{
createArtifactWithGenericMetadataFacet();
Collection<ArtifactMetadata> artifactsByMetadata =
- repository.getArtifactsByProjectVersionMetadata( TEST_METADATA_KEY, TEST_METADATA_VALUE, null );
+ repository.getArtifactsByProjectVersionMetadata( , TEST_METADATA_KEY, TEST_METADATA_VALUE, null );
assertThat( artifactsByMetadata ).hasSize( 1 );
}
@@ -1282,7 +1282,7 @@ public abstract class AbstractMetadataRepositoryTest
createArtifactWithMavenArtifactFacet();
tryAssert(()-> {
Collection<ArtifactMetadata> artifactsByMetadata =
- repository.getArtifactsByMetadata("foo", TEST_METADATA_VALUE, null);
+ repository.getArtifactsByMetadata( , "foo", TEST_METADATA_VALUE, null );
assertThat(artifactsByMetadata).hasSize(1);
ArtifactMetadata artifactMetadata = artifactsByMetadata.iterator().next();
assertThat(artifactMetadata.getId()).isEqualTo("projectId-1.0.jar");
@@ -1301,7 +1301,7 @@ public abstract class AbstractMetadataRepositoryTest
createArtifactWithData();
// only works on JCR implementation
// Collection<ArtifactMetadata> artifactsByProperty = repository.getArtifactsByProperty( "org.name", TEST_ORGANIZATION.getName(), TEST_REPO_ID );
- Collection<ArtifactMetadata> artifactsByProperty = repository.getArtifactsByProperty( "url", TEST_URL, TEST_REPO_ID );
+ Collection<ArtifactMetadata> artifactsByProperty = repository.getArtifactsByProperty( , "url", TEST_URL, TEST_REPO_ID );
assertThat( artifactsByProperty ).hasSize( 1 );
ArtifactMetadata artifactMetadata = artifactsByProperty.iterator().next();
assertThat( artifactMetadata.getId() ).isEqualTo( "projectId-1.0.jar" );
@@ -1313,23 +1313,23 @@ public abstract class AbstractMetadataRepositoryTest
public void testDeleteRepository()
throws Exception
{
- repository.updateNamespace( TEST_REPO_ID, TEST_NAMESPACE );
+ repository.updateNamespace( , TEST_REPO_ID, TEST_NAMESPACE );
ProjectMetadata project1 = new ProjectMetadata();
project1.setNamespace( TEST_NAMESPACE );
project1.setId( "project1" );
- repository.updateProject( TEST_REPO_ID, project1 );
+ repository.updateProject( , TEST_REPO_ID, project1 );
ProjectMetadata project2 = new ProjectMetadata();
project2.setNamespace( TEST_NAMESPACE );
project2.setId( "project2" );
- repository.updateProject( TEST_REPO_ID, project2 );
+ repository.updateProject( , TEST_REPO_ID, project2 );
ArtifactMetadata artifact1 = createArtifact();
artifact1.setProject( "project1" );
- repository.updateArtifact( TEST_REPO_ID, TEST_NAMESPACE, "project1", TEST_PROJECT_VERSION, artifact1 );
+ repository.updateArtifact( , TEST_REPO_ID, TEST_NAMESPACE, "project1", TEST_PROJECT_VERSION, artifact1 );
ArtifactMetadata artifact2 = createArtifact();
artifact2.setProject( "project2" );
- repository.updateArtifact( TEST_REPO_ID, TEST_NAMESPACE, "project2", TEST_PROJECT_VERSION, artifact2 );
+ repository.updateArtifact( , TEST_REPO_ID, TEST_NAMESPACE, "project2", TEST_PROJECT_VERSION, artifact2 );
repository.save();
List<ArtifactMetadata> expected = Arrays.asList( artifact1, artifact2 );
@@ -1338,15 +1338,15 @@ public abstract class AbstractMetadataRepositoryTest
tryAssert(()-> {
List<ArtifactMetadata> actual =
- new ArrayList<>( repository.getArtifactsByDateRange( TEST_REPO_ID, null, null ) );
+ new ArrayList<>( repository.getArtifactsByDateRange( , TEST_REPO_ID, null, null ) );
Collections.sort( actual, new ArtifactMetadataComparator() );
assertEquals(expected, actual);
});
- repository.removeRepository( TEST_REPO_ID );
+ repository.removeRepository( , TEST_REPO_ID );
- assertTrue( repository.getArtifacts( TEST_REPO_ID ).isEmpty() );
- assertTrue( repository.getRootNamespaces( TEST_REPO_ID ).isEmpty() );
+ assertTrue( repository.getArtifacts( , TEST_REPO_ID ).isEmpty() );
+ assertTrue( repository.getRootNamespaces( , TEST_REPO_ID ).isEmpty() );
}
@@ -1357,32 +1357,32 @@ public abstract class AbstractMetadataRepositoryTest
ArtifactMetadata artifact = createArtifact();
artifact.addFacet( new TestMetadataFacet( "value" ) );
- repository.updateArtifact( TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT, TEST_PROJECT_VERSION, artifact );
+ repository.updateArtifact( , TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT, TEST_PROJECT_VERSION, artifact );
- assertThat( repository.getArtifacts( TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT,
- TEST_PROJECT_VERSION ) ).containsExactly( artifact );
+ assertThat( repository.getArtifacts( , TEST_REPO_ID, TEST_NAMESPACE,
+ TEST_PROJECT, TEST_PROJECT_VERSION ) ).containsExactly( artifact );
- repository.updateArtifact( TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT, TEST_PROJECT_VERSION_2_0, artifact );
+ repository.updateArtifact( , TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT, TEST_PROJECT_VERSION_2_0, artifact );
- Collection<String> versions = repository.getProjectVersions( TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT );
+ Collection<String> versions = repository.getProjectVersions( , TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT );
log.info( "versions {}", versions );
assertThat( versions ).isNotNull().isNotEmpty().hasSize( 2 ).contains( "1.0", "2.0" );
- repository.removeArtifact( TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT, TEST_PROJECT_VERSION, artifact.getId() );
+ repository.removeArtifact( , TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT, TEST_PROJECT_VERSION, artifact.getId() );
- versions = repository.getProjectVersions( TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT );
+ versions = repository.getProjectVersions( , TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT );
log.info( "versions {}", versions );
assertThat( versions ).isNotNull().isNotEmpty().hasSize( 1 ).contains( "2.0" );
- assertThat( repository.getArtifacts( TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT,
- TEST_PROJECT_VERSION ) ).isNotNull().isEmpty();
+ assertThat( repository.getArtifacts( , TEST_REPO_ID, TEST_NAMESPACE,
+ TEST_PROJECT, TEST_PROJECT_VERSION ) ).isNotNull().isEmpty();
- assertThat( repository.getArtifacts( TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT,
- TEST_PROJECT_VERSION_2_0 ) ).isNotEmpty().hasSize( 1 );
+ assertThat( repository.getArtifacts( , TEST_REPO_ID, TEST_NAMESPACE,
+ TEST_PROJECT, TEST_PROJECT_VERSION_2_0 ) ).isNotEmpty().hasSize( 1 );
}
@Test
@@ -1392,18 +1392,18 @@ public abstract class AbstractMetadataRepositoryTest
ArtifactMetadata artifact = createArtifact();
artifact.addFacet( new TestMetadataFacet( "value" ) );
- repository.updateArtifact( TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT, TEST_PROJECT_VERSION, artifact );
+ repository.updateArtifact( , TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT, TEST_PROJECT_VERSION, artifact );
- repository.updateArtifact( TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT, TEST_PROJECT_VERSION, artifact );
+ repository.updateArtifact( , TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT, TEST_PROJECT_VERSION, artifact );
Collection<ArtifactMetadata> artifacts =
- repository.getArtifacts( TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT, TEST_PROJECT_VERSION );
+ repository.getArtifacts( , TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT, TEST_PROJECT_VERSION );
assertEquals( Collections.singletonList( artifact ), new ArrayList<>( artifacts ) );
- repository.removeArtifact( TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT, TEST_PROJECT_VERSION, artifact.getId() );
+ repository.removeArtifact( , TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT, TEST_PROJECT_VERSION, artifact.getId() );
- artifacts = repository.getArtifacts( TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT, TEST_PROJECT_VERSION );
+ artifacts = repository.getArtifacts( , TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT, TEST_PROJECT_VERSION );
assertThat( artifacts ).isNotNull().isEmpty();
}
@@ -1415,17 +1415,17 @@ public abstract class AbstractMetadataRepositoryTest
ArtifactMetadata artifact = createArtifact();
artifact.addFacet( new TestMetadataFacet( "value" ) );
- repository.updateArtifact( TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT, TEST_PROJECT_VERSION, artifact );
+ repository.updateArtifact( , TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT, TEST_PROJECT_VERSION, artifact );
- repository.updateArtifact( TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT, TEST_PROJECT_VERSION, artifact );
+ repository.updateArtifact( , TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT, TEST_PROJECT_VERSION, artifact );
- Collection<String> versions = repository.getProjectVersions( TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT );
+ Collection<String> versions = repository.getProjectVersions( , TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT );
assertThat( versions ).isNotNull().isNotEmpty().hasSize( 1 );
- repository.removeProjectVersion( TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT, TEST_PROJECT_VERSION );
+ repository.removeProjectVersion( , TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT, TEST_PROJECT_VERSION );
- versions = repository.getProjectVersions( TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT );
+ versions = repository.getProjectVersions( , TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT );
assertThat( versions ).isNotNull().isEmpty();
}
@@ -1437,15 +1437,15 @@ public abstract class AbstractMetadataRepositoryTest
ArtifactMetadata artifact = createArtifact();
artifact.addFacet( new TestMetadataFacet( "value" ) );
- repository.updateArtifact( TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT, TEST_PROJECT_VERSION, artifact );
+ repository.updateArtifact( , TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT, TEST_PROJECT_VERSION, artifact );
- repository.updateArtifact( TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT, TEST_PROJECT_VERSION, artifact );
+ repository.updateArtifact( , TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT, TEST_PROJECT_VERSION, artifact );
- assertEquals( 1, repository.getProjectVersions( TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT ).size() );
+ assertEquals( 1, repository.getProjectVersions( , TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT ).size() );
- repository.removeProject( TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT );
+ repository.removeProject( , TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT );
- Collection<String> versions = repository.getProjectVersions( TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT );
+ Collection<String> versions = repository.getProjectVersions( , TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT );
assertThat( versions ).isNotNull().isEmpty();
}
@@ -1461,7 +1461,7 @@ public abstract class AbstractMetadataRepositoryTest
artifactOne.addFacet( new TestMetadataFacet( "value" ) );
artifactOne.setId( TEST_PROJECT + "-" + "2.0-20120618.214127-1" + "." + "jar" );
- repository.updateArtifact( TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT, "2.0-SNAPSHOT", artifactOne );
+ repository.updateArtifact( , TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT, "2.0-SNAPSHOT", artifactOne );
ArtifactMetadata artifactTwo = createArtifact();
artifactTwo.setVersion( "2.0-20120618.214135-2" );
@@ -1469,24 +1469,24 @@ public abstract class AbstractMetadataRepositoryTest
artifactTwo.addFacet( new TestMetadataFacet( "value" ) );
artifactTwo.setId( TEST_PROJECT + "-" + "2.0-20120618.214135-2" + "." + "jar" );
- repository.updateArtifact( TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT, "2.0-SNAPSHOT", artifactTwo );
+ repository.updateArtifact( , TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT, "2.0-SNAPSHOT", artifactTwo );
Collection<ArtifactMetadata> artifactMetadatas =
- repository.getArtifacts( TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT, "2.0-SNAPSHOT" );
+ repository.getArtifacts( , TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT, "2.0-SNAPSHOT" );
assertThat( artifactMetadatas ).isNotNull().isNotEmpty().hasSize( 2 );
log.info( "artifactMetadatas: {}", artifactMetadatas );
- repository.removeArtifact( artifactOne, "2.0-SNAPSHOT" );
+ repository.removeArtifact( , artifactOne, "2.0-SNAPSHOT" );
- artifactMetadatas = repository.getArtifacts( TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT, "2.0-SNAPSHOT" );
+ artifactMetadatas = repository.getArtifacts( , TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT, "2.0-SNAPSHOT" );
assertThat( artifactMetadatas ).isNotNull().isNotEmpty().hasSize( 1 );
- repository.removeArtifact( artifactTwo, "2.0-SNAPSHOT" );
+ repository.removeArtifact( , artifactTwo, "2.0-SNAPSHOT" );
- artifactMetadatas = repository.getArtifacts( TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT, "2.0-SNAPSHOT" );
+ artifactMetadatas = repository.getArtifacts( , TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT, "2.0-SNAPSHOT" );
assertThat( artifactMetadatas ).isNotNull().isEmpty();
}
@@ -1525,14 +1525,14 @@ public abstract class AbstractMetadataRepositoryTest
d.setOptional( true );
metadata.addDependency( d );
- repository.updateProjectVersion( TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT, metadata );
+ repository.updateProjectVersion( , TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT, metadata );
repository.save();
- metadata = repository.getProjectVersion( TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT, TEST_PROJECT_VERSION );
+ metadata = repository.getProjectVersion( , TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT, TEST_PROJECT_VERSION );
Collection<ProjectVersionReference> references =
- repository.getProjectReferences( TEST_REPO_ID, d.getGroupId(), d.getArtifactId(), d.getVersion() );
+ repository.getProjectReferences( , TEST_REPO_ID, d.getGroupId(), d.getArtifactId(), d.getVersion() );
log.info( "references: {}", references );
@@ -1547,7 +1547,7 @@ public abstract class AbstractMetadataRepositoryTest
throws Exception
{
createArtifactWithData();
- Collection<ArtifactMetadata> artifactsByProperty = repository.searchArtifacts( "url", TEST_URL, TEST_REPO_ID, false );
+ Collection<ArtifactMetadata> artifactsByProperty = repository.searchArtifacts( , TEST_REPO_ID, "url", TEST_URL, false );
assertThat( artifactsByProperty ).isNotNull().isNotEmpty();
}
@@ -1556,9 +1556,9 @@ public abstract class AbstractMetadataRepositoryTest
throws Exception
{
createArtifactWithData();
- Collection<ArtifactMetadata> artifactsByProperty = repository.searchArtifacts( "url", TEST_URL, TEST_REPO_ID, true );
+ Collection<ArtifactMetadata> artifactsByProperty = repository.searchArtifacts( , TEST_REPO_ID, "url", TEST_URL, true );
assertThat( artifactsByProperty ).isNotNull().isNotEmpty();
- artifactsByProperty = repository.searchArtifacts( "org.name", "pache", TEST_REPO_ID, true );
+ artifactsByProperty = repository.searchArtifacts( , TEST_REPO_ID, "org.name", "pache", true );
assertThat( artifactsByProperty ).isNotNull().isEmpty();
}
@@ -1567,7 +1567,7 @@ public abstract class AbstractMetadataRepositoryTest
throws Exception
{
createArtifactWithGenericMetadataFacet();
- Collection<ArtifactMetadata> artifactsByProperty = repository.searchArtifacts( TEST_METADATA_KEY, TEST_METADATA_VALUE, TEST_REPO_ID, false );
+ Collection<ArtifactMetadata> artifactsByProperty = repository.searchArtifacts( , TEST_REPO_ID, TEST_METADATA_KEY, TEST_METADATA_VALUE, false );
assertThat( artifactsByProperty ).isNotNull().isNotEmpty();
}
@@ -1577,7 +1577,7 @@ public abstract class AbstractMetadataRepositoryTest
{
createArtifactWithGenericMetadataFacet();
tryAssert(()-> {
- Collection<ArtifactMetadata> artifactsByProperty = repository.searchArtifacts( TEST_METADATA_KEY, TEST_METADATA_VALUE, null, false );
+ Collection<ArtifactMetadata> artifactsByProperty = repository.searchArtifacts( , null, TEST_METADATA_KEY, TEST_METADATA_VALUE, false );
assertThat( artifactsByProperty ).isNotNull().isNotEmpty();
});
}
@@ -1590,7 +1590,7 @@ public abstract class AbstractMetadataRepositoryTest
// only works in JCR
// Collection<ArtifactMetadata> artifactsByProperty = repository.searchArtifacts( TEST_URL, TEST_REPO_ID, false );
Collection<ArtifactMetadata> artifactsByProperty =
- repository.searchArtifacts( TEST_METADATA_VALUE, TEST_REPO_ID, false );
+ repository.searchArtifacts( , TEST_REPO_ID, TEST_METADATA_VALUE, false );
assertThat( artifactsByProperty ).isNotNull().isNotEmpty();
}
@@ -1602,9 +1602,9 @@ public abstract class AbstractMetadataRepositoryTest
// only works in JCR
// Collection<ArtifactMetadata> artifactsByProperty = repository.searchArtifacts( TEST_URL, TEST_REPO_ID, true );
Collection<ArtifactMetadata> artifactsByProperty =
- repository.searchArtifacts( TEST_METADATA_VALUE, TEST_REPO_ID, true );
+ repository.searchArtifacts( , TEST_REPO_ID, TEST_METADATA_VALUE, true );
assertThat( artifactsByProperty ).isNotNull().isNotEmpty();
- artifactsByProperty = repository.searchArtifacts( TEST_METADATA_VALUE.substring( 2 ), TEST_REPO_ID, true );
+ artifactsByProperty = repository.searchArtifacts( , TEST_REPO_ID, TEST_METADATA_VALUE.substring( 2 ), true );
assertThat( artifactsByProperty ).isNotNull().isEmpty();
}
@@ -1613,7 +1613,7 @@ public abstract class AbstractMetadataRepositoryTest
throws Exception
{
createArtifactWithGenericMetadataFacet();
- Collection<ArtifactMetadata> artifactsByProperty = repository.searchArtifacts( TEST_METADATA_VALUE, TEST_REPO_ID, false );
+ Collection<ArtifactMetadata> artifactsByProperty = repository.searchArtifacts( , TEST_REPO_ID, TEST_METADATA_VALUE, false );
assertThat( artifactsByProperty ).isNotNull().isNotEmpty();
}
@@ -1670,16 +1670,16 @@ public abstract class AbstractMetadataRepositoryTest
{
artifact.addFacet( artifactFacet );
}
- repository.updateArtifact( TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT, TEST_PROJECT_VERSION, artifact );
+ repository.updateArtifact( , TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT, TEST_PROJECT_VERSION, artifact );
}
if ( projectVersionMetadataFacet != null )
{
ProjectVersionMetadata metadata =
- repository.getProjectVersion( TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT, TEST_PROJECT_VERSION );
+ repository.getProjectVersion( , TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT, TEST_PROJECT_VERSION );
metadata.addFacet( projectVersionMetadataFacet );
metadata.setOrganization( TEST_ORGANIZATION );
metadata.setUrl( TEST_URL );
- repository.updateProjectVersion( TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT, metadata );
+ repository.updateProjectVersion( , TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT, metadata );
}
repository.save();
}
@@ -1688,13 +1688,13 @@ public abstract class AbstractMetadataRepositoryTest
throws MetadataRepositoryException, MetadataResolutionException
{
ArtifactMetadata artifact = createArtifact();
- repository.updateArtifact( TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT, TEST_PROJECT_VERSION, artifact );
+ repository.updateArtifact( , TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT, TEST_PROJECT_VERSION, artifact );
ProjectVersionMetadata metadata =
- repository.getProjectVersion( TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT, TEST_PROJECT_VERSION );
+ repository.getProjectVersion( , TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT, TEST_PROJECT_VERSION );
metadata.setOrganization( TEST_ORGANIZATION );
metadata.setUrl( TEST_URL );
- repository.updateProjectVersion( TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT, metadata );
+ repository.updateProjectVersion( , TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT, metadata );
repository.save();
}
diff --git a/archiva-modules/metadata/metadata-statistics-api/src/main/java/org/apache/archiva/metadata/repository/stats/model/RepositoryStatisticsProvider.java b/archiva-modules/metadata/metadata-statistics-api/src/main/java/org/apache/archiva/metadata/repository/stats/model/RepositoryStatisticsProvider.java
index 112f86a11..6fb375194 100644
--- a/archiva-modules/metadata/metadata-statistics-api/src/main/java/org/apache/archiva/metadata/repository/stats/model/RepositoryStatisticsProvider.java
+++ b/archiva-modules/metadata/metadata-statistics-api/src/main/java/org/apache/archiva/metadata/repository/stats/model/RepositoryStatisticsProvider.java
@@ -21,6 +21,7 @@ package org.apache.archiva.metadata.repository.stats.model;
import org.apache.archiva.metadata.repository.MetadataRepository;
import org.apache.archiva.metadata.repository.MetadataRepositoryException;
+import org.apache.archiva.metadata.repository.RepositorySession;
/**
*
@@ -37,11 +38,13 @@ public interface RepositoryStatisticsProvider
/**
* Populate the statistics object with the statistics data of this repository.
*
+ *
+ * @param repositorySession
* @param repository The current metadata repository implementation
* @param repositoryId The repository Id
* @param statistics The statistics object that should be filled.
* @throws MetadataRepositoryException Is thrown, if an error occurs while accessing the repository
*/
- void populateStatistics( MetadataRepository repository, String repositoryId, RepositoryStatistics statistics)
+ void populateStatistics( RepositorySession repositorySession, MetadataRepository repository, String repositoryId, RepositoryStatistics statistics )
throws MetadataRepositoryException;
}
diff --git a/archiva-modules/metadata/metadata-statistics-api/src/main/java/org/apache/archiva/metadata/repository/stats/model/RepositoryWalkingStatisticsProvider.java b/archiva-modules/metadata/metadata-statistics-api/src/main/java/org/apache/archiva/metadata/repository/stats/model/RepositoryWalkingStatisticsProvider.java
index 9cc426c8c..172332209 100644
--- a/archiva-modules/metadata/metadata-statistics-api/src/main/java/org/apache/archiva/metadata/repository/stats/model/RepositoryWalkingStatisticsProvider.java
+++ b/archiva-modules/metadata/metadata-statistics-api/src/main/java/org/apache/archiva/metadata/repository/stats/model/RepositoryWalkingStatisticsProvider.java
@@ -24,6 +24,7 @@ import org.apache.archiva.metadata.model.maven2.MavenArtifactFacet;
import org.apache.archiva.metadata.repository.MetadataRepository;
import org.apache.archiva.metadata.repository.MetadataRepositoryException;
import org.apache.archiva.metadata.repository.MetadataResolutionException;
+import org.apache.archiva.metadata.repository.RepositorySession;
import java.util.Collection;
@@ -43,19 +44,21 @@ public class RepositoryWalkingStatisticsProvider implements RepositoryStatistics
/**
* Walks each namespace of the given repository id and counts the artifacts.
*
+ *
+ * @param repositorySession
* @param metadataRepository The repository implementation
* @param repositoryId The repository Id
* @param repositoryStatistics The statistics object that must be populated
* @throws MetadataRepositoryException Throws the repository exception, if an error occurs while accessing the repository.
*/
@Override
- public void populateStatistics( MetadataRepository metadataRepository, String repositoryId,
- RepositoryStatistics repositoryStatistics )
+ public void populateStatistics( RepositorySession repositorySession, MetadataRepository metadataRepository, String repositoryId,
+ RepositoryStatistics repositoryStatistics )
throws MetadataRepositoryException
{
try
{
- for ( String ns : metadataRepository.getRootNamespaces( repositoryId ) )
+ for ( String ns : metadataRepository.getRootNamespaces( , repositoryId ) )
{
walkRepository( metadataRepository, repositoryStatistics, repositoryId, ns );
}
@@ -70,12 +73,12 @@ public class RepositoryWalkingStatisticsProvider implements RepositoryStatistics
String ns )
throws MetadataResolutionException
{
- for ( String namespace : metadataRepository.getNamespaces( repositoryId, ns ) )
+ for ( String namespace : metadataRepository.getNamespaces( , repositoryId, ns ) )
{
walkRepository( metadataRepository, stats, repositoryId, ns + "." + namespace );
}
- Collection<String> projects = metadataRepository.getProjects( repositoryId, ns );
+ Collection<String> projects = metadataRepository.getProjects( , repositoryId, ns );
if ( !projects.isEmpty() )
{
stats.setTotalGroupCount( stats.getTotalGroupCount() + 1 );
@@ -83,10 +86,10 @@ public class RepositoryWalkingStatisticsProvider implements RepositoryStatistics
for ( String project : projects )
{
- for ( String version : metadataRepository.getProjectVersions( repositoryId, ns, project ) )
+ for ( String version : metadataRepository.getProjectVersions( , repositoryId, ns, project ) )
{
- for ( ArtifactMetadata artifact : metadataRepository.getArtifacts( repositoryId, ns, project,
- version ) )
+ for ( ArtifactMetadata artifact : metadataRepository.getArtifacts( , repositoryId, ns,
+ project, version ) )
{
stats.setTotalArtifactCount( stats.getTotalArtifactCount() + 1 );
stats.setTotalArtifactFileSize( stats.getTotalArtifactFileSize() + artifact.getSize() );
diff --git a/archiva-modules/plugins/audit/src/main/java/org/apache/archiva/audit/DefaultAuditManager.java b/archiva-modules/plugins/audit/src/main/java/org/apache/archiva/audit/DefaultAuditManager.java
index 510dc8191..cff05aaa8 100644
--- a/archiva-modules/plugins/audit/src/main/java/org/apache/archiva/audit/DefaultAuditManager.java
+++ b/archiva-modules/plugins/audit/src/main/java/org/apache/archiva/audit/DefaultAuditManager.java
@@ -58,7 +58,7 @@ public class DefaultAuditManager
List<AuditRecord> records = new ArrayList<>();
for ( String repositoryId : repositoryIds )
{
- List<String> names = metadataRepository.getMetadataFacets( repositoryId, AuditEvent.FACET_ID );
+ List<String> names = metadataRepository.getMetadataFacets( , repositoryId, AuditEvent.FACET_ID );
for ( String name : names )
{
records.add( new AuditRecord( repositoryId, name ) );
@@ -70,9 +70,9 @@ public class DefaultAuditManager
List<AuditEvent> events = new ArrayList<>( records.size() );
for ( AuditRecord record : records )
{
- AuditEvent auditEvent = (AuditEvent) metadataRepository.getMetadataFacet( record.repositoryId,
- AuditEvent.FACET_ID,
- record.name );
+ AuditEvent auditEvent = (AuditEvent) metadataRepository.getMetadataFacet( ,
+ record.repositoryId,
+ AuditEvent.FACET_ID, record.name );
events.add( auditEvent );
}
return events;
@@ -85,7 +85,7 @@ public class DefaultAuditManager
// ignore those with no repository - they will still be logged to the textual audit log
if ( event.getRepositoryId() != null )
{
- repository.addMetadataFacet( event.getRepositoryId(), event );
+ repository.addMetadataFacet( , event.getRepositoryId(), event );
}
}
@@ -93,7 +93,7 @@ public class DefaultAuditManager
public void deleteAuditEvents( MetadataRepository metadataRepository, String repositoryId )
throws MetadataRepositoryException
{
- metadataRepository.removeMetadataFacets( repositoryId, AuditEvent.FACET_ID );
+ metadataRepository.removeMetadataFacets( , repositoryId, AuditEvent.FACET_ID );
}
@Override
@@ -113,7 +113,7 @@ public class DefaultAuditManager
List<AuditEvent> results = new ArrayList<>();
for ( String repositoryId : repositoryIds )
{
- List<String> list = metadataRepository.getMetadataFacets( repositoryId, AuditEvent.FACET_ID );
+ List<String> list = metadataRepository.getMetadataFacets( , repositoryId, AuditEvent.FACET_ID );
for ( String name : list )
{
try
@@ -122,9 +122,9 @@ public class DefaultAuditManager
if ( ( startTime == null || !date.before( startTime ) ) && ( endTime == null || !date.after(
endTime ) ) )
{
- AuditEvent event = (AuditEvent) metadataRepository.getMetadataFacet( repositoryId,
- AuditEvent.FACET_ID,
- name );
+ AuditEvent event = (AuditEvent) metadataRepository.getMetadataFacet( ,
+ repositoryId,
+ AuditEvent.FACET_ID, name );
if ( resource == null || event.getResource().startsWith( resource ) )
{
diff --git a/archiva-modules/plugins/audit/src/main/java/org/apache/archiva/audit/MetadataAuditListener.java b/archiva-modules/plugins/audit/src/main/java/org/apache/archiva/audit/MetadataAuditListener.java
index 8406bbb7a..ea535fd2e 100644
--- a/archiva-modules/plugins/audit/src/main/java/org/apache/archiva/audit/MetadataAuditListener.java
+++ b/archiva-modules/plugins/audit/src/main/java/org/apache/archiva/audit/MetadataAuditListener.java
@@ -59,7 +59,15 @@ public class MetadataAuditListener
if ( event.getAction().equals( AuditEvent.CREATE_FILE ) || event.getAction().equals( AuditEvent.UPLOAD_FILE ) ||
event.getAction().equals( AuditEvent.MERGING_REPOSITORIES ) )
{
- RepositorySession repositorySession = repositorySessionFactory.createSession();
+ RepositorySession repositorySession = null;
+ try
+ {
+ repositorySession = repositorySessionFactory.createSession();
+ }
+ catch ( MetadataRepositoryException e )
+ {
+ e.printStackTrace( );
+ }
try
{
auditManager.addAuditEvent( repositorySession.getRepository(), event );
@@ -73,6 +81,10 @@ public class MetadataAuditListener
{
repositorySession.close();
}
+ catch ( org.apache.archiva.metadata.repository.MetadataSessionException e )
+ {
+ e.printStackTrace( );
+ }
}
}
}
diff --git a/archiva-modules/plugins/audit/src/test/java/org/apache/archiva/audit/AuditManagerTest.java b/archiva-modules/plugins/audit/src/test/java/org/apache/archiva/audit/AuditManagerTest.java
index 8119ba4e9..da40c6853 100644
--- a/archiva-modules/plugins/audit/src/test/java/org/apache/archiva/audit/AuditManagerTest.java
+++ b/archiva-modules/plugins/audit/src/test/java/org/apache/archiva/audit/AuditManagerTest.java
@@ -104,13 +104,13 @@ public class AuditManagerTest
expectedEvents.add( event );
}
- EasyMock.expect( metadataRepository.getMetadataFacets( TEST_REPO_ID, AuditEvent.FACET_ID ) ).andReturn(
+ EasyMock.expect( metadataRepository.getMetadataFacets( , TEST_REPO_ID, AuditEvent.FACET_ID ) ).andReturn(
getEventNames( expectedEvents ) );
for ( AuditEvent event : expectedEvents.subList( 1, expectedEvents.size() ) )
{
EasyMock.expect(
- metadataRepository.getMetadataFacet( TEST_REPO_ID, AuditEvent.FACET_ID, event.getName() ) ).andReturn(
+ metadataRepository.getMetadataFacet( , TEST_REPO_ID, AuditEvent.FACET_ID, event.getName() ) ).andReturn(
event );
}
metadataRepositoryControl.replay();
@@ -141,12 +141,12 @@ public class AuditManagerTest
expectedEvents.add( createEvent( AUDIT_EVENT_BASE + MILLIS_FORMAT.format( i ) ) );
}
- EasyMock.expect( metadataRepository.getMetadataFacets( TEST_REPO_ID, AuditEvent.FACET_ID ) ).andReturn(
+ EasyMock.expect( metadataRepository.getMetadataFacets( , TEST_REPO_ID, AuditEvent.FACET_ID ) ).andReturn(
getEventNames( expectedEvents ) );
for ( AuditEvent event : expectedEvents )
{
EasyMock.expect(
- metadataRepository.getMetadataFacet( TEST_REPO_ID, AuditEvent.FACET_ID, event.getName() ) ).andReturn(
+ metadataRepository.getMetadataFacet( , TEST_REPO_ID, AuditEvent.FACET_ID, event.getName() ) ).andReturn(
event );
}
metadataRepositoryControl.replay();
@@ -184,15 +184,15 @@ public class AuditManagerTest
eventNames.get( repositoryId ).add( event.getName() );
}
- EasyMock.expect( metadataRepository.getMetadataFacets( TEST_REPO_ID, AuditEvent.FACET_ID ) ).andReturn(
+ EasyMock.expect( metadataRepository.getMetadataFacets( , TEST_REPO_ID, AuditEvent.FACET_ID ) ).andReturn(
eventNames.get( TEST_REPO_ID ) );
- EasyMock.expect( metadataRepository.getMetadataFacets( TEST_REPO_ID_2, AuditEvent.FACET_ID ) ).andReturn(
+ EasyMock.expect( metadataRepository.getMetadataFacets( , TEST_REPO_ID_2, AuditEvent.FACET_ID ) ).andReturn(
eventNames.get( TEST_REPO_ID_2 ) );
for ( AuditEvent event : events.subList( 1, events.size() ) )
{
- EasyMock.expect( metadataRepository.getMetadataFacet( event.getRepositoryId(), AuditEvent.FACET_ID,
- event.getName() ) ).andReturn( event );
+ EasyMock.expect( metadataRepository.getMetadataFacet( , event.getRepositoryId(),
+ AuditEvent.FACET_ID, event.getName() ) ).andReturn( event );
}
metadataRepositoryControl.replay();
@@ -218,7 +218,7 @@ public class AuditManagerTest
{
- EasyMock.expect( metadataRepository.getMetadataFacets( TEST_REPO_ID, AuditEvent.FACET_ID ) ).andReturn(
+ EasyMock.expect( metadataRepository.getMetadataFacets( , TEST_REPO_ID, AuditEvent.FACET_ID ) ).andReturn(
Collections.<String>emptyList() );
metadataRepositoryControl.replay();
@@ -235,7 +235,7 @@ public class AuditManagerTest
{
AuditEvent event = createEvent( new Date() );
- metadataRepository.addMetadataFacet( TEST_REPO_ID, event );
+ metadataRepository.addMetadataFacet( , TEST_REPO_ID, event );
metadataRepositoryControl.replay();
@@ -265,7 +265,7 @@ public class AuditManagerTest
throws Exception
{
- metadataRepository.removeMetadataFacets( TEST_REPO_ID, AuditEvent.FACET_ID );
+ metadataRepository.removeMetadataFacets( , TEST_REPO_ID, AuditEvent.FACET_ID );
metadataRepositoryControl.replay();
@@ -286,12 +286,12 @@ public class AuditManagerTest
AuditEvent expectedEvent = createEvent( expectedTimestamp );
AuditEvent event3 = createEvent( new Date( current.getTime() - 1000 ) );
- EasyMock.expect( metadataRepository.getMetadataFacets( TEST_REPO_ID, AuditEvent.FACET_ID ) ).andReturn(
+ EasyMock.expect( metadataRepository.getMetadataFacets( , TEST_REPO_ID, AuditEvent.FACET_ID ) ).andReturn(
Arrays.asList( event1.getName(), expectedEvent.getName(), event3.getName() ) );
// only match the middle one
- EasyMock.expect( metadataRepository.getMetadataFacet( TEST_REPO_ID, AuditEvent.FACET_ID,
- expectedEvent.getName() ) ).andReturn( expectedEvent );
+ EasyMock.expect( metadataRepository.getMetadataFacet( , TEST_REPO_ID,
+ AuditEvent.FACET_ID, expectedEvent.getName() ) ).andReturn( expectedEvent );
metadataRepositoryControl.replay();
@@ -318,13 +318,13 @@ public class AuditManagerTest
Date ts3 = new Date( current.getTime() - 1000 );
AuditEvent expectedEvent3 = createEvent( ts3 );
- EasyMock.expect( metadataRepository.getMetadataFacets( TEST_REPO_ID, AuditEvent.FACET_ID ) ).andReturn(
+ EasyMock.expect( metadataRepository.getMetadataFacets( , TEST_REPO_ID, AuditEvent.FACET_ID ) ).andReturn(
Arrays.asList( event1.getName(), expectedEvent2.getName(), expectedEvent3.getName() ) );
- EasyMock.expect( metadataRepository.getMetadataFacet( TEST_REPO_ID, AuditEvent.FACET_ID,
- expectedEvent2.getName() ) ).andReturn( expectedEvent2 );
- EasyMock.expect( metadataRepository.getMetadataFacet( TEST_REPO_ID, AuditEvent.FACET_ID,
- expectedEvent3.getName() ) ).andReturn( expectedEvent3 );
+ EasyMock.expect( metadataRepository.getMetadataFacet( , TEST_REPO_ID,
+ AuditEvent.FACET_ID, expectedEvent2.getName() ) ).andReturn( expectedEvent2 );
+ EasyMock.expect( metadataRepository.getMetadataFacet( , TEST_REPO_ID,
+ AuditEvent.FACET_ID, expectedEvent3.getName() ) ).andReturn( expectedEvent3 );
metadataRepositoryControl.replay();
List<AuditEvent> events =
@@ -350,14 +350,14 @@ public class AuditManagerTest
AuditEvent expectedEvent2 = createEvent( expectedTimestamp );
AuditEvent event3 = createEvent( new Date( current.getTime() - 1000 ) );
- EasyMock.expect( metadataRepository.getMetadataFacets( TEST_REPO_ID, AuditEvent.FACET_ID ) ).andReturn(
+ EasyMock.expect( metadataRepository.getMetadataFacets( , TEST_REPO_ID, AuditEvent.FACET_ID ) ).andReturn(
Arrays.asList( expectedEvent1.getName(), expectedEvent2.getName(), event3.getName() ) );
- EasyMock.expect( metadataRepository.getMetadataFacet( TEST_REPO_ID, AuditEvent.FACET_ID,
- expectedEvent1.getName() ) ).andReturn( expectedEvent1 );
+ EasyMock.expect( metadataRepository.getMetadataFacet( , TEST_REPO_ID,
+ AuditEvent.FACET_ID, expectedEvent1.getName() ) ).andReturn( expectedEvent1 );
- EasyMock.expect( metadataRepository.getMetadataFacet( TEST_REPO_ID, AuditEvent.FACET_ID,
- expectedEvent2.getName() ) ).andReturn( expectedEvent2 );
+ EasyMock.expect( metadataRepository.getMetadataFacet( , TEST_REPO_ID,
+ AuditEvent.FACET_ID, expectedEvent2.getName() ) ).andReturn( expectedEvent2 );
metadataRepositoryControl.replay();
@@ -386,17 +386,17 @@ public class AuditManagerTest
Date ts3 = new Date( current.getTime() - 1000 );
AuditEvent expectedEvent3 = createEvent( ts3 );
- EasyMock.expect( metadataRepository.getMetadataFacets( TEST_REPO_ID, AuditEvent.FACET_ID ) ).andReturn(
+ EasyMock.expect( metadataRepository.getMetadataFacets( , TEST_REPO_ID, AuditEvent.FACET_ID ) ).andReturn(
Arrays.asList( expectedEvent1.getName(), expectedEvent2.getName(), expectedEvent3.getName() ) );
- EasyMock.expect( metadataRepository.getMetadataFacet( TEST_REPO_ID, AuditEvent.FACET_ID,
- expectedEvent1.getName() ) ).andReturn( expectedEvent1 );
+ EasyMock.expect( metadataRepository.getMetadataFacet( , TEST_REPO_ID,
+ AuditEvent.FACET_ID, expectedEvent1.getName() ) ).andReturn( expectedEvent1 );
- EasyMock.expect( metadataRepository.getMetadataFacet( TEST_REPO_ID, AuditEvent.FACET_ID,
- expectedEvent2.getName() ) ).andReturn( expectedEvent2 );
+ EasyMock.expect( metadataRepository.getMetadataFacet( , TEST_REPO_ID,
+ AuditEvent.FACET_ID, expectedEvent2.getName() ) ).andReturn( expectedEvent2 );
- EasyMock.expect( metadataRepository.getMetadataFacet( TEST_REPO_ID, AuditEvent.FACET_ID,
- expectedEvent3.getName() ) ).andReturn( expectedEvent3 );
+ EasyMock.expect( metadataRepository.getMetadataFacet( , TEST_REPO_ID,
+ AuditEvent.FACET_ID, expectedEvent3.getName() ) ).andReturn( expectedEvent3 );
metadataRepositoryControl.replay();
List<AuditEvent> events =
@@ -426,18 +426,18 @@ public class AuditManagerTest
AuditEvent expectedEvent3 = createEvent( ts3 );
- EasyMock.expect( metadataRepository.getMetadataFacets( TEST_REPO_ID, AuditEvent.FACET_ID ) ).andReturn(
+ EasyMock.expect( metadataRepository.getMetadataFacets( , TEST_REPO_ID, AuditEvent.FACET_ID ) ).andReturn(
Arrays.asList( expectedEvent1.getName(), expectedEvent2.getName(), expectedEvent3.getName() ) );
- EasyMock.expect( metadataRepository.getMetadataFacet( TEST_REPO_ID, AuditEvent.FACET_ID,
- expectedEvent1.getName() ) ).andReturn( expectedEvent1 );
+ EasyMock.expect( metadataRepository.getMetadataFacet( , TEST_REPO_ID,
+ AuditEvent.FACET_ID, expectedEvent1.getName() ) ).andReturn( expectedEvent1 );
- EasyMock.expect( metadataRepository.getMetadataFacet( TEST_REPO_ID, AuditEvent.FACET_ID,
- expectedEvent2.getName() ) ).andReturn( expectedEvent2 );
+ EasyMock.expect( metadataRepository.getMetadataFacet( , TEST_REPO_ID,
+ AuditEvent.FACET_ID, expectedEvent2.getName() ) ).andReturn( expectedEvent2 );
- EasyMock.expect( metadataRepository.getMetadataFacet( TEST_REPO_ID, AuditEvent.FACET_ID,
- expectedEvent3.getName() ) ).andReturn( expectedEvent3 );
+ EasyMock.expect( metadataRepository.getMetadataFacet( , TEST_REPO_ID,
+ AuditEvent.FACET_ID, expectedEvent3.getName() ) ).andReturn( expectedEvent3 );
metadataRepositoryControl.replay();
List<AuditEvent> events =
@@ -464,15 +464,15 @@ public class AuditManagerTest
AuditEvent expectedEvent3 = createEvent( new Date( current.getTime() - 1000 ) );
- EasyMock.expect( metadataRepository.getMetadataFacets( TEST_REPO_ID, AuditEvent.FACET_ID ) ).andReturn(
+ EasyMock.expect( metadataRepository.getMetadataFacets( , TEST_REPO_ID, AuditEvent.FACET_ID ) ).andReturn(
Arrays.asList( expectedEvent1.getName(), expectedEvent2.getName(), expectedEvent3.getName() ) );
- EasyMock.expect( metadataRepository.getMetadataFacet( TEST_REPO_ID, AuditEvent.FACET_ID, expectedEvent1.getName() ) ).andReturn( expectedEvent1 );
+ EasyMock.expect( metadataRepository.getMetadataFacet( , TEST_REPO_ID, AuditEvent.FACET_ID, expectedEvent1.getName() ) ).andReturn( expectedEvent1 );
- EasyMock.expect( metadataRepository.getMetadataFacet( TEST_REPO_ID, AuditEvent.FACET_ID, expectedEvent2.getName() ) ).andReturn( expectedEvent2 );
+ EasyMock.expect( metadataRepository.getMetadataFacet( , TEST_REPO_ID, AuditEvent.FACET_ID, expectedEvent2.getName() ) ).andReturn( expectedEvent2 );
- EasyMock.expect( metadataRepository.getMetadataFacet( TEST_REPO_ID, AuditEvent.FACET_ID, expectedEvent3.getName() ) ).andReturn( expectedEvent3 );
+ EasyMock.expect( metadataRepository.getMetadataFacet( , TEST_REPO_ID, AuditEvent.FACET_ID, expectedEvent3.getName() ) ).andReturn( expectedEvent3 );
metadataRepositoryControl.replay();
@@ -500,20 +500,20 @@ public class AuditManagerTest
AuditEvent expectedEvent3 = createEvent( ts3 );
- EasyMock.expect( metadataRepository.getMetadataFacets( TEST_REPO_ID, AuditEvent.FACET_ID ) )
+ EasyMock.expect( metadataRepository.getMetadataFacets( , TEST_REPO_ID, AuditEvent.FACET_ID ) )
.andReturn( Arrays.asList( expectedEvent1.getName(), expectedEvent3.getName() ) );
- EasyMock.expect( metadataRepository.getMetadataFacets( TEST_REPO_ID_2, AuditEvent.FACET_ID ) )
+ EasyMock.expect( metadataRepository.getMetadataFacets( , TEST_REPO_ID_2, AuditEvent.FACET_ID ) )
.andReturn( Arrays.asList( expectedEvent2.getName() ) );
- EasyMock.expect( metadataRepository.getMetadataFacet( TEST_REPO_ID, AuditEvent.FACET_ID, expectedEvent1.getName() ) )
+ EasyMock.expect( metadataRepository.getMetadataFacet( , TEST_REPO_ID, AuditEvent.FACET_ID, expectedEvent1.getName() ) )
.andReturn( expectedEvent1 );
- EasyMock.expect( metadataRepository.getMetadataFacet( TEST_REPO_ID_2, AuditEvent.FACET_ID, expectedEvent2.getName() ) )
+ EasyMock.expect( metadataRepository.getMetadataFacet( , TEST_REPO_ID_2, AuditEvent.FACET_ID, expectedEvent2.getName() ) )
.andReturn( expectedEvent2 );
- EasyMock.expect( metadataRepository.getMetadataFacet( TEST_REPO_ID, AuditEvent.FACET_ID, expectedEvent3.getName() ) )
+ EasyMock.expect( metadataRepository.getMetadataFacet( , TEST_REPO_ID, AuditEvent.FACET_ID, expectedEvent3.getName() ) )
.andReturn( expectedEvent3 );
metadataRepositoryControl.replay();
@@ -542,7 +542,7 @@ public class AuditManagerTest
String name2 = createEvent( expectedTimestamp ).getName();
String name3 = createEvent( new Date( current.getTime() - 1000 ) ).getName();
- EasyMock.expect( metadataRepository.getMetadataFacets( TEST_REPO_ID, AuditEvent.FACET_ID ) )
+ EasyMock.expect( metadataRepository.getMetadataFacets( , TEST_REPO_ID, AuditEvent.FACET_ID ) )
.andReturn( Arrays.asList( name1, name2, name3 ) );
metadataRepositoryControl.replay();
diff --git a/archiva-modules/plugins/metadata-store-cassandra/src/main/java/org/apache/archiva/metadata/repository/cassandra/CassandraMetadataRepository.java b/archiva-modules/plugins/metadata-store-cassandra/src/main/java/org/apache/archiva/metadata/repository/cassandra/CassandraMetadataRepository.java
index 5cc9face1..05d6c5c33 100644
--- a/archiva-modules/plugins/metadata-store-cassandra/src/main/java/org/apache/archiva/metadata/repository/cassandra/CassandraMetadataRepository.java
+++ b/archiva-modules/plugins/metadata-store-cassandra/src/main/java/org/apache/archiva/metadata/repository/cassandra/CassandraMetadataRepository.java
@@ -55,6 +55,7 @@ import org.apache.archiva.metadata.model.Scm;
import org.apache.archiva.metadata.repository.MetadataRepository;
import org.apache.archiva.metadata.repository.MetadataRepositoryException;
import org.apache.archiva.metadata.repository.MetadataResolutionException;
+import org.apache.archiva.metadata.repository.RepositorySession;
import org.apache.archiva.metadata.repository.cassandra.model.ArtifactMetadataModel;
import org.apache.archiva.metadata.repository.cassandra.model.MetadataFacetModel;
import org.apache.archiva.metadata.repository.cassandra.model.Namespace;
@@ -66,7 +67,6 @@ import org.modelmapper.ModelMapper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import javax.persistence.PersistenceException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
@@ -230,7 +230,7 @@ public class CassandraMetadataRepository
}
@Override
- public void updateNamespace( String repositoryId, String namespaceId )
+ public void updateNamespace( RepositorySession session, String repositoryId, String namespaceId )
throws MetadataRepositoryException
{
updateOrAddNamespace( repositoryId, namespaceId );
@@ -289,7 +289,7 @@ public class CassandraMetadataRepository
@Override
- public void removeNamespace( String repositoryId, String namespaceId )
+ public void removeNamespace( RepositorySession session, String repositoryId, String namespaceId )
throws MetadataRepositoryException
{
@@ -367,7 +367,7 @@ public class CassandraMetadataRepository
@Override
- public void removeRepository( final String repositoryId )
+ public void removeRepository( RepositorySession session, final String repositoryId )
throws MetadataRepositoryException
{
@@ -447,41 +447,9 @@ public class CassandraMetadataRepository
}
- @Override
- public Collection<String> getRepositories()
- throws MetadataRepositoryException
- {
- try
- {
- logger.debug( "getRepositories" );
-
- final QueryResult<OrderedRows<String, String, String>> cResult = //
- HFactory.createRangeSlicesQuery( cassandraArchivaManager.getKeyspace(), //
- ss, ss, ss ) //
- .setColumnFamily( cassandraArchivaManager.getRepositoryFamilyName() ) //
- .setColumnNames( REPOSITORY_NAME.toString() ) //
- .setRange( null, null, false, Integer.MAX_VALUE ) //
- .execute();
-
- List<String> repoIds = new ArrayList<>( cResult.get().getCount() );
-
- for ( Row<String, String, String> row : cResult.get() )
- {
- repoIds.add( getStringValue( row.getColumnSlice(), REPOSITORY_NAME.toString() ) );
- }
-
- return repoIds;
- }
- catch ( PersistenceException e )
- {
- throw new MetadataRepositoryException( e.getMessage(), e );
- }
-
- }
-
// FIXME this one need peformance improvement maybe a cache?
@Override
- public Collection<String> getRootNamespaces( final String repoId )
+ public Collection<String> getRootNamespaces( RepositorySession session, final String repoId )
throws MetadataResolutionException
{
@@ -504,7 +472,7 @@ public class CassandraMetadataRepository
// FIXME this one need peformance improvement maybe a cache?
@Override
- public Collection<String> getNamespaces( final String repoId, final String namespaceId )
+ public Collection<String> getNamespaces( RepositorySession session, final String repoId, final String namespaceId )
throws MetadataResolutionException
{
@@ -563,7 +531,7 @@ public class CassandraMetadataRepository
@Override
- public void updateProject( String repositoryId, ProjectMetadata projectMetadata )
+ public void updateProject( RepositorySession session, String repositoryId, ProjectMetadata projectMetadata )
throws MetadataRepositoryException
{
@@ -599,7 +567,7 @@ public class CassandraMetadataRepository
}
@Override
- public Collection<String> getProjects( final String repoId, final String namespace )
+ public Collection<String> getProjects( RepositorySession session, final String repoId, final String namespace )
throws MetadataResolutionException
{
@@ -622,7 +590,7 @@ public class CassandraMetadataRepository
}
@Override
- public void removeProject( final String repositoryId, final String namespaceId, final String projectId )
+ public void removeProject( RepositorySession session, final String repositoryId, final String namespaceId, final String projectId )
throws MetadataRepositoryException
{
@@ -664,7 +632,7 @@ public class CassandraMetadataRepository
}
@Override
- public Collection<String> getProjectVersions( final String repoId, final String namespace, final String projectId )
+ public Collection<String> getProjectVersions( RepositorySession session, final String repoId, final String namespace, final String projectId )
throws MetadataResolutionException
{
@@ -696,7 +664,7 @@ public class CassandraMetadataRepository
}
@Override
- public ProjectMetadata getProject( final String repoId, final String namespace, final String id )
+ public ProjectMetadata getProject( RepositorySession session, final String repoId, final String namespace, final String id )
throws MetadataResolutionException
{
@@ -744,7 +712,7 @@ public class CassandraMetadataRepository
@Override
- public void updateProjectVersion( String repositoryId, String namespaceId, String projectId,
+ public void updateProjectVersion( RepositorySession session, String repositoryId, String namespaceId, String projectId,
ProjectVersionMetadata versionMetadata )
throws MetadataRepositoryException
{
@@ -757,12 +725,12 @@ public class CassandraMetadataRepository
updateOrAddNamespace( repositoryId, namespaceId );
}
- if ( getProject( repositoryId, namespaceId, projectId ) == null )
+ if ( getProject( session, repositoryId, namespaceId, projectId ) == null )
{
ProjectMetadata projectMetadata = new ProjectMetadata();
projectMetadata.setNamespace( namespaceId );
projectMetadata.setId( projectId );
- updateProject( repositoryId, projectMetadata );
+ updateProject( session, repositoryId, projectMetadata );
}
}
@@ -953,7 +921,7 @@ public class CassandraMetadataRepository
@Override
- public ProjectVersionMetadata getProjectVersion( final String repoId, final String namespace,
+ public ProjectVersionMetadata getProjectVersion( RepositorySession session, final String repoId, final String namespace,
final String projectId, final String projectVersion )
throws MetadataResolutionException
{
@@ -1333,7 +1301,7 @@ public class CassandraMetadataRepository
}
@Override
- public void updateArtifact( String repositoryId, String namespaceId, String projectId, String projectVersion,
+ public void updateArtifact( RepositorySession session, String repositoryId, String namespaceId, String projectId, String projectVersion,
ArtifactMetadata artifactMeta )
throws MetadataRepositoryException
{
@@ -1347,7 +1315,7 @@ public class CassandraMetadataRepository
ProjectMetadata projectMetadata = new ProjectMetadata();
projectMetadata.setId( projectId );
projectMetadata.setNamespace( namespaceId );
- updateProject( repositoryId, projectMetadata );
+ updateProject( session, repositoryId, projectMetadata );
String key = new ArtifactMetadataModel.KeyBuilder().withNamespace( namespace ).withProject( projectId ).withId(
artifactMeta.getId() ).withProjectVersion( projectVersion ).build();
@@ -1439,7 +1407,7 @@ public class CassandraMetadataRepository
}
@Override
- public Collection<String> getArtifactVersions( final String repoId, final String namespace, final String projectId,
+ public Collection<String> getArtifactVersions( RepositorySession session, final String repoId, final String namespace, final String projectId,
final String projectVersion )
throws MetadataResolutionException
{
@@ -1529,7 +1497,7 @@ public class CassandraMetadataRepository
@Override
- public List<String> getMetadataFacets( final String repositoryId, final String facetId )
+ public List<String> getMetadataFacets( RepositorySession session, final String repositoryId, final String facetId )
throws MetadataRepositoryException
{
@@ -1551,14 +1519,14 @@ public class CassandraMetadataRepository
}
@Override
- public boolean hasMetadataFacet( String repositoryId, String facetId )
+ public boolean hasMetadataFacet( RepositorySession session, String repositoryId, String facetId )
throws MetadataRepositoryException
{
- return !getMetadataFacets( repositoryId, facetId ).isEmpty();
+ return !getMetadataFacets( session, repositoryId, facetId ).isEmpty();
}
@Override
- public MetadataFacet getMetadataFacet( final String repositoryId, final String facetId, final String name )
+ public MetadataFacet getMetadataFacet( RepositorySession session, final String repositoryId, final String facetId, final String name )
throws MetadataRepositoryException
{
@@ -1594,7 +1562,7 @@ public class CassandraMetadataRepository
}
@Override
- public void addMetadataFacet( String repositoryId, MetadataFacet metadataFacet )
+ public void addMetadataFacet( RepositorySession session, String repositoryId, MetadataFacet metadataFacet )
throws MetadataRepositoryException
{
@@ -1658,7 +1626,7 @@ public class CassandraMetadataRepository
}
@Override
- public void removeMetadataFacets( final String repositoryId, final String facetId )
+ public void removeMetadataFacets( RepositorySession session, final String repositoryId, final String facetId )
throws MetadataRepositoryException
{
@@ -1678,7 +1646,7 @@ public class CassandraMetadataRepository
}
@Override
- public void removeMetadataFacet( final String repositoryId, final String facetId, final String name )
+ public void removeMetadataFacet( RepositorySession session, final String repositoryId, final String facetId, final String name )
throws MetadataRepositoryException
{
@@ -1698,7 +1666,7 @@ public class CassandraMetadataRepository
}
@Override
- public List<ArtifactMetadata> getArtifactsByDateRange( final String repositoryId, final Date startTime,
+ public List<ArtifactMetadata> getArtifactsByDateRange( RepositorySession session, final String repositoryId, final Date startTime,
final Date endTime )
throws MetadataRepositoryException
{
@@ -1779,7 +1747,7 @@ public class CassandraMetadataRepository
}
@Override
- public Collection<ArtifactMetadata> getArtifactsByChecksum( final String repositoryId, final String checksum )
+ public Collection<ArtifactMetadata> getArtifactsByChecksum( RepositorySession session, final String repositoryId, final String checksum )
throws MetadataRepositoryException
{
@@ -1826,17 +1794,17 @@ public class CassandraMetadataRepository
/**
* Project version and artifact level metadata are stored in the same place, no distinctions in Cassandra
- * implementation, just calls {@link #getArtifactsByMetadata(String, String, String)}
+ * implementation, just calls {@link MetadataRepository#getArtifactsByMetadata(RepositorySession, String, String, String)}
*/
@Override
- public List<ArtifactMetadata> getArtifactsByProjectVersionMetadata( String key, String value, String repositoryId )
+ public List<ArtifactMetadata> getArtifactsByProjectVersionMetadata( RepositorySession session, String key, String value, String repositoryId )
throws MetadataRepositoryException
{
- return getArtifactsByMetadata( key, value, repositoryId );
+ return getArtifactsByMetadata( session, key, value, repositoryId );
}
@Override
- public List<ArtifactMetadata> getArtifactsByMetadata( String key, String value, String repositoryId )
+ public List<ArtifactMetadata> getArtifactsByMetadata( RepositorySession session, String key, String value, String repositoryId )
throws MetadataRepositoryException
{
RangeSlicesQuery<String, String, String> query =
@@ -1894,7 +1862,7 @@ public class CassandraMetadataRepository
}
@Override
- public List<ArtifactMetadata> getArtifactsByProperty( String key, String value, String repositoryId )
+ public List<ArtifactMetadata> getArtifactsByProperty( RepositorySession session, String key, String value, String repositoryId )
throws MetadataRepositoryException
{
QueryResult<OrderedRows<String, String, String>> result =
@@ -1920,10 +1888,10 @@ public class CassandraMetadataRepository
// projects
try
{
- artifacts.addAll( getArtifacts( getStringValue( row.getColumnSlice(), REPOSITORY_NAME ),
- getStringValue( row.getColumnSlice(), NAMESPACE_ID ),
- getStringValue( row.getColumnSlice(), PROJECT_ID ),
- getStringValue( row.getColumnSlice(), PROJECT_VERSION ) ) );
+ artifacts.addAll( getArtifacts( session,
+ getStringValue( row.getColumnSlice(), REPOSITORY_NAME ),
+ getStringValue( row.getColumnSlice(), NAMESPACE_ID ),
+ getStringValue( row.getColumnSlice(), PROJECT_ID ), getStringValue( row.getColumnSlice(), PROJECT_VERSION ) ) );
}
catch ( MetadataResolutionException e )
{
@@ -1935,7 +1903,7 @@ public class CassandraMetadataRepository
}
@Override
- public void removeArtifact( final String repositoryId, final String namespace, final String project,
+ public void removeArtifact( RepositorySession session, final String repositoryId, final String namespace, final String project,
final String version, final String id )
throws MetadataRepositoryException
{
@@ -1959,7 +1927,7 @@ public class CassandraMetadataRepository
}
@Override
- public void removeArtifact( ArtifactMetadata artifactMetadata, String baseVersion )
+ public void removeArtifact( RepositorySession session, ArtifactMetadata artifactMetadata, String baseVersion )
throws MetadataRepositoryException
{
logger.debug( "removeArtifact repositoryId: '{}', namespace: '{}', project: '{}', version: '{}', id: '{}'",
@@ -1975,7 +1943,7 @@ public class CassandraMetadataRepository
}
@Override
- public void removeArtifact( final String repositoryId, final String namespace, final String project,
+ public void removeArtifact( RepositorySession session, final String repositoryId, final String namespace, final String project,
final String version, final MetadataFacet metadataFacet )
throws MetadataRepositoryException
{
@@ -2000,7 +1968,7 @@ public class CassandraMetadataRepository
@Override
- public List<ArtifactMetadata> getArtifacts( final String repositoryId )
+ public List<ArtifactMetadata> getArtifacts( RepositorySession session, final String repositoryId )
throws MetadataRepositoryException
{
@@ -2028,7 +1996,7 @@ public class CassandraMetadataRepository
@Override
- public Collection<ProjectVersionReference> getProjectReferences( String repoId, String namespace, String projectId,
+ public Collection<ProjectVersionReference> getProjectReferences( RepositorySession session, String repoId, String namespace, String projectId,
String projectVersion )
throws MetadataResolutionException
{
@@ -2065,7 +2033,7 @@ public class CassandraMetadataRepository
}
@Override
- public void removeProjectVersion( final String repoId, final String namespace, final String projectId,
+ public void removeProjectVersion( RepositorySession session, final String repoId, final String namespace, final String projectId,
final String projectVersion )
throws MetadataRepositoryException
{
@@ -2108,7 +2076,7 @@ public class CassandraMetadataRepository
}
@Override
- public Collection<ArtifactMetadata> getArtifacts( final String repoId, final String namespace,
+ public Collection<ArtifactMetadata> getArtifacts( RepositorySession session, final String repoId, final String namespace,
final String projectId, final String projectVersion )
throws MetadataResolutionException
{
@@ -2230,23 +2198,12 @@ public class CassandraMetadataRepository
}
@Override
- public void save()
- {
- logger.trace( "save" );
- }
-
- @Override
public void close()
throws MetadataRepositoryException
{
logger.trace( "close" );
}
- @Override
- public void revert()
- {
- logger.warn( "CassandraMetadataRepository cannot revert" );
- }
@Override
public boolean canObtainAccess( Class<?> aClass )
@@ -2255,7 +2212,7 @@ public class CassandraMetadataRepository
}
@Override
- public <T> T obtainAccess( Class<T> aClass )
+ public <T> T obtainAccess( RepositorySession session, Class<T> aClass )
throws MetadataRepositoryException
{
throw new IllegalArgumentException(
@@ -2278,23 +2235,23 @@ public class CassandraMetadataRepository
* any property.
*/
@Override
- public List<ArtifactMetadata> searchArtifacts( String text, String repositoryId, boolean exact )
+ public List<ArtifactMetadata> searchArtifacts( RepositorySession session, String repositoryId, String text, boolean exact )
throws MetadataRepositoryException
{
- return getArtifactsByMetadata( null, text, repositoryId );
+ return getArtifactsByMetadata( session, null, text, repositoryId );
}
/**
* The exact parameter is ignored as we can't do non exact searches in Cassandra
*/
@Override
- public List<ArtifactMetadata> searchArtifacts( String key, String text, String repositoryId, boolean exact )
+ public List<ArtifactMetadata> searchArtifacts( RepositorySession session, String repositoryId, String key, String text, boolean exact )
throws MetadataRepositoryException
{
// TODO optimize
List<ArtifactMetadata> artifacts = new LinkedList<ArtifactMetadata>();
- artifacts.addAll( getArtifactsByMetadata( key, text, repositoryId ) );
- artifacts.addAll( getArtifactsByProperty( key, text, repositoryId ) );
+ artifacts.addAll( getArtifactsByMetadata( session, key, text, repositoryId ) );
+ artifacts.addAll( getArtifactsByProperty( session, key, text, repositoryId ) );
return artifacts;
}
}
diff --git a/archiva-modules/plugins/metadata-store-cassandra/src/main/java/org/apache/archiva/metadata/repository/cassandra/CassandraRepositorySessionFactory.java b/archiva-modules/plugins/metadata-store-cassandra/src/main/java/org/apache/archiva/metadata/repository/cassandra/CassandraRepositorySessionFactory.java
index c4b524105..6413fa955 100644
--- a/archiva-modules/plugins/metadata-store-cassandra/src/main/java/org/apache/archiva/metadata/repository/cassandra/CassandraRepositorySessionFactory.java
+++ b/archiva-modules/plugins/metadata-store-cassandra/src/main/java/org/apache/archiva/metadata/repository/cassandra/CassandraRepositorySessionFactory.java
@@ -22,6 +22,7 @@ package org.apache.archiva.metadata.repository.cassandra;
import org.apache.archiva.configuration.ArchivaConfiguration;
import org.apache.archiva.metadata.model.MetadataFacetFactory;
import org.apache.archiva.metadata.repository.AbstractRepositorySessionFactory;
+import org.apache.archiva.metadata.repository.MetadataRepositoryException;
import org.apache.archiva.metadata.repository.MetadataResolver;
import org.apache.archiva.metadata.repository.RepositorySession;
import org.apache.archiva.metadata.repository.RepositorySessionFactory;
@@ -79,7 +80,7 @@ public class CassandraRepositorySessionFactory extends AbstractRepositorySession
@Override
- public RepositorySession createSession()
+ public RepositorySession createSession() throws MetadataRepositoryException
{
CassandraMetadataRepository metadataRepository =
new CassandraMetadataRepository( metadataFacetFactories, configuration, cassandraArchivaManager );
diff --git a/archiva-modules/plugins/metadata-store-cassandra/src/test/java/org/apache/archiva/metadata/repository/cassandra/CassandraMetadataRepositoryTest.java b/archiva-modules/plugins/metadata-store-cassandra/src/test/java/org/apache/archiva/metadata/repository/cassandra/CassandraMetadataRepositoryTest.java
index 21e72ab6a..f9d32b293 100644
--- a/archiva-modules/plugins/metadata-store-cassandra/src/test/java/org/apache/archiva/metadata/repository/cassandra/CassandraMetadataRepositoryTest.java
+++ b/archiva-modules/plugins/metadata-store-cassandra/src/test/java/org/apache/archiva/metadata/repository/cassandra/CassandraMetadataRepositoryTest.java
@@ -87,10 +87,10 @@ public class CassandraMetadataRepositoryTest
.withId( TEST_PROJECT_VERSION ) //
.build();
- this.cmr.removeProjectVersion( TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT, TEST_PROJECT_VERSION );
+ this.cmr.removeProjectVersion( , TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT, TEST_PROJECT_VERSION );
assertThat(
- repository.getProjectVersion( TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT, TEST_PROJECT_VERSION ) ).isNull();
+ repository.getProjectVersion( , TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT, TEST_PROJECT_VERSION ) ).isNull();
assertThat( cmr.getMailingLists( key ) ).isNotNull().isEmpty();
diff --git a/archiva-modules/plugins/metadata-store-cassandra/src/test/java/org/apache/archiva/metadata/repository/cassandra/RepositoriesNamespaceTest.java b/archiva-modules/plugins/metadata-store-cassandra/src/test/java/org/apache/archiva/metadata/repository/cassandra/RepositoriesNamespaceTest.java
index 061d8e7b4..28d7f241e 100644
--- a/archiva-modules/plugins/metadata-store-cassandra/src/test/java/org/apache/archiva/metadata/repository/cassandra/RepositoriesNamespaceTest.java
+++ b/archiva-modules/plugins/metadata-store-cassandra/src/test/java/org/apache/archiva/metadata/repository/cassandra/RepositoriesNamespaceTest.java
@@ -85,7 +85,7 @@ public class RepositoriesNamespaceTest
try
{
- cmr.updateNamespace( "release", "org" );
+ cmr.updateNamespace( , "release", "org" );
r = cmr.getRepository( "release" );
@@ -99,14 +99,14 @@ public class RepositoriesNamespaceTest
assertThat( n ).isNotNull();
assertThat( n.getRepository() ).isNotNull();
- cmr.updateNamespace( "release", "org.apache" );
+ cmr.updateNamespace( , "release", "org.apache" );
r = cmr.getRepository( "release" );
assertThat( r ).isNotNull();
assertThat( cmr.getNamespaces( "release" ) ).isNotEmpty().hasSize( 2 );
- cmr.removeNamespace( "release", "org.apache" );
+ cmr.removeNamespace( , "release", "org.apache" );
assertThat( cmr.getNamespaces( "release" ) ).isNotEmpty().hasSize( 1 );
assertThat( cmr.getNamespaces( "release" ) ).containsExactly( "org" );
@@ -114,16 +114,16 @@ public class RepositoriesNamespaceTest
projectMetadata.setId( "theproject" );
projectMetadata.setNamespace( "org" );
- cmr.updateProject( "release", projectMetadata );
+ cmr.updateProject( , "release", projectMetadata );
- assertThat( cmr.getProjects( "release", "org" ) ).isNotEmpty().hasSize( 1 ).containsExactly(
+ assertThat( cmr.getProjects( , "release", "org" ) ).isNotEmpty().hasSize( 1 ).containsExactly(
"theproject" );
- cmr.removeProject( "release", "org", "theproject" );
+ cmr.removeProject( , "release", "org", "theproject" );
- assertThat( cmr.getProjects( "release", "org" ) ).isEmpty();
+ assertThat( cmr.getProjects( , "release", "org" ) ).isEmpty();
- cmr.removeRepository( "release" );
+ cmr.removeRepository( , "release" );
r = cmr.getRepository( "release" );
diff --git a/archiva-modules/plugins/metadata-store-file/src/main/java/org/apache/archiva/metadata/repository/file/FileMetadataRepository.java b/archiva-modules/plugins/metadata-store-file/src/main/java/org/apache/archiva/metadata/repository/file/FileMetadataRepository.java
index a0b7a31fd..635935528 100644
--- a/archiva-modules/plugins/metadata-store-file/src/main/java/org/apache/archiva/metadata/repository/file/FileMetadataRepository.java
+++ b/archiva-modules/plugins/metadata-store-file/src/main/java/org/apache/archiva/metadata/repository/file/FileMetadataRepository.java
@@ -37,6 +37,7 @@ import org.apache.archiva.metadata.model.Scm;
import org.apache.archiva.metadata.repository.MetadataRepository;
import org.apache.archiva.metadata.repository.MetadataRepositoryException;
import org.apache.archiva.metadata.repository.MetadataResolutionException;
+import org.apache.archiva.metadata.repository.RepositorySession;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -111,15 +112,15 @@ public class FileMetadataRepository
}
@Override
- public void updateProject( String repoId, ProjectMetadata project )
+ public void updateProject( RepositorySession session, String repoId, ProjectMetadata project )
{
- updateProject( repoId, project.getNamespace(), project.getId() );
+ updateProject( session, repoId, project.getNamespace(), project.getId() );
}
- private void updateProject( String repoId, String namespace, String id )
+ private void updateProject( RepositorySession session, String repoId, String namespace, String id )
{
// TODO: this is a more braindead implementation than we would normally expect, for prototyping purposes
- updateNamespace( repoId, namespace );
+ updateNamespace( session, repoId, namespace );
try
{
@@ -136,13 +137,13 @@ public class FileMetadataRepository
}
@Override
- public void updateProjectVersion( String repoId, String namespace, String projectId,
+ public void updateProjectVersion( RepositorySession session, String repoId, String namespace, String projectId,
ProjectVersionMetadata versionMetadata )
{
try
{
- updateProject( repoId, namespace, projectId );
+ updateProject( session, repoId, namespace, projectId );
Path directory =
getDirectory( repoId ).resolve( namespace + "/" + projectId + "/" + versionMetadata.getId() );
@@ -298,7 +299,7 @@ public class FileMetadataRepository
}
@Override
- public void updateNamespace( String repoId, String namespace )
+ public void updateNamespace( RepositorySession session, String repoId, String namespace )
{
try
{
@@ -315,7 +316,7 @@ public class FileMetadataRepository
}
@Override
- public List<String> getMetadataFacets( String repoId, String facetId )
+ public List<String> getMetadataFacets( RepositorySession session, String repoId, String facetId )
throws MetadataRepositoryException
{
try
@@ -339,7 +340,7 @@ public class FileMetadataRepository
}
@Override
- public boolean hasMetadataFacet( String repositoryId, String facetId )
+ public boolean hasMetadataFacet( RepositorySession session, String repositoryId, String facetId )
throws MetadataRepositoryException
{
@@ -361,7 +362,7 @@ public class FileMetadataRepository
@Override
- public MetadataFacet getMetadataFacet( String repositoryId, String facetId, String name )
+ public MetadataFacet getMetadataFacet( RepositorySession session, String repositoryId, String facetId, String name )
{
Properties properties;
try
@@ -395,7 +396,7 @@ public class FileMetadataRepository
}
@Override
- public void addMetadataFacet( String repositoryId, MetadataFacet metadataFacet )
+ public void addMetadataFacet( RepositorySession session, String repositoryId, MetadataFacet metadataFacet )
{
Properties properties = new Properties();
properties.putAll( metadataFacet.toProperties() );
@@ -414,7 +415,7 @@ public class FileMetadataRepository
}
@Override
- public void removeMetadataFacets( String repositoryId, String facetId )
+ public void removeMetadataFacets( RepositorySession session, String repositoryId, String facetId )
throws MetadataRepositoryException
{
try
@@ -429,7 +430,7 @@ public class FileMetadataRepository
}
@Override
- public void removeMetadataFacet( String repoId, String facetId, String name )
+ public void removeMetadataFacet( RepositorySession session, String repoId, String facetId, String name )
throws MetadataRepositoryException
{
try
@@ -444,7 +445,7 @@ public class FileMetadataRepository
}
@Override
- public List<ArtifactMetadata> getArtifactsByDateRange( String repoId, Date startTime, Date endTime )
+ public List<ArtifactMetadata> getArtifactsByDateRange( RepositorySession session, String repoId, Date startTime, Date endTime )
throws MetadataRepositoryException
{
try
@@ -453,9 +454,9 @@ public class FileMetadataRepository
// of this information (eg. in Lucene, as before)
List<ArtifactMetadata> artifacts = new ArrayList<>();
- for ( String ns : getRootNamespaces( repoId ) )
+ for ( String ns : getRootNamespaces(session , repoId ) )
{
- getArtifactsByDateRange( artifacts, repoId, ns, startTime, endTime );
+ getArtifactsByDateRange( session, artifacts, repoId, ns, startTime, endTime );
}
artifacts.sort(new ArtifactComparator() );
return artifacts;
@@ -466,22 +467,22 @@ public class FileMetadataRepository
}
}
- private void getArtifactsByDateRange( List<ArtifactMetadata> artifacts, String repoId, String ns, Date startTime,
+ private void getArtifactsByDateRange( RepositorySession session, List<ArtifactMetadata> artifacts, String repoId, String ns, Date startTime,
Date endTime )
throws MetadataRepositoryException
{
try
{
- for ( String namespace : getNamespaces( repoId, ns ) )
+ for ( String namespace : getNamespaces( session, repoId, ns ) )
{
- getArtifactsByDateRange( artifacts, repoId, ns + "." + namespace, startTime, endTime );
+ getArtifactsByDateRange( session, artifacts, repoId, ns + "." + namespace, startTime, endTime );
}
- for ( String project : getProjects( repoId, ns ) )
+ for ( String project : getProjects( session, repoId, ns ) )
{
- for ( String version : getProjectVersions( repoId, ns, project ) )
+ for ( String version : getProjectVersions( session, repoId, ns, project ) )
{
- for ( ArtifactMetadata artifact : getArtifacts( repoId, ns, project, version ) )
+ for ( ArtifactMetadata artifact : getArtifacts( session, repoId, ns, project, version ) )
{
if ( startTime == null || startTime.before( artifact.getWhenGathered() ) )
{
@@ -501,7 +502,7 @@ public class FileMetadataRepository
}
@Override
- public Collection<ArtifactMetadata> getArtifacts( String repoId, String namespace, String projectId,
+ public Collection<ArtifactMetadata> getArtifacts( RepositorySession session, String repoId, String namespace, String projectId,
String projectVersion )
throws MetadataResolutionException
{
@@ -604,11 +605,6 @@ public class FileMetadataRepository
}
}
- @Override
- public void save()
- {
- // it's all instantly persisted
- }
@Override
public void close()
@@ -616,11 +612,6 @@ public class FileMetadataRepository
// nothing additional to close
}
- @Override
- public void revert()
- {
- log.warn( "Attempted to revert a session, but the file-based repository storage doesn't support it" );
- }
@Override
public boolean canObtainAccess( Class<?> aClass )
@@ -629,7 +620,7 @@ public class FileMetadataRepository
}
@Override
- public <T> T obtainAccess( Class<T> aClass )
+ public <T> T obtainAccess( RepositorySession session, Class<T> aClass )
{
throw new IllegalArgumentException(
"Access using " + aClass + " is not supported on the file metadata storage" );
@@ -649,18 +640,7 @@ public class FileMetadataRepository
}
@Override
- public Collection<String> getRepositories()
- {
- List<String> repositories = new ArrayList<>();
- for ( ManagedRepositoryConfiguration managedRepositoryConfiguration : configuration.getConfiguration().getManagedRepositories() )
- {
- repositories.add( managedRepositoryConfiguration.getId() );
- }
- return repositories;
- }
-
- @Override
- public List<ArtifactMetadata> getArtifactsByChecksum( String repositoryId, String checksum )
+ public List<ArtifactMetadata> getArtifactsByChecksum( RepositorySession session, String repositoryId, String checksum )
throws MetadataRepositoryException
{
try
@@ -671,9 +651,9 @@ public class FileMetadataRepository
// of depth to avoid being too broad to be useful (eg. /repository/checksums/a/ab/abcdef1234567)
List<ArtifactMetadata> artifacts = new ArrayList<>();
- for ( String ns : getRootNamespaces( repositoryId ) )
+ for ( String ns : getRootNamespaces( session, repositoryId ) )
{
- getArtifactsByChecksum( artifacts, repositoryId, ns, checksum );
+ getArtifactsByChecksum( session, artifacts, repositoryId, ns, checksum );
}
return artifacts;
}
@@ -684,7 +664,7 @@ public class FileMetadataRepository
}
@Override
- public void removeNamespace( String repositoryId, String project )
+ public void removeNamespace( RepositorySession session, String repositoryId, String project )
throws MetadataRepositoryException
{
try
@@ -703,7 +683,7 @@ public class FileMetadataRepository
}
@Override
- public void removeArtifact( ArtifactMetadata artifactMetadata, String baseVersion )
+ public void removeArtifact( RepositorySession session, ArtifactMetadata artifactMetadata, String baseVersion )
throws MetadataRepositoryException
{
@@ -745,7 +725,7 @@ public class FileMetadataRepository
}
@Override
- public void removeArtifact( String repoId, String namespace, String project, String version, String id )
+ public void removeArtifact( RepositorySession session, String repoId, String namespace, String project, String version, String id )
throws MetadataRepositoryException
{
try
@@ -784,6 +764,8 @@ public class FileMetadataRepository
/**
* FIXME implements this !!!!
*
+ *
+ * @param session
* @param repositoryId
* @param namespace
* @param project
@@ -792,7 +774,7 @@ public class FileMetadataRepository
* @throws MetadataRepositoryException
*/
@Override
- public void removeArtifact( String repositoryId, String namespace, String project, String projectVersion,
+ public void removeArtifact( RepositorySession session, String repositoryId, String namespace, String project, String projectVersion,
MetadataFacet metadataFacet )
throws MetadataRepositoryException
{
@@ -800,7 +782,7 @@ public class FileMetadataRepository
}
@Override
- public void removeRepository( String repoId )
+ public void removeRepository( RepositorySession session, String repoId )
throws MetadataRepositoryException
{
try
@@ -814,22 +796,22 @@ public class FileMetadataRepository
}
}
- private void getArtifactsByChecksum( List<ArtifactMetadata> artifacts, String repositoryId, String ns,
+ private void getArtifactsByChecksum( RepositorySession session, List<ArtifactMetadata> artifacts, String repositoryId, String ns,
String checksum )
throws MetadataRepositoryException
{
try
{
- for ( String namespace : getNamespaces( repositoryId, ns ) )
+ for ( String namespace : getNamespaces( session, repositoryId, ns ) )
{
- getArtifactsByChecksum( artifacts, repositoryId, ns + "." + namespace, checksum );
+ getArtifactsByChecksum( session, artifacts, repositoryId, ns + "." + namespace, checksum );
}
- for ( String project : getProjects( repositoryId, ns ) )
+ for ( String project : getProjects( session, repositoryId, ns ) )
{
- for ( String version : getProjectVersions( repositoryId, ns, project ) )
+ for ( String version : getProjectVersions( session, repositoryId, ns, project ) )
{
- for ( ArtifactMetadata artifact : getArtifacts( repositoryId, ns, project, version ) )
+ for ( ArtifactMetadata artifact : getArtifacts( session, repositoryId, ns, project, version ) )
{
if ( checksum.equals( artifact.getMd5() ) || checksum.equals( artifact.getSha1() ) )
{
@@ -846,21 +828,21 @@ public class FileMetadataRepository
}
@Override
- public List<ArtifactMetadata> getArtifactsByProjectVersionMetadata( String key, String value, String repositoryId )
+ public List<ArtifactMetadata> getArtifactsByProjectVersionMetadata( RepositorySession session, String key, String value, String repositoryId )
throws MetadataRepositoryException
{
throw new UnsupportedOperationException( "not yet implemented in File backend" );
}
@Override
- public List<ArtifactMetadata> getArtifactsByMetadata( String key, String value, String repositoryId )
+ public List<ArtifactMetadata> getArtifactsByMetadata( RepositorySession session, String key, String value, String repositoryId )
throws MetadataRepositoryException
{
throw new UnsupportedOperationException( "not yet implemented in File backend" );
}
@Override
- public List<ArtifactMetadata> getArtifactsByProperty( String key, String value, String repositoryId )
+ public List<ArtifactMetadata> getArtifactsByProperty( RepositorySession session, String key, String value, String repositoryId )
throws MetadataRepositoryException
{
throw new UnsupportedOperationException( "getArtifactsByProperty not yet implemented in File backend" );
@@ -896,14 +878,14 @@ public class FileMetadataRepository
}
@Override
- public void updateArtifact( String repoId, String namespace, String projectId, String projectVersion,
+ public void updateArtifact( RepositorySession session, String repoId, String namespace, String projectId, String projectVersion,
ArtifactMetadata artifact )
{
try
{
ProjectVersionMetadata metadata = new ProjectVersionMetadata();
metadata.setId( projectVersion );
- updateProjectVersion( repoId, namespace, projectId, metadata );
+ updateProjectVersion( session, repoId, namespace, projectId, metadata );
Path directory = getDirectory( repoId ).resolve( namespace + "/" + projectId + "/" + projectVersion );
@@ -975,7 +957,7 @@ public class FileMetadataRepository
}
@Override
- public ProjectMetadata getProject( String repoId, String namespace, String projectId )
+ public ProjectMetadata getProject( RepositorySession session, String repoId, String namespace, String projectId )
throws MetadataResolutionException
{
try
@@ -1003,7 +985,7 @@ public class FileMetadataRepository
}
@Override
- public ProjectVersionMetadata getProjectVersion( String repoId, String namespace, String projectId,
+ public ProjectVersionMetadata getProjectVersion( RepositorySession session, String repoId, String namespace, String projectId,
String projectVersion )
throws MetadataResolutionException
{
@@ -1185,7 +1167,7 @@ public class FileMetadataRepository
}
@Override
- public Collection<String> getArtifactVersions( String repoId, String namespace, String projectId,
+ public Collection<String> getArtifactVersions( RepositorySession session, String repoId, String namespace, String projectId,
String projectVersion )
throws MetadataResolutionException
{
@@ -1213,7 +1195,7 @@ public class FileMetadataRepository
}
@Override
- public Collection<ProjectVersionReference> getProjectReferences( String repoId, String namespace, String projectId,
+ public Collection<ProjectVersionReference> getProjectReferences( RepositorySession session, String repoId, String namespace, String projectId,
String projectVersion )
throws MetadataResolutionException
{
@@ -1244,14 +1226,14 @@ public class FileMetadataRepository
}
@Override
- public Collection<String> getRootNamespaces( String repoId )
+ public Collection<String> getRootNamespaces( RepositorySession session, String repoId )
throws MetadataResolutionException
{
- return getNamespaces( repoId, null );
+ return getNamespaces( session, repoId, null );
}
@Override
- public Collection<String> getNamespaces( String repoId, String baseNamespace )
+ public Collection<String> getNamespaces( RepositorySession session, String repoId, String baseNamespace )
throws MetadataResolutionException
{
try
@@ -1294,7 +1276,7 @@ public class FileMetadataRepository
}
@Override
- public Collection<String> getProjects( String repoId, String namespace )
+ public Collection<String> getProjects( RepositorySession session, String repoId, String namespace )
throws MetadataResolutionException
{
try
@@ -1320,7 +1302,7 @@ public class FileMetadataRepository
}
@Override
- public Collection<String> getProjectVersions( String repoId, String namespace, String projectId )
+ public Collection<String> getProjectVersions( RepositorySession session, String repoId, String namespace, String projectId )
throws MetadataResolutionException
{
try
@@ -1345,7 +1327,7 @@ public class FileMetadataRepository
}
@Override
- public void removeProject( String repositoryId, String namespace, String projectId )
+ public void removeProject( RepositorySession session, String repositoryId, String namespace, String projectId )
throws MetadataRepositoryException
{
try
@@ -1360,7 +1342,7 @@ public class FileMetadataRepository
}
@Override
- public void removeProjectVersion( String repoId, String namespace, String projectId, String projectVersion )
+ public void removeProjectVersion( RepositorySession session, String repoId, String namespace, String projectId, String projectVersion )
throws MetadataRepositoryException
{
try
@@ -1408,15 +1390,15 @@ public class FileMetadataRepository
}
@Override
- public List<ArtifactMetadata> getArtifacts( String repoId )
+ public List<ArtifactMetadata> getArtifacts( RepositorySession session, String repoId )
throws MetadataRepositoryException
{
try
{
List<ArtifactMetadata> artifacts = new ArrayList<>();
- for ( String ns : getRootNamespaces( repoId ) )
+ for ( String ns : getRootNamespaces( session, repoId ) )
{
- getArtifacts( artifacts, repoId, ns );
+ getArtifacts( session, artifacts, repoId, ns );
}
return artifacts;
}
@@ -1426,31 +1408,31 @@ public class FileMetadataRepository
}
}
- private void getArtifacts( List<ArtifactMetadata> artifacts, String repoId, String ns )
+ private void getArtifacts( RepositorySession session, List<ArtifactMetadata> artifacts, String repoId, String ns )
throws MetadataResolutionException
{
- for ( String namespace : getNamespaces( repoId, ns ) )
+ for ( String namespace : getNamespaces( session, repoId, ns ) )
{
- getArtifacts( artifacts, repoId, ns + "." + namespace );
+ getArtifacts( session, artifacts, repoId, ns + "." + namespace );
}
- for ( String project : getProjects( repoId, ns ) )
+ for ( String project : getProjects( session, repoId, ns ) )
{
- for ( String version : getProjectVersions( repoId, ns, project ) )
+ for ( String version : getProjectVersions( session, repoId, ns, project ) )
{
- artifacts.addAll( getArtifacts( repoId, ns, project, version ) );
+ artifacts.addAll( getArtifacts( session, repoId, ns, project, version ) );
}
}
}
@Override
- public List<ArtifactMetadata> searchArtifacts( String text, String repositoryId, boolean exact )
+ public List<ArtifactMetadata> searchArtifacts( RepositorySession session, String repositoryId, String text, boolean exact )
{
throw new UnsupportedOperationException( "searchArtifacts not yet implemented in File backend" );
}
@Override
- public List<ArtifactMetadata> searchArtifacts( String key, String text, String repositoryId, boolean exact )
+ public List<ArtifactMetadata> searchArtifacts( RepositorySession session, String repositoryId, String key, String text, boolean exact )
{
throw new UnsupportedOperationException( "searchArtifacts not yet implemented in File backend" );
}
diff --git a/archiva-modules/plugins/metadata-store-file/src/main/java/org/apache/archiva/metadata/repository/file/FileRepositorySessionFactory.java b/archiva-modules/plugins/metadata-store-file/src/main/java/org/apache/archiva/metadata/repository/file/FileRepositorySessionFactory.java
index e471cc6af..e61a845c1 100644
--- a/archiva-modules/plugins/metadata-store-file/src/main/java/org/apache/archiva/metadata/repository/file/FileRepositorySessionFactory.java
+++ b/archiva-modules/plugins/metadata-store-file/src/main/java/org/apache/archiva/metadata/repository/file/FileRepositorySessionFactory.java
@@ -23,6 +23,7 @@ import org.apache.archiva.configuration.ArchivaConfiguration;
import org.apache.archiva.metadata.model.MetadataFacetFactory;
import org.apache.archiva.metadata.repository.AbstractRepositorySessionFactory;
import org.apache.archiva.metadata.repository.MetadataRepository;
+import org.apache.archiva.metadata.repository.MetadataRepositoryException;
import org.apache.archiva.metadata.repository.MetadataResolver;
import org.apache.archiva.metadata.repository.RepositorySession;
import org.apache.archiva.metadata.repository.RepositorySessionFactory;
@@ -76,7 +77,7 @@ public class FileRepositorySessionFactory extends AbstractRepositorySessionFacto
}
@Override
- public RepositorySession createSession()
+ public RepositorySession createSession() throws MetadataRepositoryException
{
MetadataRepository metadataRepository = new FileMetadataRepository( metadataFacetFactories, configuration );
diff --git a/archiva-modules/plugins/metadata-store-jcr/src/main/java/org/apache/archiva/metadata/repository/jcr/JcrMetadataRepository.java b/archiva-modules/plugins/metadata-store-jcr/src/main/java/org/apache/archiva/metadata/repository/jcr/JcrMetadataRepository.java
index 1231a1463..a6ac55f1f 100644
--- a/archiva-modules/plugins/metadata-store-jcr/src/main/java/org/apache/archiva/metadata/repository/jcr/JcrMetadataRepository.java
+++ b/archiva-modules/plugins/metadata-store-jcr/src/main/java/org/apache/archiva/metadata/repository/jcr/JcrMetadataRepository.java
@@ -23,6 +23,7 @@ import com.google.common.collect.ImmutableMap;
import org.apache.archiva.metadata.model.ArtifactMetadata;
import org.apache.archiva.metadata.model.CiManagement;
import org.apache.archiva.metadata.model.Dependency;
+import org.apache.archiva.metadata.model.FacetedMetadata;
import org.apache.archiva.metadata.model.IssueManagement;
import org.apache.archiva.metadata.model.License;
import org.apache.archiva.metadata.model.MailingList;
@@ -37,6 +38,7 @@ import org.apache.archiva.metadata.model.maven2.MavenArtifactFacet;
import org.apache.archiva.metadata.repository.MetadataRepository;
import org.apache.archiva.metadata.repository.MetadataRepositoryException;
import org.apache.archiva.metadata.repository.MetadataResolutionException;
+import org.apache.archiva.metadata.repository.RepositorySession;
import org.apache.archiva.metadata.repository.stats.model.RepositoryStatistics;
import org.apache.archiva.metadata.repository.stats.model.RepositoryStatisticsProvider;
import org.apache.commons.lang.StringUtils;
@@ -44,10 +46,8 @@ import org.apache.jackrabbit.commons.JcrUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import javax.jcr.InvalidItemStateException;
import javax.jcr.NamespaceRegistry;
import javax.jcr.Node;
-import javax.jcr.NodeIterator;
import javax.jcr.PathNotFoundException;
import javax.jcr.Property;
import javax.jcr.Repository;
@@ -94,10 +94,26 @@ public class JcrMetadataRepository
static final String PROJECT_VERSION_NODE_TYPE = "archiva:projectVersion";
static final String ARTIFACT_NODE_TYPE = "archiva:artifact";
+ private static final String QUERY_ARTIFACT_1 = "SELECT * FROM [" + ARTIFACT_NODE_TYPE + "] AS artifact WHERE ISDESCENDANTNODE(artifact,'/";
static final String FACET_NODE_TYPE = "archiva:facet";
+ static final String QUERY_ARTIFACTS_BY_PROJECT_VERSION_1 = "SELECT * FROM [" + PROJECT_VERSION_NODE_TYPE + "] AS projectVersion INNER JOIN [" + ARTIFACT_NODE_TYPE
+ + "] AS artifact ON ISCHILDNODE(artifact, projectVersion) INNER JOIN [" + FACET_NODE_TYPE
+ + "] AS facet ON ISCHILDNODE(facet, projectVersion) WHERE ([facet].[";
+ static final String QUERY_ARTIFACTS_BY_PROJECT_VERSION_2= "] = $value)";
+
+ static final String QUERY_ARTIFACTS_BY_METADATA_1 = "SELECT * FROM [" + ARTIFACT_NODE_TYPE + "] AS artifact INNER JOIN [" + FACET_NODE_TYPE
+ + "] AS facet ON ISCHILDNODE(facet, artifact) WHERE ([facet].[";
+ static final String QUERY_ARTIFACTS_BY_METADATA_2 = "] = $value)";
+
+ static final String QUERY_ARTIFACTS_BY_PROPERTY_1 = "SELECT * FROM [" + PROJECT_VERSION_NODE_TYPE + "] AS projectVersion INNER JOIN [" + ARTIFACT_NODE_TYPE
+ + "] AS artifact ON ISCHILDNODE(artifact, projectVersion) WHERE ([projectVersion].[";
+ static final String QUERY_ARTIFACTS_BY_PROPERTY_2 = "] = $value)";
+
+
private static final String DEPENDENCY_NODE_TYPE = "archiva:dependency";
+ private static final String QUERY_ARTIFACT_2 = "')";
private final Map<String, MetadataFacetFactory> metadataFacetFactories;
@@ -105,8 +121,6 @@ public class JcrMetadataRepository
private Repository repository;
- private Session jcrSession;
-
public JcrMetadataRepository( Map<String, MetadataFacetFactory> metadataFacetFactories, Repository repository )
throws RepositoryException
{
@@ -115,7 +129,7 @@ public class JcrMetadataRepository
}
- public static void initialize( Session session )
+ public static void initializeNodeTypes( Session session )
throws RepositoryException
{
@@ -147,34 +161,41 @@ public class JcrMetadataRepository
private static void registerMixinNodeType( NodeTypeManager nodeTypeManager, String name )
throws RepositoryException
{
- NodeTypeTemplate nodeType = nodeTypeManager.createNodeTypeTemplate();
- nodeType.setMixin( true );
- nodeType.setName( name );
-
// for now just don't re-create - but in future if we change the definition, make sure to remove first as an
// upgrade path
if ( !nodeTypeManager.hasNodeType( name ) )
{
+ NodeTypeTemplate nodeType = nodeTypeManager.createNodeTypeTemplate();
+ nodeType.setMixin( true );
+ nodeType.setName( name );
nodeTypeManager.registerNodeType( nodeType, false );
}
}
+ private Session getSession(RepositorySession repositorySession) throws MetadataRepositoryException {
+ if (repositorySession instanceof JcrSession) {
+ return ( (JcrSession) repositorySession ).getJcrSession();
+ } else {
+ throw new MetadataRepositoryException( "The given session object is not a JcrSession instance: " + repositorySession.getClass( ).getName( ) );
+ }
+ }
@Override
- public void updateProject( String repositoryId, ProjectMetadata project )
+ public void updateProject( RepositorySession session, String repositoryId, ProjectMetadata project )
throws MetadataRepositoryException
{
- updateProject( repositoryId, project.getNamespace(), project.getId() );
+ final Session jcrSession = getSession( session );
+ updateProject( jcrSession, repositoryId, project.getNamespace(), project.getId() );
}
- private void updateProject( String repositoryId, String namespace, String projectId )
+ private void updateProject( Session jcrSession, String repositoryId, String namespace, String projectId )
throws MetadataRepositoryException
{
- updateNamespace( repositoryId, namespace );
+ updateNamespace( jcrSession , repositoryId, namespace );
try
{
- getOrAddProjectNode( repositoryId, namespace, projectId );
+ getOrAddProjectNode( jcrSession, repositoryId, namespace, projectId );
}
catch ( RepositoryException e )
{
@@ -183,16 +204,17 @@ public class JcrMetadataRepository
}
@Override
- public void updateArtifact( String repositoryId, String namespace, String projectId, String projectVersion,
+ public void updateArtifact( RepositorySession session, String repositoryId, String namespace, String projectId, String projectVersion,
ArtifactMetadata artifactMeta )
throws MetadataRepositoryException
{
- updateNamespace( repositoryId, namespace );
+ final Session jcrSession = getSession( session );
+ updateNamespace( session, repositoryId, namespace );
try
{
Node node =
- getOrAddArtifactNode( repositoryId, namespace, projectId, projectVersion, artifactMeta.getId() );
+ getOrAddArtifactNode( jcrSession, repositoryId, namespace, projectId, projectVersion, artifactMeta.getId() );
Calendar cal = Calendar.getInstance();
cal.setTime( artifactMeta.getFileLastModified() );
@@ -240,16 +262,17 @@ public class JcrMetadataRepository
}
@Override
- public void updateProjectVersion( String repositoryId, String namespace, String projectId,
+ public void updateProjectVersion( RepositorySession session, String repositoryId, String namespace, String projectId,
ProjectVersionMetadata versionMetadata )
throws MetadataRepositoryException
{
- updateProject( repositoryId, namespace, projectId );
+ final Session jcrSession = getSession( session );
+ updateProject( jcrSession, repositoryId, namespace, projectId );
try
{
Node versionNode =
- getOrAddProjectVersionNode( repositoryId, namespace, projectId, versionMetadata.getId() );
+ getOrAddProjectVersionNode( jcrSession, repositoryId, namespace, projectId, versionMetadata.getId() );
versionNode.setProperty( "name", versionMetadata.getName() );
versionNode.setProperty( "description", versionMetadata.getDescription() );
@@ -370,13 +393,11 @@ public class JcrMetadataRepository
}
}
- @Override
- public void updateNamespace( String repositoryId, String namespace )
- throws MetadataRepositoryException
+ private void updateNamespace(Session jcrSession, String repositoryId, String namespace) throws MetadataRepositoryException
{
try
{
- Node node = getOrAddNamespaceNode( repositoryId, namespace );
+ Node node = getOrAddNamespaceNode( jcrSession, repositoryId, namespace );
node.setProperty( "namespace", namespace );
}
catch ( RepositoryException e )
@@ -386,12 +407,20 @@ public class JcrMetadataRepository
}
@Override
- public void removeProject( String repositoryId, String namespace, String projectId )
+ public void updateNamespace( RepositorySession session, String repositoryId, String namespace )
+ throws MetadataRepositoryException
+ {
+ updateNamespace( getSession(session), repositoryId, namespace );
+ }
+
+ @Override
+ public void removeProject( RepositorySession session, String repositoryId, String namespace, String projectId )
throws MetadataRepositoryException
{
+ final Session jcrSession = getSession( session );
try
{
- Node root = getJcrSession().getRootNode();
+ Node root = jcrSession.getRootNode();
String namespacePath = getNamespacePath( repositoryId, namespace );
if ( root.hasNode( namespacePath ) )
@@ -417,12 +446,13 @@ public class JcrMetadataRepository
@Override
- public boolean hasMetadataFacet( String repositoryId, String facetId )
+ public boolean hasMetadataFacet( RepositorySession session, String repositoryId, String facetId )
throws MetadataRepositoryException
{
+ final Session jcrSession = getSession( session );
try
{
- Node node = getJcrSession().getRootNode().getNode( getFacetPath( repositoryId, facetId ) );
+ Node node = jcrSession.getRootNode().getNode( getFacetPath( repositoryId, facetId ) );
return node.getNodes().hasNext();
}
catch ( PathNotFoundException e )
@@ -437,16 +467,17 @@ public class JcrMetadataRepository
}
@Override
- public List<String> getMetadataFacets( String repositoryId, String facetId )
+ public List<String> getMetadataFacets( RepositorySession session, String repositoryId, String facetId )
throws MetadataRepositoryException
{
+ final Session jcrSession = getSession( session );
List<String> facets = new ArrayList<>();
try
{
// no need to construct node-by-node here, as we'll find in the next instance, the facet names have / and
// are paths themselves
- Node node = getJcrSession().getRootNode().getNode( getFacetPath( repositoryId, facetId ) );
+ Node node = jcrSession.getRootNode().getNode( getFacetPath( repositoryId, facetId ) );
// TODO: this is a bit awkward. Might be better to review the purpose of this function - why is the list of
// paths helpful?
@@ -482,13 +513,14 @@ public class JcrMetadataRepository
}
@Override
- public MetadataFacet getMetadataFacet( String repositoryId, String facetId, String name )
+ public MetadataFacet getMetadataFacet( RepositorySession session, String repositoryId, String facetId, String name )
throws MetadataRepositoryException
{
+ final Session jcrSession = getSession( session );
MetadataFacet metadataFacet = null;
try
{
- Node root = getJcrSession().getRootNode();
+ Node root = jcrSession.getRootNode();
Node node = root.getNode( getFacetPath( repositoryId, facetId, name ) );
if ( metadataFacetFactories == null )
@@ -524,12 +556,13 @@ public class JcrMetadataRepository
}
@Override
- public void addMetadataFacet( String repositoryId, MetadataFacet metadataFacet )
+ public void addMetadataFacet( RepositorySession session, String repositoryId, MetadataFacet metadataFacet )
throws MetadataRepositoryException
{
+ final Session jcrSession = getSession( session );
try
{
- Node repo = getOrAddRepositoryNode( repositoryId );
+ Node repo = getOrAddRepositoryNode( jcrSession, repositoryId );
Node facets = JcrUtils.getOrAddNode( repo, "facets" );
String id = metadataFacet.getFacetId();
@@ -549,12 +582,13 @@ public class JcrMetadataRepository
}
@Override
- public void removeNamespace( String repositoryId, String projectId )
+ public void removeNamespace( RepositorySession session, String repositoryId, String projectId )
throws MetadataRepositoryException
{
+ final Session jcrSession = getSession( session );
try
{
- Node root = getJcrSession().getRootNode();
+ Node root = jcrSession.getRootNode();
String path = getNamespacePath( repositoryId, projectId );
if ( root.hasNode( path ) )
{
@@ -572,12 +606,13 @@ public class JcrMetadataRepository
}
@Override
- public void removeMetadataFacets( String repositoryId, String facetId )
+ public void removeMetadataFacets( RepositorySession session, String repositoryId, String facetId )
throws MetadataRepositoryException
{
+ final Session jcrSession = getSession( session );
try
{
- Node root = getJcrSession().getRootNode();
+ Node root = jcrSession.getRootNode();
String path = getFacetPath( repositoryId, facetId );
if ( root.hasNode( path ) )
{
@@ -591,12 +626,13 @@ public class JcrMetadataRepository
}
@Override
- public void removeMetadataFacet( String repositoryId, String facetId, String name )
+ public void removeMetadataFacet( RepositorySession session, String repositoryId, String facetId, String name )
throws MetadataRepositoryException
{
+ final Session jcrSession = getSession( session );
try
{
- Node root = getJcrSession().getRootNode();
+ Node root = jcrSession.getRootNode();
String path = getFacetPath( repositoryId, facetId, name );
if ( root.hasNode( path ) )
{
@@ -618,9 +654,11 @@ public class JcrMetadataRepository
}
@Override
- public List<ArtifactMetadata> getArtifactsByDateRange( String repoId, Date startTime, Date endTime )
+ public List<ArtifactMetadata> getArtifactsByDateRange( RepositorySession session, String repoId, Date startTime, Date endTime )
throws MetadataRepositoryException
{
+ final Session jcrSession = getSession( session );
+
List<ArtifactMetadata> artifacts;
String q = getArtifactQuery( repoId );
@@ -636,8 +674,8 @@ public class JcrMetadataRepository
try
{
- Query query = getJcrSession().getWorkspace().getQueryManager().createQuery( q, Query.JCR_SQL2 );
- ValueFactory valueFactory = getJcrSession().getValueFactory();
+ Query query = jcrSession.getWorkspace().getQueryManager().createQuery( q, Query.JCR_SQL2 );
+ ValueFactory valueFactory = jcrSession.getValueFactory();
if ( startTime != null )
{
query.bindValue( "start", valueFactory.createValue( createCalendar( startTime ) ) );
@@ -661,51 +699,20 @@ public class JcrMetadataRepository
return artifacts;
}
- @Override
- public Collection<String> getRepositories()
- throws MetadataRepositoryException
- {
- List<String> repositories;
-
- try
- {
- Node root = getJcrSession().getRootNode();
- if ( root.hasNode( "repositories" ) )
- {
- Node node = root.getNode( "repositories" );
-
- repositories = new ArrayList<>();
- NodeIterator i = node.getNodes();
- while ( i.hasNext() )
- {
- Node n = i.nextNode();
- repositories.add( n.getName() );
- }
- }
- else
- {
- repositories = Collections.emptyList();
- }
- }
- catch ( RepositoryException e )
- {
- throw new MetadataRepositoryException( e.getMessage(), e );
- }
- return repositories;
- }
@Override
- public List<ArtifactMetadata> getArtifactsByChecksum( String repositoryId, String checksum )
+ public List<ArtifactMetadata> getArtifactsByChecksum( RepositorySession session, String repositoryId, String checksum )
throws MetadataRepositoryException
{
+ final Session jcrSession = getSession( session );
List<ArtifactMetadata> artifacts;
String q = getArtifactQuery( repositoryId ) + " AND ([sha1] = $checksum OR [md5] = $checksum)";
try
{
- Query query = getJcrSession().getWorkspace().getQueryManager().createQuery( q, Query.JCR_SQL2 );
- ValueFactory valueFactory = getJcrSession().getValueFactory();
+ Query query = jcrSession.getWorkspace().getQueryManager().createQuery( q, Query.JCR_SQL2 );
+ ValueFactory valueFactory = jcrSession.getValueFactory();
query.bindValue( "checksum", valueFactory.createValue( checksum ) );
QueryResult result = query.execute();
@@ -722,7 +729,7 @@ public class JcrMetadataRepository
return artifacts;
}
- private List<ArtifactMetadata> runJcrQuery( String repositoryId, String q, Map<String, String> bindings )
+ private List<ArtifactMetadata> runJcrQuery( Session jcrSession, String repositoryId, String q, Map<String, String> bindings )
throws MetadataRepositoryException
{
List<ArtifactMetadata> artifacts;
@@ -735,8 +742,8 @@ public class JcrMetadataRepository
try
{
- Query query = getJcrSession().getWorkspace().getQueryManager().createQuery( q, Query.JCR_SQL2 );
- ValueFactory valueFactory = getJcrSession().getValueFactory();
+ Query query = jcrSession.getWorkspace().getQueryManager().createQuery( q, Query.JCR_SQL2 );
+ ValueFactory valueFactory = jcrSession.getValueFactory();
for ( Entry<String, String> entry : bindings.entrySet() )
{
query.bindValue( entry.getKey(), valueFactory.createValue( entry.getValue() ) );
@@ -768,49 +775,43 @@ public class JcrMetadataRepository
}
@Override
- public List<ArtifactMetadata> getArtifactsByProjectVersionMetadata( String key, String value, String repositoryId )
+ public List<ArtifactMetadata> getArtifactsByProjectVersionMetadata( RepositorySession session, String key, String value, String repositoryId )
throws MetadataRepositoryException
{
- String q =
- "SELECT * FROM [" + PROJECT_VERSION_NODE_TYPE + "] AS projectVersion INNER JOIN [" + ARTIFACT_NODE_TYPE
- + "] AS artifact ON ISCHILDNODE(artifact, projectVersion) INNER JOIN [" + FACET_NODE_TYPE
- + "] AS facet ON ISCHILDNODE(facet, projectVersion) WHERE ([facet].[" + key + "] = $value)";
-
- return runJcrQuery( repositoryId, q, ImmutableMap.of( "value", value ) );
+ final Session jcrSession = getSession( session );
+ final String q = new StringBuilder( QUERY_ARTIFACTS_BY_PROJECT_VERSION_1 ).append( key ).append( QUERY_ARTIFACTS_BY_PROJECT_VERSION_2 ).toString();
+ return runJcrQuery( jcrSession, repositoryId, q, ImmutableMap.of( "value", value ) );
}
@Override
- public List<ArtifactMetadata> getArtifactsByMetadata( String key, String value, String repositoryId )
+ public List<ArtifactMetadata> getArtifactsByMetadata( RepositorySession session, String key, String value, String repositoryId )
throws MetadataRepositoryException
{
- String q = "SELECT * FROM [" + ARTIFACT_NODE_TYPE + "] AS artifact INNER JOIN [" + FACET_NODE_TYPE
- + "] AS facet ON ISCHILDNODE(facet, artifact) WHERE ([facet].[" + key + "] = $value)";
-
- return runJcrQuery( repositoryId, q, ImmutableMap.of( "value", value ) );
+ final Session jcrSession = getSession( session );
+ final String q = new StringBuilder( QUERY_ARTIFACTS_BY_METADATA_1 ).append( key ).append( QUERY_ARTIFACTS_BY_METADATA_2 ).toString( );
+ return runJcrQuery( jcrSession, repositoryId, q, ImmutableMap.of( "value", value ) );
}
@Override
- public List<ArtifactMetadata> getArtifactsByProperty( String key, String value, String repositoryId )
+ public List<ArtifactMetadata> getArtifactsByProperty( RepositorySession session, String key, String value, String repositoryId )
throws MetadataRepositoryException
{
- String q =
- "SELECT * FROM [" + PROJECT_VERSION_NODE_TYPE + "] AS projectVersion INNER JOIN [" + ARTIFACT_NODE_TYPE
- + "] AS artifact ON ISCHILDNODE(artifact, projectVersion) WHERE ([projectVersion].[" + key
- + "] = $value)";
-
- return runJcrQuery( repositoryId, q, ImmutableMap.of( "value", value ) );
+ final Session jcrSession = getSession( session );
+ final String q = new StringBuilder( QUERY_ARTIFACTS_BY_PROPERTY_1 ).append( key ).append( QUERY_ARTIFACTS_BY_PROPERTY_2 ).toString();
+ return runJcrQuery( jcrSession, repositoryId, q, ImmutableMap.of( "value", value ) );
}
@Override
- public void removeRepository( String repositoryId )
+ public void removeRepository( RepositorySession session, String repositoryId )
throws MetadataRepositoryException
{
+ final Session jcrSession = getSession( session );
try
{
- Node root = getJcrSession().getRootNode();
+ Node root = jcrSession.getRootNode();
String path = getRepositoryPath( repositoryId );
if ( root.hasNode( path ) )
{
@@ -824,16 +825,17 @@ public class JcrMetadataRepository
}
@Override
- public List<ArtifactMetadata> getArtifacts( String repositoryId )
+ public List<ArtifactMetadata> getArtifacts( RepositorySession session, String repositoryId )
throws MetadataRepositoryException
{
+ final Session jcrSession = getSession( session );
List<ArtifactMetadata> artifacts;
String q = getArtifactQuery( repositoryId );
try
{
- Query query = getJcrSession().getWorkspace().getQueryManager().createQuery( q, Query.JCR_SQL2 );
+ Query query = jcrSession.getWorkspace().getQueryManager().createQuery( q, Query.JCR_SQL2 );
QueryResult result = query.execute();
artifacts = new ArrayList<>();
@@ -854,19 +856,27 @@ public class JcrMetadataRepository
private static String getArtifactQuery( String repositoryId )
{
- return "SELECT * FROM [" + ARTIFACT_NODE_TYPE + "] AS artifact WHERE ISDESCENDANTNODE(artifact,'/"
- + getRepositoryContentPath( repositoryId ) + "')";
+ return new StringBuilder(QUERY_ARTIFACT_1).append(getRepositoryContentPath( repositoryId )).append(QUERY_ARTIFACT_2).toString();
}
@Override
- public ProjectMetadata getProject( String repositoryId, String namespace, String projectId )
+ public ProjectMetadata getProject( RepositorySession session, String repositoryId, String namespace, String projectId )
throws MetadataResolutionException
{
+ final Session jcrSession;
+ try
+ {
+ jcrSession = getSession( session );
+ }
+ catch ( MetadataRepositoryException e )
+ {
+ throw new MetadataResolutionException( e.getMessage() );
+ }
ProjectMetadata metadata = null;
try
{
- Node root = getJcrSession().getRootNode();
+ Node root = jcrSession.getRootNode();
// basically just checking it exists
String path = getProjectPath( repositoryId, namespace, projectId );
@@ -886,15 +896,24 @@ public class JcrMetadataRepository
}
@Override
- public ProjectVersionMetadata getProjectVersion( String repositoryId, String namespace, String projectId,
+ public ProjectVersionMetadata getProjectVersion( RepositorySession session, String repositoryId, String namespace, String projectId,
String projectVersion )
throws MetadataResolutionException
{
+ final Session jcrSession;
+ try
+ {
+ jcrSession = getSession( session );
+ }
+ catch ( MetadataRepositoryException e )
+ {
+ throw new MetadataResolutionException( e.getMessage() );
+ }
ProjectVersionMetadata versionMetadata;
try
{
- Node root = getJcrSession().getRootNode();
+ Node root = jcrSession.getRootNode();
String path = getProjectVersionPath( repositoryId, namespace, projectId, projectVersion );
if ( !root.hasNode( path ) )
@@ -1028,52 +1047,66 @@ public class JcrMetadataRepository
}
}
- for ( Node n : JcrUtils.getChildNodes( node ) )
+ retrieveFacetProperties( versionMetadata, node );
+ }
+ catch ( RepositoryException e )
+ {
+ throw new MetadataResolutionException( e.getMessage(), e );
+ }
+
+ return versionMetadata;
+ }
+
+ private void retrieveFacetProperties( FacetedMetadata metadata, Node node ) throws RepositoryException
+ {
+ for ( Node n : JcrUtils.getChildNodes( node ) )
+ {
+ if ( n.isNodeType( FACET_NODE_TYPE ) )
{
- if ( n.isNodeType( FACET_NODE_TYPE ) )
+ String name = n.getName();
+ MetadataFacetFactory factory = metadataFacetFactories.get( name );
+ if ( factory == null )
{
- String name = n.getName();
- MetadataFacetFactory factory = metadataFacetFactories.get( name );
- if ( factory == null )
- {
- log.error( "Attempted to load unknown project version metadata facet: {}", name );
- }
- else
+ log.error( "Attempted to load unknown project version metadata facet: {}", name );
+ }
+ else
+ {
+ MetadataFacet facet = factory.createMetadataFacet();
+ Map<String, String> map = new HashMap<>();
+ for ( Property property : JcrUtils.getProperties( n ) )
{
- MetadataFacet facet = factory.createMetadataFacet();
- Map<String, String> map = new HashMap<>();
- for ( Property property : JcrUtils.getProperties( n ) )
+ String p = property.getName();
+ if ( !p.startsWith( "jcr:" ) )
{
- String p = property.getName();
- if ( !p.startsWith( "jcr:" ) )
- {
- map.put( p, property.getString() );
- }
+ map.put( p, property.getString() );
}
- facet.fromProperties( map );
- versionMetadata.addFacet( facet );
}
+ facet.fromProperties( map );
+ metadata.addFacet( facet );
}
}
}
- catch ( RepositoryException e )
- {
- throw new MetadataResolutionException( e.getMessage(), e );
- }
-
- return versionMetadata;
}
@Override
- public Collection<String> getArtifactVersions( String repositoryId, String namespace, String projectId,
+ public Collection<String> getArtifactVersions( RepositorySession session, String repositoryId, String namespace, String projectId,
String projectVersion )
throws MetadataResolutionException
{
+ final Session jcrSession;
+ try
+ {
+ jcrSession = getSession( session );
+ }
+ catch ( MetadataRepositoryException e )
+ {
+ throw new MetadataResolutionException( e.getMessage() );
+ }
Set<String> versions = new LinkedHashSet<String>();
try
{
- Node root = getJcrSession().getRootNode();
+ Node root = jcrSession.getRootNode();
Node node = root.getNode( getProjectVersionPath( repositoryId, namespace, projectId, projectVersion ) );
@@ -1095,10 +1128,19 @@ public class JcrMetadataRepository
}
@Override
- public Collection<ProjectVersionReference> getProjectReferences( String repositoryId, String namespace,
+ public Collection<ProjectVersionReference> getProjectReferences( RepositorySession session, String repositoryId, String namespace,
String projectId, String projectVersion )
throws MetadataResolutionException
{
+ final Session jcrSession;
+ try
+ {
+ jcrSession = getSession( session );
+ }
+ catch ( MetadataRepositoryException e )
+ {
+ throw new MetadataResolutionException( e.getMessage() );
+ }
List<ProjectVersionReference> references = new ArrayList<>();
@@ -1111,7 +1153,7 @@ public class JcrMetadataRepository
}
try
{
- Query query = getJcrSession().getWorkspace().getQueryManager().createQuery( q, Query.JCR_SQL2 );
+ Query query = jcrSession.getWorkspace().getQueryManager().createQuery( q, Query.JCR_SQL2 );
QueryResult result = query.execute();
for ( Node n : JcrUtils.getNodes( result ) )
@@ -1144,47 +1186,68 @@ public class JcrMetadataRepository
}
@Override
- public Collection<String> getRootNamespaces( String repositoryId )
+ public Collection<String> getRootNamespaces( RepositorySession session, String repositoryId )
throws MetadataResolutionException
{
- return getNamespaces( repositoryId, null );
+ return getNamespaces(session , repositoryId, null );
}
@Override
- public Collection<String> getNamespaces( String repositoryId, String baseNamespace )
+ public Collection<String> getNamespaces( RepositorySession session, String repositoryId, String baseNamespace )
throws MetadataResolutionException
{
String path = baseNamespace != null
? getNamespacePath( repositoryId, baseNamespace )
: getRepositoryContentPath( repositoryId );
- return getNodeNames( path, NAMESPACE_NODE_TYPE );
+ try
+ {
+ return getNodeNames( getSession(session), path, NAMESPACE_NODE_TYPE );
+ }
+ catch ( MetadataRepositoryException e )
+ {
+ throw new MetadataResolutionException( e.getMessage( ) );
+ }
}
@Override
- public Collection<String> getProjects( String repositoryId, String namespace )
+ public Collection<String> getProjects( RepositorySession session, String repositoryId, String namespace )
throws MetadataResolutionException
{
- return getNodeNames( getNamespacePath( repositoryId, namespace ), PROJECT_NODE_TYPE );
+ try
+ {
+ return getNodeNames( getSession(session), getNamespacePath( repositoryId, namespace ), PROJECT_NODE_TYPE );
+ }
+ catch ( MetadataRepositoryException e )
+ {
+ throw new MetadataResolutionException( e.getMessage( ) );
+ }
}
@Override
- public Collection<String> getProjectVersions( String repositoryId, String namespace, String projectId )
+ public Collection<String> getProjectVersions( RepositorySession session, String repositoryId, String namespace, String projectId )
throws MetadataResolutionException
{
- return getNodeNames( getProjectPath( repositoryId, namespace, projectId ), PROJECT_VERSION_NODE_TYPE );
+ try
+ {
+ return getNodeNames( getSession(session), getProjectPath( repositoryId, namespace, projectId ), PROJECT_VERSION_NODE_TYPE );
+ }
+ catch ( MetadataRepositoryException e )
+ {
+ throw new MetadataResolutionException( e.getMessage( ) );
+ }
}
@Override
- public void removeArtifact( ArtifactMetadata artifactMetadata, String baseVersion )
+ public void removeArtifact( RepositorySession session, ArtifactMetadata artifactMetadata, String baseVersion )
throws MetadataRepositoryException
{
-
+ final Session jcrSession = getSession( session );
String repositoryId = artifactMetadata.getRepositoryId();
try
{
- Node root = getJcrSession().getRootNode();
+ Node root = jcrSession.getRootNode();
String path =
getProjectVersionPath( repositoryId, artifactMetadata.getNamespace(), artifactMetadata.getProject(),
baseVersion );
@@ -1220,14 +1283,15 @@ public class JcrMetadataRepository
@Override
- public void removeProjectVersion( String repoId, String namespace, String projectId, String projectVersion )
+ public void removeProjectVersion( RepositorySession session, String repoId, String namespace, String projectId, String projectVersion )
throws MetadataRepositoryException
{
+ final Session jcrSession = getSession( session );
try
{
String path = getProjectPath( repoId, namespace, projectId );
- Node root = getJcrSession().getRootNode();
+ Node root = jcrSession.getRootNode();
Node nodeAtPath = root.getNode( path );
@@ -1247,13 +1311,14 @@ public class JcrMetadataRepository
}
@Override
- public void removeArtifact( String repositoryId, String namespace, String projectId, String projectVersion,
+ public void removeArtifact( RepositorySession session, String repositoryId, String namespace, String projectId, String projectVersion,
String id )
throws MetadataRepositoryException
{
+ final Session jcrSession = getSession( session );
try
{
- Node root = getJcrSession().getRootNode();
+ Node root = jcrSession.getRootNode();
String path = getArtifactPath( repositoryId, namespace, projectId, projectVersion, id );
if ( root.hasNode( path ) )
{
@@ -1282,13 +1347,14 @@ public class JcrMetadataRepository
}
@Override
- public void removeArtifact( String repositoryId, String namespace, String project, String projectVersion,
+ public void removeArtifact( RepositorySession session, String repositoryId, String namespace, String project, String projectVersion,
MetadataFacet metadataFacet )
throws MetadataRepositoryException
{
+ final Session jcrSession = getSession( session );
try
{
- Node root = getJcrSession().getRootNode();
+ Node root = jcrSession.getRootNode();
String path = getProjectVersionPath( repositoryId, namespace, project, projectVersion );
if ( root.hasNode( path ) )
@@ -1317,15 +1383,24 @@ public class JcrMetadataRepository
}
@Override
- public Collection<ArtifactMetadata> getArtifacts( String repositoryId, String namespace, String projectId,
+ public Collection<ArtifactMetadata> getArtifacts( RepositorySession session, String repositoryId, String namespace, String projectId,
String projectVersion )
throws MetadataResolutionException
{
+ final Session jcrSession;
+ try
+ {
+ jcrSession = getSession( session );
+ }
+ catch ( MetadataRepositoryException e )
+ {
+ throw new MetadataResolutionException( e.getMessage( ) );
+ }
List<ArtifactMetadata> artifacts = new ArrayList<>();
try
{
- Node root = getJcrSession().getRootNode();
+ Node root = jcrSession.getRootNode();
String path = getProjectVersionPath( repositoryId, namespace, projectId, projectVersion );
if ( root.hasNode( path ) )
@@ -1349,36 +1424,6 @@ public class JcrMetadataRepository
return artifacts;
}
- @Override
- public void save()
- {
- try
- {
- getJcrSession().save();
- }
- catch ( InvalidItemStateException e )
- {
- // olamy this might happen when deleting a repo while is under scanning
- log.warn( "skip InvalidItemStateException:{}", e.getMessage(), e );
- }
- catch ( RepositoryException e )
- {
- throw new RuntimeException( e.getMessage(), e );
- }
- }
-
- @Override
- public void revert()
- {
- try
- {
- getJcrSession().refresh( false );
- }
- catch ( RepositoryException e )
- {
- throw new RuntimeException( e.getMessage(), e );
- }
- }
@Override
public boolean canObtainAccess( Class<?> aClass )
@@ -1388,20 +1433,12 @@ public class JcrMetadataRepository
@SuppressWarnings( "unchecked" )
@Override
- public <T> T obtainAccess( Class<T> aClass )
+ public <T> T obtainAccess( RepositorySession session, Class<T> aClass )
throws MetadataRepositoryException
{
if ( aClass == Session.class )
{
- try
- {
- return (T) getJcrSession();
- }
- catch ( RepositoryException e )
- {
- log.error( e.getMessage(), e );
- throw new MetadataRepositoryException( e.getMessage(), e );
- }
+ return (T) getSession( session );
}
throw new IllegalArgumentException(
"Access using " + aClass + " is not supported on the JCR metadata storage" );
@@ -1411,10 +1448,6 @@ public class JcrMetadataRepository
public void close()
throws MetadataRepositoryException
{
- if ( jcrSession != null && jcrSession.isLive() )
- {
- jcrSession.logout();
- }
}
@@ -1422,16 +1455,17 @@ public class JcrMetadataRepository
* Exact is ignored as we can't do exact search in any property, we need a key
*/
@Override
- public List<ArtifactMetadata> searchArtifacts( String text, String repositoryId, boolean exact )
+ public List<ArtifactMetadata> searchArtifacts( RepositorySession session, String repositoryId, String text, boolean exact )
throws MetadataRepositoryException
{
- return searchArtifacts( null, text, repositoryId, exact );
+ return searchArtifacts( null, repositoryId, text, exact );
}
@Override
- public List<ArtifactMetadata> searchArtifacts( String key, String text, String repositoryId, boolean e )
+ public List<ArtifactMetadata> searchArtifacts( RepositorySession session, String repositoryId, String key, String text, boolean e )
throws MetadataRepositoryException
{
+ final Session jcrSession = getSession( session );
String theKey = key == null ? "*" : "[" + key + "]";
String projectVersionCondition =
e ? "(projectVersion." + theKey + " = $value)" : "contains([projectVersion]." + theKey + ", $value)";
@@ -1441,7 +1475,7 @@ public class JcrMetadataRepository
+ "] AS artifact ON ISCHILDNODE(artifact, projectVersion) LEFT OUTER JOIN [" + FACET_NODE_TYPE
+ "] AS facet ON ISCHILDNODE(facet, projectVersion) WHERE (" + projectVersionCondition + " OR "
+ facetCondition + ")";
- return runJcrQuery( repositoryId, q, ImmutableMap.of( "value", text ) );
+ return runJcrQuery( jcrSession, repositoryId, q, ImmutableMap.of( "value", text ) );
}
private ArtifactMetadata getArtifactFromNode( String repositoryId, Node artifactNode )
@@ -1489,33 +1523,7 @@ public class JcrMetadataRepository
artifact.setSha1( artifactNode.getProperty( "sha1" ).getString() );
}
- for ( Node n : JcrUtils.getChildNodes( artifactNode ) )
- {
- if ( n.isNodeType( FACET_NODE_TYPE ) )
- {
- String name = n.getName();
- MetadataFacetFactory factory = metadataFacetFactories.get( name );
- if ( factory == null )
- {
- log.error( "Attempted to load unknown project version metadata facet: {}", name );
- }
- else
- {
- MetadataFacet facet = factory.createMetadataFacet();
- Map<String, String> map = new HashMap<>();
- for ( Property p : JcrUtils.getProperties( n ) )
- {
- String property = p.getName();
- if ( !property.startsWith( "jcr:" ) )
- {
- map.put( property, p.getString() );
- }
- }
- facet.fromProperties( map );
- artifact.addFacet( facet );
- }
- }
- }
+ retrieveFacetProperties( artifact, artifactNode );
return artifact;
}
@@ -1525,14 +1533,15 @@ public class JcrMetadataRepository
return node.hasProperty( name ) ? node.getProperty( name ).getString() : null;
}
- private Collection<String> getNodeNames( String path, String nodeType )
+ private Collection<String> getNodeNames( Session jcrSession, String path, String nodeType )
throws MetadataResolutionException
{
+
List<String> names = new ArrayList<>();
try
{
- Node root = getJcrSession().getRootNode();
+ Node root = jcrSession.getRootNode();
Node nodeAtPath = root.getNode( path );
@@ -1620,55 +1629,55 @@ public class JcrMetadataRepository
return getFacetPath( repositoryId, facetId ) + "/" + name;
}
- private Node getOrAddRepositoryNode( String repositoryId )
+ private Node getOrAddRepositoryNode( Session jcrSession, String repositoryId )
throws RepositoryException
{
log.debug( "getOrAddRepositoryNode " + repositoryId );
- Node root = getJcrSession().getRootNode();
+ Node root = jcrSession.getRootNode();
Node node = JcrUtils.getOrAddNode( root, "repositories" );
log.debug( "Repositories " + node );
node = JcrUtils.getOrAddNode( node, repositoryId );
return node;
}
- private Node getOrAddRepositoryContentNode( String repositoryId )
+ private Node getOrAddRepositoryContentNode( Session jcrSession, String repositoryId )
throws RepositoryException
{
- Node node = getOrAddRepositoryNode( repositoryId );
+ Node node = getOrAddRepositoryNode( jcrSession, repositoryId );
return JcrUtils.getOrAddNode( node, "content" );
}
- private Node getOrAddNamespaceNode( String repositoryId, String namespace )
+ private Node getOrAddNamespaceNode( Session jcrSession, String repositoryId, String namespace )
throws RepositoryException
{
- Node repo = getOrAddRepositoryContentNode( repositoryId );
+ Node repo = getOrAddRepositoryContentNode( jcrSession, repositoryId );
return getOrAddNodeByPath( repo, namespace.replace( '.', '/' ), NAMESPACE_NODE_TYPE );
}
- private Node getOrAddProjectNode( String repositoryId, String namespace, String projectId )
+ private Node getOrAddProjectNode( Session jcrSession, String repositoryId, String namespace, String projectId )
throws RepositoryException
{
- Node namespaceNode = getOrAddNamespaceNode( repositoryId, namespace );
+ Node namespaceNode = getOrAddNamespaceNode( jcrSession, repositoryId, namespace );
Node node = JcrUtils.getOrAddNode( namespaceNode, projectId );
node.addMixin( PROJECT_NODE_TYPE );
return node;
}
- private Node getOrAddProjectVersionNode( String repositoryId, String namespace, String projectId,
+ private Node getOrAddProjectVersionNode( Session jcrSession, String repositoryId, String namespace, String projectId,
String projectVersion )
throws RepositoryException
{
- Node projectNode = getOrAddProjectNode( repositoryId, namespace, projectId );
+ Node projectNode = getOrAddProjectNode( jcrSession, repositoryId, namespace, projectId );
Node node = JcrUtils.getOrAddNode( projectNode, projectVersion );
node.addMixin( PROJECT_VERSION_NODE_TYPE );
return node;
}
- private Node getOrAddArtifactNode( String repositoryId, String namespace, String projectId, String projectVersion,
+ private Node getOrAddArtifactNode( Session jcrSession, String repositoryId, String namespace, String projectId, String projectVersion,
String id )
throws RepositoryException
{
- Node versionNode = getOrAddProjectVersionNode( repositoryId, namespace, projectId, projectVersion );
+ Node versionNode = getOrAddProjectVersionNode( jcrSession, repositoryId, namespace, projectId, projectVersion );
Node node = JcrUtils.getOrAddNode( versionNode, id );
node.addMixin( ARTIFACT_NODE_TYPE );
return node;
@@ -1696,18 +1705,9 @@ public class JcrMetadataRepository
return null;
}
- public Session getJcrSession()
- throws RepositoryException
- {
- if ( this.jcrSession == null || !this.jcrSession.isLive() )
- {
- jcrSession = repository.login( new SimpleCredentials( "admin", "admin".toCharArray() ) );
- }
- return this.jcrSession;
- }
@Override
- public void populateStatistics( MetadataRepository repository, String repositoryId,
+ public void populateStatistics( RepositorySession repositorySession, MetadataRepository repository, String repositoryId,
RepositoryStatistics repositoryStatistics )
throws MetadataRepositoryException
{
@@ -1716,7 +1716,7 @@ public class JcrMetadataRepository
throw new MetadataRepositoryException(
"The statistics population is only possible for JcrMetdataRepository implementations" );
}
- Session session = (Session) repository.obtainAccess( Session.class );
+ Session session = getSession( repositorySession );
// TODO: these may be best as running totals, maintained by observations on the properties in JCR
try
@@ -1785,4 +1785,9 @@ public class JcrMetadataRepository
}
}
+
+ public Session login() throws RepositoryException
+ {
+ return repository.login(new SimpleCredentials( "admin", "admin".toCharArray() ) );
+ }
}
diff --git a/archiva-modules/plugins/metadata-store-jcr/src/main/java/org/apache/archiva/metadata/repository/jcr/JcrRepositorySessionFactory.java b/archiva-modules/plugins/metadata-store-jcr/src/main/java/org/apache/archiva/metadata/repository/jcr/JcrRepositorySessionFactory.java
index 53a7d6171..7549229f7 100644
--- a/archiva-modules/plugins/metadata-store-jcr/src/main/java/org/apache/archiva/metadata/repository/jcr/JcrRepositorySessionFactory.java
+++ b/archiva-modules/plugins/metadata-store-jcr/src/main/java/org/apache/archiva/metadata/repository/jcr/JcrRepositorySessionFactory.java
@@ -21,7 +21,6 @@ package org.apache.archiva.metadata.repository.jcr;
import org.apache.archiva.metadata.model.MetadataFacetFactory;
import org.apache.archiva.metadata.repository.AbstractRepositorySessionFactory;
-import org.apache.archiva.metadata.repository.MetadataRepository;
import org.apache.archiva.metadata.repository.MetadataRepositoryException;
import org.apache.archiva.metadata.repository.MetadataResolver;
import org.apache.archiva.metadata.repository.RepositorySession;
@@ -70,19 +69,14 @@ public class JcrRepositorySessionFactory extends AbstractRepositorySessionFactor
private RepositoryFactory repositoryFactory;
+ private JcrMetadataRepository jcrMetadataRepository;
+
@Override
- public RepositorySession createSession()
+ public RepositorySession createSession() throws MetadataRepositoryException
{
try
{
- // FIXME: is this the right separation? or should a JCR session object contain the JCR session information?
- // such a change might allow us to avoid creating two objects for each request. It would also clear up
- // the ambiguities in the API where session & repository are the inverse of JCR; and the resolver is
- // retrieved from the session but must have it passed in. These should be reviewed before finalising the
- // API.
- MetadataRepository metadataRepository = new JcrMetadataRepository( metadataFacetFactories, repository );
-
- return new RepositorySession( metadataRepository, getMetadataResolver() );
+ return new JcrSession( jcrMetadataRepository, getMetadataResolver() );
}
catch ( RepositoryException e )
{
@@ -127,7 +121,6 @@ public class JcrRepositorySessionFactory extends AbstractRepositorySessionFactor
metadataFacetFactories = cleanedMetadataFacetFactories;
- JcrMetadataRepository metadataRepository = null;
try
{
@@ -141,24 +134,16 @@ public class JcrRepositorySessionFactory extends AbstractRepositorySessionFactor
logger.error("Repository creation failed {}", e.getMessage());
throw new RuntimeException("Fatal error. Could not create metadata repository.");
}
- metadataRepository = new JcrMetadataRepository( metadataFacetFactories, repository );
- JcrMetadataRepository.initialize( metadataRepository.getJcrSession() );
+ jcrMetadataRepository = new JcrMetadataRepository( metadataFacetFactories, repository );
+ try (JcrSession session = new JcrSession( jcrMetadataRepository, metadataResolver )) {
+ JcrMetadataRepository.initializeNodeTypes( session.getJcrSession() );
+ // Saves automatically with close
+ }
}
catch ( RepositoryException e )
{
throw new RuntimeException( e.getMessage(), e );
}
- finally
- {
- if ( metadataRepository != null )
- {
- try {
- metadataRepository.close();
- } catch (MetadataRepositoryException e) {
- logger.error("Close of metadata repository failed {}", e.getMessage());
- }
- }
- }
stopWatch.stop();
logger.info( "time to initialize JcrRepositorySessionFactory: {}", stopWatch.getTime() );
diff --git a/archiva-modules/plugins/metadata-store-jcr/src/main/java/org/apache/archiva/metadata/repository/jcr/JcrSession.java b/archiva-modules/plugins/metadata-store-jcr/src/main/java/org/apache/archiva/metadata/repository/jcr/JcrSession.java
new file mode 100644
index 000000000..387861917
--- /dev/null
+++ b/archiva-modules/plugins/metadata-store-jcr/src/main/java/org/apache/archiva/metadata/repository/jcr/JcrSession.java
@@ -0,0 +1,108 @@
+package org.apache.archiva.metadata.repository.jcr;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.archiva.metadata.repository.MetadataResolver;
+import org.apache.archiva.metadata.repository.MetadataSessionException;
+import org.apache.archiva.metadata.repository.RepositorySession;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.jcr.RepositoryException;
+import javax.jcr.Session;
+
+/**
+ *
+ * Session implementation for a JCR repository.
+ *
+ * @author Martin Stockhammer <martin_s@apache.org>
+ */
+public class JcrSession extends RepositorySession implements AutoCloseable
+{
+
+ private static final Logger log = LoggerFactory.getLogger( JcrSession.class );
+
+ private Session jcrSession;
+ private JcrMetadataRepository repository;
+
+ public JcrSession( JcrMetadataRepository metadataRepository, MetadataResolver resolver) throws RepositoryException
+ {
+ super( metadataRepository, resolver );
+ this.repository = metadataRepository;
+ this.jcrSession = metadataRepository.login();
+ }
+
+ public Session getJcrSession() {
+ return jcrSession;
+ }
+
+ public JcrMetadataRepository getJcrRepository() {
+ return repository;
+ }
+
+ @Override
+ public void close( )
+ {
+ super.close( );
+ jcrSession.logout();
+ }
+
+ @Override
+ protected boolean isDirty( )
+ {
+ try
+ {
+ return jcrSession.hasPendingChanges( );
+ }
+ catch ( RepositoryException e )
+ {
+ log.error( "Could not check pending changes {}", e.getMessage( ) );
+ return true;
+ }
+ }
+
+ @Override
+ public void save( ) throws MetadataSessionException
+ {
+ super.save( );
+ try
+ {
+ jcrSession.save();
+ }
+ catch ( RepositoryException e )
+ {
+ throw new MetadataSessionException( e.getMessage( ), e );
+ }
+ }
+
+ @Override
+ public void revert( ) throws MetadataSessionException
+ {
+ super.revert( );
+ try
+ {
+ jcrSession.refresh( false );
+ }
+ catch ( RepositoryException e )
+ {
+ throw new MetadataSessionException( e.getMessage( ), e );
+ }
+ }
+}
diff --git a/archiva-modules/plugins/metadata-store-jcr/src/test/java/org/apache/archiva/metadata/repository/jcr/JcrMetadataRepositoryTest.java b/archiva-modules/plugins/metadata-store-jcr/src/test/java/org/apache/archiva/metadata/repository/jcr/JcrMetadataRepositoryTest.java
index 0c6dedb44..9082a1fef 100644
--- a/archiva-modules/plugins/metadata-store-jcr/src/test/java/org/apache/archiva/metadata/repository/jcr/JcrMetadataRepositoryTest.java
+++ b/archiva-modules/plugins/metadata-store-jcr/src/test/java/org/apache/archiva/metadata/repository/jcr/JcrMetadataRepositoryTest.java
@@ -78,7 +78,7 @@ public class JcrMetadataRepositoryTest
Session session = jcrMetadataRepository.getJcrSession();
// set up namespaces, etc.
- JcrMetadataRepository.initialize( session );
+ JcrMetadataRepository.initializeNodeTypes( session );
// removing content is faster than deleting and re-copying the files from target/jcr
session.getRootNode().getNode( "repositories" ).remove();
diff --git a/archiva-modules/plugins/metadata-store-jcr/src/test/java/org/apache/archiva/metadata/repository/stats/JcrRepositoryStatisticsGatheringTest.java b/archiva-modules/plugins/metadata-store-jcr/src/test/java/org/apache/archiva/metadata/repository/stats/JcrRepositoryStatisticsGatheringTest.java
index 4978a0c91..55fb96b98 100644
--- a/archiva-modules/plugins/metadata-store-jcr/src/test/java/org/apache/archiva/metadata/repository/stats/JcrRepositoryStatisticsGatheringTest.java
+++ b/archiva-modules/plugins/metadata-store-jcr/src/test/java/org/apache/archiva/metadata/repository/stats/JcrRepositoryStatisticsGatheringTest.java
@@ -115,7 +115,7 @@ public class JcrRepositoryStatisticsGatheringTest
session = jcrMetadataRepository.getJcrSession();
// set up namespaces, etc.
- JcrMetadataRepository.initialize( session );
+ JcrMetadataRepository.initializeNodeTypes( session );
// removing content is faster than deleting and re-copying the files from target/jcr
session.getRootNode().getNode( "repositories" ).remove();
@@ -166,7 +166,7 @@ public class JcrRepositoryStatisticsGatheringTest
testedStatistics.setScanStartTime( startTime );
testedStatistics.setScanEndTime( endTime );
- repository.populateStatistics( repository, TEST_REPO, testedStatistics );
+ repository.populateStatistics( , repository, TEST_REPO, testedStatistics );
DefaultRepositoryStatistics expectedStatistics = new DefaultRepositoryStatistics();
expectedStatistics.setNewFileCount( NEW_FILE_COUNT );
diff --git a/archiva-modules/plugins/problem-reports/src/main/java/org/apache/archiva/reports/RepositoryProblemEventListener.java b/archiva-modules/plugins/problem-reports/src/main/java/org/apache/archiva/reports/RepositoryProblemEventListener.java
index 304866a24..64b067b76 100644
--- a/archiva-modules/plugins/problem-reports/src/main/java/org/apache/archiva/reports/RepositoryProblemEventListener.java
+++ b/archiva-modules/plugins/problem-reports/src/main/java/org/apache/archiva/reports/RepositoryProblemEventListener.java
@@ -49,7 +49,7 @@ public class RepositoryProblemEventListener
try
{
- metadataRepository.removeMetadataFacet( repositoryId, RepositoryProblemFacet.FACET_ID, name );
+ metadataRepository.removeMetadataFacet( , repositoryId, RepositoryProblemFacet.FACET_ID, name );
}
catch ( MetadataRepositoryException e )
{
@@ -67,7 +67,7 @@ public class RepositoryProblemEventListener
try
{
MetadataRepository metadataRepository = session.getRepository();
- metadataRepository.removeMetadataFacet( repoId, RepositoryProblemFacet.FACET_ID, name );
+ metadataRepository.removeMetadataFacet( , repoId, RepositoryProblemFacet.FACET_ID, name );
session.markDirty();
}
catch ( MetadataRepositoryException e )
@@ -91,7 +91,7 @@ public class RepositoryProblemEventListener
try
{
- session.getRepository().addMetadataFacet( repoId, problem );
+ session.getRepository().addMetadataFacet( , repoId, problem );
session.markDirty();
}
catch ( MetadataRepositoryException e )
diff --git a/archiva-modules/plugins/problem-reports/src/main/java/org/apache/archiva/reports/consumers/DuplicateArtifactsConsumer.java b/archiva-modules/plugins/problem-reports/src/main/java/org/apache/archiva/reports/consumers/DuplicateArtifactsConsumer.java
index 95c5ac3d2..dca503eb0 100644
--- a/archiva-modules/plugins/problem-reports/src/main/java/org/apache/archiva/reports/consumers/DuplicateArtifactsConsumer.java
+++ b/archiva-modules/plugins/problem-reports/src/main/java/org/apache/archiva/reports/consumers/DuplicateArtifactsConsumer.java
@@ -129,7 +129,14 @@ public class DuplicateArtifactsConsumer
{
repoId = repo.getId();
this.repositoryDir = Paths.get( repo.getLocation() );
- repositorySession = repositorySessionFactory.createSession();
+ try
+ {
+ repositorySession = repositorySessionFactory.createSession();
+ }
+ catch ( MetadataRepositoryException e )
+ {
+ e.printStackTrace( );
+ }
}
@Override
@@ -165,7 +172,7 @@ public class DuplicateArtifactsConsumer
Collection<ArtifactMetadata> results;
try
{
- results = metadataRepository.getArtifactsByChecksum( repoId, checksumSha1 );
+ results = metadataRepository.getArtifactsByChecksum( , repoId, checksumSha1 );
}
catch ( MetadataRepositoryException e )
{
@@ -217,7 +224,7 @@ public class DuplicateArtifactsConsumer
try
{
- metadataRepository.addMetadataFacet( repoId, problem );
+ metadataRepository.addMetadataFacet( , repoId, problem );
}
catch ( MetadataRepositoryException e )
{
diff --git a/archiva-modules/plugins/problem-reports/src/test/java/org/apache/archiva/reports/consumers/DuplicateArtifactsConsumerTest.java b/archiva-modules/plugins/problem-reports/src/test/java/org/apache/archiva/reports/consumers/DuplicateArtifactsConsumerTest.java
index 31c58c7e5..1dc1739c2 100644
--- a/archiva-modules/plugins/problem-reports/src/test/java/org/apache/archiva/reports/consumers/DuplicateArtifactsConsumerTest.java
+++ b/archiva-modules/plugins/problem-reports/src/test/java/org/apache/archiva/reports/consumers/DuplicateArtifactsConsumerTest.java
@@ -114,14 +114,14 @@ public class DuplicateArtifactsConsumerTest
public void testConsumerArtifactNotDuplicated()
throws Exception
{
- when( metadataRepository.getArtifactsByChecksum( TEST_REPO, TEST_CHECKSUM ) ).thenReturn(
+ when( metadataRepository.getArtifactsByChecksum( , TEST_REPO, TEST_CHECKSUM ) ).thenReturn(
Arrays.asList( TEST_METADATA ) );
consumer.beginScan( config, new Date() );
consumer.processFile( TEST_FILE );
consumer.completeScan();
- verify( metadataRepository, never() ).addMetadataFacet( eq( TEST_REPO ), Matchers.<MetadataFacet>anyObject() );
+ verify( metadataRepository, never() ).addMetadataFacet( , eq( TEST_REPO ), Matchers.<MetadataFacet>anyObject() );
}
// TODO: Doesn't currently work
@@ -142,7 +142,7 @@ public class DuplicateArtifactsConsumerTest
public void testConsumerArtifactDuplicated()
throws Exception
{
- when( metadataRepository.getArtifactsByChecksum( TEST_REPO, TEST_CHECKSUM ) ).thenReturn(
+ when( metadataRepository.getArtifactsByChecksum( , TEST_REPO, TEST_CHECKSUM ) ).thenReturn(
Arrays.asList( TEST_METADATA, createMetadata( "1.0" ) ) );
consumer.beginScan( config, new Date() );
@@ -150,7 +150,7 @@ public class DuplicateArtifactsConsumerTest
consumer.completeScan();
ArgumentCaptor<RepositoryProblemFacet> argument = ArgumentCaptor.forClass( RepositoryProblemFacet.class );
- verify( metadataRepository ).addMetadataFacet( eq( TEST_REPO ), argument.capture() );
+ verify( metadataRepository ).addMetadataFacet( , eq( TEST_REPO ), argument.capture() );
RepositoryProblemFacet problem = argument.getValue();
assertProblem( problem );
}
@@ -159,7 +159,7 @@ public class DuplicateArtifactsConsumerTest
public void testConsumerArtifactDuplicatedButSelfNotInMetadataRepository()
throws Exception
{
- when( metadataRepository.getArtifactsByChecksum( TEST_REPO, TEST_CHECKSUM ) ).thenReturn(
+ when( metadataRepository.getArtifactsByChecksum( , TEST_REPO, TEST_CHECKSUM ) ).thenReturn(
Arrays.asList( createMetadata( "1.0" ) ) );
consumer.beginScan( config, new Date() );
@@ -167,7 +167,7 @@ public class DuplicateArtifactsConsumerTest
consumer.completeScan();
ArgumentCaptor<RepositoryProblemFacet> argument = ArgumentCaptor.forClass( RepositoryProblemFacet.class );
- verify( metadataRepository ).addMetadataFacet( eq( TEST_REPO ), argument.capture() );
+ verify( metadataRepository ).addMetadataFacet( , eq( TEST_REPO ), argument.capture() );
RepositoryProblemFacet problem = argument.getValue();
assertProblem( problem );
}
@@ -191,7 +191,7 @@ public class DuplicateArtifactsConsumerTest
consumer.completeScan();
}
- verify( metadataRepository, never() ).addMetadataFacet( eq( TEST_REPO ), Matchers.<MetadataFacet>anyObject() );
+ verify( metadataRepository, never() ).addMetadataFacet( , eq( TEST_REPO ), Matchers.<MetadataFacet>anyObject() );
}
@Test
@@ -203,14 +203,14 @@ public class DuplicateArtifactsConsumerTest
consumer.processFile( "com/example/invalid-artifact.txt" );
consumer.completeScan();
- verify( metadataRepository, never() ).addMetadataFacet( eq( TEST_REPO ), Matchers.<MetadataFacet>anyObject() );
+ verify( metadataRepository, never() ).addMetadataFacet( , eq( TEST_REPO ), Matchers.<MetadataFacet>anyObject() );
}
@Test
public void testConsumerArtifactNotAnArtifactPathResults()
throws Exception
{
- when( metadataRepository.getArtifactsByChecksum( eq( TEST_REPO ), anyString() ) ).thenReturn(
+ when( metadataRepository.getArtifactsByChecksum( , eq( TEST_REPO ), anyString() ) ).thenReturn(
Arrays.asList( TEST_METADATA, createMetadata( "1.0" ) ) );
// override, this feels a little overspecified though
@@ -222,7 +222,7 @@ public class DuplicateArtifactsConsumerTest
consumer.processFile( "com/example/invalid-artifact.txt" );
consumer.completeScan();
- verify( metadataRepository, never() ).addMetadataFacet( eq( TEST_REPO ), Matchers.<MetadataFacet>anyObject() );
+ verify( metadataRepository, never() ).addMetadataFacet( , eq( TEST_REPO ), Matchers.<MetadataFacet>anyObject() );
}
private static void assertProblem( RepositoryProblemFacet problem )
diff --git a/archiva-modules/plugins/repository-statistics/src/main/java/org/apache/archiva/metadata/repository/stats/DefaultRepositoryStatisticsManager.java b/archiva-modules/plugins/repository-statistics/src/main/java/org/apache/archiva/metadata/repository/stats/DefaultRepositoryStatisticsManager.java
index 9611bbb67..698d887db 100644
--- a/archiva-modules/plugins/repository-statistics/src/main/java/org/apache/archiva/metadata/repository/stats/DefaultRepositoryStatisticsManager.java
+++ b/archiva-modules/plugins/repository-statistics/src/main/java/org/apache/archiva/metadata/repository/stats/DefaultRepositoryStatisticsManager.java
@@ -56,7 +56,7 @@ public class DefaultRepositoryStatisticsManager
public boolean hasStatistics( MetadataRepository metadataRepository, String repositoryId )
throws MetadataRepositoryException
{
- return metadataRepository.hasMetadataFacet( repositoryId, DefaultRepositoryStatistics.FACET_ID );
+ return metadataRepository.hasMetadataFacet( , repositoryId, DefaultRepositoryStatistics.FACET_ID );
}
@Override
@@ -66,7 +66,7 @@ public class DefaultRepositoryStatisticsManager
StopWatch stopWatch = new StopWatch();
stopWatch.start();
// TODO: consider a more efficient implementation that directly gets the last one from the content repository
- List<String> scans = metadataRepository.getMetadataFacets( repositoryId, DefaultRepositoryStatistics.FACET_ID );
+ List<String> scans = metadataRepository.getMetadataFacets( , repositoryId, DefaultRepositoryStatistics.FACET_ID );
if ( scans == null )
{
return null;
@@ -76,8 +76,8 @@ public class DefaultRepositoryStatisticsManager
{
String name = scans.get( scans.size() - 1 );
RepositoryStatistics repositoryStatistics =
- RepositoryStatistics.class.cast( metadataRepository.getMetadataFacet( repositoryId, RepositoryStatistics.FACET_ID,
- name ));
+ RepositoryStatistics.class.cast( metadataRepository.getMetadataFacet( , repositoryId,
+ RepositoryStatistics.FACET_ID, name ));
stopWatch.stop();
log.debug( "time to find last RepositoryStatistics: {} ms", stopWatch.getTime() );
return repositoryStatistics;
@@ -111,24 +111,24 @@ public class DefaultRepositoryStatisticsManager
if ( metadataRepository instanceof RepositoryStatisticsProvider)
{
- ((RepositoryStatisticsProvider)metadataRepository).populateStatistics( metadataRepository,
- repositoryId, repositoryStatistics);
+ ((RepositoryStatisticsProvider)metadataRepository).populateStatistics( ,
+ metadataRepository, repositoryId, repositoryStatistics );
}
else
{
- walkingProvider.populateStatistics( metadataRepository, repositoryId, repositoryStatistics );
+ walkingProvider.populateStatistics( , metadataRepository, repositoryId, repositoryStatistics );
}
log.info( "Gathering statistics executed in {} ms", ( System.currentTimeMillis() - startGather ) );
- metadataRepository.addMetadataFacet( repositoryId, repositoryStatistics );
+ metadataRepository.addMetadataFacet( , repositoryId, repositoryStatistics );
}
@Override
public void deleteStatistics( MetadataRepository metadataRepository, String repositoryId )
throws MetadataRepositoryException
{
- metadataRepository.removeMetadataFacets( repositoryId, DefaultRepositoryStatistics.FACET_ID );
+ metadataRepository.removeMetadataFacets( , repositoryId, DefaultRepositoryStatistics.FACET_ID );
}
@Override
@@ -137,7 +137,7 @@ public class DefaultRepositoryStatisticsManager
throws MetadataRepositoryException
{
List<RepositoryStatistics> results = new ArrayList<>();
- List<String> list = metadataRepository.getMetadataFacets( repositoryId, DefaultRepositoryStatistics.FACET_ID );
+ List<String> list = metadataRepository.getMetadataFacets( , repositoryId, DefaultRepositoryStatistics.FACET_ID );
Collections.sort( list, Collections.reverseOrder() );
for ( String name : list )
{
@@ -148,9 +148,9 @@ public class DefaultRepositoryStatisticsManager
endTime ) ) )
{
RepositoryStatistics stats =
- (RepositoryStatistics) metadataRepository.getMetadataFacet( repositoryId,
- DefaultRepositoryStatistics.FACET_ID,
- name );
+ (RepositoryStatistics) metadataRepository.getMetadataFacet( ,
+ repositoryId,
+ DefaultRepositoryStatistics.FACET_ID, name );
results.add( stats );
}
}
diff --git a/archiva-modules/plugins/repository-statistics/src/test/java/org/apache/archiva/metadata/repository/stats/RepositoryStatisticsManagerTest.java b/archiva-modules/plugins/repository-statistics/src/test/java/org/apache/archiva/metadata/repository/stats/RepositoryStatisticsManagerTest.java
index b0a1742e9..dfa185bc8 100644
--- a/archiva-modules/plugins/repository-statistics/src/test/java/org/apache/archiva/metadata/repository/stats/RepositoryStatisticsManagerTest.java
+++ b/archiva-modules/plugins/repository-statistics/src/test/java/org/apache/archiva/metadata/repository/stats/RepositoryStatisticsManagerTest.java
@@ -103,11 +103,11 @@ public class RepositoryStatisticsManagerTest
stats.setTotalFileCount( 56229 );
- expect( metadataRepository.getMetadataFacets( TEST_REPO_ID, DefaultRepositoryStatistics.FACET_ID ) ).andReturn(
+ expect( metadataRepository.getMetadataFacets( , TEST_REPO_ID, DefaultRepositoryStatistics.FACET_ID ) ).andReturn(
Arrays.asList( FIRST_TEST_SCAN, SECOND_TEST_SCAN ) );
- expect( metadataRepository.getMetadataFacet( TEST_REPO_ID, DefaultRepositoryStatistics.FACET_ID,
- SECOND_TEST_SCAN ) ).andReturn( stats );
+ expect( metadataRepository.getMetadataFacet( , TEST_REPO_ID,
+ DefaultRepositoryStatistics.FACET_ID, SECOND_TEST_SCAN ) ).andReturn( stats );
metadataRepositoryControl.replay();
@@ -131,7 +131,7 @@ public class RepositoryStatisticsManagerTest
throws Exception
{
- expect( metadataRepository.getMetadataFacets( TEST_REPO_ID, DefaultRepositoryStatistics.FACET_ID ) ).andReturn(
+ expect( metadataRepository.getMetadataFacets( , TEST_REPO_ID, DefaultRepositoryStatistics.FACET_ID ) ).andReturn(
Collections.<String>emptyList() );
metadataRepositoryControl.replay();
@@ -152,13 +152,13 @@ public class RepositoryStatisticsManagerTest
walkRepository( 1 );
- metadataRepository.addMetadataFacet( TEST_REPO_ID, stats );
+ metadataRepository.addMetadataFacet( , TEST_REPO_ID, stats );
- expect( metadataRepository.getMetadataFacets( TEST_REPO_ID, DefaultRepositoryStatistics.FACET_ID ) ).andReturn(
+ expect( metadataRepository.getMetadataFacets( , TEST_REPO_ID, DefaultRepositoryStatistics.FACET_ID ) ).andReturn(
Arrays.asList( stats.getName() ) );
- expect( metadataRepository.getMetadataFacet( TEST_REPO_ID, DefaultRepositoryStatistics.FACET_ID,
- stats.getName() ) ).andReturn( stats );
+ expect( metadataRepository.getMetadataFacet( , TEST_REPO_ID,
+ DefaultRepositoryStatistics.FACET_ID, stats.getName() ) ).andReturn( stats );
metadataRepositoryControl.replay();
@@ -189,21 +189,21 @@ public class RepositoryStatisticsManagerTest
Date startTime1 = new Date( current.getTime() - 12345 );
DefaultRepositoryStatistics stats1 = createTestStats( startTime1, new Date( current.getTime() - 6000 ) );
- metadataRepository.addMetadataFacet( TEST_REPO_ID, stats1 );
+ metadataRepository.addMetadataFacet( , TEST_REPO_ID, stats1 );
Date startTime2 = new Date( current.getTime() - 3000 );
DefaultRepositoryStatistics stats2 = createTestStats( startTime2, current );
- metadataRepository.addMetadataFacet( TEST_REPO_ID, stats2 );
+ metadataRepository.addMetadataFacet( , TEST_REPO_ID, stats2 );
- expect( metadataRepository.getMetadataFacets( TEST_REPO_ID, DefaultRepositoryStatistics.FACET_ID ) ).andReturn(
+ expect( metadataRepository.getMetadataFacets( , TEST_REPO_ID, DefaultRepositoryStatistics.FACET_ID ) ).andReturn(
Arrays.asList( stats1.getName(), stats2.getName() ) );
- expect( metadataRepository.getMetadataFacet( TEST_REPO_ID, DefaultRepositoryStatistics.FACET_ID,
- stats2.getName() ) ).andReturn( stats2 );
- metadataRepository.removeMetadataFacets( TEST_REPO_ID, DefaultRepositoryStatistics.FACET_ID );
+ expect( metadataRepository.getMetadataFacet( , TEST_REPO_ID,
+ DefaultRepositoryStatistics.FACET_ID, stats2.getName() ) ).andReturn( stats2 );
+ metadataRepository.removeMetadataFacets( , TEST_REPO_ID, DefaultRepositoryStatistics.FACET_ID );
- expect( metadataRepository.getMetadataFacets( TEST_REPO_ID, DefaultRepositoryStatistics.FACET_ID ) ).andReturn(
+ expect( metadataRepository.getMetadataFacets( , TEST_REPO_ID, DefaultRepositoryStatistics.FACET_ID ) ).andReturn(
Collections.<String>emptyList() );
metadataRepositoryControl.replay();
@@ -227,9 +227,9 @@ public class RepositoryStatisticsManagerTest
throws Exception
{
- expect( metadataRepository.getMetadataFacets( TEST_REPO_ID, DefaultRepositoryStatistics.FACET_ID ) ).andReturn(
+ expect( metadataRepository.getMetadataFacets( , TEST_REPO_ID, DefaultRepositoryStatistics.FACET_ID ) ).andReturn(
Collections.<String>emptyList() ).times( 2 );
- metadataRepository.removeMetadataFacets( TEST_REPO_ID, DefaultRepositoryStatistics.FACET_ID );
+ metadataRepository.removeMetadataFacets( , TEST_REPO_ID, DefaultRepositoryStatistics.FACET_ID );
metadataRepositoryControl.replay();
@@ -256,12 +256,12 @@ public class RepositoryStatisticsManagerTest
ArrayList<String> keys = new ArrayList<>( statsCreated.keySet() );
- expect( metadataRepository.getMetadataFacets( TEST_REPO_ID, DefaultRepositoryStatistics.FACET_ID ) ).andReturn( keys );
+ expect( metadataRepository.getMetadataFacets( , TEST_REPO_ID, DefaultRepositoryStatistics.FACET_ID ) ).andReturn( keys );
// only match the middle one
String key = keys.get( 1 );
- expect( metadataRepository.getMetadataFacet( TEST_REPO_ID, DefaultRepositoryStatistics.FACET_ID, key ) ).andReturn(
+ expect( metadataRepository.getMetadataFacet( , TEST_REPO_ID, DefaultRepositoryStatistics.FACET_ID, key ) ).andReturn(
statsCreated.get( key ) );
@@ -299,16 +299,16 @@ public class RepositoryStatisticsManagerTest
List<String> keys = new ArrayList<>( statsCreated.keySet() );
- expect( metadataRepository.getMetadataFacets( TEST_REPO_ID, DefaultRepositoryStatistics.FACET_ID ) ).andReturn( keys );
+ expect( metadataRepository.getMetadataFacets( , TEST_REPO_ID, DefaultRepositoryStatistics.FACET_ID ) ).andReturn( keys );
String key = keys.get( 1 );
- expect( metadataRepository.getMetadataFacet( TEST_REPO_ID, DefaultRepositoryStatistics.FACET_ID, key ) ).andReturn(
+ expect( metadataRepository.getMetadataFacet( , TEST_REPO_ID, DefaultRepositoryStatistics.FACET_ID, key ) ).andReturn(
statsCreated.get( key ) );
key = keys.get( 2 );
- expect( metadataRepository.getMetadataFacet( TEST_REPO_ID, DefaultRepositoryStatistics.FACET_ID, key ) ).andReturn(
+ expect( metadataRepository.getMetadataFacet( , TEST_REPO_ID, DefaultRepositoryStatistics.FACET_ID, key ) ).andReturn(
statsCreated.get( key ) );
@@ -346,15 +346,15 @@ public class RepositoryStatisticsManagerTest
List<String> keys = new ArrayList<>( statsCreated.keySet() );
- expect( metadataRepository.getMetadataFacets( TEST_REPO_ID, DefaultRepositoryStatistics.FACET_ID ) ).andReturn( keys );
+ expect( metadataRepository.getMetadataFacets( , TEST_REPO_ID, DefaultRepositoryStatistics.FACET_ID ) ).andReturn( keys );
String key = keys.get( 0 );
- expect( metadataRepository.getMetadataFacet( TEST_REPO_ID, DefaultRepositoryStatistics.FACET_ID, key ) ).andReturn(
+ expect( metadataRepository.getMetadataFacet( , TEST_REPO_ID, DefaultRepositoryStatistics.FACET_ID, key ) ).andReturn(
statsCreated.get( key ) );
key = keys.get( 1 );
- expect( metadataRepository.getMetadataFacet( TEST_REPO_ID, DefaultRepositoryStatistics.FACET_ID, key ) ).andReturn(
+ expect( metadataRepository.getMetadataFacet( , TEST_REPO_ID, DefaultRepositoryStatistics.FACET_ID, key ) ).andReturn(
statsCreated.get( key ) );
metadataRepositoryControl.replay();
@@ -392,19 +392,19 @@ public class RepositoryStatisticsManagerTest
ArrayList<String> keys = new ArrayList<>( statsCreated.keySet() );
- expect( metadataRepository.getMetadataFacets( TEST_REPO_ID, DefaultRepositoryStatistics.FACET_ID ) ).andReturn( keys );
+ expect( metadataRepository.getMetadataFacets( , TEST_REPO_ID, DefaultRepositoryStatistics.FACET_ID ) ).andReturn( keys );
String key = keys.get( 0 );
- expect( metadataRepository.getMetadataFacet( TEST_REPO_ID, DefaultRepositoryStatistics.FACET_ID, key ) ).andReturn(
+ expect( metadataRepository.getMetadataFacet( , TEST_REPO_ID, DefaultRepositoryStatistics.FACET_ID, key ) ).andReturn(
statsCreated.get( key ) );
key = keys.get( 1 );
- expect( metadataRepository.getMetadataFacet( TEST_REPO_ID, DefaultRepositoryStatistics.FACET_ID, key ) ).andReturn(
+ expect( metadataRepository.getMetadataFacet( , TEST_REPO_ID, DefaultRepositoryStatistics.FACET_ID, key ) ).andReturn(
statsCreated.get( key ) );
key = keys.get( 2 );
- expect( metadataRepository.getMetadataFacet( TEST_REPO_ID, DefaultRepositoryStatistics.FACET_ID, key ) ).andReturn(
+ expect( metadataRepository.getMetadataFacet( , TEST_REPO_ID, DefaultRepositoryStatistics.FACET_ID, key ) ).andReturn(
statsCreated.get( key ) );
metadataRepositoryControl.replay();
@@ -442,7 +442,7 @@ public class RepositoryStatisticsManagerTest
ArrayList<String> keys = new ArrayList<>( statsCreated.keySet() );
- expect( metadataRepository.getMetadataFacets( TEST_REPO_ID, DefaultRepositoryStatistics.FACET_ID ) ).andReturn( keys );
+ expect( metadataRepository.getMetadataFacets( , TEST_REPO_ID, DefaultRepositoryStatistics.FACET_ID ) ).andReturn( keys );
metadataRepositoryControl.replay();
@@ -467,7 +467,7 @@ public class RepositoryStatisticsManagerTest
throws Exception
{
DefaultRepositoryStatistics stats = createTestStats( startTime, endTime );
- metadataRepository.addMetadataFacet( TEST_REPO_ID, stats );
+ metadataRepository.addMetadataFacet( , TEST_REPO_ID, stats );
statsCreated.put( stats.getName(), stats );
}
@@ -512,104 +512,104 @@ public class RepositoryStatisticsManagerTest
for ( int i = 0; i < count; i++ )
{
- expect( metadataRepository.getRootNamespaces( TEST_REPO_ID ) ).andReturn( Arrays.asList( "com", "org" ) );
+ expect( metadataRepository.getRootNamespaces( , TEST_REPO_ID ) ).andReturn( Arrays.asList( "com", "org" ) );
- expect( metadataRepository.getProjects( TEST_REPO_ID, "com" ) ).andReturn( Arrays.<String>asList() );
+ expect( metadataRepository.getProjects( , TEST_REPO_ID, "com" ) ).andReturn( Arrays.<String>asList() );
- expect( metadataRepository.getNamespaces( TEST_REPO_ID, "com" ) ).andReturn( Arrays.asList( "example" ) );
+ expect( metadataRepository.getNamespaces( , TEST_REPO_ID, "com" ) ).andReturn( Arrays.asList( "example" ) );
- expect( metadataRepository.getNamespaces( TEST_REPO_ID, "com.example" ) ).andReturn(
+ expect( metadataRepository.getNamespaces( , TEST_REPO_ID, "com.example" ) ).andReturn(
Arrays.<String>asList() );
- expect( metadataRepository.getProjects( TEST_REPO_ID, "com.example" ) ).andReturn(
+ expect( metadataRepository.getProjects( , TEST_REPO_ID, "com.example" ) ).andReturn(
Arrays.asList( "example-project" ) );
- expect( metadataRepository.getProjectVersions( TEST_REPO_ID, "com.example", "example-project" ) ).andReturn(
+ expect( metadataRepository.getProjectVersions( , TEST_REPO_ID, "com.example", "example-project" ) ).andReturn(
Arrays.asList( "1.0", "1.1" ) );
expect(
- metadataRepository.getArtifacts( TEST_REPO_ID, "com.example", "example-project", "1.0" ) ).andReturn(
+ metadataRepository.getArtifacts( , TEST_REPO_ID, "com.example", "example-project", "1.0" ) ).andReturn(
Arrays.asList( createArtifact( "com.example", "example-project", "1.0", "jar" ),
createArtifact( "com.example", "example-project", "1.0", "pom" ) ) );
expect(
- metadataRepository.getArtifacts( TEST_REPO_ID, "com.example", "example-project", "1.1" ) ).andReturn(
+ metadataRepository.getArtifacts( , TEST_REPO_ID, "com.example", "example-project", "1.1" ) ).andReturn(
Arrays.asList( createArtifact( "com.example", "example-project", "1.1", "jar" ),
createArtifact( "com.example", "example-project", "1.1", "pom" ) ) );
- expect( metadataRepository.getNamespaces( TEST_REPO_ID, "org" ) ).andReturn( Arrays.asList( "apache", "codehaus" ) );
+ expect( metadataRepository.getNamespaces( , TEST_REPO_ID, "org" ) ).andReturn( Arrays.asList( "apache", "codehaus" ) );
- expect( metadataRepository.getNamespaces( TEST_REPO_ID, "org.apache" ) ).andReturn( Arrays.asList( "archiva", "maven" ) );
+ expect( metadataRepository.getNamespaces( , TEST_REPO_ID, "org.apache" ) ).andReturn( Arrays.asList( "archiva", "maven" ) );
- expect( metadataRepository.getProjects( TEST_REPO_ID, "org.apache" ) ).andReturn( Arrays.<String>asList() );
+ expect( metadataRepository.getProjects( , TEST_REPO_ID, "org.apache" ) ).andReturn( Arrays.<String>asList() );
- expect( metadataRepository.getNamespaces( TEST_REPO_ID, "org.apache.archiva" ) ).andReturn( Arrays.<String>asList() );
+ expect( metadataRepository.getNamespaces( , TEST_REPO_ID, "org.apache.archiva" ) ).andReturn( Arrays.<String>asList() );
- expect( metadataRepository.getProjects( TEST_REPO_ID, "org.apache.archiva" ) ).andReturn( Arrays.asList( "metadata-repository-api", "metadata-model" ) );
+ expect( metadataRepository.getProjects( , TEST_REPO_ID, "org.apache.archiva" ) ).andReturn( Arrays.asList( "metadata-repository-api", "metadata-model" ) );
- expect( metadataRepository.getProjectVersions( TEST_REPO_ID, "org.apache.archiva", "metadata-repository-api" ) )
+ expect( metadataRepository.getProjectVersions( , TEST_REPO_ID, "org.apache.archiva", "metadata-repository-api" ) )
.andReturn( Arrays.asList( "1.3-SNAPSHOT", "1.3" ) );
- expect( metadataRepository.getArtifacts( TEST_REPO_ID, "org.apache.archiva", "metadata-repository-api", "1.3-SNAPSHOT" ) )
+ expect( metadataRepository.getArtifacts( , TEST_REPO_ID, "org.apache.archiva", "metadata-repository-api", "1.3-SNAPSHOT" ) )
.andReturn( Arrays.asList( createArtifact( "org.apache.archiva", "metadata-repository-api", "1.3-SNAPSHOT", "jar" ),
createArtifact( "org.apache.archiva", "metadata-repository-api", "1.3-SNAPSHOT",
"pom" ) ) );
- expect( metadataRepository.getArtifacts( TEST_REPO_ID, "org.apache.archiva", "metadata-repository-api", "1.3" ) )
+ expect( metadataRepository.getArtifacts( , TEST_REPO_ID, "org.apache.archiva", "metadata-repository-api", "1.3" ) )
.andReturn( Arrays.asList( createArtifact( "org.apache.archiva", "metadata-repository-api", "1.3", "jar" ),
createArtifact( "org.apache.archiva", "metadata-repository-api", "1.3", "pom" ) ) );
- expect( metadataRepository.getProjectVersions( TEST_REPO_ID, "org.apache.archiva", "metadata-model" ) )
+ expect( metadataRepository.getProjectVersions( , TEST_REPO_ID, "org.apache.archiva", "metadata-model" ) )
.andReturn( Arrays.asList( "1.3-SNAPSHOT", "1.3" ) );
- expect( metadataRepository.getArtifacts( TEST_REPO_ID, "org.apache.archiva", "metadata-model", "1.3-SNAPSHOT" ) )
+ expect( metadataRepository.getArtifacts( , TEST_REPO_ID, "org.apache.archiva", "metadata-model", "1.3-SNAPSHOT" ) )
.andReturn( Arrays.asList( createArtifact( "org.apache.archiva", "metadata-model", "1.3-SNAPSHOT", "jar" ),
createArtifact( "org.apache.archiva", "metadata-model", "1.3-SNAPSHOT", "pom" ) ) );
- expect( metadataRepository.getArtifacts( TEST_REPO_ID, "org.apache.archiva", "metadata-model", "1.3" ) )
+ expect( metadataRepository.getArtifacts( , TEST_REPO_ID, "org.apache.archiva", "metadata-model", "1.3" ) )
.andReturn( Arrays.asList( createArtifact( "org.apache.archiva", "metadata-model", "1.3", "jar" ),
createArtifact( "org.apache.archiva", "metadata-model", "1.3", "pom" ) ) );
- expect( metadataRepository.getNamespaces( TEST_REPO_ID, "org.apache.maven" ) ).andReturn( Arrays.<String>asList() );
+ expect( metadataRepository.getNamespaces( , TEST_REPO_ID, "org.apache.maven" ) ).andReturn( Arrays.<String>asList() );
- expect( metadataRepository.getProjects( TEST_REPO_ID, "org.apache.maven" ) )
+ expect( metadataRepository.getProjects( , TEST_REPO_ID, "org.apache.maven" ) )
.andReturn( Arrays.asList( "maven-model" ) );
- expect( metadataRepository.getProjectVersions( TEST_REPO_ID, "org.apache.maven", "maven-model" ) )
+ expect( metadataRepository.getProjectVersions( , TEST_REPO_ID, "org.apache.maven", "maven-model" ) )
.andReturn( Arrays.asList( "2.2.1" ) );
- expect( metadataRepository.getArtifacts( TEST_REPO_ID, "org.apache.maven", "maven-model", "2.2.1" ) )
+ expect( metadataRepository.getArtifacts( , TEST_REPO_ID, "org.apache.maven", "maven-model", "2.2.1" ) )
.andReturn( Arrays.asList( createArtifact( "org.apache.archiva", "maven-model", "2.2.1", "jar" ),
createArtifact( "org.apache.archiva", "maven-model", "2.2.1", "pom" ) ) );
- expect( metadataRepository.getNamespaces( TEST_REPO_ID, "org.codehaus" ) ).andReturn( Arrays.asList( "plexus" ) );
+ expect( metadataRepository.getNamespaces( , TEST_REPO_ID, "org.codehaus" ) ).andReturn( Arrays.asList( "plexus" ) );
- expect( metadataRepository.getProjects( TEST_REPO_ID, "org" ) ).andReturn( Arrays.<String>asList( ) );
+ expect( metadataRepository.getProjects( , TEST_REPO_ID, "org" ) ).andReturn( Arrays.<String>asList( ) );
- expect( metadataRepository.getProjects( TEST_REPO_ID, "org.codehaus" ) )
+ expect( metadataRepository.getProjects( , TEST_REPO_ID, "org.codehaus" ) )
.andReturn( Arrays.<String>asList( ) );
- expect( metadataRepository.getNamespaces( TEST_REPO_ID, "org.codehaus.plexus" ) )
+ expect( metadataRepository.getNamespaces( , TEST_REPO_ID, "org.codehaus.plexus" ) )
.andReturn( Arrays.<String>asList( ) );
- expect( metadataRepository.getProjects( TEST_REPO_ID, "org.codehaus.plexus" ) )
+ expect( metadataRepository.getProjects( , TEST_REPO_ID, "org.codehaus.plexus" ) )
.andReturn( Arrays.asList( "plexus-spring" ) );
- expect( metadataRepository.getProjectVersions( TEST_REPO_ID, "org.codehaus.plexus", "plexus-spring" ) )
+ expect( metadataRepository.getProjectVersions( , TEST_REPO_ID, "org.codehaus.plexus", "plexus-spring" ) )
.andReturn( Arrays.asList( "1.0", "1.1", "1.2" ) );
- expect( metadataRepository.getArtifacts( TEST_REPO_ID, "org.codehaus.plexus", "plexus-spring", "1.0" ) )
+ expect( metadataRepository.getArtifacts( , TEST_REPO_ID, "org.codehaus.plexus", "plexus-spring", "1.0" ) )
.andReturn( Arrays.asList( createArtifact( "org.codehaus.plexus", "plexus-spring", "1.0", "jar" ),
createArtifact( "org.codehaus.plexus", "plexus-spring", "1.0", "pom" ) ) );
- expect( metadataRepository.getArtifacts( TEST_REPO_ID, "org.codehaus.plexus", "plexus-spring", "1.1" ) )
+ expect( metadataRepository.getArtifacts( , TEST_REPO_ID, "org.codehaus.plexus", "plexus-spring", "1.1" ) )
.andReturn( Arrays.asList( createArtifact( "org.codehaus.plexus", "plexus-spring", "1.1", "jar" ),
createArtifact( "org.codehaus.plexus", "plexus-spring", "1.1", "pom" ) ) );
- expect( metadataRepository.getArtifacts( TEST_REPO_ID, "org.codehaus.plexus", "plexus-spring", "1.2" ) )
+ expect( metadataRepository.getArtifacts( , TEST_REPO_ID, "org.codehaus.plexus", "plexus-spring", "1.2" ) )
.andReturn( Arrays.asList( createArtifact( "org.codehaus.plexus", "plexus-spring", "1.2", "jar" ),
createArtifact( "org.codehaus.plexus", "plexus-spring", "1.2", "pom" ) ) );
}
diff --git a/archiva-modules/plugins/stage-repository-merge/src/main/java/org/apache/archiva/stagerepository/merge/Maven2RepositoryMerger.java b/archiva-modules/plugins/stage-repository-merge/src/main/java/org/apache/archiva/stagerepository/merge/Maven2RepositoryMerger.java
index 0b427fd05..19c5333b1 100644
--- a/archiva-modules/plugins/stage-repository-merge/src/main/java/org/apache/archiva/stagerepository/merge/Maven2RepositoryMerger.java
+++ b/archiva-modules/plugins/stage-repository-merge/src/main/java/org/apache/archiva/stagerepository/merge/Maven2RepositoryMerger.java
@@ -103,7 +103,7 @@ public class Maven2RepositoryMerger
try
{
- List<ArtifactMetadata> artifactsInSourceRepo = metadataRepository.getArtifacts( sourceRepoId );
+ List<ArtifactMetadata> artifactsInSourceRepo = metadataRepository.getArtifacts( , sourceRepoId );
for ( ArtifactMetadata artifactMetadata : artifactsInSourceRepo )
{
artifactMetadata.setRepositoryId( targetRepoId );
@@ -132,7 +132,7 @@ public class Maven2RepositoryMerger
{
try
{
- List<ArtifactMetadata> sourceArtifacts = metadataRepository.getArtifacts( sourceRepoId );
+ List<ArtifactMetadata> sourceArtifacts = metadataRepository.getArtifacts( , sourceRepoId );
for ( ArtifactMetadata metadata : sourceArtifacts )
{
if ( filter.accept( metadata ) )
@@ -399,9 +399,9 @@ public class Maven2RepositoryMerger
try
{
TreeSet<ArtifactMetadata> targetArtifacts = new TreeSet<>(META_COMPARATOR);
- targetArtifacts.addAll(metadataRepository.getArtifacts(targetRepo));
+ targetArtifacts.addAll(metadataRepository.getArtifacts( , targetRepo ));
TreeSet<ArtifactMetadata> sourceArtifacts = new TreeSet<>(META_COMPARATOR);
- sourceArtifacts.addAll(metadataRepository.getArtifacts(sourceRepo));
+ sourceArtifacts.addAll(metadataRepository.getArtifacts( , sourceRepo ));
sourceArtifacts.retainAll(targetArtifacts);
return new ArrayList<>(sourceArtifacts);
diff --git a/archiva-modules/plugins/stage-repository-merge/src/test/java/org/apache/archiva/stagerepository/merge/Maven2RepositoryMergerTest.java b/archiva-modules/plugins/stage-repository-merge/src/test/java/org/apache/archiva/stagerepository/merge/Maven2RepositoryMergerTest.java
index 5626f991e..facc184a2 100644
--- a/archiva-modules/plugins/stage-repository-merge/src/test/java/org/apache/archiva/stagerepository/merge/Maven2RepositoryMergerTest.java
+++ b/archiva-modules/plugins/stage-repository-merge/src/test/java/org/apache/archiva/stagerepository/merge/Maven2RepositoryMergerTest.java
@@ -120,9 +120,9 @@ public class Maven2RepositoryMergerTest
c.addManagedRepository( targetRepo );
configuration.save( c );
- when( metadataRepository.getArtifacts( TEST_REPO_ID ) ).thenReturn( getArtifacts() );
+ when( metadataRepository.getArtifacts( , TEST_REPO_ID ) ).thenReturn( getArtifacts() );
repositoryMerger.merge( metadataRepository, TEST_REPO_ID, "target-rep" );
- verify( metadataRepository ).getArtifacts( TEST_REPO_ID );
+ verify( metadataRepository ).getArtifacts( , TEST_REPO_ID );
assertTrue( Files.exists(mergedArtifact) );
assertTrue( Files.exists(mavenMetadata) );
assertTrue( Files.exists(pom) );
@@ -169,12 +169,12 @@ public class Maven2RepositoryMergerTest
"/target/test-repository/com/example/test/test-artifact/1.0-SNAPSHOT/test-artifact-1.0-20100308.230825-1.jar" );
targetRepoFile.toFile().setReadOnly();
- when( metadataRepository.getArtifacts( sourceRepoId ) ).thenReturn( sourceRepoArtifactsList );
- when( metadataRepository.getArtifacts( TEST_REPO_ID ) ).thenReturn( targetRepoArtifactsList );
+ when( metadataRepository.getArtifacts( , sourceRepoId ) ).thenReturn( sourceRepoArtifactsList );
+ when( metadataRepository.getArtifacts( , TEST_REPO_ID ) ).thenReturn( targetRepoArtifactsList );
assertEquals( 1, repositoryMerger.getConflictingArtifacts( metadataRepository, sourceRepoId,
TEST_REPO_ID ).size() );
- verify( metadataRepository ).getArtifacts( TEST_REPO_ID );
+ verify( metadataRepository ).getArtifacts( , TEST_REPO_ID );
}
} \ No newline at end of file