]> source.dussan.org Git - archiva.git/commitdiff
[MRM-1504] Add a new module for repository administration management
authorOlivier Lamy <olamy@apache.org>
Tue, 13 Sep 2011 12:12:39 +0000 (12:12 +0000)
committerOlivier Lamy <olamy@apache.org>
Tue, 13 Sep 2011 12:12:39 +0000 (12:12 +0000)
split the repo admin in two modules : api and default implementation (to be able to more easily change the impl).
Use the repo admin api consumers and indexing modules.

git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1170135 13f79535-47bb-0310-9956-ffa450edef68

347 files changed:
.gitignore
archiva-cli/src/main/java/org/apache/maven/archiva/cli/AbstractProgressConsumer.java
archiva-cli/src/main/java/org/apache/maven/archiva/cli/ArchivaCli.java
archiva-modules/archiva-base/archiva-common/src/main/java/org/apache/maven/archiva/common/FileTypeUtils.java [new file with mode: 0644]
archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/FileTypes.java
archiva-modules/archiva-base/archiva-consumers/archiva-consumer-api/pom.xml
archiva-modules/archiva-base/archiva-consumers/archiva-consumer-api/src/main/java/org/apache/maven/archiva/consumers/AbstractMonitoredConsumer.java
archiva-modules/archiva-base/archiva-consumers/archiva-consumer-api/src/main/java/org/apache/maven/archiva/consumers/InvalidRepositoryContentConsumer.java
archiva-modules/archiva-base/archiva-consumers/archiva-consumer-api/src/main/java/org/apache/maven/archiva/consumers/RepositoryContentConsumer.java
archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/pom.xml
archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/ArtifactMissingChecksumsConsumer.java
archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/AutoRemoveConsumer.java
archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/AutoRenameConsumer.java
archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/MetadataUpdaterConsumer.java
archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/ValidateChecksumConsumer.java
archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/repository/CleanupReleasedSnapshotsRepositoryPurge.java
archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/repository/RepositoryPurgeConsumer.java
archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/archiva/metadata/repository/TestMetadataRepository.java [new file with mode: 0644]
archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/archiva/metadata/repository/TestRepositorySessionFactory.java
archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/maven/archiva/consumers/core/ArtifactMissingChecksumsConsumerTest.java
archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/maven/archiva/consumers/core/repository/AbstractRepositoryPurgeTest.java
archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/maven/archiva/consumers/core/repository/CleanupReleasedSnapshotsRepositoryPurgeTest.java
archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/maven/archiva/consumers/core/repository/DaysOldRepositoryPurgeTest.java
archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/maven/archiva/consumers/core/repository/RepositoryPurgeConsumerTest.java
archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/maven/archiva/consumers/core/repository/RetentionCountRepositoryPurgeTest.java
archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/resources/META-INF/redback/redback-core.xml [new file with mode: 0644]
archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/resources/META-INF/spring-context.xml [new file with mode: 0644]
archiva-modules/archiva-base/archiva-consumers/archiva-lucene-consumers/src/main/java/org/apache/archiva/consumers/lucene/NexusIndexerConsumer.java
archiva-modules/archiva-base/archiva-consumers/archiva-lucene-consumers/src/test/java/org/apache/archiva/consumers/lucene/NexusIndexerConsumerTest.java
archiva-modules/archiva-base/archiva-consumers/archiva-metadata-consumer/src/main/java/org/apache/archiva/consumers/metadata/ArchivaMetadataCreationConsumer.java
archiva-modules/archiva-base/archiva-converter/src/main/java/org/apache/maven/archiva/converter/legacy/DefaultLegacyRepositoryConverter.java
archiva-modules/archiva-base/archiva-converter/src/main/java/org/apache/maven/archiva/converter/legacy/LegacyConverterArtifactConsumer.java
archiva-modules/archiva-base/archiva-converter/src/test/java/org/apache/maven/archiva/converter/mock/MockArchivaAdministration.java [new file with mode: 0644]
archiva-modules/archiva-base/archiva-converter/src/test/resources/spring-context.xml
archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/search/NexusRepositorySearch.java
archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/search/SearchResultHit.java
archiva-modules/archiva-base/archiva-proxy/pom.xml
archiva-modules/archiva-base/archiva-proxy/src/main/java/org/apache/maven/archiva/proxy/DefaultRepositoryProxyConnectors.java
archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/maven/archiva/proxy/AbstractProxyTestCase.java
archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/maven/archiva/proxy/HttpProxyTransferTest.java
archiva-modules/archiva-base/archiva-proxy/src/test/resources/META-INF/redback/redback-core.xml [new file with mode: 0644]
archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-api/pom.xml [new file with mode: 0644]
archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-api/src/main/java/org/apache/archiva/admin/model/AbstractRepository.java [new file with mode: 0644]
archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-api/src/main/java/org/apache/archiva/admin/model/AbstractRepositoryConnector.java [new file with mode: 0644]
archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-api/src/main/java/org/apache/archiva/admin/model/AuditInformation.java [new file with mode: 0644]
archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-api/src/main/java/org/apache/archiva/admin/model/RepositoryAdminException.java [new file with mode: 0644]
archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-api/src/main/java/org/apache/archiva/admin/model/admin/ArchivaAdministration.java [new file with mode: 0644]
archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-api/src/main/java/org/apache/archiva/admin/model/admin/FileType.java [new file with mode: 0644]
archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-api/src/main/java/org/apache/archiva/admin/model/admin/LegacyArtifactPath.java [new file with mode: 0644]
archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-api/src/main/java/org/apache/archiva/admin/model/admin/OrganisationInformation.java [new file with mode: 0644]
archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-api/src/main/java/org/apache/archiva/admin/model/group/RepositoryGroup.java [new file with mode: 0644]
archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-api/src/main/java/org/apache/archiva/admin/model/group/RepositoryGroupAdmin.java [new file with mode: 0644]
archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-api/src/main/java/org/apache/archiva/admin/model/managed/ManagedRepository.java [new file with mode: 0644]
archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-api/src/main/java/org/apache/archiva/admin/model/managed/ManagedRepositoryAdmin.java [new file with mode: 0644]
archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-api/src/main/java/org/apache/archiva/admin/model/networkproxy/NetworkProxy.java [new file with mode: 0644]
archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-api/src/main/java/org/apache/archiva/admin/model/networkproxy/NetworkProxyAdmin.java [new file with mode: 0644]
archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-api/src/main/java/org/apache/archiva/admin/model/proxyconnector/ProxyConnector.java [new file with mode: 0644]
archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-api/src/main/java/org/apache/archiva/admin/model/proxyconnector/ProxyConnectorAdmin.java [new file with mode: 0644]
archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-api/src/main/java/org/apache/archiva/admin/model/proxyconnector/ProxyConnectorOrderComparator.java [new file with mode: 0644]
archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-api/src/main/java/org/apache/archiva/admin/model/proxyconnector/ProxyConnectorSelectionPredicate.java [new file with mode: 0644]
archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-api/src/main/java/org/apache/archiva/admin/model/remote/RemoteRepository.java [new file with mode: 0644]
archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-api/src/main/java/org/apache/archiva/admin/model/remote/RemoteRepositoryAdmin.java [new file with mode: 0644]
archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/pom.xml [new file with mode: 0644]
archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/AbstractRepositoryAdmin.java [new file with mode: 0644]
archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/RepositoryCommonValidator.java [new file with mode: 0644]
archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/admin/DefaultArchivaAdministration.java [new file with mode: 0644]
archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/admin/FiletypeToMapClosure.java [new file with mode: 0644]
archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/group/DefaultRepositoryGroupAdmin.java [new file with mode: 0644]
archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/managed/DefaultManagedRepositoryAdmin.java [new file with mode: 0644]
archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/networkproxy/DefaultNetworkProxyAdmin.java [new file with mode: 0644]
archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/proxyconnector/DefaultProxyConnectorAdmin.java [new file with mode: 0644]
archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/remote/DefaultRemoteRepositoryAdmin.java [new file with mode: 0644]
archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/utils/RepositoryComparator.java [new file with mode: 0644]
archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/resources/META-INF/spring-context.xml [new file with mode: 0644]
archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/test/java/org/apache/archiva/admin/mock/MockAuditListener.java [new file with mode: 0644]
archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/test/java/org/apache/archiva/admin/repository/AbstractRepositoryAdminTest.java [new file with mode: 0644]
archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/test/java/org/apache/archiva/admin/repository/admin/ArchivaAdministrationTest.java [new file with mode: 0644]
archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/test/java/org/apache/archiva/admin/repository/group/RepositoryGroupAdminTest.java [new file with mode: 0644]
archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/test/java/org/apache/archiva/admin/repository/managed/ManagedRepositoryAdminTest.java [new file with mode: 0644]
archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/test/java/org/apache/archiva/admin/repository/networkproxy/NetworkProxyAdminTest.java [new file with mode: 0644]
archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/test/java/org/apache/archiva/admin/repository/proxyconnector/ProxyConnectorAdminTest.java [new file with mode: 0644]
archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/test/java/org/apache/archiva/admin/repository/remote/RemoteRepositoryAdminTest.java [new file with mode: 0644]
archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/test/resources/META-INF/redback/redback-core.xml [new file with mode: 0644]
archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/test/resources/log4j.xml [new file with mode: 0644]
archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/test/resources/spring-context.xml [new file with mode: 0644]
archiva-modules/archiva-base/archiva-repository-admin/pom.xml
archiva-modules/archiva-base/archiva-repository-admin/src/main/java/org/apache/archiva/admin/AuditInformation.java [deleted file]
archiva-modules/archiva-base/archiva-repository-admin/src/main/java/org/apache/archiva/admin/repository/AbstractRepository.java [deleted file]
archiva-modules/archiva-base/archiva-repository-admin/src/main/java/org/apache/archiva/admin/repository/AbstractRepositoryAdmin.java [deleted file]
archiva-modules/archiva-base/archiva-repository-admin/src/main/java/org/apache/archiva/admin/repository/AbstractRepositoryConnector.java [deleted file]
archiva-modules/archiva-base/archiva-repository-admin/src/main/java/org/apache/archiva/admin/repository/RepositoryAdminException.java [deleted file]
archiva-modules/archiva-base/archiva-repository-admin/src/main/java/org/apache/archiva/admin/repository/RepositoryCommonValidator.java [deleted file]
archiva-modules/archiva-base/archiva-repository-admin/src/main/java/org/apache/archiva/admin/repository/admin/ArchivaAdministration.java [deleted file]
archiva-modules/archiva-base/archiva-repository-admin/src/main/java/org/apache/archiva/admin/repository/admin/DefaultArchivaAdministration.java [deleted file]
archiva-modules/archiva-base/archiva-repository-admin/src/main/java/org/apache/archiva/admin/repository/admin/FileType.java [deleted file]
archiva-modules/archiva-base/archiva-repository-admin/src/main/java/org/apache/archiva/admin/repository/admin/FiletypeToMapClosure.java [deleted file]
archiva-modules/archiva-base/archiva-repository-admin/src/main/java/org/apache/archiva/admin/repository/admin/LegacyArtifactPath.java [deleted file]
archiva-modules/archiva-base/archiva-repository-admin/src/main/java/org/apache/archiva/admin/repository/admin/OrganisationInformation.java [deleted file]
archiva-modules/archiva-base/archiva-repository-admin/src/main/java/org/apache/archiva/admin/repository/group/DefaultRepositoryGroupAdmin.java [deleted file]
archiva-modules/archiva-base/archiva-repository-admin/src/main/java/org/apache/archiva/admin/repository/group/RepositoryGroup.java [deleted file]
archiva-modules/archiva-base/archiva-repository-admin/src/main/java/org/apache/archiva/admin/repository/group/RepositoryGroupAdmin.java [deleted file]
archiva-modules/archiva-base/archiva-repository-admin/src/main/java/org/apache/archiva/admin/repository/managed/DefaultManagedRepositoryAdmin.java [deleted file]
archiva-modules/archiva-base/archiva-repository-admin/src/main/java/org/apache/archiva/admin/repository/managed/ManagedRepository.java [deleted file]
archiva-modules/archiva-base/archiva-repository-admin/src/main/java/org/apache/archiva/admin/repository/managed/ManagedRepositoryAdmin.java [deleted file]
archiva-modules/archiva-base/archiva-repository-admin/src/main/java/org/apache/archiva/admin/repository/networkproxy/DefaultNetworkProxyAdmin.java [deleted file]
archiva-modules/archiva-base/archiva-repository-admin/src/main/java/org/apache/archiva/admin/repository/networkproxy/NetworkProxy.java [deleted file]
archiva-modules/archiva-base/archiva-repository-admin/src/main/java/org/apache/archiva/admin/repository/networkproxy/NetworkProxyAdmin.java [deleted file]
archiva-modules/archiva-base/archiva-repository-admin/src/main/java/org/apache/archiva/admin/repository/proxyconnector/DefaultProxyConnectorAdmin.java [deleted file]
archiva-modules/archiva-base/archiva-repository-admin/src/main/java/org/apache/archiva/admin/repository/proxyconnector/ProxyConnector.java [deleted file]
archiva-modules/archiva-base/archiva-repository-admin/src/main/java/org/apache/archiva/admin/repository/proxyconnector/ProxyConnectorAdmin.java [deleted file]
archiva-modules/archiva-base/archiva-repository-admin/src/main/java/org/apache/archiva/admin/repository/proxyconnector/ProxyConnectorOrderComparator.java [deleted file]
archiva-modules/archiva-base/archiva-repository-admin/src/main/java/org/apache/archiva/admin/repository/proxyconnector/ProxyConnectorSelectionPredicate.java [deleted file]
archiva-modules/archiva-base/archiva-repository-admin/src/main/java/org/apache/archiva/admin/repository/remote/DefaultRemoteRepositoryAdmin.java [deleted file]
archiva-modules/archiva-base/archiva-repository-admin/src/main/java/org/apache/archiva/admin/repository/remote/RemoteRepository.java [deleted file]
archiva-modules/archiva-base/archiva-repository-admin/src/main/java/org/apache/archiva/admin/repository/remote/RemoteRepositoryAdmin.java [deleted file]
archiva-modules/archiva-base/archiva-repository-admin/src/main/java/org/apache/archiva/admin/repository/utils/RepositoryComparator.java [deleted file]
archiva-modules/archiva-base/archiva-repository-admin/src/main/resources/META-INF/spring-context.xml [deleted file]
archiva-modules/archiva-base/archiva-repository-admin/src/test/java/org/apache/archiva/admin/mock/MockAuditListener.java [deleted file]
archiva-modules/archiva-base/archiva-repository-admin/src/test/java/org/apache/archiva/admin/repository/AbstractRepositoryAdminTest.java [deleted file]
archiva-modules/archiva-base/archiva-repository-admin/src/test/java/org/apache/archiva/admin/repository/admin/ArchivaAdministrationTest.java [deleted file]
archiva-modules/archiva-base/archiva-repository-admin/src/test/java/org/apache/archiva/admin/repository/group/RepositoryGroupAdminTest.java [deleted file]
archiva-modules/archiva-base/archiva-repository-admin/src/test/java/org/apache/archiva/admin/repository/managed/ManagedRepositoryAdminTest.java [deleted file]
archiva-modules/archiva-base/archiva-repository-admin/src/test/java/org/apache/archiva/admin/repository/networkproxy/NetworkProxyAdminTest.java [deleted file]
archiva-modules/archiva-base/archiva-repository-admin/src/test/java/org/apache/archiva/admin/repository/proxyconnector/ProxyConnectorAdminTest.java [deleted file]
archiva-modules/archiva-base/archiva-repository-admin/src/test/java/org/apache/archiva/admin/repository/remote/RemoteRepositoryAdminTest.java [deleted file]
archiva-modules/archiva-base/archiva-repository-admin/src/test/resources/META-INF/redback/redback-core.xml [deleted file]
archiva-modules/archiva-base/archiva-repository-admin/src/test/resources/log4j.xml [deleted file]
archiva-modules/archiva-base/archiva-repository-admin/src/test/resources/spring-context.xml [deleted file]
archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/ManagedRepositoryContent.java
archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/RemoteRepositoryContent.java
archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/RepositoryContentFactory.java
archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/content/ManagedDefaultRepositoryContent.java
archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/content/ManagedLegacyRepositoryContent.java
archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/content/RemoteDefaultRepositoryContent.java
archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/content/RemoteLegacyRepositoryContent.java
archiva-modules/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/AbstractRepositoryLayerTestCase.java
archiva-modules/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/content/ManagedDefaultRepositoryContentTest.java
archiva-modules/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/content/ManagedLegacyRepositoryContentTest.java
archiva-modules/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/content/RemoteDefaultRepositoryContentTest.java
archiva-modules/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/content/RemoteLegacyRepositoryContentTest.java
archiva-modules/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/metadata/MetadataToolsTest.java
archiva-modules/archiva-base/archiva-repository-scanner/pom.xml
archiva-modules/archiva-base/archiva-repository-scanner/src/main/java/org/apache/archiva/repository/scanner/DefaultRepositoryScanner.java
archiva-modules/archiva-base/archiva-repository-scanner/src/main/java/org/apache/archiva/repository/scanner/RepositoryContentConsumers.java
archiva-modules/archiva-base/archiva-repository-scanner/src/main/java/org/apache/archiva/repository/scanner/RepositoryScanStatistics.java
archiva-modules/archiva-base/archiva-repository-scanner/src/main/java/org/apache/archiva/repository/scanner/RepositoryScanner.java
archiva-modules/archiva-base/archiva-repository-scanner/src/main/java/org/apache/archiva/repository/scanner/RepositoryScannerInstance.java
archiva-modules/archiva-base/archiva-repository-scanner/src/main/java/org/apache/archiva/repository/scanner/functors/TriggerBeginScanClosure.java
archiva-modules/archiva-base/archiva-repository-scanner/src/main/java/org/apache/archiva/repository/scanner/functors/TriggerScanCompletedClosure.java
archiva-modules/archiva-base/archiva-repository-scanner/src/main/resources/META-INF/spring-context.xml
archiva-modules/archiva-base/archiva-repository-scanner/src/test/java/org/apache/archiva/repository/scanner/ArchivaAdministrationStub.java [new file with mode: 0644]
archiva-modules/archiva-base/archiva-repository-scanner/src/test/java/org/apache/archiva/repository/scanner/InvalidScanConsumer.java
archiva-modules/archiva-base/archiva-repository-scanner/src/test/java/org/apache/archiva/repository/scanner/KnownScanConsumer.java
archiva-modules/archiva-base/archiva-repository-scanner/src/test/java/org/apache/archiva/repository/scanner/RepositoryContentConsumersStub.java
archiva-modules/archiva-base/archiva-repository-scanner/src/test/java/org/apache/archiva/repository/scanner/RepositoryContentConsumersTest.java
archiva-modules/archiva-base/archiva-repository-scanner/src/test/java/org/apache/archiva/repository/scanner/RepositoryScannerTest.java
archiva-modules/archiva-base/archiva-repository-scanner/src/test/java/org/apache/archiva/repository/scanner/SampleKnownConsumer.java
archiva-modules/archiva-base/archiva-repository-scanner/src/test/resources/spring-context.xml
archiva-modules/archiva-scheduler/archiva-scheduler-api/pom.xml
archiva-modules/archiva-scheduler/archiva-scheduler-indexing/pom.xml
archiva-modules/archiva-scheduler/archiva-scheduler-indexing/src/main/java/org/apache/archiva/scheduler/indexing/ArchivaIndexingTaskExecutor.java
archiva-modules/archiva-scheduler/archiva-scheduler-indexing/src/main/java/org/apache/archiva/scheduler/indexing/ArtifactIndexingTask.java
archiva-modules/archiva-scheduler/archiva-scheduler-indexing/src/test/java/org/apache/archiva/scheduler/indexing/ArchivaIndexingTaskExecutorTest.java
archiva-modules/archiva-scheduler/archiva-scheduler-repository/src/main/java/org/apache/archiva/scheduler/repository/ArchivaRepositoryScanningTaskExecutor.java
archiva-modules/archiva-scheduler/archiva-scheduler-repository/src/test/java/org/apache/archiva/mock/MockArchivaAdministration.java [new file with mode: 0644]
archiva-modules/archiva-scheduler/archiva-scheduler-repository/src/test/java/org/apache/archiva/mock/MockManagedRepositoryAdmin.java [new file with mode: 0644]
archiva-modules/archiva-scheduler/archiva-scheduler-repository/src/test/java/org/apache/archiva/mock/MockRemoteRepositoryAdmin.java [new file with mode: 0644]
archiva-modules/archiva-scheduler/archiva-scheduler-repository/src/test/java/org/apache/archiva/scheduler/repository/TestConsumer.java
archiva-modules/archiva-scheduler/archiva-scheduler-repository/src/test/resources/spring-context.xml
archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/model/Artifact.java
archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/model/ManagedRepository.java
archiva-modules/archiva-web/archiva-rest/archiva-rest-services/pom.xml
archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/AbstractRestService.java
archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultArchivaAdministrationService.java
archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultManagedRepositoriesService.java
archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultNetworkProxyService.java
archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultProxyConnectorService.java
archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultRemoteRepositoriesService.java
archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultRepositoriesService.java
archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultRepositoryGroupService.java
archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultSearchService.java [new file with mode: 0644]
archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/resources/META-INF/spring-context.xml
archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/AbstractArchivaRestTest.java
archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/ManagedRepositoriesServiceTest.java
archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/RepositoriesServiceTest.java
archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/RepositoryGroupServiceTest.java
archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/SearchServiceTest.java [new file with mode: 0644]
archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-cli/commons-cli/1.0/commons-cli-1.0-sources.jar [new file with mode: 0644]
archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-cli/commons-cli/1.0/commons-cli-1.0-sources.jar.sha1 [new file with mode: 0644]
archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-cli/commons-cli/1.0/commons-cli-1.0.jar [new file with mode: 0644]
archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-cli/commons-cli/1.0/commons-cli-1.0.jar.sha1 [new file with mode: 0644]
archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-cli/commons-cli/1.0/commons-cli-1.0.pom [new file with mode: 0644]
archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-cli/commons-cli/1.0/commons-cli-1.0.pom.sha1 [new file with mode: 0644]
archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.0.1/commons-logging-1.0.1-javadoc.jar [new file with mode: 0644]
archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.0.1/commons-logging-1.0.1-javadoc.jar.md5 [new file with mode: 0644]
archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.0.1/commons-logging-1.0.1-javadoc.jar.sha1 [new file with mode: 0644]
archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.0.1/commons-logging-1.0.1.jar [new file with mode: 0644]
archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.0.1/commons-logging-1.0.1.jar.md5 [new file with mode: 0644]
archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.0.1/commons-logging-1.0.1.jar.sha1 [new file with mode: 0644]
archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.0.1/commons-logging-1.0.1.pom [new file with mode: 0644]
archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.0.1/commons-logging-1.0.1.pom.md5 [new file with mode: 0644]
archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.0.1/commons-logging-1.0.1.pom.sha1 [new file with mode: 0644]
archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.0.1/maven-metadata.xml [new file with mode: 0644]
archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.0.1/maven-metadata.xml.md5 [new file with mode: 0644]
archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.0.1/maven-metadata.xml.sha1 [new file with mode: 0644]
archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.0.2/commons-logging-1.0.2-javadoc.jar [new file with mode: 0644]
archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.0.2/commons-logging-1.0.2-javadoc.jar.md5 [new file with mode: 0644]
archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.0.2/commons-logging-1.0.2-javadoc.jar.sha1 [new file with mode: 0644]
archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.0.2/commons-logging-1.0.2.jar [new file with mode: 0644]
archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.0.2/commons-logging-1.0.2.jar.md5 [new file with mode: 0644]
archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.0.2/commons-logging-1.0.2.jar.sha1 [new file with mode: 0644]
archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.0.2/commons-logging-1.0.2.pom [new file with mode: 0644]
archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.0.2/commons-logging-1.0.2.pom.md5 [new file with mode: 0644]
archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.0.2/commons-logging-1.0.2.pom.sha1 [new file with mode: 0644]
archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.0.2/maven-metadata.xml [new file with mode: 0644]
archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.0.2/maven-metadata.xml.md5 [new file with mode: 0644]
archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.0.2/maven-metadata.xml.sha1 [new file with mode: 0644]
archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.0.3/commons-logging-1.0.3-javadoc.jar [new file with mode: 0644]
archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.0.3/commons-logging-1.0.3-javadoc.jar.md5 [new file with mode: 0644]
archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.0.3/commons-logging-1.0.3-javadoc.jar.sha1 [new file with mode: 0644]
archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.0.3/commons-logging-1.0.3.jar [new file with mode: 0644]
archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.0.3/commons-logging-1.0.3.jar.md5 [new file with mode: 0644]
archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.0.3/commons-logging-1.0.3.jar.sha1 [new file with mode: 0644]
archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.0.3/commons-logging-1.0.3.pom [new file with mode: 0644]
archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.0.3/commons-logging-1.0.3.pom.md5 [new file with mode: 0644]
archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.0.3/commons-logging-1.0.3.pom.sha1 [new file with mode: 0644]
archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.0.3/maven-metadata.xml [new file with mode: 0644]
archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.0.3/maven-metadata.xml.md5 [new file with mode: 0644]
archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.0.3/maven-metadata.xml.sha1 [new file with mode: 0644]
archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.0.4/commons-logging-1.0.4-javadoc.jar [new file with mode: 0644]
archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.0.4/commons-logging-1.0.4-javadoc.jar.md5 [new file with mode: 0644]
archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.0.4/commons-logging-1.0.4-javadoc.jar.sha1 [new file with mode: 0644]
archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.0.4/commons-logging-1.0.4-sources.jar [new file with mode: 0644]
archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.0.4/commons-logging-1.0.4-sources.jar.md5 [new file with mode: 0644]
archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.0.4/commons-logging-1.0.4-sources.jar.sha1 [new file with mode: 0644]
archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.0.4/commons-logging-1.0.4.jar [new file with mode: 0644]
archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.0.4/commons-logging-1.0.4.jar.md5 [new file with mode: 0644]
archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.0.4/commons-logging-1.0.4.jar.sha1 [new file with mode: 0644]
archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.0.4/commons-logging-1.0.4.pom [new file with mode: 0644]
archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.0.4/commons-logging-1.0.4.pom.md5 [new file with mode: 0644]
archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.0.4/commons-logging-1.0.4.pom.sha1 [new file with mode: 0644]
archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.0.4/maven-metadata.xml [new file with mode: 0644]
archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.0.4/maven-metadata.xml.md5 [new file with mode: 0644]
archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.0.4/maven-metadata.xml.sha1 [new file with mode: 0644]
archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.0/commons-logging-1.0-javadoc.jar [new file with mode: 0644]
archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.0/commons-logging-1.0-javadoc.jar.md5 [new file with mode: 0644]
archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.0/commons-logging-1.0-javadoc.jar.sha1 [new file with mode: 0644]
archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.0/commons-logging-1.0.jar [new file with mode: 0644]
archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.0/commons-logging-1.0.jar.md5 [new file with mode: 0644]
archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.0/commons-logging-1.0.jar.sha1 [new file with mode: 0644]
archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.0/commons-logging-1.0.pom [new file with mode: 0644]
archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.0/commons-logging-1.0.pom.md5 [new file with mode: 0644]
archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.0/commons-logging-1.0.pom.sha1 [new file with mode: 0644]
archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.0/maven-metadata.xml [new file with mode: 0644]
archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.0/maven-metadata.xml.md5 [new file with mode: 0644]
archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.0/maven-metadata.xml.sha1 [new file with mode: 0644]
archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.1/commons-logging-1.1-sources.jar [new file with mode: 0644]
archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.1/commons-logging-1.1-sources.jar.md5 [new file with mode: 0644]
archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.1/commons-logging-1.1-sources.jar.sha1 [new file with mode: 0644]
archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.1/commons-logging-1.1.jar [new file with mode: 0644]
archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.1/commons-logging-1.1.jar.md5 [new file with mode: 0644]
archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.1/commons-logging-1.1.jar.sha1 [new file with mode: 0644]
archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.1/commons-logging-1.1.pom [new file with mode: 0644]
archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.1/commons-logging-1.1.pom.md5 [new file with mode: 0644]
archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.1/commons-logging-1.1.pom.sha1 [new file with mode: 0644]
archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.1/maven-metadata.xml [new file with mode: 0644]
archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.1/maven-metadata.xml.md5 [new file with mode: 0644]
archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.1/maven-metadata.xml.sha1 [new file with mode: 0644]
archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/maven-metadata.xml [new file with mode: 0644]
archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/maven-metadata.xml.md5 [new file with mode: 0644]
archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/maven-metadata.xml.sha1 [new file with mode: 0644]
archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/org/apache/felix/org.apache.felix.bundlerepository/1.6.6/org.apache.felix.bundlerepository-1.6.6.jar [new file with mode: 0644]
archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/org/apache/felix/org.apache.felix.bundlerepository/1.6.6/org.apache.felix.bundlerepository-1.6.6.pom [new file with mode: 0644]
archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/org/apache/karaf/features/org.apache.karaf.features.command/2.2.2/org.apache.karaf.features.command-2.2.2.jar [new file with mode: 0644]
archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/org/apache/karaf/features/org.apache.karaf.features.command/2.2.2/org.apache.karaf.features.command-2.2.2.pom [new file with mode: 0644]
archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/org/apache/karaf/features/org.apache.karaf.features.core/2.2.1/org.apache.karaf.features.core-2.2.1.jar [new file with mode: 0644]
archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/org/apache/karaf/features/org.apache.karaf.features.core/2.2.1/org.apache.karaf.features.core-2.2.1.pom [new file with mode: 0644]
archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/org/apache/karaf/features/org.apache.karaf.features.core/2.2.2/org.apache.karaf.features.core-2.2.2.jar [new file with mode: 0644]
archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/org/apache/karaf/features/org.apache.karaf.features.core/2.2.2/org.apache.karaf.features.core-2.2.2.pom [new file with mode: 0644]
archiva-modules/archiva-web/archiva-webapp/pom.xml
archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/archiva/web/tags/CopyPasteSnippetTag.java
archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/AbstractActionSupport.java
archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/SearchAction.java
archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/appearance/AbstractAppearanceAction.java
archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/appearance/EditOrganisationInfoAction.java
archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/connectors/proxy/AbstractProxyConnectorAction.java
archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/connectors/proxy/AbstractProxyConnectorFormAction.java
archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/connectors/proxy/AddProxyConnectorAction.java
archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/connectors/proxy/DeleteProxyConnectorAction.java
archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/connectors/proxy/DisableProxyConnectorAction.java
archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/connectors/proxy/EditProxyConnectorAction.java
archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/connectors/proxy/EnableProxyConnectorAction.java
archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/connectors/proxy/ProxyConnectorsAction.java
archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/connectors/proxy/SortProxyConnectorsAction.java
archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/legacy/AddLegacyArtifactPathAction.java
archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/legacy/DeleteLegacyArtifactPathAction.java
archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/legacy/LegacyArtifactPathAction.java
archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/networkproxies/ConfigureNetworkProxyAction.java
archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/networkproxies/NetworkProxiesAction.java
archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/AbstractRemoteRepositoriesAction.java
archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/AbstractRepositoriesAdminAction.java
archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/AddManagedRepositoryAction.java
archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/AddRemoteRepositoryAction.java
archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/DeleteManagedRepositoryAction.java
archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/DeleteRemoteRepositoryAction.java
archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/DeleteRepositoryGroupAction.java
archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/EditManagedRepositoryAction.java
archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/EditRemoteRepositoryAction.java
archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/RepositoriesAction.java
archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/RepositoryGroupsAction.java
archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/SortRepositoriesAction.java
archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/scanning/RepositoryScanningAction.java
archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/DeleteArtifactActionTest.java
archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/ShowArtifactActionTest.java
archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/UploadActionTest.java
archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/admin/connectors/proxy/AddProxyConnectorActionTest.java
archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/admin/connectors/proxy/EditProxyConnectorActionTest.java
archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/admin/legacy/AddLegacyArtifactPathActionTest.java
archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/admin/networkproxies/ConfigureNetworkProxyActionTest.java
archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/admin/repositories/AbstractManagedRepositoryActionTest.java
archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/admin/repositories/AddManagedRepositoryActionTest.java
archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/admin/repositories/AddRemoteRepositoryActionTest.java
archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/admin/repositories/DeleteManagedRepositoryActionTest.java
archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/admin/repositories/DeleteRemoteRepositoryActionTest.java
archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/admin/repositories/DeleteRepositoryGroupActionTest.java
archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/admin/repositories/EditManagedRepositoryActionTest.java
archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/admin/repositories/EditRemoteRepositoryActionTest.java
archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/admin/repositories/RepositoryGroupsActionTest.java
archiva-modules/archiva-web/archiva-webdav/pom.xml
archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/maven/archiva/webdav/ArchivaDavResource.java
archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/maven/archiva/webdav/RepositoryServlet.java
archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/metadata/repository/TestMetadataRepository.java
archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/maven/archiva/webdav/AbstractRepositoryServletTestCase.java
archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/maven/archiva/webdav/ArchivaDavResourceFactoryTest.java
archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/maven/archiva/webdav/DavResourceTest.java
archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/maven/archiva/webdav/RepositoryServletTest.java
archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/maven/archiva/webdav/StubRepositoryContentConsumers.java
archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/maven/archiva/webdav/UnauthenticatedRepositoryServlet.java
archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-api/pom.xml
archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-api/src/main/java/org/apache/archiva/web/xmlrpc/api/AdministrationService.java
archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-services/pom.xml
archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-services/src/main/java/org/apache/archiva/web/xmlrpc/services/AdministrationServiceImpl.java
archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-services/src/test/java/org/apache/archiva/web/xmlrpc/services/AdministrationServiceImplTest.java
archiva-modules/plugins/problem-reports/pom.xml
archiva-modules/plugins/problem-reports/src/main/java/org/apache/archiva/reports/consumers/DuplicateArtifactsConsumer.java
archiva-modules/plugins/problem-reports/src/test/java/org/apache/archiva/reports/consumers/DuplicateArtifactsConsumerTest.java
pom.xml

index a298732fb492c71941cd5510cbb2e09ae91d53a4..cd9bdbc42840f148fad4e3b2d23c4a3bdf36d7a2 100644 (file)
@@ -15,3 +15,4 @@ archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/lib/
 archiva-modules/archiva-web/archiva-webapp-test/cargo-installs/
 *.ipr
 *.iws
+.DS_Store
index 14e7a87fd065f2bdf1a46c9d8b6a2f4f4f2b830b..c2f220cd029a4fdbcd819ad7903727ec816b3047 100644 (file)
@@ -19,13 +19,13 @@ package org.apache.maven.archiva.cli;
  * under the License.
  */
 
-import java.util.Date;
-
-import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
+import org.apache.archiva.admin.model.managed.ManagedRepository;
 import org.apache.maven.archiva.consumers.AbstractMonitoredConsumer;
 import org.apache.maven.archiva.consumers.ConsumerException;
 import org.apache.maven.archiva.consumers.RepositoryContentConsumer;
 
+import java.util.Date;
+
 /**
  * AbstractProgressConsumer 
  *
@@ -37,13 +37,13 @@ public abstract class AbstractProgressConsumer
 {
     private int count = 0;
 
-    public void beginScan( ManagedRepositoryConfiguration repository, Date whenGathered )
+    public void beginScan( ManagedRepository repository, Date whenGathered )
         throws ConsumerException
     {
         this.count = 0;
     }
 
-    public void beginScan( ManagedRepositoryConfiguration repository, Date whenGathered, boolean executeOnEntireRepo )
+    public void beginScan( ManagedRepository repository, Date whenGathered, boolean executeOnEntireRepo )
         throws ConsumerException
     {
         beginScan( repository, whenGathered );
index a5e5adc062b7c907224f7ffd7358b148f9e72473..43d6e76a1f22ba9c5ab767a5572ef8bf3617db5b 100644 (file)
@@ -21,6 +21,7 @@ package org.apache.maven.archiva.cli;
 
 import com.sampullara.cli.Args;
 import com.sampullara.cli.Argument;
+import org.apache.archiva.admin.model.managed.ManagedRepository;
 import org.apache.archiva.common.plexusbridge.PlexusSisuBridge;
 import org.apache.archiva.common.plexusbridge.PlexusSisuBridgeException;
 import org.apache.archiva.repository.scanner.RepositoryScanStatistics;
@@ -165,7 +166,7 @@ public class ArchivaCli
         WagonManager wagonManager = plexusSisuBridge.lookup( WagonManager.class );
         wagonManager.addMirror( "internal", "*", new File( path ).toURL().toExternalForm() );
 
-        ManagedRepositoryConfiguration repo = new ManagedRepositoryConfiguration();
+        ManagedRepository repo = new ManagedRepository();
         repo.setId( "cliRepo" );
         repo.setName( "Archiva CLI Provided Repo" );
         repo.setLocation( path );
diff --git a/archiva-modules/archiva-base/archiva-common/src/main/java/org/apache/maven/archiva/common/FileTypeUtils.java b/archiva-modules/archiva-base/archiva-common/src/main/java/org/apache/maven/archiva/common/FileTypeUtils.java
new file mode 100644 (file)
index 0000000..d6d11cc
--- /dev/null
@@ -0,0 +1,39 @@
+package org.apache.maven.archiva.common;
+/*
+ * 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 java.util.Arrays;
+import java.util.List;
+
+/**
+ * @author Olivier Lamy
+ * @since 1.4
+ */
+public class FileTypeUtils
+{
+
+    /**
+     * Default exclusions from artifact consumers that are using the file types. Note that this is simplistic in the
+     * case of the support files (based on extension) as it is elsewhere - it may be better to match these to actual
+     * artifacts and exclude later during scanning.
+     */
+    public static final List<String> DEFAULT_EXCLUSIONS =
+        Arrays.asList( "**/maven-metadata.xml", "**/maven-metadata-*.xml", "**/*.sha1", "**/*.asc", "**/*.md5",
+                       "**/*.pgp", "**/.index/**", "**/.indexer/**" );
+}
index 80d04af87821e73eb8cb0233771b5641f656eb32..35ae50d0eff07ec359817aa535a2a1beac01fe90 100644 (file)
@@ -22,6 +22,7 @@ package org.apache.maven.archiva.configuration;
 import org.apache.commons.collections.CollectionUtils;
 import org.apache.commons.collections.Predicate;
 import org.apache.commons.configuration.CombinedConfiguration;
+import org.apache.maven.archiva.common.FileTypeUtils;
 import org.apache.maven.archiva.configuration.functors.FiletypeSelectionPredicate;
 import org.apache.maven.archiva.configuration.io.registry.ConfigurationRegistryReader;
 import org.codehaus.plexus.registry.Registry;
@@ -77,10 +78,9 @@ public class FileTypes
      * Default exclusions from artifact consumers that are using the file types. Note that this is simplistic in the
      * case of the support files (based on extension) as it is elsewhere - it may be better to match these to actual
      * artifacts and exclude later during scanning.
+     * @deprecated
      */
-    public static final List<String> DEFAULT_EXCLUSIONS =
-        Arrays.asList( "**/maven-metadata.xml", "**/maven-metadata-*.xml", "**/*.sha1", "**/*.asc", "**/*.md5",
-                       "**/*.pgp", "**/.index/**", "**/.indexer/**" );
+    public static final List<String> DEFAULT_EXCLUSIONS = FileTypeUtils.DEFAULT_EXCLUSIONS;
 
     public void setArchivaConfiguration( ArchivaConfiguration archivaConfiguration )
     {
index 7ef684e824134fc09f84e53d063ef65c4c1beec9..d7b8bf863d2af3f1c077f7595c47fd196f216fc0 100644 (file)
   <dependencies>
     <dependency>
       <groupId>org.apache.archiva</groupId>
-      <artifactId>archiva-configuration</artifactId>
+      <artifactId>archiva-repository-admin-api</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.archiva</groupId>
+      <artifactId>archiva-common</artifactId>
     </dependency>
     <dependency>
       <groupId>commons-collections</groupId>
index be96186e163c0cbd1798ec105e682bc84c2e44bc..55a94261a04cf9d60ab1b522f3d7f56e0c7e71f0 100644 (file)
@@ -19,13 +19,13 @@ package org.apache.maven.archiva.consumers;
  * under the License.
  */
 
+import org.apache.maven.archiva.common.FileTypeUtils;
+
 import java.util.HashSet;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Set;
 
-import org.apache.maven.archiva.configuration.FileTypes;
-
 /**
  * AbstractMonitoredConsumer 
  *
@@ -101,7 +101,7 @@ public abstract class AbstractMonitoredConsumer
 
     protected List<String> getDefaultArtifactExclusions()
     {
-        return FileTypes.DEFAULT_EXCLUSIONS;
+        return FileTypeUtils.DEFAULT_EXCLUSIONS;
     }
     
     
index a29ad3d37887d3d80de3a11ae2690669e13538b4..5a83b0798d2beb07f9c25ad562f1d0b6ba2e5484 100644 (file)
@@ -19,7 +19,7 @@ package org.apache.maven.archiva.consumers;
  * under the License.
  */
 
-import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
+import org.apache.archiva.admin.model.managed.ManagedRepository;
 
 import java.util.Date;
 import java.util.List;
@@ -60,7 +60,7 @@ public interface RepositoryContentConsumer
      * @param whenGathered the start of the repository scan
      * @throws ConsumerException if there was a problem with using the provided repository with the consumer.
      */
-    void beginScan( ManagedRepositoryConfiguration repository, Date whenGathered )
+    void beginScan( ManagedRepository repository, Date whenGathered )
         throws ConsumerException;
 
     /**
@@ -73,9 +73,9 @@ public interface RepositoryContentConsumer
      * @param whenGathered        the start of the repository scan
      * @param executeOnEntireRepo flags whether the consumer will be executed on an entire repository or just on a specific resource
      * @throws ConsumerException if there was a problem with using the provided repository with the consumer.
-     * @see RepositoryContentConsumer#beginScan(org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration, java.util.Date)
+     * @see RepositoryContentConsumer#beginScan(ManagedRepository, java.util.Date)
      */
-    void beginScan( ManagedRepositoryConfiguration repository, Date whenGathered, boolean executeOnEntireRepo )
+    void beginScan( ManagedRepository repository, Date whenGathered, boolean executeOnEntireRepo )
         throws ConsumerException;
 
     /**
index bc5b6b4c35ad80762a2522c518bfb1b1005c705a..b080c2519d5cd8dbec5ad8b6f7821d6434065d43 100644 (file)
       <groupId>org.apache.archiva</groupId>
       <artifactId>archiva-consumer-api</artifactId>
     </dependency>
+    <dependency>
+      <groupId>org.apache.archiva</groupId>
+      <artifactId>archiva-repository-admin-api</artifactId>
+    </dependency>
     <dependency>
       <groupId>org.apache.archiva</groupId>
       <artifactId>archiva-repository-layer</artifactId>
       <artifactId>mockito-all</artifactId>
       <scope>test</scope>
     </dependency>
+    <dependency>
+      <groupId>org.apache.archiva</groupId>
+      <artifactId>archiva-repository-admin-default</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.codehaus.redback</groupId>
+      <artifactId>redback-rbac-cached</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.derby</groupId>
+      <artifactId>derby</artifactId>
+      <scope>test</scope>
+    </dependency>
   </dependencies>
   <build>
     <pluginManagement>
       <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-surefire-plugin</artifactId>
+        <configuration>
+          <systemPropertyVariables>
+            <appserver.base>${basedir}/target/appserver-base</appserver.base>
+            <plexus.home>${project.build.outputDirectory}</plexus.home>
+            <java.io.tmpdir>${project.build.outputDirectory}</java.io.tmpdir>
+          </systemPropertyVariables>
+        </configuration>
+      </plugin>
         <plugin>
           <groupId>org.apache.rat</groupId>
           <artifactId>apache-rat-plugin</artifactId>
index 54dfccc2b86d43804a8702d6b654435ad54d791f..c35bf60b6e15008cab7d385c4894691b3a9eafeb 100644 (file)
@@ -19,12 +19,12 @@ package org.apache.maven.archiva.consumers.core;
  * under the License.
  */
 
+import org.apache.archiva.admin.model.managed.ManagedRepository;
 import org.apache.archiva.checksum.ChecksumAlgorithm;
 import org.apache.archiva.checksum.ChecksummedFile;
 import org.apache.maven.archiva.configuration.ArchivaConfiguration;
 import org.apache.maven.archiva.configuration.ConfigurationNames;
 import org.apache.maven.archiva.configuration.FileTypes;
-import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
 import org.apache.maven.archiva.consumers.AbstractMonitoredConsumer;
 import org.apache.maven.archiva.consumers.ConsumerException;
 import org.apache.maven.archiva.consumers.KnownRepositoryContentConsumer;
@@ -96,13 +96,13 @@ public class ArtifactMissingChecksumsConsumer
         return false;
     }
 
-    public void beginScan( ManagedRepositoryConfiguration repo, Date whenGathered )
+    public void beginScan( ManagedRepository repo, Date whenGathered )
         throws ConsumerException
     {
         this.repositoryDir = new File( repo.getLocation() );
     }
 
-    public void beginScan( ManagedRepositoryConfiguration repo, Date whenGathered, boolean executeOnEntireRepo )
+    public void beginScan( ManagedRepository repo, Date whenGathered, boolean executeOnEntireRepo )
         throws ConsumerException
     {
         beginScan( repo, whenGathered );
index 99fe36e112a15f0e91f6787f29c931bf2291d123..33fa0dcae320f9177622b130d2d5254fe7e45609 100644 (file)
@@ -19,12 +19,10 @@ package org.apache.maven.archiva.consumers.core;
  * under the License.
  */
 
-import org.apache.commons.collections.CollectionUtils;
-import org.apache.commons.lang.StringUtils;
+import org.apache.archiva.admin.model.managed.ManagedRepository;
 import org.apache.maven.archiva.configuration.ArchivaConfiguration;
 import org.apache.maven.archiva.configuration.ConfigurationNames;
 import org.apache.maven.archiva.configuration.FileTypes;
-import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
 import org.apache.maven.archiva.consumers.AbstractMonitoredConsumer;
 import org.apache.maven.archiva.consumers.ConsumerException;
 import org.apache.maven.archiva.consumers.KnownRepositoryContentConsumer;
@@ -92,13 +90,13 @@ public class AutoRemoveConsumer
         return false;
     }
 
-    public void beginScan( ManagedRepositoryConfiguration repository, Date whenGathered )
+    public void beginScan( ManagedRepository repository, Date whenGathered )
         throws ConsumerException
     {
         this.repositoryDir = new File( repository.getLocation() );
     }
 
-    public void beginScan( ManagedRepositoryConfiguration repository, Date whenGathered, boolean executeOnEntireRepo )
+    public void beginScan( ManagedRepository repository, Date whenGathered, boolean executeOnEntireRepo )
         throws ConsumerException
     {
         beginScan( repository, whenGathered );
index 33a6568bf9d7d1d2fa91f28dfebaaddd8ddb11a5..1990bfa1209030ae7a28348d12786189b67e4c01 100644 (file)
@@ -19,8 +19,8 @@ package org.apache.maven.archiva.consumers.core;
  * under the License.
  */
 
+import org.apache.archiva.admin.model.managed.ManagedRepository;
 import org.apache.commons.io.FileUtils;
-import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
 import org.apache.maven.archiva.consumers.AbstractMonitoredConsumer;
 import org.apache.maven.archiva.consumers.ConsumerException;
 import org.apache.maven.archiva.consumers.KnownRepositoryContentConsumer;
@@ -91,13 +91,13 @@ public class AutoRenameConsumer
         return false;
     }
 
-    public void beginScan( ManagedRepositoryConfiguration repository, Date whenGathered )
+    public void beginScan( ManagedRepository repository, Date whenGathered )
         throws ConsumerException
     {
         this.repositoryDir = new File( repository.getLocation() );
     }
 
-    public void beginScan( ManagedRepositoryConfiguration repository, Date whenGathered, boolean executeOnEntireRepo )
+    public void beginScan( ManagedRepository repository, Date whenGathered, boolean executeOnEntireRepo )
         throws ConsumerException
     {
         beginScan( repository, whenGathered );
index a2e657a62e0a903917bb067ff0045592f609bab4..f8003e384b551671c5e8e0fa3cabdd4a03bf7f28 100644 (file)
@@ -19,16 +19,10 @@ package org.apache.maven.archiva.consumers.core;
  * under the License.
  */
 
-import java.io.File;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.List;
-
+import org.apache.archiva.admin.model.managed.ManagedRepository;
 import org.apache.maven.archiva.configuration.ArchivaConfiguration;
 import org.apache.maven.archiva.configuration.ConfigurationNames;
 import org.apache.maven.archiva.configuration.FileTypes;
-import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
 import org.apache.maven.archiva.consumers.AbstractMonitoredConsumer;
 import org.apache.maven.archiva.consumers.ConsumerException;
 import org.apache.maven.archiva.consumers.KnownRepositoryContentConsumer;
@@ -52,6 +46,11 @@ import org.springframework.stereotype.Service;
 
 import javax.annotation.PostConstruct;
 import javax.inject.Inject;
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
 
 /**
  * MetadataUpdaterConsumer will create and update the metadata present within the repository.
@@ -129,7 +128,7 @@ public class MetadataUpdaterConsumer
         this.includes = includes;
     }
 
-    public void beginScan( ManagedRepositoryConfiguration repoConfig, Date whenGathered )
+    public void beginScan( ManagedRepository repoConfig, Date whenGathered )
         throws ConsumerException
     {
         try
@@ -148,7 +147,7 @@ public class MetadataUpdaterConsumer
         }
     }
 
-    public void beginScan( ManagedRepositoryConfiguration repository, Date whenGathered, boolean executeOnEntireRepo )
+    public void beginScan( ManagedRepository repository, Date whenGathered, boolean executeOnEntireRepo )
         throws ConsumerException
     {
         beginScan( repository, whenGathered );
index 2487ed7273bd259ab5e4c00edb6f2b01357f1b07..d5357a3ffe90676b0bb54d3a8b040ba451b1dc5a 100644 (file)
@@ -19,10 +19,10 @@ package org.apache.maven.archiva.consumers.core;
  * under the License.
  */
 
+import org.apache.archiva.admin.model.managed.ManagedRepository;
 import org.apache.archiva.common.plexusbridge.DigesterUtils;
 import org.apache.archiva.common.plexusbridge.PlexusSisuBridge;
 import org.apache.archiva.common.plexusbridge.PlexusSisuBridgeException;
-import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
 import org.apache.maven.archiva.consumers.AbstractMonitoredConsumer;
 import org.apache.maven.archiva.consumers.ConsumerException;
 import org.apache.maven.archiva.consumers.KnownRepositoryContentConsumer;
@@ -39,7 +39,6 @@ import java.io.FileNotFoundException;
 import java.io.IOException;
 import java.util.ArrayList;
 import java.util.Date;
-import java.util.Iterator;
 import java.util.List;
 
 /**
@@ -106,13 +105,13 @@ public class ValidateChecksumConsumer
         return false;
     }
 
-    public void beginScan( ManagedRepositoryConfiguration repository, Date whenGathered )
+    public void beginScan( ManagedRepository repository, Date whenGathered )
         throws ConsumerException
     {
         this.repositoryDir = new File( repository.getLocation() );
     }
 
-    public void beginScan( ManagedRepositoryConfiguration repository, Date whenGathered, boolean executeOnEntireRepo )
+    public void beginScan( ManagedRepository repository, Date whenGathered, boolean executeOnEntireRepo )
         throws ConsumerException
     {
         beginScan( repository, whenGathered );
index e120874393eac03f76a1de5404603044cacfeae8..52e5702ca3281311658d5b350fbeadb4cd12900c 100644 (file)
@@ -19,13 +19,14 @@ package org.apache.maven.archiva.consumers.core.repository;
  * under the License.
  */
 
+import org.apache.archiva.admin.model.RepositoryAdminException;
+import org.apache.archiva.admin.model.managed.ManagedRepository;
+import org.apache.archiva.admin.model.managed.ManagedRepositoryAdmin;
 import org.apache.archiva.metadata.repository.MetadataRepository;
 import org.apache.archiva.metadata.repository.RepositorySession;
 import org.apache.archiva.repository.events.RepositoryListener;
 import org.apache.maven.archiva.common.utils.VersionComparator;
 import org.apache.maven.archiva.common.utils.VersionUtil;
-import org.apache.maven.archiva.configuration.ArchivaConfiguration;
-import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
 import org.apache.maven.archiva.model.ArchivaArtifact;
 import org.apache.maven.archiva.model.ArtifactReference;
 import org.apache.maven.archiva.model.ProjectReference;
@@ -50,7 +51,7 @@ import java.util.List;
  * This will look in a single managed repository, and purge any snapshots that are present
  * that have a corresponding released version on the same repository.
  * </p>
- *
+ * <p/>
  * <p>
  * So, if you have the following (presented in the m2/default layout form) ...
  * <pre>
@@ -74,19 +75,19 @@ public class CleanupReleasedSnapshotsRepositoryPurge
 {
     private MetadataTools metadataTools;
 
-    private ArchivaConfiguration archivaConfig;
+    private ManagedRepositoryAdmin managedRepositoryAdmin;
 
     private RepositoryContentFactory repoContentFactory;
 
     public CleanupReleasedSnapshotsRepositoryPurge( ManagedRepositoryContent repository, MetadataTools metadataTools,
-                                                    ArchivaConfiguration archivaConfig,
+                                                    ManagedRepositoryAdmin managedRepositoryAdmin,
                                                     RepositoryContentFactory repoContentFactory,
                                                     RepositorySession repositorySession,
                                                     List<RepositoryListener> listeners )
     {
         super( repository, repositorySession, listeners );
         this.metadataTools = metadataTools;
-        this.archivaConfig = archivaConfig;
+        this.managedRepositoryAdmin = managedRepositoryAdmin;
         this.repoContentFactory = repoContentFactory;
     }
 
@@ -118,15 +119,15 @@ public class CleanupReleasedSnapshotsRepositoryPurge
             // Gather up all of the versions.
             List<String> allVersions = new ArrayList<String>( repository.getVersions( reference ) );
 
-            List<ManagedRepositoryConfiguration> repos = archivaConfig.getConfiguration().getManagedRepositories();
-            for ( ManagedRepositoryConfiguration repo : repos )
+            List<ManagedRepository> repos = managedRepositoryAdmin.getManagedRepositories();
+            for ( ManagedRepository repo : repos )
             {
                 if ( repo.isReleases() && !repo.getId().equals( repository.getId() ) )
                 {
                     try
                     {
-                        ManagedRepositoryContent repoContent = repoContentFactory.getManagedRepositoryContent(
-                            repo.getId() );
+                        ManagedRepositoryContent repoContent =
+                            repoContentFactory.getManagedRepositoryContent( repo.getId() );
                         allVersions.addAll( repoContent.getVersions( reference ) );
                     }
                     catch ( RepositoryNotFoundException e )
@@ -167,9 +168,9 @@ public class CleanupReleasedSnapshotsRepositoryPurge
             versionRef.setGroupId( artifactRef.getGroupId() );
             versionRef.setArtifactId( artifactRef.getArtifactId() );
 
-            ArchivaArtifact artifact = new ArchivaArtifact( artifactRef.getGroupId(), artifactRef.getArtifactId(),
-                                                            artifactRef.getVersion(), artifactRef.getClassifier(),
-                                                            artifactRef.getType(), repository.getId() );
+            ArchivaArtifact artifact =
+                new ArchivaArtifact( artifactRef.getGroupId(), artifactRef.getArtifactId(), artifactRef.getVersion(),
+                                     artifactRef.getClassifier(), artifactRef.getType(), repository.getId() );
 
             MetadataRepository metadataRepository = repositorySession.getRepository();
             for ( String version : snapshotVersions )
@@ -195,6 +196,9 @@ public class CleanupReleasedSnapshotsRepositoryPurge
             {
                 updateMetadata( artifactRef );
             }
+        } catch ( RepositoryAdminException e )
+        {
+            throw new RepositoryPurgeException( e.getMessage(), e );
         }
         catch ( LayoutException e )
         {
index 55ef8f1fd6c4190b8165278c1c516106afa2c528..791de8d7692211477a0071ccb36b8c48a81b51f1 100644 (file)
@@ -19,13 +19,14 @@ package org.apache.maven.archiva.consumers.core.repository;
  * under the License.
  */
 
+import org.apache.archiva.admin.model.managed.ManagedRepository;
+import org.apache.archiva.admin.model.managed.ManagedRepositoryAdmin;
 import org.apache.archiva.metadata.repository.RepositorySession;
 import org.apache.archiva.metadata.repository.RepositorySessionFactory;
 import org.apache.archiva.repository.events.RepositoryListener;
 import org.apache.maven.archiva.configuration.ArchivaConfiguration;
 import org.apache.maven.archiva.configuration.ConfigurationNames;
 import org.apache.maven.archiva.configuration.FileTypes;
-import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
 import org.apache.maven.archiva.consumers.AbstractMonitoredConsumer;
 import org.apache.maven.archiva.consumers.ConsumerException;
 import org.apache.maven.archiva.consumers.KnownRepositoryContentConsumer;
@@ -36,7 +37,6 @@ import org.apache.maven.archiva.repository.RepositoryNotFoundException;
 import org.apache.maven.archiva.repository.metadata.MetadataTools;
 import org.codehaus.plexus.registry.Registry;
 import org.codehaus.plexus.registry.RegistryListener;
-import org.springframework.context.ApplicationContext;
 import org.springframework.context.annotation.Scope;
 import org.springframework.stereotype.Service;
 
@@ -75,11 +75,14 @@ public class RepositoryPurgeConsumer
     @Named( value = "archivaConfiguration#default" )
     private ArchivaConfiguration configuration;
 
+    @Inject
+    private ManagedRepositoryAdmin managedRepositoryAdmin;
+
     /**
      *
      */
     @Inject
-    @Named(value = "repositoryContentFactory#default")
+    @Named( value = "repositoryContentFactory#default" )
     private RepositoryContentFactory repositoryContentFactory;
 
     /**
@@ -92,7 +95,7 @@ public class RepositoryPurgeConsumer
      *
      */
     @Inject
-    @Named(value = "fileTypes")
+    @Named( value = "fileTypes" )
     private FileTypes filetypes;
 
     private List<String> includes = new ArrayList<String>();
@@ -111,7 +114,6 @@ public class RepositoryPurgeConsumer
 
     /**
      * TODO: this could be multiple implementations and needs to be configured.
-     *
      */
     @Inject
     private RepositorySessionFactory repositorySessionFactory;
@@ -143,7 +145,7 @@ public class RepositoryPurgeConsumer
         return this.includes;
     }
 
-    public void beginScan( ManagedRepositoryConfiguration repository, Date whenGathered )
+    public void beginScan( ManagedRepository repository, Date whenGathered )
         throws ConsumerException
     {
         ManagedRepositoryContent repositoryContent;
@@ -174,13 +176,13 @@ public class RepositoryPurgeConsumer
                                                    listeners );
         }
 
-        cleanUp = new CleanupReleasedSnapshotsRepositoryPurge( repositoryContent, metadataTools, configuration,
+        cleanUp = new CleanupReleasedSnapshotsRepositoryPurge( repositoryContent, metadataTools, managedRepositoryAdmin,
                                                                repositoryContentFactory, repositorySession, listeners );
 
         deleteReleasedSnapshots = repository.isDeleteReleasedSnapshots();
     }
 
-    public void beginScan( ManagedRepositoryConfiguration repository, Date whenGathered, boolean executeOnEntireRepo )
+    public void beginScan( ManagedRepository repository, Date whenGathered, boolean executeOnEntireRepo )
         throws ConsumerException
     {
         beginScan( repository, whenGathered );
diff --git a/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/archiva/metadata/repository/TestMetadataRepository.java b/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/archiva/metadata/repository/TestMetadataRepository.java
new file mode 100644 (file)
index 0000000..c78389e
--- /dev/null
@@ -0,0 +1,185 @@
+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.
+ */
+
+import org.apache.archiva.metadata.model.ArtifactMetadata;
+import org.apache.archiva.metadata.model.MetadataFacet;
+import org.apache.archiva.metadata.model.ProjectMetadata;
+import org.apache.archiva.metadata.model.ProjectVersionMetadata;
+import org.apache.archiva.metadata.model.ProjectVersionReference;
+
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Date;
+import java.util.List;
+
+public class TestMetadataRepository
+    implements MetadataRepository
+{
+    public ProjectMetadata getProject( String repoId, String namespace, String projectId )
+    {
+        return null;
+    }
+
+    public ProjectVersionMetadata getProjectVersion( String repoId, String namespace, String projectId,
+                                                     String projectVersion )
+    {
+        return null;
+    }
+
+    public Collection<String> getArtifactVersions( String repoId, String namespace, String projectId,
+                                                   String projectVersion )
+    {
+        return null;
+    }
+
+    public Collection<ProjectVersionReference> getProjectReferences( String repoId, String namespace, String projectId,
+                                                                     String projectVersion )
+    {
+        return null;
+    }
+
+    public Collection<String> getRootNamespaces( String repoId )
+    {
+        return null;
+    }
+
+    public Collection<String> getNamespaces( String repoId, String namespace )
+    {
+        return null;
+    }
+
+    public Collection<String> getProjects( String repoId, String namespace )
+    {
+        return null;
+    }
+
+    public Collection<String> getProjectVersions( String repoId, String namespace, String projectId )
+    {
+        return null;
+    }
+
+    public void updateProject( String repoId, ProjectMetadata project )
+    {
+    }
+
+    public void updateArtifact( String repoId, String namespace, String projectId, String projectVersion,
+                                ArtifactMetadata artifactMeta )
+    {
+
+    }
+
+    public void updateProjectVersion( String repoId, String namespace, String projectId,
+                                      ProjectVersionMetadata versionMetadata )
+    {
+
+    }
+
+    public void updateNamespace( String repoId, String namespace )
+    {
+
+    }
+
+    public List<String> getMetadataFacets( String repodId, String facetId )
+    {
+        return Collections.emptyList();
+    }
+
+    public MetadataFacet getMetadataFacet( String repositoryId, String facetId, String name )
+    {
+        return null;
+    }
+
+    public void addMetadataFacet( String repositoryId, MetadataFacet metadataFacet )
+    {
+
+    }
+
+    public void removeMetadataFacets( String repositoryId, String facetId )
+    {
+
+    }
+
+    public void removeMetadataFacet( String repoId, String facetId, String name )
+    {
+
+    }
+
+    public List<ArtifactMetadata> getArtifactsByDateRange( String repoId, Date startTime, Date endTime )
+    {
+        return null;
+    }
+
+    public Collection<String> getRepositories()
+    {
+        return null;
+    }
+
+    public List<ArtifactMetadata> getArtifactsByChecksum( String repoId, String checksum )
+    {
+        return null;
+    }
+
+    public void removeArtifact( String repositoryId, String namespace, String project, String version, String id )
+    {
+
+    }
+
+    public void removeRepository( String repoId )
+    {
+
+    }
+
+    public Collection<ArtifactMetadata> getArtifacts( String repoId, String namespace, String projectId,
+                                                      String projectVersion )
+    {
+        return null;
+    }
+
+    public void save()
+    {
+
+    }
+
+    public void close()
+    {
+
+    }
+
+    public void revert()
+    {
+
+    }
+
+    public boolean canObtainAccess( Class<?> aClass )
+    {
+        return false;
+    }
+
+    public Object obtainAccess( Class<?> aClass )
+    {
+        return null;
+    }
+
+    public List<ArtifactMetadata> getArtifacts( String repositoryId )
+    {
+        return null;
+    }
+}
index 90dd98b5df1f43ec9872661f50103d87074f415f..1ac5901ca51d6056f3ea7ec2e80dc1b264d28424 100644 (file)
@@ -20,7 +20,7 @@ import org.springframework.stereotype.Service;
 * specific language governing permissions and limitations
 * under the License.
 */
-@Service("repositorySessionFactory#test")
+@Service( "repositorySessionFactory#test" )
 public class TestRepositorySessionFactory
     implements RepositorySessionFactory
 {
@@ -30,7 +30,14 @@ public class TestRepositorySessionFactory
 
     public RepositorySession createSession()
     {
-        return new RepositorySession( repository, resolver );
+        return new RepositorySession( new TestMetadataRepository(), resolver )
+        {
+            @Override
+            public void close()
+            {
+                return;
+            }
+        };
     }
 
     public void setRepository( MetadataRepository repository )
index 67b3b3ffd6d73f887ee48c750d3c0fb034fa05fa..aa243dc2e553c10d3851f3a3929d147a33e627ec 100644 (file)
@@ -1,9 +1,9 @@
 package org.apache.maven.archiva.consumers.core;
 
+import org.apache.archiva.admin.model.managed.ManagedRepository;
 import org.apache.archiva.checksum.ChecksumAlgorithm;
 import org.apache.archiva.checksum.ChecksummedFile;
 import org.apache.commons.io.FileUtils;
-import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
 import org.apache.maven.archiva.consumers.KnownRepositoryContentConsumer;
 import org.junit.Before;
 import org.junit.Test;
@@ -33,7 +33,7 @@ import java.util.Calendar;
 public class ArtifactMissingChecksumsConsumerTest
     extends AbstractArtifactConsumerTest
 {
-    private ManagedRepositoryConfiguration repoConfig;
+    private ManagedRepository repoConfig;
 
     @Before
     public void setUp()
@@ -41,7 +41,7 @@ public class ArtifactMissingChecksumsConsumerTest
     {
         super.setUp();
 
-        repoConfig = new ManagedRepositoryConfiguration();
+        repoConfig = new ManagedRepository();
         repoConfig.setId( "test-repo" );
         repoConfig.setName( "Test Repository" );
         repoConfig.setLayout( "default" );
index 2f63b653a13064029e3c18ae76d1dad0755d2072..7abb869ce2c09f9257aaa8c7028f9f926778c1e7 100644 (file)
@@ -20,6 +20,7 @@ package org.apache.maven.archiva.consumers.core.repository;
  */
 
 import junit.framework.TestCase;
+import org.apache.archiva.admin.model.managed.ManagedRepository;
 import org.apache.archiva.metadata.repository.MetadataRepository;
 import org.apache.archiva.metadata.repository.RepositorySession;
 import org.apache.archiva.repository.events.RepositoryListener;
@@ -76,7 +77,7 @@ public abstract class AbstractRepositoryPurgeTest
 
     protected static final String RELEASES_TEST_REPO_NAME = "Releases Test Repo One";
 
-    private ManagedRepositoryConfiguration config;
+    private ManagedRepository config;
 
     private ManagedRepositoryContent repo;
 
@@ -117,9 +118,9 @@ public abstract class AbstractRepositoryPurgeTest
         repo = null;
     }
 
-    public ManagedRepositoryConfiguration getRepoConfiguration( String repoId, String repoName )
+    public ManagedRepository getRepoConfiguration( String repoId, String repoName )
     {
-        config = new ManagedRepositoryConfiguration();
+        config = new ManagedRepository();
         config.setId( repoId );
         config.setName( repoName );
         config.setDaysOlder( TEST_DAYS_OLDER );
index 47a35e1d633679dc4c28d6433416e92ca836b284..c3f8c7b4491f710db1961614d098541fa9b92e00 100644 (file)
@@ -19,10 +19,11 @@ package org.apache.maven.archiva.consumers.core.repository;
  * under the License.
  */
 
+import org.apache.archiva.admin.model.managed.ManagedRepositoryAdmin;
+import org.apache.archiva.admin.repository.managed.DefaultManagedRepositoryAdmin;
 import org.apache.archiva.repository.events.RepositoryListener;
 import org.apache.commons.io.FileUtils;
 import org.apache.maven.archiva.configuration.ArchivaConfiguration;
-import org.apache.maven.archiva.configuration.Configuration;
 import org.apache.maven.archiva.repository.RepositoryContentFactory;
 import org.apache.maven.archiva.repository.metadata.MetadataTools;
 import org.custommonkey.xmlunit.XMLAssert;
@@ -67,7 +68,8 @@ public class CleanupReleasedSnapshotsRepositoryPurgeTest
         super.setUp();
 
         RepositoryContentFactory factory =
-            applicationContext.getBean( "repositoryContentFactory#cleanup-released-snapshots", RepositoryContentFactory.class );
+            applicationContext.getBean( "repositoryContentFactory#cleanup-released-snapshots",
+                                        RepositoryContentFactory.class );
 
         archivaConfiguration =
             applicationContext.getBean( "archivaConfiguration#cleanup-released-snapshots", ArchivaConfiguration.class );
@@ -76,18 +78,28 @@ public class CleanupReleasedSnapshotsRepositoryPurgeTest
 
         listener = (RepositoryListener) listenerControl.getMock();
         List<RepositoryListener> listeners = Collections.singletonList( listener );
-        repoPurge =
-            new CleanupReleasedSnapshotsRepositoryPurge( getRepository(), metadataTools, archivaConfiguration, factory,
-                                                         repositorySession, listeners );
+        repoPurge = new CleanupReleasedSnapshotsRepositoryPurge( getRepository(), metadataTools,
+                                                                 applicationContext.getBean(
+                                                                     ManagedRepositoryAdmin.class ), factory,
+                                                                 repositorySession, listeners );
+
+        ( (DefaultManagedRepositoryAdmin) applicationContext.getBean(
+            ManagedRepositoryAdmin.class ) ).setArchivaConfiguration( archivaConfiguration );
     }
 
     @Test
     public void testReleasedSnapshotsExistsInSameRepo()
         throws Exception
     {
-        Configuration config = archivaConfiguration.getConfiguration();
-        config.removeManagedRepository( config.findManagedRepositoryById( TEST_REPO_ID ) );
-        config.addManagedRepository( getRepoConfiguration( TEST_REPO_ID, TEST_REPO_NAME ) );
+        /**
+         Configuration config = archivaConfiguration.getConfiguration();
+         config.removeManagedRepository( config.findManagedRepositoryById( TEST_REPO_ID ) );
+         config.addManagedRepository( getRepoConfiguration( TEST_REPO_ID, TEST_REPO_NAME ) );
+         **/
+
+        applicationContext.getBean( ManagedRepositoryAdmin.class ).deleteManagedRepository( TEST_REPO_ID, null, false );
+        applicationContext.getBean( ManagedRepositoryAdmin.class ).addManagedRepository(
+            getRepoConfiguration( TEST_REPO_ID, TEST_REPO_NAME ), false, null );
 
         String repoRoot = prepareTestRepos();
 
@@ -142,9 +154,13 @@ public class CleanupReleasedSnapshotsRepositoryPurgeTest
     public void testNonArtifactFile()
         throws Exception
     {
-        Configuration config = archivaConfiguration.getConfiguration();
+        /*Configuration config = archivaConfiguration.getConfiguration();
         config.removeManagedRepository( config.findManagedRepositoryById( TEST_REPO_ID ) );
-        config.addManagedRepository( getRepoConfiguration( TEST_REPO_ID, TEST_REPO_NAME ) );
+        config.addManagedRepository( getRepoConfiguration( TEST_REPO_ID, TEST_REPO_NAME ) );*/
+
+        applicationContext.getBean( ManagedRepositoryAdmin.class ).deleteManagedRepository( TEST_REPO_ID, null, false );
+        applicationContext.getBean( ManagedRepositoryAdmin.class ).addManagedRepository(
+            getRepoConfiguration( TEST_REPO_ID, TEST_REPO_NAME ), false, null );
 
         String repoRoot = prepareTestRepos();
 
@@ -152,7 +168,7 @@ public class CleanupReleasedSnapshotsRepositoryPurgeTest
         listenerControl.replay();
 
         File file = new File( repoRoot, INDEX_PATH );
-        if (!file.exists())
+        if ( !file.exists() )
         {
             // help windauze to create directory with .
             file.getParentFile().mkdirs();
@@ -171,10 +187,18 @@ public class CleanupReleasedSnapshotsRepositoryPurgeTest
     public void testReleasedSnapshotsExistsInDifferentRepo()
         throws Exception
     {
+        /*
         Configuration config = archivaConfiguration.getConfiguration();
         config.removeManagedRepository( config.findManagedRepositoryById( TEST_REPO_ID ) );
         config.addManagedRepository( getRepoConfiguration( TEST_REPO_ID, TEST_REPO_NAME ) );
         config.addManagedRepository( getRepoConfiguration( RELEASES_TEST_REPO_ID, RELEASES_TEST_REPO_NAME ) );
+        */
+        applicationContext.getBean( ManagedRepositoryAdmin.class ).deleteManagedRepository( TEST_REPO_ID, null, false );
+        applicationContext.getBean( ManagedRepositoryAdmin.class ).addManagedRepository(
+            getRepoConfiguration( TEST_REPO_ID, TEST_REPO_NAME ), false, null );
+
+        applicationContext.getBean( ManagedRepositoryAdmin.class ).addManagedRepository(
+            getRepoConfiguration( RELEASES_TEST_REPO_ID, RELEASES_TEST_REPO_NAME ), false, null );
 
         String repoRoot = prepareTestRepos();
 
@@ -217,9 +241,14 @@ public class CleanupReleasedSnapshotsRepositoryPurgeTest
     public void testHigherSnapshotExistsInSameRepo()
         throws Exception
     {
+        /*
         Configuration config = archivaConfiguration.getConfiguration();
         config.removeManagedRepository( config.findManagedRepositoryById( TEST_REPO_ID ) );
         config.addManagedRepository( getRepoConfiguration( TEST_REPO_ID, TEST_REPO_NAME ) );
+        */
+        applicationContext.getBean( ManagedRepositoryAdmin.class ).deleteManagedRepository( TEST_REPO_ID, null, false );
+        applicationContext.getBean( ManagedRepositoryAdmin.class ).addManagedRepository(
+            getRepoConfiguration( TEST_REPO_ID, TEST_REPO_NAME ), false, null );
 
         String repoRoot = prepareTestRepos();
 
index 3f0ec595ca131af20eae0ee938e6bf19e5129e10..06f753800e9eec3a177fa974ec3759244bfd984e 100644 (file)
@@ -19,6 +19,7 @@ package org.apache.maven.archiva.consumers.core.repository;
  * under the License.
  */
 
+import org.apache.archiva.admin.model.managed.ManagedRepository;
 import org.apache.archiva.repository.events.RepositoryListener;
 import org.apache.commons.lang.time.DateUtils;
 import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
@@ -52,7 +53,7 @@ public class DaysOldRepositoryPurgeTest
     public void testByLastModified()
         throws Exception
     {
-        ManagedRepositoryConfiguration repoConfiguration = getRepoConfiguration( TEST_REPO_ID, TEST_REPO_NAME );
+        ManagedRepository repoConfiguration = getRepoConfiguration( TEST_REPO_ID, TEST_REPO_NAME );
         repoPurge = new DaysOldRepositoryPurge( getRepository(), repoConfiguration.getDaysOlder(),
                                                 repoConfiguration.getRetentionCount(), repositorySession,
                                                 Collections.singletonList( listener ) );
@@ -114,7 +115,7 @@ public class DaysOldRepositoryPurgeTest
     public void testOrderOfDeletion()
         throws Exception
     {
-        ManagedRepositoryConfiguration repoConfiguration = getRepoConfiguration( TEST_REPO_ID, TEST_REPO_NAME );
+        ManagedRepository repoConfiguration = getRepoConfiguration( TEST_REPO_ID, TEST_REPO_NAME );
         List<RepositoryListener> listeners = Collections.singletonList( listener );
         repoPurge = new DaysOldRepositoryPurge( getRepository(), repoConfiguration.getDaysOlder(),
                                                 repoConfiguration.getRetentionCount(), repositorySession, listeners );
@@ -165,7 +166,7 @@ public class DaysOldRepositoryPurgeTest
     public void testMetadataDrivenSnapshots()
         throws Exception
     {
-        ManagedRepositoryConfiguration repoConfiguration = getRepoConfiguration( TEST_REPO_ID, TEST_REPO_NAME );
+        ManagedRepository repoConfiguration = getRepoConfiguration( TEST_REPO_ID, TEST_REPO_NAME );
         List<RepositoryListener> listeners = Collections.singletonList( listener );
         repoPurge = new DaysOldRepositoryPurge( getRepository(), repoConfiguration.getDaysOlder(),
                                                 repoConfiguration.getRetentionCount(), repositorySession, listeners );
index 9da04bc006e8c72694560f499ebeea23c5d44fe8..8e4df2cd61831b2cab7be095ef3a5ff8fb3ec741 100644 (file)
@@ -19,14 +19,15 @@ package org.apache.maven.archiva.consumers.core.repository;
  * under the License.
  */
 
+import org.apache.archiva.admin.model.managed.ManagedRepository;
+import org.apache.archiva.admin.model.managed.ManagedRepositoryAdmin;
+import org.apache.archiva.admin.repository.managed.DefaultManagedRepositoryAdmin;
 import org.apache.archiva.metadata.repository.TestRepositorySessionFactory;
 import org.apache.commons.io.FileUtils;
 import org.apache.maven.archiva.common.utils.BaseFile;
 import org.apache.maven.archiva.configuration.ArchivaConfiguration;
-import org.apache.maven.archiva.configuration.Configuration;
 import org.apache.maven.archiva.configuration.FileType;
 import org.apache.maven.archiva.configuration.FileTypes;
-import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
 import org.apache.maven.archiva.consumers.KnownRepositoryContentConsumer;
 import org.apache.maven.archiva.consumers.functors.ConsumerWantsFilePredicate;
 import org.custommonkey.xmlunit.XMLAssert;
@@ -43,6 +44,16 @@ import java.io.File;
 public class RepositoryPurgeConsumerTest
     extends AbstractRepositoryPurgeTest
 {
+    @Before
+    public void setUp()
+        throws Exception
+    {
+        super.setUp();
+
+        TestRepositorySessionFactory factory = applicationContext.getBean( TestRepositorySessionFactory.class );
+        factory.setRepository( metadataRepository );
+    }
+
     @Test
     public void testConsumption()
         throws Exception
@@ -117,7 +128,7 @@ public class RepositoryPurgeConsumerTest
             applicationContext.getBean( "knownRepositoryContentConsumer#repo-purge-consumer-by-retention-count",
                                         KnownRepositoryContentConsumer.class );
 
-        ManagedRepositoryConfiguration repoConfiguration = getRepoConfiguration( TEST_REPO_ID, TEST_REPO_NAME );
+        ManagedRepository repoConfiguration = getRepoConfiguration( TEST_REPO_ID, TEST_REPO_NAME );
         repoConfiguration.setDaysOlder( 0 ); // force days older off to allow retention count purge to execute.
         repoConfiguration.setRetentionCount( TEST_RETENTION_COUNT );
         addRepoToConfiguration( "retention-count", repoConfiguration );
@@ -163,32 +174,51 @@ public class RepositoryPurgeConsumerTest
         removeRepoFromConfiguration( "retention-count", repoConfiguration );
     }
 
-    private void addRepoToConfiguration( String configHint, ManagedRepositoryConfiguration repoConfiguration )
+    private void addRepoToConfiguration( String configHint, ManagedRepository repoConfiguration )
         throws Exception
     {
         ArchivaConfiguration archivaConfiguration =
             applicationContext.getBean( "archivaConfiguration#" + configHint, ArchivaConfiguration.class );
-        Configuration configuration = archivaConfiguration.getConfiguration();
-        ManagedRepositoryConfiguration managedRepositoryConfiguration =
-            configuration.findManagedRepositoryById( repoConfiguration.getId() );
-        if ( managedRepositoryConfiguration != null )
+        ( (DefaultManagedRepositoryAdmin) applicationContext.getBean(
+            ManagedRepositoryAdmin.class ) ).setArchivaConfiguration( archivaConfiguration );
+        /**
+         Configuration configuration = archivaConfiguration.getConfiguration();
+         ManagedRepositoryConfiguration managedRepositoryConfiguration =
+         configuration.findManagedRepositoryById( repoConfiguration.getId() );
+         if ( managedRepositoryConfiguration != null )
+         {
+         configuration.removeManagedRepository( managedRepositoryConfiguration );
+         }
+         configuration.addManagedRepository( repoConfiguration );
+         **/
+        ManagedRepositoryAdmin managedRepositoryAdmin = applicationContext.getBean( ManagedRepositoryAdmin.class );
+        if ( managedRepositoryAdmin.getManagedRepository( repoConfiguration.getId() ) != null )
         {
-            configuration.removeManagedRepository( managedRepositoryConfiguration );
+            managedRepositoryAdmin.deleteManagedRepository( repoConfiguration.getId(), null, false );
         }
-        configuration.addManagedRepository( repoConfiguration );
+        managedRepositoryAdmin.addManagedRepository( repoConfiguration, false, null );
     }
 
-    private void removeRepoFromConfiguration( String configHint, ManagedRepositoryConfiguration repoConfiguration )
+    private void removeRepoFromConfiguration( String configHint, ManagedRepository repoConfiguration )
         throws Exception
     {
         ArchivaConfiguration archivaConfiguration =
             applicationContext.getBean( "archivaConfiguration#" + configHint, ArchivaConfiguration.class );
-        Configuration configuration = archivaConfiguration.getConfiguration();
-        ManagedRepositoryConfiguration managedRepositoryConfiguration =
-            configuration.findManagedRepositoryById( repoConfiguration.getId() );
-        if ( managedRepositoryConfiguration != null )
+
+        ( (DefaultManagedRepositoryAdmin) applicationContext.getBean(
+            ManagedRepositoryAdmin.class ) ).setArchivaConfiguration( archivaConfiguration );
+        /**
+         Configuration configuration = archivaConfiguration.getConfiguration();
+         ManagedRepositoryConfiguration managedRepositoryConfiguration =
+         configuration.findManagedRepositoryById( repoConfiguration.getId() );
+         if ( managedRepositoryConfiguration != null )
+         {
+         configuration.removeManagedRepository( managedRepositoryConfiguration );
+         }*/
+        ManagedRepositoryAdmin managedRepositoryAdmin = applicationContext.getBean( ManagedRepositoryAdmin.class );
+        if ( managedRepositoryAdmin.getManagedRepository( repoConfiguration.getId() ) != null )
         {
-            configuration.removeManagedRepository( managedRepositoryConfiguration );
+            managedRepositoryAdmin.deleteManagedRepository( repoConfiguration.getId(), null, true );
         }
     }
 
@@ -200,7 +230,7 @@ public class RepositoryPurgeConsumerTest
             applicationContext.getBean( "knownRepositoryContentConsumer#repo-purge-consumer-by-days-old",
                                         KnownRepositoryContentConsumer.class );
 
-        ManagedRepositoryConfiguration repoConfiguration = getRepoConfiguration( TEST_REPO_ID, TEST_REPO_NAME );
+        ManagedRepository repoConfiguration = getRepoConfiguration( TEST_REPO_ID, TEST_REPO_NAME );
         repoConfiguration.setDaysOlder( TEST_DAYS_OLDER );
         addRepoToConfiguration( "days-old", repoConfiguration );
 
@@ -258,7 +288,7 @@ public class RepositoryPurgeConsumerTest
             applicationContext.getBean( "knownRepositoryContentConsumer#repo-purge-consumer-by-retention-count",
                                         KnownRepositoryContentConsumer.class );
 
-        ManagedRepositoryConfiguration repoConfiguration = getRepoConfiguration( TEST_REPO_ID, TEST_REPO_NAME );
+        ManagedRepository repoConfiguration = getRepoConfiguration( TEST_REPO_ID, TEST_REPO_NAME );
         repoConfiguration.setDeleteReleasedSnapshots( false ); // Set to NOT delete released snapshots.
         addRepoToConfiguration( "retention-count", repoConfiguration );
 
@@ -303,7 +333,7 @@ public class RepositoryPurgeConsumerTest
             applicationContext.getBean( "knownRepositoryContentConsumer#repo-purge-consumer-by-days-old",
                                         KnownRepositoryContentConsumer.class );
 
-        ManagedRepositoryConfiguration repoConfiguration = getRepoConfiguration( TEST_REPO_ID, TEST_REPO_NAME );
+        ManagedRepository repoConfiguration = getRepoConfiguration( TEST_REPO_ID, TEST_REPO_NAME );
         repoConfiguration.setDeleteReleasedSnapshots( true );
         addRepoToConfiguration( "days-old", repoConfiguration );
 
@@ -340,14 +370,4 @@ public class RepositoryPurgeConsumerTest
 
         removeRepoFromConfiguration( "days-old", repoConfiguration );
     }
-
-    @Before
-    public void setUp()
-        throws Exception
-    {
-        super.setUp();
-
-        TestRepositorySessionFactory factory = applicationContext.getBean( TestRepositorySessionFactory.class );
-        factory.setRepository( metadataRepository );
-    }
 }
index be4c2f1182d0d8954f2595afe3e3f52ff06e8cb3..718bbd5c0b9a32f93f819e053df3155b4983914d 100644 (file)
@@ -19,6 +19,7 @@ package org.apache.maven.archiva.consumers.core.repository;
  * under the License.
  */
 
+import org.apache.archiva.admin.model.managed.ManagedRepository;
 import org.apache.archiva.repository.events.RepositoryListener;
 import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
 import org.junit.Before;
@@ -39,7 +40,7 @@ public class RetentionCountRepositoryPurgeTest
     {
         super.setUp();
 
-        ManagedRepositoryConfiguration repoConfiguration = getRepoConfiguration( TEST_REPO_ID, TEST_REPO_NAME );
+        ManagedRepository repoConfiguration = getRepoConfiguration( TEST_REPO_ID, TEST_REPO_NAME );
         List<RepositoryListener> listeners = Collections.singletonList( listener );
         repoPurge = new RetentionCountRepositoryPurge( getRepository(), repoConfiguration.getRetentionCount(),
                                                        repositorySession, listeners );
diff --git a/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/resources/META-INF/redback/redback-core.xml b/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/resources/META-INF/redback/redback-core.xml
new file mode 100644 (file)
index 0000000..ecc1de8
--- /dev/null
@@ -0,0 +1,213 @@
+<redback-role-model>
+    <modelVersion>1.0.0</modelVersion>
+    <applications>
+        <application>
+          <id>System</id>
+          <description>Roles that apply system-wide, across all of the applications</description>
+        <version>1.0.0</version>
+        <resources>
+            <resource>
+                <id>global</id>
+                <name>*</name>
+                <permanent>true</permanent>
+                <description>global resource implies full access for authorization</description>
+            </resource>
+            <resource>
+                <id>username</id>
+                <name>${username}</name>
+                <permanent>true</permanent>
+                <description>replaced with the username of the principal at authorization check time</description>
+            </resource>
+        </resources>
+        <operations>
+            <operation>
+                <id>configuration-edit</id>
+                <name>configuration-edit</name>
+                <description>edit configuration</description>
+                <permanent>true</permanent>
+            </operation>
+            <operation>
+                <id>user-management-user-create</id>
+                <name>user-management-user-create</name>
+                <description>create user</description>
+                <permanent>true</permanent>
+            </operation>
+            <operation>
+                <id>user-management-user-edit</id>
+                <name>user-management-user-edit</name>
+                <description>edit user</description>
+                <permanent>true</permanent>
+            </operation>
+            <operation>
+                <id>user-management-user-role</id>
+                <name>user-management-user-role</name>
+                <description>user roles</description>
+                <permanent>true</permanent>
+            </operation>
+            <operation>
+                <id>user-management-user-delete</id>
+                <name>user-management-user-delete</name>
+                <description>delete user</description>
+                <permanent>true</permanent>
+            </operation>
+            <operation>
+                <id>user-management-user-list</id>
+                <name>user-management-user-list</name>
+                <description>list users</description>
+                <permanent>true</permanent>
+            </operation>
+            <operation>
+                <id>user-management-role-grant</id>
+                <name>user-management-role-grant</name>
+                <description>grant role</description>
+                <permanent>true</permanent>
+            </operation>
+            <operation>
+                <id>user-management-role-drop</id>
+                <name>user-management-role-drop</name>
+                <description>drop role</description>
+                <permanent>true</permanent>
+            </operation>
+            <operation>
+                <id>user-management-rbac-admin</id>
+                <name>user-management-rbac-admin</name>
+                <description>administer rbac</description>
+                <permanent>true</permanent>
+            </operation>
+            <operation>
+                <id>guest-access</id>
+                <name>guest-access</name>
+                <description>access guest</description>
+                <permanent>true</permanent>
+            </operation>
+            <operation>
+                <id>user-management-manage-data</id>
+                <name>user-management-manage-data</name>
+                <description>manage data</description>
+                <permanent>true</permanent>
+            </operation>            
+        </operations>
+        <roles>
+            <role>
+                <id>system-administrator</id>
+                <name>System Administrator</name>
+                <permanent>true</permanent>
+                <assignable>true</assignable>
+                <permissions>
+                    <permission>
+                        <id>edit-redback-configuration</id>
+                        <name>Edit Redback Configuration</name>
+                        <operation>configuration-edit</operation>
+                        <resource>global</resource>
+                        <permanent>true</permanent>
+                    </permission>
+                    <permission>
+                        <id>manage-rbac-setup</id>
+                        <name>User RBAC Management</name>
+                        <operation>user-management-rbac-admin</operation>
+                        <resource>global</resource>
+                        <permanent>true</permanent>
+                    </permission>
+                    <permission>
+                        <id>manage-rbac-data</id>
+                        <name>RBAC Manage Data</name>
+                        <operation>user-management-manage-data</operation>
+                        <resource>global</resource>
+                        <permanent>true</permanent>
+                    </permission>                    
+                </permissions>
+                <childRoles>
+                    <childRole>user-administrator</childRole>
+                </childRoles>
+            </role>
+            <role>
+                <id>user-administrator</id>
+                <name>User Administrator</name>
+                <permanent>true</permanent>
+                <assignable>true</assignable>
+                <permissions>
+                    <permission>
+                        <id>drop-roles-for-anyone</id>
+                        <name>Drop Roles for Anyone</name>
+                        <operation>user-management-role-drop</operation>
+                        <resource>global</resource>
+                        <permanent>true</permanent>
+                    </permission>
+                    <permission>
+                        <id>grant-roles-for-anyone</id>
+                        <name>Grant Roles for Anyone</name>
+                        <operation>user-management-role-grant</operation>
+                        <resource>global</resource>
+                        <permanent>true</permanent>
+                    </permission>
+                    <permission>
+                        <id>user-create</id>
+                        <name>Create Users</name>
+                        <operation>user-management-user-create</operation>
+                        <resource>global</resource>
+                        <permanent>true</permanent>
+                    </permission>
+                    <permission>
+                        <id>user-delete</id>
+                        <name>Delete Users</name>
+                        <operation>user-management-user-delete</operation>
+                        <resource>global</resource>
+                        <permanent>true</permanent>
+                    </permission>
+                    <permission>
+                        <id>user-edit</id>
+                        <name>Edit Users</name>
+                        <operation>user-management-user-edit</operation>
+                        <resource>global</resource>
+                        <permanent>true</permanent>
+                    </permission>
+                    <permission>
+                        <id>access-users-roles</id>
+                        <name>Access Users Roles</name>
+                        <operation>user-management-user-role</operation>
+                        <resource>global</resource>
+                        <permanent>true</permanent>
+                    </permission>
+                    <permission>
+                        <id>access-user-list</id>
+                        <name>Access User List</name>
+                        <operation>user-management-user-list</operation>
+                        <resource>global</resource>
+                        <permanent>true</permanent>
+                    </permission>
+                </permissions>
+            </role>
+            <role>
+                <id>registered-user</id>
+                <name>Registered User</name>
+                <permanent>true</permanent>
+                <assignable>true</assignable>
+                <permissions>
+                    <permission>
+                        <id>edit-user-by-username</id>
+                        <name>Edit User Data by Username</name>
+                        <operation>user-management-user-edit</operation>
+                        <resource>username</resource>
+                        <permanent>true</permanent>
+                    </permission>
+                </permissions>
+            </role>
+            <role>
+                <id>guest</id>
+                <name>Guest</name>
+                <permanent>true</permanent>
+                <assignable>true</assignable>
+                <permissions>
+                    <permission>
+                        <id>guest-permission</id>
+                        <name>Guest Permission</name>
+                        <operation>guest-access</operation>
+                        <resource>global</resource>
+                        <permanent>true</permanent>
+                    </permission>
+                </permissions>
+            </role>
+        </roles>
+        </application>
+    </applications>
+</redback-role-model>
\ No newline at end of file
diff --git a/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/resources/META-INF/spring-context.xml b/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/resources/META-INF/spring-context.xml
new file mode 100644 (file)
index 0000000..176462a
--- /dev/null
@@ -0,0 +1,41 @@
+<?xml version="1.0"?>
+
+<!--
+  ~ 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.
+  -->
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xmlns:context="http://www.springframework.org/schema/context"
+       xsi:schemaLocation="http://www.springframework.org/schema/beans
+           http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
+           http://www.springframework.org/schema/context 
+           http://www.springframework.org/schema/context/spring-context-3.0.xsd" default-lazy-init="true">
+
+  <bean name="scheduler" class="org.codehaus.redback.components.scheduler.DefaultScheduler">
+    <property name="properties">
+      <props>
+        <prop key="org.quartz.scheduler.instanceName">scheduler1</prop>
+        <prop key="org.quartz.threadPool.class">org.quartz.simpl.SimpleThreadPool</prop>
+        <prop key="org.quartz.threadPool.threadCount">2</prop>
+        <prop key="org.quartz.threadPool.threadPriority">4</prop>
+        <prop key="org.quartz.jobStore.class">org.quartz.simpl.RAMJobStore</prop>
+      </props>
+    </property>
+  </bean>
+
+</beans>
\ No newline at end of file
index 3e87693e9f4534ccf577d21bfc723e489662291d..3fdf86d9d777d3bcc578c9e16a9ca36881614fab 100644 (file)
@@ -19,6 +19,7 @@ package org.apache.archiva.consumers.lucene;
  * under the License.
  */
 
+import org.apache.archiva.admin.model.managed.ManagedRepository;
 import org.apache.archiva.common.plexusbridge.MavenIndexerUtils;
 import org.apache.archiva.common.plexusbridge.PlexusSisuBridge;
 import org.apache.archiva.common.plexusbridge.PlexusSisuBridgeException;
@@ -27,7 +28,6 @@ import org.apache.archiva.scheduler.indexing.ArtifactIndexingTask;
 import org.apache.maven.archiva.configuration.ArchivaConfiguration;
 import org.apache.maven.archiva.configuration.ConfigurationNames;
 import org.apache.maven.archiva.configuration.FileTypes;
-import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
 import org.apache.maven.archiva.consumers.AbstractMonitoredConsumer;
 import org.apache.maven.archiva.consumers.ConsumerException;
 import org.apache.maven.archiva.consumers.KnownRepositoryContentConsumer;
@@ -35,14 +35,13 @@ import org.apache.maven.index.NexusIndexer;
 import org.apache.maven.index.context.IndexCreator;
 import org.apache.maven.index.context.IndexingContext;
 import org.apache.maven.index.context.UnsupportedExistingLuceneIndexException;
-import org.codehaus.plexus.personality.plexus.lifecycle.phase.Initializable;
-import org.codehaus.plexus.personality.plexus.lifecycle.phase.InitializationException;
 import org.codehaus.plexus.registry.Registry;
 import org.codehaus.plexus.registry.RegistryListener;
 import org.codehaus.plexus.taskqueue.TaskQueueException;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import javax.annotation.PostConstruct;
 import java.io.File;
 import java.io.IOException;
 import java.util.ArrayList;
@@ -55,7 +54,7 @@ import java.util.List;
  */
 public class NexusIndexerConsumer
     extends AbstractMonitoredConsumer
-    implements KnownRepositoryContentConsumer, RegistryListener, Initializable
+    implements KnownRepositoryContentConsumer, RegistryListener
 {
     private Logger log = LoggerFactory.getLogger( NexusIndexerConsumer.class );
 
@@ -73,7 +72,7 @@ public class NexusIndexerConsumer
 
     private List<String> includes = new ArrayList<String>();
 
-    private ManagedRepositoryConfiguration repository;
+    private ManagedRepository repository;
 
     private List<? extends IndexCreator> allIndexCreators;
 
@@ -104,7 +103,7 @@ public class NexusIndexerConsumer
         return false;
     }
 
-    public void beginScan( ManagedRepositoryConfiguration repository, Date whenGathered )
+    public void beginScan( ManagedRepository repository, Date whenGathered )
         throws ConsumerException
     {
         this.repository = repository;
@@ -125,7 +124,7 @@ public class NexusIndexerConsumer
         }
     }
 
-    public void beginScan( ManagedRepositoryConfiguration repository, Date whenGathered, boolean executeOnEntireRepo )
+    public void beginScan( ManagedRepository repository, Date whenGathered, boolean executeOnEntireRepo )
         throws ConsumerException
     {
         if ( executeOnEntireRepo )
@@ -238,8 +237,8 @@ public class NexusIndexerConsumer
         includes.addAll( filetypes.getFileTypePatterns( FileTypes.ARTIFACTS ) );
     }
 
+    @PostConstruct
     public void initialize()
-        throws InitializationException
     {
         configuration.addChangeListener( this );
 
index 53a8fc6bfffbbe5845d7908a13ce94dbb80650e4..f9d8c8fb5b4694c25c2bcdbe2f7b27ffe6e4f057 100644 (file)
@@ -20,6 +20,7 @@ package org.apache.archiva.consumers.lucene;
  */
 
 import junit.framework.TestCase;
+import org.apache.archiva.admin.model.managed.ManagedRepository;
 import org.apache.archiva.common.plexusbridge.MavenIndexerUtils;
 import org.apache.archiva.common.plexusbridge.PlexusSisuBridge;
 import org.apache.archiva.scheduler.ArchivaTaskScheduler;
@@ -88,7 +89,7 @@ public class NexusIndexerConsumerTest
 
     private KnownRepositoryContentConsumer nexusIndexerConsumer;
 
-    private ManagedRepositoryConfiguration repositoryConfig;
+    private ManagedRepository repositoryConfig;
 
     private ArchivaTaskSchedulerStub scheduler;
 
@@ -119,9 +120,9 @@ public class NexusIndexerConsumerTest
             new NexusIndexerConsumer( scheduler, configuration, filetypes, plexusSisuBridge, mavenIndexerUtils );
 
         // initialize to set the file types to be processed
-        ( (Initializable) nexusIndexerConsumer ).initialize();
+        ( (NexusIndexerConsumer) nexusIndexerConsumer ).initialize();
 
-        repositoryConfig = new ManagedRepositoryConfiguration();
+        repositoryConfig = new ManagedRepository();
         repositoryConfig.setId( "test-repo" );
         repositoryConfig.setLocation( "target/test-classes/test-repo" );
         repositoryConfig.setLayout( "default" );
index 223d0a353bffe2bb7fcafc1def432ca9c9e7fe14..034bad7d05e0f492f024b702a61de88fa35a103e 100644 (file)
@@ -19,6 +19,7 @@ package org.apache.archiva.consumers.metadata;
  * under the License.
  */
 
+import org.apache.archiva.admin.model.managed.ManagedRepository;
 import org.apache.archiva.metadata.model.ArtifactMetadata;
 import org.apache.archiva.metadata.model.ProjectMetadata;
 import org.apache.archiva.metadata.model.ProjectVersionMetadata;
@@ -33,7 +34,6 @@ import org.apache.maven.archiva.common.utils.VersionUtil;
 import org.apache.maven.archiva.configuration.ArchivaConfiguration;
 import org.apache.maven.archiva.configuration.ConfigurationNames;
 import org.apache.maven.archiva.configuration.FileTypes;
-import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
 import org.apache.maven.archiva.consumers.AbstractMonitoredConsumer;
 import org.apache.maven.archiva.consumers.ConsumerException;
 import org.apache.maven.archiva.consumers.KnownRepositoryContentConsumer;
@@ -131,14 +131,14 @@ public class ArchivaMetadataCreationConsumer
         return this.includes;
     }
 
-    public void beginScan( ManagedRepositoryConfiguration repo, Date whenGathered )
+    public void beginScan( ManagedRepository repo, Date whenGathered )
         throws ConsumerException
     {
         repoId = repo.getId();
         this.whenGathered = whenGathered;
     }
 
-    public void beginScan( ManagedRepositoryConfiguration repository, Date whenGathered, boolean executeOnEntireRepo )
+    public void beginScan( ManagedRepository repository, Date whenGathered, boolean executeOnEntireRepo )
         throws ConsumerException
     {
         beginScan( repository, whenGathered );
index 02950448b634b71a5764e5cad7c67f8a11296742..dd45dce71431e08729cf0f4401a78ace5592c898 100644 (file)
@@ -19,6 +19,7 @@ package org.apache.maven.archiva.converter.legacy;
  * under the License.
  */
 
+import org.apache.archiva.admin.model.managed.ManagedRepository;
 import org.apache.archiva.common.plexusbridge.PlexusSisuBridge;
 import org.apache.archiva.common.plexusbridge.PlexusSisuBridgeException;
 import org.apache.archiva.repository.scanner.RepositoryScanner;
@@ -89,7 +90,7 @@ public class DefaultLegacyRepositoryConverter
         {
             String defaultRepositoryUrl = PathUtil.toUrl( repositoryDirectory );
 
-            ManagedRepositoryConfiguration legacyRepository = new ManagedRepositoryConfiguration();
+            ManagedRepository legacyRepository = new ManagedRepository();
             legacyRepository.setId( "legacy" );
             legacyRepository.setName( "Legacy Repository" );
             legacyRepository.setLocation( legacyRepositoryDirectory.getAbsolutePath() );
index 92a7d0cc6626e4467f86ce6735ae84775a52a65f..9921de22fe4ea45a60c3911efd4c6e883c9faea4 100644 (file)
@@ -19,9 +19,9 @@ package org.apache.maven.archiva.converter.legacy;
  * under the License.
  */
 
+import org.apache.archiva.admin.model.managed.ManagedRepository;
 import org.apache.archiva.common.plexusbridge.PlexusSisuBridge;
 import org.apache.archiva.common.plexusbridge.PlexusSisuBridgeException;
-import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
 import org.apache.maven.archiva.consumers.AbstractMonitoredConsumer;
 import org.apache.maven.archiva.consumers.ConsumerException;
 import org.apache.maven.archiva.consumers.KnownRepositoryContentConsumer;
@@ -88,14 +88,14 @@ public class LegacyConverterArtifactConsumer
         artifactFactory = plexusSisuBridge.lookup( ArtifactFactory.class );
     }
 
-    public void beginScan( ManagedRepositoryConfiguration repository, Date whenGathered )
+    public void beginScan( ManagedRepository repository, Date whenGathered )
         throws ConsumerException
     {
         this.managedRepository = new ManagedDefaultRepositoryContent();
         this.managedRepository.setRepository( repository );
     }
 
-    public void beginScan( ManagedRepositoryConfiguration repository, Date whenGathered, boolean executeOnEntireRepo )
+    public void beginScan( ManagedRepository repository, Date whenGathered, boolean executeOnEntireRepo )
         throws ConsumerException
     {
         beginScan( repository, whenGathered );
diff --git a/archiva-modules/archiva-base/archiva-converter/src/test/java/org/apache/maven/archiva/converter/mock/MockArchivaAdministration.java b/archiva-modules/archiva-base/archiva-converter/src/test/java/org/apache/maven/archiva/converter/mock/MockArchivaAdministration.java
new file mode 100644 (file)
index 0000000..4a3f6e9
--- /dev/null
@@ -0,0 +1,148 @@
+package org.apache.maven.archiva.converter.mock;
+/*
+ * 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.admin.model.AuditInformation;
+import org.apache.archiva.admin.model.RepositoryAdminException;
+import org.apache.archiva.admin.model.admin.ArchivaAdministration;
+import org.apache.archiva.admin.model.admin.FileType;
+import org.apache.archiva.admin.model.admin.LegacyArtifactPath;
+import org.apache.archiva.admin.model.admin.OrganisationInformation;
+
+import java.util.List;
+
+/**
+ * @author Olivier Lamy
+ */
+public class MockArchivaAdministration implements ArchivaAdministration
+{
+    public List<LegacyArtifactPath> getLegacyArtifactPaths()
+        throws RepositoryAdminException
+    {
+        return null;
+    }
+
+    public void addLegacyArtifactPath( LegacyArtifactPath legacyArtifactPath, AuditInformation auditInformation )
+        throws RepositoryAdminException
+    {
+
+    }
+
+    public void deleteLegacyArtifactPath( String path, AuditInformation auditInformation )
+        throws RepositoryAdminException
+    {
+
+    }
+
+    public void addFileTypePattern( String fileTypeId, String pattern, AuditInformation auditInformation )
+        throws RepositoryAdminException
+    {
+
+    }
+
+    public void removeFileTypePattern( String fileTypeId, String pattern, AuditInformation auditInformation )
+        throws RepositoryAdminException
+    {
+
+    }
+
+    public List<FileType> getFileTypes()
+        throws RepositoryAdminException
+    {
+        return null;
+    }
+
+    public FileType getFileType( String fileTypeId )
+        throws RepositoryAdminException
+    {
+        return null;
+    }
+
+    public void addFileType( FileType fileType, AuditInformation auditInformation )
+        throws RepositoryAdminException
+    {
+
+    }
+
+    public void removeFileType( String fileTypeId, AuditInformation auditInformation )
+        throws RepositoryAdminException
+    {
+
+    }
+
+    public void addKnownContentConsumer( String knownContentConsumer, AuditInformation auditInformation )
+        throws RepositoryAdminException
+    {
+
+    }
+
+    public void setKnownContentConsumers( List<String> knownContentConsumers, AuditInformation auditInformation )
+        throws RepositoryAdminException
+    {
+
+    }
+
+    public List<String> getKnownContentConsumers()
+        throws RepositoryAdminException
+    {
+        return null;
+    }
+
+    public void removeKnownContentConsumer( String knownContentConsumer, AuditInformation auditInformation )
+        throws RepositoryAdminException
+    {
+
+    }
+
+    public void addInvalidContentConsumer( String invalidContentConsumer, AuditInformation auditInformation )
+        throws RepositoryAdminException
+    {
+
+    }
+
+    public void setInvalidContentConsumers( List<String> invalidContentConsumers, AuditInformation auditInformation )
+        throws RepositoryAdminException
+    {
+
+    }
+
+    public List<String> getInvalidContentConsumers()
+        throws RepositoryAdminException
+    {
+        return null;
+    }
+
+    public void removeInvalidContentConsumer( String invalidContentConsumer, AuditInformation auditInformation )
+        throws RepositoryAdminException
+    {
+
+    }
+
+    public OrganisationInformation getOrganisationInformation()
+        throws RepositoryAdminException
+    {
+        return null;
+    }
+
+    public void setOrganisationInformation( OrganisationInformation organisationInformation )
+        throws RepositoryAdminException
+    {
+
+    }
+}
index 60142d78141abc56e57a6772f97f48bb8a316716..0f39f64a01b7923991eeea2ba495ce813bcb651b 100644 (file)
@@ -27,5 +27,6 @@
            http://www.springframework.org/schema/context/spring-context-3.0.xsd"
        default-lazy-init="true">
 
+  <bean name="mockArchivaAdministration" class="org.apache.maven.archiva.converter.mock.MockArchivaAdministration"/>
 
 </beans>
\ No newline at end of file
index e5c1e4f5bb30bff1c8a88311b0d82d4955ae5d6d..f2db9cf3eb86287ab93f8942686bc58f468c0198 100644 (file)
@@ -373,8 +373,8 @@ public class NexusRepositorySearch
                 hit = new SearchResultHit();
                 hit.setArtifactId( artifactInfo.artifactId );
                 hit.setGroupId( artifactInfo.groupId );
-                // do we still need to set the repository id even though we're merging everything?
-                //hit.setRepositoryId( artifactInfo.repository );
+                hit.setRepositoryId( artifactInfo.repository );
+                // FIXME archiva url ??
                 hit.setUrl( artifactInfo.repository + "/" + artifactInfo.fname );
                 hit.addVersion( artifactInfo.version );
                 hit.setBundleExportPackage( artifactInfo.bundleExportPackage );
index bdec0c387717905223e9d9975ee8328279082d10..237c5d66fe1030915a53e9b4bd895c8ec5aeaeb7 100644 (file)
@@ -200,11 +200,23 @@ public class SearchResultHit
     @Override
     public String toString()
     {
-        return "SearchResultHit{" + "context='" + context + '\'' + ", url='" + url + '\'' + ", groupId='" + groupId
-            + '\'' + ", artifactId='" + artifactId + '\'' + ", version='" + version + '\'' + ", repositoryId='"
-            + repositoryId + '\'' + ", versions=" + versions + ", bundleVersion='" + bundleVersion + '\''
-            + ", bundleSymbolicName='" + bundleSymbolicName + '\'' + ", bundleExportPackage='" + bundleExportPackage
-            + '\'' + ", bundleExportService='" + bundleExportService + '\'' + '}';
+        final StringBuilder sb = new StringBuilder();
+        sb.append( "SearchResultHit" );
+        sb.append( "{context='" ).append( context ).append( '\'' );
+        sb.append( ", url='" ).append( url ).append( '\'' );
+        sb.append( ", groupId='" ).append( groupId ).append( '\'' );
+        sb.append( ", artifactId='" ).append( artifactId ).append( '\'' );
+        sb.append( ", version='" ).append( version ).append( '\'' );
+        sb.append( ", repositoryId='" ).append( repositoryId ).append( '\'' );
+        sb.append( ", versions=" ).append( versions );
+        sb.append( ", bundleVersion='" ).append( bundleVersion ).append( '\'' );
+        sb.append( ", bundleSymbolicName='" ).append( bundleSymbolicName ).append( '\'' );
+        sb.append( ", bundleExportPackage='" ).append( bundleExportPackage ).append( '\'' );
+        sb.append( ", bundleExportService='" ).append( bundleExportService ).append( '\'' );
+        sb.append( '}' );
+        return sb.toString();
     }
 
+
+
 }
index f2a6c4579dc6ae049fcbd591bb3552ca85aed12d..aac63c0efd66b9388067354dd96be12f2df7d321 100644 (file)
       <artifactId>slf4j-simple</artifactId>
       <scope>test</scope>
     </dependency>
+    <dependency>
+      <groupId>org.apache.archiva</groupId>
+      <artifactId>archiva-repository-admin-default</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.codehaus.redback</groupId>
+      <artifactId>redback-rbac-cached</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.derby</groupId>
+      <artifactId>derby</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.archiva</groupId>
+      <artifactId>archiva-security-common</artifactId>
+    </dependency>
   </dependencies>
   <build>
     <plugins>
         <artifactId>maven-surefire-plugin</artifactId>
         <configuration>
           <systemPropertyVariables>
+            <appserver.base>${basedir}/target/appserver-base</appserver.base>
+            <plexus.home>${project.build.outputDirectory}</plexus.home>
             <java.io.tmpdir>${project.build.outputDirectory}</java.io.tmpdir>
           </systemPropertyVariables>
         </configuration>
index 4d400b8d641cf6ded88a7e63208e77468c78c570..86281a7f807945f79182dee20d9604ee92089d08 100644 (file)
@@ -1073,7 +1073,7 @@ public class DefaultRepositoryProxyConnectors
         }
 
         AuthenticationInfo authInfo = null;
-        String username = remoteRepository.getRepository().getUsername();
+        String username = remoteRepository.getRepository().getUserName();
         String password = remoteRepository.getRepository().getPassword();
 
         if ( StringUtils.isNotBlank( username ) && StringUtils.isNotBlank( password ) )
index fc6ed6a24680f7961a87b68f1b2cdc6375876d4f..32b93407a1588bc4149a3d7603bec75f30ca3394 100644 (file)
@@ -20,6 +20,9 @@ package org.apache.maven.archiva.proxy;
  */
 
 import net.sf.ehcache.CacheManager;
+import org.apache.archiva.admin.model.managed.ManagedRepository;
+import org.apache.archiva.admin.model.managed.ManagedRepositoryAdmin;
+import org.apache.archiva.admin.repository.managed.DefaultManagedRepositoryAdmin;
 import org.apache.archiva.common.plexusbridge.PlexusSisuBridge;
 import org.apache.commons.lang.ArrayUtils;
 import org.apache.maven.archiva.configuration.ArchivaConfiguration;
@@ -45,6 +48,7 @@ import org.springframework.context.ApplicationContext;
 import org.springframework.test.context.ContextConfiguration;
 import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
 
+import javax.inject.Inject;
 import java.io.BufferedReader;
 import java.io.File;
 import java.io.FileReader;
@@ -56,7 +60,6 @@ import java.util.Calendar;
 import java.util.Collection;
 import java.util.Date;
 import java.util.Locale;
-import javax.inject.Inject;
 
 import static org.junit.Assert.*;
 
@@ -66,7 +69,7 @@ import static org.junit.Assert.*;
  * @version $Id$
  */
 @RunWith( SpringJUnit4ClassRunner.class )
-@ContextConfiguration( locations = {"classpath*:/META-INF/spring-context.xml", "classpath:/spring-context.xml"} )
+@ContextConfiguration( locations = { "classpath*:/META-INF/spring-context.xml", "classpath:/spring-context.xml" } )
 public abstract class AbstractProxyTestCase
 {
     @Inject
@@ -125,6 +128,9 @@ public abstract class AbstractProxyTestCase
 
     WagonDelegate delegate;
 
+    @Inject
+    protected ManagedRepositoryAdmin managedRepositoryAdmin;
+
     @Inject
     PlexusSisuBridge plexusSisuBridge;
 
@@ -132,8 +138,8 @@ public abstract class AbstractProxyTestCase
     public void setUp()
         throws Exception
     {
-        config = (MockConfiguration) applicationContext.getBean( "archivaConfiguration#mock",
-                                                                 ArchivaConfiguration.class );
+        config =
+            (MockConfiguration) applicationContext.getBean( "archivaConfiguration#mock", ArchivaConfiguration.class );
 
         config.getConfiguration().setManagedRepositories( new ArrayList<ManagedRepositoryConfiguration>() );
         config.getConfiguration().setRemoteRepositories( new ArrayList<RemoteRepositoryConfiguration>() );
@@ -144,14 +150,18 @@ public abstract class AbstractProxyTestCase
         String repoPath = "target/test-repository/managed/" + name;
         File repoLocation = new File( repoPath );
 
-        managedDefaultRepository = createRepository( ID_DEFAULT_MANAGED, "Default Managed Repository", repoPath,
-                                                     "default" );
+        managedDefaultRepository =
+            createRepository( ID_DEFAULT_MANAGED, "Default Managed Repository", repoPath, "default" );
 
         managedDefaultDir = new File( managedDefaultRepository.getRepoRoot() );
 
-        ManagedRepositoryConfiguration repoConfig = managedDefaultRepository.getRepository();
+        ManagedRepository repoConfig = managedDefaultRepository.getRepository();
 
-        config.getConfiguration().addManagedRepository( repoConfig );
+        ( (DefaultManagedRepositoryAdmin) applicationContext.getBean(
+            ManagedRepositoryAdmin.class ) ).setArchivaConfiguration( config );
+
+        applicationContext.getBean( ManagedRepositoryAdmin.class ).addManagedRepository( repoConfig, false, null );
+        //config.getConfiguration().addManagedRepository( repoConfig );
 
         // Setup source repository (using legacy layout)
         repoLocation = new File( REPOPATH_LEGACY_MANAGED_TARGET );
@@ -161,26 +171,28 @@ public abstract class AbstractProxyTestCase
         }
         copyDirectoryStructure( new File( REPOPATH_LEGACY_MANAGED ), repoLocation );
 
-        managedLegacyRepository = createRepository( ID_LEGACY_MANAGED, "Legacy Managed Repository",
-                                                    REPOPATH_LEGACY_MANAGED_TARGET, "legacy" );
+        managedLegacyRepository =
+            createRepository( ID_LEGACY_MANAGED, "Legacy Managed Repository", REPOPATH_LEGACY_MANAGED_TARGET,
+                              "legacy" );
 
         managedLegacyDir = new File( managedLegacyRepository.getRepoRoot() );
 
         repoConfig = managedLegacyRepository.getRepository();
 
-        config.getConfiguration().addManagedRepository( repoConfig );
+        //config.getConfiguration().addManagedRepository( repoConfig );
+        applicationContext.getBean( ManagedRepositoryAdmin.class ).addManagedRepository( repoConfig, false, null );
 
         // Setup target (proxied to) repository.
-        saveRemoteRepositoryConfig( ID_PROXIED1, "Proxied Repository 1", new File(
-            REPOPATH_PROXIED1 ).toURL().toExternalForm(), "default" );
+        saveRemoteRepositoryConfig( ID_PROXIED1, "Proxied Repository 1",
+                                    new File( REPOPATH_PROXIED1 ).toURL().toExternalForm(), "default" );
 
         // Setup target (proxied to) repository.
-        saveRemoteRepositoryConfig( ID_PROXIED2, "Proxied Repository 2", new File(
-            REPOPATH_PROXIED2 ).toURL().toExternalForm(), "default" );
+        saveRemoteRepositoryConfig( ID_PROXIED2, "Proxied Repository 2",
+                                    new File( REPOPATH_PROXIED2 ).toURL().toExternalForm(), "default" );
 
         // Setup target (proxied to) repository using legacy layout.
-        saveRemoteRepositoryConfig( ID_LEGACY_PROXIED, "Proxied Legacy Repository", new File(
-            REPOPATH_PROXIED_LEGACY ).toURL().toExternalForm(), "legacy" );
+        saveRemoteRepositoryConfig( ID_LEGACY_PROXIED, "Proxied Legacy Repository",
+                                    new File( REPOPATH_PROXIED_LEGACY ).toURL().toExternalForm(), "legacy" );
 
         // Setup the proxy handler.
         //proxyHandler = applicationContext.getBean (RepositoryProxyConnectors) lookup( RepositoryProxyConnectors.class.getName() );
@@ -209,8 +221,8 @@ public abstract class AbstractProxyTestCase
             {
                 return false;
             }
-            return MockControl.ARRAY_MATCHER.matches( ArrayUtils.remove( expected, 1 ), ArrayUtils.remove( actual,
-                                                                                                           1 ) );
+            return MockControl.ARRAY_MATCHER.matches( ArrayUtils.remove( expected, 1 ),
+                                                      ArrayUtils.remove( actual, 1 ) );
         }
 
         public String toString( Object[] arguments )
@@ -312,7 +324,8 @@ public abstract class AbstractProxyTestCase
             return;
         }
 
-        Collection<File> tmpFiles = org.apache.commons.io.FileUtils.listFiles( workingDir, new String[]{"tmp"}, false );
+        Collection<File> tmpFiles =
+            org.apache.commons.io.FileUtils.listFiles( workingDir, new String[]{ "tmp" }, false );
         if ( !tmpFiles.isEmpty() )
         {
             StringBuffer emsg = new StringBuffer();
@@ -400,14 +413,14 @@ public abstract class AbstractProxyTestCase
     protected ManagedRepositoryContent createRepository( String id, String name, String path, String layout )
         throws Exception
     {
-        ManagedRepositoryConfiguration repo = new ManagedRepositoryConfiguration();
+        ManagedRepository repo = new ManagedRepository();
         repo.setId( id );
         repo.setName( name );
         repo.setLocation( path );
         repo.setLayout( layout );
 
-        ManagedRepositoryContent repoContent = applicationContext.getBean( "managedRepositoryContent#" + layout,
-                                                                           ManagedRepositoryContent.class );
+        ManagedRepositoryContent repoContent =
+            applicationContext.getBean( "managedRepositoryContent#" + layout, ManagedRepositoryContent.class );
         repoContent.setRepository( repo );
         return repoContent;
     }
@@ -489,10 +502,10 @@ public abstract class AbstractProxyTestCase
         config.triggerChange( prefix + ".policies.checksum", connectorConfig.getPolicy( "checksum", "" ) );
         config.triggerChange( prefix + ".policies.snapshots", connectorConfig.getPolicy( "snapshots", "" ) );
         config.triggerChange( prefix + ".policies.cache-failures", connectorConfig.getPolicy( "cache-failures", "" ) );
-        config.triggerChange( prefix + ".policies.propagate-errors", connectorConfig.getPolicy( "propagate-errors",
-                                                                                                "" ) );
-        config.triggerChange( prefix + ".policies.propagate-errors-on-update", connectorConfig.getPolicy(
-            "propagate-errors-on-update", "" ) );
+        config.triggerChange( prefix + ".policies.propagate-errors",
+                              connectorConfig.getPolicy( "propagate-errors", "" ) );
+        config.triggerChange( prefix + ".policies.propagate-errors-on-update",
+                              connectorConfig.getPolicy( "propagate-errors-on-update", "" ) );
     }
 
     protected void saveManagedRepositoryConfig( String id, String name, String path, String layout )
@@ -644,9 +657,9 @@ public abstract class AbstractProxyTestCase
         String managedLegacyPath = managedLegacyDir.getCanonicalPath();
         String testFile = file.getCanonicalPath();
 
-        assertTrue( "Unit Test Failure: File <" + testFile +
-                        "> should be have been defined within the legacy managed path of <" + managedLegacyPath + ">",
-                    testFile.startsWith( managedLegacyPath ) );
+        assertTrue(
+            "Unit Test Failure: File <" + testFile + "> should be have been defined within the legacy managed path of <"
+                + managedLegacyPath + ">", testFile.startsWith( managedLegacyPath ) );
 
         assertFalse( "File < " + testFile + "> should not exist in managed legacy repository.", file.exists() );
     }
@@ -657,9 +670,9 @@ public abstract class AbstractProxyTestCase
         String managedDefaultPath = managedDefaultDir.getCanonicalPath();
         String testFile = file.getCanonicalPath();
 
-        assertTrue( "Unit Test Failure: File <" + testFile +
-                        "> should be have been defined within the managed default path of <" + managedDefaultPath + ">",
-                    testFile.startsWith( managedDefaultPath ) );
+        assertTrue( "Unit Test Failure: File <" + testFile
+                        + "> should be have been defined within the managed default path of <" + managedDefaultPath
+                        + ">", testFile.startsWith( managedDefaultPath ) );
 
         assertFalse( "File < " + testFile + "> should not exist in managed default repository.", file.exists() );
     }
index 32f552965134530e6d6a2a444ffd7aa599fb3b8b..ae913b284e309db83eafc01d60fe1af920c8ad70 100644 (file)
@@ -19,9 +19,11 @@ package org.apache.maven.archiva.proxy;
  * under the License.
  */
 
+import org.apache.archiva.admin.model.managed.ManagedRepository;
+import org.apache.archiva.admin.model.managed.ManagedRepositoryAdmin;
+import org.apache.archiva.admin.repository.managed.DefaultManagedRepositoryAdmin;
 import org.apache.commons.io.FileUtils;
 import org.apache.maven.archiva.configuration.ArchivaConfiguration;
-import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
 import org.apache.maven.archiva.configuration.NetworkProxyConfiguration;
 import org.apache.maven.archiva.configuration.ProxyConnectorConfiguration;
 import org.apache.maven.archiva.configuration.RemoteRepositoryConfiguration;
@@ -45,12 +47,12 @@ import org.springframework.context.ApplicationContext;
 import org.springframework.test.context.ContextConfiguration;
 import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
 
-import java.io.File;
-import java.io.IOException;
 import javax.inject.Inject;
 import javax.servlet.ServletException;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
+import java.io.File;
+import java.io.IOException;
 
 import static org.junit.Assert.*;
 
@@ -60,7 +62,7 @@ import static org.junit.Assert.*;
  * @version $Id: ManagedDefaultTransferTest.java 677852 2008-07-18 08:16:24Z brett $
  */
 @RunWith( SpringJUnit4ClassRunner.class )
-@ContextConfiguration( locations = {"classpath*:/META-INF/spring-context.xml", "classpath:/spring-context.xml"} )
+@ContextConfiguration( locations = { "classpath*:/META-INF/spring-context.xml", "classpath:/spring-context.xml" } )
 public class HttpProxyTransferTest
 {
     private static final String PROXY_ID = "proxy";
@@ -108,19 +110,28 @@ public class HttpProxyTransferTest
         // Make the destination dir.
         destRepoDir.mkdirs();
 
-        ManagedRepositoryConfiguration repo = new ManagedRepositoryConfiguration();
+        ManagedRepository repo = new ManagedRepository();
         repo.setId( MANAGED_ID );
         repo.setName( "Default Managed Repository" );
         repo.setLocation( repoPath );
         repo.setLayout( "default" );
 
-        ManagedRepositoryContent repoContent = applicationContext.getBean( "managedRepositoryContent#default",
-                                                                           ManagedRepositoryContent.class );
+        ManagedRepositoryContent repoContent =
+            applicationContext.getBean( "managedRepositoryContent#default", ManagedRepositoryContent.class );
 
         repoContent.setRepository( repo );
         managedDefaultRepository = repoContent;
 
-        config.getConfiguration().addManagedRepository( repo );
+        ( (DefaultManagedRepositoryAdmin) applicationContext.getBean(
+            ManagedRepositoryAdmin.class ) ).setArchivaConfiguration( config );
+
+        ManagedRepositoryAdmin managedRepositoryAdmin = applicationContext.getBean( ManagedRepositoryAdmin.class );
+        if ( managedRepositoryAdmin.getManagedRepository( repo.getId() ) == null )
+        {
+            managedRepositoryAdmin.addManagedRepository( repo, false, null );
+        }
+
+        //config.getConfiguration().addManagedRepository( repo );
 
         Handler handler = new AbstractHandler()
         {
diff --git a/archiva-modules/archiva-base/archiva-proxy/src/test/resources/META-INF/redback/redback-core.xml b/archiva-modules/archiva-base/archiva-proxy/src/test/resources/META-INF/redback/redback-core.xml
new file mode 100644 (file)
index 0000000..ecc1de8
--- /dev/null
@@ -0,0 +1,213 @@
+<redback-role-model>
+    <modelVersion>1.0.0</modelVersion>
+    <applications>
+        <application>
+          <id>System</id>
+          <description>Roles that apply system-wide, across all of the applications</description>
+        <version>1.0.0</version>
+        <resources>
+            <resource>
+                <id>global</id>
+                <name>*</name>
+                <permanent>true</permanent>
+                <description>global resource implies full access for authorization</description>
+            </resource>
+            <resource>
+                <id>username</id>
+                <name>${username}</name>
+                <permanent>true</permanent>
+                <description>replaced with the username of the principal at authorization check time</description>
+            </resource>
+        </resources>
+        <operations>
+            <operation>
+                <id>configuration-edit</id>
+                <name>configuration-edit</name>
+                <description>edit configuration</description>
+                <permanent>true</permanent>
+            </operation>
+            <operation>
+                <id>user-management-user-create</id>
+                <name>user-management-user-create</name>
+                <description>create user</description>
+                <permanent>true</permanent>
+            </operation>
+            <operation>
+                <id>user-management-user-edit</id>
+                <name>user-management-user-edit</name>
+                <description>edit user</description>
+                <permanent>true</permanent>
+            </operation>
+            <operation>
+                <id>user-management-user-role</id>
+                <name>user-management-user-role</name>
+                <description>user roles</description>
+                <permanent>true</permanent>
+            </operation>
+            <operation>
+                <id>user-management-user-delete</id>
+                <name>user-management-user-delete</name>
+                <description>delete user</description>
+                <permanent>true</permanent>
+            </operation>
+            <operation>
+                <id>user-management-user-list</id>
+                <name>user-management-user-list</name>
+                <description>list users</description>
+                <permanent>true</permanent>
+            </operation>
+            <operation>
+                <id>user-management-role-grant</id>
+                <name>user-management-role-grant</name>
+                <description>grant role</description>
+                <permanent>true</permanent>
+            </operation>
+            <operation>
+                <id>user-management-role-drop</id>
+                <name>user-management-role-drop</name>
+                <description>drop role</description>
+                <permanent>true</permanent>
+            </operation>
+            <operation>
+                <id>user-management-rbac-admin</id>
+                <name>user-management-rbac-admin</name>
+                <description>administer rbac</description>
+                <permanent>true</permanent>
+            </operation>
+            <operation>
+                <id>guest-access</id>
+                <name>guest-access</name>
+                <description>access guest</description>
+                <permanent>true</permanent>
+            </operation>
+            <operation>
+                <id>user-management-manage-data</id>
+                <name>user-management-manage-data</name>
+                <description>manage data</description>
+                <permanent>true</permanent>
+            </operation>            
+        </operations>
+        <roles>
+            <role>
+                <id>system-administrator</id>
+                <name>System Administrator</name>
+                <permanent>true</permanent>
+                <assignable>true</assignable>
+                <permissions>
+                    <permission>
+                        <id>edit-redback-configuration</id>
+                        <name>Edit Redback Configuration</name>
+                        <operation>configuration-edit</operation>
+                        <resource>global</resource>
+                        <permanent>true</permanent>
+                    </permission>
+                    <permission>
+                        <id>manage-rbac-setup</id>
+                        <name>User RBAC Management</name>
+                        <operation>user-management-rbac-admin</operation>
+                        <resource>global</resource>
+                        <permanent>true</permanent>
+                    </permission>
+                    <permission>
+                        <id>manage-rbac-data</id>
+                        <name>RBAC Manage Data</name>
+                        <operation>user-management-manage-data</operation>
+                        <resource>global</resource>
+                        <permanent>true</permanent>
+                    </permission>                    
+                </permissions>
+                <childRoles>
+                    <childRole>user-administrator</childRole>
+                </childRoles>
+            </role>
+            <role>
+                <id>user-administrator</id>
+                <name>User Administrator</name>
+                <permanent>true</permanent>
+                <assignable>true</assignable>
+                <permissions>
+                    <permission>
+                        <id>drop-roles-for-anyone</id>
+                        <name>Drop Roles for Anyone</name>
+                        <operation>user-management-role-drop</operation>
+                        <resource>global</resource>
+                        <permanent>true</permanent>
+                    </permission>
+                    <permission>
+                        <id>grant-roles-for-anyone</id>
+                        <name>Grant Roles for Anyone</name>
+                        <operation>user-management-role-grant</operation>
+                        <resource>global</resource>
+                        <permanent>true</permanent>
+                    </permission>
+                    <permission>
+                        <id>user-create</id>
+                        <name>Create Users</name>
+                        <operation>user-management-user-create</operation>
+                        <resource>global</resource>
+                        <permanent>true</permanent>
+                    </permission>
+                    <permission>
+                        <id>user-delete</id>
+                        <name>Delete Users</name>
+                        <operation>user-management-user-delete</operation>
+                        <resource>global</resource>
+                        <permanent>true</permanent>
+                    </permission>
+                    <permission>
+                        <id>user-edit</id>
+                        <name>Edit Users</name>
+                        <operation>user-management-user-edit</operation>
+                        <resource>global</resource>
+                        <permanent>true</permanent>
+                    </permission>
+                    <permission>
+                        <id>access-users-roles</id>
+                        <name>Access Users Roles</name>
+                        <operation>user-management-user-role</operation>
+                        <resource>global</resource>
+                        <permanent>true</permanent>
+                    </permission>
+                    <permission>
+                        <id>access-user-list</id>
+                        <name>Access User List</name>
+                        <operation>user-management-user-list</operation>
+                        <resource>global</resource>
+                        <permanent>true</permanent>
+                    </permission>
+                </permissions>
+            </role>
+            <role>
+                <id>registered-user</id>
+                <name>Registered User</name>
+                <permanent>true</permanent>
+                <assignable>true</assignable>
+                <permissions>
+                    <permission>
+                        <id>edit-user-by-username</id>
+                        <name>Edit User Data by Username</name>
+                        <operation>user-management-user-edit</operation>
+                        <resource>username</resource>
+                        <permanent>true</permanent>
+                    </permission>
+                </permissions>
+            </role>
+            <role>
+                <id>guest</id>
+                <name>Guest</name>
+                <permanent>true</permanent>
+                <assignable>true</assignable>
+                <permissions>
+                    <permission>
+                        <id>guest-permission</id>
+                        <name>Guest Permission</name>
+                        <operation>guest-access</operation>
+                        <resource>global</resource>
+                        <permanent>true</permanent>
+                    </permission>
+                </permissions>
+            </role>
+        </roles>
+        </application>
+    </applications>
+</redback-role-model>
\ No newline at end of file
diff --git a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-api/pom.xml b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-api/pom.xml
new file mode 100644 (file)
index 0000000..86a1d01
--- /dev/null
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ 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.
+  -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+  <parent>
+    <groupId>org.apache.archiva</groupId>
+    <artifactId>archiva-repository-admin</artifactId>
+    <version>1.4-SNAPSHOT</version>
+  </parent>
+  <artifactId>archiva-repository-admin-api</artifactId>
+  <name>Archiva Base :: Repository Admin Api</name>
+  <dependencies>
+    <dependency>
+      <groupId>commons-collections</groupId>
+      <artifactId>commons-collections</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>commons-lang</groupId>
+      <artifactId>commons-lang</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.codehaus.redback</groupId>
+      <artifactId>redback-users-api</artifactId>
+    </dependency>
+  </dependencies>
+
+</project>
diff --git a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-api/src/main/java/org/apache/archiva/admin/model/AbstractRepository.java b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-api/src/main/java/org/apache/archiva/admin/model/AbstractRepository.java
new file mode 100644 (file)
index 0000000..0530684
--- /dev/null
@@ -0,0 +1,116 @@
+package org.apache.archiva.admin.model;
+/*
+ * 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 java.io.Serializable;
+
+/**
+ * @author Olivier Lamy
+ * @since 1.4
+ */
+public class AbstractRepository
+    implements Serializable
+{
+
+    private String id;
+
+    private String name;
+
+    private String layout = "default";
+
+    public AbstractRepository()
+    {
+        // no op
+    }
+
+    public AbstractRepository( String id, String name, String layout )
+    {
+        this.id = id;
+        this.name = name;
+        this.layout = layout;
+    }
+
+    public String getId()
+    {
+        return id;
+    }
+
+    public void setId( String id )
+    {
+        this.id = id;
+    }
+
+    public String getName()
+    {
+        return name;
+    }
+
+    public void setName( String name )
+    {
+        this.name = name;
+    }
+
+    public String getLayout()
+    {
+        return layout;
+    }
+
+    public void setLayout( String layout )
+    {
+        this.layout = layout;
+    }
+
+
+    public int hashCode()
+    {
+        int result = 17;
+        result = 37 * result + ( id != null ? id.hashCode() : 0 );
+        return result;
+    }
+
+    public boolean equals( Object other )
+    {
+        if ( this == other )
+        {
+            return true;
+        }
+
+        if ( !( other instanceof AbstractRepository ) )
+        {
+            return false;
+        }
+
+        AbstractRepository that = (AbstractRepository) other;
+        boolean result = true;
+        result = result && ( getId() == null ? that.getId() == null : getId().equals( that.getId() ) );
+        return result;
+    }
+
+    @Override
+    public String toString()
+    {
+        final StringBuilder sb = new StringBuilder();
+        sb.append( "AbstractRepository" );
+        sb.append( "{id='" ).append( id ).append( '\'' );
+        sb.append( ", name='" ).append( name ).append( '\'' );
+        sb.append( ", layout='" ).append( layout ).append( '\'' );
+        sb.append( '}' );
+        return sb.toString();
+    }
+}
diff --git a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-api/src/main/java/org/apache/archiva/admin/model/AbstractRepositoryConnector.java b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-api/src/main/java/org/apache/archiva/admin/model/AbstractRepositoryConnector.java
new file mode 100644 (file)
index 0000000..84f9a51
--- /dev/null
@@ -0,0 +1,401 @@
+package org.apache.archiva.admin.model;
+/*
+ * 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 java.io.Serializable;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author Olivier Lamy
+ * @since 1.4
+ */
+public abstract class AbstractRepositoryConnector
+    implements Serializable
+{
+    /**
+     * The Repository Source for this connector.
+     */
+    private String sourceRepoId;
+
+    /**
+     * The Repository Target for this connector.
+     */
+    private String targetRepoId;
+
+    /**
+     * The network proxy ID to use for this connector.
+     */
+    private String proxyId;
+
+    /**
+     * Field blackListPatterns.
+     */
+    private List<String> blackListPatterns;
+
+    /**
+     * Field whiteListPatterns.
+     */
+    private List<String> whiteListPatterns;
+
+    /**
+     * Field policies.
+     */
+    private Map<String, String> policies;
+
+    /**
+     * Field properties.
+     */
+    private Map<String, String> properties;
+
+    /**
+     * If the the repository proxy connector is disabled or not
+     */
+    private boolean disabled = false;
+
+    //-----------/
+    //- Methods -/
+    //-----------/
+
+    /**
+     * Method addBlackListPattern.
+     *
+     * @param string
+     */
+    public void addBlackListPattern( String string )
+    {
+        getBlackListPatterns().add( string );
+    }
+
+    /**
+     * Method addPolicy.
+     *
+     * @param key
+     * @param value
+     */
+    public void addPolicy( String key, String value )
+    {
+        getPolicies().put( key, value );
+    }
+
+    /**
+     * Method addProperty.
+     *
+     * @param key
+     * @param value
+     */
+    public void addProperty( String key, String value )
+    {
+        getProperties().put( key, value );
+    }
+
+    /**
+     * Method addWhiteListPattern.
+     *
+     * @param string
+     */
+    public void addWhiteListPattern( String string )
+    {
+        getWhiteListPatterns().add( string );
+    }
+
+    /**
+     * Method getBlackListPatterns.
+     *
+     * @return List
+     */
+    public List<String> getBlackListPatterns()
+    {
+        if ( this.blackListPatterns == null )
+        {
+            this.blackListPatterns = new ArrayList<String>();
+        }
+
+        return this.blackListPatterns;
+    }
+
+    /**
+     * Method getPolicies.
+     *
+     * @return Map
+     */
+    public Map<String, String> getPolicies()
+    {
+        if ( this.policies == null )
+        {
+            this.policies = new HashMap<String, String>();
+        }
+
+        return this.policies;
+    }
+
+    /**
+     * Method getProperties.
+     *
+     * @return Map
+     */
+    public Map<String, String> getProperties()
+    {
+        if ( this.properties == null )
+        {
+            this.properties = new HashMap<String, String>();
+        }
+
+        return this.properties;
+    }
+
+    /**
+     * Get the network proxy ID to use for this connector.
+     *
+     * @return String
+     */
+    public String getProxyId()
+    {
+        return this.proxyId;
+    }
+
+    /**
+     * Get the Repository Source for this connector.
+     *
+     * @return String
+     */
+    public String getSourceRepoId()
+    {
+        return this.sourceRepoId;
+    }
+
+    /**
+     * Get the Repository Target for this connector.
+     *
+     * @return String
+     */
+    public String getTargetRepoId()
+    {
+        return this.targetRepoId;
+    }
+
+    /**
+     * Method getWhiteListPatterns.
+     *
+     * @return List
+     */
+    public List<String> getWhiteListPatterns()
+    {
+        if ( this.whiteListPatterns == null )
+        {
+            this.whiteListPatterns = new ArrayList<String>();
+        }
+
+        return this.whiteListPatterns;
+    }
+
+    /**
+     * Get if the the repository proxy connector is disabled or not
+     * .
+     *
+     * @return boolean
+     */
+    public boolean isDisabled()
+    {
+        return this.disabled;
+    }
+
+    /**
+     * Method removeBlackListPattern.
+     *
+     * @param string
+     */
+    public void removeBlackListPattern( String string )
+    {
+        getBlackListPatterns().remove( string );
+    }
+
+    /**
+     * Method removeWhiteListPattern.
+     *
+     * @param string
+     */
+    public void removeWhiteListPattern( String string )
+    {
+        getWhiteListPatterns().remove( string );
+    }
+
+    /**
+     * Set the list of blacklisted patterns for this connector.
+     *
+     * @param blackListPatterns
+     */
+    public void setBlackListPatterns( List<String> blackListPatterns )
+    {
+        this.blackListPatterns = blackListPatterns;
+    }
+
+    /**
+     * Set if the the repository proxy connector is
+     * disabled or not
+     * .
+     *
+     * @param disabled
+     */
+    public void setDisabled( boolean disabled )
+    {
+        this.disabled = disabled;
+    }
+
+    /**
+     * Set policy configuration for the connector.
+     *
+     * @param policies
+     */
+    public void setPolicies( Map<String, String> policies )
+    {
+        this.policies = policies;
+    }
+
+    /**
+     * Set configuration for the connector.
+     *
+     * @param properties
+     */
+    public void setProperties( Map<String, String> properties )
+    {
+        this.properties = properties;
+    }
+
+    /**
+     * Set the network proxy ID to use for this connector.
+     *
+     * @param proxyId
+     */
+    public void setProxyId( String proxyId )
+    {
+        this.proxyId = proxyId;
+    }
+
+    /**
+     * Set the Repository Source for this connector.
+     *
+     * @param sourceRepoId
+     */
+    public void setSourceRepoId( String sourceRepoId )
+    {
+        this.sourceRepoId = sourceRepoId;
+    }
+
+    /**
+     * Set the Repository Target for this connector.
+     *
+     * @param targetRepoId
+     */
+    public void setTargetRepoId( String targetRepoId )
+    {
+        this.targetRepoId = targetRepoId;
+    }
+
+    /**
+     * Set
+     * The list of whitelisted patterns for this
+     * connector.
+     *
+     * @param whiteListPatterns
+     */
+    public void setWhiteListPatterns( List<String> whiteListPatterns )
+    {
+        this.whiteListPatterns = whiteListPatterns;
+    }
+
+
+    /**
+     * Obtain a specific policy from the underlying connector.
+     *
+     * @param policyId     the policy id to fetch.
+     * @param defaultValue the default value for the policy id.
+     * @return the configured policy value (or default value if not found).
+     */
+    public String getPolicy( String policyId, String defaultValue )
+    {
+        if ( this.getPolicies() == null )
+        {
+            return null;
+        }
+
+        String value = this.getPolicies().get( policyId );
+
+        if ( value == null )
+        {
+            return defaultValue;
+        }
+
+        return value;
+    }
+
+    @Override
+    public boolean equals( Object o )
+    {
+        if ( this == o )
+        {
+            return true;
+        }
+        if ( o == null || getClass() != o.getClass() )
+        {
+            return false;
+        }
+
+        AbstractRepositoryConnector that = (AbstractRepositoryConnector) o;
+
+        if ( sourceRepoId != null ? !sourceRepoId.equals( that.sourceRepoId ) : that.sourceRepoId != null )
+        {
+            return false;
+        }
+        if ( targetRepoId != null ? !targetRepoId.equals( that.targetRepoId ) : that.targetRepoId != null )
+        {
+            return false;
+        }
+
+        return true;
+    }
+
+    @Override
+    public int hashCode()
+    {
+        int result = sourceRepoId != null ? sourceRepoId.hashCode() : 0;
+        result = 31 * result + ( targetRepoId != null ? targetRepoId.hashCode() : 0 );
+        return result;
+    }
+
+    @Override
+    public String toString()
+    {
+        final StringBuilder sb = new StringBuilder();
+        sb.append( "AbstractRepositoryConnector" );
+        sb.append( "{sourceRepoId='" ).append( sourceRepoId ).append( '\'' );
+        sb.append( ", targetRepoId='" ).append( targetRepoId ).append( '\'' );
+        sb.append( ", proxyId='" ).append( proxyId ).append( '\'' );
+        sb.append( ", blackListPatterns=" ).append( blackListPatterns );
+        sb.append( ", whiteListPatterns=" ).append( whiteListPatterns );
+        sb.append( ", policies=" ).append( policies );
+        sb.append( ", properties=" ).append( properties );
+        sb.append( ", disabled=" ).append( disabled );
+        sb.append( '}' );
+        return sb.toString();
+    }
+}
+
diff --git a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-api/src/main/java/org/apache/archiva/admin/model/AuditInformation.java b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-api/src/main/java/org/apache/archiva/admin/model/AuditInformation.java
new file mode 100644 (file)
index 0000000..6d96a42
--- /dev/null
@@ -0,0 +1,69 @@
+package org.apache.archiva.admin.model;
+/*
+ * 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.codehaus.plexus.redback.users.User;
+
+/**
+ * @author Olivier Lamy
+ * @since 1.4
+ */
+public class AuditInformation
+{
+    private User user;
+
+    private String remoteAddr;
+
+    public AuditInformation( User user, String remoteAddr )
+    {
+        this.user = user;
+        this.remoteAddr = remoteAddr;
+    }
+
+    public User getUser()
+    {
+        return user;
+    }
+
+    public void setUser( User user )
+    {
+        this.user = user;
+    }
+
+    public String getRemoteAddr()
+    {
+        return remoteAddr;
+    }
+
+    public void setRemoteAddr( String remoteAddr )
+    {
+        this.remoteAddr = remoteAddr;
+    }
+
+    @Override
+    public String toString()
+    {
+        final StringBuilder sb = new StringBuilder();
+        sb.append( "AuditInformation" );
+        sb.append( "{user=" ).append( user );
+        sb.append( ", remoteAddr='" ).append( remoteAddr ).append( '\'' );
+        sb.append( '}' );
+        return sb.toString();
+    }
+}
diff --git a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-api/src/main/java/org/apache/archiva/admin/model/RepositoryAdminException.java b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-api/src/main/java/org/apache/archiva/admin/model/RepositoryAdminException.java
new file mode 100644 (file)
index 0000000..0237bca
--- /dev/null
@@ -0,0 +1,38 @@
+package org.apache.archiva.admin.model;
+/*
+ * 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.
+ */
+
+
+/**
+ * @author Olivier Lamy
+ * @since 1.4
+ */
+public class RepositoryAdminException
+    extends Exception
+{
+    public RepositoryAdminException( String s )
+    {
+        super( s );
+    }
+
+    public RepositoryAdminException( String message, Throwable cause )
+    {
+        super( message, cause );
+    }
+}
diff --git a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-api/src/main/java/org/apache/archiva/admin/model/admin/ArchivaAdministration.java b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-api/src/main/java/org/apache/archiva/admin/model/admin/ArchivaAdministration.java
new file mode 100644 (file)
index 0000000..f7cc514
--- /dev/null
@@ -0,0 +1,90 @@
+package org.apache.archiva.admin.model.admin;
+/*
+ * 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.admin.model.AuditInformation;
+import org.apache.archiva.admin.model.RepositoryAdminException;
+
+import java.util.List;
+
+/**
+ * @author Olivier Lamy
+ * @since 1.4
+ */
+public interface ArchivaAdministration
+{
+
+    List<LegacyArtifactPath> getLegacyArtifactPaths()
+        throws RepositoryAdminException;
+
+    void addLegacyArtifactPath( LegacyArtifactPath legacyArtifactPath, AuditInformation auditInformation )
+        throws RepositoryAdminException;
+
+    void deleteLegacyArtifactPath( String path, AuditInformation auditInformation )
+        throws RepositoryAdminException;
+
+    void addFileTypePattern( String fileTypeId, String pattern, AuditInformation auditInformation )
+        throws RepositoryAdminException;
+
+    void removeFileTypePattern( String fileTypeId, String pattern, AuditInformation auditInformation )
+        throws RepositoryAdminException;
+
+    List<FileType> getFileTypes()
+        throws RepositoryAdminException;
+
+    FileType getFileType( String fileTypeId )
+        throws RepositoryAdminException;
+
+    void addFileType( FileType fileType, AuditInformation auditInformation )
+        throws RepositoryAdminException;
+
+    void removeFileType( String fileTypeId, AuditInformation auditInformation )
+        throws RepositoryAdminException;
+
+    void addKnownContentConsumer( String knownContentConsumer, AuditInformation auditInformation )
+        throws RepositoryAdminException;
+
+    void setKnownContentConsumers( List<String> knownContentConsumers, AuditInformation auditInformation )
+        throws RepositoryAdminException;
+
+    List<String> getKnownContentConsumers()
+        throws RepositoryAdminException;
+
+    void removeKnownContentConsumer( String knownContentConsumer, AuditInformation auditInformation )
+        throws RepositoryAdminException;
+
+    void addInvalidContentConsumer( String invalidContentConsumer, AuditInformation auditInformation )
+        throws RepositoryAdminException;
+
+    void setInvalidContentConsumers( List<String> invalidContentConsumers, AuditInformation auditInformation )
+        throws RepositoryAdminException;
+
+    List<String> getInvalidContentConsumers()
+        throws RepositoryAdminException;
+
+    void removeInvalidContentConsumer( String invalidContentConsumer, AuditInformation auditInformation )
+        throws RepositoryAdminException;
+
+    OrganisationInformation getOrganisationInformation()
+        throws RepositoryAdminException;
+
+    void setOrganisationInformation( OrganisationInformation organisationInformation )
+        throws RepositoryAdminException;
+
+}
diff --git a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-api/src/main/java/org/apache/archiva/admin/model/admin/FileType.java b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-api/src/main/java/org/apache/archiva/admin/model/admin/FileType.java
new file mode 100644 (file)
index 0000000..5fe4e6a
--- /dev/null
@@ -0,0 +1,125 @@
+package org.apache.archiva.admin.model.admin;
+/*
+ * 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 java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author Olivier Lamy
+ * @since 1.4
+ */
+public class FileType
+    implements Serializable
+{
+    /**
+     * Field id.
+     */
+    private String id;
+
+    /**
+     * Field patterns.
+     */
+    private List<String> patterns;
+
+    public FileType()
+    {
+        // no op
+    }
+
+    public FileType( String id, List<String> patterns )
+    {
+        this.id = id;
+        this.patterns = patterns;
+    }
+
+    public String getId()
+    {
+        return id;
+    }
+
+    public void setId( String id )
+    {
+        this.id = id;
+    }
+
+    public List<String> getPatterns()
+    {
+        if ( patterns == null )
+        {
+            this.patterns = new ArrayList<String>();
+        }
+        return patterns;
+    }
+
+    public void setPatterns( List<String> patterns )
+    {
+        this.patterns = patterns;
+    }
+
+    public void addPattern( String pattern )
+    {
+        getPatterns().add( pattern );
+    }
+
+    public void removePattern( String pattern )
+    {
+        getPatterns().remove( pattern );
+    }
+
+    @Override
+    public boolean equals( Object o )
+    {
+        if ( this == o )
+        {
+            return true;
+        }
+        if ( o == null || getClass() != o.getClass() )
+        {
+            return false;
+        }
+
+        FileType fileType = (FileType) o;
+
+        if ( id != null ? !id.equals( fileType.id ) : fileType.id != null )
+        {
+            return false;
+        }
+
+        return true;
+    }
+
+    @Override
+    public int hashCode()
+    {
+        return id != null ? 37 + id.hashCode() : 0;
+    }
+
+    @Override
+    public String toString()
+    {
+        final StringBuilder sb = new StringBuilder();
+        sb.append( "FileType" );
+        sb.append( "{id='" ).append( id ).append( '\'' );
+        sb.append( ", patterns=" ).append( patterns );
+        sb.append( '}' );
+        return sb.toString();
+    }
+}
diff --git a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-api/src/main/java/org/apache/archiva/admin/model/admin/LegacyArtifactPath.java b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-api/src/main/java/org/apache/archiva/admin/model/admin/LegacyArtifactPath.java
new file mode 100644 (file)
index 0000000..2031d95
--- /dev/null
@@ -0,0 +1,141 @@
+package org.apache.archiva.admin.model.admin;
+/*
+ * 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 java.io.Serializable;
+
+/**
+ * @author Olivier Lamy
+ * @since 1.4
+ */
+public class LegacyArtifactPath
+    implements Serializable
+{
+    /**
+     * The legacy path.
+     */
+    private String path;
+
+    /**
+     * The artifact reference, as " [groupId] :
+     * [artifactId] : [version] : [classifier] : [type] ".
+     */
+    private String artifact;
+
+    public LegacyArtifactPath()
+    {
+        // no op
+    }
+
+    public LegacyArtifactPath( String path, String artifact )
+    {
+        this.path = path;
+        this.artifact = artifact;
+    }
+
+    public String getPath()
+    {
+        return path;
+    }
+
+    public void setPath( String path )
+    {
+        this.path = path;
+    }
+
+    public String getArtifact()
+    {
+        return artifact;
+    }
+
+    public void setArtifact( String artifact )
+    {
+        this.artifact = artifact;
+    }
+
+    public boolean match( String path )
+    {
+        return path.equals( this.path );
+    }
+
+    public String getGroupId()
+    {
+        return artifact.split( ":" )[0];
+    }
+
+    public String getArtifactId()
+    {
+        return artifact.split( ":" )[1];
+    }
+
+    public String getVersion()
+    {
+        return artifact.split( ":" )[2];
+    }
+
+    public String getClassifier()
+    {
+        String classifier = artifact.split( ":" )[3];
+        return classifier.length() > 0 ? classifier : null;
+    }
+
+    public String getType()
+    {
+        return artifact.split( ":" )[4];
+    }
+
+    @Override
+    public boolean equals( Object o )
+    {
+        if ( this == o )
+        {
+            return true;
+        }
+        if ( o == null || getClass() != o.getClass() )
+        {
+            return false;
+        }
+
+        LegacyArtifactPath that = (LegacyArtifactPath) o;
+
+        if ( path != null ? !path.equals( that.path ) : that.path != null )
+        {
+            return false;
+        }
+
+        return true;
+    }
+
+    @Override
+    public int hashCode()
+    {
+        return path != null ? 37 + path.hashCode() : 0;
+    }
+
+    @Override
+    public String toString()
+    {
+        final StringBuilder sb = new StringBuilder();
+        sb.append( "LegacyArtifactPath" );
+        sb.append( "{path='" ).append( path ).append( '\'' );
+        sb.append( ", artifact='" ).append( artifact ).append( '\'' );
+        sb.append( '}' );
+        return sb.toString();
+    }
+}
diff --git a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-api/src/main/java/org/apache/archiva/admin/model/admin/OrganisationInformation.java b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-api/src/main/java/org/apache/archiva/admin/model/admin/OrganisationInformation.java
new file mode 100644 (file)
index 0000000..23941fe
--- /dev/null
@@ -0,0 +1,95 @@
+package org.apache.archiva.admin.model.admin;
+/*
+ * 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.
+ */
+
+/**
+ * @author Olivier Lamy
+ * @since 1.4
+ */
+public class OrganisationInformation
+{
+    /**
+     * name of the organisation.
+     */
+    private String name;
+
+    /**
+     * name of the organisation.
+     */
+    private String url;
+
+    /**
+     * name of the organisation.
+     */
+    private String logoLocation;
+
+    public OrganisationInformation()
+    {
+        // no op
+    }
+
+    public OrganisationInformation( String name, String url, String logoLocation )
+    {
+        this.name = name;
+        this.url = url;
+        this.logoLocation = logoLocation;
+    }
+
+    public String getName()
+    {
+        return name;
+    }
+
+    public void setName( String name )
+    {
+        this.name = name;
+    }
+
+    public String getUrl()
+    {
+        return url;
+    }
+
+    public void setUrl( String url )
+    {
+        this.url = url;
+    }
+
+    public String getLogoLocation()
+    {
+        return logoLocation;
+    }
+
+    public void setLogoLocation( String logoLocation )
+    {
+        this.logoLocation = logoLocation;
+    }
+
+    @Override
+    public String toString()
+    {
+        final StringBuilder sb = new StringBuilder();
+        sb.append( "OrganisationInformation" );
+        sb.append( "{name='" ).append( name ).append( '\'' );
+        sb.append( ", url='" ).append( url ).append( '\'' );
+        sb.append( ", logoLocation='" ).append( logoLocation ).append( '\'' );
+        sb.append( '}' );
+        return sb.toString();
+    }
+}
diff --git a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-api/src/main/java/org/apache/archiva/admin/model/group/RepositoryGroup.java b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-api/src/main/java/org/apache/archiva/admin/model/group/RepositoryGroup.java
new file mode 100644 (file)
index 0000000..e242bf4
--- /dev/null
@@ -0,0 +1,153 @@
+package org.apache.archiva.admin.model.group;
+/*
+ * 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 java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author Olivier Lamy
+ * @since 1.4
+ */
+public class RepositoryGroup
+    implements Serializable
+{
+    /**
+     * repository group Id
+     */
+    private String id;
+
+    /**
+     * repositories ids
+     */
+    private List<String> repositories;
+
+    public RepositoryGroup()
+    {
+        // no op
+    }
+
+    public RepositoryGroup( String id, List<String> repositories )
+    {
+        this.id = id;
+        this.repositories = repositories;
+    }
+
+    /**
+     * Method addRepository.
+     *
+     * @param string
+     */
+    public void addRepository( String string )
+    {
+        getRepositories().add( string );
+    }
+
+    /**
+     * Get the id of the repository group.
+     *
+     * @return String
+     */
+    public String getId()
+    {
+        return this.id;
+    }
+
+    /**
+     * Method getRepositories.
+     *
+     * @return List
+     */
+    public java.util.List<String> getRepositories()
+    {
+        if ( this.repositories == null )
+        {
+            this.repositories = new ArrayList<String>();
+        }
+
+        return this.repositories;
+    }
+
+    /**
+     * Method removeRepository.
+     *
+     * @param string
+     */
+    public void removeRepository( String string )
+    {
+        getRepositories().remove( string );
+    }
+
+    /**
+     * Set the id of the repository group.
+     *
+     * @param id
+     */
+    public void setId( String id )
+    {
+        this.id = id;
+    }
+
+    /**
+     * Set the list of repository ids under the group.
+     *
+     * @param repositories
+     */
+    public void setRepositories( List<String> repositories )
+    {
+        this.repositories = repositories;
+    }
+
+    public boolean equals( Object other )
+    {
+        if ( this == other )
+        {
+            return true;
+        }
+
+        if ( !( other instanceof RepositoryGroup ) )
+        {
+            return false;
+        }
+
+        RepositoryGroup that = (RepositoryGroup) other;
+        boolean result = true;
+        result = result && ( getId() == null ? that.getId() == null : getId().equals( that.getId() ) );
+        return result;
+    }
+
+    public int hashCode()
+    {
+        int result = 17;
+        result = 37 * result + ( id != null ? id.hashCode() : 0 );
+        return result;
+    }
+
+    @Override
+    public String toString()
+    {
+        final StringBuilder sb = new StringBuilder();
+        sb.append( "RepositoryGroup" );
+        sb.append( "{id='" ).append( id ).append( '\'' );
+        sb.append( ", repositories=" ).append( repositories );
+        sb.append( '}' );
+        return sb.toString();
+    }
+}
diff --git a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-api/src/main/java/org/apache/archiva/admin/model/group/RepositoryGroupAdmin.java b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-api/src/main/java/org/apache/archiva/admin/model/group/RepositoryGroupAdmin.java
new file mode 100644 (file)
index 0000000..18c5c94
--- /dev/null
@@ -0,0 +1,75 @@
+package org.apache.archiva.admin.model.group;
+/*
+ * 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.admin.model.AuditInformation;
+import org.apache.archiva.admin.model.RepositoryAdminException;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author Olivier Lamy
+ * @since 1.4
+ */
+public interface RepositoryGroupAdmin
+{
+    List<RepositoryGroup> getRepositoriesGroups()
+        throws RepositoryAdminException;
+
+    RepositoryGroup getRepositoryGroup( String repositoryGroupId )
+        throws RepositoryAdminException;
+
+    Boolean addRepositoryGroup( RepositoryGroup repositoryGroup, AuditInformation auditInformation )
+        throws RepositoryAdminException;
+
+    Boolean updateRepositoryGroup( RepositoryGroup repositoryGroup, AuditInformation auditInformation )
+        throws RepositoryAdminException;
+
+    Boolean deleteRepositoryGroup( String repositoryGroupId, AuditInformation auditInformation )
+        throws RepositoryAdminException;
+
+    Boolean addRepositoryToGroup( String repositoryGroupId, String repositoryId, AuditInformation auditInformation )
+        throws RepositoryAdminException;
+
+    Boolean deleteRepositoryFromGroup( String repositoryGroupId, String repositoryId,
+                                       AuditInformation auditInformation )
+        throws RepositoryAdminException;
+
+    /**
+     * @return Map with key repoGroupId and value repoGroup
+     * @throws RepositoryAdminException
+     */
+    Map<String, RepositoryGroup> getRepositoryGroupsAsMap()
+        throws RepositoryAdminException;
+
+    /**
+     * @return Map with key repoGroupId and value List of ManagedRepositories
+     * @throws RepositoryAdminException
+     */
+    Map<String, List<String>> getGroupToRepositoryMap()
+        throws RepositoryAdminException;
+
+    /**
+     * @return Map with key managedRepo id and value List of repositoryGroup ids where the repo is
+     * @throws RepositoryAdminException
+     */
+    Map<String, List<String>> getRepositoryToGroupMap()
+        throws RepositoryAdminException;
+}
diff --git a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-api/src/main/java/org/apache/archiva/admin/model/managed/ManagedRepository.java b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-api/src/main/java/org/apache/archiva/admin/model/managed/ManagedRepository.java
new file mode 100644 (file)
index 0000000..8d0e48b
--- /dev/null
@@ -0,0 +1,232 @@
+package org.apache.archiva.admin.model.managed;
+
+/*
+ * 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.admin.model.AbstractRepository;
+
+import java.io.Serializable;
+
+/**
+ * @author Olivier Lamy
+ * @since 1.4
+ */
+public class ManagedRepository
+    extends AbstractRepository
+    implements Serializable
+{
+
+    private String location;
+
+    private boolean snapshots = false;
+
+    private boolean releases = true;
+
+    private boolean blockRedeployments = false;
+
+    /**
+     * default model value
+     */
+    private String cronExpression = "0 0 * * * ?";
+
+
+    /**
+     * not need when creating the repo : only available when reading
+     */
+    private ManagedRepository stagingRepository;
+
+    private boolean scanned = false;
+
+    private String indexDirectory;
+
+    /**
+     * default model value
+     */
+    private int daysOlder = 100;
+
+    /**
+     * default model value
+     */
+    private int retentionCount = 2;
+
+    private boolean deleteReleasedSnapshots;
+
+    public ManagedRepository()
+    {
+        // no op
+    }
+
+    public ManagedRepository( String id, String name, String location, String layout, boolean snapshots,
+                              boolean releases, boolean blockRedeployments, String cronExpression, String indexDir,
+                              boolean scanned, int daysOlder, int retentionCount, boolean deleteReleasedSnapshots )
+    {
+        super(id, name, layout);
+
+        this.location = location;
+        this.snapshots = snapshots;
+        this.releases = releases;
+        this.blockRedeployments = blockRedeployments;
+        this.cronExpression = cronExpression;
+        this.indexDirectory = indexDir;
+        this.scanned = scanned;
+        this.daysOlder = daysOlder;
+        this.retentionCount = retentionCount;
+        this.deleteReleasedSnapshots = deleteReleasedSnapshots;
+    }
+
+    public String getLocation()
+    {
+        return this.location;
+    }
+
+
+    public boolean isReleases()
+    {
+        return this.releases;
+    }
+
+    /**
+     * Get null
+     */
+    public boolean isSnapshots()
+    {
+        return this.snapshots;
+    }
+
+
+    public void setReleases( boolean releases )
+    {
+        this.releases = releases;
+    }
+
+    public void setSnapshots( boolean snapshots )
+    {
+        this.snapshots = snapshots;
+    }
+
+    public void setLocation( String location )
+    {
+        this.location = location;
+    }
+
+    public boolean isBlockRedeployments()
+    {
+        return blockRedeployments;
+    }
+
+    public void setBlockRedeployments( boolean blockRedeployments )
+    {
+        this.blockRedeployments = blockRedeployments;
+    }
+
+    public String getCronExpression()
+    {
+        return cronExpression;
+    }
+
+    public void setCronExpression( String cronExpression )
+    {
+        this.cronExpression = cronExpression;
+    }
+
+    public ManagedRepository getStagingRepository()
+    {
+        return stagingRepository;
+    }
+
+
+    public void setStagingRepository( ManagedRepository stagingRepository )
+    {
+        this.stagingRepository = stagingRepository;
+    }
+
+    public boolean isScanned()
+    {
+        return scanned;
+    }
+
+    public void setScanned( boolean scanned )
+    {
+        this.scanned = scanned;
+    }
+
+    public String getIndexDirectory()
+    {
+        return indexDirectory;
+    }
+
+    public void setIndexDirectory( String indexDirectory )
+    {
+        this.indexDirectory = indexDirectory;
+    }
+
+    public int getDaysOlder()
+    {
+        return daysOlder;
+    }
+
+    public void setDaysOlder( int daysOlder )
+    {
+        this.daysOlder = daysOlder;
+    }
+
+    public int getRetentionCount()
+    {
+        return retentionCount;
+    }
+
+    public void setRetentionCount( int retentionCount )
+    {
+        this.retentionCount = retentionCount;
+    }
+
+    public boolean isDeleteReleasedSnapshots()
+    {
+        return deleteReleasedSnapshots;
+    }
+
+    public void setDeleteReleasedSnapshots( boolean deleteReleasedSnapshots )
+    {
+        this.deleteReleasedSnapshots = deleteReleasedSnapshots;
+    }
+
+
+    @Override
+    public String toString()
+    {
+        final StringBuilder sb = new StringBuilder();
+        sb.append( "ManagedRepository" );
+        sb.append( "{location='" ).append( location ).append( '\'' );
+        sb.append( ", snapshots=" ).append( snapshots );
+        sb.append( ", releases=" ).append( releases );
+        sb.append( ", blockRedeployments=" ).append( blockRedeployments );
+        sb.append( ", cronExpression='" ).append( cronExpression ).append( '\'' );
+        sb.append( ", stagingRepository=" ).append( stagingRepository );
+        sb.append( ", scanned=" ).append( scanned );
+        sb.append( ", indexDirectory='" ).append( indexDirectory ).append( '\'' );
+        sb.append( ", daysOlder=" ).append( daysOlder );
+        sb.append( ", retentionCount=" ).append( retentionCount );
+        sb.append( ", deleteReleasedSnapshots=" ).append( deleteReleasedSnapshots );
+        sb.append( '}' );
+        sb.append( super.toString() );
+        return sb.toString();
+    }
+
+
+}
\ No newline at end of file
diff --git a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-api/src/main/java/org/apache/archiva/admin/model/managed/ManagedRepositoryAdmin.java b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-api/src/main/java/org/apache/archiva/admin/model/managed/ManagedRepositoryAdmin.java
new file mode 100644 (file)
index 0000000..cf79f43
--- /dev/null
@@ -0,0 +1,56 @@
+package org.apache.archiva.admin.model.managed;
+/*
+ * 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.admin.model.AuditInformation;
+import org.apache.archiva.admin.model.RepositoryAdminException;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author Olivier Lamy
+ * @since 1.4
+ */
+public interface ManagedRepositoryAdmin
+{
+    List<ManagedRepository> getManagedRepositories()
+        throws RepositoryAdminException;
+
+    Map<String, ManagedRepository> getManagedRepositoriesAsMap()
+        throws RepositoryAdminException;
+
+    ManagedRepository getManagedRepository( String repositoryId )
+        throws RepositoryAdminException;
+
+    Boolean deleteManagedRepository( String repositoryId, AuditInformation auditInformation, boolean deleteContent )
+        throws RepositoryAdminException;
+
+    Boolean addManagedRepository( ManagedRepository managedRepository, boolean needStageRepo,
+                                  AuditInformation auditInformation )
+        throws RepositoryAdminException;
+
+
+    Boolean updateManagedRepository( ManagedRepository managedRepository, boolean needStageRepo,
+                                     AuditInformation auditInformation, boolean resetStats )
+        throws RepositoryAdminException;
+
+
+}
diff --git a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-api/src/main/java/org/apache/archiva/admin/model/networkproxy/NetworkProxy.java b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-api/src/main/java/org/apache/archiva/admin/model/networkproxy/NetworkProxy.java
new file mode 100644 (file)
index 0000000..b60138f
--- /dev/null
@@ -0,0 +1,177 @@
+package org.apache.archiva.admin.model.networkproxy;
+/*
+ * 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 java.io.Serializable;
+
+/**
+ * @author Olivier Lamy
+ * @since 1.4
+ */
+public class NetworkProxy
+    implements Serializable
+{
+    private String id;
+
+    /**
+     * The network protocol to use with this proxy: "http", "socks-4"
+     * .
+     */
+    private String protocol = "http";
+
+    /**
+     * The proxy host.
+     */
+    private String host;
+
+    /**
+     * The proxy port.
+     */
+    private int port = 8080;
+
+    /**
+     * The proxy user.
+     */
+    private String username;
+
+    /**
+     * The proxy password.
+     */
+    private String password;
+
+    public NetworkProxy()
+    {
+        // no op
+    }
+
+    public NetworkProxy( String id, String protocol, String host, int port, String username, String password )
+    {
+        this.id = id;
+        this.protocol = protocol;
+        this.host = host;
+        this.port = port;
+        this.username = username;
+        this.password = password;
+    }
+
+    public String getId()
+    {
+        return id;
+    }
+
+    public void setId( String id )
+    {
+        this.id = id;
+    }
+
+    public String getProtocol()
+    {
+        return protocol;
+    }
+
+    public void setProtocol( String protocol )
+    {
+        this.protocol = protocol;
+    }
+
+    public String getHost()
+    {
+        return host;
+    }
+
+    public void setHost( String host )
+    {
+        this.host = host;
+    }
+
+    public int getPort()
+    {
+        return port;
+    }
+
+    public void setPort( int port )
+    {
+        this.port = port;
+    }
+
+    public String getUsername()
+    {
+        return username;
+    }
+
+    public void setUsername( String username )
+    {
+        this.username = username;
+    }
+
+    public String getPassword()
+    {
+        return password;
+    }
+
+    public void setPassword( String password )
+    {
+        this.password = password;
+    }
+
+    @Override
+    public boolean equals( Object o )
+    {
+        if ( this == o )
+        {
+            return true;
+        }
+        if ( o == null || getClass() != o.getClass() )
+        {
+            return false;
+        }
+
+        NetworkProxy that = (NetworkProxy) o;
+
+        if ( id != null ? !id.equals( that.id ) : that.id != null )
+        {
+            return false;
+        }
+
+        return true;
+    }
+
+    @Override
+    public int hashCode()
+    {
+        int result = 17;
+        result = 37 * result + ( id != null ? id.hashCode() : 0 );
+        return result;
+    }
+
+    @Override
+    public String toString()
+    {
+        final StringBuilder sb = new StringBuilder();
+        sb.append( "NetworkProxy" );
+        sb.append( "{id='" ).append( id ).append( '\'' );
+        sb.append( ", protocol='" ).append( protocol ).append( '\'' );
+        sb.append( ", host='" ).append( host ).append( '\'' );
+        sb.append( ", port=" ).append( port );
+        sb.append( ", username='" ).append( username ).append( '\'' );
+        sb.append( ", password='" ).append( password ).append( '\'' );
+        sb.append( '}' );
+        return sb.toString();
+    }
+}
diff --git a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-api/src/main/java/org/apache/archiva/admin/model/networkproxy/NetworkProxyAdmin.java b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-api/src/main/java/org/apache/archiva/admin/model/networkproxy/NetworkProxyAdmin.java
new file mode 100644 (file)
index 0000000..52e2bd2
--- /dev/null
@@ -0,0 +1,46 @@
+package org.apache.archiva.admin.model.networkproxy;
+/*
+ * 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.admin.model.AuditInformation;
+import org.apache.archiva.admin.model.RepositoryAdminException;
+
+import java.util.List;
+
+/**
+ * @author Olivier Lamy
+ * @since 1.4
+ */
+public interface NetworkProxyAdmin
+{
+    List<NetworkProxy> getNetworkProxies()
+        throws RepositoryAdminException;
+
+    NetworkProxy getNetworkProxy( String networkProxyId )
+        throws RepositoryAdminException;
+
+    void addNetworkProxy( NetworkProxy networkProxy, AuditInformation auditInformation )
+        throws RepositoryAdminException;
+
+    void updateNetworkProxy( NetworkProxy networkProxy, AuditInformation auditInformation )
+        throws RepositoryAdminException;
+
+    void deleteNetworkProxy( String networkProxyId, AuditInformation auditInformation )
+        throws RepositoryAdminException;
+}
diff --git a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-api/src/main/java/org/apache/archiva/admin/model/proxyconnector/ProxyConnector.java b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-api/src/main/java/org/apache/archiva/admin/model/proxyconnector/ProxyConnector.java
new file mode 100644 (file)
index 0000000..57838ea
--- /dev/null
@@ -0,0 +1,116 @@
+package org.apache.archiva.admin.model.proxyconnector;
+/*
+ * 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.admin.model.AbstractRepositoryConnector;
+
+import java.io.Serializable;
+
+/**
+ * @author Olivier Lamy
+ * @since 1.4
+ */
+public class ProxyConnector
+    extends AbstractRepositoryConnector
+    implements Serializable
+{
+    /**
+     * The order id for UNORDERED
+     */
+    public static final int UNORDERED = 0;
+
+    /**
+     * The policy key {@link #getPolicies()} for error handling.
+     * See {@link org.apache.maven.archiva.policies.DownloadErrorPolicy}
+     * for details on potential values to this policy key.
+     */
+    public static final String POLICY_PROPAGATE_ERRORS = "propagate-errors";
+
+    /**
+     * The policy key {@link #getPolicies()} for error handling when an artifact is present.
+     * See {@link org.apache.maven.archiva.policies.DownloadErrorPolicy}
+     * for details on potential values to this policy key.
+     */
+    public static final String POLICY_PROPAGATE_ERRORS_ON_UPDATE = "propagate-errors-on-update";
+
+    /**
+     * The policy key {@link #getPolicies()} for snapshot handling.
+     * See {@link org.apache.maven.archiva.policies.SnapshotsPolicy}
+     * for details on potential values to this policy key.
+     */
+    public static final String POLICY_SNAPSHOTS = "snapshots";
+
+    /**
+     * The policy key {@link #getPolicies()} for releases handling.
+     * See {@link org.apache.maven.archiva.policies.ReleasesPolicy}
+     * for details on potential values to this policy key.
+     */
+    public static final String POLICY_RELEASES = "releases";
+
+    /**
+     * The policy key {@link #getPolicies()} for checksum handling.
+     * See {@link org.apache.maven.archiva.policies.ChecksumPolicy}
+     * for details on potential values to this policy key.
+     */
+    public static final String POLICY_CHECKSUM = "checksum";
+
+    /**
+     * The policy key {@link #getPolicies()} for cache-failures handling.
+     * See {@link org.apache.maven.archiva.policies.CachedFailuresPolicy}
+     * for details on potential values to this policy key.
+     */
+    public static final String POLICY_CACHE_FAILURES = "cache-failures";
+
+    /**
+     *
+     * The order of the proxy connectors. (0 means no order specified)
+     *           .
+     */
+    private int order = 0;
+
+    /**
+     * Get the order of the proxy connectors. (0 means no order specified)
+     * @return int
+     */
+    public int getOrder()
+    {
+        return this.order;
+    }
+
+
+    /**
+     * Set the order of the proxy connectors. (0 means no order specified)
+     * @param order
+     */
+    public void setOrder( int order )
+    {
+        this.order = order;
+    }
+
+    @Override
+    public String toString()
+    {
+        final StringBuilder sb = new StringBuilder();
+        sb.append( "ProxyConnector" );
+        sb.append( "{order=" ).append( order );
+        sb.append( '}' );
+        sb.append( super.toString() );
+        return sb.toString();
+    }
+}
diff --git a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-api/src/main/java/org/apache/archiva/admin/model/proxyconnector/ProxyConnectorAdmin.java b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-api/src/main/java/org/apache/archiva/admin/model/proxyconnector/ProxyConnectorAdmin.java
new file mode 100644 (file)
index 0000000..1c31b99
--- /dev/null
@@ -0,0 +1,61 @@
+package org.apache.archiva.admin.model.proxyconnector;
+/*
+ * 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.admin.model.AuditInformation;
+import org.apache.archiva.admin.model.RepositoryAdminException;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * <b>No update method for changing source and target here as id is : sourceRepoId and targetRepoId, use delete then add.</b>
+ *
+ * @author Olivier Lamy
+ * @since 1.4
+ */
+public interface ProxyConnectorAdmin
+{
+    List<ProxyConnector> getProxyConnectors()
+        throws RepositoryAdminException;
+
+    ProxyConnector getProxyConnector( String sourceRepoId, String targetRepoId )
+        throws RepositoryAdminException;
+
+    Boolean addProxyConnector( ProxyConnector proxyConnector, AuditInformation auditInformation )
+        throws RepositoryAdminException;
+
+    Boolean deleteProxyConnector( ProxyConnector proxyConnector, AuditInformation auditInformation )
+        throws RepositoryAdminException;
+
+    /**
+     * <b>only for enabled/disable or changing bean values except target/source</b>
+     * @param proxyConnector
+     * @param auditInformation
+     * @return
+     * @throws RepositoryAdminException
+     */
+    Boolean updateProxyConnector( ProxyConnector proxyConnector, AuditInformation auditInformation )
+            throws RepositoryAdminException;
+
+
+    Map<String, List<ProxyConnector>> getProxyConnectorAsMap()
+        throws RepositoryAdminException;
+
+}
diff --git a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-api/src/main/java/org/apache/archiva/admin/model/proxyconnector/ProxyConnectorOrderComparator.java b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-api/src/main/java/org/apache/archiva/admin/model/proxyconnector/ProxyConnectorOrderComparator.java
new file mode 100644 (file)
index 0000000..34aee66
--- /dev/null
@@ -0,0 +1,68 @@
+package org.apache.archiva.admin.model.proxyconnector;
+/*
+ * 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 java.util.Comparator;
+
+/**
+ * @author Olivier Lamy
+ * @since 1.4
+ */
+public class ProxyConnectorOrderComparator
+    implements Comparator<ProxyConnector>
+{
+    private static ProxyConnectorOrderComparator INSTANCE = new ProxyConnectorOrderComparator();
+
+    public int compare( ProxyConnector o1, ProxyConnector o2 )
+    {
+        if ( o1 == null && o2 == null )
+        {
+            return 0;
+        }
+
+        // Ensure null goes to end of list.
+        if ( o1 == null && o2 != null )
+        {
+            return 1;
+        }
+
+        if ( o1 != null && o2 == null )
+        {
+            return -1;
+        }
+
+        // Ensure 0 (unordered) goes to end of list.
+        if ( o1.getOrder() == 0 && o2.getOrder() != 0 )
+        {
+            return 1;
+        }
+
+        if ( o1.getOrder() != 0 && o2.getOrder() == 0 )
+        {
+            return -1;
+        }
+
+        return o1.getOrder() - o2.getOrder();
+    }
+
+    public static ProxyConnectorOrderComparator getInstance()
+    {
+        return INSTANCE;
+    }
+}
diff --git a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-api/src/main/java/org/apache/archiva/admin/model/proxyconnector/ProxyConnectorSelectionPredicate.java b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-api/src/main/java/org/apache/archiva/admin/model/proxyconnector/ProxyConnectorSelectionPredicate.java
new file mode 100644 (file)
index 0000000..953c9f1
--- /dev/null
@@ -0,0 +1,54 @@
+package org.apache.archiva.admin.model.proxyconnector;
+/*
+ * 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.commons.collections.Predicate;
+import org.apache.commons.lang.StringUtils;
+
+/**
+ * @author Olivier Lamy
+ * @since 1.4
+ */
+public class ProxyConnectorSelectionPredicate
+    implements Predicate
+{
+    private String sourceId;
+
+    private String targetId;
+
+    public ProxyConnectorSelectionPredicate( String sourceId, String targetId )
+    {
+        this.sourceId = sourceId;
+        this.targetId = targetId;
+    }
+
+    public boolean evaluate( Object object )
+    {
+        boolean satisfies = false;
+
+        if ( object instanceof ProxyConnector )
+        {
+            ProxyConnector connector = (ProxyConnector) object;
+            return ( StringUtils.equals( sourceId, connector.getSourceRepoId() ) && StringUtils.equals( targetId,
+                                                                                                        connector.getTargetRepoId() ) );
+        }
+
+        return satisfies;
+    }
+}
diff --git a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-api/src/main/java/org/apache/archiva/admin/model/remote/RemoteRepository.java b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-api/src/main/java/org/apache/archiva/admin/model/remote/RemoteRepository.java
new file mode 100644 (file)
index 0000000..ced425b
--- /dev/null
@@ -0,0 +1,119 @@
+package org.apache.archiva.admin.model.remote;
+
+/*
+ * 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.admin.model.AbstractRepository;
+
+import java.io.Serializable;
+
+/**
+ * @author Olivier Lamy
+ * @since 1.4
+ */
+public class RemoteRepository
+    extends AbstractRepository
+    implements Serializable
+{
+
+    private String url;
+
+    private String userName;
+
+    private String password;
+
+    private int timeout = 60;
+
+    public RemoteRepository()
+    {
+        // no op
+    }
+
+    public RemoteRepository( String id, String name, String url, String layout )
+    {
+        super( id, name, layout );
+        this.url = url;
+    }
+
+    public RemoteRepository( String id, String name, String url, String layout, String userName, String password,
+                             int timeOut )
+    {
+        super( id, name, layout );
+        this.url = url;
+        this.userName = userName;
+        this.password = password;
+        this.timeout = timeOut;
+    }
+
+    public String getUrl()
+    {
+        return url;
+    }
+
+    public void setUrl( String url )
+    {
+        this.url = url;
+    }
+
+    public String getUserName()
+    {
+        return userName;
+    }
+
+    public void setUserName( String userName )
+    {
+        this.userName = userName;
+    }
+
+    public String getPassword()
+    {
+        return password;
+    }
+
+    public void setPassword( String password )
+    {
+        this.password = password;
+    }
+
+    public int getTimeout()
+    {
+        return timeout;
+    }
+
+    public void setTimeout( int timeout )
+    {
+        this.timeout = timeout;
+    }
+
+    @Override
+    public String toString()
+    {
+        final StringBuilder sb = new StringBuilder();
+        sb.append( "RemoteRepository" );
+        sb.append( "{url='" ).append( url ).append( '\'' );
+        sb.append( ", userName='" ).append( userName ).append( '\'' );
+        sb.append( ", password='" ).append( password ).append( '\'' );
+        sb.append( ", timeout=" ).append( timeout );
+        sb.append( '}' );
+        sb.append( super.toString() );
+        return sb.toString();
+    }
+
+
+}
\ No newline at end of file
diff --git a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-api/src/main/java/org/apache/archiva/admin/model/remote/RemoteRepositoryAdmin.java b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-api/src/main/java/org/apache/archiva/admin/model/remote/RemoteRepositoryAdmin.java
new file mode 100644 (file)
index 0000000..0753f90
--- /dev/null
@@ -0,0 +1,51 @@
+package org.apache.archiva.admin.model.remote;
+/*
+ * 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.admin.model.AuditInformation;
+import org.apache.archiva.admin.model.RepositoryAdminException;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author Olivier Lamy
+ * @since 1.4
+ */
+public interface RemoteRepositoryAdmin
+{
+    List<RemoteRepository> getRemoteRepositories()
+        throws RepositoryAdminException;
+
+    RemoteRepository getRemoteRepository( String repositoryId )
+        throws RepositoryAdminException;
+
+    Boolean deleteRemoteRepository( String repositoryId, AuditInformation auditInformation )
+        throws RepositoryAdminException;
+
+    Boolean addRemoteRepository( RemoteRepository remoteRepository, AuditInformation auditInformation )
+        throws RepositoryAdminException;
+
+    Boolean updateRemoteRepository( RemoteRepository remoteRepository, AuditInformation auditInformation )
+        throws RepositoryAdminException;
+
+    Map<String, RemoteRepository> getRemoteRepositoriesAsMap()
+        throws RepositoryAdminException;
+}
diff --git a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/pom.xml b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/pom.xml
new file mode 100644 (file)
index 0000000..a2f4721
--- /dev/null
@@ -0,0 +1,200 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ 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.
+  -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+  <parent>
+    <groupId>org.apache.archiva</groupId>
+    <artifactId>archiva-repository-admin</artifactId>
+    <version>1.4-SNAPSHOT</version>
+  </parent>
+  <artifactId>archiva-repository-admin-default</artifactId>
+  <name>Archiva Base :: Repository Admin Default</name>
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.archiva</groupId>
+      <artifactId>archiva-configuration</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.archiva</groupId>
+      <artifactId>archiva-security-common</artifactId>
+    </dependency>
+     <dependency>
+      <groupId>org.apache.archiva</groupId>
+      <artifactId>archiva-scheduler-repository</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.archiva</groupId>
+      <artifactId>archiva-repository-admin-api</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.archiva</groupId>
+      <artifactId>audit</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>javax.inject</groupId>
+      <artifactId>javax.inject</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>net.sf.beanlib</groupId>
+      <artifactId>beanlib</artifactId>
+        <exclusions>
+          <exclusion>
+            <groupId>cglib</groupId>
+            <artifactId>cglib</artifactId>
+          </exclusion>
+          <exclusion>
+            <groupId>aopalliance</groupId>
+            <artifactId>aopalliance</artifactId>
+          </exclusion>
+        </exclusions>
+    </dependency>
+    <dependency>
+      <groupId>org.springframework</groupId>
+      <artifactId>spring-context-support</artifactId>
+      <version>${spring.version}</version>
+      <exclusions>
+        <exclusion>
+          <groupId>commons-logging</groupId>
+          <artifactId>commons-logging</artifactId>
+        </exclusion>
+      </exclusions>
+    </dependency>
+    <dependency>
+      <groupId>org.springframework</groupId>
+      <artifactId>spring-context</artifactId>
+      <version>${spring.version}</version>
+      <exclusions>
+        <exclusion>
+          <groupId>commons-logging</groupId>
+          <artifactId>commons-logging</artifactId>
+        </exclusion>
+      </exclusions>
+    </dependency>
+    <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>slf4j-api</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>commons-validator</groupId>
+      <artifactId>commons-validator</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>oro</groupId>
+      <artifactId>oro</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.codehaus.redback.components</groupId>
+      <artifactId>spring-quartz</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.codehaus.redback</groupId>
+      <artifactId>redback-rbac-role-manager</artifactId>
+      <exclusions>
+        <exclusion>
+          <groupId>commons-logging</groupId>
+          <artifactId>commons-logging</artifactId>
+        </exclusion>
+      </exclusions>
+    </dependency>
+    <dependency>
+      <groupId>org.codehaus.redback</groupId>
+      <artifactId>redback-authentication-api</artifactId>
+        <exclusions>
+          <exclusion>
+            <groupId>commons-logging</groupId>
+            <artifactId>commons-logging</artifactId>
+          </exclusion>
+        </exclusions>
+    </dependency>
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>slf4j-log4j12</artifactId>
+      <scope>test</scope>
+    </dependency>
+
+    <dependency>
+      <groupId>org.codehaus.redback</groupId>
+      <artifactId>redback-users-memory</artifactId>
+      <scope>test</scope>
+      <version>${redback.version}</version>
+    </dependency>
+
+    <dependency>
+      <groupId>org.codehaus.redback</groupId>
+      <artifactId>redback-keys-memory</artifactId>
+      <scope>test</scope>
+      <version>${redback.version}</version>
+    </dependency>
+
+    <dependency>
+      <groupId>org.codehaus.redback</groupId>
+      <artifactId>redback-rbac-cached</artifactId>
+      <version>${redback.version}</version>
+      <scope>test</scope>
+      <exclusions>
+        <exclusion>
+          <groupId>commons-logging</groupId>
+          <artifactId>commons-logging</artifactId>
+        </exclusion>
+      </exclusions>
+    </dependency>
+
+    <dependency>
+      <groupId>org.apache.derby</groupId>
+      <artifactId>derby</artifactId>
+      <scope>test</scope>
+    </dependency>
+
+    <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>jcl-over-slf4j</artifactId>
+      <scope>test</scope>
+    </dependency>
+
+    <dependency>
+      <groupId>org.apache.archiva</groupId>
+      <artifactId>metadata-store-file</artifactId>
+      <scope>test</scope>
+    </dependency>
+
+  </dependencies>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-surefire-plugin</artifactId>
+        <configuration>
+          <systemPropertyVariables>
+            <appserver.base>${project.build.outputDirectory}</appserver.base>
+            <plexus.home>${project.build.outputDirectory}</plexus.home>
+          </systemPropertyVariables>
+        </configuration>
+
+      </plugin>
+    </plugins>
+  </build>
+</project>
diff --git a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/AbstractRepositoryAdmin.java b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/AbstractRepositoryAdmin.java
new file mode 100644 (file)
index 0000000..298705f
--- /dev/null
@@ -0,0 +1,132 @@
+package org.apache.archiva.admin.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.
+ */
+
+import org.apache.archiva.admin.model.AuditInformation;
+import org.apache.archiva.admin.model.RepositoryAdminException;
+import org.apache.archiva.audit.AuditEvent;
+import org.apache.archiva.audit.AuditListener;
+import org.apache.maven.archiva.configuration.ArchivaConfiguration;
+import org.apache.maven.archiva.configuration.Configuration;
+import org.apache.maven.archiva.configuration.IndeterminateConfigurationException;
+import org.codehaus.plexus.redback.users.User;
+import org.codehaus.plexus.registry.Registry;
+import org.codehaus.plexus.registry.RegistryException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.inject.Inject;
+import javax.inject.Named;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author Olivier Lamy
+ * @since 1.4
+ */
+public abstract class AbstractRepositoryAdmin
+{
+    protected Logger log = LoggerFactory.getLogger( getClass() );
+
+    @Inject
+    private List<AuditListener> auditListeners = new ArrayList<AuditListener>();
+
+
+    @Inject
+    private RepositoryCommonValidator repositoryCommonValidator;
+
+    @Inject
+    private ArchivaConfiguration archivaConfiguration;
+
+    @Inject
+    @Named( value = "commons-configuration" )
+    private Registry registry;
+
+    protected void triggerAuditEvent( String repositoryId, String resource, String action,
+                                      AuditInformation auditInformation )
+    {
+        User user = auditInformation == null ? null : auditInformation.getUser();
+        AuditEvent event =
+            new AuditEvent( repositoryId, user == null ? "null" : (String) user.getPrincipal(), resource, action );
+        event.setRemoteIP( auditInformation == null ? "null" : auditInformation.getRemoteAddr() );
+
+        for ( AuditListener listener : getAuditListeners() )
+        {
+            listener.auditEvent( event );
+        }
+
+    }
+
+    protected void saveConfiguration( Configuration config )
+        throws RepositoryAdminException
+    {
+        try
+        {
+            getArchivaConfiguration().save( config );
+        }
+        catch ( RegistryException e )
+        {
+            throw new RepositoryAdminException( "Error occurred in the registry.", e );
+        }
+        catch ( IndeterminateConfigurationException e )
+        {
+            throw new RepositoryAdminException( "Error occurred while saving the configuration.", e );
+        }
+    }
+
+    public List<AuditListener> getAuditListeners()
+    {
+        return auditListeners;
+    }
+
+    public void setAuditListeners( List<AuditListener> auditListeners )
+    {
+        this.auditListeners = auditListeners;
+    }
+
+    public void setArchivaConfiguration( ArchivaConfiguration archivaConfiguration )
+    {
+        this.archivaConfiguration = archivaConfiguration;
+    }
+
+    public ArchivaConfiguration getArchivaConfiguration()
+    {
+        return archivaConfiguration;
+    }
+
+    public RepositoryCommonValidator getRepositoryCommonValidator()
+    {
+        return repositoryCommonValidator;
+    }
+
+    public void setRepositoryCommonValidator( RepositoryCommonValidator repositoryCommonValidator )
+    {
+        this.repositoryCommonValidator = repositoryCommonValidator;
+    }
+
+    public Registry getRegistry()
+    {
+        return registry;
+    }
+
+    public void setRegistry( Registry registry )
+    {
+        this.registry = registry;
+    }
+}
diff --git a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/RepositoryCommonValidator.java b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/RepositoryCommonValidator.java
new file mode 100644 (file)
index 0000000..5ac48f3
--- /dev/null
@@ -0,0 +1,150 @@
+package org.apache.archiva.admin.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.
+ */
+
+import org.apache.archiva.admin.model.AbstractRepository;
+import org.apache.archiva.admin.model.RepositoryAdminException;
+import org.apache.commons.lang.StringUtils;
+import org.apache.commons.validator.GenericValidator;
+import org.apache.maven.archiva.configuration.ArchivaConfiguration;
+import org.apache.maven.archiva.configuration.Configuration;
+import org.codehaus.plexus.registry.Registry;
+import org.springframework.stereotype.Service;
+
+import javax.inject.Inject;
+import javax.inject.Named;
+
+/**
+ * apply basic repository validation : id and name.
+ * Check if already exists.
+ *
+ * @author Olivier Lamy
+ * @since 1.4
+ */
+@Service
+public class RepositoryCommonValidator
+{
+
+    public static final String REPOSITORY_ID_VALID_EXPRESSION = "^[a-zA-Z0-9._-]+$";
+
+    public static final String REPOSITORY_NAME_VALID_EXPRESSION = "^([a-zA-Z0-9.)/_(-]|\\s)+$";
+
+
+    @Inject
+    private ArchivaConfiguration archivaConfiguration;
+
+    @Inject
+    @Named( value = "commons-configuration" )
+    private Registry registry;
+
+    /**
+     * @param abstractRepository
+     * @param update             in update mode if yes already exists won't be check
+     * @throws RepositoryAdminException
+     */
+    public void basicValidation( AbstractRepository abstractRepository, boolean update )
+        throws RepositoryAdminException
+    {
+        Configuration config = archivaConfiguration.getConfiguration();
+
+        String repoId = abstractRepository.getId();
+
+        if ( !update )
+        {
+
+            if ( config.getManagedRepositoriesAsMap().containsKey( repoId ) )
+            {
+                throw new RepositoryAdminException( "Unable to add new repository with id [" + repoId
+                                                        + "], that id already exists as a managed repository." );
+            }
+            else if ( config.getRepositoryGroupsAsMap().containsKey( repoId ) )
+            {
+                throw new RepositoryAdminException( "Unable to add new repository with id [" + repoId
+                                                        + "], that id already exists as a repository group." );
+            }
+            else if ( config.getRemoteRepositoriesAsMap().containsKey( repoId ) )
+            {
+                throw new RepositoryAdminException( "Unable to add new repository with id [" + repoId
+                                                        + "], that id already exists as a remote repository." );
+            }
+        }
+
+        if ( StringUtils.isBlank( repoId ) )
+        {
+            throw new RepositoryAdminException( "Repository ID cannot be empty." );
+        }
+
+        if ( !GenericValidator.matchRegexp( repoId, REPOSITORY_ID_VALID_EXPRESSION ) )
+        {
+            throw new RepositoryAdminException(
+                "Invalid repository ID. Identifier must only contain alphanumeric characters, underscores(_), dots(.), and dashes(-)." );
+        }
+
+        String name = abstractRepository.getName();
+
+        if ( StringUtils.isBlank( name ) )
+        {
+            throw new RepositoryAdminException( "repository name cannot be empty" );
+        }
+
+        if ( !GenericValidator.matchRegexp( name, REPOSITORY_NAME_VALID_EXPRESSION ) )
+        {
+            throw new RepositoryAdminException(
+                "Invalid repository name. Repository Name must only contain alphanumeric characters, white-spaces(' '), "
+                    + "forward-slashes(/), open-parenthesis('('), close-parenthesis(')'),  underscores(_), dots(.), and dashes(-)." );
+        }
+
+
+    }
+
+    /**
+     * replace some interpolations ${appserver.base} with correct values
+     *
+     * @param directory
+     * @return
+     */
+    public String removeExpressions( String directory )
+    {
+        String value = StringUtils.replace( directory, "${appserver.base}",
+                                            getRegistry().getString( "appserver.base", "${appserver.base}" ) );
+        value = StringUtils.replace( value, "${appserver.home}",
+                                     getRegistry().getString( "appserver.home", "${appserver.home}" ) );
+        return value;
+    }
+
+    public ArchivaConfiguration getArchivaConfiguration()
+    {
+        return archivaConfiguration;
+    }
+
+    public void setArchivaConfiguration( ArchivaConfiguration archivaConfiguration )
+    {
+        this.archivaConfiguration = archivaConfiguration;
+    }
+
+    public Registry getRegistry()
+    {
+        return registry;
+    }
+
+    public void setRegistry( Registry registry )
+    {
+        this.registry = registry;
+    }
+}
diff --git a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/admin/DefaultArchivaAdministration.java b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/admin/DefaultArchivaAdministration.java
new file mode 100644 (file)
index 0000000..e899523
--- /dev/null
@@ -0,0 +1,305 @@
+package org.apache.archiva.admin.repository.admin;
+/*
+ * 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 net.sf.beanlib.provider.replicator.BeanReplicator;
+import org.apache.archiva.admin.model.AuditInformation;
+import org.apache.archiva.admin.model.RepositoryAdminException;
+import org.apache.archiva.admin.model.admin.ArchivaAdministration;
+import org.apache.archiva.admin.model.admin.FileType;
+import org.apache.archiva.admin.model.admin.LegacyArtifactPath;
+import org.apache.archiva.admin.model.admin.OrganisationInformation;
+import org.apache.archiva.admin.repository.AbstractRepositoryAdmin;
+import org.apache.archiva.audit.AuditEvent;
+import org.apache.commons.lang.StringUtils;
+import org.apache.maven.archiva.configuration.Configuration;
+import org.springframework.stereotype.Service;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+/**
+ * @author Olivier Lamy
+ */
+@Service( "archivaAdministration#default" )
+public class DefaultArchivaAdministration
+    extends AbstractRepositoryAdmin
+    implements ArchivaAdministration
+{
+    public List<LegacyArtifactPath> getLegacyArtifactPaths()
+        throws RepositoryAdminException
+    {
+        List<LegacyArtifactPath> legacyArtifactPaths = new ArrayList<LegacyArtifactPath>();
+        for ( org.apache.maven.archiva.configuration.LegacyArtifactPath legacyArtifactPath : getArchivaConfiguration().getConfiguration().getLegacyArtifactPaths() )
+        {
+            legacyArtifactPaths.add(
+                new BeanReplicator().replicateBean( legacyArtifactPath, LegacyArtifactPath.class ) );
+        }
+        return legacyArtifactPaths;
+
+    }
+
+    public void addLegacyArtifactPath( LegacyArtifactPath legacyArtifactPath, AuditInformation auditInformation )
+        throws RepositoryAdminException
+    {
+        Configuration configuration = getArchivaConfiguration().getConfiguration();
+
+        configuration.addLegacyArtifactPath( new BeanReplicator().replicateBean( legacyArtifactPath,
+                                                                                 org.apache.maven.archiva.configuration.LegacyArtifactPath.class ) );
+
+        saveConfiguration( configuration );
+        triggerAuditEvent( "", "", AuditEvent.ADD_LEGACY_PATH, auditInformation );
+    }
+
+    public void deleteLegacyArtifactPath( String path, AuditInformation auditInformation )
+        throws RepositoryAdminException
+    {
+        Configuration configuration = getArchivaConfiguration().getConfiguration();
+        org.apache.maven.archiva.configuration.LegacyArtifactPath legacyArtifactPath =
+            new org.apache.maven.archiva.configuration.LegacyArtifactPath();
+
+        legacyArtifactPath.setPath( path );
+        configuration.removeLegacyArtifactPath( legacyArtifactPath );
+
+        saveConfiguration( configuration );
+        triggerAuditEvent( "", "", AuditEvent.REMOVE_LEGACY_PATH, auditInformation );
+    }
+
+
+    public void addFileTypePattern( String fileTypeId, String pattern, AuditInformation auditInformation )
+        throws RepositoryAdminException
+    {
+        Configuration configuration = getArchivaConfiguration().getConfiguration();
+
+        org.apache.maven.archiva.configuration.FileType fileType = getFileTypeById( fileTypeId, configuration );
+        if ( fileType == null )
+        {
+            return;
+        }
+        fileType.addPattern( pattern );
+
+        saveConfiguration( configuration );
+        triggerAuditEvent( "", "", AuditEvent.ADD_PATTERN, auditInformation );
+    }
+
+    public void removeFileTypePattern( String fileTypeId, String pattern, AuditInformation auditInformation )
+        throws RepositoryAdminException
+    {
+        Configuration configuration = getArchivaConfiguration().getConfiguration();
+
+        org.apache.maven.archiva.configuration.FileType fileType = getFileTypeById( fileTypeId, configuration );
+        if ( fileType == null )
+        {
+            return;
+        }
+        fileType.removePattern( pattern );
+
+        saveConfiguration( configuration );
+        triggerAuditEvent( "", "", AuditEvent.REMOVE_PATTERN, auditInformation );
+    }
+
+    public FileType getFileType( String fileTypeId )
+        throws RepositoryAdminException
+    {
+        org.apache.maven.archiva.configuration.FileType fileType =
+            getFileTypeById( fileTypeId, getArchivaConfiguration().getConfiguration() );
+        if ( fileType == null )
+        {
+            return null;
+        }
+        return new BeanReplicator().replicateBean( fileType, FileType.class );
+    }
+
+    public void addFileType( FileType fileType, AuditInformation auditInformation )
+        throws RepositoryAdminException
+    {
+        Configuration configuration = getArchivaConfiguration().getConfiguration();
+        if ( getFileTypeById( fileType.getId(), configuration ) != null )
+        {
+            throw new RepositoryAdminException(
+                "impossible to FileType with id " + fileType.getId() + " already exists" );
+        }
+
+        configuration.getRepositoryScanning().addFileType(
+            new BeanReplicator().replicateBean( fileType, org.apache.maven.archiva.configuration.FileType.class ) );
+        saveConfiguration( configuration );
+    }
+
+    public void removeFileType( String fileTypeId, AuditInformation auditInformation )
+        throws RepositoryAdminException
+    {
+        Configuration configuration = getArchivaConfiguration().getConfiguration();
+        org.apache.maven.archiva.configuration.FileType fileType =
+            new org.apache.maven.archiva.configuration.FileType();
+        fileType.setId( fileTypeId );
+        configuration.getRepositoryScanning().removeFileType( fileType );
+        saveConfiguration( configuration );
+    }
+
+    public void addKnownContentConsumer( String knownContentConsumer, AuditInformation auditInformation )
+        throws RepositoryAdminException
+    {
+        Configuration configuration = getArchivaConfiguration().getConfiguration();
+        if ( configuration.getRepositoryScanning().getKnownContentConsumers().contains( knownContentConsumer ) )
+        {
+            log.warn( "skip adding knownContentConsumer {} as already here", knownContentConsumer );
+            return;
+        }
+        configuration.getRepositoryScanning().addKnownContentConsumer( knownContentConsumer );
+        saveConfiguration( configuration );
+        triggerAuditEvent( "", "", AuditEvent.ENABLE_REPO_CONSUMER, auditInformation );
+    }
+
+    public void removeKnownContentConsumer( String knownContentConsumer, AuditInformation auditInformation )
+        throws RepositoryAdminException
+    {
+        Configuration configuration = getArchivaConfiguration().getConfiguration();
+        configuration.getRepositoryScanning().removeKnownContentConsumer( knownContentConsumer );
+        saveConfiguration( configuration );
+        triggerAuditEvent( "", "", AuditEvent.DISABLE_REPO_CONSUMER, auditInformation );
+    }
+
+    public void addInvalidContentConsumer( String invalidContentConsumer, AuditInformation auditInformation )
+        throws RepositoryAdminException
+    {
+        Configuration configuration = getArchivaConfiguration().getConfiguration();
+        if ( configuration.getRepositoryScanning().getInvalidContentConsumers().contains( invalidContentConsumer ) )
+        {
+            log.warn( "skip adding invalidContentConsumer {} as already here", invalidContentConsumer );
+            return;
+        }
+        configuration.getRepositoryScanning().addInvalidContentConsumer( invalidContentConsumer );
+        saveConfiguration( configuration );
+        triggerAuditEvent( "", "", AuditEvent.ENABLE_REPO_CONSUMER, auditInformation );
+    }
+
+    public void removeInvalidContentConsumer( String invalidContentConsumer, AuditInformation auditInformation )
+        throws RepositoryAdminException
+    {
+        Configuration configuration = getArchivaConfiguration().getConfiguration();
+        configuration.getRepositoryScanning().removeInvalidContentConsumer( invalidContentConsumer );
+        saveConfiguration( configuration );
+        triggerAuditEvent( "", "", AuditEvent.DISABLE_REPO_CONSUMER, auditInformation );
+    }
+
+    public void setKnownContentConsumers( List<String> knownContentConsumers, AuditInformation auditInformation )
+        throws RepositoryAdminException
+    {
+        if ( knownContentConsumers == null )
+        {
+            return;
+        }
+        for ( String knowContentConsumer : knownContentConsumers )
+        {
+            addKnownContentConsumer( knowContentConsumer, auditInformation );
+        }
+    }
+
+    public void setInvalidContentConsumers( List<String> invalidContentConsumers, AuditInformation auditInformation )
+        throws RepositoryAdminException
+    {
+        if ( invalidContentConsumers == null )
+        {
+            return;
+        }
+        for ( String invalidContentConsumer : invalidContentConsumers )
+        {
+            addKnownContentConsumer( invalidContentConsumer, auditInformation );
+        }
+    }
+
+    public List<FileType> getFileTypes()
+        throws RepositoryAdminException
+    {
+        List<org.apache.maven.archiva.configuration.FileType> configFileTypes =
+            getArchivaConfiguration().getConfiguration().getRepositoryScanning().getFileTypes();
+        if ( configFileTypes == null || configFileTypes.isEmpty() )
+        {
+            return Collections.emptyList();
+        }
+        List<FileType> fileTypes = new ArrayList<FileType>();
+        for ( org.apache.maven.archiva.configuration.FileType fileType : configFileTypes )
+        {
+            fileTypes.add( new BeanReplicator().replicateBean( fileType, FileType.class ) );
+        }
+        return fileTypes;
+    }
+
+    public List<String> getKnownContentConsumers()
+        throws RepositoryAdminException
+    {
+        return new ArrayList<String>(
+            getArchivaConfiguration().getConfiguration().getRepositoryScanning().getKnownContentConsumers() );
+    }
+
+    public List<String> getInvalidContentConsumers()
+        throws RepositoryAdminException
+    {
+        return new ArrayList<String>(
+            getArchivaConfiguration().getConfiguration().getRepositoryScanning().getInvalidContentConsumers() );
+    }
+
+    public OrganisationInformation getOrganisationInformation()
+        throws RepositoryAdminException
+    {
+        org.apache.maven.archiva.configuration.OrganisationInformation organisationInformation =
+            getArchivaConfiguration().getConfiguration().getOrganisationInfo();
+        if ( organisationInformation == null )
+        {
+            return null;
+        }
+        return new BeanReplicator().replicateBean( organisationInformation, OrganisationInformation.class );
+    }
+
+    public void setOrganisationInformation( OrganisationInformation organisationInformation )
+        throws RepositoryAdminException
+    {
+        Configuration configuration = getArchivaConfiguration().getConfiguration();
+        if ( organisationInformation != null )
+        {
+            org.apache.maven.archiva.configuration.OrganisationInformation organisationInformationModel =
+                new BeanReplicator().replicateBean( organisationInformation,
+                                                    org.apache.maven.archiva.configuration.OrganisationInformation.class );
+            configuration.setOrganisationInfo( organisationInformationModel );
+        }
+        else
+        {
+            configuration.setOrganisationInfo( null );
+        }
+        saveConfiguration( configuration );
+    }
+
+    //-------------------------
+    //
+    //-------------------------
+
+    private org.apache.maven.archiva.configuration.FileType getFileTypeById( String id, Configuration configuration )
+    {
+        for ( org.apache.maven.archiva.configuration.FileType fileType : configuration.getRepositoryScanning().getFileTypes() )
+        {
+            if ( StringUtils.equals( id, fileType.getId() ) )
+            {
+                return fileType;
+            }
+        }
+        return null;
+    }
+
+}
diff --git a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/admin/FiletypeToMapClosure.java b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/admin/FiletypeToMapClosure.java
new file mode 100644 (file)
index 0000000..b48392e
--- /dev/null
@@ -0,0 +1,51 @@
+package org.apache.archiva.admin.repository.admin;
+
+/*
+ * 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.admin.model.admin.FileType;
+import org.apache.commons.collections.Closure;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * FiletypeToMapClosure 
+ *
+ * @since 1.4
+ */
+public class FiletypeToMapClosure
+    implements Closure
+{
+    private Map<String, FileType> map = new HashMap<String, FileType>();
+
+    public void execute( Object input )
+    {
+        if ( input instanceof FileType )
+        {
+            FileType filetype = (FileType) input;
+            map.put( filetype.getId(), filetype );
+        }
+    }
+
+    public Map<String, FileType> getMap()
+    {
+        return map;
+    }
+}
diff --git a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/group/DefaultRepositoryGroupAdmin.java b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/group/DefaultRepositoryGroupAdmin.java
new file mode 100644 (file)
index 0000000..e3c2b63
--- /dev/null
@@ -0,0 +1,327 @@
+package org.apache.archiva.admin.repository.group;
+/*
+ * 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.admin.model.AuditInformation;
+import org.apache.archiva.admin.model.RepositoryAdminException;
+import org.apache.archiva.admin.model.group.RepositoryGroup;
+import org.apache.archiva.admin.model.group.RepositoryGroupAdmin;
+import org.apache.archiva.admin.model.managed.ManagedRepository;
+import org.apache.archiva.admin.model.managed.ManagedRepositoryAdmin;
+import org.apache.archiva.admin.repository.AbstractRepositoryAdmin;
+import org.apache.archiva.audit.AuditEvent;
+import org.apache.commons.lang.StringUtils;
+import org.apache.maven.archiva.configuration.Configuration;
+import org.apache.maven.archiva.configuration.RepositoryGroupConfiguration;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Service;
+
+import javax.inject.Inject;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+/**
+ * @author Olivier Lamy
+ */
+@Service( "repositoryGroupAdmin#default" )
+public class DefaultRepositoryGroupAdmin
+    extends AbstractRepositoryAdmin
+    implements RepositoryGroupAdmin
+{
+
+    private Logger log = LoggerFactory.getLogger( getClass() );
+
+    private static final Pattern REPO_GROUP_ID_PATTERN = Pattern.compile( "[A-Za-z0-9\\._\\-]+" );
+
+    @Inject
+    private ManagedRepositoryAdmin managedRepositoryAdmin;
+
+    public List<RepositoryGroup> getRepositoriesGroups()
+        throws RepositoryAdminException
+    {
+        List<RepositoryGroup> repositoriesGroups = new ArrayList<RepositoryGroup>();
+
+        for ( RepositoryGroupConfiguration repositoryGroupConfiguration : getArchivaConfiguration().getConfiguration().getRepositoryGroups() )
+        {
+            repositoriesGroups.add( new RepositoryGroup( repositoryGroupConfiguration.getId(), new ArrayList<String>(
+                repositoryGroupConfiguration.getRepositories() ) ) );
+        }
+
+        return repositoriesGroups;
+    }
+
+    public RepositoryGroup getRepositoryGroup( String repositoryGroupId )
+        throws RepositoryAdminException
+    {
+        List<RepositoryGroup> repositoriesGroups = getRepositoriesGroups();
+        for ( RepositoryGroup repositoryGroup : repositoriesGroups )
+        {
+            if ( StringUtils.equals( repositoryGroupId, repositoryGroup.getId() ) )
+            {
+                return repositoryGroup;
+            }
+        }
+        return null;
+    }
+
+    public Boolean addRepositoryGroup( RepositoryGroup repositoryGroup, AuditInformation auditInformation )
+        throws RepositoryAdminException
+    {
+        validateRepositoryGroup( repositoryGroup, false );
+        validateManagedRepositoriesExists( repositoryGroup.getRepositories() );
+        RepositoryGroupConfiguration repositoryGroupConfiguration = new RepositoryGroupConfiguration();
+        repositoryGroupConfiguration.setId( repositoryGroup.getId() );
+        repositoryGroupConfiguration.setRepositories( repositoryGroup.getRepositories() );
+        Configuration configuration = getArchivaConfiguration().getConfiguration();
+        configuration.addRepositoryGroup( repositoryGroupConfiguration );
+        saveConfiguration( configuration );
+        triggerAuditEvent( repositoryGroup.getId(), null, AuditEvent.ADD_REPO_GROUP, auditInformation );
+        return Boolean.TRUE;
+    }
+
+    public Boolean deleteRepositoryGroup( String repositoryGroupId, AuditInformation auditInformation )
+        throws RepositoryAdminException
+    {
+        Configuration configuration = getArchivaConfiguration().getConfiguration();
+        RepositoryGroupConfiguration repositoryGroupConfiguration =
+            configuration.getRepositoryGroupsAsMap().get( repositoryGroupId );
+        if ( repositoryGroupConfiguration == null )
+        {
+            throw new RepositoryAdminException(
+                "repositoryGroup with id " + repositoryGroupId + " doesn't not exists so cannot remove" );
+        }
+        configuration.removeRepositoryGroup( repositoryGroupConfiguration );
+        triggerAuditEvent( repositoryGroupId, null, AuditEvent.DELETE_REPO_GROUP, auditInformation );
+        return Boolean.TRUE;
+    }
+
+    public Boolean updateRepositoryGroup( RepositoryGroup repositoryGroup, AuditInformation auditInformation )
+        throws RepositoryAdminException
+    {
+        return updateRepositoryGroup( repositoryGroup, auditInformation, true );
+    }
+
+    private Boolean updateRepositoryGroup( RepositoryGroup repositoryGroup, AuditInformation auditInformation,
+                                           boolean triggerAuditEvent )
+        throws RepositoryAdminException
+    {
+        validateRepositoryGroup( repositoryGroup, true );
+        validateManagedRepositoriesExists( repositoryGroup.getRepositories() );
+        Configuration configuration = getArchivaConfiguration().getConfiguration();
+
+        RepositoryGroupConfiguration repositoryGroupConfiguration =
+            configuration.getRepositoryGroupsAsMap().get( repositoryGroup.getId() );
+
+        configuration.removeRepositoryGroup( repositoryGroupConfiguration );
+
+        repositoryGroupConfiguration.setRepositories( repositoryGroup.getRepositories() );
+        configuration.addRepositoryGroup( repositoryGroupConfiguration );
+
+        saveConfiguration( configuration );
+        if ( triggerAuditEvent )
+        {
+            triggerAuditEvent( repositoryGroup.getId(), null, AuditEvent.MODIFY_REPO_GROUP, auditInformation );
+        }
+        return Boolean.TRUE;
+    }
+
+
+    public Boolean addRepositoryToGroup( String repositoryGroupId, String repositoryId,
+                                         AuditInformation auditInformation )
+        throws RepositoryAdminException
+    {
+        RepositoryGroup repositoryGroup = getRepositoryGroup( repositoryGroupId );
+        if ( repositoryGroup == null )
+        {
+            throw new RepositoryAdminException(
+                "repositoryGroup with id " + repositoryGroupId + " doesn't not exists so cannot add repository to it" );
+        }
+
+        if ( repositoryGroup.getRepositories().contains( repositoryId ) )
+        {
+            throw new RepositoryAdminException(
+                "repositoryGroup with id " + repositoryGroupId + " already contain repository with id" + repositoryId );
+        }
+        validateManagedRepositoriesExists( Arrays.asList( repositoryId ) );
+
+        repositoryGroup.addRepository( repositoryId );
+        updateRepositoryGroup( repositoryGroup, auditInformation, false );
+        triggerAuditEvent( repositoryGroup.getId(), null, AuditEvent.ADD_REPO_TO_GROUP, auditInformation );
+        return Boolean.TRUE;
+    }
+
+    public Boolean deleteRepositoryFromGroup( String repositoryGroupId, String repositoryId,
+                                              AuditInformation auditInformation )
+        throws RepositoryAdminException
+    {
+        RepositoryGroup repositoryGroup = getRepositoryGroup( repositoryGroupId );
+        if ( repositoryGroup == null )
+        {
+            throw new RepositoryAdminException( "repositoryGroup with id " + repositoryGroupId
+                                                    + " doesn't not exists so cannot remove repository from it" );
+        }
+
+        if ( !repositoryGroup.getRepositories().contains( repositoryId ) )
+        {
+            throw new RepositoryAdminException(
+                "repositoryGroup with id " + repositoryGroupId + " doesn't not contains repository with id"
+                    + repositoryId );
+        }
+
+        repositoryGroup.removeRepository( repositoryId );
+        updateRepositoryGroup( repositoryGroup, auditInformation, false );
+        triggerAuditEvent( repositoryGroup.getId(), null, AuditEvent.DELETE_REPO_FROM_GROUP, auditInformation );
+        return Boolean.TRUE;
+    }
+
+    public Map<String, RepositoryGroup> getRepositoryGroupsAsMap()
+        throws RepositoryAdminException
+    {
+        List<RepositoryGroup> repositoriesGroups = getRepositoriesGroups();
+        Map<String, RepositoryGroup> map = new HashMap<String, RepositoryGroup>( repositoriesGroups.size() );
+        for ( RepositoryGroup repositoryGroup : repositoriesGroups )
+        {
+            map.put( repositoryGroup.getId(), repositoryGroup );
+        }
+        return map;
+    }
+
+    public Map<String, List<String>> getGroupToRepositoryMap()
+        throws RepositoryAdminException
+    {
+
+        java.util.Map<String, java.util.List<String>> map = new java.util.HashMap<String, java.util.List<String>>();
+
+        for ( ManagedRepository repo : getManagedRepositoryAdmin().getManagedRepositories() )
+        {
+            for ( RepositoryGroup group : getRepositoriesGroups() )
+            {
+                if ( !group.getRepositories().contains( repo.getId() ) )
+                {
+                    String groupId = group.getId();
+                    java.util.List<String> repos = map.get( groupId );
+                    if ( repos == null )
+                    {
+                        repos = new java.util.ArrayList<String>();
+                        map.put( groupId, repos );
+                    }
+                    repos.add( repo.getId() );
+                }
+            }
+        }
+        return map;
+    }
+
+    public Map<String, List<String>> getRepositoryToGroupMap()
+        throws RepositoryAdminException
+    {
+        java.util.Map<String, java.util.List<String>> map = new java.util.HashMap<String, java.util.List<String>>();
+
+        for ( RepositoryGroup group : getRepositoriesGroups() )
+        {
+            for ( String repositoryId : group.getRepositories() )
+            {
+                java.util.List<String> groups = map.get( repositoryId );
+                if ( groups == null )
+                {
+                    groups = new java.util.ArrayList<String>();
+                    map.put( repositoryId, groups );
+                }
+                groups.add( group.getId() );
+            }
+        }
+        return map;
+    }
+
+    public Boolean validateRepositoryGroup( RepositoryGroup repositoryGroup, boolean updateMode )
+        throws RepositoryAdminException
+    {
+        String repoGroupId = repositoryGroup.getId();
+        if ( StringUtils.isBlank( repoGroupId ) )
+        {
+            throw new RepositoryAdminException( "repositoryGroup id cannot be empty" );
+        }
+
+        if ( repoGroupId.length() > 100 )
+        {
+            throw new RepositoryAdminException(
+                "Identifier [" + repoGroupId + "] is over the maximum limit of 100 characters" );
+
+        }
+
+        Matcher matcher = REPO_GROUP_ID_PATTERN.matcher( repoGroupId );
+        if ( !matcher.matches() )
+        {
+            throw new RepositoryAdminException(
+                "Invalid character(s) found in identifier. Only the following characters are allowed: alphanumeric, '.', '-' and '_'" );
+        }
+
+        Configuration configuration = getArchivaConfiguration().getConfiguration();
+
+        if ( configuration.getRepositoryGroupsAsMap().containsKey( repoGroupId ) )
+        {
+            if ( !updateMode )
+            {
+                throw new RepositoryAdminException( "Unable to add new repository group with id [" + repoGroupId
+                                                        + "], that id already exists as a repository group." );
+            }
+        }
+        else if ( configuration.getManagedRepositoriesAsMap().containsKey( repoGroupId ) )
+        {
+            throw new RepositoryAdminException( "Unable to add new repository group with id [" + repoGroupId
+                                                    + "], that id already exists as a managed repository." );
+        }
+        else if ( configuration.getRemoteRepositoriesAsMap().containsKey( repoGroupId ) )
+        {
+            throw new RepositoryAdminException( "Unable to add new repository group with id [" + repoGroupId
+                                                    + "], that id already exists as a remote repository." );
+        }
+
+        return Boolean.TRUE;
+    }
+
+    private void validateManagedRepositoriesExists( List<String> managedRepositoriesIds )
+        throws RepositoryAdminException
+    {
+        for ( String id : managedRepositoriesIds )
+        {
+            if ( getManagedRepositoryAdmin().getManagedRepository( id ) == null )
+            {
+                throw new RepositoryAdminException(
+                    "managedRepository with id " + id + " not exists so cannot be used in a repositoryGroup" );
+            }
+        }
+    }
+
+    public ManagedRepositoryAdmin getManagedRepositoryAdmin()
+    {
+        return managedRepositoryAdmin;
+    }
+
+    public void setManagedRepositoryAdmin( ManagedRepositoryAdmin managedRepositoryAdmin )
+    {
+        this.managedRepositoryAdmin = managedRepositoryAdmin;
+    }
+}
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
new file mode 100644 (file)
index 0000000..bee9869
--- /dev/null
@@ -0,0 +1,600 @@
+package org.apache.archiva.admin.repository.managed;
+/*
+ * 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.admin.model.AuditInformation;
+import org.apache.archiva.admin.model.RepositoryAdminException;
+import org.apache.archiva.admin.model.managed.ManagedRepository;
+import org.apache.archiva.admin.model.managed.ManagedRepositoryAdmin;
+import org.apache.archiva.admin.repository.AbstractRepositoryAdmin;
+import org.apache.archiva.audit.AuditEvent;
+import org.apache.archiva.metadata.repository.MetadataRepository;
+import org.apache.archiva.metadata.repository.MetadataRepositoryException;
+import org.apache.archiva.metadata.repository.RepositorySession;
+import org.apache.archiva.metadata.repository.RepositorySessionFactory;
+import org.apache.archiva.metadata.repository.stats.RepositoryStatisticsManager;
+import org.apache.archiva.scheduler.repository.RepositoryArchivaTaskScheduler;
+import org.apache.archiva.scheduler.repository.RepositoryTask;
+import org.apache.archiva.security.common.ArchivaRoleConstants;
+import org.apache.commons.io.FileUtils;
+import org.apache.commons.lang.StringUtils;
+import org.apache.commons.validator.GenericValidator;
+import org.apache.maven.archiva.configuration.Configuration;
+import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
+import org.apache.maven.archiva.configuration.ProxyConnectorConfiguration;
+import org.apache.maven.archiva.configuration.RepositoryGroupConfiguration;
+import org.codehaus.plexus.redback.role.RoleManager;
+import org.codehaus.plexus.redback.role.RoleManagerException;
+import org.codehaus.plexus.taskqueue.TaskQueueException;
+import org.codehaus.redback.components.scheduler.CronExpressionValidator;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Service;
+
+import javax.inject.Inject;
+import javax.inject.Named;
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * FIXME remove all generic Exception to have usefull ones
+ * FIXME review the staging mechanism to have a per user session one
+ *
+ * @author Olivier Lamy
+ */
+@Service( "managedRepositoryAdmin#default" )
+public class DefaultManagedRepositoryAdmin
+    extends AbstractRepositoryAdmin
+    implements ManagedRepositoryAdmin
+{
+
+    public static final String REPOSITORY_LOCATION_VALID_EXPRESSION = "^[-a-zA-Z0-9._/~:?!&amp;=\\\\]+$";
+
+    private Logger log = LoggerFactory.getLogger( getClass() );
+
+    public static final String STAGE_REPO_ID_END = "-stage";
+
+
+    @Inject
+    @Named( value = "archivaTaskScheduler#repository" )
+    private RepositoryArchivaTaskScheduler repositoryTaskScheduler;
+
+    @Inject
+    private RepositorySessionFactory repositorySessionFactory;
+
+    @Inject
+    private RepositoryStatisticsManager repositoryStatisticsManager;
+
+
+    @Inject
+    protected RoleManager roleManager;
+
+    public List<ManagedRepository> getManagedRepositories()
+        throws RepositoryAdminException
+    {
+        List<ManagedRepositoryConfiguration> managedRepoConfigs =
+            getArchivaConfiguration().getConfiguration().getManagedRepositories();
+
+        List<ManagedRepository> managedRepos = new ArrayList<ManagedRepository>( managedRepoConfigs.size() );
+
+        for ( ManagedRepositoryConfiguration repoConfig : managedRepoConfigs )
+        {
+            // TODO add staging repo information back too
+            ManagedRepository repo =
+                new ManagedRepository( repoConfig.getId(), repoConfig.getName(), repoConfig.getLocation(),
+                                       repoConfig.getLayout(), repoConfig.isSnapshots(), repoConfig.isReleases(),
+                                       repoConfig.isBlockRedeployments(), repoConfig.getRefreshCronExpression(),
+                                       repoConfig.getIndexDir(), repoConfig.isScanned(), repoConfig.getDaysOlder(),
+                                       repoConfig.getRetentionCount(), repoConfig.isDeleteReleasedSnapshots() );
+
+            managedRepos.add( repo );
+        }
+
+        return managedRepos;
+    }
+
+    public Map<String, ManagedRepository> getManagedRepositoriesAsMap()
+        throws RepositoryAdminException
+    {
+        List<ManagedRepository> managedRepositories = getManagedRepositories();
+        Map<String, ManagedRepository> repositoriesMap =
+            new HashMap<String, ManagedRepository>( managedRepositories.size() );
+        for ( ManagedRepository managedRepository : managedRepositories )
+        {
+            repositoriesMap.put( managedRepository.getId(), managedRepository );
+        }
+        return repositoriesMap;
+    }
+
+    public ManagedRepository getManagedRepository( String repositoryId )
+        throws RepositoryAdminException
+    {
+        List<ManagedRepository> repos = getManagedRepositories();
+        for ( ManagedRepository repo : repos )
+        {
+            if ( StringUtils.equals( repo.getId(), repositoryId ) )
+            {
+                return repo;
+            }
+        }
+        return null;
+    }
+
+    public Boolean addManagedRepository( ManagedRepository managedRepository, boolean needStageRepo,
+                                         AuditInformation auditInformation )
+        throws RepositoryAdminException
+    {
+
+        getRepositoryCommonValidator().basicValidation( managedRepository, false );
+        triggerAuditEvent( managedRepository.getId(), null, AuditEvent.ADD_MANAGED_REPO, auditInformation );
+        return
+            addManagedRepository( managedRepository.getId(), managedRepository.getLayout(), managedRepository.getName(),
+                                  managedRepository.getLocation(), managedRepository.isBlockRedeployments(),
+                                  managedRepository.isReleases(), managedRepository.isSnapshots(), needStageRepo,
+                                  managedRepository.getCronExpression(), managedRepository.getIndexDirectory(),
+                                  managedRepository.getDaysOlder(), managedRepository.getRetentionCount(),
+                                  managedRepository.isDeleteReleasedSnapshots(), auditInformation,
+                                  getArchivaConfiguration().getConfiguration() ) != null;
+
+    }
+
+    private ManagedRepositoryConfiguration addManagedRepository( String repoId, String layout, String name,
+                                                                 String location, boolean blockRedeployments,
+                                                                 boolean releasesIncluded, boolean snapshotsIncluded,
+                                                                 boolean stageRepoNeeded, String cronExpression,
+                                                                 String indexDir, int daysOlder, int retentionCount,
+                                                                 boolean deteleReleasedSnapshots,
+                                                                 AuditInformation auditInformation,
+                                                                 Configuration config )
+        throws RepositoryAdminException
+    {
+
+        // FIXME : olamy can be empty to avoid scheduled scan ?
+        if ( StringUtils.isNotBlank( cronExpression ) )
+        {
+            CronExpressionValidator validator = new CronExpressionValidator();
+
+            if ( !validator.validate( cronExpression ) )
+            {
+                throw new RepositoryAdminException( "Invalid cron expression." );
+            }
+        }
+        else
+        {
+            throw new RepositoryAdminException( "Cron expression cannot be empty." );
+        }
+
+        String repoLocation = getRepositoryCommonValidator().removeExpressions( location );
+
+        if ( !GenericValidator.matchRegexp( repoLocation, REPOSITORY_LOCATION_VALID_EXPRESSION ) )
+        {
+            throw new RepositoryAdminException(
+                "Invalid repository location. Directory must only contain alphanumeric characters, equals(=), question-marks(?), "
+                    + "exclamation-points(!), ampersands(&amp;), forward-slashes(/), back-slashes(\\), underscores(_), dots(.), colons(:), tildes(~), and dashes(-)." );
+        }
+
+        ManagedRepositoryConfiguration repository = new ManagedRepositoryConfiguration();
+
+        repository.setId( repoId );
+        repository.setBlockRedeployments( blockRedeployments );
+        repository.setReleases( releasesIncluded );
+        repository.setSnapshots( snapshotsIncluded );
+        repository.setName( name );
+        repository.setLocation( repoLocation );
+        repository.setLayout( layout );
+        repository.setRefreshCronExpression( cronExpression );
+        repository.setIndexDir( indexDir );
+        repository.setDaysOlder( daysOlder );
+        repository.setRetentionCount( retentionCount );
+        repository.setDeleteReleasedSnapshots( deteleReleasedSnapshots );
+
+
+        try
+        {
+            addRepository( repository, config );
+            addRepositoryRoles( repository );
+
+            if ( stageRepoNeeded )
+            {
+                ManagedRepositoryConfiguration stagingRepository = getStageRepoConfig( repository );
+                addRepository( stagingRepository, config );
+                addRepositoryRoles( stagingRepository );
+                triggerAuditEvent( stagingRepository.getId(), null, AuditEvent.ADD_MANAGED_REPO, auditInformation );
+            }
+        }
+        catch ( RoleManagerException e )
+        {
+            throw new RepositoryAdminException( "failed to add repository roles " + e.getMessage(), e );
+        }
+        catch ( IOException e )
+        {
+            throw new RepositoryAdminException( "failed to add repository " + e.getMessage(), e );
+        }
+
+        saveConfiguration( config );
+
+        //MRM-1342 Repository statistics report doesn't appear to be working correctly
+        //scan repository when adding of repository is successful
+        try
+        {
+            scanRepository( repoId, true );
+            // olamy no need of scanning staged repo
+            /*
+            if ( stageRepoNeeded )
+            {
+                ManagedRepositoryConfiguration stagingRepository = getStageRepoConfig( repository );
+                scanRepository( stagingRepository.getId(), true );
+            }*/
+        }
+        catch ( Exception e )
+        {
+            log.warn( new StringBuilder( "Unable to scan repository [" ).append( repoId ).append( "]: " ).append(
+                e.getMessage() ).toString(), e );
+        }
+
+        return repository;
+    }
+
+
+    // FIXME cleanup repositoryGroups when deleting a ManagedRepo
+    public Boolean deleteManagedRepository( String repositoryId, AuditInformation auditInformation,
+                                            boolean deleteContent )
+        throws RepositoryAdminException
+    {
+        Configuration config = getArchivaConfiguration().getConfiguration();
+
+        ManagedRepositoryConfiguration repository = config.findManagedRepositoryById( repositoryId );
+
+        if ( repository == null )
+        {
+            throw new RepositoryAdminException( "A repository with that id does not exist" );
+        }
+
+        triggerAuditEvent( repositoryId, null, AuditEvent.DELETE_MANAGED_REPO, auditInformation );
+
+        deleteManagedRepository( repository, deleteContent, config, false );
+
+        // stage repo exists ?
+        ManagedRepositoryConfiguration stagingRepository =
+            getArchivaConfiguration().getConfiguration().findManagedRepositoryById( repositoryId + STAGE_REPO_ID_END );
+        if ( stagingRepository != null )
+        {
+            // do not trigger event when deleting the staged one
+            //triggerAuditEvent( stagingRepository.getId(), null, AuditEvent.DELETE_MANAGED_REPO, auditInformation );
+            deleteManagedRepository( stagingRepository, deleteContent, config, true );
+        }
+
+        try
+        {
+            saveConfiguration( config );
+        }
+        catch ( Exception e )
+        {
+            throw new RepositoryAdminException( "Error saving configuration for delete action" + e.getMessage() );
+        }
+
+        return Boolean.TRUE;
+    }
+
+    private Boolean deleteManagedRepository( ManagedRepositoryConfiguration repository, boolean deleteContent,
+                                             Configuration config, boolean stagedOne )
+        throws RepositoryAdminException
+    {
+        if ( !stagedOne )
+        {
+            RepositorySession repositorySession = getRepositorySessionFactory().createSession();
+            try
+            {
+                MetadataRepository metadataRepository = repositorySession.getRepository();
+                metadataRepository.removeRepository( repository.getId() );
+                log.debug( "call repositoryStatisticsManager.deleteStatistics" );
+                getRepositoryStatisticsManager().deleteStatistics( metadataRepository, repository.getId() );
+                repositorySession.save();
+            }
+            catch ( MetadataRepositoryException e )
+            {
+                throw new RepositoryAdminException( e.getMessage(), e );
+            }
+            finally
+            {
+                repositorySession.close();
+            }
+        }
+        config.removeManagedRepository( repository );
+
+        if ( deleteContent )
+        {
+            // TODO could be async ? as directory can be huge
+            File dir = new File( repository.getLocation() );
+            if ( !FileUtils.deleteQuietly( dir ) )
+            {
+                throw new RepositoryAdminException( "Cannot delete repository " + dir );
+            }
+        }
+
+        // olamy: copy list for reading as a unit test in webapp fail with ConcurrentModificationException
+        List<ProxyConnectorConfiguration> proxyConnectors =
+            new ArrayList<ProxyConnectorConfiguration>( config.getProxyConnectors() );
+        for ( ProxyConnectorConfiguration proxyConnector : proxyConnectors )
+        {
+            if ( StringUtils.equals( proxyConnector.getSourceRepoId(), repository.getId() ) )
+            {
+                config.removeProxyConnector( proxyConnector );
+            }
+        }
+
+        Map<String, List<String>> repoToGroupMap = config.getRepositoryToGroupMap();
+        if ( repoToGroupMap != null )
+        {
+            if ( repoToGroupMap.containsKey( repository.getId() ) )
+            {
+                List<String> repoGroups = repoToGroupMap.get( repository.getId() );
+                for ( String repoGroup : repoGroups )
+                {
+                    // copy to prevent UnsupportedOperationException
+                    RepositoryGroupConfiguration repositoryGroupConfiguration =
+                        config.findRepositoryGroupById( repoGroup );
+                    List<String> repos = new ArrayList<String>( repositoryGroupConfiguration.getRepositories() );
+                    config.removeRepositoryGroup( repositoryGroupConfiguration );
+                    repos.remove( repository.getId() );
+                    repositoryGroupConfiguration.setRepositories( repos );
+                    config.addRepositoryGroup( repositoryGroupConfiguration );
+                }
+            }
+        }
+
+        try
+        {
+            removeRepositoryRoles( repository );
+        }
+        catch ( RoleManagerException e )
+        {
+            throw new RepositoryAdminException(
+                "fail to remove repository roles for repository " + repository.getId() + " : " + e.getMessage(), e );
+        }
+
+        saveConfiguration( config );
+
+        return Boolean.TRUE;
+    }
+
+
+    public Boolean updateManagedRepository( ManagedRepository managedRepository, boolean needStageRepo,
+                                            AuditInformation auditInformation, boolean resetStats )
+        throws RepositoryAdminException
+    {
+
+        log.debug( "updateManagedConfiguration repo {} needStage {} resetStats {} ",
+                   Arrays.asList( managedRepository, needStageRepo, resetStats ).toArray() );
+
+        // Ensure that the fields are valid.
+
+        getRepositoryCommonValidator().basicValidation( managedRepository, true );
+
+        Configuration configuration = getArchivaConfiguration().getConfiguration();
+
+        ManagedRepositoryConfiguration toremove = configuration.findManagedRepositoryById( managedRepository.getId() );
+
+        if ( toremove != null )
+        {
+            configuration.removeManagedRepository( toremove );
+        }
+
+        ManagedRepositoryConfiguration stagingRepository = getStageRepoConfig( toremove );
+
+        // TODO remove content from old if path has changed !!!!!
+
+        if ( stagingRepository != null )
+        {
+            configuration.removeManagedRepository( stagingRepository );
+        }
+
+        ManagedRepositoryConfiguration managedRepositoryConfiguration =
+            addManagedRepository( managedRepository.getId(), managedRepository.getLayout(), managedRepository.getName(),
+                                  managedRepository.getLocation(), managedRepository.isBlockRedeployments(),
+                                  managedRepository.isReleases(), managedRepository.isSnapshots(), needStageRepo,
+                                  managedRepository.getCronExpression(), managedRepository.getIndexDirectory(),
+                                  managedRepository.getDaysOlder(), managedRepository.getRetentionCount(),
+                                  managedRepository.isDeleteReleasedSnapshots(), auditInformation,
+                                  getArchivaConfiguration().getConfiguration() );
+
+        // Save the repository configuration.
+        RepositorySession repositorySession = getRepositorySessionFactory().createSession();
+
+        try
+        {
+            triggerAuditEvent( managedRepositoryConfiguration.getId(), null, AuditEvent.MODIFY_MANAGED_REPO,
+                               auditInformation );
+
+            saveConfiguration( this.getArchivaConfiguration().getConfiguration() );
+            if ( resetStats )
+            {
+                log.debug( "call repositoryStatisticsManager.deleteStatistics" );
+                getRepositoryStatisticsManager().deleteStatistics( repositorySession.getRepository(),
+                                                                   managedRepositoryConfiguration.getId() );
+                repositorySession.save();
+            }
+
+        }
+        catch ( MetadataRepositoryException e )
+        {
+            throw new RepositoryAdminException( e.getMessage(), e );
+        }
+        finally
+        {
+            repositorySession.close();
+        }
+
+        return true;
+    }
+
+    //--------------------------
+    // utils methods
+    //--------------------------
+
+
+    protected void addRepository( ManagedRepositoryConfiguration repository, Configuration configuration )
+        throws RepositoryAdminException, IOException
+    {
+        // Normalize the path
+        File file = new File( repository.getLocation() );
+        repository.setLocation( file.getCanonicalPath() );
+        if ( !file.exists() )
+        {
+            file.mkdirs();
+        }
+        if ( !file.exists() || !file.isDirectory() )
+        {
+            throw new RepositoryAdminException(
+                "Unable to add repository - no write access, can not create the root directory: " + file );
+        }
+
+        configuration.addManagedRepository( repository );
+    }
+
+    private ManagedRepositoryConfiguration getStageRepoConfig( ManagedRepositoryConfiguration repository )
+    {
+        ManagedRepositoryConfiguration stagingRepository = new ManagedRepositoryConfiguration();
+        stagingRepository.setId( repository.getId() + STAGE_REPO_ID_END );
+        stagingRepository.setLayout( repository.getLayout() );
+        stagingRepository.setName( repository.getName() + STAGE_REPO_ID_END );
+        stagingRepository.setBlockRedeployments( repository.isBlockRedeployments() );
+        stagingRepository.setDaysOlder( repository.getDaysOlder() );
+        stagingRepository.setDeleteReleasedSnapshots( repository.isDeleteReleasedSnapshots() );
+        stagingRepository.setIndexDir( repository.getIndexDir() );
+        String path = repository.getLocation();
+        int lastIndex = path.lastIndexOf( '/' );
+        stagingRepository.setLocation( path.substring( 0, lastIndex ) + "/" + stagingRepository.getId() );
+        stagingRepository.setRefreshCronExpression( repository.getRefreshCronExpression() );
+        stagingRepository.setReleases( repository.isReleases() );
+        stagingRepository.setRetentionCount( repository.getRetentionCount() );
+        stagingRepository.setScanned( repository.isScanned() );
+        stagingRepository.setSnapshots( repository.isSnapshots() );
+        return stagingRepository;
+    }
+
+    public Boolean scanRepository( String repositoryId, boolean fullScan )
+    {
+        if ( getRepositoryTaskScheduler().isProcessingRepositoryTask( repositoryId ) )
+        {
+            log.info( "scanning of repository with id {} already scheduled", repositoryId );
+        }
+        RepositoryTask task = new RepositoryTask();
+        task.setRepositoryId( repositoryId );
+        task.setScanAll( fullScan );
+        try
+        {
+            getRepositoryTaskScheduler().queueTask( task );
+        }
+        catch ( TaskQueueException e )
+        {
+            log.error( "failed to schedule scanning of repo with id {}", repositoryId, e );
+            return false;
+        }
+        return true;
+    }
+
+    protected void addRepositoryRoles( ManagedRepositoryConfiguration newRepository )
+        throws RoleManagerException
+    {
+        String repoId = newRepository.getId();
+
+        // TODO: double check these are configured on start up
+        // TODO: belongs in the business logic
+
+        if ( !getRoleManager().templatedRoleExists( ArchivaRoleConstants.TEMPLATE_REPOSITORY_OBSERVER, repoId ) )
+        {
+            getRoleManager().createTemplatedRole( ArchivaRoleConstants.TEMPLATE_REPOSITORY_OBSERVER, repoId );
+        }
+
+        if ( !getRoleManager().templatedRoleExists( ArchivaRoleConstants.TEMPLATE_REPOSITORY_MANAGER, repoId ) )
+        {
+            getRoleManager().createTemplatedRole( ArchivaRoleConstants.TEMPLATE_REPOSITORY_MANAGER, repoId );
+        }
+    }
+
+    protected void removeRepositoryRoles( ManagedRepositoryConfiguration existingRepository )
+        throws RoleManagerException
+    {
+        String repoId = existingRepository.getId();
+
+        if ( getRoleManager().templatedRoleExists( ArchivaRoleConstants.TEMPLATE_REPOSITORY_MANAGER, repoId ) )
+        {
+            getRoleManager().removeTemplatedRole( ArchivaRoleConstants.TEMPLATE_REPOSITORY_MANAGER, repoId );
+        }
+
+        if ( getRoleManager().templatedRoleExists( ArchivaRoleConstants.TEMPLATE_REPOSITORY_OBSERVER, repoId ) )
+        {
+            getRoleManager().removeTemplatedRole( ArchivaRoleConstants.TEMPLATE_REPOSITORY_OBSERVER, repoId );
+        }
+
+        log.debug( "removed user roles associated with repository {}", repoId );
+    }
+
+    //--------------------------
+    // setters/getters
+    //--------------------------
+
+
+    public RoleManager getRoleManager()
+    {
+        return roleManager;
+    }
+
+    public void setRoleManager( RoleManager roleManager )
+    {
+        this.roleManager = roleManager;
+    }
+
+    public RepositoryStatisticsManager getRepositoryStatisticsManager()
+    {
+        return repositoryStatisticsManager;
+    }
+
+    public void setRepositoryStatisticsManager( RepositoryStatisticsManager repositoryStatisticsManager )
+    {
+        this.repositoryStatisticsManager = repositoryStatisticsManager;
+    }
+
+    public RepositorySessionFactory getRepositorySessionFactory()
+    {
+        return repositorySessionFactory;
+    }
+
+    public void setRepositorySessionFactory( RepositorySessionFactory repositorySessionFactory )
+    {
+        this.repositorySessionFactory = repositorySessionFactory;
+    }
+
+
+    public RepositoryArchivaTaskScheduler getRepositoryTaskScheduler()
+    {
+        return repositoryTaskScheduler;
+    }
+
+    public void setRepositoryTaskScheduler( RepositoryArchivaTaskScheduler repositoryTaskScheduler )
+    {
+        this.repositoryTaskScheduler = repositoryTaskScheduler;
+    }
+}
diff --git a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/networkproxy/DefaultNetworkProxyAdmin.java b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/networkproxy/DefaultNetworkProxyAdmin.java
new file mode 100644 (file)
index 0000000..1455354
--- /dev/null
@@ -0,0 +1,145 @@
+package org.apache.archiva.admin.repository.networkproxy;
+/*
+ * 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 net.sf.beanlib.provider.replicator.BeanReplicator;
+import org.apache.archiva.admin.model.AuditInformation;
+import org.apache.archiva.admin.model.RepositoryAdminException;
+import org.apache.archiva.admin.model.networkproxy.NetworkProxy;
+import org.apache.archiva.admin.model.networkproxy.NetworkProxyAdmin;
+import org.apache.archiva.admin.repository.AbstractRepositoryAdmin;
+import org.apache.archiva.audit.AuditEvent;
+import org.apache.commons.lang.StringUtils;
+import org.apache.maven.archiva.configuration.Configuration;
+import org.apache.maven.archiva.configuration.NetworkProxyConfiguration;
+import org.springframework.stereotype.Service;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author Olivier Lamy
+ * @since 1.4
+ */
+@Service( "networkProxyAdmin#default" )
+public class DefaultNetworkProxyAdmin
+    extends AbstractRepositoryAdmin
+    implements NetworkProxyAdmin
+{
+
+    public List<NetworkProxy> getNetworkProxies()
+        throws RepositoryAdminException
+    {
+        List<NetworkProxy> networkProxies = new ArrayList<NetworkProxy>();
+        for ( NetworkProxyConfiguration networkProxyConfiguration : getArchivaConfiguration().getConfiguration().getNetworkProxies() )
+        {
+            networkProxies.add( getNetworkProxy( networkProxyConfiguration ) );
+        }
+        return networkProxies;
+    }
+
+    public NetworkProxy getNetworkProxy( String networkProxyId )
+        throws RepositoryAdminException
+    {
+        for ( NetworkProxy networkProxy : getNetworkProxies() )
+        {
+            if ( StringUtils.equals( networkProxyId, networkProxy.getId() ) )
+            {
+                return networkProxy;
+            }
+        }
+
+        return null;
+    }
+
+    public void addNetworkProxy( NetworkProxy networkProxy, AuditInformation auditInformation )
+        throws RepositoryAdminException
+    {
+        if ( networkProxy == null )
+        {
+            return;
+        }
+        if ( getNetworkProxy( networkProxy.getId() ) != null )
+        {
+            throw new RepositoryAdminException(
+                "cannot add NetworkProxy with id " + networkProxy.getId() + " already exist" );
+        }
+        Configuration configuration = getArchivaConfiguration().getConfiguration();
+        configuration.addNetworkProxy( getNetworkProxyConfiguration( networkProxy ) );
+
+        triggerAuditEvent( networkProxy.getId(), null, AuditEvent.ADD_NETWORK_PROXY, auditInformation );
+
+        saveConfiguration( configuration );
+    }
+
+    public void updateNetworkProxy( NetworkProxy networkProxy, AuditInformation auditInformation )
+        throws RepositoryAdminException
+    {
+        if ( networkProxy == null )
+        {
+            return;
+        }
+        if ( getNetworkProxy( networkProxy.getId() ) == null )
+        {
+            throw new RepositoryAdminException(
+                "cannot update NetworkProxy with id " + networkProxy.getId() + " as not exist" );
+        }
+        Configuration configuration = getArchivaConfiguration().getConfiguration();
+        NetworkProxyConfiguration networkProxyConfiguration = getNetworkProxyConfiguration( networkProxy );
+        configuration.removeNetworkProxy( networkProxyConfiguration );
+        configuration.addNetworkProxy( networkProxyConfiguration );
+
+        triggerAuditEvent( networkProxy.getId(), null, AuditEvent.MODIFY_NETWORK_PROXY, auditInformation );
+
+        saveConfiguration( configuration );
+    }
+
+    public void deleteNetworkProxy( String networkProxyId, AuditInformation auditInformation )
+        throws RepositoryAdminException
+    {
+
+        NetworkProxy networkProxy = getNetworkProxy( networkProxyId );
+        if ( networkProxy == null )
+        {
+            throw new RepositoryAdminException(
+                "cannot delete NetworkProxy with id " + networkProxyId + " as not exist" );
+        }
+        Configuration configuration = getArchivaConfiguration().getConfiguration();
+        NetworkProxyConfiguration networkProxyConfiguration = getNetworkProxyConfiguration( networkProxy );
+        configuration.removeNetworkProxy( networkProxyConfiguration );
+
+        triggerAuditEvent( networkProxy.getId(), null, AuditEvent.DELETE_NETWORK_PROXY, auditInformation );
+
+        saveConfiguration( configuration );
+    }
+
+    protected NetworkProxy getNetworkProxy( NetworkProxyConfiguration networkProxyConfiguration )
+    {
+        return networkProxyConfiguration == null
+            ? null
+            : new BeanReplicator().replicateBean( networkProxyConfiguration, NetworkProxy.class );
+    }
+
+    protected NetworkProxyConfiguration getNetworkProxyConfiguration( NetworkProxy networkProxy )
+    {
+        return networkProxy == null
+            ? null
+            : new BeanReplicator().replicateBean( networkProxy, NetworkProxyConfiguration.class );
+    }
+}
diff --git a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/proxyconnector/DefaultProxyConnectorAdmin.java b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/proxyconnector/DefaultProxyConnectorAdmin.java
new file mode 100644 (file)
index 0000000..fc3580e
--- /dev/null
@@ -0,0 +1,254 @@
+package org.apache.archiva.admin.repository.proxyconnector;
+/*
+ * 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 net.sf.beanlib.provider.replicator.BeanReplicator;
+import org.apache.archiva.admin.model.AuditInformation;
+import org.apache.archiva.admin.model.RepositoryAdminException;
+import org.apache.archiva.admin.model.managed.ManagedRepositoryAdmin;
+import org.apache.archiva.admin.model.proxyconnector.ProxyConnector;
+import org.apache.archiva.admin.model.proxyconnector.ProxyConnectorAdmin;
+import org.apache.archiva.admin.model.proxyconnector.ProxyConnectorOrderComparator;
+import org.apache.archiva.admin.model.remote.RemoteRepositoryAdmin;
+import org.apache.archiva.admin.repository.AbstractRepositoryAdmin;
+import org.apache.archiva.audit.AuditEvent;
+import org.apache.commons.collections.CollectionUtils;
+import org.apache.commons.lang.StringUtils;
+import org.apache.maven.archiva.configuration.Configuration;
+import org.apache.maven.archiva.configuration.ProxyConnectorConfiguration;
+import org.apache.maven.archiva.configuration.functors.ProxyConnectorSelectionPredicate;
+import org.springframework.stereotype.Service;
+
+import javax.inject.Inject;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author Olivier Lamy
+ * @since 1.4
+ */
+@Service( "proxyConnectorAdmin#default" )
+public class DefaultProxyConnectorAdmin
+    extends AbstractRepositoryAdmin
+    implements ProxyConnectorAdmin
+{
+
+    @Inject
+    private ManagedRepositoryAdmin managedRepositoryAdmin;
+
+    @Inject
+    private RemoteRepositoryAdmin remoteRepositoryAdmin;
+
+    public List<ProxyConnector> getProxyConnectors()
+        throws RepositoryAdminException
+    {
+        List<ProxyConnectorConfiguration> proxyConnectorConfigurations =
+            getArchivaConfiguration().getConfiguration().getProxyConnectors();
+        List<ProxyConnector> proxyConnectors = new ArrayList<ProxyConnector>( proxyConnectorConfigurations.size() );
+        for ( ProxyConnectorConfiguration configuration : proxyConnectorConfigurations )
+        {
+            proxyConnectors.add( getProxyConnector( configuration ) );
+        }
+
+        return proxyConnectors;
+    }
+
+    public ProxyConnector getProxyConnector( String sourceRepoId, String targetRepoId )
+        throws RepositoryAdminException
+    {
+        for ( ProxyConnector proxyConnector : getProxyConnectors() )
+        {
+            if ( StringUtils.equals( sourceRepoId, proxyConnector.getSourceRepoId() ) && StringUtils.equals(
+                targetRepoId, proxyConnector.getTargetRepoId() ) )
+            {
+                return proxyConnector;
+            }
+        }
+        return null;
+    }
+
+    public Boolean addProxyConnector( ProxyConnector proxyConnector, AuditInformation auditInformation )
+        throws RepositoryAdminException
+    {
+        if ( getProxyConnector( proxyConnector.getSourceRepoId(), proxyConnector.getTargetRepoId() ) != null )
+        {
+            throw new RepositoryAdminException(
+                "Unable to add proxy connector, as one already exists with source repository id ["
+                    + proxyConnector.getSourceRepoId() + "] and target repository id ["
+                    + proxyConnector.getTargetRepoId() + "]." );
+        }
+
+        validateProxyConnector( proxyConnector );
+
+        proxyConnector.setBlackListPatterns( unescapePatterns( proxyConnector.getBlackListPatterns() ) );
+        proxyConnector.setWhiteListPatterns( unescapePatterns( proxyConnector.getWhiteListPatterns() ) );
+
+        Configuration configuration = getArchivaConfiguration().getConfiguration();
+
+        ProxyConnectorConfiguration proxyConnectorConfiguration = getProxyConnectorConfiguration( proxyConnector );
+        configuration.addProxyConnector( proxyConnectorConfiguration );
+        saveConfiguration( configuration );
+        triggerAuditEvent( proxyConnector.getSourceRepoId() + "-" + proxyConnector.getTargetRepoId(), null,
+                           AuditEvent.ADD_PROXY_CONNECTOR, auditInformation );
+        return Boolean.TRUE;
+
+    }
+
+    public Boolean deleteProxyConnector( ProxyConnector proxyConnector, AuditInformation auditInformation )
+        throws RepositoryAdminException
+    {
+        Configuration configuration = getArchivaConfiguration().getConfiguration();
+        ProxyConnectorConfiguration proxyConnectorConfiguration =
+            findProxyConnector( proxyConnector.getSourceRepoId(), proxyConnector.getTargetRepoId(), configuration );
+        if ( proxyConnectorConfiguration == null )
+        {
+            throw new RepositoryAdminException(
+                "unable to find ProxyConnector with source " + proxyConnector.getSourceRepoId() + " and target "
+                    + proxyConnector.getTargetRepoId() );
+        }
+        configuration.removeProxyConnector( proxyConnectorConfiguration );
+        saveConfiguration( configuration );
+        triggerAuditEvent( proxyConnector.getSourceRepoId() + "-" + proxyConnector.getTargetRepoId(), null,
+                           AuditEvent.DELETE_PROXY_CONNECTOR, auditInformation );
+        return Boolean.TRUE;
+    }
+
+    public Boolean updateProxyConnector( ProxyConnector proxyConnector, AuditInformation auditInformation )
+        throws RepositoryAdminException
+    {
+        Configuration configuration = getArchivaConfiguration().getConfiguration();
+        ProxyConnectorConfiguration proxyConnectorConfiguration =
+            findProxyConnector( proxyConnector.getSourceRepoId(), proxyConnector.getTargetRepoId(), configuration );
+        configuration.removeProxyConnector( proxyConnectorConfiguration );
+        configuration.addProxyConnector( getProxyConnectorConfiguration( proxyConnector ) );
+        triggerAuditEvent( proxyConnector.getSourceRepoId() + "-" + proxyConnector.getTargetRepoId(), null,
+                           AuditEvent.MODIFY_PROXY_CONNECTOR, auditInformation );
+        return Boolean.TRUE;
+    }
+
+    protected List<String> unescapePatterns( List<String> patterns )
+    {
+        List<String> rawPatterns = new ArrayList<String>();
+        if ( patterns != null )
+        {
+            for ( String pattern : patterns )
+            {
+                rawPatterns.add( StringUtils.replace( pattern, "\\\\", "\\" ) );
+            }
+        }
+
+        return rawPatterns;
+    }
+
+    public Map<String, List<ProxyConnector>> getProxyConnectorAsMap()
+        throws RepositoryAdminException
+    {
+        Map<String, List<ProxyConnector>> proxyConnectorMap = new HashMap<String, java.util.List<ProxyConnector>>();
+
+        Iterator<ProxyConnector> it = getProxyConnectors().iterator();
+        while ( it.hasNext() )
+        {
+            ProxyConnector proxyConfig = it.next();
+            String key = proxyConfig.getSourceRepoId();
+
+            List<ProxyConnector> connectors = proxyConnectorMap.get( key );
+            if ( connectors == null )
+            {
+                connectors = new ArrayList<ProxyConnector>();
+                proxyConnectorMap.put( key, connectors );
+            }
+
+            connectors.add( proxyConfig );
+
+            Collections.sort( connectors, ProxyConnectorOrderComparator.getInstance() );
+        }
+
+        return proxyConnectorMap;
+    }
+
+    private ProxyConnectorConfiguration findProxyConnector( String sourceId, String targetId,
+                                                            Configuration configuration )
+    {
+        if ( StringUtils.isBlank( sourceId ) )
+        {
+            return null;
+        }
+
+        if ( StringUtils.isBlank( targetId ) )
+        {
+            return null;
+        }
+
+        ProxyConnectorSelectionPredicate selectedProxy = new ProxyConnectorSelectionPredicate( sourceId, targetId );
+        return (ProxyConnectorConfiguration) CollectionUtils.find( configuration.getProxyConnectors(), selectedProxy );
+    }
+
+    protected ProxyConnectorConfiguration getProxyConnectorConfiguration( ProxyConnector proxyConnector )
+    {
+        /*
+        ProxyConnectorConfiguration proxyConnectorConfiguration = new ProxyConnectorConfiguration();
+        proxyConnectorConfiguration.setOrder( proxyConnector.getOrder() );
+        proxyConnectorConfiguration.setBlackListPatterns(
+            new ArrayList<String>( proxyConnector.getBlackListPatterns() ) );
+        proxyConnectorConfiguration.setWhiteListPatterns(
+            new ArrayList<String>( proxyConnector.getWhiteListPatterns() ) );
+        proxyConnectorConfiguration.setDisabled( proxyConnector.isDisabled() );
+        proxyConnectorConfiguration.setPolicies( new HashMap( proxyConnector.getPolicies() ) );
+        proxyConnectorConfiguration.setProperties( new HashMap( proxyConnector.getProperties() ) );
+        proxyConnectorConfiguration.setProxyId( proxyConnector.getProxyId() );
+        proxyConnectorConfiguration.setSourceRepoId( proxyConnector.getSourceRepoId() );
+        proxyConnectorConfiguration.setTargetRepoId( proxyConnector.getTargetRepoId() );
+        return proxyConnectorConfiguration;*/
+
+        return proxyConnector == null
+            ? null
+            : new BeanReplicator().replicateBean( proxyConnector, ProxyConnectorConfiguration.class );
+    }
+
+    protected ProxyConnector getProxyConnector( ProxyConnectorConfiguration proxyConnectorConfiguration )
+    {
+        return proxyConnectorConfiguration == null
+            ? null
+            : new BeanReplicator().replicateBean( proxyConnectorConfiguration, ProxyConnector.class );
+    }
+
+    protected void validateProxyConnector( ProxyConnector proxyConnector )
+        throws RepositoryAdminException
+    {
+        // validate source a Managed target a Remote
+        if ( managedRepositoryAdmin.getManagedRepository( proxyConnector.getSourceRepoId() ) == null )
+        {
+            throw new RepositoryAdminException(
+                "non valid ProxyConnector sourceRepo with id " + proxyConnector.getSourceRepoId()
+                    + " is not a ManagedRepository" );
+        }
+        if ( remoteRepositoryAdmin.getRemoteRepository( proxyConnector.getTargetRepoId() ) == null )
+        {
+            throw new RepositoryAdminException(
+                "non valid ProxyConnector sourceRepo with id " + proxyConnector.getTargetRepoId()
+                    + " is not a RemoteRepository" );
+        }
+
+        // FIXME validate NetworkProxyConfiguration too when available
+    }
+}
diff --git a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/remote/DefaultRemoteRepositoryAdmin.java b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/remote/DefaultRemoteRepositoryAdmin.java
new file mode 100644 (file)
index 0000000..b2c48e1
--- /dev/null
@@ -0,0 +1,192 @@
+package org.apache.archiva.admin.repository.remote;
+/*
+ * 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.admin.model.AuditInformation;
+import org.apache.archiva.admin.model.RepositoryAdminException;
+import org.apache.archiva.admin.model.remote.RemoteRepository;
+import org.apache.archiva.admin.model.remote.RemoteRepositoryAdmin;
+import org.apache.archiva.admin.repository.AbstractRepositoryAdmin;
+import org.apache.archiva.audit.AuditEvent;
+import org.apache.commons.lang.StringUtils;
+import org.apache.maven.archiva.configuration.Configuration;
+import org.apache.maven.archiva.configuration.ProxyConnectorConfiguration;
+import org.apache.maven.archiva.configuration.RemoteRepositoryConfiguration;
+import org.springframework.stereotype.Service;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author Olivier Lamy
+ * @since 1.4
+ */
+@Service( "remoteRepositoryAdmin#default" )
+public class DefaultRemoteRepositoryAdmin
+    extends AbstractRepositoryAdmin
+    implements RemoteRepositoryAdmin
+{
+
+
+    public List<RemoteRepository> getRemoteRepositories()
+        throws RepositoryAdminException
+    {
+        List<RemoteRepository> remoteRepositories = new ArrayList<RemoteRepository>();
+        for ( RemoteRepositoryConfiguration repositoryConfiguration : getArchivaConfiguration().getConfiguration().getRemoteRepositories() )
+        {
+            remoteRepositories.add(
+                new RemoteRepository( repositoryConfiguration.getId(), repositoryConfiguration.getName(),
+                                      repositoryConfiguration.getUrl(), repositoryConfiguration.getLayout(),
+                                      repositoryConfiguration.getUsername(), repositoryConfiguration.getPassword(),
+                                      repositoryConfiguration.getTimeout() ) );
+        }
+        return remoteRepositories;
+    }
+
+    public RemoteRepository getRemoteRepository( String repositoryId )
+        throws RepositoryAdminException
+    {
+        for ( RemoteRepository remoteRepository : getRemoteRepositories() )
+        {
+            if ( StringUtils.equals( repositoryId, remoteRepository.getId() ) )
+            {
+                return remoteRepository;
+            }
+        }
+        return null;
+    }
+
+    public Boolean addRemoteRepository( RemoteRepository remoteRepository, AuditInformation auditInformation )
+        throws RepositoryAdminException
+    {
+        triggerAuditEvent( remoteRepository.getId(), null, AuditEvent.ADD_REMOTE_REPO, auditInformation );
+        getRepositoryCommonValidator().basicValidation( remoteRepository, false );
+
+        //TODO we can validate it's a good uri/url
+        if ( StringUtils.isEmpty( remoteRepository.getUrl() ) )
+        {
+            throw new RepositoryAdminException( "url cannot be null" );
+        }
+
+        //MRM-752 - url needs trimming
+        remoteRepository.setUrl( StringUtils.trim( remoteRepository.getUrl() ) );
+
+        RemoteRepositoryConfiguration remoteRepositoryConfiguration =
+            getRemoteRepositoryConfiguration( remoteRepository );
+
+        Configuration configuration = getArchivaConfiguration().getConfiguration();
+        configuration.addRemoteRepository( remoteRepositoryConfiguration );
+        saveConfiguration( configuration );
+
+        return Boolean.TRUE;
+    }
+
+    public Boolean deleteRemoteRepository( String repositoryId, AuditInformation auditInformation )
+        throws RepositoryAdminException
+    {
+
+        triggerAuditEvent( repositoryId, null, AuditEvent.DELETE_REMOTE_REPO, auditInformation );
+
+        Configuration configuration = getArchivaConfiguration().getConfiguration();
+
+        RemoteRepositoryConfiguration remoteRepositoryConfiguration =
+            configuration.getRemoteRepositoriesAsMap().get( repositoryId );
+        if ( remoteRepositoryConfiguration == null )
+        {
+            throw new RepositoryAdminException(
+                "remoteRepository with id " + repositoryId + " not exist cannot remove it" );
+        }
+
+        configuration.removeRemoteRepository( remoteRepositoryConfiguration );
+
+        // TODO use ProxyConnectorAdmin interface ?
+        // [MRM-520] Proxy Connectors are not deleted with the deletion of a Repository.
+        List<ProxyConnectorConfiguration> proxyConnectors =
+            new ArrayList<ProxyConnectorConfiguration>( configuration.getProxyConnectors() );
+        for ( ProxyConnectorConfiguration proxyConnector : proxyConnectors )
+        {
+            if ( StringUtils.equals( proxyConnector.getTargetRepoId(), repositoryId ) )
+            {
+                configuration.removeProxyConnector( proxyConnector );
+            }
+        }
+
+        saveConfiguration( configuration );
+
+        return Boolean.TRUE;
+    }
+
+    public Boolean updateRemoteRepository( RemoteRepository remoteRepository, AuditInformation auditInformation )
+        throws RepositoryAdminException
+    {
+
+        String repositoryId = remoteRepository.getId();
+
+        triggerAuditEvent( repositoryId, null, AuditEvent.MODIFY_REMOTE_REPO, auditInformation );
+
+        // update means : remove and add
+
+        Configuration configuration = getArchivaConfiguration().getConfiguration();
+
+        RemoteRepositoryConfiguration remoteRepositoryConfiguration =
+            configuration.getRemoteRepositoriesAsMap().get( repositoryId );
+        if ( remoteRepositoryConfiguration == null )
+        {
+            throw new RepositoryAdminException(
+                "remoteRepository with id " + repositoryId + " not exist cannot remove it" );
+        }
+
+        configuration.removeRemoteRepository( remoteRepositoryConfiguration );
+
+        remoteRepositoryConfiguration = getRemoteRepositoryConfiguration( remoteRepository );
+        configuration.addRemoteRepository( remoteRepositoryConfiguration );
+        saveConfiguration( configuration );
+
+        return Boolean.TRUE;
+    }
+
+    public Map<String, RemoteRepository> getRemoteRepositoriesAsMap()
+        throws RepositoryAdminException
+    {
+        java.util.Map<String, RemoteRepository> map = new HashMap<String, RemoteRepository>();
+
+        for ( RemoteRepository repo : getRemoteRepositories() )
+        {
+            map.put( repo.getId(), repo );
+        }
+
+        return map;
+    }
+
+    private RemoteRepositoryConfiguration getRemoteRepositoryConfiguration( RemoteRepository remoteRepository )
+    {
+        RemoteRepositoryConfiguration remoteRepositoryConfiguration = new RemoteRepositoryConfiguration();
+        remoteRepositoryConfiguration.setId( remoteRepository.getId() );
+        remoteRepositoryConfiguration.setPassword( remoteRepository.getPassword() );
+        remoteRepositoryConfiguration.setTimeout( remoteRepository.getTimeout() );
+        remoteRepositoryConfiguration.setUrl( remoteRepository.getUrl() );
+        remoteRepositoryConfiguration.setUsername( remoteRepository.getUserName() );
+        remoteRepositoryConfiguration.setLayout( remoteRepository.getLayout() );
+        remoteRepositoryConfiguration.setName( remoteRepository.getName() );
+        return remoteRepositoryConfiguration;
+    }
+
+}
diff --git a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/utils/RepositoryComparator.java b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/utils/RepositoryComparator.java
new file mode 100644 (file)
index 0000000..c65c230
--- /dev/null
@@ -0,0 +1,51 @@
+package org.apache.archiva.admin.repository.utils;
+/*
+ * 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.admin.model.AbstractRepository;
+
+import java.util.Comparator;
+
+/**
+ * @author Olivier Lamy
+ * @since 1.4
+ */
+public class RepositoryComparator
+    implements Comparator<AbstractRepository>
+{
+    public int compare( AbstractRepository o1, AbstractRepository o2 )
+    {
+        if ( o1 == null && o2 == null )
+        {
+            return 0;
+        }
+
+        if ( o1 == null )
+        {
+            return -1;
+        }
+
+        if ( o2 == null )
+        {
+            return 1;
+        }
+
+        return o1.getId().compareToIgnoreCase( o2.getId() );
+    }
+}
diff --git a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/resources/META-INF/spring-context.xml b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/resources/META-INF/spring-context.xml
new file mode 100644 (file)
index 0000000..3a98666
--- /dev/null
@@ -0,0 +1,36 @@
+<?xml version="1.0"?>
+
+<!--
+  ~ 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.
+  -->
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xmlns:context="http://www.springframework.org/schema/context"
+       xsi:schemaLocation="http://www.springframework.org/schema/beans
+           http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
+           http://www.springframework.org/schema/context 
+           http://www.springframework.org/schema/context/spring-context-3.0.xsd" default-lazy-init="true">
+
+
+  <context:annotation-config />
+  <context:component-scan
+    base-package="org.apache.archiva.admin.repository"/>
+
+
+
+</beans>
\ No newline at end of file
diff --git a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/test/java/org/apache/archiva/admin/mock/MockAuditListener.java b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/test/java/org/apache/archiva/admin/mock/MockAuditListener.java
new file mode 100644 (file)
index 0000000..42387a6
--- /dev/null
@@ -0,0 +1,52 @@
+package org.apache.archiva.admin.mock;
+/*
+ * 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.audit.AuditEvent;
+import org.apache.archiva.audit.AuditListener;
+import org.springframework.stereotype.Service;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author Olivier Lamy
+ */
+@Service( "auditListener#mock" )
+public class MockAuditListener
+    implements AuditListener
+{
+
+    private List<AuditEvent> auditEvents = new ArrayList<AuditEvent>();
+
+    public void auditEvent( AuditEvent event )
+    {
+        auditEvents.add( event );
+    }
+
+    public List<AuditEvent> getAuditEvents()
+    {
+        return auditEvents;
+    }
+
+    public void clearEvents()
+    {
+        auditEvents.clear();
+    }
+}
diff --git a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/test/java/org/apache/archiva/admin/repository/AbstractRepositoryAdminTest.java b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/test/java/org/apache/archiva/admin/repository/AbstractRepositoryAdminTest.java
new file mode 100644 (file)
index 0000000..2547837
--- /dev/null
@@ -0,0 +1,140 @@
+package org.apache.archiva.admin.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.
+ */
+
+import junit.framework.TestCase;
+import org.apache.archiva.admin.mock.MockAuditListener;
+import org.apache.archiva.admin.model.AuditInformation;
+import org.apache.archiva.admin.model.managed.ManagedRepository;
+import org.apache.archiva.admin.model.managed.ManagedRepositoryAdmin;
+import org.apache.archiva.admin.model.proxyconnector.ProxyConnectorAdmin;
+import org.apache.archiva.admin.model.remote.RemoteRepository;
+import org.apache.archiva.admin.model.remote.RemoteRepositoryAdmin;
+import org.apache.commons.io.FileUtils;
+import org.apache.commons.lang.StringUtils;
+import org.codehaus.plexus.redback.role.RoleManager;
+import org.codehaus.plexus.redback.users.User;
+import org.codehaus.plexus.redback.users.memory.SimpleUser;
+import org.junit.runner.RunWith;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+
+import javax.inject.Inject;
+import java.io.File;
+import java.util.List;
+
+/**
+ * @author Olivier Lamy
+ */
+@RunWith( SpringJUnit4ClassRunner.class )
+@ContextConfiguration( locations = { "classpath*:/META-INF/spring-context.xml", "classpath:/spring-context.xml" } )
+public abstract class AbstractRepositoryAdminTest
+    extends TestCase
+{
+    protected Logger log = LoggerFactory.getLogger( getClass() );
+
+    public static final String APPSERVER_BASE_PATH = System.getProperty( "appserver.base" );
+
+    @Inject
+    protected MockAuditListener mockAuditListener;
+
+    @Inject
+    protected RoleManager roleManager;
+
+    @Inject
+    protected RemoteRepositoryAdmin remoteRepositoryAdmin;
+
+    @Inject
+    protected ManagedRepositoryAdmin managedRepositoryAdmin;
+
+    @Inject
+    protected ProxyConnectorAdmin proxyConnectorAdmin;
+
+    protected AuditInformation getFakeAuditInformation()
+    {
+        AuditInformation auditInformation = new AuditInformation( getFakeUser(), "archiva-localhost" );
+        return auditInformation;
+    }
+
+    protected User getFakeUser()
+    {
+        SimpleUser user = new SimpleUser()
+        {
+            @Override
+            public Object getPrincipal()
+            {
+                return "root";
+            }
+
+        };
+
+        user.setUsername( "root" );
+        user.setFullName( "The top user" );
+        return user;
+    }
+
+    protected ManagedRepository getTestManagedRepository( String repoId, String repoLocation )
+    {
+        return new ManagedRepository( repoId, "test repo", repoLocation, "default", false, true, true, "0 0 * * * ?",
+                                      repoLocation + "/.index", false, 1, 2, true );
+    }
+
+    protected File clearRepoLocation( String path )
+        throws Exception
+    {
+        File repoDir = new File( path );
+        if ( repoDir.exists() )
+        {
+            FileUtils.deleteDirectory( repoDir );
+        }
+        assertFalse( repoDir.exists() );
+        return repoDir;
+    }
+
+    protected ManagedRepository findManagedRepoById( List<ManagedRepository> repos, String id )
+    {
+        for ( ManagedRepository repo : repos )
+        {
+            if ( StringUtils.equals( id, repo.getId() ) )
+            {
+                return repo;
+            }
+        }
+        return null;
+    }
+
+    protected RemoteRepository getRemoteRepository()
+    {
+        return getRemoteRepository( "foo" );
+    }
+
+    protected RemoteRepository getRemoteRepository(String id)
+    {
+        RemoteRepository remoteRepository = new RemoteRepository();
+        remoteRepository.setUrl( "http://foo.com/maven-it-rocks" );
+        remoteRepository.setTimeout( 10 );
+        remoteRepository.setName( "maven foo" );
+        remoteRepository.setUserName( "foo-name" );
+        remoteRepository.setPassword( "toto" );
+        remoteRepository.setId( id );
+        return remoteRepository;
+    }
+}
diff --git a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/test/java/org/apache/archiva/admin/repository/admin/ArchivaAdministrationTest.java b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/test/java/org/apache/archiva/admin/repository/admin/ArchivaAdministrationTest.java
new file mode 100644 (file)
index 0000000..2b8a1ce
--- /dev/null
@@ -0,0 +1,194 @@
+package org.apache.archiva.admin.repository.admin;
+/*
+ * 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.admin.model.RepositoryAdminException;
+import org.apache.archiva.admin.model.admin.ArchivaAdministration;
+import org.apache.archiva.admin.model.admin.FileType;
+import org.apache.archiva.admin.model.admin.LegacyArtifactPath;
+import org.apache.archiva.admin.model.admin.OrganisationInformation;
+import org.apache.archiva.admin.repository.AbstractRepositoryAdminTest;
+import org.apache.archiva.audit.AuditEvent;
+import org.junit.Test;
+
+import javax.inject.Inject;
+import java.util.Arrays;
+
+/**
+ * @author Olivier Lamy
+ */
+public class ArchivaAdministrationTest
+    extends AbstractRepositoryAdminTest
+{
+    @Inject
+    ArchivaAdministration archivaAdministration;
+
+
+    @Test
+    public void getAllLegacyPaths()
+        throws Exception
+    {
+        assertNotNull( archivaAdministration.getLegacyArtifactPaths() );
+        assertFalse( archivaAdministration.getLegacyArtifactPaths().isEmpty() );
+        assertEquals( 1, archivaAdministration.getLegacyArtifactPaths().size() );
+        log.info( "all legacy paths {}", archivaAdministration.getLegacyArtifactPaths() );
+    }
+
+    public void addAndDeleteLegacyPath()
+        throws Exception
+    {
+        int initialSize = archivaAdministration.getLegacyArtifactPaths().size();
+
+        LegacyArtifactPath legacyArtifactPath = new LegacyArtifactPath( "foo", "bar" );
+        archivaAdministration.addLegacyArtifactPath( legacyArtifactPath, getFakeAuditInformation() );
+
+        assertTrue( archivaAdministration.getLegacyArtifactPaths().contains( new LegacyArtifactPath( "foo", "bar" ) ) );
+        assertEquals( initialSize + 1, archivaAdministration.getLegacyArtifactPaths().size() );
+
+        archivaAdministration.deleteLegacyArtifactPath( legacyArtifactPath.getPath(), getFakeAuditInformation() );
+
+        assertFalse(
+            archivaAdministration.getLegacyArtifactPaths().contains( new LegacyArtifactPath( "foo", "bar" ) ) );
+        assertEquals( initialSize, archivaAdministration.getLegacyArtifactPaths().size() );
+        mockAuditListener.clearEvents();
+    }
+
+    @Test
+    public void addAndUpdateAndDeleteFileType()
+        throws RepositoryAdminException
+    {
+        int initialSize = archivaAdministration.getFileTypes().size();
+
+        FileType fileType = new FileType();
+        fileType.setId( "foo" );
+        fileType.setPatterns( Arrays.asList( "bar", "toto" ) );
+
+        archivaAdministration.addFileType( fileType, getFakeAuditInformation() );
+
+        assertEquals( initialSize + 1, archivaAdministration.getFileTypes().size() );
+
+        archivaAdministration.addFileTypePattern( "foo", "zorro", getFakeAuditInformation() );
+
+        assertEquals( initialSize + 1, archivaAdministration.getFileTypes().size() );
+
+        assertEquals( 3, archivaAdministration.getFileType( "foo" ).getPatterns().size() );
+
+        assertTrue( archivaAdministration.getFileType( "foo" ).getPatterns().contains( "bar" ) );
+        assertTrue( archivaAdministration.getFileType( "foo" ).getPatterns().contains( "toto" ) );
+        assertTrue( archivaAdministration.getFileType( "foo" ).getPatterns().contains( "zorro" ) );
+
+        archivaAdministration.removeFileTypePattern( "foo", "zorro", getFakeAuditInformation() );
+
+        assertEquals( initialSize + 1, archivaAdministration.getFileTypes().size() );
+
+        assertEquals( 2, archivaAdministration.getFileType( "foo" ).getPatterns().size() );
+
+        assertTrue( archivaAdministration.getFileType( "foo" ).getPatterns().contains( "bar" ) );
+        assertTrue( archivaAdministration.getFileType( "foo" ).getPatterns().contains( "toto" ) );
+        assertFalse( archivaAdministration.getFileType( "foo" ).getPatterns().contains( "zorro" ) );
+
+        archivaAdministration.removeFileType( "foo", getFakeAuditInformation() );
+
+        assertEquals( initialSize, archivaAdministration.getFileTypes().size() );
+        assertNull( archivaAdministration.getFileType( "foo" ) );
+        mockAuditListener.clearEvents();
+    }
+
+    @Test
+    public void knownContentConsumersTest()
+        throws Exception
+    {
+        int initialSize = archivaAdministration.getKnownContentConsumers().size();
+
+        archivaAdministration.addKnownContentConsumer( "foo", getFakeAuditInformation() );
+
+        assertEquals( initialSize + 1, archivaAdministration.getKnownContentConsumers().size() );
+        assertTrue( archivaAdministration.getKnownContentConsumers().contains( "foo" ) );
+
+        // ensure we don't add it twice as it's an ArrayList as storage
+        archivaAdministration.addKnownContentConsumer( "foo", getFakeAuditInformation() );
+
+        assertEquals( initialSize + 1, archivaAdministration.getKnownContentConsumers().size() );
+        assertTrue( archivaAdministration.getKnownContentConsumers().contains( "foo" ) );
+
+        archivaAdministration.removeKnownContentConsumer( "foo", getFakeAuditInformation() );
+
+        assertEquals( initialSize, archivaAdministration.getKnownContentConsumers().size() );
+        assertFalse( archivaAdministration.getKnownContentConsumers().contains( "foo" ) );
+
+        assertEquals( 2, mockAuditListener.getAuditEvents().size() );
+        assertEquals( AuditEvent.ENABLE_REPO_CONSUMER, mockAuditListener.getAuditEvents().get( 0 ).getAction() );
+        assertEquals( AuditEvent.DISABLE_REPO_CONSUMER, mockAuditListener.getAuditEvents().get( 1 ).getAction() );
+
+        mockAuditListener.clearEvents();
+
+    }
+
+    @Test
+    public void invalidContentConsumersTest()
+        throws Exception
+    {
+        int initialSize = archivaAdministration.getInvalidContentConsumers().size();
+
+        archivaAdministration.addInvalidContentConsumer( "foo", getFakeAuditInformation() );
+
+        assertEquals( initialSize + 1, archivaAdministration.getInvalidContentConsumers().size() );
+        assertTrue( archivaAdministration.getInvalidContentConsumers().contains( "foo" ) );
+
+        // ensure we don't add it twice as it's an ArrayList as storage
+        archivaAdministration.addInvalidContentConsumer( "foo", getFakeAuditInformation() );
+
+        assertEquals( initialSize + 1, archivaAdministration.getInvalidContentConsumers().size() );
+        assertTrue( archivaAdministration.getInvalidContentConsumers().contains( "foo" ) );
+
+        archivaAdministration.removeInvalidContentConsumer( "foo", getFakeAuditInformation() );
+
+        assertEquals( initialSize, archivaAdministration.getInvalidContentConsumers().size() );
+        assertFalse( archivaAdministration.getInvalidContentConsumers().contains( "foo" ) );
+
+        assertEquals( 2, mockAuditListener.getAuditEvents().size() );
+        assertEquals( AuditEvent.ENABLE_REPO_CONSUMER, mockAuditListener.getAuditEvents().get( 0 ).getAction() );
+        assertEquals( AuditEvent.DISABLE_REPO_CONSUMER, mockAuditListener.getAuditEvents().get( 1 ).getAction() );
+
+        mockAuditListener.clearEvents();
+
+    }
+
+
+    public void organisationInfoUpdate()
+        throws Exception
+    {
+        OrganisationInformation organisationInformation = archivaAdministration.getOrganisationInformation();
+        assertNull( organisationInformation );
+
+        organisationInformation = new OrganisationInformation();
+        organisationInformation.setLogoLocation( "http://foo.com/bar.png" );
+        organisationInformation.setName( "foo org" );
+        organisationInformation.setUrl( "http:/foo.com" );
+
+        archivaAdministration.setOrganisationInformation( organisationInformation );
+
+        organisationInformation = archivaAdministration.getOrganisationInformation();
+        assertNotNull( organisationInformation );
+        assertEquals( "http://foo.com/bar.png", organisationInformation.getLogoLocation() );
+        assertEquals( "foo org", organisationInformation.getName() );
+        assertEquals( "http://foo.com", organisationInformation.getUrl() );
+
+    }
+}
diff --git a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/test/java/org/apache/archiva/admin/repository/group/RepositoryGroupAdminTest.java b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/test/java/org/apache/archiva/admin/repository/group/RepositoryGroupAdminTest.java
new file mode 100644 (file)
index 0000000..465f21f
--- /dev/null
@@ -0,0 +1,202 @@
+package org.apache.archiva.admin.repository.group;
+/*
+ * 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.admin.model.group.RepositoryGroup;
+import org.apache.archiva.admin.model.group.RepositoryGroupAdmin;
+import org.apache.archiva.admin.model.managed.ManagedRepository;
+import org.apache.archiva.admin.repository.AbstractRepositoryAdminTest;
+import org.apache.archiva.audit.AuditEvent;
+import org.junit.Test;
+
+import javax.inject.Inject;
+import java.io.File;
+import java.util.Arrays;
+
+/**
+ * @author Olivier Lamy
+ */
+public class RepositoryGroupAdminTest
+    extends AbstractRepositoryAdminTest
+{
+    @Inject
+    RepositoryGroupAdmin repositoryGroupAdmin;
+
+    @Test
+    public void addAndDeleteGroup()
+        throws Exception
+    {
+        try
+        {
+            ManagedRepository managedRepositoryOne =
+                getTestManagedRepository( "test-new-one", APPSERVER_BASE_PATH + File.separator + "test-new-one" );
+
+            ManagedRepository managedRepositoryTwo =
+                getTestManagedRepository( "test-new-two", APPSERVER_BASE_PATH + File.separator + "test-new-two" );
+
+            managedRepositoryAdmin.addManagedRepository( managedRepositoryOne, false, getFakeAuditInformation() );
+
+            managedRepositoryAdmin.addManagedRepository( managedRepositoryTwo, false, getFakeAuditInformation() );
+
+            RepositoryGroup repositoryGroup =
+                new RepositoryGroup( "repo-group-one", Arrays.asList( "test-new-one", "test-new-two" ) );
+
+            mockAuditListener.clearEvents();
+
+            repositoryGroupAdmin.addRepositoryGroup( repositoryGroup, getFakeAuditInformation() );
+
+            assertEquals( 1, repositoryGroupAdmin.getRepositoriesGroups().size() );
+            assertEquals( "repo-group-one", repositoryGroupAdmin.getRepositoriesGroups().get( 0 ).getId() );
+            assertEquals( 2, repositoryGroupAdmin.getRepositoriesGroups().get( 0 ).getRepositories().size() );
+            assertEquals( Arrays.asList( "test-new-one", "test-new-two" ),
+                          repositoryGroupAdmin.getRepositoriesGroups().get( 0 ).getRepositories() );
+
+            repositoryGroupAdmin.deleteRepositoryGroup( "repo-group-one", getFakeAuditInformation() );
+
+            assertEquals( 0, repositoryGroupAdmin.getRepositoriesGroups().size() );
+
+            assertEquals( 2, mockAuditListener.getAuditEvents().size() );
+
+            assertEquals( AuditEvent.ADD_REPO_GROUP, mockAuditListener.getAuditEvents().get( 0 ).getAction() );
+            assertEquals( AuditEvent.DELETE_REPO_GROUP, mockAuditListener.getAuditEvents().get( 1 ).getAction() );
+        }
+        finally
+        {
+            mockAuditListener.clearEvents();
+            managedRepositoryAdmin.deleteManagedRepository( "test-new-one", getFakeAuditInformation(), true );
+            managedRepositoryAdmin.deleteManagedRepository( "test-new-two", getFakeAuditInformation(), true );
+        }
+    }
+
+    @Test
+    public void addAndUpdateAndDeleteGroup()
+        throws Exception
+    {
+        try
+        {
+            ManagedRepository managedRepositoryOne =
+                getTestManagedRepository( "test-new-one", APPSERVER_BASE_PATH + File.separator + "test-new-one" );
+
+            ManagedRepository managedRepositoryTwo =
+                getTestManagedRepository( "test-new-two", APPSERVER_BASE_PATH + File.separator + "test-new-two" );
+
+            managedRepositoryAdmin.addManagedRepository( managedRepositoryOne, false, getFakeAuditInformation() );
+
+            managedRepositoryAdmin.addManagedRepository( managedRepositoryTwo, false, getFakeAuditInformation() );
+
+            RepositoryGroup repositoryGroup = new RepositoryGroup( "repo-group-one", Arrays.asList( "test-new-one" ) );
+
+            mockAuditListener.clearEvents();
+
+            repositoryGroupAdmin.addRepositoryGroup( repositoryGroup, getFakeAuditInformation() );
+
+            assertEquals( 1, repositoryGroupAdmin.getRepositoriesGroups().size() );
+            assertEquals( "repo-group-one", repositoryGroupAdmin.getRepositoriesGroups().get( 0 ).getId() );
+            assertEquals( 1, repositoryGroupAdmin.getRepositoriesGroups().get( 0 ).getRepositories().size() );
+            assertEquals( Arrays.asList( "test-new-one" ),
+                          repositoryGroupAdmin.getRepositoriesGroups().get( 0 ).getRepositories() );
+
+            repositoryGroup = repositoryGroupAdmin.getRepositoryGroup( "repo-group-one" );
+            assertNotNull( repositoryGroup );
+
+            repositoryGroup.addRepository( managedRepositoryTwo.getId() );
+
+            repositoryGroupAdmin.updateRepositoryGroup( repositoryGroup, getFakeAuditInformation() );
+
+            assertEquals( 1, repositoryGroupAdmin.getRepositoriesGroups().size() );
+            assertEquals( "repo-group-one", repositoryGroupAdmin.getRepositoriesGroups().get( 0 ).getId() );
+            assertEquals( 2, repositoryGroupAdmin.getRepositoriesGroups().get( 0 ).getRepositories().size() );
+            assertEquals( Arrays.asList( "test-new-one", "test-new-two" ),
+                          repositoryGroupAdmin.getRepositoriesGroups().get( 0 ).getRepositories() );
+
+            repositoryGroupAdmin.deleteRepositoryGroup( "repo-group-one", getFakeAuditInformation() );
+
+            assertEquals( 0, repositoryGroupAdmin.getRepositoriesGroups().size() );
+
+            assertEquals( 3, mockAuditListener.getAuditEvents().size() );
+
+            assertEquals( AuditEvent.ADD_REPO_GROUP, mockAuditListener.getAuditEvents().get( 0 ).getAction() );
+            assertEquals( AuditEvent.MODIFY_REPO_GROUP, mockAuditListener.getAuditEvents().get( 1 ).getAction() );
+            assertEquals( AuditEvent.DELETE_REPO_GROUP, mockAuditListener.getAuditEvents().get( 2 ).getAction() );
+        }
+        finally
+        {
+            mockAuditListener.clearEvents();
+            managedRepositoryAdmin.deleteManagedRepository( "test-new-one", getFakeAuditInformation(), true );
+            managedRepositoryAdmin.deleteManagedRepository( "test-new-two", getFakeAuditInformation(), true );
+        }
+    }
+
+
+    @Test
+    public void addAndDeleteGroupWithRemowingManagedRepo()
+        throws Exception
+    {
+        try
+        {
+            ManagedRepository managedRepositoryOne =
+                getTestManagedRepository( "test-new-one", APPSERVER_BASE_PATH + File.separator + "test-new-one" );
+
+            ManagedRepository managedRepositoryTwo =
+                getTestManagedRepository( "test-new-two", APPSERVER_BASE_PATH + File.separator + "test-new-two" );
+
+            managedRepositoryAdmin.addManagedRepository( managedRepositoryOne, false, getFakeAuditInformation() );
+
+            managedRepositoryAdmin.addManagedRepository( managedRepositoryTwo, false, getFakeAuditInformation() );
+
+            RepositoryGroup repositoryGroup =
+                new RepositoryGroup( "repo-group-one", Arrays.asList( "test-new-one", "test-new-two" ) );
+
+            mockAuditListener.clearEvents();
+
+            repositoryGroupAdmin.addRepositoryGroup( repositoryGroup, getFakeAuditInformation() );
+
+            assertEquals( 1, repositoryGroupAdmin.getRepositoriesGroups().size() );
+            assertEquals( "repo-group-one", repositoryGroupAdmin.getRepositoriesGroups().get( 0 ).getId() );
+            assertEquals( 2, repositoryGroupAdmin.getRepositoriesGroups().get( 0 ).getRepositories().size() );
+            assertEquals( Arrays.asList( "test-new-one", "test-new-two" ),
+                          repositoryGroupAdmin.getRepositoriesGroups().get( 0 ).getRepositories() );
+
+            // deleting a managed repo to validate repogroup correctly updated !
+            managedRepositoryAdmin.deleteManagedRepository( "test-new-one", getFakeAuditInformation(), true );
+
+            assertEquals( 1, repositoryGroupAdmin.getRepositoriesGroups().size() );
+            assertEquals( "repo-group-one", repositoryGroupAdmin.getRepositoriesGroups().get( 0 ).getId() );
+            assertEquals( 1, repositoryGroupAdmin.getRepositoriesGroups().get( 0 ).getRepositories().size() );
+            assertEquals( Arrays.asList( "test-new-two" ),
+                          repositoryGroupAdmin.getRepositoriesGroups().get( 0 ).getRepositories() );
+
+            repositoryGroupAdmin.deleteRepositoryGroup( "repo-group-one", getFakeAuditInformation() );
+
+            assertEquals( 0, repositoryGroupAdmin.getRepositoriesGroups().size() );
+
+            assertEquals( 3, mockAuditListener.getAuditEvents().size() );
+
+            assertEquals( AuditEvent.ADD_REPO_GROUP, mockAuditListener.getAuditEvents().get( 0 ).getAction() );
+            assertEquals( AuditEvent.DELETE_MANAGED_REPO, mockAuditListener.getAuditEvents().get( 1 ).getAction() );
+            assertEquals( AuditEvent.DELETE_REPO_GROUP, mockAuditListener.getAuditEvents().get( 2 ).getAction() );
+        }
+        finally
+        {
+            mockAuditListener.clearEvents();
+
+            managedRepositoryAdmin.deleteManagedRepository( "test-new-two", getFakeAuditInformation(), true );
+        }
+    }
+}
diff --git a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/test/java/org/apache/archiva/admin/repository/managed/ManagedRepositoryAdminTest.java b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/test/java/org/apache/archiva/admin/repository/managed/ManagedRepositoryAdminTest.java
new file mode 100644 (file)
index 0000000..9cdf7f2
--- /dev/null
@@ -0,0 +1,378 @@
+package org.apache.archiva.admin.repository.managed;
+/*
+ * 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.admin.model.managed.ManagedRepository;
+import org.apache.archiva.admin.repository.AbstractRepositoryAdminTest;
+import org.apache.archiva.audit.AuditEvent;
+import org.apache.archiva.security.common.ArchivaRoleConstants;
+import org.junit.Test;
+
+import java.io.File;
+import java.util.List;
+
+/**
+ * @author Olivier Lamy
+ */
+public class ManagedRepositoryAdminTest
+    extends AbstractRepositoryAdminTest
+{
+    public static final String STAGE_REPO_ID_END = DefaultManagedRepositoryAdmin.STAGE_REPO_ID_END;
+
+    @Test
+    public void getAllManagedRepos()
+        throws Exception
+    {
+        mockAuditListener.clearEvents();
+        List<ManagedRepository> repos = managedRepositoryAdmin.getManagedRepositories();
+        assertNotNull( repos );
+        assertTrue( repos.size() > 0 );
+        log.info( "repos " + repos );
+
+        // check default internal
+        ManagedRepository internal = findManagedRepoById( repos, "internal" );
+        assertNotNull( internal );
+        assertTrue( internal.isReleases() );
+        assertFalse( internal.isSnapshots() );
+        mockAuditListener.clearEvents();
+    }
+
+    @Test
+    public void getById()
+        throws Exception
+    {
+        mockAuditListener.clearEvents();
+        ManagedRepository repo = managedRepositoryAdmin.getManagedRepository( "internal" );
+        assertNotNull( repo );
+        mockAuditListener.clearEvents();
+    }
+
+    @Test
+    public void addDeleteManagedRepo()
+        throws Exception
+    {
+        mockAuditListener.clearEvents();
+
+        String repoId = "test-new-one";
+
+        String repoLocation = APPSERVER_BASE_PATH + File.separator + repoId;
+
+        File repoDir = clearRepoLocation( repoLocation );
+
+        List<ManagedRepository> repos = managedRepositoryAdmin.getManagedRepositories();
+        assertNotNull( repos );
+        int initialSize = repos.size();
+        assertTrue( initialSize > 0 );
+
+        ManagedRepository repo = new ManagedRepository();
+        repo.setId( repoId );
+        repo.setName( "test repo" );
+        repo.setLocation( repoLocation );
+        repo.setCronExpression( "0 0 * * * ?" );
+        managedRepositoryAdmin.addManagedRepository( repo, false, getFakeAuditInformation() );
+        repos = managedRepositoryAdmin.getManagedRepositories();
+        assertNotNull( repos );
+        assertEquals( initialSize + 1, repos.size() );
+
+        assertNotNull( managedRepositoryAdmin.getManagedRepository( repoId ) );
+
+        assertTemplateRoleExists( repoId );
+
+        managedRepositoryAdmin.deleteManagedRepository( repoId, getFakeAuditInformation(), false );
+
+        // deleteContents false
+        assertTrue( repoDir.exists() );
+
+        repos = managedRepositoryAdmin.getManagedRepositories();
+        assertNotNull( repos );
+        assertEquals( initialSize, repos.size() );
+
+        assertTemplateRoleNotExists( repoId );
+
+        assertEquals( 2, mockAuditListener.getAuditEvents().size() );
+
+        assertAuditListenerCallAddAndDelete();
+
+        mockAuditListener.clearEvents();
+    }
+
+    @Test
+    public void updateDeleteManagedRepo()
+        throws Exception
+    {
+        String repoId = "test-new-one";
+
+        String repoLocation = APPSERVER_BASE_PATH + File.separator + "new-path";
+
+        File repoDir = clearRepoLocation( repoLocation );
+
+        mockAuditListener.clearEvents();
+        List<ManagedRepository> repos = managedRepositoryAdmin.getManagedRepositories();
+        assertNotNull( repos );
+        int initialSize = repos.size();
+        assertTrue( initialSize > 0 );
+
+        ManagedRepository repo = new ManagedRepository();
+        repo.setId( repoId );
+        repo.setName( "test repo" );
+        repo.setLocation( repoLocation );
+        repo.setCronExpression( "0 0 * * * ?" );
+        managedRepositoryAdmin.addManagedRepository( repo, false, getFakeAuditInformation() );
+
+        assertTemplateRoleExists( repoId );
+
+        repos = managedRepositoryAdmin.getManagedRepositories();
+        assertNotNull( repos );
+        assertEquals( initialSize + 1, repos.size() );
+
+        String newName = "test repo update";
+
+        repo.setName( newName );
+
+        repo.setLocation( repoLocation );
+        repo.setCronExpression( "0 0 * * * ?" );
+
+        managedRepositoryAdmin.updateManagedRepository( repo, false, getFakeAuditInformation(), false );
+
+        repo = managedRepositoryAdmin.getManagedRepository( repoId );
+        assertNotNull( repo );
+        assertEquals( newName, repo.getName() );
+        assertEquals( new File( repoLocation ).getCanonicalPath(), new File( repo.getLocation() ).getCanonicalPath() );
+        assertTrue( new File( repoLocation ).exists() );
+
+        assertTemplateRoleExists( repoId );
+
+        managedRepositoryAdmin.deleteManagedRepository( repo.getId(), getFakeAuditInformation(), false );
+
+        // check deleteContents false
+        assertTrue( repoDir.exists() );
+
+        assertTemplateRoleNotExists( repoId );
+
+        assertAuditListenerCallAndUpdateAddAndDelete( false );
+
+        mockAuditListener.clearEvents();
+
+    }
+
+
+    @Test
+    public void addDeleteManagedRepoWithStaged()
+        throws Exception
+    {
+
+        String repoId = "test-new-one";
+        String repoLocation = APPSERVER_BASE_PATH + File.separator + repoId;
+
+        File repoDir = clearRepoLocation( repoLocation );
+
+        mockAuditListener.clearEvents();
+        List<ManagedRepository> repos = managedRepositoryAdmin.getManagedRepositories();
+        assertNotNull( repos );
+        int initialSize = repos.size();
+        assertTrue( initialSize > 0 );
+
+        ManagedRepository repo = new ManagedRepository();
+        repo.setId( repoId );
+        repo.setName( "test repo" );
+        repo.setLocation( repoLocation );
+        repo.setCronExpression( "0 0 * * * ?" );
+        managedRepositoryAdmin.addManagedRepository( repo, true, getFakeAuditInformation() );
+        repos = managedRepositoryAdmin.getManagedRepositories();
+        assertNotNull( repos );
+        assertEquals( initialSize + 2, repos.size() );
+
+        assertNotNull( managedRepositoryAdmin.getManagedRepository( repoId ) );
+
+        assertTemplateRoleExists( repoId );
+
+        assertTrue( repoDir.exists() );
+
+        assertNotNull( managedRepositoryAdmin.getManagedRepository( repoId + STAGE_REPO_ID_END ) );
+
+        assertTemplateRoleExists( repoId + STAGE_REPO_ID_END );
+
+        assertTrue( new File( repoLocation + STAGE_REPO_ID_END ).exists() );
+
+        managedRepositoryAdmin.deleteManagedRepository( repoId, getFakeAuditInformation(), true );
+
+        assertFalse( repoDir.exists() );
+
+        assertFalse( new File( repoLocation + STAGE_REPO_ID_END ).exists() );
+
+        assertTemplateRoleNotExists( repoId + STAGE_REPO_ID_END );
+
+        repos = managedRepositoryAdmin.getManagedRepositories();
+        assertNotNull( repos );
+        assertEquals( initialSize, repos.size() );
+
+        assertTemplateRoleNotExists( repoId );
+
+        assertTemplateRoleNotExists( repoId + STAGE_REPO_ID_END );
+
+        mockAuditListener.clearEvents();
+
+    }
+
+    @Test
+    public void updateDeleteManagedRepoWithStagedRepo()
+        throws Exception
+    {
+        String repoId = "test-new-one";
+
+        String repoLocation = APPSERVER_BASE_PATH + File.separator + "new-path";
+
+        String stageRepoLocation = APPSERVER_BASE_PATH + File.separator + repoId;
+
+        File repoDir = clearRepoLocation( repoLocation );
+
+        mockAuditListener.clearEvents();
+        List<ManagedRepository> repos = managedRepositoryAdmin.getManagedRepositories();
+        assertNotNull( repos );
+        int initialSize = repos.size();
+        assertTrue( initialSize > 0 );
+
+        ManagedRepository repo = getTestManagedRepository( repoId, repoLocation );
+
+        managedRepositoryAdmin.addManagedRepository( repo, false, getFakeAuditInformation() );
+
+        assertTemplateRoleExists( repoId );
+
+        assertFalse( new File( repoLocation + STAGE_REPO_ID_END ).exists() );
+
+        assertTemplateRoleNotExists( repoId + STAGE_REPO_ID_END );
+
+        repos = managedRepositoryAdmin.getManagedRepositories();
+        assertNotNull( repos );
+        assertEquals( initialSize + 1, repos.size() );
+
+        repo = managedRepositoryAdmin.getManagedRepository( repoId );
+
+        assertEquals( getTestManagedRepository( repoId, repoLocation ).getIndexDirectory(), repo.getIndexDirectory() );
+
+        String newName = "test repo update";
+
+        repo.setName( newName );
+
+        repo.setLocation( repoLocation );
+
+        managedRepositoryAdmin.updateManagedRepository( repo, true, getFakeAuditInformation(), false );
+
+        repo = managedRepositoryAdmin.getManagedRepository( repoId );
+        assertNotNull( repo );
+        assertEquals( newName, repo.getName() );
+        assertEquals( new File( repoLocation ).getCanonicalPath(), new File( repo.getLocation() ).getCanonicalPath() );
+        assertTrue( new File( repoLocation ).exists() );
+        assertEquals( getTestManagedRepository( repoId, repoLocation ).getCronExpression(), repo.getCronExpression() );
+        assertEquals( getTestManagedRepository( repoId, repoLocation ).getLayout(), repo.getLayout() );
+        assertEquals( getTestManagedRepository( repoId, repoLocation ).getId(), repo.getId() );
+        assertEquals( getTestManagedRepository( repoId, repoLocation ).getIndexDirectory(), repo.getIndexDirectory() );
+
+        assertEquals( getTestManagedRepository( repoId, repoLocation ).getDaysOlder(), repo.getDaysOlder() );
+        assertEquals( getTestManagedRepository( repoId, repoLocation ).getRetentionCount(), repo.getRetentionCount() );
+        assertEquals( getTestManagedRepository( repoId, repoLocation ).isDeleteReleasedSnapshots(),
+                      repo.isDeleteReleasedSnapshots() );
+
+        assertTemplateRoleExists( repoId );
+
+        assertTrue( new File( stageRepoLocation + STAGE_REPO_ID_END ).exists() );
+
+        assertTemplateRoleExists( repoId + STAGE_REPO_ID_END );
+
+        managedRepositoryAdmin.deleteManagedRepository( repo.getId(), getFakeAuditInformation(), false );
+
+        // check deleteContents false
+        assertTrue( repoDir.exists() );
+
+        assertTemplateRoleNotExists( repoId );
+
+        assertTrue( new File( stageRepoLocation + STAGE_REPO_ID_END ).exists() );
+
+        assertTemplateRoleNotExists( repoId + STAGE_REPO_ID_END );
+
+        assertAuditListenerCallAndUpdateAddAndDelete( true );
+
+        mockAuditListener.clearEvents();
+
+    }
+
+    //----------------------------------
+    // utility methods
+    //----------------------------------
+
+    private void assertTemplateRoleExists( String repoId )
+        throws Exception
+    {
+        assertTrue( roleManager.templatedRoleExists( ArchivaRoleConstants.TEMPLATE_REPOSITORY_OBSERVER, repoId ) );
+        assertTrue( roleManager.templatedRoleExists( ArchivaRoleConstants.TEMPLATE_REPOSITORY_MANAGER, repoId ) );
+    }
+
+
+    private void assertTemplateRoleNotExists( String repoId )
+        throws Exception
+    {
+        assertFalse( roleManager.templatedRoleExists( ArchivaRoleConstants.TEMPLATE_REPOSITORY_OBSERVER, repoId ) );
+        assertFalse( roleManager.templatedRoleExists( ArchivaRoleConstants.TEMPLATE_REPOSITORY_MANAGER, repoId ) );
+    }
+
+    private void assertAuditListenerCallAddAndDelete()
+    {
+        assertEquals( 2, mockAuditListener.getAuditEvents().size() );
+
+        assertEquals( AuditEvent.ADD_MANAGED_REPO, mockAuditListener.getAuditEvents().get( 0 ).getAction() );
+        assertEquals( "root", mockAuditListener.getAuditEvents().get( 0 ).getUserId() );
+        assertEquals( "archiva-localhost", mockAuditListener.getAuditEvents().get( 0 ).getRemoteIP() );
+
+        assertEquals( AuditEvent.DELETE_MANAGED_REPO, mockAuditListener.getAuditEvents().get( 1 ).getAction() );
+        assertEquals( "root", mockAuditListener.getAuditEvents().get( 0 ).getUserId() );
+    }
+
+    private void assertAuditListenerCallAndUpdateAddAndDelete( boolean stageNeeded )
+    {
+        if ( stageNeeded )
+        {
+            assertEquals( "not 4 audit events " + mockAuditListener.getAuditEvents(), 4,
+                          mockAuditListener.getAuditEvents().size() );
+        }
+        else
+        {
+            assertEquals( "not 3 audit events " + mockAuditListener.getAuditEvents(), 3,
+                          mockAuditListener.getAuditEvents().size() );
+        }
+        assertEquals( AuditEvent.ADD_MANAGED_REPO, mockAuditListener.getAuditEvents().get( 0 ).getAction() );
+        assertEquals( "root", mockAuditListener.getAuditEvents().get( 0 ).getUserId() );
+        assertEquals( "archiva-localhost", mockAuditListener.getAuditEvents().get( 0 ).getRemoteIP() );
+
+        if ( stageNeeded )
+        {
+            assertEquals( AuditEvent.ADD_MANAGED_REPO, mockAuditListener.getAuditEvents().get( 1 ).getAction() );
+            assertEquals( AuditEvent.MODIFY_MANAGED_REPO, mockAuditListener.getAuditEvents().get( 2 ).getAction() );
+            assertEquals( AuditEvent.DELETE_MANAGED_REPO, mockAuditListener.getAuditEvents().get( 3 ).getAction() );
+        }
+        else
+        {
+            assertEquals( AuditEvent.MODIFY_MANAGED_REPO, mockAuditListener.getAuditEvents().get( 1 ).getAction() );
+            assertEquals( AuditEvent.DELETE_MANAGED_REPO, mockAuditListener.getAuditEvents().get( 2 ).getAction() );
+        }
+
+    }
+
+
+
+}
diff --git a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/test/java/org/apache/archiva/admin/repository/networkproxy/NetworkProxyAdminTest.java b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/test/java/org/apache/archiva/admin/repository/networkproxy/NetworkProxyAdminTest.java
new file mode 100644 (file)
index 0000000..02eec58
--- /dev/null
@@ -0,0 +1,144 @@
+package org.apache.archiva.admin.repository.networkproxy;
+/*
+ * 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.admin.model.networkproxy.NetworkProxy;
+import org.apache.archiva.admin.model.networkproxy.NetworkProxyAdmin;
+import org.apache.archiva.admin.repository.AbstractRepositoryAdminTest;
+import org.apache.archiva.audit.AuditEvent;
+import org.junit.Test;
+
+import javax.inject.Inject;
+
+/**
+ * @author Olivier Lamy
+ */
+public class NetworkProxyAdminTest
+    extends AbstractRepositoryAdminTest
+{
+
+    @Inject
+    private NetworkProxyAdmin networkProxyAdmin;
+
+    @Test
+    public void getAllEmpty()
+        throws Exception
+    {
+        assertNotNull( networkProxyAdmin.getNetworkProxies() );
+    }
+
+    @Test
+    public void addAndDelete()
+        throws Exception
+    {
+        mockAuditListener.clearEvents();
+        int initialSize = networkProxyAdmin.getNetworkProxies().size();
+        NetworkProxy networkProxy = getNetworkProxyTest( "foo" );
+
+        networkProxyAdmin.addNetworkProxy( networkProxy, getFakeAuditInformation() );
+
+        assertEquals( initialSize + 1, networkProxyAdmin.getNetworkProxies().size() );
+
+        networkProxy = networkProxyAdmin.getNetworkProxy( "foo" );
+
+        assertNotNull( networkProxy );
+        assertEquals( getNetworkProxyTest( "foo" ).getId(), networkProxy.getId() );
+        assertEquals( getNetworkProxyTest( "foo" ).getHost(), networkProxy.getHost() );
+        assertEquals( getNetworkProxyTest( "foo" ).getPassword(), networkProxy.getPassword() );
+        assertEquals( getNetworkProxyTest( "foo" ).getPort(), networkProxy.getPort() );
+        assertEquals( getNetworkProxyTest( "foo" ).getUsername(), networkProxy.getUsername() );
+        assertEquals( getNetworkProxyTest( "foo" ).getProtocol(), networkProxy.getProtocol() );
+
+        networkProxyAdmin.deleteNetworkProxy( "foo", getFakeAuditInformation() );
+
+        assertNull( networkProxyAdmin.getNetworkProxy( "foo" ) );
+
+        assertEquals( 2, mockAuditListener.getAuditEvents().size() );
+
+        assertEquals( AuditEvent.ADD_NETWORK_PROXY, mockAuditListener.getAuditEvents().get( 0 ).getAction() );
+        assertEquals( AuditEvent.DELETE_NETWORK_PROXY, mockAuditListener.getAuditEvents().get( 1 ).getAction() );
+
+        mockAuditListener.clearEvents();
+    }
+
+    @Test
+    public void addAndUpdateAndDelete()
+        throws Exception
+    {
+        mockAuditListener.clearEvents();
+        int initialSize = networkProxyAdmin.getNetworkProxies().size();
+        NetworkProxy networkProxy = getNetworkProxyTest( "foo" );
+
+        networkProxyAdmin.addNetworkProxy( networkProxy, getFakeAuditInformation() );
+
+        assertEquals( initialSize + 1, networkProxyAdmin.getNetworkProxies().size() );
+
+        networkProxy = networkProxyAdmin.getNetworkProxy( "foo" );
+
+        assertNotNull( networkProxy );
+        assertEquals( getNetworkProxyTest( "foo" ).getId(), networkProxy.getId() );
+        assertEquals( getNetworkProxyTest( "foo" ).getHost(), networkProxy.getHost() );
+        assertEquals( getNetworkProxyTest( "foo" ).getPassword(), networkProxy.getPassword() );
+        assertEquals( getNetworkProxyTest( "foo" ).getPort(), networkProxy.getPort() );
+        assertEquals( getNetworkProxyTest( "foo" ).getUsername(), networkProxy.getUsername() );
+        assertEquals( getNetworkProxyTest( "foo" ).getProtocol(), networkProxy.getProtocol() );
+
+        networkProxy.setHost( "https://toto.com" );
+        networkProxy.setPassword( "newpasswd" );
+        networkProxy.setPort( 9191 );
+        networkProxy.setProtocol( "http" );
+        networkProxy.setUsername( "newusername" );
+
+        networkProxyAdmin.updateNetworkProxy( networkProxy, getFakeAuditInformation() );
+
+        NetworkProxy updatedNetworkProxy = networkProxyAdmin.getNetworkProxy( "foo" );
+
+        assertNotNull( updatedNetworkProxy );
+        assertEquals( networkProxy.getId(), updatedNetworkProxy.getId() );
+        assertEquals( networkProxy.getHost(), updatedNetworkProxy.getHost() );
+        assertEquals( networkProxy.getPassword(), updatedNetworkProxy.getPassword() );
+        assertEquals( networkProxy.getPort(), updatedNetworkProxy.getPort() );
+        assertEquals( networkProxy.getUsername(), updatedNetworkProxy.getUsername() );
+        assertEquals( networkProxy.getProtocol(), updatedNetworkProxy.getProtocol() );
+
+        networkProxyAdmin.deleteNetworkProxy( "foo", getFakeAuditInformation() );
+
+        assertEquals( 3, mockAuditListener.getAuditEvents().size() );
+
+        assertEquals( AuditEvent.ADD_NETWORK_PROXY, mockAuditListener.getAuditEvents().get( 0 ).getAction() );
+        assertEquals( AuditEvent.MODIFY_NETWORK_PROXY, mockAuditListener.getAuditEvents().get( 1 ).getAction() );
+        assertEquals( AuditEvent.DELETE_NETWORK_PROXY, mockAuditListener.getAuditEvents().get( 2 ).getAction() );
+
+        mockAuditListener.clearEvents();
+    }
+
+
+    protected NetworkProxy getNetworkProxyTest( String id )
+    {
+        NetworkProxy networkProxy = new NetworkProxy();
+        networkProxy.setId( "foo" );
+        networkProxy.setHost( "http://foo.com" );
+        networkProxy.setPassword( "passwd" );
+        networkProxy.setPort( 9090 );
+        networkProxy.setUsername( "root" );
+        networkProxy.setProtocol( "https" );
+        return networkProxy;
+    }
+
+}
diff --git a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/test/java/org/apache/archiva/admin/repository/proxyconnector/ProxyConnectorAdminTest.java b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/test/java/org/apache/archiva/admin/repository/proxyconnector/ProxyConnectorAdminTest.java
new file mode 100644 (file)
index 0000000..b90c3b0
--- /dev/null
@@ -0,0 +1,166 @@
+package org.apache.archiva.admin.repository.proxyconnector;
+/*
+ * 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.admin.model.proxyconnector.ProxyConnector;
+import org.apache.archiva.admin.model.remote.RemoteRepository;
+import org.apache.archiva.admin.repository.AbstractRepositoryAdminTest;
+import org.apache.archiva.audit.AuditEvent;
+import org.junit.Test;
+
+import java.util.Arrays;
+
+/**
+ * @author Olivier Lamy
+ */
+public class ProxyConnectorAdminTest
+    extends AbstractRepositoryAdminTest
+{
+
+    @Test
+    public void addAndDelete()
+        throws Exception
+    {
+        mockAuditListener.clearEvents();
+        assertEquals( "not proxyConnectors 2 " + proxyConnectorAdmin.getProxyConnectors(), 2,
+                      proxyConnectorAdmin.getProxyConnectors().size() );
+        assertFalse( proxyConnectorAdmin.getProxyConnectors().isEmpty() );
+        ProxyConnector proxyConnector = new ProxyConnector();
+        proxyConnector.setSourceRepoId( "snapshots" );
+        proxyConnector.setTargetRepoId( "central" );
+        proxyConnectorAdmin.addProxyConnector( proxyConnector, getFakeAuditInformation() );
+
+        assertFalse( proxyConnectorAdmin.getProxyConnectors().isEmpty() );
+        assertEquals( 3, proxyConnectorAdmin.getProxyConnectors().size() );
+
+        assertNotNull( proxyConnectorAdmin.getProxyConnector( "snapshots", "central" ) );
+
+        proxyConnectorAdmin.deleteProxyConnector( proxyConnector, getFakeAuditInformation() );
+
+        assertEquals( 2, proxyConnectorAdmin.getProxyConnectors().size() );
+        assertFalse( proxyConnectorAdmin.getProxyConnectors().isEmpty() );
+
+        assertEquals( 2, mockAuditListener.getAuditEvents().size() );
+
+        assertEquals( AuditEvent.ADD_PROXY_CONNECTOR, mockAuditListener.getAuditEvents().get( 0 ).getAction() );
+        assertEquals( "root", mockAuditListener.getAuditEvents().get( 0 ).getUserId() );
+        assertEquals( "archiva-localhost", mockAuditListener.getAuditEvents().get( 0 ).getRemoteIP() );
+
+        assertEquals( AuditEvent.DELETE_PROXY_CONNECTOR, mockAuditListener.getAuditEvents().get( 1 ).getAction() );
+        assertEquals( "root", mockAuditListener.getAuditEvents().get( 1 ).getUserId() );
+
+        assertNull( proxyConnectorAdmin.getProxyConnector( "snapshots", "central" ) );
+
+        mockAuditListener.clearEvents();
+    }
+
+    @Test
+    public void addAndUpdateAndDelete()
+        throws Exception
+    {
+        mockAuditListener.clearEvents();
+        RemoteRepository remoteRepository = getRemoteRepository( "test-new-one" );
+
+        remoteRepositoryAdmin.addRemoteRepository( remoteRepository, getFakeAuditInformation() );
+
+        assertEquals( "not proxyConnectors 2 " + proxyConnectorAdmin.getProxyConnectors(), 2,
+                      proxyConnectorAdmin.getProxyConnectors().size() );
+        assertFalse( proxyConnectorAdmin.getProxyConnectors().isEmpty() );
+        ProxyConnector proxyConnector = new ProxyConnector();
+        proxyConnector.setSourceRepoId( "snapshots" );
+        proxyConnector.setTargetRepoId( "central" );
+        proxyConnector.setWhiteListPatterns( Arrays.asList( "foo", "bar" ) );
+        proxyConnectorAdmin.addProxyConnector( proxyConnector, getFakeAuditInformation() );
+
+        assertFalse( proxyConnectorAdmin.getProxyConnectors().isEmpty() );
+        assertEquals( 3, proxyConnectorAdmin.getProxyConnectors().size() );
+
+        assertNotNull( proxyConnectorAdmin.getProxyConnector( "snapshots", "central" ) );
+        assertEquals( Arrays.asList( "foo", "bar" ),
+                      proxyConnectorAdmin.getProxyConnector( "snapshots", "central" ).getWhiteListPatterns() );
+
+        proxyConnectorAdmin.deleteProxyConnector( proxyConnector, getFakeAuditInformation() );
+
+        proxyConnector.setTargetRepoId( remoteRepository.getId() );
+        proxyConnectorAdmin.addProxyConnector( proxyConnector, getFakeAuditInformation() );
+
+        assertNull( proxyConnectorAdmin.getProxyConnector( "snapshots", "central" ) );
+        assertNotNull( remoteRepository.getId(),
+                       proxyConnectorAdmin.getProxyConnector( "snapshots", remoteRepository.getId() ) );
+
+        proxyConnectorAdmin.deleteProxyConnector( proxyConnector, getFakeAuditInformation() );
+
+        assertNull( proxyConnectorAdmin.getProxyConnector( "snapshots", "central" ) );
+
+        assertEquals( 2, proxyConnectorAdmin.getProxyConnectors().size() );
+        assertFalse( proxyConnectorAdmin.getProxyConnectors().isEmpty() );
+
+        assertEquals( 5, mockAuditListener.getAuditEvents().size() );
+
+        assertEquals( AuditEvent.ADD_REMOTE_REPO, mockAuditListener.getAuditEvents().get( 0 ).getAction() );
+
+        assertEquals( AuditEvent.ADD_PROXY_CONNECTOR, mockAuditListener.getAuditEvents().get( 1 ).getAction() );
+        assertEquals( "root", mockAuditListener.getAuditEvents().get( 2 ).getUserId() );
+        assertEquals( "archiva-localhost", mockAuditListener.getAuditEvents().get( 2 ).getRemoteIP() );
+
+        assertEquals( AuditEvent.DELETE_PROXY_CONNECTOR, mockAuditListener.getAuditEvents().get( 2 ).getAction() );
+
+        assertEquals( AuditEvent.ADD_PROXY_CONNECTOR, mockAuditListener.getAuditEvents().get( 3 ).getAction() );
+
+        assertEquals( AuditEvent.DELETE_PROXY_CONNECTOR, mockAuditListener.getAuditEvents().get( 4 ).getAction() );
+        assertEquals( "root", mockAuditListener.getAuditEvents().get( 4 ).getUserId() );
+
+        remoteRepositoryAdmin.deleteRemoteRepository( remoteRepository.getId(), getFakeAuditInformation() );
+        mockAuditListener.clearEvents();
+    }
+
+    @Test
+    public void findProxyConnector()
+        throws Exception
+    {
+        ProxyConnector proxyConnector = proxyConnectorAdmin.getProxyConnector( "internal", "central" );
+        assertNotNull( proxyConnector );
+    }
+
+    @Test
+    public void updateProxyConnector()
+        throws Exception
+    {
+        mockAuditListener.clearEvents();
+        ProxyConnector proxyConnector = proxyConnectorAdmin.getProxyConnector( "internal", "central" );
+        assertNotNull( proxyConnector );
+        proxyConnector.setDisabled( false );
+        proxyConnectorAdmin.updateProxyConnector( proxyConnector, getFakeAuditInformation() );
+        proxyConnector = proxyConnectorAdmin.getProxyConnector( "internal", "central" );
+        assertFalse( proxyConnector.isDisabled() );
+
+        proxyConnector.setDisabled( true );
+        proxyConnectorAdmin.updateProxyConnector( proxyConnector, getFakeAuditInformation() );
+        proxyConnector = proxyConnectorAdmin.getProxyConnector( "internal", "central" );
+        assertTrue( proxyConnector.isDisabled() );
+
+        proxyConnector.setOrder( 4 );
+        proxyConnectorAdmin.updateProxyConnector( proxyConnector, getFakeAuditInformation() );
+        proxyConnector = proxyConnectorAdmin.getProxyConnector( "internal", "central" );
+        assertEquals( 4, proxyConnector.getOrder() );
+        mockAuditListener.clearEvents();
+
+    }
+
+}
diff --git a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/test/java/org/apache/archiva/admin/repository/remote/RemoteRepositoryAdminTest.java b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/test/java/org/apache/archiva/admin/repository/remote/RemoteRepositoryAdminTest.java
new file mode 100644 (file)
index 0000000..ffc5a33
--- /dev/null
@@ -0,0 +1,154 @@
+package org.apache.archiva.admin.repository.remote;
+/*
+ * 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.admin.model.remote.RemoteRepository;
+import org.apache.archiva.admin.repository.AbstractRepositoryAdminTest;
+import org.apache.archiva.audit.AuditEvent;
+import org.junit.Test;
+
+import java.util.List;
+
+/**
+ * @author Olivier Lamy
+ */
+public class RemoteRepositoryAdminTest
+    extends AbstractRepositoryAdminTest
+{
+
+    @Test
+    public void getAll()
+        throws Exception
+    {
+        List<RemoteRepository> remoteRepositories = remoteRepositoryAdmin.getRemoteRepositories();
+        assertNotNull( remoteRepositories );
+        assertTrue( remoteRepositories.size() > 0 );
+        log.info( "remote " + remoteRepositories );
+    }
+
+    @Test
+    public void getById()
+        throws Exception
+    {
+        RemoteRepository central = remoteRepositoryAdmin.getRemoteRepository( "central" );
+        assertNotNull( central );
+        assertEquals( "http://repo1.maven.org/maven2", central.getUrl() );
+        assertEquals( 60, central.getTimeout() );
+        assertNull( central.getUserName() );
+        assertNull( central.getPassword() );
+    }
+
+    @Test
+    public void addAndDelete()
+        throws Exception
+    {
+        mockAuditListener.clearEvents();
+        int initialSize = remoteRepositoryAdmin.getRemoteRepositories().size();
+
+        RemoteRepository remoteRepository = getRemoteRepository();
+
+        remoteRepositoryAdmin.addRemoteRepository( remoteRepository, getFakeAuditInformation() );
+
+        assertEquals( initialSize + 1, remoteRepositoryAdmin.getRemoteRepositories().size() );
+
+        RemoteRepository repo = remoteRepositoryAdmin.getRemoteRepository( "foo" );
+        assertNotNull( repo );
+        assertEquals( getRemoteRepository().getPassword(), repo.getPassword() );
+        assertEquals( getRemoteRepository().getUrl(), repo.getUrl() );
+        assertEquals( getRemoteRepository().getUserName(), repo.getUserName() );
+        assertEquals( getRemoteRepository().getName(), repo.getName() );
+        assertEquals( getRemoteRepository().getTimeout(), repo.getTimeout() );
+
+        remoteRepositoryAdmin.deleteRemoteRepository( "foo", getFakeAuditInformation() );
+
+        assertEquals( initialSize, remoteRepositoryAdmin.getRemoteRepositories().size() );
+
+        repo = remoteRepositoryAdmin.getRemoteRepository( "foo" );
+        assertNull( repo );
+
+        assertEquals( 2, mockAuditListener.getAuditEvents().size() );
+
+        assertEquals( AuditEvent.ADD_REMOTE_REPO, mockAuditListener.getAuditEvents().get( 0 ).getAction() );
+        assertEquals( "root", mockAuditListener.getAuditEvents().get( 0 ).getUserId() );
+        assertEquals( "archiva-localhost", mockAuditListener.getAuditEvents().get( 0 ).getRemoteIP() );
+
+        assertEquals( AuditEvent.DELETE_REMOTE_REPO, mockAuditListener.getAuditEvents().get( 1 ).getAction() );
+        assertEquals( "root", mockAuditListener.getAuditEvents().get( 1 ).getUserId() );
+
+    }
+
+
+    @Test
+    public void addAndUpdateAndDelete()
+        throws Exception
+    {
+        mockAuditListener.clearEvents();
+        int initialSize = remoteRepositoryAdmin.getRemoteRepositories().size();
+
+        RemoteRepository remoteRepository = getRemoteRepository();
+
+        remoteRepositoryAdmin.addRemoteRepository( remoteRepository, getFakeAuditInformation() );
+
+        assertEquals( initialSize + 1, remoteRepositoryAdmin.getRemoteRepositories().size() );
+
+        RemoteRepository repo = remoteRepositoryAdmin.getRemoteRepository( "foo" );
+        assertNotNull( repo );
+        assertEquals( getRemoteRepository().getPassword(), repo.getPassword() );
+        assertEquals( getRemoteRepository().getUrl(), repo.getUrl() );
+        assertEquals( getRemoteRepository().getUserName(), repo.getUserName() );
+        assertEquals( getRemoteRepository().getName(), repo.getName() );
+        assertEquals( getRemoteRepository().getTimeout(), repo.getTimeout() );
+
+        repo.setUserName( "foo-name-changed" );
+        repo.setPassword( "titi" );
+        repo.setUrl( "http://foo.com/maven-really-rocks" );
+
+        remoteRepositoryAdmin.updateRemoteRepository( repo, getFakeAuditInformation() );
+
+        repo = remoteRepositoryAdmin.getRemoteRepository( "foo" );
+
+        assertEquals( "foo-name-changed", repo.getUserName() );
+        assertEquals( "titi", repo.getPassword() );
+        assertEquals( "http://foo.com/maven-really-rocks", repo.getUrl() );
+
+        remoteRepositoryAdmin.deleteRemoteRepository( "foo", getFakeAuditInformation() );
+
+        assertEquals( initialSize, remoteRepositoryAdmin.getRemoteRepositories().size() );
+
+        repo = remoteRepositoryAdmin.getRemoteRepository( "foo" );
+        assertNull( repo );
+
+        assertEquals( 3, mockAuditListener.getAuditEvents().size() );
+
+        assertEquals( AuditEvent.ADD_REMOTE_REPO, mockAuditListener.getAuditEvents().get( 0 ).getAction() );
+        assertEquals( "root", mockAuditListener.getAuditEvents().get( 0 ).getUserId() );
+        assertEquals( "archiva-localhost", mockAuditListener.getAuditEvents().get( 0 ).getRemoteIP() );
+
+        assertEquals( AuditEvent.MODIFY_REMOTE_REPO, mockAuditListener.getAuditEvents().get( 1 ).getAction() );
+        assertEquals( "root", mockAuditListener.getAuditEvents().get( 1 ).getUserId() );
+        assertEquals( "archiva-localhost", mockAuditListener.getAuditEvents().get( 1 ).getRemoteIP() );
+
+        assertEquals( AuditEvent.DELETE_REMOTE_REPO, mockAuditListener.getAuditEvents().get( 2 ).getAction() );
+        assertEquals( "root", mockAuditListener.getAuditEvents().get( 2 ).getUserId() );
+
+    }
+
+
+
+}
diff --git a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/test/resources/META-INF/redback/redback-core.xml b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/test/resources/META-INF/redback/redback-core.xml
new file mode 100644 (file)
index 0000000..ecc1de8
--- /dev/null
@@ -0,0 +1,213 @@
+<redback-role-model>
+    <modelVersion>1.0.0</modelVersion>
+    <applications>
+        <application>
+          <id>System</id>
+          <description>Roles that apply system-wide, across all of the applications</description>
+        <version>1.0.0</version>
+        <resources>
+            <resource>
+                <id>global</id>
+                <name>*</name>
+                <permanent>true</permanent>
+                <description>global resource implies full access for authorization</description>
+            </resource>
+            <resource>
+                <id>username</id>
+                <name>${username}</name>
+                <permanent>true</permanent>
+                <description>replaced with the username of the principal at authorization check time</description>
+            </resource>
+        </resources>
+        <operations>
+            <operation>
+                <id>configuration-edit</id>
+                <name>configuration-edit</name>
+                <description>edit configuration</description>
+                <permanent>true</permanent>
+            </operation>
+            <operation>
+                <id>user-management-user-create</id>
+                <name>user-management-user-create</name>
+                <description>create user</description>
+                <permanent>true</permanent>
+            </operation>
+            <operation>
+                <id>user-management-user-edit</id>
+                <name>user-management-user-edit</name>
+                <description>edit user</description>
+                <permanent>true</permanent>
+            </operation>
+            <operation>
+                <id>user-management-user-role</id>
+                <name>user-management-user-role</name>
+                <description>user roles</description>
+                <permanent>true</permanent>
+            </operation>
+            <operation>
+                <id>user-management-user-delete</id>
+                <name>user-management-user-delete</name>
+                <description>delete user</description>
+                <permanent>true</permanent>
+            </operation>
+            <operation>
+                <id>user-management-user-list</id>
+                <name>user-management-user-list</name>
+                <description>list users</description>
+                <permanent>true</permanent>
+            </operation>
+            <operation>
+                <id>user-management-role-grant</id>
+                <name>user-management-role-grant</name>
+                <description>grant role</description>
+                <permanent>true</permanent>
+            </operation>
+            <operation>
+                <id>user-management-role-drop</id>
+                <name>user-management-role-drop</name>
+                <description>drop role</description>
+                <permanent>true</permanent>
+            </operation>
+            <operation>
+                <id>user-management-rbac-admin</id>
+                <name>user-management-rbac-admin</name>
+                <description>administer rbac</description>
+                <permanent>true</permanent>
+            </operation>
+            <operation>
+                <id>guest-access</id>
+                <name>guest-access</name>
+                <description>access guest</description>
+                <permanent>true</permanent>
+            </operation>
+            <operation>
+                <id>user-management-manage-data</id>
+                <name>user-management-manage-data</name>
+                <description>manage data</description>
+                <permanent>true</permanent>
+            </operation>            
+        </operations>
+        <roles>
+            <role>
+                <id>system-administrator</id>
+                <name>System Administrator</name>
+                <permanent>true</permanent>
+                <assignable>true</assignable>
+                <permissions>
+                    <permission>
+                        <id>edit-redback-configuration</id>
+                        <name>Edit Redback Configuration</name>
+                        <operation>configuration-edit</operation>
+                        <resource>global</resource>
+                        <permanent>true</permanent>
+                    </permission>
+                    <permission>
+                        <id>manage-rbac-setup</id>
+                        <name>User RBAC Management</name>
+                        <operation>user-management-rbac-admin</operation>
+                        <resource>global</resource>
+                        <permanent>true</permanent>
+                    </permission>
+                    <permission>
+                        <id>manage-rbac-data</id>
+                        <name>RBAC Manage Data</name>
+                        <operation>user-management-manage-data</operation>
+                        <resource>global</resource>
+                        <permanent>true</permanent>
+                    </permission>                    
+                </permissions>
+                <childRoles>
+                    <childRole>user-administrator</childRole>
+                </childRoles>
+            </role>
+            <role>
+                <id>user-administrator</id>
+                <name>User Administrator</name>
+                <permanent>true</permanent>
+                <assignable>true</assignable>
+                <permissions>
+                    <permission>
+                        <id>drop-roles-for-anyone</id>
+                        <name>Drop Roles for Anyone</name>
+                        <operation>user-management-role-drop</operation>
+                        <resource>global</resource>
+                        <permanent>true</permanent>
+                    </permission>
+                    <permission>
+                        <id>grant-roles-for-anyone</id>
+                        <name>Grant Roles for Anyone</name>
+                        <operation>user-management-role-grant</operation>
+                        <resource>global</resource>
+                        <permanent>true</permanent>
+                    </permission>
+                    <permission>
+                        <id>user-create</id>
+                        <name>Create Users</name>
+                        <operation>user-management-user-create</operation>
+                        <resource>global</resource>
+                        <permanent>true</permanent>
+                    </permission>
+                    <permission>
+                        <id>user-delete</id>
+                        <name>Delete Users</name>
+                        <operation>user-management-user-delete</operation>
+                        <resource>global</resource>
+                        <permanent>true</permanent>
+                    </permission>
+                    <permission>
+                        <id>user-edit</id>
+                        <name>Edit Users</name>
+                        <operation>user-management-user-edit</operation>
+                        <resource>global</resource>
+                        <permanent>true</permanent>
+                    </permission>
+                    <permission>
+                        <id>access-users-roles</id>
+                        <name>Access Users Roles</name>
+                        <operation>user-management-user-role</operation>
+                        <resource>global</resource>
+                        <permanent>true</permanent>
+                    </permission>
+                    <permission>
+                        <id>access-user-list</id>
+                        <name>Access User List</name>
+                        <operation>user-management-user-list</operation>
+                        <resource>global</resource>
+                        <permanent>true</permanent>
+                    </permission>
+                </permissions>
+            </role>
+            <role>
+                <id>registered-user</id>
+                <name>Registered User</name>
+                <permanent>true</permanent>
+                <assignable>true</assignable>
+                <permissions>
+                    <permission>
+                        <id>edit-user-by-username</id>
+                        <name>Edit User Data by Username</name>
+                        <operation>user-management-user-edit</operation>
+                        <resource>username</resource>
+                        <permanent>true</permanent>
+                    </permission>
+                </permissions>
+            </role>
+            <role>
+                <id>guest</id>
+                <name>Guest</name>
+                <permanent>true</permanent>
+                <assignable>true</assignable>
+                <permissions>
+                    <permission>
+                        <id>guest-permission</id>
+                        <name>Guest Permission</name>
+                        <operation>guest-access</operation>
+                        <resource>global</resource>
+                        <permanent>true</permanent>
+                    </permission>
+                </permissions>
+            </role>
+        </roles>
+        </application>
+    </applications>
+</redback-role-model>
\ No newline at end of file
diff --git a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/test/resources/log4j.xml b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/test/resources/log4j.xml
new file mode 100644 (file)
index 0000000..9b1a658
--- /dev/null
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!--
+  ~ 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.
+  -->
+
+<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
+
+<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
+
+  <appender name="console" class="org.apache.log4j.ConsoleAppender">
+    <layout class="org.apache.log4j.PatternLayout">
+      <param name="ConversionPattern" value="%d [%t] %-5p %c %x - %m%n"/>
+    </layout>
+  </appender>
+
+
+
+  <logger name="org.apache.archiva.admin.repository.managed" >
+    <level value="debug"/>
+  </logger>
+  <logger name="JPOX">
+    <level value="ERROR"/>
+  </logger>
+
+  <logger name="org.springframework">
+    <level value="error"/>
+  </logger>
+
+  <root>
+    <priority value ="info" />
+    <appender-ref ref="console" />
+  </root>
+
+</log4j:configuration>
diff --git a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/test/resources/spring-context.xml b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/test/resources/spring-context.xml
new file mode 100644 (file)
index 0000000..a18703d
--- /dev/null
@@ -0,0 +1,59 @@
+<?xml version="1.0"?>
+
+<!--
+  ~ 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.
+  -->
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xmlns:context="http://www.springframework.org/schema/context"
+       xsi:schemaLocation="http://www.springframework.org/schema/beans
+           http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
+           http://www.springframework.org/schema/context 
+           http://www.springframework.org/schema/context/spring-context-3.0.xsd" default-lazy-init="true">
+
+  <context:annotation-config/>
+  <context:component-scan base-package="org.apache.archiva.admin.mock"/>
+
+  <bean name="scheduler" class="org.codehaus.redback.components.scheduler.DefaultScheduler">
+    <property name="properties">
+      <props>
+        <prop key="org.quartz.scheduler.instanceName">scheduler1</prop>
+        <prop key="org.quartz.threadPool.class">org.quartz.simpl.SimpleThreadPool</prop>
+        <prop key="org.quartz.threadPool.threadCount">2</prop>
+        <prop key="org.quartz.threadPool.threadPriority">4</prop>
+        <prop key="org.quartz.jobStore.class">org.quartz.simpl.RAMJobStore</prop>
+      </props>
+    </property>
+  </bean>
+
+  <bean name="commons-configuration" class="org.codehaus.redback.components.registry.commons.CommonsConfigurationRegistry">
+    <property name="properties">
+      <value>
+        <![CDATA[
+        <configuration>
+          <system/>
+          <xml fileName="${appserver.base}/conf/archiva.xml" config-forceCreate="true"
+               config-optional="true"
+               config-name="org.apache.maven.archiva.base" config-at="org.apache.maven.archiva"/>
+        </configuration>
+        ]]>
+      </value>
+    </property>
+  </bean>
+
+</beans>
\ No newline at end of file
index 541eb7f70c07eef92f9b5489bfb2aece447fee01..54bc048197a48f838988474ed1620dd5384c60e1 100644 (file)
   </parent>
   <artifactId>archiva-repository-admin</artifactId>
   <name>Archiva Base :: Repository Admin</name>
-  <dependencies>
-    <dependency>
-      <groupId>org.apache.archiva</groupId>
-      <artifactId>archiva-configuration</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.archiva</groupId>
-      <artifactId>archiva-security-common</artifactId>
-    </dependency>
-     <dependency>
-      <groupId>org.apache.archiva</groupId>
-      <artifactId>archiva-scheduler-repository</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.archiva</groupId>
-      <artifactId>audit</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>javax.inject</groupId>
-      <artifactId>javax.inject</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>net.sf.beanlib</groupId>
-      <artifactId>beanlib</artifactId>
-        <exclusions>
-          <exclusion>
-            <groupId>cglib</groupId>
-            <artifactId>cglib</artifactId>
-          </exclusion>
-          <exclusion>
-            <groupId>aopalliance</groupId>
-            <artifactId>aopalliance</artifactId>
-          </exclusion>
-        </exclusions>
-    </dependency>
-    <dependency>
-      <groupId>org.springframework</groupId>
-      <artifactId>spring-context-support</artifactId>
-      <version>${spring.version}</version>
-      <exclusions>
-        <exclusion>
-          <groupId>commons-logging</groupId>
-          <artifactId>commons-logging</artifactId>
-        </exclusion>
-      </exclusions>
-    </dependency>
-    <dependency>
-      <groupId>org.springframework</groupId>
-      <artifactId>spring-context</artifactId>
-      <version>${spring.version}</version>
-      <exclusions>
-        <exclusion>
-          <groupId>commons-logging</groupId>
-          <artifactId>commons-logging</artifactId>
-        </exclusion>
-      </exclusions>
-    </dependency>
-    <dependency>
-      <groupId>org.slf4j</groupId>
-      <artifactId>slf4j-api</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>commons-validator</groupId>
-      <artifactId>commons-validator</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>oro</groupId>
-      <artifactId>oro</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>org.codehaus.redback.components</groupId>
-      <artifactId>spring-quartz</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>org.codehaus.redback</groupId>
-      <artifactId>redback-rbac-role-manager</artifactId>
-      <exclusions>
-        <exclusion>
-          <groupId>commons-logging</groupId>
-          <artifactId>commons-logging</artifactId>
-        </exclusion>
-      </exclusions>
-    </dependency>
-    <dependency>
-      <groupId>org.codehaus.redback</groupId>
-      <artifactId>redback-authentication-api</artifactId>
-        <exclusions>
-          <exclusion>
-            <groupId>commons-logging</groupId>
-            <artifactId>commons-logging</artifactId>
-          </exclusion>
-        </exclusions>
-    </dependency>
-    <dependency>
-      <groupId>junit</groupId>
-      <artifactId>junit</artifactId>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
-      <groupId>org.slf4j</groupId>
-      <artifactId>slf4j-log4j12</artifactId>
-      <scope>test</scope>
-    </dependency>
-
-    <dependency>
-      <groupId>org.codehaus.redback</groupId>
-      <artifactId>redback-users-memory</artifactId>
-      <scope>test</scope>
-      <version>${redback.version}</version>
-    </dependency>
-
-    <dependency>
-      <groupId>org.codehaus.redback</groupId>
-      <artifactId>redback-keys-memory</artifactId>
-      <scope>test</scope>
-      <version>${redback.version}</version>
-    </dependency>
-
-    <dependency>
-      <groupId>org.codehaus.redback</groupId>
-      <artifactId>redback-rbac-cached</artifactId>
-      <version>${redback.version}</version>
-      <scope>test</scope>
-      <exclusions>
-        <exclusion>
-          <groupId>commons-logging</groupId>
-          <artifactId>commons-logging</artifactId>
-        </exclusion>
-      </exclusions>
-    </dependency>
-
-    <dependency>
-      <groupId>org.apache.derby</groupId>
-      <artifactId>derby</artifactId>
-      <scope>test</scope>
-    </dependency>
-
-    <dependency>
-      <groupId>org.slf4j</groupId>
-      <artifactId>jcl-over-slf4j</artifactId>
-      <scope>test</scope>
-    </dependency>
-
-    <dependency>
-      <groupId>org.apache.archiva</groupId>
-      <artifactId>metadata-store-file</artifactId>
-      <scope>test</scope>
-    </dependency>
-
-  </dependencies>
-
-  <build>
-    <plugins>
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-surefire-plugin</artifactId>
-        <configuration>
-          <systemPropertyVariables>
-            <appserver.base>${project.build.outputDirectory}</appserver.base>
-            <plexus.home>${project.build.outputDirectory}</plexus.home>
-          </systemPropertyVariables>
-        </configuration>
-
-      </plugin>
-    </plugins>
-  </build>
+  <packaging>pom</packaging>
+  <modules>
+    <module>archiva-repository-admin-api</module>
+    <module>archiva-repository-admin-default</module>
+  </modules>
 </project>
diff --git a/archiva-modules/archiva-base/archiva-repository-admin/src/main/java/org/apache/archiva/admin/AuditInformation.java b/archiva-modules/archiva-base/archiva-repository-admin/src/main/java/org/apache/archiva/admin/AuditInformation.java
deleted file mode 100644 (file)
index 098e093..0000000
+++ /dev/null
@@ -1,69 +0,0 @@
-package org.apache.archiva.admin;
-/*
- * 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.codehaus.plexus.redback.users.User;
-
-/**
- * @author Olivier Lamy
- * @since 1.4
- */
-public class AuditInformation
-{
-    private User user;
-
-    private String remoteAddr;
-
-    public AuditInformation( User user, String remoteAddr )
-    {
-        this.user = user;
-        this.remoteAddr = remoteAddr;
-    }
-
-    public User getUser()
-    {
-        return user;
-    }
-
-    public void setUser( User user )
-    {
-        this.user = user;
-    }
-
-    public String getRemoteAddr()
-    {
-        return remoteAddr;
-    }
-
-    public void setRemoteAddr( String remoteAddr )
-    {
-        this.remoteAddr = remoteAddr;
-    }
-
-    @Override
-    public String toString()
-    {
-        final StringBuilder sb = new StringBuilder();
-        sb.append( "AuditInformation" );
-        sb.append( "{user=" ).append( user );
-        sb.append( ", remoteAddr='" ).append( remoteAddr ).append( '\'' );
-        sb.append( '}' );
-        return sb.toString();
-    }
-}
diff --git a/archiva-modules/archiva-base/archiva-repository-admin/src/main/java/org/apache/archiva/admin/repository/AbstractRepository.java b/archiva-modules/archiva-base/archiva-repository-admin/src/main/java/org/apache/archiva/admin/repository/AbstractRepository.java
deleted file mode 100644 (file)
index 6f7cf82..0000000
+++ /dev/null
@@ -1,116 +0,0 @@
-package org.apache.archiva.admin.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.
- */
-
-import java.io.Serializable;
-
-/**
- * @author Olivier Lamy
- * @since 1.4
- */
-public class AbstractRepository
-    implements Serializable
-{
-
-    private String id;
-
-    private String name;
-
-    private String layout = "default";
-
-    public AbstractRepository()
-    {
-        // no op
-    }
-
-    public AbstractRepository( String id, String name, String layout )
-    {
-        this.id = id;
-        this.name = name;
-        this.layout = layout;
-    }
-
-    public String getId()
-    {
-        return id;
-    }
-
-    public void setId( String id )
-    {
-        this.id = id;
-    }
-
-    public String getName()
-    {
-        return name;
-    }
-
-    public void setName( String name )
-    {
-        this.name = name;
-    }
-
-    public String getLayout()
-    {
-        return layout;
-    }
-
-    public void setLayout( String layout )
-    {
-        this.layout = layout;
-    }
-
-
-    public int hashCode()
-    {
-        int result = 17;
-        result = 37 * result + ( id != null ? id.hashCode() : 0 );
-        return result;
-    }
-
-    public boolean equals( Object other )
-    {
-        if ( this == other )
-        {
-            return true;
-        }
-
-        if ( !( other instanceof AbstractRepository ) )
-        {
-            return false;
-        }
-
-        AbstractRepository that = (AbstractRepository) other;
-        boolean result = true;
-        result = result && ( getId() == null ? that.getId() == null : getId().equals( that.getId() ) );
-        return result;
-    }
-
-    @Override
-    public String toString()
-    {
-        final StringBuilder sb = new StringBuilder();
-        sb.append( "AbstractRepository" );
-        sb.append( "{id='" ).append( id ).append( '\'' );
-        sb.append( ", name='" ).append( name ).append( '\'' );
-        sb.append( ", layout='" ).append( layout ).append( '\'' );
-        sb.append( '}' );
-        return sb.toString();
-    }
-}
diff --git a/archiva-modules/archiva-base/archiva-repository-admin/src/main/java/org/apache/archiva/admin/repository/AbstractRepositoryAdmin.java b/archiva-modules/archiva-base/archiva-repository-admin/src/main/java/org/apache/archiva/admin/repository/AbstractRepositoryAdmin.java
deleted file mode 100644 (file)
index d917a6a..0000000
+++ /dev/null
@@ -1,131 +0,0 @@
-package org.apache.archiva.admin.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.
- */
-
-import org.apache.archiva.admin.AuditInformation;
-import org.apache.archiva.audit.AuditEvent;
-import org.apache.archiva.audit.AuditListener;
-import org.apache.maven.archiva.configuration.ArchivaConfiguration;
-import org.apache.maven.archiva.configuration.Configuration;
-import org.apache.maven.archiva.configuration.IndeterminateConfigurationException;
-import org.codehaus.plexus.redback.users.User;
-import org.codehaus.plexus.registry.Registry;
-import org.codehaus.plexus.registry.RegistryException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import javax.inject.Inject;
-import javax.inject.Named;
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * @author Olivier Lamy
- * @since 1.4
- */
-public abstract class AbstractRepositoryAdmin
-{
-    protected Logger log = LoggerFactory.getLogger( getClass() );
-
-    @Inject
-    private List<AuditListener> auditListeners = new ArrayList<AuditListener>();
-
-
-    @Inject
-    private RepositoryCommonValidator repositoryCommonValidator;
-
-    @Inject
-    private ArchivaConfiguration archivaConfiguration;
-
-    @Inject
-    @Named( value = "commons-configuration" )
-    private Registry registry;
-
-    protected void triggerAuditEvent( String repositoryId, String resource, String action,
-                                      AuditInformation auditInformation )
-    {
-        User user = auditInformation == null ? null : auditInformation.getUser();
-        AuditEvent event =
-            new AuditEvent( repositoryId, user == null ? "null" : (String) user.getPrincipal(), resource, action );
-        event.setRemoteIP( auditInformation == null ? "null" : auditInformation.getRemoteAddr() );
-
-        for ( AuditListener listener : getAuditListeners() )
-        {
-            listener.auditEvent( event );
-        }
-
-    }
-
-    protected void saveConfiguration( Configuration config )
-        throws RepositoryAdminException
-    {
-        try
-        {
-            getArchivaConfiguration().save( config );
-        }
-        catch ( RegistryException e )
-        {
-            throw new RepositoryAdminException( "Error occurred in the registry.", e );
-        }
-        catch ( IndeterminateConfigurationException e )
-        {
-            throw new RepositoryAdminException( "Error occurred while saving the configuration.", e );
-        }
-    }
-
-    public List<AuditListener> getAuditListeners()
-    {
-        return auditListeners;
-    }
-
-    public void setAuditListeners( List<AuditListener> auditListeners )
-    {
-        this.auditListeners = auditListeners;
-    }
-
-    public void setArchivaConfiguration( ArchivaConfiguration archivaConfiguration )
-    {
-        this.archivaConfiguration = archivaConfiguration;
-    }
-
-    public ArchivaConfiguration getArchivaConfiguration()
-    {
-        return archivaConfiguration;
-    }
-
-    public RepositoryCommonValidator getRepositoryCommonValidator()
-    {
-        return repositoryCommonValidator;
-    }
-
-    public void setRepositoryCommonValidator( RepositoryCommonValidator repositoryCommonValidator )
-    {
-        this.repositoryCommonValidator = repositoryCommonValidator;
-    }
-
-    public Registry getRegistry()
-    {
-        return registry;
-    }
-
-    public void setRegistry( Registry registry )
-    {
-        this.registry = registry;
-    }
-}
diff --git a/archiva-modules/archiva-base/archiva-repository-admin/src/main/java/org/apache/archiva/admin/repository/AbstractRepositoryConnector.java b/archiva-modules/archiva-base/archiva-repository-admin/src/main/java/org/apache/archiva/admin/repository/AbstractRepositoryConnector.java
deleted file mode 100644 (file)
index c5ecf32..0000000
+++ /dev/null
@@ -1,401 +0,0 @@
-package org.apache.archiva.admin.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.
- */
-
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-/**
- * @author Olivier Lamy
- * @since 1.4
- */
-public abstract class AbstractRepositoryConnector
-    implements Serializable
-{
-    /**
-     * The Repository Source for this connector.
-     */
-    private String sourceRepoId;
-
-    /**
-     * The Repository Target for this connector.
-     */
-    private String targetRepoId;
-
-    /**
-     * The network proxy ID to use for this connector.
-     */
-    private String proxyId;
-
-    /**
-     * Field blackListPatterns.
-     */
-    private List<String> blackListPatterns;
-
-    /**
-     * Field whiteListPatterns.
-     */
-    private List<String> whiteListPatterns;
-
-    /**
-     * Field policies.
-     */
-    private Map<String, String> policies;
-
-    /**
-     * Field properties.
-     */
-    private Map<String, String> properties;
-
-    /**
-     * If the the repository proxy connector is disabled or not
-     */
-    private boolean disabled = false;
-
-    //-----------/
-    //- Methods -/
-    //-----------/
-
-    /**
-     * Method addBlackListPattern.
-     *
-     * @param string
-     */
-    public void addBlackListPattern( String string )
-    {
-        getBlackListPatterns().add( string );
-    }
-
-    /**
-     * Method addPolicy.
-     *
-     * @param key
-     * @param value
-     */
-    public void addPolicy( String key, String value )
-    {
-        getPolicies().put( key, value );
-    }
-
-    /**
-     * Method addProperty.
-     *
-     * @param key
-     * @param value
-     */
-    public void addProperty( String key, String value )
-    {
-        getProperties().put( key, value );
-    }
-
-    /**
-     * Method addWhiteListPattern.
-     *
-     * @param string
-     */
-    public void addWhiteListPattern( String string )
-    {
-        getWhiteListPatterns().add( string );
-    }
-
-    /**
-     * Method getBlackListPatterns.
-     *
-     * @return List
-     */
-    public List<String> getBlackListPatterns()
-    {
-        if ( this.blackListPatterns == null )
-        {
-            this.blackListPatterns = new ArrayList<String>();
-        }
-
-        return this.blackListPatterns;
-    }
-
-    /**
-     * Method getPolicies.
-     *
-     * @return Map
-     */
-    public Map<String, String> getPolicies()
-    {
-        if ( this.policies == null )
-        {
-            this.policies = new HashMap<String, String>();
-        }
-
-        return this.policies;
-    }
-
-    /**
-     * Method getProperties.
-     *
-     * @return Map
-     */
-    public Map<String, String> getProperties()
-    {
-        if ( this.properties == null )
-        {
-            this.properties = new HashMap<String, String>();
-        }
-
-        return this.properties;
-    }
-
-    /**
-     * Get the network proxy ID to use for this connector.
-     *
-     * @return String
-     */
-    public String getProxyId()
-    {
-        return this.proxyId;
-    }
-
-    /**
-     * Get the Repository Source for this connector.
-     *
-     * @return String
-     */
-    public String getSourceRepoId()
-    {
-        return this.sourceRepoId;
-    }
-
-    /**
-     * Get the Repository Target for this connector.
-     *
-     * @return String
-     */
-    public String getTargetRepoId()
-    {
-        return this.targetRepoId;
-    }
-
-    /**
-     * Method getWhiteListPatterns.
-     *
-     * @return List
-     */
-    public List<String> getWhiteListPatterns()
-    {
-        if ( this.whiteListPatterns == null )
-        {
-            this.whiteListPatterns = new ArrayList<String>();
-        }
-
-        return this.whiteListPatterns;
-    }
-
-    /**
-     * Get if the the repository proxy connector is disabled or not
-     * .
-     *
-     * @return boolean
-     */
-    public boolean isDisabled()
-    {
-        return this.disabled;
-    }
-
-    /**
-     * Method removeBlackListPattern.
-     *
-     * @param string
-     */
-    public void removeBlackListPattern( String string )
-    {
-        getBlackListPatterns().remove( string );
-    }
-
-    /**
-     * Method removeWhiteListPattern.
-     *
-     * @param string
-     */
-    public void removeWhiteListPattern( String string )
-    {
-        getWhiteListPatterns().remove( string );
-    }
-
-    /**
-     * Set the list of blacklisted patterns for this connector.
-     *
-     * @param blackListPatterns
-     */
-    public void setBlackListPatterns( List<String> blackListPatterns )
-    {
-        this.blackListPatterns = blackListPatterns;
-    }
-
-    /**
-     * Set if the the repository proxy connector is
-     * disabled or not
-     * .
-     *
-     * @param disabled
-     */
-    public void setDisabled( boolean disabled )
-    {
-        this.disabled = disabled;
-    }
-
-    /**
-     * Set policy configuration for the connector.
-     *
-     * @param policies
-     */
-    public void setPolicies( Map<String, String> policies )
-    {
-        this.policies = policies;
-    }
-
-    /**
-     * Set configuration for the connector.
-     *
-     * @param properties
-     */
-    public void setProperties( Map<String, String> properties )
-    {
-        this.properties = properties;
-    }
-
-    /**
-     * Set the network proxy ID to use for this connector.
-     *
-     * @param proxyId
-     */
-    public void setProxyId( String proxyId )
-    {
-        this.proxyId = proxyId;
-    }
-
-    /**
-     * Set the Repository Source for this connector.
-     *
-     * @param sourceRepoId
-     */
-    public void setSourceRepoId( String sourceRepoId )
-    {
-        this.sourceRepoId = sourceRepoId;
-    }
-
-    /**
-     * Set the Repository Target for this connector.
-     *
-     * @param targetRepoId
-     */
-    public void setTargetRepoId( String targetRepoId )
-    {
-        this.targetRepoId = targetRepoId;
-    }
-
-    /**
-     * Set
-     * The list of whitelisted patterns for this
-     * connector.
-     *
-     * @param whiteListPatterns
-     */
-    public void setWhiteListPatterns( List<String> whiteListPatterns )
-    {
-        this.whiteListPatterns = whiteListPatterns;
-    }
-
-
-    /**
-     * Obtain a specific policy from the underlying connector.
-     *
-     * @param policyId     the policy id to fetch.
-     * @param defaultValue the default value for the policy id.
-     * @return the configured policy value (or default value if not found).
-     */
-    public String getPolicy( String policyId, String defaultValue )
-    {
-        if ( this.getPolicies() == null )
-        {
-            return null;
-        }
-
-        String value = this.getPolicies().get( policyId );
-
-        if ( value == null )
-        {
-            return defaultValue;
-        }
-
-        return value;
-    }
-
-    @Override
-    public boolean equals( Object o )
-    {
-        if ( this == o )
-        {
-            return true;
-        }
-        if ( o == null || getClass() != o.getClass() )
-        {
-            return false;
-        }
-
-        AbstractRepositoryConnector that = (AbstractRepositoryConnector) o;
-
-        if ( sourceRepoId != null ? !sourceRepoId.equals( that.sourceRepoId ) : that.sourceRepoId != null )
-        {
-            return false;
-        }
-        if ( targetRepoId != null ? !targetRepoId.equals( that.targetRepoId ) : that.targetRepoId != null )
-        {
-            return false;
-        }
-
-        return true;
-    }
-
-    @Override
-    public int hashCode()
-    {
-        int result = sourceRepoId != null ? sourceRepoId.hashCode() : 0;
-        result = 31 * result + ( targetRepoId != null ? targetRepoId.hashCode() : 0 );
-        return result;
-    }
-
-    @Override
-    public String toString()
-    {
-        final StringBuilder sb = new StringBuilder();
-        sb.append( "AbstractRepositoryConnector" );
-        sb.append( "{sourceRepoId='" ).append( sourceRepoId ).append( '\'' );
-        sb.append( ", targetRepoId='" ).append( targetRepoId ).append( '\'' );
-        sb.append( ", proxyId='" ).append( proxyId ).append( '\'' );
-        sb.append( ", blackListPatterns=" ).append( blackListPatterns );
-        sb.append( ", whiteListPatterns=" ).append( whiteListPatterns );
-        sb.append( ", policies=" ).append( policies );
-        sb.append( ", properties=" ).append( properties );
-        sb.append( ", disabled=" ).append( disabled );
-        sb.append( '}' );
-        return sb.toString();
-    }
-}
-
diff --git a/archiva-modules/archiva-base/archiva-repository-admin/src/main/java/org/apache/archiva/admin/repository/RepositoryAdminException.java b/archiva-modules/archiva-base/archiva-repository-admin/src/main/java/org/apache/archiva/admin/repository/RepositoryAdminException.java
deleted file mode 100644 (file)
index 12f9b1b..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-package org.apache.archiva.admin.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.
- */
-
-
-/**
- * @author Olivier Lamy
- * @since 1.4
- */
-public class RepositoryAdminException
-    extends Exception
-{
-    public RepositoryAdminException( String s )
-    {
-        super( s );
-    }
-
-    public RepositoryAdminException( String message, Throwable cause )
-    {
-        super( message, cause );
-    }
-}
diff --git a/archiva-modules/archiva-base/archiva-repository-admin/src/main/java/org/apache/archiva/admin/repository/RepositoryCommonValidator.java b/archiva-modules/archiva-base/archiva-repository-admin/src/main/java/org/apache/archiva/admin/repository/RepositoryCommonValidator.java
deleted file mode 100644 (file)
index e49fb3e..0000000
+++ /dev/null
@@ -1,148 +0,0 @@
-package org.apache.archiva.admin.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.
- */
-
-import org.apache.commons.lang.StringUtils;
-import org.apache.commons.validator.GenericValidator;
-import org.apache.maven.archiva.configuration.ArchivaConfiguration;
-import org.apache.maven.archiva.configuration.Configuration;
-import org.codehaus.plexus.registry.Registry;
-import org.springframework.stereotype.Service;
-
-import javax.inject.Inject;
-import javax.inject.Named;
-
-/**
- * apply basic repository validation : id and name.
- * Check if already exists.
- *
- * @author Olivier Lamy
- * @since 1.4
- */
-@Service
-public class RepositoryCommonValidator
-{
-
-    public static final String REPOSITORY_ID_VALID_EXPRESSION = "^[a-zA-Z0-9._-]+$";
-
-    public static final String REPOSITORY_NAME_VALID_EXPRESSION = "^([a-zA-Z0-9.)/_(-]|\\s)+$";
-
-
-    @Inject
-    private ArchivaConfiguration archivaConfiguration;
-
-    @Inject
-    @Named( value = "commons-configuration" )
-    private Registry registry;
-
-    /**
-     * @param abstractRepository
-     * @param update             in update mode if yes already exists won't be check
-     * @throws RepositoryAdminException
-     */
-    public void basicValidation( AbstractRepository abstractRepository, boolean update )
-        throws RepositoryAdminException
-    {
-        Configuration config = archivaConfiguration.getConfiguration();
-
-        String repoId = abstractRepository.getId();
-
-        if ( !update )
-        {
-
-            if ( config.getManagedRepositoriesAsMap().containsKey( repoId ) )
-            {
-                throw new RepositoryAdminException( "Unable to add new repository with id [" + repoId
-                                                        + "], that id already exists as a managed repository." );
-            }
-            else if ( config.getRepositoryGroupsAsMap().containsKey( repoId ) )
-            {
-                throw new RepositoryAdminException( "Unable to add new repository with id [" + repoId
-                                                        + "], that id already exists as a repository group." );
-            }
-            else if ( config.getRemoteRepositoriesAsMap().containsKey( repoId ) )
-            {
-                throw new RepositoryAdminException( "Unable to add new repository with id [" + repoId
-                                                        + "], that id already exists as a remote repository." );
-            }
-        }
-
-        if ( StringUtils.isBlank( repoId ) )
-        {
-            throw new RepositoryAdminException( "Repository ID cannot be empty." );
-        }
-
-        if ( !GenericValidator.matchRegexp( repoId, REPOSITORY_ID_VALID_EXPRESSION ) )
-        {
-            throw new RepositoryAdminException(
-                "Invalid repository ID. Identifier must only contain alphanumeric characters, underscores(_), dots(.), and dashes(-)." );
-        }
-
-        String name = abstractRepository.getName();
-
-        if ( StringUtils.isBlank( name ) )
-        {
-            throw new RepositoryAdminException( "repository name cannot be empty" );
-        }
-
-        if ( !GenericValidator.matchRegexp( name, REPOSITORY_NAME_VALID_EXPRESSION ) )
-        {
-            throw new RepositoryAdminException(
-                "Invalid repository name. Repository Name must only contain alphanumeric characters, white-spaces(' '), "
-                    + "forward-slashes(/), open-parenthesis('('), close-parenthesis(')'),  underscores(_), dots(.), and dashes(-)." );
-        }
-
-
-    }
-
-    /**
-     * replace some interpolations ${appserver.base} with correct values
-     *
-     * @param directory
-     * @return
-     */
-    public String removeExpressions( String directory )
-    {
-        String value = StringUtils.replace( directory, "${appserver.base}",
-                                            getRegistry().getString( "appserver.base", "${appserver.base}" ) );
-        value = StringUtils.replace( value, "${appserver.home}",
-                                     getRegistry().getString( "appserver.home", "${appserver.home}" ) );
-        return value;
-    }
-
-    public ArchivaConfiguration getArchivaConfiguration()
-    {
-        return archivaConfiguration;
-    }
-
-    public void setArchivaConfiguration( ArchivaConfiguration archivaConfiguration )
-    {
-        this.archivaConfiguration = archivaConfiguration;
-    }
-
-    public Registry getRegistry()
-    {
-        return registry;
-    }
-
-    public void setRegistry( Registry registry )
-    {
-        this.registry = registry;
-    }
-}
diff --git a/archiva-modules/archiva-base/archiva-repository-admin/src/main/java/org/apache/archiva/admin/repository/admin/ArchivaAdministration.java b/archiva-modules/archiva-base/archiva-repository-admin/src/main/java/org/apache/archiva/admin/repository/admin/ArchivaAdministration.java
deleted file mode 100644 (file)
index 48a365f..0000000
+++ /dev/null
@@ -1,90 +0,0 @@
-package org.apache.archiva.admin.repository.admin;
-/*
- * 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.admin.AuditInformation;
-import org.apache.archiva.admin.repository.RepositoryAdminException;
-
-import java.util.List;
-
-/**
- * @author Olivier Lamy
- * @since 1.4
- */
-public interface ArchivaAdministration
-{
-
-    List<LegacyArtifactPath> getLegacyArtifactPaths()
-        throws RepositoryAdminException;
-
-    void addLegacyArtifactPath( LegacyArtifactPath legacyArtifactPath, AuditInformation auditInformation )
-        throws RepositoryAdminException;
-
-    void deleteLegacyArtifactPath( String path, AuditInformation auditInformation )
-        throws RepositoryAdminException;
-
-    void addFileTypePattern( String fileTypeId, String pattern, AuditInformation auditInformation )
-        throws RepositoryAdminException;
-
-    void removeFileTypePattern( String fileTypeId, String pattern, AuditInformation auditInformation )
-        throws RepositoryAdminException;
-
-    List<FileType> getFileTypes()
-        throws RepositoryAdminException;
-
-    FileType getFileType( String fileTypeId )
-        throws RepositoryAdminException;
-
-    void addFileType( FileType fileType, AuditInformation auditInformation )
-        throws RepositoryAdminException;
-
-    void removeFileType( String fileTypeId, AuditInformation auditInformation )
-        throws RepositoryAdminException;
-
-    void addKnownContentConsumer( String knownContentConsumer, AuditInformation auditInformation )
-        throws RepositoryAdminException;
-
-    void setKnownContentConsumers( List<String> knownContentConsumers, AuditInformation auditInformation )
-        throws RepositoryAdminException;
-
-    List<String> getKnownContentConsumers()
-        throws RepositoryAdminException;
-
-    void removeKnownContentConsumer( String knownContentConsumer, AuditInformation auditInformation )
-        throws RepositoryAdminException;
-
-    void addInvalidContentConsumer( String invalidContentConsumer, AuditInformation auditInformation )
-        throws RepositoryAdminException;
-
-    void setInvalidContentConsumers( List<String> invalidContentConsumers, AuditInformation auditInformation )
-        throws RepositoryAdminException;
-
-    List<String> getInvalidContentConsumers()
-        throws RepositoryAdminException;
-
-    void removeInvalidContentConsumer( String invalidContentConsumer, AuditInformation auditInformation )
-        throws RepositoryAdminException;
-
-    OrganisationInformation getOrganisationInformation()
-        throws RepositoryAdminException;
-
-    void setOrganisationInformation( OrganisationInformation organisationInformation )
-        throws RepositoryAdminException;
-
-}
diff --git a/archiva-modules/archiva-base/archiva-repository-admin/src/main/java/org/apache/archiva/admin/repository/admin/DefaultArchivaAdministration.java b/archiva-modules/archiva-base/archiva-repository-admin/src/main/java/org/apache/archiva/admin/repository/admin/DefaultArchivaAdministration.java
deleted file mode 100644 (file)
index 0848692..0000000
+++ /dev/null
@@ -1,301 +0,0 @@
-package org.apache.archiva.admin.repository.admin;
-/*
- * 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 net.sf.beanlib.provider.replicator.BeanReplicator;
-import org.apache.archiva.admin.AuditInformation;
-import org.apache.archiva.admin.repository.AbstractRepositoryAdmin;
-import org.apache.archiva.admin.repository.RepositoryAdminException;
-import org.apache.archiva.audit.AuditEvent;
-import org.apache.commons.lang.StringUtils;
-import org.apache.maven.archiva.configuration.Configuration;
-import org.springframework.stereotype.Service;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-/**
- * @author Olivier Lamy
- */
-@Service( "archivaAdministration#default" )
-public class DefaultArchivaAdministration
-    extends AbstractRepositoryAdmin
-    implements ArchivaAdministration
-{
-    public List<LegacyArtifactPath> getLegacyArtifactPaths()
-        throws RepositoryAdminException
-    {
-        List<LegacyArtifactPath> legacyArtifactPaths = new ArrayList<LegacyArtifactPath>();
-        for ( org.apache.maven.archiva.configuration.LegacyArtifactPath legacyArtifactPath : getArchivaConfiguration().getConfiguration().getLegacyArtifactPaths() )
-        {
-            legacyArtifactPaths.add(
-                new BeanReplicator().replicateBean( legacyArtifactPath, LegacyArtifactPath.class ) );
-        }
-        return legacyArtifactPaths;
-
-    }
-
-    public void addLegacyArtifactPath( LegacyArtifactPath legacyArtifactPath, AuditInformation auditInformation )
-        throws RepositoryAdminException
-    {
-        Configuration configuration = getArchivaConfiguration().getConfiguration();
-
-        configuration.addLegacyArtifactPath( new BeanReplicator().replicateBean( legacyArtifactPath,
-                                                                                 org.apache.maven.archiva.configuration.LegacyArtifactPath.class ) );
-
-        saveConfiguration( configuration );
-        triggerAuditEvent( "", "", AuditEvent.ADD_LEGACY_PATH, auditInformation );
-    }
-
-    public void deleteLegacyArtifactPath( String path, AuditInformation auditInformation )
-        throws RepositoryAdminException
-    {
-        Configuration configuration = getArchivaConfiguration().getConfiguration();
-        org.apache.maven.archiva.configuration.LegacyArtifactPath legacyArtifactPath =
-            new org.apache.maven.archiva.configuration.LegacyArtifactPath();
-
-        legacyArtifactPath.setPath( path );
-        configuration.removeLegacyArtifactPath( legacyArtifactPath );
-
-        saveConfiguration( configuration );
-        triggerAuditEvent( "", "", AuditEvent.REMOVE_LEGACY_PATH, auditInformation );
-    }
-
-
-    public void addFileTypePattern( String fileTypeId, String pattern, AuditInformation auditInformation )
-        throws RepositoryAdminException
-    {
-        Configuration configuration = getArchivaConfiguration().getConfiguration();
-
-        org.apache.maven.archiva.configuration.FileType fileType = getFileTypeById( fileTypeId, configuration );
-        if ( fileType == null )
-        {
-            return;
-        }
-        fileType.addPattern( pattern );
-
-        saveConfiguration( configuration );
-        triggerAuditEvent( "", "", AuditEvent.ADD_PATTERN, auditInformation );
-    }
-
-    public void removeFileTypePattern( String fileTypeId, String pattern, AuditInformation auditInformation )
-        throws RepositoryAdminException
-    {
-        Configuration configuration = getArchivaConfiguration().getConfiguration();
-
-        org.apache.maven.archiva.configuration.FileType fileType = getFileTypeById( fileTypeId, configuration );
-        if ( fileType == null )
-        {
-            return;
-        }
-        fileType.removePattern( pattern );
-
-        saveConfiguration( configuration );
-        triggerAuditEvent( "", "", AuditEvent.REMOVE_PATTERN, auditInformation );
-    }
-
-    public FileType getFileType( String fileTypeId )
-        throws RepositoryAdminException
-    {
-        org.apache.maven.archiva.configuration.FileType fileType =
-            getFileTypeById( fileTypeId, getArchivaConfiguration().getConfiguration() );
-        if ( fileType == null )
-        {
-            return null;
-        }
-        return new BeanReplicator().replicateBean( fileType, FileType.class );
-    }
-
-    public void addFileType( FileType fileType, AuditInformation auditInformation )
-        throws RepositoryAdminException
-    {
-        Configuration configuration = getArchivaConfiguration().getConfiguration();
-        if ( getFileTypeById( fileType.getId(), configuration ) != null )
-        {
-            throw new RepositoryAdminException(
-                "impossible to FileType with id " + fileType.getId() + " already exists" );
-        }
-
-        configuration.getRepositoryScanning().addFileType(
-            new BeanReplicator().replicateBean( fileType, org.apache.maven.archiva.configuration.FileType.class ) );
-        saveConfiguration( configuration );
-    }
-
-    public void removeFileType( String fileTypeId, AuditInformation auditInformation )
-        throws RepositoryAdminException
-    {
-        Configuration configuration = getArchivaConfiguration().getConfiguration();
-        org.apache.maven.archiva.configuration.FileType fileType =
-            new org.apache.maven.archiva.configuration.FileType();
-        fileType.setId( fileTypeId );
-        configuration.getRepositoryScanning().removeFileType( fileType );
-        saveConfiguration( configuration );
-    }
-
-    public void addKnownContentConsumer( String knownContentConsumer, AuditInformation auditInformation )
-        throws RepositoryAdminException
-    {
-        Configuration configuration = getArchivaConfiguration().getConfiguration();
-        if ( configuration.getRepositoryScanning().getKnownContentConsumers().contains( knownContentConsumer ) )
-        {
-            log.warn( "skip adding knownContentConsumer {} as already here", knownContentConsumer );
-            return;
-        }
-        configuration.getRepositoryScanning().addKnownContentConsumer( knownContentConsumer );
-        saveConfiguration( configuration );
-        triggerAuditEvent( "", "", AuditEvent.ENABLE_REPO_CONSUMER, auditInformation );
-    }
-
-    public void removeKnownContentConsumer( String knownContentConsumer, AuditInformation auditInformation )
-        throws RepositoryAdminException
-    {
-        Configuration configuration = getArchivaConfiguration().getConfiguration();
-        configuration.getRepositoryScanning().removeKnownContentConsumer( knownContentConsumer );
-        saveConfiguration( configuration );
-        triggerAuditEvent( "", "", AuditEvent.DISABLE_REPO_CONSUMER, auditInformation );
-    }
-
-    public void addInvalidContentConsumer( String invalidContentConsumer, AuditInformation auditInformation )
-        throws RepositoryAdminException
-    {
-        Configuration configuration = getArchivaConfiguration().getConfiguration();
-        if ( configuration.getRepositoryScanning().getInvalidContentConsumers().contains( invalidContentConsumer ) )
-        {
-            log.warn( "skip adding invalidContentConsumer {} as already here", invalidContentConsumer );
-            return;
-        }
-        configuration.getRepositoryScanning().addInvalidContentConsumer( invalidContentConsumer );
-        saveConfiguration( configuration );
-        triggerAuditEvent( "", "", AuditEvent.ENABLE_REPO_CONSUMER, auditInformation );
-    }
-
-    public void removeInvalidContentConsumer( String invalidContentConsumer, AuditInformation auditInformation )
-        throws RepositoryAdminException
-    {
-        Configuration configuration = getArchivaConfiguration().getConfiguration();
-        configuration.getRepositoryScanning().removeInvalidContentConsumer( invalidContentConsumer );
-        saveConfiguration( configuration );
-        triggerAuditEvent( "", "", AuditEvent.DISABLE_REPO_CONSUMER, auditInformation );
-    }
-
-    public void setKnownContentConsumers( List<String> knownContentConsumers, AuditInformation auditInformation )
-        throws RepositoryAdminException
-    {
-        if ( knownContentConsumers == null )
-        {
-            return;
-        }
-        for ( String knowContentConsumer : knownContentConsumers )
-        {
-            addKnownContentConsumer( knowContentConsumer, auditInformation );
-        }
-    }
-
-    public void setInvalidContentConsumers( List<String> invalidContentConsumers, AuditInformation auditInformation )
-        throws RepositoryAdminException
-    {
-        if ( invalidContentConsumers == null )
-        {
-            return;
-        }
-        for ( String invalidContentConsumer : invalidContentConsumers )
-        {
-            addKnownContentConsumer( invalidContentConsumer, auditInformation );
-        }
-    }
-
-    public List<FileType> getFileTypes()
-        throws RepositoryAdminException
-    {
-        List<org.apache.maven.archiva.configuration.FileType> configFileTypes =
-            getArchivaConfiguration().getConfiguration().getRepositoryScanning().getFileTypes();
-        if ( configFileTypes == null || configFileTypes.isEmpty() )
-        {
-            return Collections.emptyList();
-        }
-        List<FileType> fileTypes = new ArrayList<FileType>();
-        for ( org.apache.maven.archiva.configuration.FileType fileType : configFileTypes )
-        {
-            fileTypes.add( new BeanReplicator().replicateBean( fileType, FileType.class ) );
-        }
-        return fileTypes;
-    }
-
-    public List<String> getKnownContentConsumers()
-        throws RepositoryAdminException
-    {
-        return new ArrayList<String>(
-            getArchivaConfiguration().getConfiguration().getRepositoryScanning().getKnownContentConsumers() );
-    }
-
-    public List<String> getInvalidContentConsumers()
-        throws RepositoryAdminException
-    {
-        return new ArrayList<String>(
-            getArchivaConfiguration().getConfiguration().getRepositoryScanning().getInvalidContentConsumers() );
-    }
-
-    public OrganisationInformation getOrganisationInformation()
-        throws RepositoryAdminException
-    {
-        org.apache.maven.archiva.configuration.OrganisationInformation organisationInformation =
-            getArchivaConfiguration().getConfiguration().getOrganisationInfo();
-        if ( organisationInformation == null )
-        {
-            return null;
-        }
-        return new BeanReplicator().replicateBean( organisationInformation, OrganisationInformation.class );
-    }
-
-    public void setOrganisationInformation( OrganisationInformation organisationInformation )
-        throws RepositoryAdminException
-    {
-        Configuration configuration = getArchivaConfiguration().getConfiguration();
-        if ( organisationInformation != null )
-        {
-            org.apache.maven.archiva.configuration.OrganisationInformation organisationInformationModel =
-                new BeanReplicator().replicateBean( organisationInformation,
-                                                    org.apache.maven.archiva.configuration.OrganisationInformation.class );
-            configuration.setOrganisationInfo( organisationInformationModel );
-        }
-        else
-        {
-            configuration.setOrganisationInfo( null );
-        }
-        saveConfiguration( configuration );
-    }
-
-    //-------------------------
-    //
-    //-------------------------
-
-    private org.apache.maven.archiva.configuration.FileType getFileTypeById( String id, Configuration configuration )
-    {
-        for ( org.apache.maven.archiva.configuration.FileType fileType : configuration.getRepositoryScanning().getFileTypes() )
-        {
-            if ( StringUtils.equals( id, fileType.getId() ) )
-            {
-                return fileType;
-            }
-        }
-        return null;
-    }
-
-}
diff --git a/archiva-modules/archiva-base/archiva-repository-admin/src/main/java/org/apache/archiva/admin/repository/admin/FileType.java b/archiva-modules/archiva-base/archiva-repository-admin/src/main/java/org/apache/archiva/admin/repository/admin/FileType.java
deleted file mode 100644 (file)
index 8f3a3f2..0000000
+++ /dev/null
@@ -1,125 +0,0 @@
-package org.apache.archiva.admin.repository.admin;
-/*
- * 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 java.io.Serializable;
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * @author Olivier Lamy
- * @since 1.4
- */
-public class FileType
-    implements Serializable
-{
-    /**
-     * Field id.
-     */
-    private String id;
-
-    /**
-     * Field patterns.
-     */
-    private List<String> patterns;
-
-    public FileType()
-    {
-        // no op
-    }
-
-    public FileType( String id, List<String> patterns )
-    {
-        this.id = id;
-        this.patterns = patterns;
-    }
-
-    public String getId()
-    {
-        return id;
-    }
-
-    public void setId( String id )
-    {
-        this.id = id;
-    }
-
-    public List<String> getPatterns()
-    {
-        if ( patterns == null )
-        {
-            this.patterns = new ArrayList<String>();
-        }
-        return patterns;
-    }
-
-    public void setPatterns( List<String> patterns )
-    {
-        this.patterns = patterns;
-    }
-
-    public void addPattern( String pattern )
-    {
-        getPatterns().add( pattern );
-    }
-
-    public void removePattern( String pattern )
-    {
-        getPatterns().remove( pattern );
-    }
-
-    @Override
-    public boolean equals( Object o )
-    {
-        if ( this == o )
-        {
-            return true;
-        }
-        if ( o == null || getClass() != o.getClass() )
-        {
-            return false;
-        }
-
-        FileType fileType = (FileType) o;
-
-        if ( id != null ? !id.equals( fileType.id ) : fileType.id != null )
-        {
-            return false;
-        }
-
-        return true;
-    }
-
-    @Override
-    public int hashCode()
-    {
-        return id != null ? 37 + id.hashCode() : 0;
-    }
-
-    @Override
-    public String toString()
-    {
-        final StringBuilder sb = new StringBuilder();
-        sb.append( "FileType" );
-        sb.append( "{id='" ).append( id ).append( '\'' );
-        sb.append( ", patterns=" ).append( patterns );
-        sb.append( '}' );
-        return sb.toString();
-    }
-}
diff --git a/archiva-modules/archiva-base/archiva-repository-admin/src/main/java/org/apache/archiva/admin/repository/admin/FiletypeToMapClosure.java b/archiva-modules/archiva-base/archiva-repository-admin/src/main/java/org/apache/archiva/admin/repository/admin/FiletypeToMapClosure.java
deleted file mode 100644 (file)
index 5465b6e..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-package org.apache.archiva.admin.repository.admin;
-
-/*
- * 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.commons.collections.Closure;
-
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * FiletypeToMapClosure 
- *
- * @since 1.4
- */
-public class FiletypeToMapClosure
-    implements Closure
-{
-    private Map<String, FileType> map = new HashMap<String, FileType>();
-
-    public void execute( Object input )
-    {
-        if ( input instanceof FileType )
-        {
-            FileType filetype = (FileType) input;
-            map.put( filetype.getId(), filetype );
-        }
-    }
-
-    public Map<String, FileType> getMap()
-    {
-        return map;
-    }
-}
diff --git a/archiva-modules/archiva-base/archiva-repository-admin/src/main/java/org/apache/archiva/admin/repository/admin/LegacyArtifactPath.java b/archiva-modules/archiva-base/archiva-repository-admin/src/main/java/org/apache/archiva/admin/repository/admin/LegacyArtifactPath.java
deleted file mode 100644 (file)
index e948948..0000000
+++ /dev/null
@@ -1,141 +0,0 @@
-package org.apache.archiva.admin.repository.admin;
-/*
- * 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 java.io.Serializable;
-
-/**
- * @author Olivier Lamy
- * @since 1.4
- */
-public class LegacyArtifactPath
-    implements Serializable
-{
-    /**
-     * The legacy path.
-     */
-    private String path;
-
-    /**
-     * The artifact reference, as " [groupId] :
-     * [artifactId] : [version] : [classifier] : [type] ".
-     */
-    private String artifact;
-
-    public LegacyArtifactPath()
-    {
-        // no op
-    }
-
-    public LegacyArtifactPath( String path, String artifact )
-    {
-        this.path = path;
-        this.artifact = artifact;
-    }
-
-    public String getPath()
-    {
-        return path;
-    }
-
-    public void setPath( String path )
-    {
-        this.path = path;
-    }
-
-    public String getArtifact()
-    {
-        return artifact;
-    }
-
-    public void setArtifact( String artifact )
-    {
-        this.artifact = artifact;
-    }
-
-    public boolean match( String path )
-    {
-        return path.equals( this.path );
-    }
-
-    public String getGroupId()
-    {
-        return artifact.split( ":" )[0];
-    }
-
-    public String getArtifactId()
-    {
-        return artifact.split( ":" )[1];
-    }
-
-    public String getVersion()
-    {
-        return artifact.split( ":" )[2];
-    }
-
-    public String getClassifier()
-    {
-        String classifier = artifact.split( ":" )[3];
-        return classifier.length() > 0 ? classifier : null;
-    }
-
-    public String getType()
-    {
-        return artifact.split( ":" )[4];
-    }
-
-    @Override
-    public boolean equals( Object o )
-    {
-        if ( this == o )
-        {
-            return true;
-        }
-        if ( o == null || getClass() != o.getClass() )
-        {
-            return false;
-        }
-
-        LegacyArtifactPath that = (LegacyArtifactPath) o;
-
-        if ( path != null ? !path.equals( that.path ) : that.path != null )
-        {
-            return false;
-        }
-
-        return true;
-    }
-
-    @Override
-    public int hashCode()
-    {
-        return path != null ? 37 + path.hashCode() : 0;
-    }
-
-    @Override
-    public String toString()
-    {
-        final StringBuilder sb = new StringBuilder();
-        sb.append( "LegacyArtifactPath" );
-        sb.append( "{path='" ).append( path ).append( '\'' );
-        sb.append( ", artifact='" ).append( artifact ).append( '\'' );
-        sb.append( '}' );
-        return sb.toString();
-    }
-}
diff --git a/archiva-modules/archiva-base/archiva-repository-admin/src/main/java/org/apache/archiva/admin/repository/admin/OrganisationInformation.java b/archiva-modules/archiva-base/archiva-repository-admin/src/main/java/org/apache/archiva/admin/repository/admin/OrganisationInformation.java
deleted file mode 100644 (file)
index 77bd06d..0000000
+++ /dev/null
@@ -1,95 +0,0 @@
-package org.apache.archiva.admin.repository.admin;
-/*
- * 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.
- */
-
-/**
- * @author Olivier Lamy
- * @since 1.4
- */
-public class OrganisationInformation
-{
-    /**
-     * name of the organisation.
-     */
-    private String name;
-
-    /**
-     * name of the organisation.
-     */
-    private String url;
-
-    /**
-     * name of the organisation.
-     */
-    private String logoLocation;
-
-    public OrganisationInformation()
-    {
-        // no op
-    }
-
-    public OrganisationInformation( String name, String url, String logoLocation )
-    {
-        this.name = name;
-        this.url = url;
-        this.logoLocation = logoLocation;
-    }
-
-    public String getName()
-    {
-        return name;
-    }
-
-    public void setName( String name )
-    {
-        this.name = name;
-    }
-
-    public String getUrl()
-    {
-        return url;
-    }
-
-    public void setUrl( String url )
-    {
-        this.url = url;
-    }
-
-    public String getLogoLocation()
-    {
-        return logoLocation;
-    }
-
-    public void setLogoLocation( String logoLocation )
-    {
-        this.logoLocation = logoLocation;
-    }
-
-    @Override
-    public String toString()
-    {
-        final StringBuilder sb = new StringBuilder();
-        sb.append( "OrganisationInformation" );
-        sb.append( "{name='" ).append( name ).append( '\'' );
-        sb.append( ", url='" ).append( url ).append( '\'' );
-        sb.append( ", logoLocation='" ).append( logoLocation ).append( '\'' );
-        sb.append( '}' );
-        return sb.toString();
-    }
-}
diff --git a/archiva-modules/archiva-base/archiva-repository-admin/src/main/java/org/apache/archiva/admin/repository/group/DefaultRepositoryGroupAdmin.java b/archiva-modules/archiva-base/archiva-repository-admin/src/main/java/org/apache/archiva/admin/repository/group/DefaultRepositoryGroupAdmin.java
deleted file mode 100644 (file)
index 78e183b..0000000
+++ /dev/null
@@ -1,325 +0,0 @@
-package org.apache.archiva.admin.repository.group;
-/*
- * 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.admin.AuditInformation;
-import org.apache.archiva.admin.repository.AbstractRepositoryAdmin;
-import org.apache.archiva.admin.repository.RepositoryAdminException;
-import org.apache.archiva.admin.repository.managed.ManagedRepository;
-import org.apache.archiva.admin.repository.managed.ManagedRepositoryAdmin;
-import org.apache.archiva.audit.AuditEvent;
-import org.apache.commons.lang.StringUtils;
-import org.apache.maven.archiva.configuration.Configuration;
-import org.apache.maven.archiva.configuration.RepositoryGroupConfiguration;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.stereotype.Service;
-
-import javax.inject.Inject;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-/**
- * @author Olivier Lamy
- */
-@Service( "repositoryGroupAdmin#default" )
-public class DefaultRepositoryGroupAdmin
-    extends AbstractRepositoryAdmin
-    implements RepositoryGroupAdmin
-{
-
-    private Logger log = LoggerFactory.getLogger( getClass() );
-
-    private static final Pattern REPO_GROUP_ID_PATTERN = Pattern.compile( "[A-Za-z0-9\\._\\-]+" );
-
-    @Inject
-    private ManagedRepositoryAdmin managedRepositoryAdmin;
-
-    public List<RepositoryGroup> getRepositoriesGroups()
-        throws RepositoryAdminException
-    {
-        List<RepositoryGroup> repositoriesGroups = new ArrayList<RepositoryGroup>();
-
-        for ( RepositoryGroupConfiguration repositoryGroupConfiguration : getArchivaConfiguration().getConfiguration().getRepositoryGroups() )
-        {
-            repositoriesGroups.add( new RepositoryGroup( repositoryGroupConfiguration.getId(), new ArrayList<String>(
-                repositoryGroupConfiguration.getRepositories() ) ) );
-        }
-
-        return repositoriesGroups;
-    }
-
-    public RepositoryGroup getRepositoryGroup( String repositoryGroupId )
-        throws RepositoryAdminException
-    {
-        List<RepositoryGroup> repositoriesGroups = getRepositoriesGroups();
-        for ( RepositoryGroup repositoryGroup : repositoriesGroups )
-        {
-            if ( StringUtils.equals( repositoryGroupId, repositoryGroup.getId() ) )
-            {
-                return repositoryGroup;
-            }
-        }
-        return null;
-    }
-
-    public Boolean addRepositoryGroup( RepositoryGroup repositoryGroup, AuditInformation auditInformation )
-        throws RepositoryAdminException
-    {
-        validateRepositoryGroup( repositoryGroup, false );
-        validateManagedRepositoriesExists( repositoryGroup.getRepositories() );
-        RepositoryGroupConfiguration repositoryGroupConfiguration = new RepositoryGroupConfiguration();
-        repositoryGroupConfiguration.setId( repositoryGroup.getId() );
-        repositoryGroupConfiguration.setRepositories( repositoryGroup.getRepositories() );
-        Configuration configuration = getArchivaConfiguration().getConfiguration();
-        configuration.addRepositoryGroup( repositoryGroupConfiguration );
-        saveConfiguration( configuration );
-        triggerAuditEvent( repositoryGroup.getId(), null, AuditEvent.ADD_REPO_GROUP, auditInformation );
-        return Boolean.TRUE;
-    }
-
-    public Boolean deleteRepositoryGroup( String repositoryGroupId, AuditInformation auditInformation )
-        throws RepositoryAdminException
-    {
-        Configuration configuration = getArchivaConfiguration().getConfiguration();
-        RepositoryGroupConfiguration repositoryGroupConfiguration =
-            configuration.getRepositoryGroupsAsMap().get( repositoryGroupId );
-        if ( repositoryGroupConfiguration == null )
-        {
-            throw new RepositoryAdminException(
-                "repositoryGroup with id " + repositoryGroupId + " doesn't not exists so cannot remove" );
-        }
-        configuration.removeRepositoryGroup( repositoryGroupConfiguration );
-        triggerAuditEvent( repositoryGroupId, null, AuditEvent.DELETE_REPO_GROUP, auditInformation );
-        return Boolean.TRUE;
-    }
-
-    public Boolean updateRepositoryGroup( RepositoryGroup repositoryGroup, AuditInformation auditInformation )
-        throws RepositoryAdminException
-    {
-        return updateRepositoryGroup( repositoryGroup, auditInformation, true );
-    }
-
-    private Boolean updateRepositoryGroup( RepositoryGroup repositoryGroup, AuditInformation auditInformation,
-                                           boolean triggerAuditEvent )
-        throws RepositoryAdminException
-    {
-        validateRepositoryGroup( repositoryGroup, true );
-        validateManagedRepositoriesExists( repositoryGroup.getRepositories() );
-        Configuration configuration = getArchivaConfiguration().getConfiguration();
-
-        RepositoryGroupConfiguration repositoryGroupConfiguration =
-            configuration.getRepositoryGroupsAsMap().get( repositoryGroup.getId() );
-
-        configuration.removeRepositoryGroup( repositoryGroupConfiguration );
-
-        repositoryGroupConfiguration.setRepositories( repositoryGroup.getRepositories() );
-        configuration.addRepositoryGroup( repositoryGroupConfiguration );
-
-        saveConfiguration( configuration );
-        if ( triggerAuditEvent )
-        {
-            triggerAuditEvent( repositoryGroup.getId(), null, AuditEvent.MODIFY_REPO_GROUP, auditInformation );
-        }
-        return Boolean.TRUE;
-    }
-
-
-    public Boolean addRepositoryToGroup( String repositoryGroupId, String repositoryId,
-                                         AuditInformation auditInformation )
-        throws RepositoryAdminException
-    {
-        RepositoryGroup repositoryGroup = getRepositoryGroup( repositoryGroupId );
-        if ( repositoryGroup == null )
-        {
-            throw new RepositoryAdminException(
-                "repositoryGroup with id " + repositoryGroupId + " doesn't not exists so cannot add repository to it" );
-        }
-
-        if ( repositoryGroup.getRepositories().contains( repositoryId ) )
-        {
-            throw new RepositoryAdminException(
-                "repositoryGroup with id " + repositoryGroupId + " already contain repository with id" + repositoryId );
-        }
-        validateManagedRepositoriesExists( Arrays.asList( repositoryId ) );
-
-        repositoryGroup.addRepository( repositoryId );
-        updateRepositoryGroup( repositoryGroup, auditInformation, false );
-        triggerAuditEvent( repositoryGroup.getId(), null, AuditEvent.ADD_REPO_TO_GROUP, auditInformation );
-        return Boolean.TRUE;
-    }
-
-    public Boolean deleteRepositoryFromGroup( String repositoryGroupId, String repositoryId,
-                                              AuditInformation auditInformation )
-        throws RepositoryAdminException
-    {
-        RepositoryGroup repositoryGroup = getRepositoryGroup( repositoryGroupId );
-        if ( repositoryGroup == null )
-        {
-            throw new RepositoryAdminException( "repositoryGroup with id " + repositoryGroupId
-                                                    + " doesn't not exists so cannot remove repository from it" );
-        }
-
-        if ( !repositoryGroup.getRepositories().contains( repositoryId ) )
-        {
-            throw new RepositoryAdminException(
-                "repositoryGroup with id " + repositoryGroupId + " doesn't not contains repository with id"
-                    + repositoryId );
-        }
-
-        repositoryGroup.removeRepository( repositoryId );
-        updateRepositoryGroup( repositoryGroup, auditInformation, false );
-        triggerAuditEvent( repositoryGroup.getId(), null, AuditEvent.DELETE_REPO_FROM_GROUP, auditInformation );
-        return Boolean.TRUE;
-    }
-
-    public Map<String, RepositoryGroup> getRepositoryGroupsAsMap()
-        throws RepositoryAdminException
-    {
-        List<RepositoryGroup> repositoriesGroups = getRepositoriesGroups();
-        Map<String, RepositoryGroup> map = new HashMap<String, RepositoryGroup>( repositoriesGroups.size() );
-        for ( RepositoryGroup repositoryGroup : repositoriesGroups )
-        {
-            map.put( repositoryGroup.getId(), repositoryGroup );
-        }
-        return map;
-    }
-
-    public Map<String, List<String>> getGroupToRepositoryMap()
-        throws RepositoryAdminException
-    {
-
-        java.util.Map<String, java.util.List<String>> map = new java.util.HashMap<String, java.util.List<String>>();
-
-        for ( ManagedRepository repo : getManagedRepositoryAdmin().getManagedRepositories() )
-        {
-            for ( RepositoryGroup group : getRepositoriesGroups() )
-            {
-                if ( !group.getRepositories().contains( repo.getId() ) )
-                {
-                    String groupId = group.getId();
-                    java.util.List<String> repos = map.get( groupId );
-                    if ( repos == null )
-                    {
-                        repos = new java.util.ArrayList<String>();
-                        map.put( groupId, repos );
-                    }
-                    repos.add( repo.getId() );
-                }
-            }
-        }
-        return map;
-    }
-
-    public Map<String, List<String>> getRepositoryToGroupMap()
-        throws RepositoryAdminException
-    {
-        java.util.Map<String, java.util.List<String>> map = new java.util.HashMap<String, java.util.List<String>>();
-
-        for ( RepositoryGroup group : getRepositoriesGroups() )
-        {
-            for ( String repositoryId : group.getRepositories() )
-            {
-                java.util.List<String> groups = map.get( repositoryId );
-                if ( groups == null )
-                {
-                    groups = new java.util.ArrayList<String>();
-                    map.put( repositoryId, groups );
-                }
-                groups.add( group.getId() );
-            }
-        }
-        return map;
-    }
-
-    public Boolean validateRepositoryGroup( RepositoryGroup repositoryGroup, boolean updateMode )
-        throws RepositoryAdminException
-    {
-        String repoGroupId = repositoryGroup.getId();
-        if ( StringUtils.isBlank( repoGroupId ) )
-        {
-            throw new RepositoryAdminException( "repositoryGroup id cannot be empty" );
-        }
-
-        if ( repoGroupId.length() > 100 )
-        {
-            throw new RepositoryAdminException(
-                "Identifier [" + repoGroupId + "] is over the maximum limit of 100 characters" );
-
-        }
-
-        Matcher matcher = REPO_GROUP_ID_PATTERN.matcher( repoGroupId );
-        if ( !matcher.matches() )
-        {
-            throw new RepositoryAdminException(
-                "Invalid character(s) found in identifier. Only the following characters are allowed: alphanumeric, '.', '-' and '_'" );
-        }
-
-        Configuration configuration = getArchivaConfiguration().getConfiguration();
-
-        if ( configuration.getRepositoryGroupsAsMap().containsKey( repoGroupId ) )
-        {
-            if ( !updateMode )
-            {
-                throw new RepositoryAdminException( "Unable to add new repository group with id [" + repoGroupId
-                                                        + "], that id already exists as a repository group." );
-            }
-        }
-        else if ( configuration.getManagedRepositoriesAsMap().containsKey( repoGroupId ) )
-        {
-            throw new RepositoryAdminException( "Unable to add new repository group with id [" + repoGroupId
-                                                    + "], that id already exists as a managed repository." );
-        }
-        else if ( configuration.getRemoteRepositoriesAsMap().containsKey( repoGroupId ) )
-        {
-            throw new RepositoryAdminException( "Unable to add new repository group with id [" + repoGroupId
-                                                    + "], that id already exists as a remote repository." );
-        }
-
-        return Boolean.TRUE;
-    }
-
-    private void validateManagedRepositoriesExists( List<String> managedRepositoriesIds )
-        throws RepositoryAdminException
-    {
-        for ( String id : managedRepositoriesIds )
-        {
-            if ( getManagedRepositoryAdmin().getManagedRepository( id ) == null )
-            {
-                throw new RepositoryAdminException(
-                    "managedRepository with id " + id + " not exists so cannot be used in a repositoryGroup" );
-            }
-        }
-    }
-
-    public ManagedRepositoryAdmin getManagedRepositoryAdmin()
-    {
-        return managedRepositoryAdmin;
-    }
-
-    public void setManagedRepositoryAdmin( ManagedRepositoryAdmin managedRepositoryAdmin )
-    {
-        this.managedRepositoryAdmin = managedRepositoryAdmin;
-    }
-}
diff --git a/archiva-modules/archiva-base/archiva-repository-admin/src/main/java/org/apache/archiva/admin/repository/group/RepositoryGroup.java b/archiva-modules/archiva-base/archiva-repository-admin/src/main/java/org/apache/archiva/admin/repository/group/RepositoryGroup.java
deleted file mode 100644 (file)
index 5e44596..0000000
+++ /dev/null
@@ -1,153 +0,0 @@
-package org.apache.archiva.admin.repository.group;
-/*
- * 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 java.io.Serializable;
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * @author Olivier Lamy
- * @since 1.4
- */
-public class RepositoryGroup
-    implements Serializable
-{
-    /**
-     * repository group Id
-     */
-    private String id;
-
-    /**
-     * repositories ids
-     */
-    private List<String> repositories;
-
-    public RepositoryGroup()
-    {
-        // no op
-    }
-
-    public RepositoryGroup( String id, List<String> repositories )
-    {
-        this.id = id;
-        this.repositories = repositories;
-    }
-
-    /**
-     * Method addRepository.
-     *
-     * @param string
-     */
-    public void addRepository( String string )
-    {
-        getRepositories().add( string );
-    }
-
-    /**
-     * Get the id of the repository group.
-     *
-     * @return String
-     */
-    public String getId()
-    {
-        return this.id;
-    }
-
-    /**
-     * Method getRepositories.
-     *
-     * @return List
-     */
-    public java.util.List<String> getRepositories()
-    {
-        if ( this.repositories == null )
-        {
-            this.repositories = new ArrayList<String>();
-        }
-
-        return this.repositories;
-    }
-
-    /**
-     * Method removeRepository.
-     *
-     * @param string
-     */
-    public void removeRepository( String string )
-    {
-        getRepositories().remove( string );
-    }
-
-    /**
-     * Set the id of the repository group.
-     *
-     * @param id
-     */
-    public void setId( String id )
-    {
-        this.id = id;
-    }
-
-    /**
-     * Set the list of repository ids under the group.
-     *
-     * @param repositories
-     */
-    public void setRepositories( List<String> repositories )
-    {
-        this.repositories = repositories;
-    }
-
-    public boolean equals( Object other )
-    {
-        if ( this == other )
-        {
-            return true;
-        }
-
-        if ( !( other instanceof RepositoryGroup ) )
-        {
-            return false;
-        }
-
-        RepositoryGroup that = (RepositoryGroup) other;
-        boolean result = true;
-        result = result && ( getId() == null ? that.getId() == null : getId().equals( that.getId() ) );
-        return result;
-    }
-
-    public int hashCode()
-    {
-        int result = 17;
-        result = 37 * result + ( id != null ? id.hashCode() : 0 );
-        return result;
-    }
-
-    @Override
-    public String toString()
-    {
-        final StringBuilder sb = new StringBuilder();
-        sb.append( "RepositoryGroup" );
-        sb.append( "{id='" ).append( id ).append( '\'' );
-        sb.append( ", repositories=" ).append( repositories );
-        sb.append( '}' );
-        return sb.toString();
-    }
-}
diff --git a/archiva-modules/archiva-base/archiva-repository-admin/src/main/java/org/apache/archiva/admin/repository/group/RepositoryGroupAdmin.java b/archiva-modules/archiva-base/archiva-repository-admin/src/main/java/org/apache/archiva/admin/repository/group/RepositoryGroupAdmin.java
deleted file mode 100644 (file)
index 7c21b3a..0000000
+++ /dev/null
@@ -1,75 +0,0 @@
-package org.apache.archiva.admin.repository.group;
-/*
- * 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.admin.AuditInformation;
-import org.apache.archiva.admin.repository.RepositoryAdminException;
-
-import java.util.List;
-import java.util.Map;
-
-/**
- * @author Olivier Lamy
- * @since 1.4
- */
-public interface RepositoryGroupAdmin
-{
-    List<RepositoryGroup> getRepositoriesGroups()
-        throws RepositoryAdminException;
-
-    RepositoryGroup getRepositoryGroup( String repositoryGroupId )
-        throws RepositoryAdminException;
-
-    Boolean addRepositoryGroup( RepositoryGroup repositoryGroup, AuditInformation auditInformation )
-        throws RepositoryAdminException;
-
-    Boolean updateRepositoryGroup( RepositoryGroup repositoryGroup, AuditInformation auditInformation )
-        throws RepositoryAdminException;
-
-    Boolean deleteRepositoryGroup( String repositoryGroupId, AuditInformation auditInformation )
-        throws RepositoryAdminException;
-
-    Boolean addRepositoryToGroup( String repositoryGroupId, String repositoryId, AuditInformation auditInformation )
-        throws RepositoryAdminException;
-
-    Boolean deleteRepositoryFromGroup( String repositoryGroupId, String repositoryId,
-                                       AuditInformation auditInformation )
-        throws RepositoryAdminException;
-
-    /**
-     * @return Map with key repoGroupId and value repoGroup
-     * @throws RepositoryAdminException
-     */
-    Map<String, RepositoryGroup> getRepositoryGroupsAsMap()
-        throws RepositoryAdminException;
-
-    /**
-     * @return Map with key repoGroupId and value List of ManagedRepositories
-     * @throws RepositoryAdminException
-     */
-    Map<String, List<String>> getGroupToRepositoryMap()
-        throws RepositoryAdminException;
-
-    /**
-     * @return Map with key managedRepo id and value List of repositoryGroup ids where the repo is
-     * @throws RepositoryAdminException
-     */
-    Map<String, List<String>> getRepositoryToGroupMap()
-        throws RepositoryAdminException;
-}
diff --git a/archiva-modules/archiva-base/archiva-repository-admin/src/main/java/org/apache/archiva/admin/repository/managed/DefaultManagedRepositoryAdmin.java b/archiva-modules/archiva-base/archiva-repository-admin/src/main/java/org/apache/archiva/admin/repository/managed/DefaultManagedRepositoryAdmin.java
deleted file mode 100644 (file)
index e525c3b..0000000
+++ /dev/null
@@ -1,596 +0,0 @@
-package org.apache.archiva.admin.repository.managed;
-/*
- * 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.admin.AuditInformation;
-import org.apache.archiva.admin.repository.AbstractRepositoryAdmin;
-import org.apache.archiva.admin.repository.RepositoryAdminException;
-import org.apache.archiva.audit.AuditEvent;
-import org.apache.archiva.metadata.repository.MetadataRepository;
-import org.apache.archiva.metadata.repository.MetadataRepositoryException;
-import org.apache.archiva.metadata.repository.RepositorySession;
-import org.apache.archiva.metadata.repository.RepositorySessionFactory;
-import org.apache.archiva.metadata.repository.stats.RepositoryStatisticsManager;
-import org.apache.archiva.scheduler.repository.RepositoryArchivaTaskScheduler;
-import org.apache.archiva.scheduler.repository.RepositoryTask;
-import org.apache.archiva.security.common.ArchivaRoleConstants;
-import org.apache.commons.io.FileUtils;
-import org.apache.commons.lang.StringUtils;
-import org.apache.commons.validator.GenericValidator;
-import org.apache.maven.archiva.configuration.Configuration;
-import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
-import org.apache.maven.archiva.configuration.ProxyConnectorConfiguration;
-import org.apache.maven.archiva.configuration.RepositoryGroupConfiguration;
-import org.codehaus.plexus.redback.role.RoleManager;
-import org.codehaus.plexus.redback.role.RoleManagerException;
-import org.codehaus.plexus.taskqueue.TaskQueueException;
-import org.codehaus.redback.components.scheduler.CronExpressionValidator;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.stereotype.Service;
-
-import javax.inject.Inject;
-import javax.inject.Named;
-import java.io.File;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-/**
- * FIXME remove all generic Exception to have usefull ones
- * FIXME review the staging mechanism to have a per user session one
- *
- * @author Olivier Lamy
- */
-@Service( "managedRepositoryAdmin#default" )
-public class DefaultManagedRepositoryAdmin
-    extends AbstractRepositoryAdmin
-    implements ManagedRepositoryAdmin
-{
-
-    public static final String REPOSITORY_LOCATION_VALID_EXPRESSION = "^[-a-zA-Z0-9._/~:?!&amp;=\\\\]+$";
-
-    private Logger log = LoggerFactory.getLogger( getClass() );
-
-    public static final String STAGE_REPO_ID_END = "-stage";
-
-
-    @Inject
-    @Named( value = "archivaTaskScheduler#repository" )
-    private RepositoryArchivaTaskScheduler repositoryTaskScheduler;
-
-    @Inject
-    private RepositorySessionFactory repositorySessionFactory;
-
-    @Inject
-    private RepositoryStatisticsManager repositoryStatisticsManager;
-
-
-    @Inject
-    protected RoleManager roleManager;
-
-    public List<ManagedRepository> getManagedRepositories()
-        throws RepositoryAdminException
-    {
-        List<ManagedRepositoryConfiguration> managedRepoConfigs =
-            getArchivaConfiguration().getConfiguration().getManagedRepositories();
-
-        List<ManagedRepository> managedRepos = new ArrayList<ManagedRepository>( managedRepoConfigs.size() );
-
-        for ( ManagedRepositoryConfiguration repoConfig : managedRepoConfigs )
-        {
-            // TODO add staging repo information back too
-            ManagedRepository repo =
-                new ManagedRepository( repoConfig.getId(), repoConfig.getName(), repoConfig.getLocation(),
-                                       repoConfig.getLayout(), repoConfig.isSnapshots(), repoConfig.isReleases(),
-                                       repoConfig.isBlockRedeployments(), repoConfig.getRefreshCronExpression(),
-                                       repoConfig.getIndexDir(), repoConfig.isScanned(), repoConfig.getDaysOlder(),
-                                       repoConfig.getRetentionCount(), repoConfig.isDeleteReleasedSnapshots() );
-
-            managedRepos.add( repo );
-        }
-
-        return managedRepos;
-    }
-
-    public Map<String, ManagedRepository> getManagedRepositoriesAsMap()
-        throws RepositoryAdminException
-    {
-        List<ManagedRepository> managedRepositories = getManagedRepositories();
-        Map<String, ManagedRepository> repositoriesMap =
-            new HashMap<String, ManagedRepository>( managedRepositories.size() );
-        for ( ManagedRepository managedRepository : managedRepositories )
-        {
-            repositoriesMap.put( managedRepository.getId(), managedRepository );
-        }
-        return repositoriesMap;
-    }
-
-    public ManagedRepository getManagedRepository( String repositoryId )
-        throws RepositoryAdminException
-    {
-        List<ManagedRepository> repos = getManagedRepositories();
-        for ( ManagedRepository repo : repos )
-        {
-            if ( StringUtils.equals( repo.getId(), repositoryId ) )
-            {
-                return repo;
-            }
-        }
-        return null;
-    }
-
-    public Boolean addManagedRepository( ManagedRepository managedRepository, boolean needStageRepo,
-                                         AuditInformation auditInformation )
-        throws RepositoryAdminException
-    {
-
-        getRepositoryCommonValidator().basicValidation( managedRepository, false );
-        triggerAuditEvent( managedRepository.getId(), null, AuditEvent.ADD_MANAGED_REPO, auditInformation );
-        return
-            addManagedRepository( managedRepository.getId(), managedRepository.getLayout(), managedRepository.getName(),
-                                  managedRepository.getLocation(), managedRepository.isBlockRedeployments(),
-                                  managedRepository.isReleases(), managedRepository.isSnapshots(), needStageRepo,
-                                  managedRepository.getCronExpression(), managedRepository.getIndexDirectory(),
-                                  managedRepository.getDaysOlder(), managedRepository.getRetentionCount(),
-                                  managedRepository.isDeleteReleasedSnapshots(), auditInformation,
-                                  getArchivaConfiguration().getConfiguration() ) != null;
-
-    }
-
-    private ManagedRepositoryConfiguration addManagedRepository( String repoId, String layout, String name,
-                                                                 String location, boolean blockRedeployments,
-                                                                 boolean releasesIncluded, boolean snapshotsIncluded,
-                                                                 boolean stageRepoNeeded, String cronExpression,
-                                                                 String indexDir, int daysOlder, int retentionCount,
-                                                                 boolean deteleReleasedSnapshots,
-                                                                 AuditInformation auditInformation,
-                                                                 Configuration config )
-        throws RepositoryAdminException
-    {
-
-        // FIXME : olamy can be empty to avoid scheduled scan ?
-        if ( StringUtils.isNotBlank( cronExpression ) )
-        {
-            CronExpressionValidator validator = new CronExpressionValidator();
-
-            if ( !validator.validate( cronExpression ) )
-            {
-                throw new RepositoryAdminException( "Invalid cron expression." );
-            }
-        }
-        else
-        {
-            throw new RepositoryAdminException( "Cron expression cannot be empty." );
-        }
-
-        String repoLocation = getRepositoryCommonValidator().removeExpressions( location );
-
-        if ( !GenericValidator.matchRegexp( repoLocation, REPOSITORY_LOCATION_VALID_EXPRESSION ) )
-        {
-            throw new RepositoryAdminException(
-                "Invalid repository location. Directory must only contain alphanumeric characters, equals(=), question-marks(?), "
-                    + "exclamation-points(!), ampersands(&amp;), forward-slashes(/), back-slashes(\\), underscores(_), dots(.), colons(:), tildes(~), and dashes(-)." );
-        }
-
-        ManagedRepositoryConfiguration repository = new ManagedRepositoryConfiguration();
-
-        repository.setId( repoId );
-        repository.setBlockRedeployments( blockRedeployments );
-        repository.setReleases( releasesIncluded );
-        repository.setSnapshots( snapshotsIncluded );
-        repository.setName( name );
-        repository.setLocation( repoLocation );
-        repository.setLayout( layout );
-        repository.setRefreshCronExpression( cronExpression );
-        repository.setIndexDir( indexDir );
-        repository.setDaysOlder( daysOlder );
-        repository.setRetentionCount( retentionCount );
-        repository.setDeleteReleasedSnapshots( deteleReleasedSnapshots );
-        try
-        {
-            addRepository( repository, config );
-            addRepositoryRoles( repository );
-
-            if ( stageRepoNeeded )
-            {
-                ManagedRepositoryConfiguration stagingRepository = getStageRepoConfig( repository );
-                addRepository( stagingRepository, config );
-                addRepositoryRoles( stagingRepository );
-                triggerAuditEvent( stagingRepository.getId(), null, AuditEvent.ADD_MANAGED_REPO, auditInformation );
-            }
-        }
-        catch ( RoleManagerException e )
-        {
-            throw new RepositoryAdminException( "failed to add repository roles " + e.getMessage(), e );
-        }
-        catch ( IOException e )
-        {
-            throw new RepositoryAdminException( "failed to add repository " + e.getMessage(), e );
-        }
-
-        saveConfiguration( config );
-
-        //MRM-1342 Repository statistics report doesn't appear to be working correctly
-        //scan repository when adding of repository is successful
-        try
-        {
-            scanRepository( repoId, true );
-            // olamy no need of scanning staged repo
-            /*
-            if ( stageRepoNeeded )
-            {
-                ManagedRepositoryConfiguration stagingRepository = getStageRepoConfig( repository );
-                scanRepository( stagingRepository.getId(), true );
-            }*/
-        }
-        catch ( Exception e )
-        {
-            log.warn( new StringBuilder( "Unable to scan repository [" ).append( repoId ).append( "]: " ).append(
-                e.getMessage() ).toString(), e );
-        }
-
-        return repository;
-    }
-
-
-    // FIXME cleanup repositoryGroups when deleting a ManagedRepo
-    public Boolean deleteManagedRepository( String repositoryId, AuditInformation auditInformation,
-                                            boolean deleteContent )
-        throws RepositoryAdminException
-    {
-        Configuration config = getArchivaConfiguration().getConfiguration();
-
-        ManagedRepositoryConfiguration repository = config.findManagedRepositoryById( repositoryId );
-
-        if ( repository == null )
-        {
-            throw new RepositoryAdminException( "A repository with that id does not exist" );
-        }
-
-        triggerAuditEvent( repositoryId, null, AuditEvent.DELETE_MANAGED_REPO, auditInformation );
-
-        deleteManagedRepository( repository, deleteContent, config, false );
-
-        // stage repo exists ?
-        ManagedRepositoryConfiguration stagingRepository =
-            getArchivaConfiguration().getConfiguration().findManagedRepositoryById( repositoryId + STAGE_REPO_ID_END );
-        if ( stagingRepository != null )
-        {
-            // do not trigger event when deleting the staged one
-            //triggerAuditEvent( stagingRepository.getId(), null, AuditEvent.DELETE_MANAGED_REPO, auditInformation );
-            deleteManagedRepository( stagingRepository, deleteContent, config, true );
-        }
-
-        try
-        {
-            saveConfiguration( config );
-        }
-        catch ( Exception e )
-        {
-            throw new RepositoryAdminException( "Error saving configuration for delete action" + e.getMessage() );
-        }
-
-        return Boolean.TRUE;
-    }
-
-    private Boolean deleteManagedRepository( ManagedRepositoryConfiguration repository, boolean deleteContent,
-                                             Configuration config, boolean stagedOne )
-        throws RepositoryAdminException
-    {
-        if ( !stagedOne )
-        {
-            RepositorySession repositorySession = getRepositorySessionFactory().createSession();
-            try
-            {
-                MetadataRepository metadataRepository = repositorySession.getRepository();
-                metadataRepository.removeRepository( repository.getId() );
-                log.debug( "call repositoryStatisticsManager.deleteStatistics" );
-                getRepositoryStatisticsManager().deleteStatistics( metadataRepository, repository.getId() );
-                repositorySession.save();
-            }
-            catch ( MetadataRepositoryException e )
-            {
-                throw new RepositoryAdminException( e.getMessage(), e );
-            }
-            finally
-            {
-                repositorySession.close();
-            }
-        }
-        config.removeManagedRepository( repository );
-
-        if ( deleteContent )
-        {
-            // TODO could be async ? as directory can be huge
-            File dir = new File( repository.getLocation() );
-            if ( !FileUtils.deleteQuietly( dir ) )
-            {
-                throw new RepositoryAdminException( "Cannot delete repository " + dir );
-            }
-        }
-
-        // olamy: copy list for reading as a unit test in webapp fail with ConcurrentModificationException
-        List<ProxyConnectorConfiguration> proxyConnectors =
-            new ArrayList<ProxyConnectorConfiguration>( config.getProxyConnectors() );
-        for ( ProxyConnectorConfiguration proxyConnector : proxyConnectors )
-        {
-            if ( StringUtils.equals( proxyConnector.getSourceRepoId(), repository.getId() ) )
-            {
-                config.removeProxyConnector( proxyConnector );
-            }
-        }
-
-        Map<String, List<String>> repoToGroupMap = config.getRepositoryToGroupMap();
-        if ( repoToGroupMap != null )
-        {
-            if ( repoToGroupMap.containsKey( repository.getId() ) )
-            {
-                List<String> repoGroups = repoToGroupMap.get( repository.getId() );
-                for ( String repoGroup : repoGroups )
-                {
-                    // copy to prevent UnsupportedOperationException
-                    RepositoryGroupConfiguration repositoryGroupConfiguration =
-                        config.findRepositoryGroupById( repoGroup );
-                    List<String> repos = new ArrayList<String>( repositoryGroupConfiguration.getRepositories() );
-                    config.removeRepositoryGroup( repositoryGroupConfiguration );
-                    repos.remove( repository.getId() );
-                    repositoryGroupConfiguration.setRepositories( repos );
-                    config.addRepositoryGroup( repositoryGroupConfiguration );
-                }
-            }
-        }
-
-        try
-        {
-            removeRepositoryRoles( repository );
-        }
-        catch ( RoleManagerException e )
-        {
-            throw new RepositoryAdminException(
-                "fail to remove repository roles for repository " + repository.getId() + " : " + e.getMessage(), e );
-        }
-
-        saveConfiguration( config );
-
-        return Boolean.TRUE;
-    }
-
-
-    public Boolean updateManagedRepository( ManagedRepository managedRepository, boolean needStageRepo,
-                                            AuditInformation auditInformation, boolean resetStats )
-        throws RepositoryAdminException
-    {
-
-        log.debug( "updateManagedConfiguration repo {} needStage {} resetStats {} ",
-                   Arrays.asList( managedRepository, needStageRepo, resetStats ).toArray() );
-
-        // Ensure that the fields are valid.
-
-        getRepositoryCommonValidator().basicValidation( managedRepository, true );
-
-        Configuration configuration = getArchivaConfiguration().getConfiguration();
-
-        ManagedRepositoryConfiguration toremove = configuration.findManagedRepositoryById( managedRepository.getId() );
-
-        if ( toremove != null )
-        {
-            configuration.removeManagedRepository( toremove );
-        }
-
-        ManagedRepositoryConfiguration stagingRepository = getStageRepoConfig( toremove );
-
-        // TODO remove content from old if path has changed !!!!!
-
-        if ( stagingRepository != null )
-        {
-            configuration.removeManagedRepository( stagingRepository );
-        }
-
-        ManagedRepositoryConfiguration managedRepositoryConfiguration =
-            addManagedRepository( managedRepository.getId(), managedRepository.getLayout(), managedRepository.getName(),
-                                  managedRepository.getLocation(), managedRepository.isBlockRedeployments(),
-                                  managedRepository.isReleases(), managedRepository.isSnapshots(), needStageRepo,
-                                  managedRepository.getCronExpression(), managedRepository.getIndexDirectory(),
-                                  managedRepository.getDaysOlder(), managedRepository.getRetentionCount(),
-                                  managedRepository.isDeleteReleasedSnapshots(), auditInformation,
-                                  getArchivaConfiguration().getConfiguration() );
-
-        // Save the repository configuration.
-        RepositorySession repositorySession = getRepositorySessionFactory().createSession();
-
-        try
-        {
-            triggerAuditEvent( managedRepositoryConfiguration.getId(), null, AuditEvent.MODIFY_MANAGED_REPO,
-                               auditInformation );
-
-            saveConfiguration( this.getArchivaConfiguration().getConfiguration() );
-            if ( resetStats )
-            {
-                log.debug( "call repositoryStatisticsManager.deleteStatistics" );
-                getRepositoryStatisticsManager().deleteStatistics( repositorySession.getRepository(),
-                                                                   managedRepositoryConfiguration.getId() );
-                repositorySession.save();
-            }
-
-        }
-        catch ( MetadataRepositoryException e )
-        {
-            throw new RepositoryAdminException( e.getMessage(), e );
-        }
-        finally
-        {
-            repositorySession.close();
-        }
-
-        return true;
-    }
-
-    //--------------------------
-    // utils methods
-    //--------------------------
-
-
-    protected void addRepository( ManagedRepositoryConfiguration repository, Configuration configuration )
-        throws RepositoryAdminException, IOException
-    {
-        // Normalize the path
-        File file = new File( repository.getLocation() );
-        repository.setLocation( file.getCanonicalPath() );
-        if ( !file.exists() )
-        {
-            file.mkdirs();
-        }
-        if ( !file.exists() || !file.isDirectory() )
-        {
-            throw new RepositoryAdminException(
-                "Unable to add repository - no write access, can not create the root directory: " + file );
-        }
-
-        configuration.addManagedRepository( repository );
-    }
-
-    private ManagedRepositoryConfiguration getStageRepoConfig( ManagedRepositoryConfiguration repository )
-    {
-        ManagedRepositoryConfiguration stagingRepository = new ManagedRepositoryConfiguration();
-        stagingRepository.setId( repository.getId() + STAGE_REPO_ID_END );
-        stagingRepository.setLayout( repository.getLayout() );
-        stagingRepository.setName( repository.getName() + STAGE_REPO_ID_END );
-        stagingRepository.setBlockRedeployments( repository.isBlockRedeployments() );
-        stagingRepository.setDaysOlder( repository.getDaysOlder() );
-        stagingRepository.setDeleteReleasedSnapshots( repository.isDeleteReleasedSnapshots() );
-        stagingRepository.setIndexDir( repository.getIndexDir() );
-        String path = repository.getLocation();
-        int lastIndex = path.lastIndexOf( '/' );
-        stagingRepository.setLocation( path.substring( 0, lastIndex ) + "/" + stagingRepository.getId() );
-        stagingRepository.setRefreshCronExpression( repository.getRefreshCronExpression() );
-        stagingRepository.setReleases( repository.isReleases() );
-        stagingRepository.setRetentionCount( repository.getRetentionCount() );
-        stagingRepository.setScanned( repository.isScanned() );
-        stagingRepository.setSnapshots( repository.isSnapshots() );
-        return stagingRepository;
-    }
-
-    public Boolean scanRepository( String repositoryId, boolean fullScan )
-    {
-        if ( getRepositoryTaskScheduler().isProcessingRepositoryTask( repositoryId ) )
-        {
-            log.info( "scanning of repository with id {} already scheduled", repositoryId );
-        }
-        RepositoryTask task = new RepositoryTask();
-        task.setRepositoryId( repositoryId );
-        task.setScanAll( fullScan );
-        try
-        {
-            getRepositoryTaskScheduler().queueTask( task );
-        }
-        catch ( TaskQueueException e )
-        {
-            log.error( "failed to schedule scanning of repo with id {}", repositoryId, e );
-            return false;
-        }
-        return true;
-    }
-
-    protected void addRepositoryRoles( ManagedRepositoryConfiguration newRepository )
-        throws RoleManagerException
-    {
-        String repoId = newRepository.getId();
-
-        // TODO: double check these are configured on start up
-        // TODO: belongs in the business logic
-
-        if ( !getRoleManager().templatedRoleExists( ArchivaRoleConstants.TEMPLATE_REPOSITORY_OBSERVER, repoId ) )
-        {
-            getRoleManager().createTemplatedRole( ArchivaRoleConstants.TEMPLATE_REPOSITORY_OBSERVER, repoId );
-        }
-
-        if ( !getRoleManager().templatedRoleExists( ArchivaRoleConstants.TEMPLATE_REPOSITORY_MANAGER, repoId ) )
-        {
-            getRoleManager().createTemplatedRole( ArchivaRoleConstants.TEMPLATE_REPOSITORY_MANAGER, repoId );
-        }
-    }
-
-    protected void removeRepositoryRoles( ManagedRepositoryConfiguration existingRepository )
-        throws RoleManagerException
-    {
-        String repoId = existingRepository.getId();
-
-        if ( getRoleManager().templatedRoleExists( ArchivaRoleConstants.TEMPLATE_REPOSITORY_MANAGER, repoId ) )
-        {
-            getRoleManager().removeTemplatedRole( ArchivaRoleConstants.TEMPLATE_REPOSITORY_MANAGER, repoId );
-        }
-
-        if ( getRoleManager().templatedRoleExists( ArchivaRoleConstants.TEMPLATE_REPOSITORY_OBSERVER, repoId ) )
-        {
-            getRoleManager().removeTemplatedRole( ArchivaRoleConstants.TEMPLATE_REPOSITORY_OBSERVER, repoId );
-        }
-
-        log.debug( "removed user roles associated with repository {}", repoId );
-    }
-
-    //--------------------------
-    // setters/getters
-    //--------------------------
-
-
-    public RoleManager getRoleManager()
-    {
-        return roleManager;
-    }
-
-    public void setRoleManager( RoleManager roleManager )
-    {
-        this.roleManager = roleManager;
-    }
-
-    public RepositoryStatisticsManager getRepositoryStatisticsManager()
-    {
-        return repositoryStatisticsManager;
-    }
-
-    public void setRepositoryStatisticsManager( RepositoryStatisticsManager repositoryStatisticsManager )
-    {
-        this.repositoryStatisticsManager = repositoryStatisticsManager;
-    }
-
-    public RepositorySessionFactory getRepositorySessionFactory()
-    {
-        return repositorySessionFactory;
-    }
-
-    public void setRepositorySessionFactory( RepositorySessionFactory repositorySessionFactory )
-    {
-        this.repositorySessionFactory = repositorySessionFactory;
-    }
-
-
-    public RepositoryArchivaTaskScheduler getRepositoryTaskScheduler()
-    {
-        return repositoryTaskScheduler;
-    }
-
-    public void setRepositoryTaskScheduler( RepositoryArchivaTaskScheduler repositoryTaskScheduler )
-    {
-        this.repositoryTaskScheduler = repositoryTaskScheduler;
-    }
-}
diff --git a/archiva-modules/archiva-base/archiva-repository-admin/src/main/java/org/apache/archiva/admin/repository/managed/ManagedRepository.java b/archiva-modules/archiva-base/archiva-repository-admin/src/main/java/org/apache/archiva/admin/repository/managed/ManagedRepository.java
deleted file mode 100644 (file)
index a47d109..0000000
+++ /dev/null
@@ -1,232 +0,0 @@
-package org.apache.archiva.admin.repository.managed;
-
-/*
- * 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.admin.repository.AbstractRepository;
-
-import java.io.Serializable;
-
-/**
- * @author Olivier Lamy
- * @since 1.4
- */
-public class ManagedRepository
-    extends AbstractRepository
-    implements Serializable
-{
-
-    private String location;
-
-    private boolean snapshots = false;
-
-    private boolean releases = true;
-
-    private boolean blockRedeployments = false;
-
-    /**
-     * default model value
-     */
-    private String cronExpression = "0 0 * * * ?";
-
-
-    /**
-     * not need when creating the repo : only available when reading
-     */
-    private ManagedRepository stagingRepository;
-
-    private boolean scanned = true;
-
-    private String indexDirectory;
-
-    /**
-     * default model value
-     */
-    private int daysOlder = 100;
-
-    /**
-     * default model value
-     */
-    private int retentionCount = 2;
-
-    private boolean deleteReleasedSnapshots;
-
-    public ManagedRepository()
-    {
-        // no op
-    }
-
-    public ManagedRepository( String id, String name, String location, String layout, boolean snapshots,
-                              boolean releases, boolean blockRedeployments, String cronExpression, String indexDir,
-                              boolean scanned, int daysOlder, int retentionCount, boolean deleteReleasedSnapshots )
-    {
-        super(id, name, layout);
-
-        this.location = location;
-        this.snapshots = snapshots;
-        this.releases = releases;
-        this.blockRedeployments = blockRedeployments;
-        this.cronExpression = cronExpression;
-        this.indexDirectory = indexDir;
-        this.scanned = scanned;
-        this.daysOlder = daysOlder;
-        this.retentionCount = retentionCount;
-        this.deleteReleasedSnapshots = deleteReleasedSnapshots;
-    }
-
-    public String getLocation()
-    {
-        return this.location;
-    }
-
-
-    public boolean isReleases()
-    {
-        return this.releases;
-    }
-
-    /**
-     * Get null
-     */
-    public boolean isSnapshots()
-    {
-        return this.snapshots;
-    }
-
-
-    public void setReleases( boolean releases )
-    {
-        this.releases = releases;
-    }
-
-    public void setSnapshots( boolean snapshots )
-    {
-        this.snapshots = snapshots;
-    }
-
-    public void setLocation( String location )
-    {
-        this.location = location;
-    }
-
-    public boolean isBlockRedeployments()
-    {
-        return blockRedeployments;
-    }
-
-    public void setBlockRedeployments( boolean blockRedeployments )
-    {
-        this.blockRedeployments = blockRedeployments;
-    }
-
-    public String getCronExpression()
-    {
-        return cronExpression;
-    }
-
-    public void setCronExpression( String cronExpression )
-    {
-        this.cronExpression = cronExpression;
-    }
-
-    public ManagedRepository getStagingRepository()
-    {
-        return stagingRepository;
-    }
-
-
-    public void setStagingRepository( ManagedRepository stagingRepository )
-    {
-        this.stagingRepository = stagingRepository;
-    }
-
-    public boolean isScanned()
-    {
-        return scanned;
-    }
-
-    public void setScanned( boolean scanned )
-    {
-        this.scanned = scanned;
-    }
-
-    public String getIndexDirectory()
-    {
-        return indexDirectory;
-    }
-
-    public void setIndexDirectory( String indexDirectory )
-    {
-        this.indexDirectory = indexDirectory;
-    }
-
-    public int getDaysOlder()
-    {
-        return daysOlder;
-    }
-
-    public void setDaysOlder( int daysOlder )
-    {
-        this.daysOlder = daysOlder;
-    }
-
-    public int getRetentionCount()
-    {
-        return retentionCount;
-    }
-
-    public void setRetentionCount( int retentionCount )
-    {
-        this.retentionCount = retentionCount;
-    }
-
-    public boolean isDeleteReleasedSnapshots()
-    {
-        return deleteReleasedSnapshots;
-    }
-
-    public void setDeleteReleasedSnapshots( boolean deleteReleasedSnapshots )
-    {
-        this.deleteReleasedSnapshots = deleteReleasedSnapshots;
-    }
-
-
-    @Override
-    public String toString()
-    {
-        final StringBuilder sb = new StringBuilder();
-        sb.append( "ManagedRepository" );
-        sb.append( "{location='" ).append( location ).append( '\'' );
-        sb.append( ", snapshots=" ).append( snapshots );
-        sb.append( ", releases=" ).append( releases );
-        sb.append( ", blockRedeployments=" ).append( blockRedeployments );
-        sb.append( ", cronExpression='" ).append( cronExpression ).append( '\'' );
-        sb.append( ", stagingRepository=" ).append( stagingRepository );
-        sb.append( ", scanned=" ).append( scanned );
-        sb.append( ", indexDirectory='" ).append( indexDirectory ).append( '\'' );
-        sb.append( ", daysOlder=" ).append( daysOlder );
-        sb.append( ", retentionCount=" ).append( retentionCount );
-        sb.append( ", deleteReleasedSnapshots=" ).append( deleteReleasedSnapshots );
-        sb.append( '}' );
-        sb.append( super.toString() );
-        return sb.toString();
-    }
-
-
-}
\ No newline at end of file
diff --git a/archiva-modules/archiva-base/archiva-repository-admin/src/main/java/org/apache/archiva/admin/repository/managed/ManagedRepositoryAdmin.java b/archiva-modules/archiva-base/archiva-repository-admin/src/main/java/org/apache/archiva/admin/repository/managed/ManagedRepositoryAdmin.java
deleted file mode 100644 (file)
index 8f9e2cd..0000000
+++ /dev/null
@@ -1,56 +0,0 @@
-package org.apache.archiva.admin.repository.managed;
-/*
- * 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.admin.AuditInformation;
-import org.apache.archiva.admin.repository.RepositoryAdminException;
-
-import java.util.List;
-import java.util.Map;
-
-/**
- * @author Olivier Lamy
- * @since 1.4
- */
-public interface ManagedRepositoryAdmin
-{
-    List<ManagedRepository> getManagedRepositories()
-        throws RepositoryAdminException;
-
-    Map<String, ManagedRepository> getManagedRepositoriesAsMap()
-        throws RepositoryAdminException;
-
-    ManagedRepository getManagedRepository( String repositoryId )
-        throws RepositoryAdminException;
-
-    Boolean deleteManagedRepository( String repositoryId, AuditInformation auditInformation, boolean deleteContent )
-        throws RepositoryAdminException;
-
-    Boolean addManagedRepository( ManagedRepository managedRepository, boolean needStageRepo,
-                                  AuditInformation auditInformation )
-        throws RepositoryAdminException;
-
-
-    Boolean updateManagedRepository( ManagedRepository managedRepository, boolean needStageRepo,
-                                     AuditInformation auditInformation, boolean resetStats )
-        throws RepositoryAdminException;
-
-
-}
diff --git a/archiva-modules/archiva-base/archiva-repository-admin/src/main/java/org/apache/archiva/admin/repository/networkproxy/DefaultNetworkProxyAdmin.java b/archiva-modules/archiva-base/archiva-repository-admin/src/main/java/org/apache/archiva/admin/repository/networkproxy/DefaultNetworkProxyAdmin.java
deleted file mode 100644 (file)
index b2dcdd0..0000000
+++ /dev/null
@@ -1,143 +0,0 @@
-package org.apache.archiva.admin.repository.networkproxy;
-/*
- * 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 net.sf.beanlib.provider.replicator.BeanReplicator;
-import org.apache.archiva.admin.AuditInformation;
-import org.apache.archiva.admin.repository.AbstractRepositoryAdmin;
-import org.apache.archiva.admin.repository.RepositoryAdminException;
-import org.apache.archiva.audit.AuditEvent;
-import org.apache.commons.lang.StringUtils;
-import org.apache.maven.archiva.configuration.Configuration;
-import org.apache.maven.archiva.configuration.NetworkProxyConfiguration;
-import org.springframework.stereotype.Service;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * @author Olivier Lamy
- * @since 1.4
- */
-@Service( "networkProxyAdmin#default" )
-public class DefaultNetworkProxyAdmin
-    extends AbstractRepositoryAdmin
-    implements NetworkProxyAdmin
-{
-
-    public List<NetworkProxy> getNetworkProxies()
-        throws RepositoryAdminException
-    {
-        List<NetworkProxy> networkProxies = new ArrayList<NetworkProxy>();
-        for ( NetworkProxyConfiguration networkProxyConfiguration : getArchivaConfiguration().getConfiguration().getNetworkProxies() )
-        {
-            networkProxies.add( getNetworkProxy( networkProxyConfiguration ) );
-        }
-        return networkProxies;
-    }
-
-    public NetworkProxy getNetworkProxy( String networkProxyId )
-        throws RepositoryAdminException
-    {
-        for ( NetworkProxy networkProxy : getNetworkProxies() )
-        {
-            if ( StringUtils.equals( networkProxyId, networkProxy.getId() ) )
-            {
-                return networkProxy;
-            }
-        }
-
-        return null;
-    }
-
-    public void addNetworkProxy( NetworkProxy networkProxy, AuditInformation auditInformation )
-        throws RepositoryAdminException
-    {
-        if ( networkProxy == null )
-        {
-            return;
-        }
-        if ( getNetworkProxy( networkProxy.getId() ) != null )
-        {
-            throw new RepositoryAdminException(
-                "cannot add NetworkProxy with id " + networkProxy.getId() + " already exist" );
-        }
-        Configuration configuration = getArchivaConfiguration().getConfiguration();
-        configuration.addNetworkProxy( getNetworkProxyConfiguration( networkProxy ) );
-
-        triggerAuditEvent( networkProxy.getId(), null, AuditEvent.ADD_NETWORK_PROXY, auditInformation );
-
-        saveConfiguration( configuration );
-    }
-
-    public void updateNetworkProxy( NetworkProxy networkProxy, AuditInformation auditInformation )
-        throws RepositoryAdminException
-    {
-        if ( networkProxy == null )
-        {
-            return;
-        }
-        if ( getNetworkProxy( networkProxy.getId() ) == null )
-        {
-            throw new RepositoryAdminException(
-                "cannot update NetworkProxy with id " + networkProxy.getId() + " as not exist" );
-        }
-        Configuration configuration = getArchivaConfiguration().getConfiguration();
-        NetworkProxyConfiguration networkProxyConfiguration = getNetworkProxyConfiguration( networkProxy );
-        configuration.removeNetworkProxy( networkProxyConfiguration );
-        configuration.addNetworkProxy( networkProxyConfiguration );
-
-        triggerAuditEvent( networkProxy.getId(), null, AuditEvent.MODIFY_NETWORK_PROXY, auditInformation );
-
-        saveConfiguration( configuration );
-    }
-
-    public void deleteNetworkProxy( String networkProxyId, AuditInformation auditInformation )
-        throws RepositoryAdminException
-    {
-
-        NetworkProxy networkProxy = getNetworkProxy( networkProxyId );
-        if ( networkProxy == null )
-        {
-            throw new RepositoryAdminException(
-                "cannot delete NetworkProxy with id " + networkProxyId + " as not exist" );
-        }
-        Configuration configuration = getArchivaConfiguration().getConfiguration();
-        NetworkProxyConfiguration networkProxyConfiguration = getNetworkProxyConfiguration( networkProxy );
-        configuration.removeNetworkProxy( networkProxyConfiguration );
-
-        triggerAuditEvent( networkProxy.getId(), null, AuditEvent.DELETE_NETWORK_PROXY, auditInformation );
-
-        saveConfiguration( configuration );
-    }
-
-    protected NetworkProxy getNetworkProxy( NetworkProxyConfiguration networkProxyConfiguration )
-    {
-        return networkProxyConfiguration == null
-            ? null
-            : new BeanReplicator().replicateBean( networkProxyConfiguration, NetworkProxy.class );
-    }
-
-    protected NetworkProxyConfiguration getNetworkProxyConfiguration( NetworkProxy networkProxy )
-    {
-        return networkProxy == null
-            ? null
-            : new BeanReplicator().replicateBean( networkProxy, NetworkProxyConfiguration.class );
-    }
-}
diff --git a/archiva-modules/archiva-base/archiva-repository-admin/src/main/java/org/apache/archiva/admin/repository/networkproxy/NetworkProxy.java b/archiva-modules/archiva-base/archiva-repository-admin/src/main/java/org/apache/archiva/admin/repository/networkproxy/NetworkProxy.java
deleted file mode 100644 (file)
index ec5250b..0000000
+++ /dev/null
@@ -1,177 +0,0 @@
-package org.apache.archiva.admin.repository.networkproxy;
-/*
- * 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 java.io.Serializable;
-
-/**
- * @author Olivier Lamy
- * @since 1.4
- */
-public class NetworkProxy
-    implements Serializable
-{
-    private String id;
-
-    /**
-     * The network protocol to use with this proxy: "http", "socks-4"
-     * .
-     */
-    private String protocol = "http";
-
-    /**
-     * The proxy host.
-     */
-    private String host;
-
-    /**
-     * The proxy port.
-     */
-    private int port = 8080;
-
-    /**
-     * The proxy user.
-     */
-    private String username;
-
-    /**
-     * The proxy password.
-     */
-    private String password;
-
-    public NetworkProxy()
-    {
-        // no op
-    }
-
-    public NetworkProxy( String id, String protocol, String host, int port, String username, String password )
-    {
-        this.id = id;
-        this.protocol = protocol;
-        this.host = host;
-        this.port = port;
-        this.username = username;
-        this.password = password;
-    }
-
-    public String getId()
-    {
-        return id;
-    }
-
-    public void setId( String id )
-    {
-        this.id = id;
-    }
-
-    public String getProtocol()
-    {
-        return protocol;
-    }
-
-    public void setProtocol( String protocol )
-    {
-        this.protocol = protocol;
-    }
-
-    public String getHost()
-    {
-        return host;
-    }
-
-    public void setHost( String host )
-    {
-        this.host = host;
-    }
-
-    public int getPort()
-    {
-        return port;
-    }
-
-    public void setPort( int port )
-    {
-        this.port = port;
-    }
-
-    public String getUsername()
-    {
-        return username;
-    }
-
-    public void setUsername( String username )
-    {
-        this.username = username;
-    }
-
-    public String getPassword()
-    {
-        return password;
-    }
-
-    public void setPassword( String password )
-    {
-        this.password = password;
-    }
-
-    @Override
-    public boolean equals( Object o )
-    {
-        if ( this == o )
-        {
-            return true;
-        }
-        if ( o == null || getClass() != o.getClass() )
-        {
-            return false;
-        }
-
-        NetworkProxy that = (NetworkProxy) o;
-
-        if ( id != null ? !id.equals( that.id ) : that.id != null )
-        {
-            return false;
-        }
-
-        return true;
-    }
-
-    @Override
-    public int hashCode()
-    {
-        int result = 17;
-        result = 37 * result + ( id != null ? id.hashCode() : 0 );
-        return result;
-    }
-
-    @Override
-    public String toString()
-    {
-        final StringBuilder sb = new StringBuilder();
-        sb.append( "NetworkProxy" );
-        sb.append( "{id='" ).append( id ).append( '\'' );
-        sb.append( ", protocol='" ).append( protocol ).append( '\'' );
-        sb.append( ", host='" ).append( host ).append( '\'' );
-        sb.append( ", port=" ).append( port );
-        sb.append( ", username='" ).append( username ).append( '\'' );
-        sb.append( ", password='" ).append( password ).append( '\'' );
-        sb.append( '}' );
-        return sb.toString();
-    }
-}
diff --git a/archiva-modules/archiva-base/archiva-repository-admin/src/main/java/org/apache/archiva/admin/repository/networkproxy/NetworkProxyAdmin.java b/archiva-modules/archiva-base/archiva-repository-admin/src/main/java/org/apache/archiva/admin/repository/networkproxy/NetworkProxyAdmin.java
deleted file mode 100644 (file)
index e8c0a01..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-package org.apache.archiva.admin.repository.networkproxy;
-/*
- * 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.admin.AuditInformation;
-import org.apache.archiva.admin.repository.RepositoryAdminException;
-
-import java.util.List;
-
-/**
- * @author Olivier Lamy
- * @since 1.4
- */
-public interface NetworkProxyAdmin
-{
-    List<NetworkProxy> getNetworkProxies()
-        throws RepositoryAdminException;
-
-    NetworkProxy getNetworkProxy( String networkProxyId )
-        throws RepositoryAdminException;
-
-    void addNetworkProxy( NetworkProxy networkProxy, AuditInformation auditInformation )
-        throws RepositoryAdminException;
-
-    void updateNetworkProxy( NetworkProxy networkProxy, AuditInformation auditInformation )
-        throws RepositoryAdminException;
-
-    void deleteNetworkProxy( String networkProxyId, AuditInformation auditInformation )
-        throws RepositoryAdminException;
-}
diff --git a/archiva-modules/archiva-base/archiva-repository-admin/src/main/java/org/apache/archiva/admin/repository/proxyconnector/DefaultProxyConnectorAdmin.java b/archiva-modules/archiva-base/archiva-repository-admin/src/main/java/org/apache/archiva/admin/repository/proxyconnector/DefaultProxyConnectorAdmin.java
deleted file mode 100644 (file)
index 7b77cfd..0000000
+++ /dev/null
@@ -1,251 +0,0 @@
-package org.apache.archiva.admin.repository.proxyconnector;
-/*
- * 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 net.sf.beanlib.provider.replicator.BeanReplicator;
-import org.apache.archiva.admin.AuditInformation;
-import org.apache.archiva.admin.repository.AbstractRepositoryAdmin;
-import org.apache.archiva.admin.repository.RepositoryAdminException;
-import org.apache.archiva.admin.repository.managed.ManagedRepositoryAdmin;
-import org.apache.archiva.admin.repository.remote.RemoteRepositoryAdmin;
-import org.apache.archiva.audit.AuditEvent;
-import org.apache.commons.collections.CollectionUtils;
-import org.apache.commons.lang.StringUtils;
-import org.apache.maven.archiva.configuration.Configuration;
-import org.apache.maven.archiva.configuration.ProxyConnectorConfiguration;
-import org.apache.maven.archiva.configuration.functors.ProxyConnectorSelectionPredicate;
-import org.springframework.stereotype.Service;
-
-import javax.inject.Inject;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-/**
- * @author Olivier Lamy
- * @since 1.4
- */
-@Service( "proxyConnectorAdmin#default" )
-public class DefaultProxyConnectorAdmin
-    extends AbstractRepositoryAdmin
-    implements ProxyConnectorAdmin
-{
-
-    @Inject
-    private ManagedRepositoryAdmin managedRepositoryAdmin;
-
-    @Inject
-    private RemoteRepositoryAdmin remoteRepositoryAdmin;
-
-    public List<ProxyConnector> getProxyConnectors()
-        throws RepositoryAdminException
-    {
-        List<ProxyConnectorConfiguration> proxyConnectorConfigurations =
-            getArchivaConfiguration().getConfiguration().getProxyConnectors();
-        List<ProxyConnector> proxyConnectors = new ArrayList<ProxyConnector>( proxyConnectorConfigurations.size() );
-        for ( ProxyConnectorConfiguration configuration : proxyConnectorConfigurations )
-        {
-            proxyConnectors.add( getProxyConnector( configuration ) );
-        }
-
-        return proxyConnectors;
-    }
-
-    public ProxyConnector getProxyConnector( String sourceRepoId, String targetRepoId )
-        throws RepositoryAdminException
-    {
-        for ( ProxyConnector proxyConnector : getProxyConnectors() )
-        {
-            if ( StringUtils.equals( sourceRepoId, proxyConnector.getSourceRepoId() ) && StringUtils.equals(
-                targetRepoId, proxyConnector.getTargetRepoId() ) )
-            {
-                return proxyConnector;
-            }
-        }
-        return null;
-    }
-
-    public Boolean addProxyConnector( ProxyConnector proxyConnector, AuditInformation auditInformation )
-        throws RepositoryAdminException
-    {
-        if ( getProxyConnector( proxyConnector.getSourceRepoId(), proxyConnector.getTargetRepoId() ) != null )
-        {
-            throw new RepositoryAdminException(
-                "Unable to add proxy connector, as one already exists with source repository id ["
-                    + proxyConnector.getSourceRepoId() + "] and target repository id ["
-                    + proxyConnector.getTargetRepoId() + "]." );
-        }
-
-        validateProxyConnector( proxyConnector );
-
-        proxyConnector.setBlackListPatterns( unescapePatterns( proxyConnector.getBlackListPatterns() ) );
-        proxyConnector.setWhiteListPatterns( unescapePatterns( proxyConnector.getWhiteListPatterns() ) );
-
-        Configuration configuration = getArchivaConfiguration().getConfiguration();
-
-        ProxyConnectorConfiguration proxyConnectorConfiguration = getProxyConnectorConfiguration( proxyConnector );
-        configuration.addProxyConnector( proxyConnectorConfiguration );
-        saveConfiguration( configuration );
-        triggerAuditEvent( proxyConnector.getSourceRepoId() + "-" + proxyConnector.getTargetRepoId(), null,
-                           AuditEvent.ADD_PROXY_CONNECTOR, auditInformation );
-        return Boolean.TRUE;
-
-    }
-
-    public Boolean deleteProxyConnector( ProxyConnector proxyConnector, AuditInformation auditInformation )
-        throws RepositoryAdminException
-    {
-        Configuration configuration = getArchivaConfiguration().getConfiguration();
-        ProxyConnectorConfiguration proxyConnectorConfiguration =
-            findProxyConnector( proxyConnector.getSourceRepoId(), proxyConnector.getTargetRepoId(), configuration );
-        if ( proxyConnectorConfiguration == null )
-        {
-            throw new RepositoryAdminException(
-                "unable to find ProxyConnector with source " + proxyConnector.getSourceRepoId() + " and target "
-                    + proxyConnector.getTargetRepoId() );
-        }
-        configuration.removeProxyConnector( proxyConnectorConfiguration );
-        saveConfiguration( configuration );
-        triggerAuditEvent( proxyConnector.getSourceRepoId() + "-" + proxyConnector.getTargetRepoId(), null,
-                           AuditEvent.DELETE_PROXY_CONNECTOR, auditInformation );
-        return Boolean.TRUE;
-    }
-
-    public Boolean updateProxyConnector( ProxyConnector proxyConnector, AuditInformation auditInformation )
-        throws RepositoryAdminException
-    {
-        Configuration configuration = getArchivaConfiguration().getConfiguration();
-        ProxyConnectorConfiguration proxyConnectorConfiguration =
-            findProxyConnector( proxyConnector.getSourceRepoId(), proxyConnector.getTargetRepoId(), configuration );
-        configuration.removeProxyConnector( proxyConnectorConfiguration );
-        configuration.addProxyConnector( getProxyConnectorConfiguration( proxyConnector ) );
-        triggerAuditEvent( proxyConnector.getSourceRepoId() + "-" + proxyConnector.getTargetRepoId(), null,
-                           AuditEvent.MODIFY_PROXY_CONNECTOR, auditInformation );
-        return Boolean.TRUE;
-    }
-
-    protected List<String> unescapePatterns( List<String> patterns )
-    {
-        List<String> rawPatterns = new ArrayList<String>();
-        if ( patterns != null )
-        {
-            for ( String pattern : patterns )
-            {
-                rawPatterns.add( StringUtils.replace( pattern, "\\\\", "\\" ) );
-            }
-        }
-
-        return rawPatterns;
-    }
-
-    public Map<String, List<ProxyConnector>> getProxyConnectorAsMap()
-        throws RepositoryAdminException
-    {
-        Map<String, List<ProxyConnector>> proxyConnectorMap = new HashMap<String, java.util.List<ProxyConnector>>();
-
-        Iterator<ProxyConnector> it = getProxyConnectors().iterator();
-        while ( it.hasNext() )
-        {
-            ProxyConnector proxyConfig = it.next();
-            String key = proxyConfig.getSourceRepoId();
-
-            List<ProxyConnector> connectors = proxyConnectorMap.get( key );
-            if ( connectors == null )
-            {
-                connectors = new ArrayList<ProxyConnector>();
-                proxyConnectorMap.put( key, connectors );
-            }
-
-            connectors.add( proxyConfig );
-
-            Collections.sort( connectors, ProxyConnectorOrderComparator.getInstance() );
-        }
-
-        return proxyConnectorMap;
-    }
-
-    private ProxyConnectorConfiguration findProxyConnector( String sourceId, String targetId,
-                                                            Configuration configuration )
-    {
-        if ( StringUtils.isBlank( sourceId ) )
-        {
-            return null;
-        }
-
-        if ( StringUtils.isBlank( targetId ) )
-        {
-            return null;
-        }
-
-        ProxyConnectorSelectionPredicate selectedProxy = new ProxyConnectorSelectionPredicate( sourceId, targetId );
-        return (ProxyConnectorConfiguration) CollectionUtils.find( configuration.getProxyConnectors(), selectedProxy );
-    }
-
-    protected ProxyConnectorConfiguration getProxyConnectorConfiguration( ProxyConnector proxyConnector )
-    {
-        /*
-        ProxyConnectorConfiguration proxyConnectorConfiguration = new ProxyConnectorConfiguration();
-        proxyConnectorConfiguration.setOrder( proxyConnector.getOrder() );
-        proxyConnectorConfiguration.setBlackListPatterns(
-            new ArrayList<String>( proxyConnector.getBlackListPatterns() ) );
-        proxyConnectorConfiguration.setWhiteListPatterns(
-            new ArrayList<String>( proxyConnector.getWhiteListPatterns() ) );
-        proxyConnectorConfiguration.setDisabled( proxyConnector.isDisabled() );
-        proxyConnectorConfiguration.setPolicies( new HashMap( proxyConnector.getPolicies() ) );
-        proxyConnectorConfiguration.setProperties( new HashMap( proxyConnector.getProperties() ) );
-        proxyConnectorConfiguration.setProxyId( proxyConnector.getProxyId() );
-        proxyConnectorConfiguration.setSourceRepoId( proxyConnector.getSourceRepoId() );
-        proxyConnectorConfiguration.setTargetRepoId( proxyConnector.getTargetRepoId() );
-        return proxyConnectorConfiguration;*/
-
-        return proxyConnector == null
-            ? null
-            : new BeanReplicator().replicateBean( proxyConnector, ProxyConnectorConfiguration.class );
-    }
-
-    protected ProxyConnector getProxyConnector( ProxyConnectorConfiguration proxyConnectorConfiguration )
-    {
-        return proxyConnectorConfiguration == null
-            ? null
-            : new BeanReplicator().replicateBean( proxyConnectorConfiguration, ProxyConnector.class );
-    }
-
-    protected void validateProxyConnector( ProxyConnector proxyConnector )
-        throws RepositoryAdminException
-    {
-        // validate source a Managed target a Remote
-        if ( managedRepositoryAdmin.getManagedRepository( proxyConnector.getSourceRepoId() ) == null )
-        {
-            throw new RepositoryAdminException(
-                "non valid ProxyConnector sourceRepo with id " + proxyConnector.getSourceRepoId()
-                    + " is not a ManagedRepository" );
-        }
-        if ( remoteRepositoryAdmin.getRemoteRepository( proxyConnector.getTargetRepoId() ) == null )
-        {
-            throw new RepositoryAdminException(
-                "non valid ProxyConnector sourceRepo with id " + proxyConnector.getTargetRepoId()
-                    + " is not a RemoteRepository" );
-        }
-
-        // FIXME validate NetworkProxyConfiguration too when available
-    }
-}
diff --git a/archiva-modules/archiva-base/archiva-repository-admin/src/main/java/org/apache/archiva/admin/repository/proxyconnector/ProxyConnector.java b/archiva-modules/archiva-base/archiva-repository-admin/src/main/java/org/apache/archiva/admin/repository/proxyconnector/ProxyConnector.java
deleted file mode 100644 (file)
index 67a7672..0000000
+++ /dev/null
@@ -1,116 +0,0 @@
-package org.apache.archiva.admin.repository.proxyconnector;
-/*
- * 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.admin.repository.AbstractRepositoryConnector;
-
-import java.io.Serializable;
-
-/**
- * @author Olivier Lamy
- * @since 1.4
- */
-public class ProxyConnector
-    extends AbstractRepositoryConnector
-    implements Serializable
-{
-    /**
-     * The order id for UNORDERED
-     */
-    public static final int UNORDERED = 0;
-
-    /**
-     * The policy key {@link #getPolicies()} for error handling.
-     * See {@link org.apache.maven.archiva.policies.DownloadErrorPolicy}
-     * for details on potential values to this policy key.
-     */
-    public static final String POLICY_PROPAGATE_ERRORS = "propagate-errors";
-
-    /**
-     * The policy key {@link #getPolicies()} for error handling when an artifact is present.
-     * See {@link org.apache.maven.archiva.policies.DownloadErrorPolicy}
-     * for details on potential values to this policy key.
-     */
-    public static final String POLICY_PROPAGATE_ERRORS_ON_UPDATE = "propagate-errors-on-update";
-
-    /**
-     * The policy key {@link #getPolicies()} for snapshot handling.
-     * See {@link org.apache.maven.archiva.policies.SnapshotsPolicy}
-     * for details on potential values to this policy key.
-     */
-    public static final String POLICY_SNAPSHOTS = "snapshots";
-
-    /**
-     * The policy key {@link #getPolicies()} for releases handling.
-     * See {@link org.apache.maven.archiva.policies.ReleasesPolicy}
-     * for details on potential values to this policy key.
-     */
-    public static final String POLICY_RELEASES = "releases";
-
-    /**
-     * The policy key {@link #getPolicies()} for checksum handling.
-     * See {@link org.apache.maven.archiva.policies.ChecksumPolicy}
-     * for details on potential values to this policy key.
-     */
-    public static final String POLICY_CHECKSUM = "checksum";
-
-    /**
-     * The policy key {@link #getPolicies()} for cache-failures handling.
-     * See {@link org.apache.maven.archiva.policies.CachedFailuresPolicy}
-     * for details on potential values to this policy key.
-     */
-    public static final String POLICY_CACHE_FAILURES = "cache-failures";
-
-    /**
-     *
-     * The order of the proxy connectors. (0 means no order specified)
-     *           .
-     */
-    private int order = 0;
-
-    /**
-     * Get the order of the proxy connectors. (0 means no order specified)
-     * @return int
-     */
-    public int getOrder()
-    {
-        return this.order;
-    }
-
-
-    /**
-     * Set the order of the proxy connectors. (0 means no order specified)
-     * @param order
-     */
-    public void setOrder( int order )
-    {
-        this.order = order;
-    }
-
-    @Override
-    public String toString()
-    {
-        final StringBuilder sb = new StringBuilder();
-        sb.append( "ProxyConnector" );
-        sb.append( "{order=" ).append( order );
-        sb.append( '}' );
-        sb.append( super.toString() );
-        return sb.toString();
-    }
-}
diff --git a/archiva-modules/archiva-base/archiva-repository-admin/src/main/java/org/apache/archiva/admin/repository/proxyconnector/ProxyConnectorAdmin.java b/archiva-modules/archiva-base/archiva-repository-admin/src/main/java/org/apache/archiva/admin/repository/proxyconnector/ProxyConnectorAdmin.java
deleted file mode 100644 (file)
index cfb549b..0000000
+++ /dev/null
@@ -1,61 +0,0 @@
-package org.apache.archiva.admin.repository.proxyconnector;
-/*
- * 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.admin.AuditInformation;
-import org.apache.archiva.admin.repository.RepositoryAdminException;
-
-import java.util.List;
-import java.util.Map;
-
-/**
- * <b>No update method for changing source and target here as id is : sourceRepoId and targetRepoId, use delete then add.</b>
- *
- * @author Olivier Lamy
- * @since 1.4
- */
-public interface ProxyConnectorAdmin
-{
-    List<ProxyConnector> getProxyConnectors()
-        throws RepositoryAdminException;
-
-    ProxyConnector getProxyConnector( String sourceRepoId, String targetRepoId )
-        throws RepositoryAdminException;
-
-    Boolean addProxyConnector( ProxyConnector proxyConnector, AuditInformation auditInformation )
-        throws RepositoryAdminException;
-
-    Boolean deleteProxyConnector( ProxyConnector proxyConnector, AuditInformation auditInformation )
-        throws RepositoryAdminException;
-
-    /**
-     * <b>only for enabled/disable or changing bean values except target/source</b>
-     * @param proxyConnector
-     * @param auditInformation
-     * @return
-     * @throws RepositoryAdminException
-     */
-    Boolean updateProxyConnector( ProxyConnector proxyConnector, AuditInformation auditInformation )
-            throws RepositoryAdminException;
-
-
-    Map<String, List<ProxyConnector>> getProxyConnectorAsMap()
-        throws RepositoryAdminException;
-
-}
diff --git a/archiva-modules/archiva-base/archiva-repository-admin/src/main/java/org/apache/archiva/admin/repository/proxyconnector/ProxyConnectorOrderComparator.java b/archiva-modules/archiva-base/archiva-repository-admin/src/main/java/org/apache/archiva/admin/repository/proxyconnector/ProxyConnectorOrderComparator.java
deleted file mode 100644 (file)
index 3f8b0d0..0000000
+++ /dev/null
@@ -1,68 +0,0 @@
-package org.apache.archiva.admin.repository.proxyconnector;
-/*
- * 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 java.util.Comparator;
-
-/**
- * @author Olivier Lamy
- * @since 1.4
- */
-public class ProxyConnectorOrderComparator
-    implements Comparator<ProxyConnector>
-{
-    private static ProxyConnectorOrderComparator INSTANCE = new ProxyConnectorOrderComparator();
-
-    public int compare( ProxyConnector o1, ProxyConnector o2 )
-    {
-        if ( o1 == null && o2 == null )
-        {
-            return 0;
-        }
-
-        // Ensure null goes to end of list.
-        if ( o1 == null && o2 != null )
-        {
-            return 1;
-        }
-
-        if ( o1 != null && o2 == null )
-        {
-            return -1;
-        }
-
-        // Ensure 0 (unordered) goes to end of list.
-        if ( o1.getOrder() == 0 && o2.getOrder() != 0 )
-        {
-            return 1;
-        }
-
-        if ( o1.getOrder() != 0 && o2.getOrder() == 0 )
-        {
-            return -1;
-        }
-
-        return o1.getOrder() - o2.getOrder();
-    }
-
-    public static ProxyConnectorOrderComparator getInstance()
-    {
-        return INSTANCE;
-    }
-}
diff --git a/archiva-modules/archiva-base/archiva-repository-admin/src/main/java/org/apache/archiva/admin/repository/proxyconnector/ProxyConnectorSelectionPredicate.java b/archiva-modules/archiva-base/archiva-repository-admin/src/main/java/org/apache/archiva/admin/repository/proxyconnector/ProxyConnectorSelectionPredicate.java
deleted file mode 100644 (file)
index 01983b7..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
-package org.apache.archiva.admin.repository.proxyconnector;
-/*
- * 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.commons.collections.Predicate;
-import org.apache.commons.lang.StringUtils;
-
-/**
- * @author Olivier Lamy
- * @since 1.4
- */
-public class ProxyConnectorSelectionPredicate
-    implements Predicate
-{
-    private String sourceId;
-
-    private String targetId;
-
-    public ProxyConnectorSelectionPredicate( String sourceId, String targetId )
-    {
-        this.sourceId = sourceId;
-        this.targetId = targetId;
-    }
-
-    public boolean evaluate( Object object )
-    {
-        boolean satisfies = false;
-
-        if ( object instanceof ProxyConnector )
-        {
-            ProxyConnector connector = (ProxyConnector) object;
-            return ( StringUtils.equals( sourceId, connector.getSourceRepoId() ) && StringUtils.equals( targetId,
-                                                                                                        connector.getTargetRepoId() ) );
-        }
-
-        return satisfies;
-    }
-}
diff --git a/archiva-modules/archiva-base/archiva-repository-admin/src/main/java/org/apache/archiva/admin/repository/remote/DefaultRemoteRepositoryAdmin.java b/archiva-modules/archiva-base/archiva-repository-admin/src/main/java/org/apache/archiva/admin/repository/remote/DefaultRemoteRepositoryAdmin.java
deleted file mode 100644 (file)
index a2c83a4..0000000
+++ /dev/null
@@ -1,190 +0,0 @@
-package org.apache.archiva.admin.repository.remote;
-/*
- * 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.admin.AuditInformation;
-import org.apache.archiva.admin.repository.AbstractRepositoryAdmin;
-import org.apache.archiva.admin.repository.RepositoryAdminException;
-import org.apache.archiva.audit.AuditEvent;
-import org.apache.commons.lang.StringUtils;
-import org.apache.maven.archiva.configuration.Configuration;
-import org.apache.maven.archiva.configuration.ProxyConnectorConfiguration;
-import org.apache.maven.archiva.configuration.RemoteRepositoryConfiguration;
-import org.springframework.stereotype.Service;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-/**
- * @author Olivier Lamy
- * @since 1.4
- */
-@Service( "remoteRepositoryAdmin#default" )
-public class DefaultRemoteRepositoryAdmin
-    extends AbstractRepositoryAdmin
-    implements RemoteRepositoryAdmin
-{
-
-
-    public List<RemoteRepository> getRemoteRepositories()
-        throws RepositoryAdminException
-    {
-        List<RemoteRepository> remoteRepositories = new ArrayList<RemoteRepository>();
-        for ( RemoteRepositoryConfiguration repositoryConfiguration : getArchivaConfiguration().getConfiguration().getRemoteRepositories() )
-        {
-            remoteRepositories.add(
-                new RemoteRepository( repositoryConfiguration.getId(), repositoryConfiguration.getName(),
-                                      repositoryConfiguration.getUrl(), repositoryConfiguration.getLayout(),
-                                      repositoryConfiguration.getUsername(), repositoryConfiguration.getPassword(),
-                                      repositoryConfiguration.getTimeout() ) );
-        }
-        return remoteRepositories;
-    }
-
-    public RemoteRepository getRemoteRepository( String repositoryId )
-        throws RepositoryAdminException
-    {
-        for ( RemoteRepository remoteRepository : getRemoteRepositories() )
-        {
-            if ( StringUtils.equals( repositoryId, remoteRepository.getId() ) )
-            {
-                return remoteRepository;
-            }
-        }
-        return null;
-    }
-
-    public Boolean addRemoteRepository( RemoteRepository remoteRepository, AuditInformation auditInformation )
-        throws RepositoryAdminException
-    {
-        triggerAuditEvent( remoteRepository.getId(), null, AuditEvent.ADD_REMOTE_REPO, auditInformation );
-        getRepositoryCommonValidator().basicValidation( remoteRepository, false );
-
-        //TODO we can validate it's a good uri/url
-        if ( StringUtils.isEmpty( remoteRepository.getUrl() ) )
-        {
-            throw new RepositoryAdminException( "url cannot be null" );
-        }
-
-        //MRM-752 - url needs trimming
-        remoteRepository.setUrl( StringUtils.trim( remoteRepository.getUrl() ) );
-
-        RemoteRepositoryConfiguration remoteRepositoryConfiguration =
-            getRemoteRepositoryConfiguration( remoteRepository );
-
-        Configuration configuration = getArchivaConfiguration().getConfiguration();
-        configuration.addRemoteRepository( remoteRepositoryConfiguration );
-        saveConfiguration( configuration );
-
-        return Boolean.TRUE;
-    }
-
-    public Boolean deleteRemoteRepository( String repositoryId, AuditInformation auditInformation )
-        throws RepositoryAdminException
-    {
-
-        triggerAuditEvent( repositoryId, null, AuditEvent.DELETE_REMOTE_REPO, auditInformation );
-
-        Configuration configuration = getArchivaConfiguration().getConfiguration();
-
-        RemoteRepositoryConfiguration remoteRepositoryConfiguration =
-            configuration.getRemoteRepositoriesAsMap().get( repositoryId );
-        if ( remoteRepositoryConfiguration == null )
-        {
-            throw new RepositoryAdminException(
-                "remoteRepository with id " + repositoryId + " not exist cannot remove it" );
-        }
-
-        configuration.removeRemoteRepository( remoteRepositoryConfiguration );
-
-        // TODO use ProxyConnectorAdmin interface ?
-        // [MRM-520] Proxy Connectors are not deleted with the deletion of a Repository.
-        List<ProxyConnectorConfiguration> proxyConnectors =
-            new ArrayList<ProxyConnectorConfiguration>( configuration.getProxyConnectors() );
-        for ( ProxyConnectorConfiguration proxyConnector : proxyConnectors )
-        {
-            if ( StringUtils.equals( proxyConnector.getTargetRepoId(), repositoryId ) )
-            {
-                configuration.removeProxyConnector( proxyConnector );
-            }
-        }
-
-        saveConfiguration( configuration );
-
-        return Boolean.TRUE;
-    }
-
-    public Boolean updateRemoteRepository( RemoteRepository remoteRepository, AuditInformation auditInformation )
-        throws RepositoryAdminException
-    {
-
-        String repositoryId = remoteRepository.getId();
-
-        triggerAuditEvent( repositoryId, null, AuditEvent.MODIFY_REMOTE_REPO, auditInformation );
-
-        // update means : remove and add
-
-        Configuration configuration = getArchivaConfiguration().getConfiguration();
-
-        RemoteRepositoryConfiguration remoteRepositoryConfiguration =
-            configuration.getRemoteRepositoriesAsMap().get( repositoryId );
-        if ( remoteRepositoryConfiguration == null )
-        {
-            throw new RepositoryAdminException(
-                "remoteRepository with id " + repositoryId + " not exist cannot remove it" );
-        }
-
-        configuration.removeRemoteRepository( remoteRepositoryConfiguration );
-
-        remoteRepositoryConfiguration = getRemoteRepositoryConfiguration( remoteRepository );
-        configuration.addRemoteRepository( remoteRepositoryConfiguration );
-        saveConfiguration( configuration );
-
-        return Boolean.TRUE;
-    }
-
-    public Map<String, RemoteRepository> getRemoteRepositoriesAsMap()
-        throws RepositoryAdminException
-    {
-        java.util.Map<String, RemoteRepository> map = new HashMap<String, RemoteRepository>();
-
-        for ( RemoteRepository repo : getRemoteRepositories() )
-        {
-            map.put( repo.getId(), repo );
-        }
-
-        return map;
-    }
-
-    private RemoteRepositoryConfiguration getRemoteRepositoryConfiguration( RemoteRepository remoteRepository )
-    {
-        RemoteRepositoryConfiguration remoteRepositoryConfiguration = new RemoteRepositoryConfiguration();
-        remoteRepositoryConfiguration.setId( remoteRepository.getId() );
-        remoteRepositoryConfiguration.setPassword( remoteRepository.getPassword() );
-        remoteRepositoryConfiguration.setTimeout( remoteRepository.getTimeout() );
-        remoteRepositoryConfiguration.setUrl( remoteRepository.getUrl() );
-        remoteRepositoryConfiguration.setUsername( remoteRepository.getUserName() );
-        remoteRepositoryConfiguration.setLayout( remoteRepository.getLayout() );
-        remoteRepositoryConfiguration.setName( remoteRepository.getName() );
-        return remoteRepositoryConfiguration;
-    }
-
-}
diff --git a/archiva-modules/archiva-base/archiva-repository-admin/src/main/java/org/apache/archiva/admin/repository/remote/RemoteRepository.java b/archiva-modules/archiva-base/archiva-repository-admin/src/main/java/org/apache/archiva/admin/repository/remote/RemoteRepository.java
deleted file mode 100644 (file)
index db9f965..0000000
+++ /dev/null
@@ -1,119 +0,0 @@
-package org.apache.archiva.admin.repository.remote;
-
-/*
- * 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.admin.repository.AbstractRepository;
-
-import java.io.Serializable;
-
-/**
- * @author Olivier Lamy
- * @since 1.4
- */
-public class RemoteRepository
-    extends AbstractRepository
-    implements Serializable
-{
-
-    private String url;
-
-    private String userName;
-
-    private String password;
-
-    private int timeout = 60;
-
-    public RemoteRepository()
-    {
-        // no op
-    }
-
-    public RemoteRepository( String id, String name, String url, String layout )
-    {
-        super( id, name, layout );
-        this.url = url;
-    }
-
-    public RemoteRepository( String id, String name, String url, String layout, String userName, String password,
-                             int timeOut )
-    {
-        super( id, name, layout );
-        this.url = url;
-        this.userName = userName;
-        this.password = password;
-        this.timeout = timeOut;
-    }
-
-    public String getUrl()
-    {
-        return url;
-    }
-
-    public void setUrl( String url )
-    {
-        this.url = url;
-    }
-
-    public String getUserName()
-    {
-        return userName;
-    }
-
-    public void setUserName( String userName )
-    {
-        this.userName = userName;
-    }
-
-    public String getPassword()
-    {
-        return password;
-    }
-
-    public void setPassword( String password )
-    {
-        this.password = password;
-    }
-
-    public int getTimeout()
-    {
-        return timeout;
-    }
-
-    public void setTimeout( int timeout )
-    {
-        this.timeout = timeout;
-    }
-
-    @Override
-    public String toString()
-    {
-        final StringBuilder sb = new StringBuilder();
-        sb.append( "RemoteRepository" );
-        sb.append( "{url='" ).append( url ).append( '\'' );
-        sb.append( ", userName='" ).append( userName ).append( '\'' );
-        sb.append( ", password='" ).append( password ).append( '\'' );
-        sb.append( ", timeout=" ).append( timeout );
-        sb.append( '}' );
-        sb.append( super.toString() );
-        return sb.toString();
-    }
-
-
-}
\ No newline at end of file
diff --git a/archiva-modules/archiva-base/archiva-repository-admin/src/main/java/org/apache/archiva/admin/repository/remote/RemoteRepositoryAdmin.java b/archiva-modules/archiva-base/archiva-repository-admin/src/main/java/org/apache/archiva/admin/repository/remote/RemoteRepositoryAdmin.java
deleted file mode 100644 (file)
index 15218ba..0000000
+++ /dev/null
@@ -1,51 +0,0 @@
-package org.apache.archiva.admin.repository.remote;
-/*
- * 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.admin.AuditInformation;
-import org.apache.archiva.admin.repository.RepositoryAdminException;
-
-import java.util.List;
-import java.util.Map;
-
-/**
- * @author Olivier Lamy
- * @since 1.4
- */
-public interface RemoteRepositoryAdmin
-{
-    List<RemoteRepository> getRemoteRepositories()
-        throws RepositoryAdminException;
-
-    RemoteRepository getRemoteRepository( String repositoryId )
-        throws RepositoryAdminException;
-
-    Boolean deleteRemoteRepository( String repositoryId, AuditInformation auditInformation )
-        throws RepositoryAdminException;
-
-    Boolean addRemoteRepository( RemoteRepository remoteRepository, AuditInformation auditInformation )
-        throws RepositoryAdminException;
-
-    Boolean updateRemoteRepository( RemoteRepository remoteRepository, AuditInformation auditInformation )
-        throws RepositoryAdminException;
-
-    Map<String, RemoteRepository> getRemoteRepositoriesAsMap()
-        throws RepositoryAdminException;
-}
diff --git a/archiva-modules/archiva-base/archiva-repository-admin/src/main/java/org/apache/archiva/admin/repository/utils/RepositoryComparator.java b/archiva-modules/archiva-base/archiva-repository-admin/src/main/java/org/apache/archiva/admin/repository/utils/RepositoryComparator.java
deleted file mode 100644 (file)
index f9b9369..0000000
+++ /dev/null
@@ -1,51 +0,0 @@
-package org.apache.archiva.admin.repository.utils;
-/*
- * 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.admin.repository.AbstractRepository;
-
-import java.util.Comparator;
-
-/**
- * @author Olivier Lamy
- * @since 1.4
- */
-public class RepositoryComparator
-    implements Comparator<AbstractRepository>
-{
-    public int compare( AbstractRepository o1, AbstractRepository o2 )
-    {
-        if ( o1 == null && o2 == null )
-        {
-            return 0;
-        }
-
-        if ( o1 == null )
-        {
-            return -1;
-        }
-
-        if ( o2 == null )
-        {
-            return 1;
-        }
-
-        return o1.getId().compareToIgnoreCase( o2.getId() );
-    }
-}
diff --git a/archiva-modules/archiva-base/archiva-repository-admin/src/main/resources/META-INF/spring-context.xml b/archiva-modules/archiva-base/archiva-repository-admin/src/main/resources/META-INF/spring-context.xml
deleted file mode 100644 (file)
index 3a98666..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-<?xml version="1.0"?>
-
-<!--
-  ~ 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.
-  -->
-<beans xmlns="http://www.springframework.org/schema/beans"
-       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-       xmlns:context="http://www.springframework.org/schema/context"
-       xsi:schemaLocation="http://www.springframework.org/schema/beans
-           http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
-           http://www.springframework.org/schema/context 
-           http://www.springframework.org/schema/context/spring-context-3.0.xsd" default-lazy-init="true">
-
-
-  <context:annotation-config />
-  <context:component-scan
-    base-package="org.apache.archiva.admin.repository"/>
-
-
-
-</beans>
\ No newline at end of file
diff --git a/archiva-modules/archiva-base/archiva-repository-admin/src/test/java/org/apache/archiva/admin/mock/MockAuditListener.java b/archiva-modules/archiva-base/archiva-repository-admin/src/test/java/org/apache/archiva/admin/mock/MockAuditListener.java
deleted file mode 100644 (file)
index 42387a6..0000000
+++ /dev/null
@@ -1,52 +0,0 @@
-package org.apache.archiva.admin.mock;
-/*
- * 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.audit.AuditEvent;
-import org.apache.archiva.audit.AuditListener;
-import org.springframework.stereotype.Service;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * @author Olivier Lamy
- */
-@Service( "auditListener#mock" )
-public class MockAuditListener
-    implements AuditListener
-{
-
-    private List<AuditEvent> auditEvents = new ArrayList<AuditEvent>();
-
-    public void auditEvent( AuditEvent event )
-    {
-        auditEvents.add( event );
-    }
-
-    public List<AuditEvent> getAuditEvents()
-    {
-        return auditEvents;
-    }
-
-    public void clearEvents()
-    {
-        auditEvents.clear();
-    }
-}
diff --git a/archiva-modules/archiva-base/archiva-repository-admin/src/test/java/org/apache/archiva/admin/repository/AbstractRepositoryAdminTest.java b/archiva-modules/archiva-base/archiva-repository-admin/src/test/java/org/apache/archiva/admin/repository/AbstractRepositoryAdminTest.java
deleted file mode 100644 (file)
index 0533faa..0000000
+++ /dev/null
@@ -1,140 +0,0 @@
-package org.apache.archiva.admin.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.
- */
-
-import junit.framework.TestCase;
-import org.apache.archiva.admin.AuditInformation;
-import org.apache.archiva.admin.mock.MockAuditListener;
-import org.apache.archiva.admin.repository.managed.ManagedRepository;
-import org.apache.archiva.admin.repository.managed.ManagedRepositoryAdmin;
-import org.apache.archiva.admin.repository.proxyconnector.ProxyConnectorAdmin;
-import org.apache.archiva.admin.repository.remote.RemoteRepository;
-import org.apache.archiva.admin.repository.remote.RemoteRepositoryAdmin;
-import org.apache.commons.io.FileUtils;
-import org.apache.commons.lang.StringUtils;
-import org.codehaus.plexus.redback.role.RoleManager;
-import org.codehaus.plexus.redback.users.User;
-import org.codehaus.plexus.redback.users.memory.SimpleUser;
-import org.junit.runner.RunWith;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.test.context.ContextConfiguration;
-import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
-
-import javax.inject.Inject;
-import java.io.File;
-import java.util.List;
-
-/**
- * @author Olivier Lamy
- */
-@RunWith( SpringJUnit4ClassRunner.class )
-@ContextConfiguration( locations = { "classpath*:/META-INF/spring-context.xml", "classpath:/spring-context.xml" } )
-public abstract class AbstractRepositoryAdminTest
-    extends TestCase
-{
-    protected Logger log = LoggerFactory.getLogger( getClass() );
-
-    public static final String APPSERVER_BASE_PATH = System.getProperty( "appserver.base" );
-
-    @Inject
-    protected MockAuditListener mockAuditListener;
-
-    @Inject
-    protected RoleManager roleManager;
-
-    @Inject
-    protected RemoteRepositoryAdmin remoteRepositoryAdmin;
-
-    @Inject
-    protected ManagedRepositoryAdmin managedRepositoryAdmin;
-
-    @Inject
-    protected ProxyConnectorAdmin proxyConnectorAdmin;
-
-    protected AuditInformation getFakeAuditInformation()
-    {
-        AuditInformation auditInformation = new AuditInformation( getFakeUser(), "archiva-localhost" );
-        return auditInformation;
-    }
-
-    protected User getFakeUser()
-    {
-        SimpleUser user = new SimpleUser()
-        {
-            @Override
-            public Object getPrincipal()
-            {
-                return "root";
-            }
-
-        };
-
-        user.setUsername( "root" );
-        user.setFullName( "The top user" );
-        return user;
-    }
-
-    protected ManagedRepository getTestManagedRepository( String repoId, String repoLocation )
-    {
-        return new ManagedRepository( repoId, "test repo", repoLocation, "default", false, true, true, "0 0 * * * ?",
-                                      repoLocation + "/.index", false, 1, 2, true );
-    }
-
-    protected File clearRepoLocation( String path )
-        throws Exception
-    {
-        File repoDir = new File( path );
-        if ( repoDir.exists() )
-        {
-            FileUtils.deleteDirectory( repoDir );
-        }
-        assertFalse( repoDir.exists() );
-        return repoDir;
-    }
-
-    protected ManagedRepository findManagedRepoById( List<ManagedRepository> repos, String id )
-    {
-        for ( ManagedRepository repo : repos )
-        {
-            if ( StringUtils.equals( id, repo.getId() ) )
-            {
-                return repo;
-            }
-        }
-        return null;
-    }
-
-    protected RemoteRepository getRemoteRepository()
-    {
-        return getRemoteRepository( "foo" );
-    }
-
-    protected RemoteRepository getRemoteRepository(String id)
-    {
-        RemoteRepository remoteRepository = new RemoteRepository();
-        remoteRepository.setUrl( "http://foo.com/maven-it-rocks" );
-        remoteRepository.setTimeout( 10 );
-        remoteRepository.setName( "maven foo" );
-        remoteRepository.setUserName( "foo-name" );
-        remoteRepository.setPassword( "toto" );
-        remoteRepository.setId( id );
-        return remoteRepository;
-    }
-}
diff --git a/archiva-modules/archiva-base/archiva-repository-admin/src/test/java/org/apache/archiva/admin/repository/admin/ArchivaAdministrationTest.java b/archiva-modules/archiva-base/archiva-repository-admin/src/test/java/org/apache/archiva/admin/repository/admin/ArchivaAdministrationTest.java
deleted file mode 100644 (file)
index c51c126..0000000
+++ /dev/null
@@ -1,190 +0,0 @@
-package org.apache.archiva.admin.repository.admin;
-/*
- * 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.admin.repository.AbstractRepositoryAdminTest;
-import org.apache.archiva.admin.repository.RepositoryAdminException;
-import org.apache.archiva.audit.AuditEvent;
-import org.junit.Test;
-
-import javax.inject.Inject;
-import java.util.Arrays;
-
-/**
- * @author Olivier Lamy
- */
-public class ArchivaAdministrationTest
-    extends AbstractRepositoryAdminTest
-{
-    @Inject
-    ArchivaAdministration archivaAdministration;
-
-
-    @Test
-    public void getAllLegacyPaths()
-        throws Exception
-    {
-        assertNotNull( archivaAdministration.getLegacyArtifactPaths() );
-        assertFalse( archivaAdministration.getLegacyArtifactPaths().isEmpty() );
-        assertEquals( 1, archivaAdministration.getLegacyArtifactPaths().size() );
-        log.info( "all legacy paths {}", archivaAdministration.getLegacyArtifactPaths() );
-    }
-
-    public void addAndDeleteLegacyPath()
-        throws Exception
-    {
-        int initialSize = archivaAdministration.getLegacyArtifactPaths().size();
-
-        LegacyArtifactPath legacyArtifactPath = new LegacyArtifactPath( "foo", "bar" );
-        archivaAdministration.addLegacyArtifactPath( legacyArtifactPath, getFakeAuditInformation() );
-
-        assertTrue( archivaAdministration.getLegacyArtifactPaths().contains( new LegacyArtifactPath( "foo", "bar" ) ) );
-        assertEquals( initialSize + 1, archivaAdministration.getLegacyArtifactPaths().size() );
-
-        archivaAdministration.deleteLegacyArtifactPath( legacyArtifactPath.getPath(), getFakeAuditInformation() );
-
-        assertFalse(
-            archivaAdministration.getLegacyArtifactPaths().contains( new LegacyArtifactPath( "foo", "bar" ) ) );
-        assertEquals( initialSize, archivaAdministration.getLegacyArtifactPaths().size() );
-        mockAuditListener.clearEvents();
-    }
-
-    @Test
-    public void addAndUpdateAndDeleteFileType()
-        throws RepositoryAdminException
-    {
-        int initialSize = archivaAdministration.getFileTypes().size();
-
-        FileType fileType = new FileType();
-        fileType.setId( "foo" );
-        fileType.setPatterns( Arrays.asList( "bar", "toto" ) );
-
-        archivaAdministration.addFileType( fileType, getFakeAuditInformation() );
-
-        assertEquals( initialSize + 1, archivaAdministration.getFileTypes().size() );
-
-        archivaAdministration.addFileTypePattern( "foo", "zorro", getFakeAuditInformation() );
-
-        assertEquals( initialSize + 1, archivaAdministration.getFileTypes().size() );
-
-        assertEquals( 3, archivaAdministration.getFileType( "foo" ).getPatterns().size() );
-
-        assertTrue( archivaAdministration.getFileType( "foo" ).getPatterns().contains( "bar" ) );
-        assertTrue( archivaAdministration.getFileType( "foo" ).getPatterns().contains( "toto" ) );
-        assertTrue( archivaAdministration.getFileType( "foo" ).getPatterns().contains( "zorro" ) );
-
-        archivaAdministration.removeFileTypePattern( "foo", "zorro", getFakeAuditInformation() );
-
-        assertEquals( initialSize + 1, archivaAdministration.getFileTypes().size() );
-
-        assertEquals( 2, archivaAdministration.getFileType( "foo" ).getPatterns().size() );
-
-        assertTrue( archivaAdministration.getFileType( "foo" ).getPatterns().contains( "bar" ) );
-        assertTrue( archivaAdministration.getFileType( "foo" ).getPatterns().contains( "toto" ) );
-        assertFalse( archivaAdministration.getFileType( "foo" ).getPatterns().contains( "zorro" ) );
-
-        archivaAdministration.removeFileType( "foo", getFakeAuditInformation() );
-
-        assertEquals( initialSize, archivaAdministration.getFileTypes().size() );
-        assertNull( archivaAdministration.getFileType( "foo" ) );
-        mockAuditListener.clearEvents();
-    }
-
-    @Test
-    public void knownContentConsumersTest()
-        throws Exception
-    {
-        int initialSize = archivaAdministration.getKnownContentConsumers().size();
-
-        archivaAdministration.addKnownContentConsumer( "foo", getFakeAuditInformation() );
-
-        assertEquals( initialSize + 1, archivaAdministration.getKnownContentConsumers().size() );
-        assertTrue( archivaAdministration.getKnownContentConsumers().contains( "foo" ) );
-
-        // ensure we don't add it twice as it's an ArrayList as storage
-        archivaAdministration.addKnownContentConsumer( "foo", getFakeAuditInformation() );
-
-        assertEquals( initialSize + 1, archivaAdministration.getKnownContentConsumers().size() );
-        assertTrue( archivaAdministration.getKnownContentConsumers().contains( "foo" ) );
-
-        archivaAdministration.removeKnownContentConsumer( "foo", getFakeAuditInformation() );
-
-        assertEquals( initialSize, archivaAdministration.getKnownContentConsumers().size() );
-        assertFalse( archivaAdministration.getKnownContentConsumers().contains( "foo" ) );
-
-        assertEquals( 2, mockAuditListener.getAuditEvents().size() );
-        assertEquals( AuditEvent.ENABLE_REPO_CONSUMER, mockAuditListener.getAuditEvents().get( 0 ).getAction() );
-        assertEquals( AuditEvent.DISABLE_REPO_CONSUMER, mockAuditListener.getAuditEvents().get( 1 ).getAction() );
-
-        mockAuditListener.clearEvents();
-
-    }
-
-    @Test
-    public void invalidContentConsumersTest()
-        throws Exception
-    {
-        int initialSize = archivaAdministration.getInvalidContentConsumers().size();
-
-        archivaAdministration.addInvalidContentConsumer( "foo", getFakeAuditInformation() );
-
-        assertEquals( initialSize + 1, archivaAdministration.getInvalidContentConsumers().size() );
-        assertTrue( archivaAdministration.getInvalidContentConsumers().contains( "foo" ) );
-
-        // ensure we don't add it twice as it's an ArrayList as storage
-        archivaAdministration.addInvalidContentConsumer( "foo", getFakeAuditInformation() );
-
-        assertEquals( initialSize + 1, archivaAdministration.getInvalidContentConsumers().size() );
-        assertTrue( archivaAdministration.getInvalidContentConsumers().contains( "foo" ) );
-
-        archivaAdministration.removeInvalidContentConsumer( "foo", getFakeAuditInformation() );
-
-        assertEquals( initialSize, archivaAdministration.getInvalidContentConsumers().size() );
-        assertFalse( archivaAdministration.getInvalidContentConsumers().contains( "foo" ) );
-
-        assertEquals( 2, mockAuditListener.getAuditEvents().size() );
-        assertEquals( AuditEvent.ENABLE_REPO_CONSUMER, mockAuditListener.getAuditEvents().get( 0 ).getAction() );
-        assertEquals( AuditEvent.DISABLE_REPO_CONSUMER, mockAuditListener.getAuditEvents().get( 1 ).getAction() );
-
-        mockAuditListener.clearEvents();
-
-    }
-
-
-    public void organisationInfoUpdate()
-        throws Exception
-    {
-        OrganisationInformation organisationInformation = archivaAdministration.getOrganisationInformation();
-        assertNull( organisationInformation );
-
-        organisationInformation = new OrganisationInformation();
-        organisationInformation.setLogoLocation( "http://foo.com/bar.png" );
-        organisationInformation.setName( "foo org" );
-        organisationInformation.setUrl( "http:/foo.com" );
-
-        archivaAdministration.setOrganisationInformation( organisationInformation );
-
-        organisationInformation = archivaAdministration.getOrganisationInformation();
-        assertNotNull( organisationInformation );
-        assertEquals( "http://foo.com/bar.png", organisationInformation.getLogoLocation() );
-        assertEquals( "foo org", organisationInformation.getName() );
-        assertEquals( "http://foo.com", organisationInformation.getUrl() );
-
-    }
-}
diff --git a/archiva-modules/archiva-base/archiva-repository-admin/src/test/java/org/apache/archiva/admin/repository/group/RepositoryGroupAdminTest.java b/archiva-modules/archiva-base/archiva-repository-admin/src/test/java/org/apache/archiva/admin/repository/group/RepositoryGroupAdminTest.java
deleted file mode 100644 (file)
index 7079a9c..0000000
+++ /dev/null
@@ -1,200 +0,0 @@
-package org.apache.archiva.admin.repository.group;
-/*
- * 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.admin.repository.AbstractRepositoryAdminTest;
-import org.apache.archiva.admin.repository.managed.ManagedRepository;
-import org.apache.archiva.audit.AuditEvent;
-import org.junit.Test;
-
-import javax.inject.Inject;
-import java.io.File;
-import java.util.Arrays;
-
-/**
- * @author Olivier Lamy
- */
-public class RepositoryGroupAdminTest
-    extends AbstractRepositoryAdminTest
-{
-    @Inject
-    RepositoryGroupAdmin repositoryGroupAdmin;
-
-    @Test
-    public void addAndDeleteGroup()
-        throws Exception
-    {
-        try
-        {
-            ManagedRepository managedRepositoryOne =
-                getTestManagedRepository( "test-new-one", APPSERVER_BASE_PATH + File.separator + "test-new-one" );
-
-            ManagedRepository managedRepositoryTwo =
-                getTestManagedRepository( "test-new-two", APPSERVER_BASE_PATH + File.separator + "test-new-two" );
-
-            managedRepositoryAdmin.addManagedRepository( managedRepositoryOne, false, getFakeAuditInformation() );
-
-            managedRepositoryAdmin.addManagedRepository( managedRepositoryTwo, false, getFakeAuditInformation() );
-
-            RepositoryGroup repositoryGroup =
-                new RepositoryGroup( "repo-group-one", Arrays.asList( "test-new-one", "test-new-two" ) );
-
-            mockAuditListener.clearEvents();
-
-            repositoryGroupAdmin.addRepositoryGroup( repositoryGroup, getFakeAuditInformation() );
-
-            assertEquals( 1, repositoryGroupAdmin.getRepositoriesGroups().size() );
-            assertEquals( "repo-group-one", repositoryGroupAdmin.getRepositoriesGroups().get( 0 ).getId() );
-            assertEquals( 2, repositoryGroupAdmin.getRepositoriesGroups().get( 0 ).getRepositories().size() );
-            assertEquals( Arrays.asList( "test-new-one", "test-new-two" ),
-                          repositoryGroupAdmin.getRepositoriesGroups().get( 0 ).getRepositories() );
-
-            repositoryGroupAdmin.deleteRepositoryGroup( "repo-group-one", getFakeAuditInformation() );
-
-            assertEquals( 0, repositoryGroupAdmin.getRepositoriesGroups().size() );
-
-            assertEquals( 2, mockAuditListener.getAuditEvents().size() );
-
-            assertEquals( AuditEvent.ADD_REPO_GROUP, mockAuditListener.getAuditEvents().get( 0 ).getAction() );
-            assertEquals( AuditEvent.DELETE_REPO_GROUP, mockAuditListener.getAuditEvents().get( 1 ).getAction() );
-        }
-        finally
-        {
-            mockAuditListener.clearEvents();
-            managedRepositoryAdmin.deleteManagedRepository( "test-new-one", getFakeAuditInformation(), true );
-            managedRepositoryAdmin.deleteManagedRepository( "test-new-two", getFakeAuditInformation(), true );
-        }
-    }
-
-    @Test
-    public void addAndUpdateAndDeleteGroup()
-        throws Exception
-    {
-        try
-        {
-            ManagedRepository managedRepositoryOne =
-                getTestManagedRepository( "test-new-one", APPSERVER_BASE_PATH + File.separator + "test-new-one" );
-
-            ManagedRepository managedRepositoryTwo =
-                getTestManagedRepository( "test-new-two", APPSERVER_BASE_PATH + File.separator + "test-new-two" );
-
-            managedRepositoryAdmin.addManagedRepository( managedRepositoryOne, false, getFakeAuditInformation() );
-
-            managedRepositoryAdmin.addManagedRepository( managedRepositoryTwo, false, getFakeAuditInformation() );
-
-            RepositoryGroup repositoryGroup = new RepositoryGroup( "repo-group-one", Arrays.asList( "test-new-one" ) );
-
-            mockAuditListener.clearEvents();
-
-            repositoryGroupAdmin.addRepositoryGroup( repositoryGroup, getFakeAuditInformation() );
-
-            assertEquals( 1, repositoryGroupAdmin.getRepositoriesGroups().size() );
-            assertEquals( "repo-group-one", repositoryGroupAdmin.getRepositoriesGroups().get( 0 ).getId() );
-            assertEquals( 1, repositoryGroupAdmin.getRepositoriesGroups().get( 0 ).getRepositories().size() );
-            assertEquals( Arrays.asList( "test-new-one" ),
-                          repositoryGroupAdmin.getRepositoriesGroups().get( 0 ).getRepositories() );
-
-            repositoryGroup = repositoryGroupAdmin.getRepositoryGroup( "repo-group-one" );
-            assertNotNull( repositoryGroup );
-
-            repositoryGroup.addRepository( managedRepositoryTwo.getId() );
-
-            repositoryGroupAdmin.updateRepositoryGroup( repositoryGroup, getFakeAuditInformation() );
-
-            assertEquals( 1, repositoryGroupAdmin.getRepositoriesGroups().size() );
-            assertEquals( "repo-group-one", repositoryGroupAdmin.getRepositoriesGroups().get( 0 ).getId() );
-            assertEquals( 2, repositoryGroupAdmin.getRepositoriesGroups().get( 0 ).getRepositories().size() );
-            assertEquals( Arrays.asList( "test-new-one", "test-new-two" ),
-                          repositoryGroupAdmin.getRepositoriesGroups().get( 0 ).getRepositories() );
-
-            repositoryGroupAdmin.deleteRepositoryGroup( "repo-group-one", getFakeAuditInformation() );
-
-            assertEquals( 0, repositoryGroupAdmin.getRepositoriesGroups().size() );
-
-            assertEquals( 3, mockAuditListener.getAuditEvents().size() );
-
-            assertEquals( AuditEvent.ADD_REPO_GROUP, mockAuditListener.getAuditEvents().get( 0 ).getAction() );
-            assertEquals( AuditEvent.MODIFY_REPO_GROUP, mockAuditListener.getAuditEvents().get( 1 ).getAction() );
-            assertEquals( AuditEvent.DELETE_REPO_GROUP, mockAuditListener.getAuditEvents().get( 2 ).getAction() );
-        }
-        finally
-        {
-            mockAuditListener.clearEvents();
-            managedRepositoryAdmin.deleteManagedRepository( "test-new-one", getFakeAuditInformation(), true );
-            managedRepositoryAdmin.deleteManagedRepository( "test-new-two", getFakeAuditInformation(), true );
-        }
-    }
-
-
-    @Test
-    public void addAndDeleteGroupWithRemowingManagedRepo()
-        throws Exception
-    {
-        try
-        {
-            ManagedRepository managedRepositoryOne =
-                getTestManagedRepository( "test-new-one", APPSERVER_BASE_PATH + File.separator + "test-new-one" );
-
-            ManagedRepository managedRepositoryTwo =
-                getTestManagedRepository( "test-new-two", APPSERVER_BASE_PATH + File.separator + "test-new-two" );
-
-            managedRepositoryAdmin.addManagedRepository( managedRepositoryOne, false, getFakeAuditInformation() );
-
-            managedRepositoryAdmin.addManagedRepository( managedRepositoryTwo, false, getFakeAuditInformation() );
-
-            RepositoryGroup repositoryGroup =
-                new RepositoryGroup( "repo-group-one", Arrays.asList( "test-new-one", "test-new-two" ) );
-
-            mockAuditListener.clearEvents();
-
-            repositoryGroupAdmin.addRepositoryGroup( repositoryGroup, getFakeAuditInformation() );
-
-            assertEquals( 1, repositoryGroupAdmin.getRepositoriesGroups().size() );
-            assertEquals( "repo-group-one", repositoryGroupAdmin.getRepositoriesGroups().get( 0 ).getId() );
-            assertEquals( 2, repositoryGroupAdmin.getRepositoriesGroups().get( 0 ).getRepositories().size() );
-            assertEquals( Arrays.asList( "test-new-one", "test-new-two" ),
-                          repositoryGroupAdmin.getRepositoriesGroups().get( 0 ).getRepositories() );
-
-            // deleting a managed repo to validate repogroup correctly updated !
-            managedRepositoryAdmin.deleteManagedRepository( "test-new-one", getFakeAuditInformation(), true );
-
-            assertEquals( 1, repositoryGroupAdmin.getRepositoriesGroups().size() );
-            assertEquals( "repo-group-one", repositoryGroupAdmin.getRepositoriesGroups().get( 0 ).getId() );
-            assertEquals( 1, repositoryGroupAdmin.getRepositoriesGroups().get( 0 ).getRepositories().size() );
-            assertEquals( Arrays.asList( "test-new-two" ),
-                          repositoryGroupAdmin.getRepositoriesGroups().get( 0 ).getRepositories() );
-
-            repositoryGroupAdmin.deleteRepositoryGroup( "repo-group-one", getFakeAuditInformation() );
-
-            assertEquals( 0, repositoryGroupAdmin.getRepositoriesGroups().size() );
-
-            assertEquals( 3, mockAuditListener.getAuditEvents().size() );
-
-            assertEquals( AuditEvent.ADD_REPO_GROUP, mockAuditListener.getAuditEvents().get( 0 ).getAction() );
-            assertEquals( AuditEvent.DELETE_MANAGED_REPO, mockAuditListener.getAuditEvents().get( 1 ).getAction() );
-            assertEquals( AuditEvent.DELETE_REPO_GROUP, mockAuditListener.getAuditEvents().get( 2 ).getAction() );
-        }
-        finally
-        {
-            mockAuditListener.clearEvents();
-
-            managedRepositoryAdmin.deleteManagedRepository( "test-new-two", getFakeAuditInformation(), true );
-        }
-    }
-}
diff --git a/archiva-modules/archiva-base/archiva-repository-admin/src/test/java/org/apache/archiva/admin/repository/managed/ManagedRepositoryAdminTest.java b/archiva-modules/archiva-base/archiva-repository-admin/src/test/java/org/apache/archiva/admin/repository/managed/ManagedRepositoryAdminTest.java
deleted file mode 100644 (file)
index 66dd71b..0000000
+++ /dev/null
@@ -1,379 +0,0 @@
-package org.apache.archiva.admin.repository.managed;
-/*
- * 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.admin.repository.AbstractRepositoryAdminTest;
-import org.apache.archiva.audit.AuditEvent;
-import org.apache.archiva.security.common.ArchivaRoleConstants;
-import org.apache.commons.io.FileUtils;
-import org.apache.commons.lang.StringUtils;
-import org.junit.Test;
-
-import java.io.File;
-import java.util.List;
-
-/**
- * @author Olivier Lamy
- */
-public class ManagedRepositoryAdminTest
-    extends AbstractRepositoryAdminTest
-{
-    public static final String STAGE_REPO_ID_END = DefaultManagedRepositoryAdmin.STAGE_REPO_ID_END;
-
-    @Test
-    public void getAllManagedRepos()
-        throws Exception
-    {
-        mockAuditListener.clearEvents();
-        List<ManagedRepository> repos = managedRepositoryAdmin.getManagedRepositories();
-        assertNotNull( repos );
-        assertTrue( repos.size() > 0 );
-        log.info( "repos " + repos );
-
-        // check default internal
-        ManagedRepository internal = findManagedRepoById( repos, "internal" );
-        assertNotNull( internal );
-        assertTrue( internal.isReleases() );
-        assertFalse( internal.isSnapshots() );
-        mockAuditListener.clearEvents();
-    }
-
-    @Test
-    public void getById()
-        throws Exception
-    {
-        mockAuditListener.clearEvents();
-        ManagedRepository repo = managedRepositoryAdmin.getManagedRepository( "internal" );
-        assertNotNull( repo );
-        mockAuditListener.clearEvents();
-    }
-
-    @Test
-    public void addDeleteManagedRepo()
-        throws Exception
-    {
-        mockAuditListener.clearEvents();
-
-        String repoId = "test-new-one";
-
-        String repoLocation = APPSERVER_BASE_PATH + File.separator + repoId;
-
-        File repoDir = clearRepoLocation( repoLocation );
-
-        List<ManagedRepository> repos = managedRepositoryAdmin.getManagedRepositories();
-        assertNotNull( repos );
-        int initialSize = repos.size();
-        assertTrue( initialSize > 0 );
-
-        ManagedRepository repo = new ManagedRepository();
-        repo.setId( repoId );
-        repo.setName( "test repo" );
-        repo.setLocation( repoLocation );
-        repo.setCronExpression( "0 0 * * * ?" );
-        managedRepositoryAdmin.addManagedRepository( repo, false, getFakeAuditInformation() );
-        repos = managedRepositoryAdmin.getManagedRepositories();
-        assertNotNull( repos );
-        assertEquals( initialSize + 1, repos.size() );
-
-        assertNotNull( managedRepositoryAdmin.getManagedRepository( repoId ) );
-
-        assertTemplateRoleExists( repoId );
-
-        managedRepositoryAdmin.deleteManagedRepository( repoId, getFakeAuditInformation(), false );
-
-        // deleteContents false
-        assertTrue( repoDir.exists() );
-
-        repos = managedRepositoryAdmin.getManagedRepositories();
-        assertNotNull( repos );
-        assertEquals( initialSize, repos.size() );
-
-        assertTemplateRoleNotExists( repoId );
-
-        assertEquals( 2, mockAuditListener.getAuditEvents().size() );
-
-        assertAuditListenerCallAddAndDelete();
-
-        mockAuditListener.clearEvents();
-    }
-
-    @Test
-    public void updateDeleteManagedRepo()
-        throws Exception
-    {
-        String repoId = "test-new-one";
-
-        String repoLocation = APPSERVER_BASE_PATH + File.separator + "new-path";
-
-        File repoDir = clearRepoLocation( repoLocation );
-
-        mockAuditListener.clearEvents();
-        List<ManagedRepository> repos = managedRepositoryAdmin.getManagedRepositories();
-        assertNotNull( repos );
-        int initialSize = repos.size();
-        assertTrue( initialSize > 0 );
-
-        ManagedRepository repo = new ManagedRepository();
-        repo.setId( repoId );
-        repo.setName( "test repo" );
-        repo.setLocation( repoLocation );
-        repo.setCronExpression( "0 0 * * * ?" );
-        managedRepositoryAdmin.addManagedRepository( repo, false, getFakeAuditInformation() );
-
-        assertTemplateRoleExists( repoId );
-
-        repos = managedRepositoryAdmin.getManagedRepositories();
-        assertNotNull( repos );
-        assertEquals( initialSize + 1, repos.size() );
-
-        String newName = "test repo update";
-
-        repo.setName( newName );
-
-        repo.setLocation( repoLocation );
-        repo.setCronExpression( "0 0 * * * ?" );
-
-        managedRepositoryAdmin.updateManagedRepository( repo, false, getFakeAuditInformation(), false );
-
-        repo = managedRepositoryAdmin.getManagedRepository( repoId );
-        assertNotNull( repo );
-        assertEquals( newName, repo.getName() );
-        assertEquals( new File( repoLocation ).getCanonicalPath(), new File( repo.getLocation() ).getCanonicalPath() );
-        assertTrue( new File( repoLocation ).exists() );
-
-        assertTemplateRoleExists( repoId );
-
-        managedRepositoryAdmin.deleteManagedRepository( repo.getId(), getFakeAuditInformation(), false );
-
-        // check deleteContents false
-        assertTrue( repoDir.exists() );
-
-        assertTemplateRoleNotExists( repoId );
-
-        assertAuditListenerCallAndUpdateAddAndDelete( false );
-
-        mockAuditListener.clearEvents();
-
-    }
-
-
-    @Test
-    public void addDeleteManagedRepoWithStaged()
-        throws Exception
-    {
-
-        String repoId = "test-new-one";
-        String repoLocation = APPSERVER_BASE_PATH + File.separator + repoId;
-
-        File repoDir = clearRepoLocation( repoLocation );
-
-        mockAuditListener.clearEvents();
-        List<ManagedRepository> repos = managedRepositoryAdmin.getManagedRepositories();
-        assertNotNull( repos );
-        int initialSize = repos.size();
-        assertTrue( initialSize > 0 );
-
-        ManagedRepository repo = new ManagedRepository();
-        repo.setId( repoId );
-        repo.setName( "test repo" );
-        repo.setLocation( repoLocation );
-        repo.setCronExpression( "0 0 * * * ?" );
-        managedRepositoryAdmin.addManagedRepository( repo, true, getFakeAuditInformation() );
-        repos = managedRepositoryAdmin.getManagedRepositories();
-        assertNotNull( repos );
-        assertEquals( initialSize + 2, repos.size() );
-
-        assertNotNull( managedRepositoryAdmin.getManagedRepository( repoId ) );
-
-        assertTemplateRoleExists( repoId );
-
-        assertTrue( repoDir.exists() );
-
-        assertNotNull( managedRepositoryAdmin.getManagedRepository( repoId + STAGE_REPO_ID_END ) );
-
-        assertTemplateRoleExists( repoId + STAGE_REPO_ID_END );
-
-        assertTrue( new File( repoLocation + STAGE_REPO_ID_END ).exists() );
-
-        managedRepositoryAdmin.deleteManagedRepository( repoId, getFakeAuditInformation(), true );
-
-        assertFalse( repoDir.exists() );
-
-        assertFalse( new File( repoLocation + STAGE_REPO_ID_END ).exists() );
-
-        assertTemplateRoleNotExists( repoId + STAGE_REPO_ID_END );
-
-        repos = managedRepositoryAdmin.getManagedRepositories();
-        assertNotNull( repos );
-        assertEquals( initialSize, repos.size() );
-
-        assertTemplateRoleNotExists( repoId );
-
-        assertTemplateRoleNotExists( repoId + STAGE_REPO_ID_END );
-
-        mockAuditListener.clearEvents();
-
-    }
-
-    @Test
-    public void updateDeleteManagedRepoWithStagedRepo()
-        throws Exception
-    {
-        String repoId = "test-new-one";
-
-        String repoLocation = APPSERVER_BASE_PATH + File.separator + "new-path";
-
-        String stageRepoLocation = APPSERVER_BASE_PATH + File.separator + repoId;
-
-        File repoDir = clearRepoLocation( repoLocation );
-
-        mockAuditListener.clearEvents();
-        List<ManagedRepository> repos = managedRepositoryAdmin.getManagedRepositories();
-        assertNotNull( repos );
-        int initialSize = repos.size();
-        assertTrue( initialSize > 0 );
-
-        ManagedRepository repo = getTestManagedRepository( repoId, repoLocation );
-
-        managedRepositoryAdmin.addManagedRepository( repo, false, getFakeAuditInformation() );
-
-        assertTemplateRoleExists( repoId );
-
-        assertFalse( new File( repoLocation + STAGE_REPO_ID_END ).exists() );
-
-        assertTemplateRoleNotExists( repoId + STAGE_REPO_ID_END );
-
-        repos = managedRepositoryAdmin.getManagedRepositories();
-        assertNotNull( repos );
-        assertEquals( initialSize + 1, repos.size() );
-
-        repo = managedRepositoryAdmin.getManagedRepository( repoId );
-
-        assertEquals( getTestManagedRepository( repoId, repoLocation ).getIndexDirectory(), repo.getIndexDirectory() );
-
-        String newName = "test repo update";
-
-        repo.setName( newName );
-
-        repo.setLocation( repoLocation );
-
-        managedRepositoryAdmin.updateManagedRepository( repo, true, getFakeAuditInformation(), false );
-
-        repo = managedRepositoryAdmin.getManagedRepository( repoId );
-        assertNotNull( repo );
-        assertEquals( newName, repo.getName() );
-        assertEquals( new File( repoLocation ).getCanonicalPath(), new File( repo.getLocation() ).getCanonicalPath() );
-        assertTrue( new File( repoLocation ).exists() );
-        assertEquals( getTestManagedRepository( repoId, repoLocation ).getCronExpression(), repo.getCronExpression() );
-        assertEquals( getTestManagedRepository( repoId, repoLocation ).getLayout(), repo.getLayout() );
-        assertEquals( getTestManagedRepository( repoId, repoLocation ).getId(), repo.getId() );
-        assertEquals( getTestManagedRepository( repoId, repoLocation ).getIndexDirectory(), repo.getIndexDirectory() );
-
-        assertEquals( getTestManagedRepository( repoId, repoLocation ).getDaysOlder(), repo.getDaysOlder() );
-        assertEquals( getTestManagedRepository( repoId, repoLocation ).getRetentionCount(), repo.getRetentionCount() );
-        assertEquals( getTestManagedRepository( repoId, repoLocation ).isDeleteReleasedSnapshots(),
-                      repo.isDeleteReleasedSnapshots() );
-
-        assertTemplateRoleExists( repoId );
-
-        assertTrue( new File( stageRepoLocation + STAGE_REPO_ID_END ).exists() );
-
-        assertTemplateRoleExists( repoId + STAGE_REPO_ID_END );
-
-        managedRepositoryAdmin.deleteManagedRepository( repo.getId(), getFakeAuditInformation(), false );
-
-        // check deleteContents false
-        assertTrue( repoDir.exists() );
-
-        assertTemplateRoleNotExists( repoId );
-
-        assertTrue( new File( stageRepoLocation + STAGE_REPO_ID_END ).exists() );
-
-        assertTemplateRoleNotExists( repoId + STAGE_REPO_ID_END );
-
-        assertAuditListenerCallAndUpdateAddAndDelete( true );
-
-        mockAuditListener.clearEvents();
-
-    }
-
-    //----------------------------------
-    // utility methods
-    //----------------------------------
-
-    private void assertTemplateRoleExists( String repoId )
-        throws Exception
-    {
-        assertTrue( roleManager.templatedRoleExists( ArchivaRoleConstants.TEMPLATE_REPOSITORY_OBSERVER, repoId ) );
-        assertTrue( roleManager.templatedRoleExists( ArchivaRoleConstants.TEMPLATE_REPOSITORY_MANAGER, repoId ) );
-    }
-
-
-    private void assertTemplateRoleNotExists( String repoId )
-        throws Exception
-    {
-        assertFalse( roleManager.templatedRoleExists( ArchivaRoleConstants.TEMPLATE_REPOSITORY_OBSERVER, repoId ) );
-        assertFalse( roleManager.templatedRoleExists( ArchivaRoleConstants.TEMPLATE_REPOSITORY_MANAGER, repoId ) );
-    }
-
-    private void assertAuditListenerCallAddAndDelete()
-    {
-        assertEquals( 2, mockAuditListener.getAuditEvents().size() );
-
-        assertEquals( AuditEvent.ADD_MANAGED_REPO, mockAuditListener.getAuditEvents().get( 0 ).getAction() );
-        assertEquals( "root", mockAuditListener.getAuditEvents().get( 0 ).getUserId() );
-        assertEquals( "archiva-localhost", mockAuditListener.getAuditEvents().get( 0 ).getRemoteIP() );
-
-        assertEquals( AuditEvent.DELETE_MANAGED_REPO, mockAuditListener.getAuditEvents().get( 1 ).getAction() );
-        assertEquals( "root", mockAuditListener.getAuditEvents().get( 0 ).getUserId() );
-    }
-
-    private void assertAuditListenerCallAndUpdateAddAndDelete( boolean stageNeeded )
-    {
-        if ( stageNeeded )
-        {
-            assertEquals( "not 4 audit events " + mockAuditListener.getAuditEvents(), 4,
-                          mockAuditListener.getAuditEvents().size() );
-        }
-        else
-        {
-            assertEquals( "not 3 audit events " + mockAuditListener.getAuditEvents(), 3,
-                          mockAuditListener.getAuditEvents().size() );
-        }
-        assertEquals( AuditEvent.ADD_MANAGED_REPO, mockAuditListener.getAuditEvents().get( 0 ).getAction() );
-        assertEquals( "root", mockAuditListener.getAuditEvents().get( 0 ).getUserId() );
-        assertEquals( "archiva-localhost", mockAuditListener.getAuditEvents().get( 0 ).getRemoteIP() );
-
-        if ( stageNeeded )
-        {
-            assertEquals( AuditEvent.ADD_MANAGED_REPO, mockAuditListener.getAuditEvents().get( 1 ).getAction() );
-            assertEquals( AuditEvent.MODIFY_MANAGED_REPO, mockAuditListener.getAuditEvents().get( 2 ).getAction() );
-            assertEquals( AuditEvent.DELETE_MANAGED_REPO, mockAuditListener.getAuditEvents().get( 3 ).getAction() );
-        }
-        else
-        {
-            assertEquals( AuditEvent.MODIFY_MANAGED_REPO, mockAuditListener.getAuditEvents().get( 1 ).getAction() );
-            assertEquals( AuditEvent.DELETE_MANAGED_REPO, mockAuditListener.getAuditEvents().get( 2 ).getAction() );
-        }
-
-    }
-
-
-
-}
diff --git a/archiva-modules/archiva-base/archiva-repository-admin/src/test/java/org/apache/archiva/admin/repository/networkproxy/NetworkProxyAdminTest.java b/archiva-modules/archiva-base/archiva-repository-admin/src/test/java/org/apache/archiva/admin/repository/networkproxy/NetworkProxyAdminTest.java
deleted file mode 100644 (file)
index 840ba19..0000000
+++ /dev/null
@@ -1,142 +0,0 @@
-package org.apache.archiva.admin.repository.networkproxy;
-/*
- * 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.admin.repository.AbstractRepositoryAdminTest;
-import org.apache.archiva.audit.AuditEvent;
-import org.junit.Test;
-
-import javax.inject.Inject;
-
-/**
- * @author Olivier Lamy
- */
-public class NetworkProxyAdminTest
-    extends AbstractRepositoryAdminTest
-{
-
-    @Inject
-    private NetworkProxyAdmin networkProxyAdmin;
-
-    @Test
-    public void getAllEmpty()
-        throws Exception
-    {
-        assertNotNull( networkProxyAdmin.getNetworkProxies() );
-    }
-
-    @Test
-    public void addAndDelete()
-        throws Exception
-    {
-        mockAuditListener.clearEvents();
-        int initialSize = networkProxyAdmin.getNetworkProxies().size();
-        NetworkProxy networkProxy = getNetworkProxyTest( "foo" );
-
-        networkProxyAdmin.addNetworkProxy( networkProxy, getFakeAuditInformation() );
-
-        assertEquals( initialSize + 1, networkProxyAdmin.getNetworkProxies().size() );
-
-        networkProxy = networkProxyAdmin.getNetworkProxy( "foo" );
-
-        assertNotNull( networkProxy );
-        assertEquals( getNetworkProxyTest( "foo" ).getId(), networkProxy.getId() );
-        assertEquals( getNetworkProxyTest( "foo" ).getHost(), networkProxy.getHost() );
-        assertEquals( getNetworkProxyTest( "foo" ).getPassword(), networkProxy.getPassword() );
-        assertEquals( getNetworkProxyTest( "foo" ).getPort(), networkProxy.getPort() );
-        assertEquals( getNetworkProxyTest( "foo" ).getUsername(), networkProxy.getUsername() );
-        assertEquals( getNetworkProxyTest( "foo" ).getProtocol(), networkProxy.getProtocol() );
-
-        networkProxyAdmin.deleteNetworkProxy( "foo", getFakeAuditInformation() );
-
-        assertNull( networkProxyAdmin.getNetworkProxy( "foo" ) );
-
-        assertEquals( 2, mockAuditListener.getAuditEvents().size() );
-
-        assertEquals( AuditEvent.ADD_NETWORK_PROXY, mockAuditListener.getAuditEvents().get( 0 ).getAction() );
-        assertEquals( AuditEvent.DELETE_NETWORK_PROXY, mockAuditListener.getAuditEvents().get( 1 ).getAction() );
-
-        mockAuditListener.clearEvents();
-    }
-
-    @Test
-    public void addAndUpdateAndDelete()
-        throws Exception
-    {
-        mockAuditListener.clearEvents();
-        int initialSize = networkProxyAdmin.getNetworkProxies().size();
-        NetworkProxy networkProxy = getNetworkProxyTest( "foo" );
-
-        networkProxyAdmin.addNetworkProxy( networkProxy, getFakeAuditInformation() );
-
-        assertEquals( initialSize + 1, networkProxyAdmin.getNetworkProxies().size() );
-
-        networkProxy = networkProxyAdmin.getNetworkProxy( "foo" );
-
-        assertNotNull( networkProxy );
-        assertEquals( getNetworkProxyTest( "foo" ).getId(), networkProxy.getId() );
-        assertEquals( getNetworkProxyTest( "foo" ).getHost(), networkProxy.getHost() );
-        assertEquals( getNetworkProxyTest( "foo" ).getPassword(), networkProxy.getPassword() );
-        assertEquals( getNetworkProxyTest( "foo" ).getPort(), networkProxy.getPort() );
-        assertEquals( getNetworkProxyTest( "foo" ).getUsername(), networkProxy.getUsername() );
-        assertEquals( getNetworkProxyTest( "foo" ).getProtocol(), networkProxy.getProtocol() );
-
-        networkProxy.setHost( "https://toto.com" );
-        networkProxy.setPassword( "newpasswd" );
-        networkProxy.setPort( 9191 );
-        networkProxy.setProtocol( "http" );
-        networkProxy.setUsername( "newusername" );
-
-        networkProxyAdmin.updateNetworkProxy( networkProxy, getFakeAuditInformation() );
-
-        NetworkProxy updatedNetworkProxy = networkProxyAdmin.getNetworkProxy( "foo" );
-
-        assertNotNull( updatedNetworkProxy );
-        assertEquals( networkProxy.getId(), updatedNetworkProxy.getId() );
-        assertEquals( networkProxy.getHost(), updatedNetworkProxy.getHost() );
-        assertEquals( networkProxy.getPassword(), updatedNetworkProxy.getPassword() );
-        assertEquals( networkProxy.getPort(), updatedNetworkProxy.getPort() );
-        assertEquals( networkProxy.getUsername(), updatedNetworkProxy.getUsername() );
-        assertEquals( networkProxy.getProtocol(), updatedNetworkProxy.getProtocol() );
-
-        networkProxyAdmin.deleteNetworkProxy( "foo", getFakeAuditInformation() );
-
-        assertEquals( 3, mockAuditListener.getAuditEvents().size() );
-
-        assertEquals( AuditEvent.ADD_NETWORK_PROXY, mockAuditListener.getAuditEvents().get( 0 ).getAction() );
-        assertEquals( AuditEvent.MODIFY_NETWORK_PROXY, mockAuditListener.getAuditEvents().get( 1 ).getAction() );
-        assertEquals( AuditEvent.DELETE_NETWORK_PROXY, mockAuditListener.getAuditEvents().get( 2 ).getAction() );
-
-        mockAuditListener.clearEvents();
-    }
-
-
-    protected NetworkProxy getNetworkProxyTest( String id )
-    {
-        NetworkProxy networkProxy = new NetworkProxy();
-        networkProxy.setId( "foo" );
-        networkProxy.setHost( "http://foo.com" );
-        networkProxy.setPassword( "passwd" );
-        networkProxy.setPort( 9090 );
-        networkProxy.setUsername( "root" );
-        networkProxy.setProtocol( "https" );
-        return networkProxy;
-    }
-
-}
diff --git a/archiva-modules/archiva-base/archiva-repository-admin/src/test/java/org/apache/archiva/admin/repository/proxyconnector/ProxyConnectorAdminTest.java b/archiva-modules/archiva-base/archiva-repository-admin/src/test/java/org/apache/archiva/admin/repository/proxyconnector/ProxyConnectorAdminTest.java
deleted file mode 100644 (file)
index 8b1eaaf..0000000
+++ /dev/null
@@ -1,165 +0,0 @@
-package org.apache.archiva.admin.repository.proxyconnector;
-/*
- * 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.admin.repository.AbstractRepositoryAdminTest;
-import org.apache.archiva.admin.repository.remote.RemoteRepository;
-import org.apache.archiva.audit.AuditEvent;
-import org.junit.Test;
-
-import java.util.Arrays;
-
-/**
- * @author Olivier Lamy
- */
-public class ProxyConnectorAdminTest
-    extends AbstractRepositoryAdminTest
-{
-
-    @Test
-    public void addAndDelete()
-        throws Exception
-    {
-        mockAuditListener.clearEvents();
-        assertEquals( "not proxyConnectors 2 " + proxyConnectorAdmin.getProxyConnectors(), 2,
-                      proxyConnectorAdmin.getProxyConnectors().size() );
-        assertFalse( proxyConnectorAdmin.getProxyConnectors().isEmpty() );
-        ProxyConnector proxyConnector = new ProxyConnector();
-        proxyConnector.setSourceRepoId( "snapshots" );
-        proxyConnector.setTargetRepoId( "central" );
-        proxyConnectorAdmin.addProxyConnector( proxyConnector, getFakeAuditInformation() );
-
-        assertFalse( proxyConnectorAdmin.getProxyConnectors().isEmpty() );
-        assertEquals( 3, proxyConnectorAdmin.getProxyConnectors().size() );
-
-        assertNotNull( proxyConnectorAdmin.getProxyConnector( "snapshots", "central" ) );
-
-        proxyConnectorAdmin.deleteProxyConnector( proxyConnector, getFakeAuditInformation() );
-
-        assertEquals( 2, proxyConnectorAdmin.getProxyConnectors().size() );
-        assertFalse( proxyConnectorAdmin.getProxyConnectors().isEmpty() );
-
-        assertEquals( 2, mockAuditListener.getAuditEvents().size() );
-
-        assertEquals( AuditEvent.ADD_PROXY_CONNECTOR, mockAuditListener.getAuditEvents().get( 0 ).getAction() );
-        assertEquals( "root", mockAuditListener.getAuditEvents().get( 0 ).getUserId() );
-        assertEquals( "archiva-localhost", mockAuditListener.getAuditEvents().get( 0 ).getRemoteIP() );
-
-        assertEquals( AuditEvent.DELETE_PROXY_CONNECTOR, mockAuditListener.getAuditEvents().get( 1 ).getAction() );
-        assertEquals( "root", mockAuditListener.getAuditEvents().get( 1 ).getUserId() );
-
-        assertNull( proxyConnectorAdmin.getProxyConnector( "snapshots", "central" ) );
-
-        mockAuditListener.clearEvents();
-    }
-
-    @Test
-    public void addAndUpdateAndDelete()
-        throws Exception
-    {
-        mockAuditListener.clearEvents();
-        RemoteRepository remoteRepository = getRemoteRepository( "test-new-one" );
-
-        remoteRepositoryAdmin.addRemoteRepository( remoteRepository, getFakeAuditInformation() );
-
-        assertEquals( "not proxyConnectors 2 " + proxyConnectorAdmin.getProxyConnectors(), 2,
-                      proxyConnectorAdmin.getProxyConnectors().size() );
-        assertFalse( proxyConnectorAdmin.getProxyConnectors().isEmpty() );
-        ProxyConnector proxyConnector = new ProxyConnector();
-        proxyConnector.setSourceRepoId( "snapshots" );
-        proxyConnector.setTargetRepoId( "central" );
-        proxyConnector.setWhiteListPatterns( Arrays.asList( "foo", "bar" ) );
-        proxyConnectorAdmin.addProxyConnector( proxyConnector, getFakeAuditInformation() );
-
-        assertFalse( proxyConnectorAdmin.getProxyConnectors().isEmpty() );
-        assertEquals( 3, proxyConnectorAdmin.getProxyConnectors().size() );
-
-        assertNotNull( proxyConnectorAdmin.getProxyConnector( "snapshots", "central" ) );
-        assertEquals( Arrays.asList( "foo", "bar" ),
-                      proxyConnectorAdmin.getProxyConnector( "snapshots", "central" ).getWhiteListPatterns() );
-
-        proxyConnectorAdmin.deleteProxyConnector( proxyConnector, getFakeAuditInformation() );
-
-        proxyConnector.setTargetRepoId( remoteRepository.getId() );
-        proxyConnectorAdmin.addProxyConnector( proxyConnector, getFakeAuditInformation() );
-
-        assertNull( proxyConnectorAdmin.getProxyConnector( "snapshots", "central" ) );
-        assertNotNull( remoteRepository.getId(),
-                       proxyConnectorAdmin.getProxyConnector( "snapshots", remoteRepository.getId() ) );
-
-        proxyConnectorAdmin.deleteProxyConnector( proxyConnector, getFakeAuditInformation() );
-
-        assertNull( proxyConnectorAdmin.getProxyConnector( "snapshots", "central" ) );
-
-        assertEquals( 2, proxyConnectorAdmin.getProxyConnectors().size() );
-        assertFalse( proxyConnectorAdmin.getProxyConnectors().isEmpty() );
-
-        assertEquals( 5, mockAuditListener.getAuditEvents().size() );
-
-        assertEquals( AuditEvent.ADD_REMOTE_REPO, mockAuditListener.getAuditEvents().get( 0 ).getAction() );
-
-        assertEquals( AuditEvent.ADD_PROXY_CONNECTOR, mockAuditListener.getAuditEvents().get( 1 ).getAction() );
-        assertEquals( "root", mockAuditListener.getAuditEvents().get( 2 ).getUserId() );
-        assertEquals( "archiva-localhost", mockAuditListener.getAuditEvents().get( 2 ).getRemoteIP() );
-
-        assertEquals( AuditEvent.DELETE_PROXY_CONNECTOR, mockAuditListener.getAuditEvents().get( 2 ).getAction() );
-
-        assertEquals( AuditEvent.ADD_PROXY_CONNECTOR, mockAuditListener.getAuditEvents().get( 3 ).getAction() );
-
-        assertEquals( AuditEvent.DELETE_PROXY_CONNECTOR, mockAuditListener.getAuditEvents().get( 4 ).getAction() );
-        assertEquals( "root", mockAuditListener.getAuditEvents().get( 4 ).getUserId() );
-
-        remoteRepositoryAdmin.deleteRemoteRepository( remoteRepository.getId(), getFakeAuditInformation() );
-        mockAuditListener.clearEvents();
-    }
-
-    @Test
-    public void findProxyConnector()
-        throws Exception
-    {
-        ProxyConnector proxyConnector = proxyConnectorAdmin.getProxyConnector( "internal", "central" );
-        assertNotNull( proxyConnector );
-    }
-
-    @Test
-    public void updateProxyConnector()
-        throws Exception
-    {
-        mockAuditListener.clearEvents();
-        ProxyConnector proxyConnector = proxyConnectorAdmin.getProxyConnector( "internal", "central" );
-        assertNotNull( proxyConnector );
-        proxyConnector.setDisabled( false );
-        proxyConnectorAdmin.updateProxyConnector( proxyConnector, getFakeAuditInformation() );
-        proxyConnector = proxyConnectorAdmin.getProxyConnector( "internal", "central" );
-        assertFalse( proxyConnector.isDisabled() );
-
-        proxyConnector.setDisabled( true );
-        proxyConnectorAdmin.updateProxyConnector( proxyConnector, getFakeAuditInformation() );
-        proxyConnector = proxyConnectorAdmin.getProxyConnector( "internal", "central" );
-        assertTrue( proxyConnector.isDisabled() );
-
-        proxyConnector.setOrder( 4 );
-        proxyConnectorAdmin.updateProxyConnector( proxyConnector, getFakeAuditInformation() );
-        proxyConnector = proxyConnectorAdmin.getProxyConnector( "internal", "central" );
-        assertEquals( 4, proxyConnector.getOrder() );
-        mockAuditListener.clearEvents();
-
-    }
-
-}
diff --git a/archiva-modules/archiva-base/archiva-repository-admin/src/test/java/org/apache/archiva/admin/repository/remote/RemoteRepositoryAdminTest.java b/archiva-modules/archiva-base/archiva-repository-admin/src/test/java/org/apache/archiva/admin/repository/remote/RemoteRepositoryAdminTest.java
deleted file mode 100644 (file)
index 85f8ef7..0000000
+++ /dev/null
@@ -1,153 +0,0 @@
-package org.apache.archiva.admin.repository.remote;
-/*
- * 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.admin.repository.AbstractRepositoryAdminTest;
-import org.apache.archiva.audit.AuditEvent;
-import org.junit.Test;
-
-import java.util.List;
-
-/**
- * @author Olivier Lamy
- */
-public class RemoteRepositoryAdminTest
-    extends AbstractRepositoryAdminTest
-{
-
-    @Test
-    public void getAll()
-        throws Exception
-    {
-        List<RemoteRepository> remoteRepositories = remoteRepositoryAdmin.getRemoteRepositories();
-        assertNotNull( remoteRepositories );
-        assertTrue( remoteRepositories.size() > 0 );
-        log.info( "remote " + remoteRepositories );
-    }
-
-    @Test
-    public void getById()
-        throws Exception
-    {
-        RemoteRepository central = remoteRepositoryAdmin.getRemoteRepository( "central" );
-        assertNotNull( central );
-        assertEquals( "http://repo1.maven.org/maven2", central.getUrl() );
-        assertEquals( 60, central.getTimeout() );
-        assertNull( central.getUserName() );
-        assertNull( central.getPassword() );
-    }
-
-    @Test
-    public void addAndDelete()
-        throws Exception
-    {
-        mockAuditListener.clearEvents();
-        int initialSize = remoteRepositoryAdmin.getRemoteRepositories().size();
-
-        RemoteRepository remoteRepository = getRemoteRepository();
-
-        remoteRepositoryAdmin.addRemoteRepository( remoteRepository, getFakeAuditInformation() );
-
-        assertEquals( initialSize + 1, remoteRepositoryAdmin.getRemoteRepositories().size() );
-
-        RemoteRepository repo = remoteRepositoryAdmin.getRemoteRepository( "foo" );
-        assertNotNull( repo );
-        assertEquals( getRemoteRepository().getPassword(), repo.getPassword() );
-        assertEquals( getRemoteRepository().getUrl(), repo.getUrl() );
-        assertEquals( getRemoteRepository().getUserName(), repo.getUserName() );
-        assertEquals( getRemoteRepository().getName(), repo.getName() );
-        assertEquals( getRemoteRepository().getTimeout(), repo.getTimeout() );
-
-        remoteRepositoryAdmin.deleteRemoteRepository( "foo", getFakeAuditInformation() );
-
-        assertEquals( initialSize, remoteRepositoryAdmin.getRemoteRepositories().size() );
-
-        repo = remoteRepositoryAdmin.getRemoteRepository( "foo" );
-        assertNull( repo );
-
-        assertEquals( 2, mockAuditListener.getAuditEvents().size() );
-
-        assertEquals( AuditEvent.ADD_REMOTE_REPO, mockAuditListener.getAuditEvents().get( 0 ).getAction() );
-        assertEquals( "root", mockAuditListener.getAuditEvents().get( 0 ).getUserId() );
-        assertEquals( "archiva-localhost", mockAuditListener.getAuditEvents().get( 0 ).getRemoteIP() );
-
-        assertEquals( AuditEvent.DELETE_REMOTE_REPO, mockAuditListener.getAuditEvents().get( 1 ).getAction() );
-        assertEquals( "root", mockAuditListener.getAuditEvents().get( 1 ).getUserId() );
-
-    }
-
-
-    @Test
-    public void addAndUpdateAndDelete()
-        throws Exception
-    {
-        mockAuditListener.clearEvents();
-        int initialSize = remoteRepositoryAdmin.getRemoteRepositories().size();
-
-        RemoteRepository remoteRepository = getRemoteRepository();
-
-        remoteRepositoryAdmin.addRemoteRepository( remoteRepository, getFakeAuditInformation() );
-
-        assertEquals( initialSize + 1, remoteRepositoryAdmin.getRemoteRepositories().size() );
-
-        RemoteRepository repo = remoteRepositoryAdmin.getRemoteRepository( "foo" );
-        assertNotNull( repo );
-        assertEquals( getRemoteRepository().getPassword(), repo.getPassword() );
-        assertEquals( getRemoteRepository().getUrl(), repo.getUrl() );
-        assertEquals( getRemoteRepository().getUserName(), repo.getUserName() );
-        assertEquals( getRemoteRepository().getName(), repo.getName() );
-        assertEquals( getRemoteRepository().getTimeout(), repo.getTimeout() );
-
-        repo.setUserName( "foo-name-changed" );
-        repo.setPassword( "titi" );
-        repo.setUrl( "http://foo.com/maven-really-rocks" );
-
-        remoteRepositoryAdmin.updateRemoteRepository( repo, getFakeAuditInformation() );
-
-        repo = remoteRepositoryAdmin.getRemoteRepository( "foo" );
-
-        assertEquals( "foo-name-changed", repo.getUserName() );
-        assertEquals( "titi", repo.getPassword() );
-        assertEquals( "http://foo.com/maven-really-rocks", repo.getUrl() );
-
-        remoteRepositoryAdmin.deleteRemoteRepository( "foo", getFakeAuditInformation() );
-
-        assertEquals( initialSize, remoteRepositoryAdmin.getRemoteRepositories().size() );
-
-        repo = remoteRepositoryAdmin.getRemoteRepository( "foo" );
-        assertNull( repo );
-
-        assertEquals( 3, mockAuditListener.getAuditEvents().size() );
-
-        assertEquals( AuditEvent.ADD_REMOTE_REPO, mockAuditListener.getAuditEvents().get( 0 ).getAction() );
-        assertEquals( "root", mockAuditListener.getAuditEvents().get( 0 ).getUserId() );
-        assertEquals( "archiva-localhost", mockAuditListener.getAuditEvents().get( 0 ).getRemoteIP() );
-
-        assertEquals( AuditEvent.MODIFY_REMOTE_REPO, mockAuditListener.getAuditEvents().get( 1 ).getAction() );
-        assertEquals( "root", mockAuditListener.getAuditEvents().get( 1 ).getUserId() );
-        assertEquals( "archiva-localhost", mockAuditListener.getAuditEvents().get( 1 ).getRemoteIP() );
-
-        assertEquals( AuditEvent.DELETE_REMOTE_REPO, mockAuditListener.getAuditEvents().get( 2 ).getAction() );
-        assertEquals( "root", mockAuditListener.getAuditEvents().get( 2 ).getUserId() );
-
-    }
-
-
-
-}
diff --git a/archiva-modules/archiva-base/archiva-repository-admin/src/test/resources/META-INF/redback/redback-core.xml b/archiva-modules/archiva-base/archiva-repository-admin/src/test/resources/META-INF/redback/redback-core.xml
deleted file mode 100644 (file)
index ecc1de8..0000000
+++ /dev/null
@@ -1,213 +0,0 @@
-<redback-role-model>
-    <modelVersion>1.0.0</modelVersion>
-    <applications>
-        <application>
-          <id>System</id>
-          <description>Roles that apply system-wide, across all of the applications</description>
-        <version>1.0.0</version>
-        <resources>
-            <resource>
-                <id>global</id>
-                <name>*</name>
-                <permanent>true</permanent>
-                <description>global resource implies full access for authorization</description>
-            </resource>
-            <resource>
-                <id>username</id>
-                <name>${username}</name>
-                <permanent>true</permanent>
-                <description>replaced with the username of the principal at authorization check time</description>
-            </resource>
-        </resources>
-        <operations>
-            <operation>
-                <id>configuration-edit</id>
-                <name>configuration-edit</name>
-                <description>edit configuration</description>
-                <permanent>true</permanent>
-            </operation>
-            <operation>
-                <id>user-management-user-create</id>
-                <name>user-management-user-create</name>
-                <description>create user</description>
-                <permanent>true</permanent>
-            </operation>
-            <operation>
-                <id>user-management-user-edit</id>
-                <name>user-management-user-edit</name>
-                <description>edit user</description>
-                <permanent>true</permanent>
-            </operation>
-            <operation>
-                <id>user-management-user-role</id>
-                <name>user-management-user-role</name>
-                <description>user roles</description>
-                <permanent>true</permanent>
-            </operation>
-            <operation>
-                <id>user-management-user-delete</id>
-                <name>user-management-user-delete</name>
-                <description>delete user</description>
-                <permanent>true</permanent>
-            </operation>
-            <operation>
-                <id>user-management-user-list</id>
-                <name>user-management-user-list</name>
-                <description>list users</description>
-                <permanent>true</permanent>
-            </operation>
-            <operation>
-                <id>user-management-role-grant</id>
-                <name>user-management-role-grant</name>
-                <description>grant role</description>
-                <permanent>true</permanent>
-            </operation>
-            <operation>
-                <id>user-management-role-drop</id>
-                <name>user-management-role-drop</name>
-                <description>drop role</description>
-                <permanent>true</permanent>
-            </operation>
-            <operation>
-                <id>user-management-rbac-admin</id>
-                <name>user-management-rbac-admin</name>
-                <description>administer rbac</description>
-                <permanent>true</permanent>
-            </operation>
-            <operation>
-                <id>guest-access</id>
-                <name>guest-access</name>
-                <description>access guest</description>
-                <permanent>true</permanent>
-            </operation>
-            <operation>
-                <id>user-management-manage-data</id>
-                <name>user-management-manage-data</name>
-                <description>manage data</description>
-                <permanent>true</permanent>
-            </operation>            
-        </operations>
-        <roles>
-            <role>
-                <id>system-administrator</id>
-                <name>System Administrator</name>
-                <permanent>true</permanent>
-                <assignable>true</assignable>
-                <permissions>
-                    <permission>
-                        <id>edit-redback-configuration</id>
-                        <name>Edit Redback Configuration</name>
-                        <operation>configuration-edit</operation>
-                        <resource>global</resource>
-                        <permanent>true</permanent>
-                    </permission>
-                    <permission>
-                        <id>manage-rbac-setup</id>
-                        <name>User RBAC Management</name>
-                        <operation>user-management-rbac-admin</operation>
-                        <resource>global</resource>
-                        <permanent>true</permanent>
-                    </permission>
-                    <permission>
-                        <id>manage-rbac-data</id>
-                        <name>RBAC Manage Data</name>
-                        <operation>user-management-manage-data</operation>
-                        <resource>global</resource>
-                        <permanent>true</permanent>
-                    </permission>                    
-                </permissions>
-                <childRoles>
-                    <childRole>user-administrator</childRole>
-                </childRoles>
-            </role>
-            <role>
-                <id>user-administrator</id>
-                <name>User Administrator</name>
-                <permanent>true</permanent>
-                <assignable>true</assignable>
-                <permissions>
-                    <permission>
-                        <id>drop-roles-for-anyone</id>
-                        <name>Drop Roles for Anyone</name>
-                        <operation>user-management-role-drop</operation>
-                        <resource>global</resource>
-                        <permanent>true</permanent>
-                    </permission>
-                    <permission>
-                        <id>grant-roles-for-anyone</id>
-                        <name>Grant Roles for Anyone</name>
-                        <operation>user-management-role-grant</operation>
-                        <resource>global</resource>
-                        <permanent>true</permanent>
-                    </permission>
-                    <permission>
-                        <id>user-create</id>
-                        <name>Create Users</name>
-                        <operation>user-management-user-create</operation>
-                        <resource>global</resource>
-                        <permanent>true</permanent>
-                    </permission>
-                    <permission>
-                        <id>user-delete</id>
-                        <name>Delete Users</name>
-                        <operation>user-management-user-delete</operation>
-                        <resource>global</resource>
-                        <permanent>true</permanent>
-                    </permission>
-                    <permission>
-                        <id>user-edit</id>
-                        <name>Edit Users</name>
-                        <operation>user-management-user-edit</operation>
-                        <resource>global</resource>
-                        <permanent>true</permanent>
-                    </permission>
-                    <permission>
-                        <id>access-users-roles</id>
-                        <name>Access Users Roles</name>
-                        <operation>user-management-user-role</operation>
-                        <resource>global</resource>
-                        <permanent>true</permanent>
-                    </permission>
-                    <permission>
-                        <id>access-user-list</id>
-                        <name>Access User List</name>
-                        <operation>user-management-user-list</operation>
-                        <resource>global</resource>
-                        <permanent>true</permanent>
-                    </permission>
-                </permissions>
-            </role>
-            <role>
-                <id>registered-user</id>
-                <name>Registered User</name>
-                <permanent>true</permanent>
-                <assignable>true</assignable>
-                <permissions>
-                    <permission>
-                        <id>edit-user-by-username</id>
-                        <name>Edit User Data by Username</name>
-                        <operation>user-management-user-edit</operation>
-                        <resource>username</resource>
-                        <permanent>true</permanent>
-                    </permission>
-                </permissions>
-            </role>
-            <role>
-                <id>guest</id>
-                <name>Guest</name>
-                <permanent>true</permanent>
-                <assignable>true</assignable>
-                <permissions>
-                    <permission>
-                        <id>guest-permission</id>
-                        <name>Guest Permission</name>
-                        <operation>guest-access</operation>
-                        <resource>global</resource>
-                        <permanent>true</permanent>
-                    </permission>
-                </permissions>
-            </role>
-        </roles>
-        </application>
-    </applications>
-</redback-role-model>
\ No newline at end of file
diff --git a/archiva-modules/archiva-base/archiva-repository-admin/src/test/resources/log4j.xml b/archiva-modules/archiva-base/archiva-repository-admin/src/test/resources/log4j.xml
deleted file mode 100644 (file)
index 9b1a658..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<!--
-  ~ 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.
-  -->
-
-<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
-
-<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
-
-  <appender name="console" class="org.apache.log4j.ConsoleAppender">
-    <layout class="org.apache.log4j.PatternLayout">
-      <param name="ConversionPattern" value="%d [%t] %-5p %c %x - %m%n"/>
-    </layout>
-  </appender>
-
-
-
-  <logger name="org.apache.archiva.admin.repository.managed" >
-    <level value="debug"/>
-  </logger>
-  <logger name="JPOX">
-    <level value="ERROR"/>
-  </logger>
-
-  <logger name="org.springframework">
-    <level value="error"/>
-  </logger>
-
-  <root>
-    <priority value ="info" />
-    <appender-ref ref="console" />
-  </root>
-
-</log4j:configuration>
diff --git a/archiva-modules/archiva-base/archiva-repository-admin/src/test/resources/spring-context.xml b/archiva-modules/archiva-base/archiva-repository-admin/src/test/resources/spring-context.xml
deleted file mode 100644 (file)
index a18703d..0000000
+++ /dev/null
@@ -1,59 +0,0 @@
-<?xml version="1.0"?>
-
-<!--
-  ~ 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.
-  -->
-<beans xmlns="http://www.springframework.org/schema/beans"
-       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-       xmlns:context="http://www.springframework.org/schema/context"
-       xsi:schemaLocation="http://www.springframework.org/schema/beans
-           http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
-           http://www.springframework.org/schema/context 
-           http://www.springframework.org/schema/context/spring-context-3.0.xsd" default-lazy-init="true">
-
-  <context:annotation-config/>
-  <context:component-scan base-package="org.apache.archiva.admin.mock"/>
-
-  <bean name="scheduler" class="org.codehaus.redback.components.scheduler.DefaultScheduler">
-    <property name="properties">
-      <props>
-        <prop key="org.quartz.scheduler.instanceName">scheduler1</prop>
-        <prop key="org.quartz.threadPool.class">org.quartz.simpl.SimpleThreadPool</prop>
-        <prop key="org.quartz.threadPool.threadCount">2</prop>
-        <prop key="org.quartz.threadPool.threadPriority">4</prop>
-        <prop key="org.quartz.jobStore.class">org.quartz.simpl.RAMJobStore</prop>
-      </props>
-    </property>
-  </bean>
-
-  <bean name="commons-configuration" class="org.codehaus.redback.components.registry.commons.CommonsConfigurationRegistry">
-    <property name="properties">
-      <value>
-        <![CDATA[
-        <configuration>
-          <system/>
-          <xml fileName="${appserver.base}/conf/archiva.xml" config-forceCreate="true"
-               config-optional="true"
-               config-name="org.apache.maven.archiva.base" config-at="org.apache.maven.archiva"/>
-        </configuration>
-        ]]>
-      </value>
-    </property>
-  </bean>
-
-</beans>
\ No newline at end of file
index de2da68ca3b09b2c908e7a033f3f26c4c801fbe5..c8c01410ec991932c29d6595ba54fd7b8e64f3a9 100644 (file)
@@ -19,7 +19,7 @@ package org.apache.maven.archiva.repository;
  * under the License.
  */
 
-import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
+import org.apache.archiva.admin.model.managed.ManagedRepository;
 import org.apache.maven.archiva.model.ArchivaArtifact;
 import org.apache.maven.archiva.model.ArtifactReference;
 import org.apache.maven.archiva.model.ProjectReference;
@@ -30,7 +30,7 @@ import java.io.File;
 import java.util.Set;
 
 /**
- * ManagedRepositoryContent interface for interacting with a managed repository in an abstract way, 
+ * ManagedRepositoryContent interface for interacting with a managed repository in an abstract way,
  * without the need for processing based on filesystem paths, or working with the database.
  *
  * @version $Id$
@@ -40,9 +40,9 @@ public interface ManagedRepositoryContent
     /**
      * Delete from the managed repository all files / directories associated with the
      * provided version reference.
-     * 
+     *
      * @param reference the version reference to delete.
-     * @throws ContentNotFoundException 
+     * @throws ContentNotFoundException
      */
     void deleteVersion( VersionedReference reference )
         throws ContentNotFoundException;
@@ -51,11 +51,11 @@ public interface ManagedRepositoryContent
      * <p>
      * Convenience method to get the repository id.
      * </p>
-     * 
+     * <p/>
      * <p>
      * Equivalent to calling <code>.getRepository().getId()</code>
      * </p>
-     * 
+     *
      * @return the repository id.
      */
     String getId();
@@ -63,18 +63,18 @@ public interface ManagedRepositoryContent
     /**
      * <p>
      * Gather up the list of related artifacts to the ArtifactReference provided.
-     * This typically inclues the pom files, and those things with 
+     * This typically inclues the pom files, and those things with
      * classifiers (such as doc, source code, test libs, etc...)
      * </p>
-     * 
+     * <p/>
      * <p>
      * <strong>NOTE:</strong> Some layouts (such as maven 1 "legacy") are not compatible with this query.
-     * </p> 
-     * 
+     * </p>
+     *
      * @param reference the reference to work off of.
      * @return the set of ArtifactReferences for related artifacts.
      * @throws ContentNotFoundException if the initial artifact reference does not exist within the repository.
-     * @throws LayoutException 
+     * @throws LayoutException
      */
     Set<ArtifactReference> getRelatedArtifacts( ArtifactReference reference )
         throws ContentNotFoundException;
@@ -83,11 +83,11 @@ public interface ManagedRepositoryContent
      * <p>
      * Convenience method to get the repository (on disk) root directory.
      * </p>
-     * 
+     * <p/>
      * <p>
      * Equivalent to calling <code>.getRepository().getLocation()</code>
      * </p>
-     * 
+     *
      * @return the repository (on disk) root directory.
      */
     String getRepoRoot();
@@ -95,19 +95,19 @@ public interface ManagedRepositoryContent
     /**
      * Get the repository configuration associated with this
      * repository content.
-     * 
+     *
      * @return the repository that is associated with this repository content.
      */
-    ManagedRepositoryConfiguration getRepository();
+    ManagedRepository getRepository();
 
     /**
      * Given a specific {@link ProjectReference}, return the list of available versions for
      * that project reference.
-     * 
+     *
      * @param reference the project reference to work off of.
      * @return the list of versions found for that project reference.
      * @throws ContentNotFoundException if the project reference does nto exist within the repository.
-     * @throws LayoutException 
+     * @throws LayoutException
      */
     Set<String> getVersions( ProjectReference reference )
         throws ContentNotFoundException, LayoutException;
@@ -117,50 +117,50 @@ public interface ManagedRepositoryContent
      * Given a specific {@link VersionedReference}, return the list of available versions for that
      * versioned reference.
      * </p>
-     * 
+     * <p/>
      * <p>
      * <strong>NOTE:</strong> This is really only useful when working with SNAPSHOTs.
      * </p>
-     * 
+     *
      * @param reference the versioned reference to work off of.
      * @return the set of versions found.
      * @throws ContentNotFoundException if the versioned reference does not exist within the repository.
-     * @throws LayoutException 
+     * @throws LayoutException
      */
-    public Set<String> getVersions( VersionedReference reference )
+    Set<String> getVersions( VersionedReference reference )
         throws ContentNotFoundException;
 
     /**
      * Determines if the artifact referenced exists in the repository.
-     * 
+     *
      * @param reference the artifact reference to check for.
      * @return true if the artifact referenced exists.
      */
-    public boolean hasContent( ArtifactReference reference );
+    boolean hasContent( ArtifactReference reference );
 
     /**
      * Determines if the project referenced exists in the repository.
-     * 
+     *
      * @param reference the project reference to check for.
      * @return true it the project referenced exists.
      */
-    public boolean hasContent( ProjectReference reference );
+    boolean hasContent( ProjectReference reference );
 
     /**
      * Determines if the version reference exists in the repository.
-     * 
+     *
      * @param reference the version reference to check for.
      * @return true if the version referenced exists.
      */
-    public boolean hasContent( VersionedReference reference );
+    boolean hasContent( VersionedReference reference );
 
     /**
      * Set the repository configuration to associate with this
      * repository content.
-     * 
+     *
      * @param repo the repository to associate with this repository content.
      */
-    public void setRepository( ManagedRepositoryConfiguration repo );
+    void setRepository( ManagedRepository repo );
 
     /**
      * Given a repository relative path to a filename, return the {@link VersionedReference} object suitable for the path.
@@ -170,7 +170,7 @@ public interface ManagedRepositoryContent
      *         a {@link ArtifactReference})
      * @throws LayoutException if there was a problem converting the path to an artifact.
      */
-    public ArtifactReference toArtifactReference( String path )
+    ArtifactReference toArtifactReference( String path )
         throws LayoutException;
 
     /**
@@ -179,33 +179,33 @@ public interface ManagedRepositoryContent
      * @param reference the artifact reference to use.
      * @return the relative path to the artifact.
      */
-    public File toFile( ArtifactReference reference );
-    
+    File toFile( ArtifactReference reference );
+
     /**
      * Given an {@link ArchivaArtifact}, return the file reference to the artifact.
      *
      * @param reference the archiva artifact to use.
      * @return the relative path to the artifact.
      */
-    public File toFile( ArchivaArtifact reference );
+    File toFile( ArchivaArtifact reference );
 
     /**
      * Given a {@link ProjectReference}, return the path to the metadata for
-     * the project. 
-     * 
+     * the project.
+     *
      * @param reference the reference to use.
      * @return the path to the metadata file, or null if no metadata is appropriate.
      */
-    public String toMetadataPath( ProjectReference reference );
+    String toMetadataPath( ProjectReference reference );
 
     /**
      * Given a {@link VersionedReference}, return the path to the metadata for
-     * the specific version of the project. 
-     * 
+     * the specific version of the project.
+     *
      * @param reference the reference to use.
      * @return the path to the metadata file, or null if no metadata is appropriate.
      */
-    public String toMetadataPath( VersionedReference reference );
+    String toMetadataPath( VersionedReference reference );
 
     /**
      * Given an {@link ArtifactReference}, return the relative path to the artifact.
@@ -213,13 +213,13 @@ public interface ManagedRepositoryContent
      * @param reference the artifact reference to use.
      * @return the relative path to the artifact.
      */
-    public String toPath( ArtifactReference reference );
-    
+    String toPath( ArtifactReference reference );
+
     /**
      * Given an {@link ArchivaArtifact}, return the relative path to the artifact.
      *
      * @param reference the archiva artifact to use.
      * @return the relative path to the artifact.
      */
-    public String toPath( ArchivaArtifact reference );
+    String toPath( ArchivaArtifact reference );
 }
index 0da4dd8462027fb9e456bb6f23be56b20cf49d03..68d7318197cc56c67882de91e2c5718b5268b018 100644 (file)
@@ -19,6 +19,7 @@ package org.apache.maven.archiva.repository;
  * under the License.
  */
 
+import org.apache.archiva.admin.model.remote.RemoteRepository;
 import org.apache.maven.archiva.configuration.RemoteRepositoryConfiguration;
 import org.apache.maven.archiva.model.ArtifactReference;
 import org.apache.maven.archiva.model.RepositoryURL;
@@ -51,7 +52,7 @@ public interface RemoteRepositoryContent
      * 
      * @return the repository that is associated with this repository content.
      */
-    RemoteRepositoryConfiguration getRepository();
+    RemoteRepository getRepository();
 
     /**
      * <p>
@@ -72,7 +73,7 @@ public interface RemoteRepositoryContent
      * 
      * @param repo the repository to associate with this repository content.
      */
-    void setRepository( RemoteRepositoryConfiguration repo );
+    void setRepository( RemoteRepository repo );
 
     /**
      * Given a repository relative path to a filename, return the {@link VersionedReference} object suitable for the path.
index af79060b679c46190cad7b41c39a43e9a6d0db56..dfbb7b23c3f0828164026845600f2edf70c95d61 100644 (file)
@@ -19,10 +19,13 @@ package org.apache.maven.archiva.repository;
  * under the License.
  */
 
+import org.apache.archiva.admin.model.RepositoryAdminException;
+import org.apache.archiva.admin.model.managed.ManagedRepository;
+import org.apache.archiva.admin.model.managed.ManagedRepositoryAdmin;
+import org.apache.archiva.admin.model.remote.RemoteRepository;
+import org.apache.archiva.admin.model.remote.RemoteRepositoryAdmin;
 import org.apache.maven.archiva.configuration.ArchivaConfiguration;
 import org.apache.maven.archiva.configuration.ConfigurationNames;
-import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
-import org.apache.maven.archiva.configuration.RemoteRepositoryConfiguration;
 import org.codehaus.plexus.registry.Registry;
 import org.codehaus.plexus.registry.RegistryListener;
 import org.springframework.context.ApplicationContext;
@@ -48,6 +51,12 @@ public class RepositoryContentFactory
     @Inject
     private ArchivaConfiguration archivaConfiguration;
 
+    @Inject
+    private ManagedRepositoryAdmin managedRepositoryAdmin;
+
+    @Inject
+    private RemoteRepositoryAdmin remoteRepositoryAdmin;
+
     @Inject
     private ApplicationContext applicationContext;
 
@@ -73,51 +82,65 @@ public class RepositoryContentFactory
     public ManagedRepositoryContent getManagedRepositoryContent( String repoId )
         throws RepositoryNotFoundException, RepositoryException
     {
-        ManagedRepositoryContent repo = managedContentMap.get( repoId );
-
-        if ( repo != null )
+        try
         {
+            ManagedRepositoryContent repo = managedContentMap.get( repoId );
+
+            if ( repo != null )
+            {
+                return repo;
+            }
+
+            ManagedRepository repoConfig = managedRepositoryAdmin.getManagedRepository( repoId );
+            if ( repoConfig == null )
+            {
+                throw new RepositoryNotFoundException(
+                    "Unable to find managed repository configuration for id:" + repoId );
+            }
+
+            repo = applicationContext.getBean( "managedRepositoryContent#" + repoConfig.getLayout(),
+                                               ManagedRepositoryContent.class );
+            repo.setRepository( repoConfig );
+            managedContentMap.put( repoId, repo );
+
             return repo;
         }
-
-        ManagedRepositoryConfiguration repoConfig =
-            archivaConfiguration.getConfiguration().findManagedRepositoryById( repoId );
-        if ( repoConfig == null )
+        catch ( RepositoryAdminException e )
         {
-            throw new RepositoryNotFoundException( "Unable to find managed repository configuration for id:" + repoId );
+            throw new RepositoryException( e.getMessage(), e );
         }
-
-        repo = applicationContext.getBean( "managedRepositoryContent#" + repoConfig.getLayout(),
-                                           ManagedRepositoryContent.class );
-        repo.setRepository( repoConfig );
-        managedContentMap.put( repoId, repo );
-
-        return repo;
     }
 
     public RemoteRepositoryContent getRemoteRepositoryContent( String repoId )
         throws RepositoryNotFoundException, RepositoryException
     {
-        RemoteRepositoryContent repo = remoteContentMap.get( repoId );
-
-        if ( repo != null )
+        try
         {
+            RemoteRepositoryContent repo = remoteContentMap.get( repoId );
+
+            if ( repo != null )
+            {
+                return repo;
+            }
+
+            RemoteRepository repoConfig = remoteRepositoryAdmin.getRemoteRepository( repoId );
+            if ( repoConfig == null )
+            {
+                throw new RepositoryNotFoundException(
+                    "Unable to find remote repository configuration for id:" + repoId );
+            }
+
+            repo = applicationContext.getBean( "remoteRepositoryContent#" + repoConfig.getLayout(),
+                                               RemoteRepositoryContent.class );
+            repo.setRepository( repoConfig );
+            remoteContentMap.put( repoId, repo );
+
             return repo;
         }
-
-        RemoteRepositoryConfiguration repoConfig =
-            archivaConfiguration.getConfiguration().findRemoteRepositoryById( repoId );
-        if ( repoConfig == null )
+        catch ( RepositoryAdminException e )
         {
-            throw new RepositoryNotFoundException( "Unable to find remote repository configuration for id:" + repoId );
+            throw new RepositoryException( e.getMessage(), e );
         }
-
-        repo = applicationContext.getBean( "remoteRepositoryContent#" + repoConfig.getLayout(),
-                                           RemoteRepositoryContent.class );
-        repo.setRepository( repoConfig );
-        remoteContentMap.put( repoId, repo );
-
-        return repo;
     }
 
 
index df0005be698b7dcf077c1280cd171c978d29aed6..2634d0e21c82adcfd745763f3e2ea687cd838773 100644 (file)
@@ -19,6 +19,7 @@ package org.apache.maven.archiva.repository.content;
  * under the License.
  */
 
+import org.apache.archiva.admin.model.managed.ManagedRepository;
 import org.apache.archiva.metadata.repository.storage.maven2.DefaultArtifactMappingProvider;
 import org.apache.commons.io.FileUtils;
 import org.apache.maven.archiva.common.utils.PathUtil;
@@ -57,7 +58,7 @@ public class ManagedDefaultRepositoryContent
     @Named(value = "fileTypes" )
     private FileTypes filetypes;
 
-    private ManagedRepositoryConfiguration repository;
+    private ManagedRepository repository;
 
     public ManagedDefaultRepositoryContent()
     {
@@ -148,7 +149,7 @@ public class ManagedDefaultRepositoryContent
         return repository.getLocation();
     }
 
-    public ManagedRepositoryConfiguration getRepository()
+    public ManagedRepository getRepository()
     {
         return repository;
     }
@@ -316,7 +317,7 @@ public class ManagedDefaultRepositoryContent
         }
     }
 
-    public void setRepository( ManagedRepositoryConfiguration repository )
+    public void setRepository( ManagedRepository repository )
     {
         this.repository = repository;
     }
index 45b5d77aac554390ffbe9d43eae98da854d7caf2..c4aefc14653a63ff9fcc79794598c1c7db36194a 100644 (file)
@@ -19,6 +19,7 @@ package org.apache.maven.archiva.repository.content;
  * under the License.
  */
 
+import org.apache.archiva.admin.model.managed.ManagedRepository;
 import org.apache.commons.collections.CollectionUtils;
 import org.apache.commons.lang.StringUtils;
 import org.apache.maven.archiva.common.utils.PathUtil;
@@ -58,7 +59,7 @@ public class ManagedLegacyRepositoryContent
     @Inject
     private FileTypes filetypes;
 
-    private ManagedRepositoryConfiguration repository;
+    private ManagedRepository repository;
 
     public void deleteVersion( VersionedReference reference )
         throws ContentNotFoundException
@@ -198,7 +199,7 @@ public class ManagedLegacyRepositoryContent
         return repository.getLocation();
     }
 
-    public ManagedRepositoryConfiguration getRepository()
+    public ManagedRepository getRepository()
     {
         return repository;
     }
@@ -315,7 +316,7 @@ public class ManagedLegacyRepositoryContent
         }
     }
 
-    public void setRepository( ManagedRepositoryConfiguration repository )
+    public void setRepository( ManagedRepository repository )
     {
         this.repository = repository;
     }
index 886b0415afb1b6de70ec2cd4a3cff7731edb75eb..f0644325c46c86a17557614bb30b26a7ba6b4770 100644 (file)
@@ -19,6 +19,7 @@ package org.apache.maven.archiva.repository.content;
  * under the License.
  */
 
+import org.apache.archiva.admin.model.remote.RemoteRepository;
 import org.apache.maven.archiva.configuration.RemoteRepositoryConfiguration;
 import org.apache.maven.archiva.model.ArtifactReference;
 import org.apache.maven.archiva.model.RepositoryURL;
@@ -38,14 +39,14 @@ public class RemoteDefaultRepositoryContent
     extends AbstractDefaultRepositoryContent
     implements RemoteRepositoryContent
 {
-    private RemoteRepositoryConfiguration repository;
+    private RemoteRepository repository;
 
     public String getId()
     {
         return repository.getId();
     }
 
-    public RemoteRepositoryConfiguration getRepository()
+    public RemoteRepository getRepository()
     {
         return repository;
     }
@@ -55,7 +56,7 @@ public class RemoteDefaultRepositoryContent
         return new RepositoryURL( repository.getUrl() );
     }
 
-    public void setRepository( RemoteRepositoryConfiguration repository )
+    public void setRepository( RemoteRepository repository )
     {
         this.repository = repository;
     }
index f6d946885d3f93c767dc1afd8c51efee4458c227..f9d80992a5adb9e9dcd851f96990a6c93c0de65e 100644 (file)
@@ -19,6 +19,7 @@ package org.apache.maven.archiva.repository.content;
  * under the License.
  */
 
+import org.apache.archiva.admin.model.remote.RemoteRepository;
 import org.apache.maven.archiva.configuration.RemoteRepositoryConfiguration;
 import org.apache.maven.archiva.model.ArtifactReference;
 import org.apache.maven.archiva.model.RepositoryURL;
@@ -39,14 +40,14 @@ public class RemoteLegacyRepositoryContent
     extends AbstractLegacyRepositoryContent
     implements RemoteRepositoryContent
 {
-    private RemoteRepositoryConfiguration repository;
+    private RemoteRepository repository;
 
     public String getId()
     {
         return repository.getId();
     }
 
-    public RemoteRepositoryConfiguration getRepository()
+    public RemoteRepository getRepository()
     {
         return repository;
     }
@@ -56,7 +57,7 @@ public class RemoteLegacyRepositoryContent
         return new RepositoryURL( repository.getUrl() );
     }
 
-    public void setRepository( RemoteRepositoryConfiguration repository )
+    public void setRepository( RemoteRepository repository )
     {
         this.repository = repository;
     }
index faa427564e2381999a200e130f5f71a00d3b9ab6..f72078c3487fd96352eec9c13ba1916d465807ae 100644 (file)
@@ -19,6 +19,8 @@ package org.apache.maven.archiva.repository;
  * under the License.
  */
 
+import org.apache.archiva.admin.model.managed.ManagedRepository;
+import org.apache.archiva.admin.model.remote.RemoteRepository;
 import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
 import org.apache.maven.archiva.configuration.RemoteRepositoryConfiguration;
 import org.junit.Rule;
@@ -46,18 +48,18 @@ public abstract class AbstractRepositoryLayerTestCase
     @Inject
     protected ApplicationContext applicationContext;
 
-    protected ManagedRepositoryConfiguration createRepository( String id, String name, File location )
+    protected ManagedRepository createRepository( String id, String name, File location )
     {
-        ManagedRepositoryConfiguration repo = new ManagedRepositoryConfiguration();
+        ManagedRepository repo = new ManagedRepository();
         repo.setId( id );
         repo.setName( name );
         repo.setLocation( location.getAbsolutePath() );
         return repo;
     }
 
-    protected RemoteRepositoryConfiguration createRemoteRepository( String id, String name, String url )
+    protected RemoteRepository createRemoteRepository( String id, String name, String url )
     {
-        RemoteRepositoryConfiguration repo = new RemoteRepositoryConfiguration();
+        RemoteRepository repo = new RemoteRepository();
         repo.setId( id );
         repo.setName( name );
         repo.setUrl( url );
@@ -68,7 +70,7 @@ public abstract class AbstractRepositoryLayerTestCase
                                                                        String layout )
         throws Exception
     {
-        ManagedRepositoryConfiguration repo = new ManagedRepositoryConfiguration();
+        ManagedRepository repo = new ManagedRepository();
         repo.setId( id );
         repo.setName( name );
         repo.setLocation( location.getAbsolutePath() );
@@ -84,7 +86,7 @@ public abstract class AbstractRepositoryLayerTestCase
     protected RemoteRepositoryContent createRemoteRepositoryContent( String id, String name, String url, String layout )
         throws Exception
     {
-        RemoteRepositoryConfiguration repo = new RemoteRepositoryConfiguration();
+        RemoteRepository repo = new RemoteRepository();
         repo.setId( id );
         repo.setName( name );
         repo.setUrl( url );
index 0198271e9d79e0c3553a2abd779313d0025558e0..89232d9d574f126802b3c23685d1c072e2535706 100644 (file)
@@ -19,6 +19,7 @@ package org.apache.maven.archiva.repository.content;
  * under the License.
  */
 
+import org.apache.archiva.admin.model.managed.ManagedRepository;
 import org.apache.maven.archiva.common.utils.VersionComparator;
 import org.apache.maven.archiva.configuration.ArchivaConfiguration;
 import org.apache.maven.archiva.configuration.FileType;
@@ -67,7 +68,7 @@ public class ManagedDefaultRepositoryContentTest
     {
         File repoDir = new File( "src/test/repositories/default-repository" );
 
-        ManagedRepositoryConfiguration repository = createRepository( "testRepo", "Unit Test Repo", repoDir );
+        ManagedRepository repository = createRepository( "testRepo", "Unit Test Repo", repoDir );
 
 
         FileType fileType =
index 833902f628427beda3b281abaf138d17398d7c13..f5a1d19ff1023961280e32d4c9bf7d624ef5c3f3 100644 (file)
@@ -19,6 +19,7 @@ package org.apache.maven.archiva.repository.content;
  * under the License.
  */
 
+import org.apache.archiva.admin.model.managed.ManagedRepository;
 import org.apache.maven.archiva.common.utils.VersionComparator;
 import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
 import org.apache.maven.archiva.model.ArtifactReference;
@@ -57,7 +58,7 @@ public class ManagedLegacyRepositoryContentTest
     {
         File repoDir = new File( "src/test/repositories/legacy-repository" );
 
-        ManagedRepositoryConfiguration repository = createRepository( "testRepo", "Unit Test Repo", repoDir );
+        ManagedRepository repository = createRepository( "testRepo", "Unit Test Repo", repoDir );
         repository.setLayout( "legacy" );
 
         //repoContent = (ManagedRepositoryContent) lookup( ManagedRepositoryContent.class, "legacy" );
index 938dd5c5c28e6111cb89e4903b583bd1611f9ce1..65b63129c6fb08b671b99feed3cb5ce6812e2669 100644 (file)
@@ -19,6 +19,7 @@ package org.apache.maven.archiva.repository.content;
  * under the License.
  */
 
+import org.apache.archiva.admin.model.remote.RemoteRepository;
 import org.apache.maven.archiva.configuration.RemoteRepositoryConfiguration;
 import org.apache.maven.archiva.model.ArtifactReference;
 import org.apache.maven.archiva.repository.RemoteRepositoryContent;
@@ -43,7 +44,7 @@ public class RemoteDefaultRepositoryContentTest
     public void setUp()
         throws Exception
     {
-        RemoteRepositoryConfiguration repository = createRemoteRepository( "testRemoteRepo", "Unit Test Remote Repo",
+        RemoteRepository repository = createRemoteRepository( "testRemoteRepo", "Unit Test Remote Repo",
                                                                            "http://repo1.maven.org/maven2/" );
 
         //repoContent = (RemoteRepositoryContent) lookup( RemoteRepositoryContent.class, "default" );
index b0bb6e6a9e10280f0b4dcfd28ad7ffe8803e75eb..8fa46f081b674e46788b0cc3722c631a271d758d 100644 (file)
@@ -19,6 +19,7 @@ package org.apache.maven.archiva.repository.content;
  * under the License.
  */
 
+import org.apache.archiva.admin.model.remote.RemoteRepository;
 import org.apache.maven.archiva.configuration.RemoteRepositoryConfiguration;
 import org.apache.maven.archiva.model.ArtifactReference;
 import org.apache.maven.archiva.repository.RemoteRepositoryContent;
@@ -44,7 +45,7 @@ public class RemoteLegacyRepositoryContentTest
     public void setUp()
         throws Exception
     {
-        RemoteRepositoryConfiguration repository =
+        RemoteRepository repository =
             createRemoteRepository( "testRemoteLegacyRepo", "Unit Test Remote Legacy Repo",
                                     "http://repo1.maven.org/maven/" );
         repository.setLayout( "legacy" );
index ccc340ca8bb88bd115eb08f7a30215322454a6ac..62d0b7f5c2cb1c7b4c3bf19d0107e28593215409 100644 (file)
@@ -19,6 +19,7 @@ package org.apache.maven.archiva.repository.metadata;
  * under the License.
  */
 
+import org.apache.archiva.admin.model.managed.ManagedRepository;
 import org.apache.commons.io.FileUtils;
 import org.apache.commons.lang.StringUtils;
 import org.apache.maven.archiva.common.utils.VersionComparator;
@@ -355,7 +356,7 @@ public class MetadataToolsTest
         reference.setArtifactId( artifactId );
         reference.setVersion( version );
 
-        ManagedRepositoryConfiguration repo =
+        ManagedRepository repo =
             createRepository( "test-repo", "Test Repository: " + name.getMethodName(), repoRootDir );
         ManagedRepositoryContent repoContent =
             applicationContext.getBean( "managedRepositoryContent#default", ManagedRepositoryContent.class );
@@ -583,7 +584,7 @@ public class MetadataToolsTest
 
         repoRoot.mkdirs();
 
-        ManagedRepositoryConfiguration repoConfig =
+        ManagedRepository repoConfig =
             createRepository( "test-repo", "Test Repository: " + name.getMethodName(), repoRoot );
 
         ManagedRepositoryContent repoContent =
index a4d54739193a39ad61b11813ca2323b17fa72f21..92f024a79c4f0c5c3db89434392985dd14f62cbd 100644 (file)
@@ -34,7 +34,7 @@
     </dependency>
     <dependency>
       <groupId>org.apache.archiva</groupId>
-      <artifactId>archiva-configuration</artifactId>
+      <artifactId>archiva-repository-admin-api</artifactId>
     </dependency>
     <dependency>
       <groupId>org.springframework</groupId>
       <artifactId>slf4j-simple</artifactId>
       <scope>test</scope>
     </dependency>
+    <dependency>
+      <groupId>org.apache.archiva</groupId>
+      <artifactId>archiva-configuration</artifactId>
+      <!-- FIXME olamy : should be scope test but it depends on FileTypes
+      <scope>test</scope>
+      -->
+    </dependency>
     <dependency>
       <groupId>org.springframework</groupId>
       <artifactId>spring-test</artifactId>
index 6185efe91ff4c2652dd40f17e220edebe3517cdc..c7f950f3985d0be4600133f36482296efad87931 100644 (file)
@@ -19,28 +19,29 @@ package org.apache.archiva.repository.scanner;
  * under the License.
  */
 
+import org.apache.archiva.admin.model.RepositoryAdminException;
+import org.apache.archiva.admin.model.managed.ManagedRepository;
 import org.apache.commons.collections.CollectionUtils;
 import org.apache.maven.archiva.configuration.FileTypes;
-import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
 import org.apache.maven.archiva.consumers.InvalidRepositoryContentConsumer;
 import org.apache.maven.archiva.consumers.KnownRepositoryContentConsumer;
 import org.apache.maven.archiva.consumers.RepositoryContentConsumer;
 import org.codehaus.plexus.util.DirectoryWalker;
 import org.springframework.stereotype.Service;
 
+import javax.inject.Inject;
 import java.io.File;
 import java.util.ArrayList;
 import java.util.LinkedHashSet;
 import java.util.List;
 import java.util.Set;
-import javax.inject.Inject;
 
 /**
  * DefaultRepositoryScanner
  *
  * @version $Id$
  */
-@Service("repositoryScanner#default")
+@Service( "repositoryScanner#default" )
 public class DefaultRepositoryScanner
     implements RepositoryScanner
 {
@@ -58,17 +59,24 @@ public class DefaultRepositoryScanner
 
     private Set<RepositoryScannerInstance> inProgressScans = new LinkedHashSet<RepositoryScannerInstance>();
 
-    public RepositoryScanStatistics scan( ManagedRepositoryConfiguration repository, long changesSince )
+    public RepositoryScanStatistics scan( ManagedRepository repository, long changesSince )
         throws RepositoryScannerException
     {
-        List<KnownRepositoryContentConsumer> knownContentConsumers = consumerUtil.getSelectedKnownConsumers();
-        List<InvalidRepositoryContentConsumer> invalidContentConsumers = consumerUtil.getSelectedInvalidConsumers();
-        List<String> ignoredPatterns = filetypes.getFileTypePatterns( FileTypes.IGNORED );
+        try
+        {
+            List<KnownRepositoryContentConsumer> knownContentConsumers = consumerUtil.getSelectedKnownConsumers();
+            List<InvalidRepositoryContentConsumer> invalidContentConsumers = consumerUtil.getSelectedInvalidConsumers();
+            List<String> ignoredPatterns = filetypes.getFileTypePatterns( FileTypes.IGNORED );
 
-        return scan( repository, knownContentConsumers, invalidContentConsumers, ignoredPatterns, changesSince );
+            return scan( repository, knownContentConsumers, invalidContentConsumers, ignoredPatterns, changesSince );
+        }
+        catch ( RepositoryAdminException e )
+        {
+            throw new RepositoryScannerException( e.getMessage(), e );
+        }
     }
 
-    public RepositoryScanStatistics scan( ManagedRepositoryConfiguration repository,
+    public RepositoryScanStatistics scan( ManagedRepository repository,
                                           List<KnownRepositoryContentConsumer> knownContentConsumers,
                                           List<InvalidRepositoryContentConsumer> invalidContentConsumers,
                                           List<String> ignoredContentPatterns, long changesSince )
@@ -85,14 +93,14 @@ public class DefaultRepositoryScanner
         //create the repo if not existing to have an empty stats
         if ( !repositoryBase.exists() && !repositoryBase.mkdirs() )
         {
-            throw new UnsupportedOperationException( "Unable to scan a repository, directory "
-                + repositoryBase.getPath() + " does not exist." );
+            throw new UnsupportedOperationException(
+                "Unable to scan a repository, directory " + repositoryBase.getPath() + " does not exist." );
         }
 
         if ( !repositoryBase.isDirectory() )
         {
-            throw new UnsupportedOperationException( "Unable to scan a repository, path "
-                + repositoryBase.getPath() + " is not a directory." );
+            throw new UnsupportedOperationException(
+                "Unable to scan a repository, path " + repositoryBase.getPath() + " is not a directory." );
         }
 
         // Setup Includes / Excludes.
@@ -117,8 +125,8 @@ public class DefaultRepositoryScanner
         dirWalker.setExcludes( allExcludes );
 
         // Setup the Scan Instance
-        RepositoryScannerInstance scannerInstance = new RepositoryScannerInstance( repository, knownContentConsumers,
-                                                                                   invalidContentConsumers, changesSince );
+        RepositoryScannerInstance scannerInstance =
+            new RepositoryScannerInstance( repository, knownContentConsumers, invalidContentConsumers, changesSince );
 
         inProgressScans.add( scannerInstance );
 
index 666ff004540822168d99deb12cfbf4bccb252858..c95209ebde629712cd5a9c35f10076f99e2bf37e 100644 (file)
@@ -19,6 +19,9 @@ package org.apache.archiva.repository.scanner;
  * under the License.
  */
 
+import org.apache.archiva.admin.model.RepositoryAdminException;
+import org.apache.archiva.admin.model.admin.ArchivaAdministration;
+import org.apache.archiva.admin.model.managed.ManagedRepository;
 import org.apache.archiva.repository.scanner.functors.ConsumerProcessFileClosure;
 import org.apache.archiva.repository.scanner.functors.TriggerBeginScanClosure;
 import org.apache.archiva.repository.scanner.functors.TriggerScanCompletedClosure;
@@ -26,16 +29,15 @@ import org.apache.commons.collections.Closure;
 import org.apache.commons.collections.CollectionUtils;
 import org.apache.commons.collections.functors.IfClosure;
 import org.apache.maven.archiva.common.utils.BaseFile;
-import org.apache.maven.archiva.configuration.ArchivaConfiguration;
-import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
-import org.apache.maven.archiva.configuration.RepositoryScanningConfiguration;
 import org.apache.maven.archiva.consumers.InvalidRepositoryContentConsumer;
 import org.apache.maven.archiva.consumers.KnownRepositoryContentConsumer;
 import org.apache.maven.archiva.consumers.functors.ConsumerWantsFilePredicate;
 import org.springframework.beans.BeansException;
 import org.springframework.context.ApplicationContext;
 import org.springframework.context.ApplicationContextAware;
+import org.springframework.stereotype.Service;
 
+import javax.inject.Inject;
 import java.io.File;
 import java.util.ArrayList;
 import java.util.Date;
@@ -48,20 +50,24 @@ import java.util.Map;
  *
  * @version $Id$
  */
+@Service("repositoryContentConsumers")
 public class RepositoryContentConsumers
     implements ApplicationContextAware
 {
+
+    @Inject
     private ApplicationContext applicationContext;
 
-    private ArchivaConfiguration archivaConfiguration;
+    private ArchivaAdministration archivaAdministration;
 
     private List<KnownRepositoryContentConsumer> selectedKnownConsumers;
 
     private List<InvalidRepositoryContentConsumer> selectedInvalidConsumers;
 
-    public RepositoryContentConsumers( ArchivaConfiguration archivaConfiguration )
+    @Inject
+    public RepositoryContentConsumers( ArchivaAdministration archivaAdministration )
     {
-        this.archivaConfiguration = archivaConfiguration;
+        this.archivaAdministration = archivaAdministration;
     }
 
     public void setApplicationContext( ApplicationContext applicationContext )
@@ -84,9 +90,9 @@ public class RepositoryContentConsumers
      * @return the list of consumer ids that have been selected by the configuration.
      */
     public List<String> getSelectedKnownConsumerIds()
+        throws RepositoryAdminException
     {
-        RepositoryScanningConfiguration scanning = archivaConfiguration.getConfiguration().getRepositoryScanning();
-        return scanning.getKnownContentConsumers();
+        return archivaAdministration.getKnownContentConsumers();
     }
 
     /**
@@ -103,9 +109,9 @@ public class RepositoryContentConsumers
      * @return the list of consumer ids that have been selected by the configuration.
      */
     public List<String> getSelectedInvalidConsumerIds()
+        throws RepositoryAdminException
     {
-        RepositoryScanningConfiguration scanning = archivaConfiguration.getConfiguration().getRepositoryScanning();
-        return scanning.getInvalidContentConsumers();
+        return archivaAdministration.getInvalidContentConsumers();
     }
 
     /**
@@ -115,6 +121,7 @@ public class RepositoryContentConsumers
      * @return the map of String ids to {@link KnownRepositoryContentConsumer} objects.
      */
     public Map<String, KnownRepositoryContentConsumer> getSelectedKnownConsumersMap()
+        throws RepositoryAdminException
     {
         Map<String, KnownRepositoryContentConsumer> consumerMap = new HashMap<String, KnownRepositoryContentConsumer>();
 
@@ -133,6 +140,7 @@ public class RepositoryContentConsumers
      * @return the map of String ids to {@link InvalidRepositoryContentConsumer} objects.
      */
     public Map<String, InvalidRepositoryContentConsumer> getSelectedInvalidConsumersMap()
+        throws RepositoryAdminException
     {
         Map<String, InvalidRepositoryContentConsumer> consumerMap =
             new HashMap<String, InvalidRepositoryContentConsumer>();
@@ -153,6 +161,7 @@ public class RepositoryContentConsumers
      *         by the active configuration.
      */
     public synchronized List<KnownRepositoryContentConsumer> getSelectedKnownConsumers()
+        throws RepositoryAdminException
     {
         if ( selectedKnownConsumers == null )
         {
@@ -180,6 +189,7 @@ public class RepositoryContentConsumers
      *         by the active configuration.
      */
     public synchronized List<InvalidRepositoryContentConsumer> getSelectedInvalidConsumers()
+        throws RepositoryAdminException
     {
         if ( selectedInvalidConsumers == null )
         {
@@ -236,8 +246,8 @@ public class RepositoryContentConsumers
      * @param localFile              the local file to execute the consumers against.
      * @param updateRelatedArtifacts TODO
      */
-    public void executeConsumers( ManagedRepositoryConfiguration repository, File localFile,
-                                  boolean updateRelatedArtifacts )
+    public void executeConsumers( ManagedRepository repository, File localFile, boolean updateRelatedArtifacts )
+        throws RepositoryAdminException
     {
         // Run the repository consumers
         try
@@ -316,8 +326,8 @@ public class RepositoryContentConsumers
         return new Date( System.currentTimeMillis() );
     }
 
-    public void setArchivaConfiguration( ArchivaConfiguration archivaConfiguration )
+    public void setArchivaAdministration( ArchivaAdministration archivaAdministration )
     {
-        this.archivaConfiguration = archivaConfiguration;
+        this.archivaAdministration = archivaAdministration;
     }
 }
index e6fa22d7b273981f681ef9ca85eb8e9114567f4d..f7511b7dab223111d2bcfab1cccebd01062f7218 100644 (file)
@@ -23,6 +23,7 @@ import java.text.SimpleDateFormat;
 import java.util.List;
 import java.util.Map;
 
+import org.apache.archiva.admin.model.managed.ManagedRepository;
 import org.apache.commons.collections.CollectionUtils;
 import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
 
@@ -114,7 +115,7 @@ public class RepositoryScanStatistics
         invalidConsumers = consumers;
     }
 
-    public String toDump( ManagedRepositoryConfiguration repo )
+    public String toDump( ManagedRepository repo )
     {
         StringBuffer buf = new StringBuffer();
 
index 2ebbc443d92f132e54a17b643794f0f262cc0f03..064826a14f3187d119d727feb21673376ae38672 100644 (file)
@@ -19,23 +19,22 @@ package org.apache.archiva.repository.scanner;
  * under the License.
  */
 
-import java.util.Collection;
-import java.util.List;
-import java.util.Set;
-
-import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
+import org.apache.archiva.admin.model.managed.ManagedRepository;
 import org.apache.maven.archiva.consumers.InvalidRepositoryContentConsumer;
 import org.apache.maven.archiva.consumers.KnownRepositoryContentConsumer;
 
+import java.util.List;
+import java.util.Set;
+
 /**
- * RepositoryScanner 
+ * RepositoryScanner
  *
  * @version $Id$
  */
 public interface RepositoryScanner
 {
     /**
-     * The value to pass to {@link #scan(ManagedRepositoryConfiguration, long)} to have the scan
+     * The value to pass to {@link #scan(ManagedRepository, long)} to have the scan
      * operate in a fresh fashion, with no check on changes based on timestamp.
      */
     public static final long FRESH_SCAN = 0;
@@ -44,68 +43,56 @@ public interface RepositoryScanner
      * <p>
      * Typical Ignorable Content patterns.
      * </p>
-     * 
+     * <p/>
      * <p><strong>
      * NOTE: Do not use for normal webapp or task driven repository scanning.
      * </strong></p>
-     * 
+     * <p/>
      * <p>
      * These patterns are only valid for archiva-cli and archiva-converter use.
      * </p>
      */
-    public static final String[] IGNORABLE_CONTENT = {
-        "bin/**",
-        "reports/**",
-        ".index",
-        ".reports/**",
-        ".maven/**",
-        "**/.svn/**",
-        "**/*snapshot-version",
-        "*/website/**",
-        "*/licences/**",
-        "**/.htaccess",
-        "**/*.html",
-        "**/*.txt",
-        "**/README*",
-        "**/CHANGELOG*",
-        "**/KEYS*" };
+    public static final String[] IGNORABLE_CONTENT =
+        { "bin/**", "reports/**", ".index", ".reports/**", ".maven/**", "**/.svn/**", "**/*snapshot-version",
+            "*/website/**", "*/licences/**", "**/.htaccess", "**/*.html", "**/*.txt", "**/README*", "**/CHANGELOG*",
+            "**/KEYS*" };
 
     /**
      * Scan the repository for content changes.
-     * 
+     * <p/>
      * Internally, this will use the as-configured known and invalid consumer lists.
-     * 
-     * @param repository the repository to change.
+     *
+     * @param repository   the repository to change.
      * @param changesSince the timestamp to use as a threshold on what is considered new or changed.
      *                     (To have all content be taken into consideration regardless of timestamp,
-     *                      use the {@link #FRESH_SCAN} constant) 
+     *                     use the {@link #FRESH_SCAN} constant)
      * @return the statistics for this scan.
      * @throws RepositoryScannerException if there was a fundamental problem with getting the discoverer started.
      */
-    public RepositoryScanStatistics scan( ManagedRepositoryConfiguration repository, long changesSince )
+    RepositoryScanStatistics scan( ManagedRepository repository, long changesSince )
         throws RepositoryScannerException;
 
     /**
      * Scan the repository for content changes.
-     * 
+     * <p/>
      * Internally, this will use the as-configured known and invalid consumer lists.
-     * 
-     * @param repository the repository to change.
-     * @param knownContentConsumers the list of consumers that follow the {@link KnownRepositoryContentConsumer} 
-     *                              interface that should be used for this scan.
-     * @param invalidContentConsumers the list of consumers that follow the {@link InvalidRepositoryContentConsumer} 
-     *                                 interface that should be used for this scan.
-     * @param ignoredContentPatterns list of patterns that should be ignored and not sent to any consumer.
-     * @param changesSince the timestamp to use as a threshold on what is considered new or changed.
-     *                     (To have all content be taken into consideration regardless of timestamp,
-     *                      use the {@link #FRESH_SCAN} constant) 
+     *
+     * @param repository              the repository to change.
+     * @param knownContentConsumers   the list of consumers that follow the {@link KnownRepositoryContentConsumer}
+     *                                interface that should be used for this scan.
+     * @param invalidContentConsumers the list of consumers that follow the {@link InvalidRepositoryContentConsumer}
+     *                                interface that should be used for this scan.
+     * @param ignoredContentPatterns  list of patterns that should be ignored and not sent to any consumer.
+     * @param changesSince            the timestamp to use as a threshold on what is considered new or changed.
+     *                                (To have all content be taken into consideration regardless of timestamp,
+     *                                use the {@link #FRESH_SCAN} constant)
      * @return the statistics for this scan.
      * @throws RepositoryScannerException if there was a fundamental problem with getting the discoverer started.
      */
-    public RepositoryScanStatistics scan( ManagedRepositoryConfiguration repository,
-                                             List<KnownRepositoryContentConsumer> knownContentConsumers,
-                                             List<InvalidRepositoryContentConsumer> invalidContentConsumers,
-                                             List<String> ignoredContentPatterns, long changesSince )
+    RepositoryScanStatistics scan( ManagedRepository repository,
+                                   List<KnownRepositoryContentConsumer> knownContentConsumers,
+                                   List<InvalidRepositoryContentConsumer> invalidContentConsumers,
+                                   List<String> ignoredContentPatterns, long changesSince )
         throws RepositoryScannerException;
 
     Set<RepositoryScannerInstance> getInProgressScans();
index f027c2266862da9e22d9c45f7f0906e0cdaffa66..c75a999125e58220c1426408f8fae116686cd456 100644 (file)
@@ -19,12 +19,7 @@ package org.apache.archiva.repository.scanner;
  * under the License.
  */
 
-import java.io.File;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
+import org.apache.archiva.admin.model.managed.ManagedRepository;
 import org.apache.archiva.repository.scanner.functors.ConsumerProcessFileClosure;
 import org.apache.archiva.repository.scanner.functors.TriggerBeginScanClosure;
 import org.apache.archiva.repository.scanner.functors.TriggerScanCompletedClosure;
@@ -33,13 +28,18 @@ import org.apache.commons.collections.CollectionUtils;
 import org.apache.commons.collections.functors.IfClosure;
 import org.apache.commons.lang.SystemUtils;
 import org.apache.maven.archiva.common.utils.BaseFile;
-import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
 import org.apache.maven.archiva.consumers.InvalidRepositoryContentConsumer;
 import org.apache.maven.archiva.consumers.KnownRepositoryContentConsumer;
 import org.apache.maven.archiva.consumers.functors.ConsumerWantsFilePredicate;
 import org.codehaus.plexus.util.DirectoryWalkListener;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+
+import java.io.File;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
 /**
  * RepositoryScannerInstance 
  *
@@ -60,7 +60,7 @@ public class RepositoryScannerInstance
      */
     private List<InvalidRepositoryContentConsumer> invalidConsumers;
 
-    private ManagedRepositoryConfiguration repository;
+    private ManagedRepository repository;
 
     private RepositoryScanStatistics stats;
 
@@ -74,7 +74,7 @@ public class RepositoryScannerInstance
 
     private Map<String, Long> consumerCounts;
 
-    public RepositoryScannerInstance( ManagedRepositoryConfiguration repository,
+    public RepositoryScannerInstance( ManagedRepository repository,
                                       List<KnownRepositoryContentConsumer> knownConsumerList,
                                       List<InvalidRepositoryContentConsumer> invalidConsumerList )
     {
@@ -106,7 +106,7 @@ public class RepositoryScannerInstance
         }
     }
 
-    public RepositoryScannerInstance( ManagedRepositoryConfiguration repository,
+    public RepositoryScannerInstance( ManagedRepository repository,
                                       List<KnownRepositoryContentConsumer> knownContentConsumers,
                                       List<InvalidRepositoryContentConsumer> invalidContentConsumers, long changesSince )
     {
@@ -187,7 +187,7 @@ public class RepositoryScannerInstance
         log.debug( "Repository Scanner: {}", message );
     }
     
-    public ManagedRepositoryConfiguration getRepository()
+    public ManagedRepository getRepository()
     {
         return repository;
     }
index 2976637b850764b1ff4c04772d2a047b0023d5e1..507ccb61b55573a60b23542c622db277858c37ec 100644 (file)
@@ -19,15 +19,15 @@ package org.apache.archiva.repository.scanner.functors;
  * under the License.
  */
 
-import java.util.Date;
-
+import org.apache.archiva.admin.model.managed.ManagedRepository;
 import org.apache.commons.collections.Closure;
-import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
 import org.apache.maven.archiva.consumers.ConsumerException;
 import org.apache.maven.archiva.consumers.RepositoryContentConsumer;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import java.util.Date;
+
 /**
  * TriggerBeginScanClosure 
  *
@@ -38,24 +38,24 @@ public class TriggerBeginScanClosure
 {
     private Logger log = LoggerFactory.getLogger( TriggerBeginScanClosure.class );
     
-    private ManagedRepositoryConfiguration repository;
+    private ManagedRepository repository;
     
     private Date whenGathered;
 
     private boolean executeOnEntireRepo = true;
 
-    public TriggerBeginScanClosure( ManagedRepositoryConfiguration repository )
+    public TriggerBeginScanClosure( ManagedRepository repository )
     {
         this.repository = repository;
     }
     
-    public TriggerBeginScanClosure( ManagedRepositoryConfiguration repository, Date whenGathered )
+    public TriggerBeginScanClosure( ManagedRepository repository, Date whenGathered )
     {
         this( repository );
         this.whenGathered = whenGathered;
     }
 
-    public TriggerBeginScanClosure( ManagedRepositoryConfiguration repository, Date whenGathered, boolean executeOnEntireRepo )
+    public TriggerBeginScanClosure( ManagedRepository repository, Date whenGathered, boolean executeOnEntireRepo )
     {
         this( repository, whenGathered );
         this.executeOnEntireRepo = executeOnEntireRepo;
index 5d2330a98793b32dd62f3694905f0e6f9e2536da..9cbfb7400ddfe551b851c03c7199b6afea356024 100644 (file)
@@ -19,8 +19,8 @@ package org.apache.archiva.repository.scanner.functors;
  * under the License.
  */
 
+import org.apache.archiva.admin.model.managed.ManagedRepository;
 import org.apache.commons.collections.Closure;
-import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
 import org.apache.maven.archiva.consumers.RepositoryContentConsumer;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -33,16 +33,16 @@ public class TriggerScanCompletedClosure
 {
     private Logger log = LoggerFactory.getLogger( TriggerScanCompletedClosure.class );
 
-    private final ManagedRepositoryConfiguration repository;
+    private final ManagedRepository repository;
 
     private boolean executeOnEntireRepo = true;
 
-    public TriggerScanCompletedClosure( ManagedRepositoryConfiguration repository )
+    public TriggerScanCompletedClosure( ManagedRepository repository )
     {
         this.repository = repository;
     }
 
-    public TriggerScanCompletedClosure( ManagedRepositoryConfiguration repository, boolean executeOnEntireRepo )
+    public TriggerScanCompletedClosure( ManagedRepository repository, boolean executeOnEntireRepo )
     {
         this( repository );
         this.executeOnEntireRepo = executeOnEntireRepo;
index 867eb1a27a446022d88a0cecd0593a50dcbf4b6e..c5e39b8e094f9b468e3c748f7cb7c60a251ee23f 100644 (file)
@@ -31,9 +31,4 @@
   <context:component-scan base-package="org.apache.archiva.repository.scanner"/>
   <alias name="repositoryScanner#default" alias="repositoryScanner"/>
 
-  <bean id="repositoryContentConsumers" class="org.apache.archiva.repository.scanner.RepositoryContentConsumers" scope="prototype">
-    <constructor-arg>
-      <ref bean="archivaConfiguration"/>
-    </constructor-arg>
-  </bean>
 </beans>
diff --git a/archiva-modules/archiva-base/archiva-repository-scanner/src/test/java/org/apache/archiva/repository/scanner/ArchivaAdministrationStub.java b/archiva-modules/archiva-base/archiva-repository-scanner/src/test/java/org/apache/archiva/repository/scanner/ArchivaAdministrationStub.java
new file mode 100644 (file)
index 0000000..a64c726
--- /dev/null
@@ -0,0 +1,166 @@
+package org.apache.archiva.repository.scanner;
+/*
+ * 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.admin.model.AuditInformation;
+import org.apache.archiva.admin.model.RepositoryAdminException;
+import org.apache.archiva.admin.model.admin.ArchivaAdministration;
+import org.apache.archiva.admin.model.admin.FileType;
+import org.apache.archiva.admin.model.admin.LegacyArtifactPath;
+import org.apache.archiva.admin.model.admin.OrganisationInformation;
+import org.apache.maven.archiva.configuration.ArchivaConfiguration;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+/**
+ * @author Olivier Lamy
+ */
+@Service
+public class ArchivaAdministrationStub
+    implements ArchivaAdministration
+{
+
+    private ArchivaConfiguration archivaConfiguration;
+
+    public ArchivaAdministrationStub()
+    {
+        // no op
+    }
+
+
+    public ArchivaAdministrationStub( ArchivaConfiguration archivaConfiguration )
+    {
+        this.archivaConfiguration = archivaConfiguration;
+    }
+
+    public List<LegacyArtifactPath> getLegacyArtifactPaths()
+        throws RepositoryAdminException
+    {
+        return null;
+    }
+
+    public void addLegacyArtifactPath( LegacyArtifactPath legacyArtifactPath, AuditInformation auditInformation )
+        throws RepositoryAdminException
+    {
+
+    }
+
+    public void deleteLegacyArtifactPath( String path, AuditInformation auditInformation )
+        throws RepositoryAdminException
+    {
+
+    }
+
+    public void addFileTypePattern( String fileTypeId, String pattern, AuditInformation auditInformation )
+        throws RepositoryAdminException
+    {
+
+    }
+
+    public void removeFileTypePattern( String fileTypeId, String pattern, AuditInformation auditInformation )
+        throws RepositoryAdminException
+    {
+
+    }
+
+    public List<FileType> getFileTypes()
+        throws RepositoryAdminException
+    {
+        return null;
+    }
+
+    public FileType getFileType( String fileTypeId )
+        throws RepositoryAdminException
+    {
+        return null;
+    }
+
+    public void addFileType( FileType fileType, AuditInformation auditInformation )
+        throws RepositoryAdminException
+    {
+
+    }
+
+    public void removeFileType( String fileTypeId, AuditInformation auditInformation )
+        throws RepositoryAdminException
+    {
+
+    }
+
+    public void addKnownContentConsumer( String knownContentConsumer, AuditInformation auditInformation )
+        throws RepositoryAdminException
+    {
+
+    }
+
+    public void setKnownContentConsumers( List<String> knownContentConsumers, AuditInformation auditInformation )
+        throws RepositoryAdminException
+    {
+
+    }
+
+    public List<String> getKnownContentConsumers()
+        throws RepositoryAdminException
+    {
+        return archivaConfiguration.getConfiguration().getRepositoryScanning().getKnownContentConsumers();
+    }
+
+    public void removeKnownContentConsumer( String knownContentConsumer, AuditInformation auditInformation )
+        throws RepositoryAdminException
+    {
+
+    }
+
+    public void addInvalidContentConsumer( String invalidContentConsumer, AuditInformation auditInformation )
+        throws RepositoryAdminException
+    {
+
+    }
+
+    public void setInvalidContentConsumers( List<String> invalidContentConsumers, AuditInformation auditInformation )
+        throws RepositoryAdminException
+    {
+
+    }
+
+    public List<String> getInvalidContentConsumers()
+        throws RepositoryAdminException
+    {
+        return archivaConfiguration.getConfiguration().getRepositoryScanning().getInvalidContentConsumers();
+    }
+
+    public void removeInvalidContentConsumer( String invalidContentConsumer, AuditInformation auditInformation )
+        throws RepositoryAdminException
+    {
+
+    }
+
+    public OrganisationInformation getOrganisationInformation()
+        throws RepositoryAdminException
+    {
+        return null;
+    }
+
+    public void setOrganisationInformation( OrganisationInformation organisationInformation )
+        throws RepositoryAdminException
+    {
+
+    }
+}
index 472848d44a09ef3029577bb87fff20fa0e05682b..91fdb1930e17bb3060563df28af65e1778843a5c 100644 (file)
@@ -19,14 +19,14 @@ package org.apache.archiva.repository.scanner;
  * under the License.
  */
 
-import java.util.Date;
-import java.util.List;
-
-import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
+import org.apache.archiva.admin.model.managed.ManagedRepository;
 import org.apache.maven.archiva.consumers.AbstractMonitoredConsumer;
 import org.apache.maven.archiva.consumers.ConsumerException;
 import org.apache.maven.archiva.consumers.InvalidRepositoryContentConsumer;
 
+import java.util.Date;
+import java.util.List;
+
 /**
  * InvalidScanConsumer 
  *
@@ -43,13 +43,13 @@ public class InvalidScanConsumer
     
     private int processCount = 0;
 
-    public void beginScan( ManagedRepositoryConfiguration repository, Date whenGathered )
+    public void beginScan( ManagedRepository repository, Date whenGathered )
         throws ConsumerException
     {
         /* do nothing */
     }
 
-    public void beginScan( ManagedRepositoryConfiguration repository, Date whenGathered, boolean executeOnEntireRepo )
+    public void beginScan( ManagedRepository repository, Date whenGathered, boolean executeOnEntireRepo )
         throws ConsumerException
     {
         beginScan( repository, whenGathered );
index a2cd9290103fc0c7e163dcb3ff72634397602156..e3d98af35f0f79eed5cd1f10aeedad80c8cfd380 100644 (file)
@@ -19,16 +19,16 @@ package org.apache.archiva.repository.scanner;
  * under the License.
  */
 
+import org.apache.archiva.admin.model.managed.ManagedRepository;
+import org.apache.maven.archiva.consumers.AbstractMonitoredConsumer;
+import org.apache.maven.archiva.consumers.ConsumerException;
+import org.apache.maven.archiva.consumers.KnownRepositoryContentConsumer;
+
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Date;
 import java.util.List;
 
-import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
-import org.apache.maven.archiva.consumers.AbstractMonitoredConsumer;
-import org.apache.maven.archiva.consumers.ConsumerException;
-import org.apache.maven.archiva.consumers.KnownRepositoryContentConsumer;
-
 /**
  * ScanConsumer 
  *
@@ -70,13 +70,13 @@ public class KnownScanConsumer
         return "Scan Consumer (for testing)";
     }
 
-    public void beginScan( ManagedRepositoryConfiguration repository, Date whenGathered )
+    public void beginScan( ManagedRepository repository, Date whenGathered )
         throws ConsumerException
     {
         /* do nothing */
     }
 
-    public void beginScan( ManagedRepositoryConfiguration repository, Date whenGathered, boolean executeOnEntireRepo )
+    public void beginScan( ManagedRepository repository, Date whenGathered, boolean executeOnEntireRepo )
         throws ConsumerException
     {
         beginScan( repository, whenGathered );
index bd47bce23d717d09a1635830fc7828b5e14ccdc9..4b17fe6f87e4c95bb47971ccf00285f4427e72e7 100644 (file)
@@ -19,16 +19,16 @@ package org.apache.archiva.repository.scanner;
  * under the License.
  */
 
-import java.util.Date;
+import org.apache.archiva.admin.model.admin.ArchivaAdministration;
 
-import org.apache.maven.archiva.configuration.ArchivaConfiguration;
+import java.util.Date;
 
 public class RepositoryContentConsumersStub
     extends RepositoryContentConsumers
 {
-    public RepositoryContentConsumersStub(ArchivaConfiguration archivaConfiguration)
+    public RepositoryContentConsumersStub( ArchivaAdministration archivaAdministration )
     {
-        super(archivaConfiguration);
+        super( archivaAdministration );
     }
 
     @Override
@@ -36,7 +36,7 @@ public class RepositoryContentConsumersStub
     {
         Date startTimeForTest = new Date( System.currentTimeMillis() );
         startTimeForTest.setTime( 12345678 );
-        
+
         return startTimeForTest;
     }
 }
index 4684618b47ed63f191e40a7bcfd3dcb02a45af44..81e5ba946084d16fb304651f748c7c8393df7957 100644 (file)
@@ -20,10 +20,10 @@ package org.apache.archiva.repository.scanner;
  */
 
 import junit.framework.TestCase;
+import org.apache.archiva.admin.model.managed.ManagedRepository;
+import org.apache.archiva.admin.model.remote.RemoteRepository;
 import org.apache.commons.lang.SystemUtils;
 import org.apache.maven.archiva.configuration.ArchivaConfiguration;
-import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
-import org.apache.maven.archiva.configuration.RemoteRepositoryConfiguration;
 import org.apache.maven.archiva.consumers.InvalidRepositoryContentConsumer;
 import org.apache.maven.archiva.consumers.KnownRepositoryContentConsumer;
 import org.easymock.MockControl;
@@ -67,18 +67,18 @@ public class RepositoryContentConsumersTest
     @Inject
     ApplicationContext applicationContext;
 
-    protected ManagedRepositoryConfiguration createRepository( String id, String name, File location )
+    protected ManagedRepository createRepository( String id, String name, File location )
     {
-        ManagedRepositoryConfiguration repo = new ManagedRepositoryConfiguration();
+        ManagedRepository repo = new ManagedRepository();
         repo.setId( id );
         repo.setName( name );
         repo.setLocation( location.getAbsolutePath() );
         return repo;
     }
 
-    protected RemoteRepositoryConfiguration createRemoteRepository( String id, String name, String url )
+    protected RemoteRepository createRemoteRepository( String id, String name, String url )
     {
-        RemoteRepositoryConfiguration repo = new RemoteRepositoryConfiguration();
+        RemoteRepository repo = new RemoteRepository();
         repo.setId( id );
         repo.setName( name );
         repo.setUrl( url );
@@ -89,10 +89,13 @@ public class RepositoryContentConsumersTest
         throws Exception
     {
 
+
         ArchivaConfiguration configuration =
             applicationContext.getBean( "archivaConfiguration#test-conf", ArchivaConfiguration.class );
 
-        RepositoryContentConsumers consumerUtilStub = new RepositoryContentConsumersStub( configuration );
+        ArchivaAdministrationStub administrationStub = new ArchivaAdministrationStub( configuration );
+
+        RepositoryContentConsumers consumerUtilStub = new RepositoryContentConsumersStub( administrationStub );
 
         RepositoryContentConsumers consumerUtil =
             (RepositoryContentConsumers) applicationContext.getBean( "repositoryContentConsumers#test",
@@ -103,7 +106,7 @@ public class RepositoryContentConsumersTest
         consumerUtilStub.setApplicationContext( context );
         consumerUtilStub.setSelectedInvalidConsumers( consumerUtil.getSelectedInvalidConsumers() );
         consumerUtilStub.setSelectedKnownConsumers( consumerUtil.getSelectedKnownConsumers() );
-        consumerUtilStub.setArchivaConfiguration( configuration );
+        consumerUtilStub.setArchivaAdministration( administrationStub );
 
         assertNotNull( "RepositoryContentConsumers should not be null.", consumerUtilStub );
 
@@ -264,7 +267,7 @@ public class RepositoryContentConsumersTest
 
         consumers.setSelectedInvalidConsumers( Collections.singletonList( selectedInvalidConsumer ) );
 
-        ManagedRepositoryConfiguration repo = createRepository( "id", "name", new File( "target/test-repo" ) );
+        ManagedRepository repo = createRepository( "id", "name", new File( "target/test-repo" ) );
         File testFile = new File( "target/test-repo/path/to/test-file.txt" );
 
         Date startTime = new Date( System.currentTimeMillis() );
index 709128e604a92f9c8d6899211c5052383082f158..d68988a9b7ac4866b784732223d9a0da55dab128 100644 (file)
@@ -20,6 +20,8 @@ package org.apache.archiva.repository.scanner;
  */
 
 import junit.framework.TestCase;
+import org.apache.archiva.admin.model.managed.ManagedRepository;
+import org.apache.archiva.admin.model.remote.RemoteRepository;
 import org.apache.commons.io.FileUtils;
 import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
 import org.apache.maven.archiva.configuration.RemoteRepositoryConfiguration;
@@ -56,18 +58,18 @@ public class RepositoryScannerTest
     @Inject
     ApplicationContext applicationContext;
 
-    protected ManagedRepositoryConfiguration createRepository( String id, String name, File location )
+    protected ManagedRepository createRepository( String id, String name, File location )
     {
-        ManagedRepositoryConfiguration repo = new ManagedRepositoryConfiguration();
+        ManagedRepository repo = new ManagedRepository();
         repo.setId( id );
         repo.setName( name );
         repo.setLocation( location.getAbsolutePath() );
         return repo;
     }
 
-    protected RemoteRepositoryConfiguration createRemoteRepository( String id, String name, String url )
+    protected RemoteRepository createRemoteRepository( String id, String name, String url )
     {
-        RemoteRepositoryConfiguration repo = new RemoteRepositoryConfiguration();
+        RemoteRepository repo = new RemoteRepository();
         repo.setId( id );
         repo.setName( name );
         repo.setUrl( url );
@@ -77,7 +79,7 @@ public class RepositoryScannerTest
     private static final String[] ARTIFACT_PATTERNS =
         new String[]{ "**/*.jar", "**/*.pom", "**/*.rar", "**/*.zip", "**/*.war", "**/*.tar.gz" };
 
-    private ManagedRepositoryConfiguration createDefaultRepository()
+    private ManagedRepository createDefaultRepository()
     {
         File repoDir = new File( "src/test/repositories/default-repository" );
 
@@ -86,7 +88,7 @@ public class RepositoryScannerTest
         return createRepository( "testDefaultRepo", "Test Default Repository", repoDir );
     }
 
-    private ManagedRepositoryConfiguration createSimpleRepository()
+    private ManagedRepository createSimpleRepository()
         throws IOException, ParseException
     {
         File srcDir = new File( "src/test/repositories/simple-repository" );
@@ -114,13 +116,13 @@ public class RepositoryScannerTest
         return fmt.parse( timestamp ).getTime();
     }
 
-    private ManagedRepositoryConfiguration createLegacyRepository()
+    private ManagedRepository createLegacyRepository()
     {
         File repoDir = new File( "src/test/repositories/legacy-repository" );
 
         assertTrue( "Legacy Test Repository should exist.", repoDir.exists() && repoDir.isDirectory() );
 
-        ManagedRepositoryConfiguration repo = createRepository( "testLegacyRepo", "Test Legacy Repository", repoDir );
+        ManagedRepository repo = createRepository( "testLegacyRepo", "Test Legacy Repository", repoDir );
         repo.setLayout( "legacy" );
 
         return repo;
@@ -152,7 +154,7 @@ public class RepositoryScannerTest
     public void testTimestampRepositoryScanner()
         throws Exception
     {
-        ManagedRepositoryConfiguration repository = createSimpleRepository();
+        ManagedRepository repository = createSimpleRepository();
 
         List<KnownRepositoryContentConsumer> knownConsumers = new ArrayList<KnownRepositoryContentConsumer>();
         KnownScanConsumer consumer = new KnownScanConsumer();
@@ -179,7 +181,7 @@ public class RepositoryScannerTest
     public void testTimestampRepositoryScannerFreshScan()
         throws Exception
     {
-        ManagedRepositoryConfiguration repository = createSimpleRepository();
+        ManagedRepository repository = createSimpleRepository();
 
         List<KnownRepositoryContentConsumer> knownConsumers = new ArrayList<KnownRepositoryContentConsumer>();
         KnownScanConsumer consumer = new KnownScanConsumer();
@@ -205,7 +207,7 @@ public class RepositoryScannerTest
     public void testTimestampRepositoryScannerProcessUnmodified()
         throws Exception
     {
-        ManagedRepositoryConfiguration repository = createSimpleRepository();
+        ManagedRepository repository = createSimpleRepository();
 
         List<KnownRepositoryContentConsumer> knownConsumers = new ArrayList<KnownRepositoryContentConsumer>();
         KnownScanConsumer consumer = new KnownScanConsumer();
@@ -232,7 +234,7 @@ public class RepositoryScannerTest
     public void testDefaultRepositoryScanner()
         throws Exception
     {
-        ManagedRepositoryConfiguration repository = createDefaultRepository();
+        ManagedRepository repository = createDefaultRepository();
 
         List<KnownRepositoryContentConsumer> knownConsumers = new ArrayList<KnownRepositoryContentConsumer>();
         KnownScanConsumer consumer = new KnownScanConsumer();
@@ -293,7 +295,7 @@ public class RepositoryScannerTest
         actualArtifactPaths.add( "org/apache/testgroup/discovery/1.0/discovery-1.0.pom" );
         actualArtifactPaths.add( "javax/sql/jdbc/2.0/jdbc-2.0.jar" );
 
-        ManagedRepositoryConfiguration repository = createDefaultRepository();
+        ManagedRepository repository = createDefaultRepository();
 
         List<KnownRepositoryContentConsumer> knownConsumers = new ArrayList<KnownRepositoryContentConsumer>();
         KnownScanConsumer consumer = new KnownScanConsumer();
@@ -330,7 +332,7 @@ public class RepositoryScannerTest
         actualMetadataPaths.add( "javax/sql/maven-metadata-repository.xml" );
         actualMetadataPaths.add( "javax/maven-metadata.xml" );
 
-        ManagedRepositoryConfiguration repository = createDefaultRepository();
+        ManagedRepository repository = createDefaultRepository();
 
         List<KnownRepositoryContentConsumer> knownConsumers = new ArrayList<KnownRepositoryContentConsumer>();
         KnownScanConsumer knownConsumer = new KnownScanConsumer();
@@ -367,7 +369,7 @@ public class RepositoryScannerTest
         actualProjectPaths.add( "org/apache/maven/samplejar/1.0/samplejar-1.0.pom" );
         actualProjectPaths.add( "org/apache/testgroup/discovery/1.0/discovery-1.0.pom" );
 
-        ManagedRepositoryConfiguration repository = createDefaultRepository();
+        ManagedRepository repository = createDefaultRepository();
 
         List<KnownRepositoryContentConsumer> knownConsumers = new ArrayList<KnownRepositoryContentConsumer>();
         KnownScanConsumer consumer = new KnownScanConsumer();
@@ -408,7 +410,7 @@ public class RepositoryScannerTest
         actualArtifactPaths.add( "org.apache.maven.update/jars/test-not-updated-1.0.jar" );
         actualArtifactPaths.add( "org.apache.maven.update/jars/test-updated-1.0.jar" );
 
-        ManagedRepositoryConfiguration repository = createLegacyRepository();
+        ManagedRepository repository = createLegacyRepository();
 
         List<KnownRepositoryContentConsumer> knownConsumers = new ArrayList<KnownRepositoryContentConsumer>();
         KnownScanConsumer consumer = new KnownScanConsumer();
index e61bcf2e87cd3d8c00fc5015ccdfdb3424090b65..b9603693d82fd36c43802dec1b09baff9e0ce298 100644 (file)
@@ -19,14 +19,14 @@ package org.apache.archiva.repository.scanner;
  * under the License.
  */
 
-import java.util.Date;
-import java.util.List;
-
-import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
+import org.apache.archiva.admin.model.managed.ManagedRepository;
 import org.apache.maven.archiva.consumers.AbstractMonitoredConsumer;
 import org.apache.maven.archiva.consumers.ConsumerException;
 import org.apache.maven.archiva.consumers.KnownRepositoryContentConsumer;
 
+import java.util.Date;
+import java.util.List;
+
 /**
  * SampleKnownConsumer 
  *
@@ -41,13 +41,13 @@ public class SampleKnownConsumer
      */
     private String id = "unset-id";
     
-    public void beginScan( ManagedRepositoryConfiguration repository, Date whenGathered )
+    public void beginScan( ManagedRepository repository, Date whenGathered )
         throws ConsumerException
     {
         /* nothing to do */
     }
 
-    public void beginScan( ManagedRepositoryConfiguration repository, Date whenGathered, boolean executeOnEntireRepo )
+    public void beginScan( ManagedRepository repository, Date whenGathered, boolean executeOnEntireRepo )
         throws ConsumerException
     {
         beginScan( repository, whenGathered );
index 69c2d2875d973359bbf7973fa5c5f4803c33afb8..b62fb28eff6c0ff3473023a38385bd27bb54a7af 100644 (file)
     <property name="registry" ref="registry#configured"/>
   </bean>
 
+  <bean name="admin-test-conf" class="org.apache.archiva.repository.scanner.ArchivaAdministrationStub">
+    <constructor-arg ref="archivaConfiguration#test-conf"/>
+  </bean>
+
   <bean name="registry#configured" class="org.codehaus.redback.components.registry.commons.CommonsConfigurationRegistry">
     <property name="properties">
       <value>
@@ -84,7 +88,7 @@
   </bean>
 
   <bean name="repositoryContentConsumers#test" class="org.apache.archiva.repository.scanner.RepositoryContentConsumersStub">
-    <constructor-arg ref="archivaConfiguration#test-conf"/>
+    <constructor-arg ref="admin-test-conf"/>
   </bean>
 
 
index a74cadd9e24fbcabe3f09fed7a881c1f82ce3caa..b1ab5039b5af886c4805e02f1c75a0b93afd5571 100644 (file)
   <artifactId>archiva-scheduler-api</artifactId>
   <name>Archiva Scheduler :: API</name>
   <dependencies>
+    <dependency>
+      <groupId>org.apache.archiva</groupId>
+      <artifactId>archiva-repository-admin-api</artifactId>
+    </dependency>
     <dependency>
       <groupId>org.codehaus.redback.components</groupId>
       <artifactId>spring-taskqueue</artifactId>
index 1f36de79507cfa9549f3d97702f023f091ae7468..6bd9b78048b2b1b45d8bffbff0b88308cf072110 100644 (file)
       <groupId>org.apache.archiva</groupId>
       <artifactId>archiva-scheduler-api</artifactId>
     </dependency>
+    <dependency>
+      <groupId>org.apache.archiva</groupId>
+      <artifactId>archiva-repository-admin-api</artifactId>
+    </dependency>
     <dependency>
       <groupId>org.apache.archiva</groupId>
       <artifactId>archiva-configuration</artifactId>
index 527fa8bce595d82af1d4b2239e11001dd085e81b..2477c7898915b44b6fc4a4035f24fe3a9fac9b2c 100644 (file)
@@ -20,6 +20,7 @@ package org.apache.archiva.scheduler.indexing;
  * under the License.
  */
 
+import org.apache.archiva.admin.model.managed.ManagedRepository;
 import org.apache.archiva.common.plexusbridge.MavenIndexerUtils;
 import org.apache.archiva.common.plexusbridge.PlexusSisuBridge;
 import org.apache.archiva.common.plexusbridge.PlexusSisuBridgeException;
@@ -104,7 +105,7 @@ public class ArchivaIndexingTaskExecutor
         {
             ArtifactIndexingTask indexingTask = (ArtifactIndexingTask) task;
 
-            ManagedRepositoryConfiguration repository = indexingTask.getRepository();
+            ManagedRepository repository = indexingTask.getRepository();
             IndexingContext context = indexingTask.getContext();
 
             if ( ArtifactIndexingTask.Action.FINISH.equals( indexingTask.getAction() )
@@ -231,7 +232,7 @@ public class ArchivaIndexingTaskExecutor
         }
     }
 
-    private void finishIndexingTask( ArtifactIndexingTask indexingTask, ManagedRepositoryConfiguration repository,
+    private void finishIndexingTask( ArtifactIndexingTask indexingTask, ManagedRepository repository,
                                      IndexingContext context )
         throws TaskExecutionException
     {
index 8302f89a79c060002ee0c7fc869b9e06a19c7a2e..c39650af622a6822dcb9312eda8b2972c756c427 100644 (file)
@@ -19,7 +19,7 @@ package org.apache.archiva.scheduler.indexing;
  * under the License.
  */
 
-import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
+import org.apache.archiva.admin.model.managed.ManagedRepository;
 import org.apache.maven.index.NexusIndexer;
 import org.apache.maven.index.context.IndexCreator;
 import org.apache.maven.index.context.IndexingContext;
@@ -41,7 +41,7 @@ public class ArtifactIndexingTask
         FINISH
     }
 
-    private final ManagedRepositoryConfiguration repository;
+    private final ManagedRepository repository;
 
     private final File resourceFile;
 
@@ -56,7 +56,7 @@ public class ArtifactIndexingTask
      */
     private boolean onlyUpdate = false;
 
-    public ArtifactIndexingTask( ManagedRepositoryConfiguration repository, File resourceFile, Action action,
+    public ArtifactIndexingTask( ManagedRepository repository, File resourceFile, Action action,
                                  IndexingContext context )
     {
         this.repository = repository;
@@ -65,14 +65,14 @@ public class ArtifactIndexingTask
         this.context = context;
     }
 
-    public ArtifactIndexingTask( ManagedRepositoryConfiguration repository, File resourceFile, Action action,
+    public ArtifactIndexingTask( ManagedRepository repository, File resourceFile, Action action,
                                  IndexingContext context, boolean executeOnEntireRepo )
     {
         this( repository, resourceFile, action, context );
         this.executeOnEntireRepo = executeOnEntireRepo;
     }
 
-    public ArtifactIndexingTask( ManagedRepositoryConfiguration repository, File resourceFile, Action action,
+    public ArtifactIndexingTask( ManagedRepository repository, File resourceFile, Action action,
                                  IndexingContext context, boolean executeOnEntireRepo, boolean onlyUpdate )
     {
         this( repository, resourceFile, action, context, executeOnEntireRepo );
@@ -104,7 +104,7 @@ public class ArtifactIndexingTask
         return action;
     }
 
-    public ManagedRepositoryConfiguration getRepository()
+    public ManagedRepository getRepository()
     {
         return repository;
     }
@@ -190,17 +190,17 @@ public class ArtifactIndexingTask
      * @throws IOException
      * @throws UnsupportedExistingLuceneIndexException
      */
-    public static IndexingContext createContext( ManagedRepositoryConfiguration repository, NexusIndexer indexer,
+    public static IndexingContext createContext( ManagedRepository repository, NexusIndexer indexer,
                                                  List<? extends IndexCreator> indexCreators )
         throws IOException, UnsupportedExistingLuceneIndexException
     {
-        String indexDir = repository.getIndexDir();
+        String indexDir = repository.getIndexDirectory();
         File managedRepository = new File( repository.getLocation() );
 
         File indexDirectory = null;
         if ( indexDir != null && !"".equals( indexDir ) )
         {
-            indexDirectory = new File( repository.getIndexDir() );
+            indexDirectory = new File( repository.getIndexDirectory() );
         }
         else
         {
index 3b8da8e5d091bcc5d64095f04d929c77155aeba0..86e164ab9dc8694ed47038f81b38191622971857 100644 (file)
@@ -20,6 +20,7 @@ package org.apache.archiva.scheduler.indexing;
  */
 
 import junit.framework.TestCase;
+import org.apache.archiva.admin.model.managed.ManagedRepository;
 import org.apache.archiva.common.plexusbridge.MavenIndexerUtils;
 import org.apache.archiva.common.plexusbridge.PlexusSisuBridge;
 import org.apache.commons.io.FileUtils;
@@ -67,9 +68,7 @@ public class ArchivaIndexingTaskExecutorTest
     @Inject
     private ArchivaIndexingTaskExecutor indexingExecutor;
 
-    private ManagedRepositoryConfiguration repositoryConfig;
-
-    private Configuration configuration;
+    private ManagedRepository repositoryConfig;
 
     private NexusIndexer indexer;
 
@@ -85,7 +84,7 @@ public class ArchivaIndexingTaskExecutorTest
     {
         super.setUp();
 
-        repositoryConfig = new ManagedRepositoryConfiguration();
+        repositoryConfig = new ManagedRepository();
         repositoryConfig.setId( "test-repo" );
         repositoryConfig.setLocation( "target/test-classes/test-repo" );
         repositoryConfig.setLayout( "default" );
@@ -94,9 +93,6 @@ public class ArchivaIndexingTaskExecutorTest
         repositoryConfig.setSnapshots( false );
         repositoryConfig.setReleases( true );
 
-        configuration = new Configuration();
-        configuration.addManagedRepository( repositoryConfig );
-
         indexer = plexusSisuBridge.lookup( NexusIndexer.class );
 
         ArtifactIndexingTask.createContext( repositoryConfig, indexer, mavenIndexerUtils.getAllIndexCreators() );
index a8a7a4c37f4288b39c36659d7cd4c2dc4e33ca50..e7dc7901f4d381fb456fc2281b9d3df6a2f71f86 100644 (file)
@@ -19,6 +19,9 @@ package org.apache.archiva.scheduler.repository;
  * under the License.
  */
 
+import org.apache.archiva.admin.model.RepositoryAdminException;
+import org.apache.archiva.admin.model.managed.ManagedRepository;
+import org.apache.archiva.admin.model.managed.ManagedRepositoryAdmin;
 import org.apache.archiva.metadata.repository.MetadataRepository;
 import org.apache.archiva.metadata.repository.MetadataRepositoryException;
 import org.apache.archiva.metadata.repository.RepositorySession;
@@ -30,8 +33,6 @@ import org.apache.archiva.repository.scanner.RepositoryScanStatistics;
 import org.apache.archiva.repository.scanner.RepositoryScanner;
 import org.apache.archiva.repository.scanner.RepositoryScannerException;
 import org.apache.commons.lang.StringUtils;
-import org.apache.maven.archiva.configuration.ArchivaConfiguration;
-import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
 import org.codehaus.plexus.personality.plexus.lifecycle.phase.Initializable;
 import org.codehaus.plexus.personality.plexus.lifecycle.phase.InitializationException;
 import org.codehaus.plexus.taskqueue.Task;
@@ -39,12 +40,10 @@ import org.codehaus.plexus.taskqueue.execution.TaskExecutionException;
 import org.codehaus.plexus.taskqueue.execution.TaskExecutor;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-import org.springframework.scheduling.TaskScheduler;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.PostConstruct;
 import javax.inject.Inject;
-import javax.inject.Named;
 import java.util.Date;
 
 /**
@@ -52,7 +51,7 @@ import java.util.Date;
  *
  * @version $Id$
  */
-@Service("taskExecutor#repository-scanning")
+@Service( "taskExecutor#repository-scanning" )
 public class ArchivaRepositoryScanningTaskExecutor
     implements TaskExecutor, Initializable
 {
@@ -62,13 +61,10 @@ public class ArchivaRepositoryScanningTaskExecutor
      *
      */
     @Inject
-    @Named(value="archivaConfiguration#default")
-    private ArchivaConfiguration archivaConfiguration;
+    private ManagedRepositoryAdmin managedRepositoryAdmin;
 
     /**
      * The repository scanner component.
-     *
-     *
      */
     @Inject
     private RepositoryScanner repoScanner;
@@ -89,7 +85,6 @@ public class ArchivaRepositoryScanningTaskExecutor
 
     /**
      * TODO: may be different implementations
-     *
      */
     @Inject
     private RepositorySessionFactory repositorySessionFactory;
@@ -105,102 +100,109 @@ public class ArchivaRepositoryScanningTaskExecutor
     public void executeTask( Task task )
         throws TaskExecutionException
     {
-
-        // TODO: replace this whole class with the prescribed content scanning service/action
-        // - scan repository for artifacts that do not have corresponding metadata or have been updated and
-        // send events for each
-        // - scan metadata for artifacts that have been removed and send events for each
-        // - scan metadata for missing plugin data
-        // - store information so that it can restart upon failure (publish event on the server recovery
-        // queue, remove it on successful completion)
-
-        this.task = task;
-
-        RepositoryTask repoTask = (RepositoryTask) task;
-
-        String repoId = repoTask.getRepositoryId();
-        if ( StringUtils.isBlank( repoId ) )
+        try
         {
-            throw new TaskExecutionException( "Unable to execute RepositoryTask with blank repository Id." );
-        }
+            // TODO: replace this whole class with the prescribed content scanning service/action
+            // - scan repository for artifacts that do not have corresponding metadata or have been updated and
+            // send events for each
+            // - scan metadata for artifacts that have been removed and send events for each
+            // - scan metadata for missing plugin data
+            // - store information so that it can restart upon failure (publish event on the server recovery
+            // queue, remove it on successful completion)
 
-        ManagedRepositoryConfiguration arepo = archivaConfiguration.getConfiguration().findManagedRepositoryById(
-            repoId );
+            this.task = task;
 
-        // execute consumers on resource file if set
-        if ( repoTask.getResourceFile() != null )
-        {
-            log.debug( "Executing task from queue with job name: {}", repoTask );
-            consumers.executeConsumers( arepo, repoTask.getResourceFile(), repoTask.isUpdateRelatedArtifacts() );
-        }
-        else
-        {
-            log.info( "Executing task from queue with job name: {}", repoTask );
+            RepositoryTask repoTask = (RepositoryTask) task;
 
-            // otherwise, execute consumers on whole repository
-            if ( arepo == null )
+            String repoId = repoTask.getRepositoryId();
+            if ( StringUtils.isBlank( repoId ) )
             {
-                throw new TaskExecutionException(
-                    "Unable to execute RepositoryTask with invalid repository id: " + repoId );
+                throw new TaskExecutionException( "Unable to execute RepositoryTask with blank repository Id." );
             }
 
-            long sinceWhen = RepositoryScanner.FRESH_SCAN;
-            long previousFileCount = 0;
+            ManagedRepository arepo = managedRepositoryAdmin.getManagedRepository( repoId );
 
-            RepositorySession repositorySession = repositorySessionFactory.createSession();
-            MetadataRepository metadataRepository = repositorySession.getRepository();
-            try
+            // execute consumers on resource file if set
+            if ( repoTask.getResourceFile() != null )
+            {
+                log.debug( "Executing task from queue with job name: {}", repoTask );
+                consumers.executeConsumers( arepo, repoTask.getResourceFile(), repoTask.isUpdateRelatedArtifacts() );
+            }
+            else
             {
-                if ( !repoTask.isScanAll() )
+                log.info( "Executing task from queue with job name: {}", repoTask );
+
+                // otherwise, execute consumers on whole repository
+                if ( arepo == null )
                 {
-                    RepositoryStatistics previousStats = repositoryStatisticsManager.getLastStatistics(
-                        metadataRepository, repoId );
-                    if ( previousStats != null )
-                    {
-                        sinceWhen = previousStats.getScanStartTime().getTime();
-                        previousFileCount = previousStats.getTotalFileCount();
-                    }
+                    throw new TaskExecutionException(
+                        "Unable to execute RepositoryTask with invalid repository id: " + repoId );
                 }
 
-                RepositoryScanStatistics stats;
+                long sinceWhen = RepositoryScanner.FRESH_SCAN;
+                long previousFileCount = 0;
+
+                RepositorySession repositorySession = repositorySessionFactory.createSession();
+                MetadataRepository metadataRepository = repositorySession.getRepository();
                 try
                 {
-                    stats = repoScanner.scan( arepo, sinceWhen );
-                }
-                catch ( RepositoryScannerException e )
-                {
-                    throw new TaskExecutionException( "Repository error when executing repository job.", e );
-                }
+                    if ( !repoTask.isScanAll() )
+                    {
+                        RepositoryStatistics previousStats =
+                            repositoryStatisticsManager.getLastStatistics( metadataRepository, repoId );
+                        if ( previousStats != null )
+                        {
+                            sinceWhen = previousStats.getScanStartTime().getTime();
+                            previousFileCount = previousStats.getTotalFileCount();
+                        }
+                    }
+
+                    RepositoryScanStatistics stats;
+                    try
+                    {
+                        stats = repoScanner.scan( arepo, sinceWhen );
+                    }
+                    catch ( RepositoryScannerException e )
+                    {
+                        throw new TaskExecutionException( "Repository error when executing repository job.", e );
+                    }
 
-                log.info( "Finished first scan: " + stats.toDump( arepo ) );
+                    log.info( "Finished first scan: {}", stats.toDump( arepo ) );
 
-                // further statistics will be populated by the following method
-                Date endTime = new Date( stats.getWhenGathered().getTime() + stats.getDuration() );
+                    // further statistics will be populated by the following method
+                    Date endTime = new Date( stats.getWhenGathered().getTime() + stats.getDuration() );
 
-                log.info( "Gathering repository statistics" );
+                    log.info( "Gathering repository statistics" );
 
-                repositoryStatisticsManager.addStatisticsAfterScan( metadataRepository, repoId, stats.getWhenGathered(),
-                                                                    endTime, stats.getTotalFileCount(),
-                                                                    stats.getTotalFileCount() - previousFileCount );
-                repositorySession.save();
-            }
-            catch ( MetadataRepositoryException e )
-            {
-                throw new TaskExecutionException( "Unable to store updated statistics: " + e.getMessage(), e );
-            }
-            finally
-            {
-                repositorySession.close();
-            }
+                    repositoryStatisticsManager.addStatisticsAfterScan( metadataRepository, repoId,
+                                                                        stats.getWhenGathered(), endTime,
+                                                                        stats.getTotalFileCount(),
+                                                                        stats.getTotalFileCount() - previousFileCount );
+                    repositorySession.save();
+                }
+                catch ( MetadataRepositoryException e )
+                {
+                    throw new TaskExecutionException( "Unable to store updated statistics: " + e.getMessage(), e );
+                }
+                finally
+                {
+                    repositorySession.close();
+                }
 
 //                log.info( "Scanning for removed repository content" );
 
 //                metadataRepository.findAllProjects();
-            // FIXME: do something
+                // FIXME: do something
 
-            log.info( "Finished repository task: {}", repoTask );
+                log.info( "Finished repository task: {}", repoTask );
 
-            this.task = null;
+                this.task = null;
+            }
+        }
+        catch ( RepositoryAdminException e )
+        {
+            log.error( e.getMessage(), e );
+            throw new TaskExecutionException( e.getMessage(), e );
         }
     }
 
@@ -209,16 +211,6 @@ public class ArchivaRepositoryScanningTaskExecutor
         return task;
     }
 
-    public ArchivaConfiguration getArchivaConfiguration()
-    {
-        return archivaConfiguration;
-    }
-
-    public void setArchivaConfiguration( ArchivaConfiguration archivaConfiguration )
-    {
-        this.archivaConfiguration = archivaConfiguration;
-    }
-
     public RepositoryScanner getRepoScanner()
     {
         return repoScanner;
@@ -258,4 +250,14 @@ public class ArchivaRepositoryScanningTaskExecutor
     {
         this.repositoryStatisticsManager = repositoryStatisticsManager;
     }
+
+    public ManagedRepositoryAdmin getManagedRepositoryAdmin()
+    {
+        return managedRepositoryAdmin;
+    }
+
+    public void setManagedRepositoryAdmin( ManagedRepositoryAdmin managedRepositoryAdmin )
+    {
+        this.managedRepositoryAdmin = managedRepositoryAdmin;
+    }
 }
diff --git a/archiva-modules/archiva-scheduler/archiva-scheduler-repository/src/test/java/org/apache/archiva/mock/MockArchivaAdministration.java b/archiva-modules/archiva-scheduler/archiva-scheduler-repository/src/test/java/org/apache/archiva/mock/MockArchivaAdministration.java
new file mode 100644 (file)
index 0000000..9065f9e
--- /dev/null
@@ -0,0 +1,166 @@
+package org.apache.archiva.mock;
+/*
+ * 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.admin.model.AuditInformation;
+import org.apache.archiva.admin.model.RepositoryAdminException;
+import org.apache.archiva.admin.model.admin.ArchivaAdministration;
+import org.apache.archiva.admin.model.admin.FileType;
+import org.apache.archiva.admin.model.admin.LegacyArtifactPath;
+import org.apache.archiva.admin.model.admin.OrganisationInformation;
+import org.apache.maven.archiva.configuration.ArchivaConfiguration;
+import org.springframework.stereotype.Service;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author Olivier Lamy
+ */
+public class MockArchivaAdministration
+    implements ArchivaAdministration
+{
+    private ArchivaConfiguration archivaConfiguration;
+
+    public List<LegacyArtifactPath> getLegacyArtifactPaths()
+        throws RepositoryAdminException
+    {
+        return null;  //To change body of implemented methods use File | Settings | File Templates.
+    }
+
+    public void addLegacyArtifactPath( LegacyArtifactPath legacyArtifactPath, AuditInformation auditInformation )
+        throws RepositoryAdminException
+    {
+        //To change body of implemented methods use File | Settings | File Templates.
+    }
+
+    public void deleteLegacyArtifactPath( String path, AuditInformation auditInformation )
+        throws RepositoryAdminException
+    {
+        //To change body of implemented methods use File | Settings | File Templates.
+    }
+
+    public void addFileTypePattern( String fileTypeId, String pattern, AuditInformation auditInformation )
+        throws RepositoryAdminException
+    {
+        //To change body of implemented methods use File | Settings | File Templates.
+    }
+
+    public void removeFileTypePattern( String fileTypeId, String pattern, AuditInformation auditInformation )
+        throws RepositoryAdminException
+    {
+        //To change body of implemented methods use File | Settings | File Templates.
+    }
+
+    public List<FileType> getFileTypes()
+        throws RepositoryAdminException
+    {
+        return null;  //To change body of implemented methods use File | Settings | File Templates.
+    }
+
+    public FileType getFileType( String fileTypeId )
+        throws RepositoryAdminException
+    {
+        return null;  //To change body of implemented methods use File | Settings | File Templates.
+    }
+
+    public void addFileType( FileType fileType, AuditInformation auditInformation )
+        throws RepositoryAdminException
+    {
+        //To change body of implemented methods use File | Settings | File Templates.
+    }
+
+    public void removeFileType( String fileTypeId, AuditInformation auditInformation )
+        throws RepositoryAdminException
+    {
+        //To change body of implemented methods use File | Settings | File Templates.
+    }
+
+    public void addKnownContentConsumer( String knownContentConsumer, AuditInformation auditInformation )
+        throws RepositoryAdminException
+    {
+        //To change body of implemented methods use File | Settings | File Templates.
+    }
+
+    public void setKnownContentConsumers( List<String> knownContentConsumers, AuditInformation auditInformation )
+        throws RepositoryAdminException
+    {
+        //To change body of implemented methods use File | Settings | File Templates.
+    }
+
+    public List<String> getKnownContentConsumers()
+        throws RepositoryAdminException
+    {
+        return new ArrayList<String>(
+            getArchivaConfiguration().getConfiguration().getRepositoryScanning().getKnownContentConsumers() );
+    }
+
+    public void removeKnownContentConsumer( String knownContentConsumer, AuditInformation auditInformation )
+        throws RepositoryAdminException
+    {
+        //To change body of implemented methods use File | Settings | File Templates.
+    }
+
+    public void addInvalidContentConsumer( String invalidContentConsumer, AuditInformation auditInformation )
+        throws RepositoryAdminException
+    {
+        //To change body of implemented methods use File | Settings | File Templates.
+    }
+
+    public void setInvalidContentConsumers( List<String> invalidContentConsumers, AuditInformation auditInformation )
+        throws RepositoryAdminException
+    {
+        //To change body of implemented methods use File | Settings | File Templates.
+    }
+
+    public List<String> getInvalidContentConsumers()
+        throws RepositoryAdminException
+    {
+        return new ArrayList<String>(
+            getArchivaConfiguration().getConfiguration().getRepositoryScanning().getInvalidContentConsumers() );
+    }
+
+    public void removeInvalidContentConsumer( String invalidContentConsumer, AuditInformation auditInformation )
+        throws RepositoryAdminException
+    {
+        //To change body of implemented methods use File | Settings | File Templates.
+    }
+
+    public OrganisationInformation getOrganisationInformation()
+        throws RepositoryAdminException
+    {
+        return null;  //To change body of implemented methods use File | Settings | File Templates.
+    }
+
+    public void setOrganisationInformation( OrganisationInformation organisationInformation )
+        throws RepositoryAdminException
+    {
+        //To change body of implemented methods use File | Settings | File Templates.
+    }
+
+    public ArchivaConfiguration getArchivaConfiguration()
+    {
+        return archivaConfiguration;
+    }
+
+    public void setArchivaConfiguration( ArchivaConfiguration archivaConfiguration )
+    {
+        this.archivaConfiguration = archivaConfiguration;
+    }
+}
diff --git a/archiva-modules/archiva-scheduler/archiva-scheduler-repository/src/test/java/org/apache/archiva/mock/MockManagedRepositoryAdmin.java b/archiva-modules/archiva-scheduler/archiva-scheduler-repository/src/test/java/org/apache/archiva/mock/MockManagedRepositoryAdmin.java
new file mode 100644 (file)
index 0000000..d516aa6
--- /dev/null
@@ -0,0 +1,116 @@
+package org.apache.archiva.mock;
+/*
+ * 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.admin.model.AuditInformation;
+import org.apache.archiva.admin.model.RepositoryAdminException;
+import org.apache.archiva.admin.model.managed.ManagedRepository;
+import org.apache.archiva.admin.model.managed.ManagedRepositoryAdmin;
+import org.apache.commons.lang.StringUtils;
+import org.apache.maven.archiva.configuration.ArchivaConfiguration;
+import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
+import org.springframework.stereotype.Service;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author Olivier Lamy
+ */
+public class MockManagedRepositoryAdmin
+    implements ManagedRepositoryAdmin
+{
+    private ArchivaConfiguration archivaConfiguration;
+
+    public List<ManagedRepository> getManagedRepositories()
+        throws RepositoryAdminException
+    {
+        List<ManagedRepositoryConfiguration> managedRepoConfigs =
+            getArchivaConfiguration().getConfiguration().getManagedRepositories();
+
+        List<ManagedRepository> managedRepos = new ArrayList<ManagedRepository>( managedRepoConfigs.size() );
+
+        for ( ManagedRepositoryConfiguration repoConfig : managedRepoConfigs )
+        {
+            // TODO add staging repo information back too
+            ManagedRepository repo =
+                new ManagedRepository( repoConfig.getId(), repoConfig.getName(), repoConfig.getLocation(),
+                                       repoConfig.getLayout(), repoConfig.isSnapshots(), repoConfig.isReleases(),
+                                       repoConfig.isBlockRedeployments(), repoConfig.getRefreshCronExpression(),
+                                       repoConfig.getIndexDir(), repoConfig.isScanned(), repoConfig.getDaysOlder(),
+                                       repoConfig.getRetentionCount(), repoConfig.isDeleteReleasedSnapshots() );
+
+            managedRepos.add( repo );
+        }
+
+        return managedRepos;
+    }
+
+    public Map<String, ManagedRepository> getManagedRepositoriesAsMap()
+        throws RepositoryAdminException
+    {
+        return null;
+    }
+
+    public ManagedRepository getManagedRepository( String repositoryId )
+        throws RepositoryAdminException
+    {
+        List<ManagedRepository> repos = getManagedRepositories();
+        for ( ManagedRepository repo : repos )
+        {
+            if ( StringUtils.equals( repo.getId(), repositoryId ) )
+            {
+                return repo;
+            }
+        }
+        return null;
+    }
+
+    public Boolean deleteManagedRepository( String repositoryId, AuditInformation auditInformation,
+                                            boolean deleteContent )
+        throws RepositoryAdminException
+    {
+        return null;
+    }
+
+    public Boolean addManagedRepository( ManagedRepository managedRepository, boolean needStageRepo,
+                                         AuditInformation auditInformation )
+        throws RepositoryAdminException
+    {
+        return null;
+    }
+
+    public Boolean updateManagedRepository( ManagedRepository managedRepository, boolean needStageRepo,
+                                            AuditInformation auditInformation, boolean resetStats )
+        throws RepositoryAdminException
+    {
+        return null;
+    }
+
+    public ArchivaConfiguration getArchivaConfiguration()
+    {
+        return archivaConfiguration;
+    }
+
+    public void setArchivaConfiguration( ArchivaConfiguration archivaConfiguration )
+    {
+        this.archivaConfiguration = archivaConfiguration;
+    }
+}
diff --git a/archiva-modules/archiva-scheduler/archiva-scheduler-repository/src/test/java/org/apache/archiva/mock/MockRemoteRepositoryAdmin.java b/archiva-modules/archiva-scheduler/archiva-scheduler-repository/src/test/java/org/apache/archiva/mock/MockRemoteRepositoryAdmin.java
new file mode 100644 (file)
index 0000000..0c842f3
--- /dev/null
@@ -0,0 +1,84 @@
+package org.apache.archiva.mock;
+/*
+ * 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.admin.model.AuditInformation;
+import org.apache.archiva.admin.model.RepositoryAdminException;
+import org.apache.archiva.admin.model.remote.RemoteRepository;
+import org.apache.archiva.admin.model.remote.RemoteRepositoryAdmin;
+import org.apache.maven.archiva.configuration.ArchivaConfiguration;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author Olivier Lamy
+ */
+public class MockRemoteRepositoryAdmin
+    implements RemoteRepositoryAdmin
+{
+    private ArchivaConfiguration archivaConfiguration;
+
+    public List<RemoteRepository> getRemoteRepositories()
+        throws RepositoryAdminException
+    {
+        return null;  //To change body of implemented methods use File | Settings | File Templates.
+    }
+
+    public RemoteRepository getRemoteRepository( String repositoryId )
+        throws RepositoryAdminException
+    {
+        return null;  //To change body of implemented methods use File | Settings | File Templates.
+    }
+
+    public Boolean deleteRemoteRepository( String repositoryId, AuditInformation auditInformation )
+        throws RepositoryAdminException
+    {
+        return null;  //To change body of implemented methods use File | Settings | File Templates.
+    }
+
+    public Boolean addRemoteRepository( RemoteRepository remoteRepository, AuditInformation auditInformation )
+        throws RepositoryAdminException
+    {
+        return null;  //To change body of implemented methods use File | Settings | File Templates.
+    }
+
+    public Boolean updateRemoteRepository( RemoteRepository remoteRepository, AuditInformation auditInformation )
+        throws RepositoryAdminException
+    {
+        return null;  //To change body of implemented methods use File | Settings | File Templates.
+    }
+
+    public Map<String, RemoteRepository> getRemoteRepositoriesAsMap()
+        throws RepositoryAdminException
+    {
+        return null;  //To change body of implemented methods use File | Settings | File Templates.
+    }
+
+    public ArchivaConfiguration getArchivaConfiguration()
+    {
+        return archivaConfiguration;
+    }
+
+    public void setArchivaConfiguration( ArchivaConfiguration archivaConfiguration )
+    {
+        this.archivaConfiguration = archivaConfiguration;
+    }
+}
index 681b3827dd14960ac8a81d34b59e38db6a010391..37356aa48c0fd7bf2956a1db8e211fc91ce9446a 100644 (file)
@@ -19,7 +19,7 @@ package org.apache.archiva.scheduler.repository;
  * under the License.
  */
 
-import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
+import org.apache.archiva.admin.model.managed.ManagedRepository;
 import org.apache.maven.archiva.consumers.AbstractMonitoredConsumer;
 import org.apache.maven.archiva.consumers.ConsumerException;
 import org.apache.maven.archiva.consumers.KnownRepositoryContentConsumer;
@@ -31,7 +31,6 @@ import org.apache.maven.archiva.repository.layout.LayoutException;
 import org.springframework.stereotype.Service;
 
 import javax.inject.Inject;
-import javax.inject.Named;
 import java.util.Collection;
 import java.util.Collections;
 import java.util.Date;
@@ -76,7 +75,7 @@ public class TestConsumer
         return null;
     }
 
-    public void beginScan( ManagedRepositoryConfiguration repository, Date whenGathered )
+    public void beginScan( ManagedRepository repository, Date whenGathered )
         throws ConsumerException
     {
         consumed.clear();
@@ -91,7 +90,7 @@ public class TestConsumer
         }
     }
 
-    public void beginScan( ManagedRepositoryConfiguration repository, Date whenGathered, boolean executeOnEntireRepo )
+    public void beginScan( ManagedRepository repository, Date whenGathered, boolean executeOnEntireRepo )
         throws ConsumerException
     {
         beginScan( repository, whenGathered );
index 8b0a94cb7a6f217c3474d0c268825fd55f2951ca..9074757aafaf0e3c6e8dc23aa291779ae413e235 100755 (executable)
   <context:annotation-config/>
   <context:component-scan base-package="org.apache.archiva.metadata.repository"/>
 
-  <bean name="taskExecutor#test-repository-scanning" class="org.apache.archiva.scheduler.repository.ArchivaRepositoryScanningTaskExecutor">
+  <bean name="managedRepoAdmin#test" class="org.apache.archiva.mock.MockManagedRepositoryAdmin">
+    <property name="archivaConfiguration" ref="archivaConfiguration#test-repository-scanning"/>
+  </bean>
+
+  <bean name="archivaAdministration#mock" class="org.apache.archiva.mock.MockArchivaAdministration">
+    <property name="archivaConfiguration" ref="archivaConfiguration#test-repository-scanning"/>
+  </bean>
+
+  <bean name="remoteRepositoryAdmin#mock" class="org.apache.archiva.mock.MockRemoteRepositoryAdmin">
     <property name="archivaConfiguration" ref="archivaConfiguration#test-repository-scanning"/>
   </bean>
 
+  <bean name="taskExecutor#test-repository-scanning" class="org.apache.archiva.scheduler.repository.ArchivaRepositoryScanningTaskExecutor">
+    <property name="managedRepositoryAdmin" ref="managedRepoAdmin#test"/>
+  </bean>
+
   <bean name="repositoryContentFactory#default" class="org.apache.maven.archiva.repository.RepositoryContentFactory">
     <property name="archivaConfiguration" ref="archivaConfiguration#test-repository-scanning"/>
   </bean>
index a98585291cf3aa5a82f1f0ba45116b1c833fbd98..e24666d92a4f9989424d8ac0f339c020f05bf2d7 100644 (file)
@@ -36,7 +36,36 @@ public class Artifact
 
     private String type;
 
-    //private Date whenGathered;
+    private String url;
+
+    /**
+     * contains osgi metadata Bundle-Version if available
+     *
+     * @since 1.4
+     */
+    private String bundleVersion;
+
+    /**
+     * contains osgi metadata Bundle-SymbolicName if available
+     *
+     * @since 1.4
+     */
+    private String bundleSymbolicName;
+
+    /**
+     * contains osgi metadata Export-Package if available
+     *
+     * @since 1.4
+     */
+    private String bundleExportPackage;
+
+    /**
+     * contains osgi metadata Export-Service if available
+     *
+     * @since 1.4
+     */
+    private String bundleExportService;
+
 
     public Artifact()
     {
index 57a9917cc107fb2765efd6d25b84bba6ea4d358e..85d903a28ba726ddcd8c2937b4859a19a36833f1 100644 (file)
@@ -45,10 +45,13 @@ public class ManagedRepository
 
     private boolean stageRepoNeeded;
 
-    private String cronExpression;
+    // default value
+    private String cronExpression = "0 0 * * * ?";
 
     private boolean resetStats;
 
+    private boolean scanned =false;
+
     public ManagedRepository()
     {
         // no op
@@ -173,6 +176,16 @@ public class ManagedRepository
         this.resetStats = resetStats;
     }
 
+    public boolean isScanned()
+    {
+        return scanned;
+    }
+
+    public void setScanned( boolean scanned )
+    {
+        this.scanned = scanned;
+    }
+
     public int hashCode()
     {
         int result = 17;
@@ -205,14 +218,15 @@ public class ManagedRepository
         sb.append( "ManagedRepository" );
         sb.append( "{id='" ).append( id ).append( '\'' );
         sb.append( ", name='" ).append( name ).append( '\'' );
-        sb.append( ", location='" ).append( location ).append( '\'' );
         sb.append( ", layout='" ).append( layout ).append( '\'' );
+        sb.append( ", location='" ).append( location ).append( '\'' );
         sb.append( ", snapshots=" ).append( snapshots );
         sb.append( ", releases=" ).append( releases );
         sb.append( ", blockRedeployments=" ).append( blockRedeployments );
         sb.append( ", stageRepoNeeded=" ).append( stageRepoNeeded );
         sb.append( ", cronExpression='" ).append( cronExpression ).append( '\'' );
         sb.append( ", resetStats=" ).append( resetStats );
+        sb.append( ", scanned=" ).append( scanned );
         sb.append( '}' );
         return sb.toString();
     }
index 0f19a4681fe0518368bf0db05762734f401d6488..0055e3f777872d3dcc4c8b9f983ca683fb4148d6 100644 (file)
@@ -39,7 +39,7 @@
     </dependency>
     <dependency>
       <groupId>org.apache.archiva</groupId>
-      <artifactId>archiva-repository-admin</artifactId>
+      <artifactId>archiva-repository-admin-api</artifactId>
     </dependency>
     <dependency>
       <groupId>org.apache.archiva</groupId>
       <groupId>org.apache.archiva</groupId>
       <artifactId>archiva-scheduler-repository</artifactId>
     </dependency>
+    <dependency>
+      <groupId>org.apache.archiva</groupId>
+      <artifactId>archiva-indexer</artifactId>
+    </dependency>
     <dependency>
       <groupId>org.codehaus.redback</groupId>
       <artifactId>redback-authorization-api</artifactId>
       <scope>test</scope>
     </dependency>
 
+    <dependency>
+      <groupId>org.apache.archiva</groupId>
+      <artifactId>archiva-repository-admin-default</artifactId>
+      <scope>test</scope>
+    </dependency>
+
   </dependencies>
 
   <build>
           <systemPropertyVariables>
             <plexus.home>${project.build.outputDirectory}</plexus.home>
             <appserver.base>${basedir}/target/appserver-base</appserver.base>
+            <targetDir>${basedir}/target/</targetDir>
           </systemPropertyVariables>
         </configuration>
       </plugin>
index 469f1e0c58697f1fb45840ff5534e9d19eece9e1..dc968434a85a947dd6278bc8517e218deea86cf4 100644 (file)
@@ -18,7 +18,7 @@ package org.apache.archiva.rest.services;
  * under the License.
  */
 
-import org.apache.archiva.admin.AuditInformation;
+import org.apache.archiva.admin.model.AuditInformation;
 import org.apache.archiva.audit.AuditListener;
 import org.codehaus.plexus.redback.users.User;
 import org.codehaus.redback.rest.services.RedbackAuthenticationThreadLocal;
index 522779395012babaec763c01db8f9033c641ebb7..c95ccbd7ff6c62ca70d44d801311a9895ec1419e 100644 (file)
@@ -19,8 +19,8 @@ package org.apache.archiva.rest.services;
  */
 
 import net.sf.beanlib.provider.replicator.BeanReplicator;
-import org.apache.archiva.admin.repository.RepositoryAdminException;
-import org.apache.archiva.admin.repository.admin.ArchivaAdministration;
+import org.apache.archiva.admin.model.RepositoryAdminException;
+import org.apache.archiva.admin.model.admin.ArchivaAdministration;
 import org.apache.archiva.rest.api.model.FileType;
 import org.apache.archiva.rest.api.model.LegacyArtifactPath;
 import org.apache.archiva.rest.api.model.OrganisationInformation;
@@ -51,7 +51,7 @@ public class DefaultArchivaAdministrationService
         try
         {
             List<LegacyArtifactPath> legacyArtifactPaths = new ArrayList<LegacyArtifactPath>();
-            for ( org.apache.archiva.admin.repository.admin.LegacyArtifactPath legacyArtifactPath : archivaAdministration.getLegacyArtifactPaths() )
+            for ( org.apache.archiva.admin.model.admin.LegacyArtifactPath legacyArtifactPath : archivaAdministration.getLegacyArtifactPaths() )
             {
                 legacyArtifactPaths.add(
                     new BeanReplicator().replicateBean( legacyArtifactPath, LegacyArtifactPath.class ) );
@@ -70,7 +70,7 @@ public class DefaultArchivaAdministrationService
         try
         {
             archivaAdministration.addLegacyArtifactPath( new BeanReplicator().replicateBean( legacyArtifactPath,
-                                                                                             org.apache.archiva.admin.repository.admin.LegacyArtifactPath.class ),
+                                                                                             org.apache.archiva.admin.model.admin.LegacyArtifactPath.class ),
                                                          getAuditInformation() );
         }
         catch ( RepositoryAdminException e )
@@ -127,8 +127,7 @@ public class DefaultArchivaAdministrationService
     {
         try
         {
-            org.apache.archiva.admin.repository.admin.FileType fileType =
-                archivaAdministration.getFileType( fileTypeId );
+            org.apache.archiva.admin.model.admin.FileType fileType = archivaAdministration.getFileType( fileTypeId );
             if ( fileType == null )
             {
                 return null;
@@ -146,9 +145,9 @@ public class DefaultArchivaAdministrationService
     {
         try
         {
-            archivaAdministration.addFileType( new BeanReplicator().replicateBean( fileType,
-                                                                                   org.apache.archiva.admin.repository.admin.FileType.class ),
-                                               getAuditInformation() );
+            archivaAdministration.addFileType(
+                new BeanReplicator().replicateBean( fileType, org.apache.archiva.admin.model.admin.FileType.class ),
+                getAuditInformation() );
         }
         catch ( RepositoryAdminException e )
         {
@@ -257,14 +256,13 @@ public class DefaultArchivaAdministrationService
     {
         try
         {
-            List<org.apache.archiva.admin.repository.admin.FileType> modelfileTypes =
-                archivaAdministration.getFileTypes();
+            List<org.apache.archiva.admin.model.admin.FileType> modelfileTypes = archivaAdministration.getFileTypes();
             if ( modelfileTypes == null || modelfileTypes.isEmpty() )
             {
                 return Collections.emptyList();
             }
             List<FileType> fileTypes = new ArrayList<FileType>( modelfileTypes.size() );
-            for ( org.apache.archiva.admin.repository.admin.FileType fileType : modelfileTypes )
+            for ( org.apache.archiva.admin.model.admin.FileType fileType : modelfileTypes )
             {
                 fileTypes.add( new BeanReplicator().replicateBean( fileType, FileType.class ) );
             }
@@ -307,7 +305,7 @@ public class DefaultArchivaAdministrationService
     {
         try
         {
-            org.apache.archiva.admin.repository.admin.OrganisationInformation organisationInformation =
+            org.apache.archiva.admin.model.admin.OrganisationInformation organisationInformation =
                 archivaAdministration.getOrganisationInformation();
 
             return organisationInformation == null
@@ -333,7 +331,7 @@ public class DefaultArchivaAdministrationService
             {
                 archivaAdministration.setOrganisationInformation(
                     new BeanReplicator().replicateBean( organisationInformation,
-                                                        org.apache.archiva.admin.repository.admin.OrganisationInformation.class ) );
+                                                        org.apache.archiva.admin.model.admin.OrganisationInformation.class ) );
             }
         }
         catch ( RepositoryAdminException e )
index f473abc5829f1e932d038d766c4ad38d0ed43f34..f2fa197d4d6ddf93c5718e4a5c7a9ec1de9f30d3 100644 (file)
@@ -18,8 +18,8 @@ package org.apache.archiva.rest.services;
  * under the License.
  */
 
-import org.apache.archiva.admin.repository.RepositoryAdminException;
-import org.apache.archiva.admin.repository.managed.ManagedRepositoryAdmin;
+import org.apache.archiva.admin.model.RepositoryAdminException;
+import org.apache.archiva.admin.model.managed.ManagedRepositoryAdmin;
 import org.apache.archiva.rest.api.model.ManagedRepository;
 import org.apache.archiva.rest.api.services.ArchivaRestServiceException;
 import org.apache.archiva.rest.api.services.ManagedRepositoriesService;
@@ -48,12 +48,12 @@ public class DefaultManagedRepositoriesService
     {
         try
         {
-            List<org.apache.archiva.admin.repository.managed.ManagedRepository> repos =
+            List<org.apache.archiva.admin.model.managed.ManagedRepository> repos =
                 managedRepositoryAdmin.getManagedRepositories();
 
             List<ManagedRepository> managedRepos = new ArrayList<ManagedRepository>( repos.size() );
 
-            for ( org.apache.archiva.admin.repository.managed.ManagedRepository repoConfig : repos )
+            for ( org.apache.archiva.admin.model.managed.ManagedRepository repoConfig : repos )
             {
                 // TODO staging repo too
                 ManagedRepository repo =
@@ -96,8 +96,8 @@ public class DefaultManagedRepositoriesService
     public Boolean addManagedRepository( ManagedRepository managedRepository )
         throws Exception
     {
-        org.apache.archiva.admin.repository.managed.ManagedRepository repo =
-            new org.apache.archiva.admin.repository.managed.ManagedRepository();
+        org.apache.archiva.admin.model.managed.ManagedRepository repo =
+            new org.apache.archiva.admin.model.managed.ManagedRepository();
         repo.setLocation( managedRepository.getLocation() );
         repo.setBlockRedeployments( managedRepository.isBlockRedeployments() );
         repo.setCronExpression( managedRepository.getCronExpression() );
@@ -114,8 +114,8 @@ public class DefaultManagedRepositoriesService
     public Boolean updateManagedRepository( ManagedRepository managedRepository )
         throws Exception
     {
-        org.apache.archiva.admin.repository.managed.ManagedRepository repo =
-            new org.apache.archiva.admin.repository.managed.ManagedRepository();
+        org.apache.archiva.admin.model.managed.ManagedRepository repo =
+            new org.apache.archiva.admin.model.managed.ManagedRepository();
         repo.setLocation( managedRepository.getLocation() );
         repo.setBlockRedeployments( managedRepository.isBlockRedeployments() );
         repo.setCronExpression( managedRepository.getCronExpression() );
index 5e23c9ff0ea6b8df1e600404154b0d020141c4b6..011dda6dc1c70f0e9475a902f3b734caf7ce1018 100644 (file)
@@ -19,8 +19,8 @@ package org.apache.archiva.rest.services;
  */
 
 import net.sf.beanlib.provider.replicator.BeanReplicator;
-import org.apache.archiva.admin.repository.RepositoryAdminException;
-import org.apache.archiva.admin.repository.networkproxy.NetworkProxyAdmin;
+import org.apache.archiva.admin.model.RepositoryAdminException;
+import org.apache.archiva.admin.model.networkproxy.NetworkProxyAdmin;
 import org.apache.archiva.rest.api.model.NetworkProxy;
 import org.apache.archiva.rest.api.services.ArchivaRestServiceException;
 import org.apache.archiva.rest.api.services.NetworkProxyService;
@@ -47,7 +47,7 @@ public class DefaultNetworkProxyService
         try
         {
             List<NetworkProxy> networkProxies = new ArrayList<NetworkProxy>();
-            for ( org.apache.archiva.admin.repository.networkproxy.NetworkProxy networkProxy : networkProxyAdmin.getNetworkProxies() )
+            for ( org.apache.archiva.admin.model.networkproxy.NetworkProxy networkProxy : networkProxyAdmin.getNetworkProxies() )
             {
                 networkProxies.add( new BeanReplicator().replicateBean( networkProxy, NetworkProxy.class ) );
             }
@@ -64,7 +64,7 @@ public class DefaultNetworkProxyService
     {
         try
         {
-            org.apache.archiva.admin.repository.networkproxy.NetworkProxy networkProxy =
+            org.apache.archiva.admin.model.networkproxy.NetworkProxy networkProxy =
                 networkProxyAdmin.getNetworkProxy( networkProxyId );
             return networkProxy == null ? null : new BeanReplicator().replicateBean( networkProxy, NetworkProxy.class );
         }
@@ -84,7 +84,7 @@ public class DefaultNetworkProxyService
                 return;
             }
             getNetworkProxyAdmin().addNetworkProxy( new BeanReplicator().replicateBean( networkProxy,
-                                                                                        org.apache.archiva.admin.repository.networkproxy.NetworkProxy.class ),
+                                                                                        org.apache.archiva.admin.model.networkproxy.NetworkProxy.class ),
                                                     getAuditInformation() );
         }
         catch ( RepositoryAdminException e )
@@ -103,7 +103,7 @@ public class DefaultNetworkProxyService
         try
         {
             getNetworkProxyAdmin().updateNetworkProxy( new BeanReplicator().replicateBean( networkProxy,
-                                                                                           org.apache.archiva.admin.repository.networkproxy.NetworkProxy.class ),
+                                                                                           org.apache.archiva.admin.model.networkproxy.NetworkProxy.class ),
                                                        getAuditInformation() );
         }
         catch ( RepositoryAdminException e )
index 24087aa067606831f124e05b62c8cfa4d4762145..30e2ab8aef1c957d0d59a717aff52dd8a51cad2e 100644 (file)
@@ -19,8 +19,8 @@ package org.apache.archiva.rest.services;
  */
 
 import net.sf.beanlib.provider.replicator.BeanReplicator;
-import org.apache.archiva.admin.repository.RepositoryAdminException;
-import org.apache.archiva.admin.repository.proxyconnector.ProxyConnectorAdmin;
+import org.apache.archiva.admin.model.RepositoryAdminException;
+import org.apache.archiva.admin.model.proxyconnector.ProxyConnectorAdmin;
 import org.apache.archiva.rest.api.model.ProxyConnector;
 import org.apache.archiva.rest.api.services.ArchivaRestServiceException;
 import org.apache.archiva.rest.api.services.ProxyConnectorService;
@@ -47,7 +47,7 @@ public class DefaultProxyConnectorService
         try
         {
             List<ProxyConnector> proxyConnectors = new ArrayList<ProxyConnector>();
-            for ( org.apache.archiva.admin.repository.proxyconnector.ProxyConnector proxyConnector : proxyConnectorAdmin.getProxyConnectors() )
+            for ( org.apache.archiva.admin.model.proxyconnector.ProxyConnector proxyConnector : proxyConnectorAdmin.getProxyConnectors() )
             {
                 proxyConnectors.add( new BeanReplicator().replicateBean( proxyConnector, ProxyConnector.class ) );
             }
@@ -64,7 +64,7 @@ public class DefaultProxyConnectorService
     {
         try
         {
-            org.apache.archiva.admin.repository.proxyconnector.ProxyConnector proxyConnector =
+            org.apache.archiva.admin.model.proxyconnector.ProxyConnector proxyConnector =
                 proxyConnectorAdmin.getProxyConnector( sourceRepoId, targetRepoId );
             return proxyConnector == null
                 ? null
@@ -86,7 +86,7 @@ public class DefaultProxyConnectorService
         try
         {
             return proxyConnectorAdmin.addProxyConnector( new BeanReplicator().replicateBean( proxyConnector,
-                                                                                              org.apache.archiva.admin.repository.proxyconnector.ProxyConnector.class ),
+                                                                                              org.apache.archiva.admin.model.proxyconnector.ProxyConnector.class ),
                                                           getAuditInformation() );
         }
         catch ( RepositoryAdminException e )
@@ -105,7 +105,7 @@ public class DefaultProxyConnectorService
         try
         {
             return proxyConnectorAdmin.deleteProxyConnector( new BeanReplicator().replicateBean( proxyConnector,
-                                                                                                 org.apache.archiva.admin.repository.proxyconnector.ProxyConnector.class ),
+                                                                                                 org.apache.archiva.admin.model.proxyconnector.ProxyConnector.class ),
                                                              getAuditInformation() );
         }
         catch ( RepositoryAdminException e )
@@ -124,7 +124,7 @@ public class DefaultProxyConnectorService
         try
         {
             return proxyConnectorAdmin.updateProxyConnector( new BeanReplicator().replicateBean( proxyConnector,
-                                                                                                 org.apache.archiva.admin.repository.proxyconnector.ProxyConnector.class ),
+                                                                                                 org.apache.archiva.admin.model.proxyconnector.ProxyConnector.class ),
                                                              getAuditInformation() );
         }
         catch ( RepositoryAdminException e )
index 9f3eeeb8d7d7cd099f3dd8bf20ebabc0fe454d17..9dbd068eb2f94ab5ceec41f8c332ee4403d764bb 100644 (file)
@@ -18,8 +18,8 @@ package org.apache.archiva.rest.services;
  * under the License.
  */
 
-import org.apache.archiva.admin.repository.RepositoryAdminException;
-import org.apache.archiva.admin.repository.remote.RemoteRepositoryAdmin;
+import org.apache.archiva.admin.model.RepositoryAdminException;
+import org.apache.archiva.admin.model.remote.RemoteRepositoryAdmin;
 import org.apache.archiva.rest.api.model.RemoteRepository;
 import org.apache.archiva.rest.api.services.ArchivaRestServiceException;
 import org.apache.archiva.rest.api.services.RemoteRepositoriesService;
@@ -49,7 +49,7 @@ public class DefaultRemoteRepositoriesService
         try
         {
             List<RemoteRepository> remoteRepositories = new ArrayList<RemoteRepository>();
-            for ( org.apache.archiva.admin.repository.remote.RemoteRepository remoteRepository : remoteRepositoryAdmin.getRemoteRepositories() )
+            for ( org.apache.archiva.admin.model.remote.RemoteRepository remoteRepository : remoteRepositoryAdmin.getRemoteRepositories() )
             {
                 RemoteRepository repo = new RemoteRepository( remoteRepository.getId(), remoteRepository.getName(),
                                                               remoteRepository.getUrl(), remoteRepository.getLayout(),
@@ -100,15 +100,15 @@ public class DefaultRemoteRepositoriesService
                                                              getAuditInformation() );
     }
 
-    private org.apache.archiva.admin.repository.remote.RemoteRepository getModelRemoteRepository(
+    private org.apache.archiva.admin.model.remote.RemoteRepository getModelRemoteRepository(
         RemoteRepository remoteRepository )
     {
-        return new org.apache.archiva.admin.repository.remote.RemoteRepository( remoteRepository.getId(),
-                                                                                remoteRepository.getName(),
-                                                                                remoteRepository.getUrl(),
-                                                                                remoteRepository.getLayout(),
-                                                                                remoteRepository.getUserName(),
-                                                                                remoteRepository.getPassword(),
-                                                                                remoteRepository.getTimeOut() );
+        return new org.apache.archiva.admin.model.remote.RemoteRepository( remoteRepository.getId(),
+                                                                           remoteRepository.getName(),
+                                                                           remoteRepository.getUrl(),
+                                                                           remoteRepository.getLayout(),
+                                                                           remoteRepository.getUserName(),
+                                                                           remoteRepository.getPassword(),
+                                                                           remoteRepository.getTimeOut() );
     }
 }
index 26048fcff4fbc11cfd12bf7386cdf2266e0005f6..2475ff809b8ddc690858a2581c965e544ecfa89a 100644 (file)
@@ -19,14 +19,10 @@ package org.apache.archiva.rest.services;
  * under the License.
  */
 
-import org.apache.archiva.admin.repository.managed.ManagedRepositoryAdmin;
-import org.apache.archiva.metadata.repository.RepositorySessionFactory;
-import org.apache.archiva.metadata.repository.stats.RepositoryStatisticsManager;
 import org.apache.archiva.rest.api.services.RepositoriesService;
 import org.apache.archiva.scheduler.repository.RepositoryArchivaTaskScheduler;
 import org.apache.archiva.scheduler.repository.RepositoryTask;
 import org.codehaus.plexus.redback.role.RoleManager;
-import org.codehaus.plexus.registry.Registry;
 import org.codehaus.plexus.taskqueue.TaskQueueException;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
index e68bdd1a84df6feceb6793b0382620c8128fc8bc..c52a20bc6fd3916eef52445adc21ff227409ef5b 100644 (file)
@@ -18,8 +18,8 @@ package org.apache.archiva.rest.services;
  * under the License.
  */
 
-import org.apache.archiva.admin.repository.RepositoryAdminException;
-import org.apache.archiva.admin.repository.group.RepositoryGroupAdmin;
+import org.apache.archiva.admin.model.RepositoryAdminException;
+import org.apache.archiva.admin.model.group.RepositoryGroupAdmin;
 import org.apache.archiva.rest.api.model.RepositoryGroup;
 import org.apache.archiva.rest.api.services.ArchivaRestServiceException;
 import org.apache.archiva.rest.api.services.RepositoryGroupService;
@@ -48,7 +48,7 @@ public class DefaultRepositoryGroupService
         try
         {
             List<RepositoryGroup> repositoriesGroups = new ArrayList<RepositoryGroup>();
-            for ( org.apache.archiva.admin.repository.group.RepositoryGroup repoGroup : repositoryGroupAdmin.getRepositoriesGroups() )
+            for ( org.apache.archiva.admin.model.group.RepositoryGroup repoGroup : repositoryGroupAdmin.getRepositoriesGroups() )
             {
                 repositoriesGroups.add(
                     new RepositoryGroup( repoGroup.getId(), new ArrayList<String>( repoGroup.getRepositories() ) ) );
@@ -80,7 +80,7 @@ public class DefaultRepositoryGroupService
         try
         {
             return repositoryGroupAdmin.addRepositoryGroup(
-                new org.apache.archiva.admin.repository.group.RepositoryGroup( repoGroup.getId(), new ArrayList<String>(
+                new org.apache.archiva.admin.model.group.RepositoryGroup( repoGroup.getId(), new ArrayList<String>(
                     repoGroup.getRepositories() ) ), getAuditInformation() );
         }
         catch ( RepositoryAdminException e )
@@ -95,7 +95,7 @@ public class DefaultRepositoryGroupService
         try
         {
             return repositoryGroupAdmin.updateRepositoryGroup(
-                new org.apache.archiva.admin.repository.group.RepositoryGroup( repoGroup.getId(), new ArrayList<String>(
+                new org.apache.archiva.admin.model.group.RepositoryGroup( repoGroup.getId(), new ArrayList<String>(
                     repoGroup.getRepositories() ) ), getAuditInformation() );
         }
         catch ( RepositoryAdminException e )
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
new file mode 100644 (file)
index 0000000..a4d8cbf
--- /dev/null
@@ -0,0 +1,164 @@
+package org.apache.archiva.rest.services;
+/*
+ * 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 net.sf.beanlib.provider.replicator.BeanReplicator;
+import org.apache.archiva.indexer.search.RepositorySearch;
+import org.apache.archiva.indexer.search.RepositorySearchException;
+import org.apache.archiva.indexer.search.SearchResultHit;
+import org.apache.archiva.indexer.search.SearchResultLimits;
+import org.apache.archiva.indexer.search.SearchResults;
+import org.apache.archiva.rest.api.model.Artifact;
+import org.apache.archiva.rest.api.model.Dependency;
+import org.apache.archiva.rest.api.services.ArchivaRestServiceException;
+import org.apache.archiva.rest.api.services.SearchService;
+import org.apache.archiva.security.AccessDeniedException;
+import org.apache.archiva.security.ArchivaSecurityException;
+import org.apache.archiva.security.PrincipalNotFoundException;
+import org.apache.archiva.security.UserRepositories;
+import org.apache.commons.lang.StringUtils;
+import org.codehaus.plexus.redback.users.UserManager;
+import org.codehaus.redback.rest.services.RedbackAuthenticationThreadLocal;
+import org.codehaus.redback.rest.services.RedbackRequestInformation;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Service;
+
+import javax.inject.Inject;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+/**
+ * @author Olivier Lamy
+ */
+@Service( "searchService#rest" )
+public class DefaultSearchService
+    implements SearchService
+{
+
+    private Logger log = LoggerFactory.getLogger( getClass() );
+
+    @Inject
+    private RepositorySearch repositorySearch;
+
+    @Inject
+    private UserRepositories userRepositories;
+
+    public List<Artifact> quickSearch( String queryString )
+        throws ArchivaRestServiceException
+    {
+        if ( StringUtils.isBlank( queryString ) )
+        {
+            return Collections.emptyList();
+        }
+
+        SearchResultLimits limits = new SearchResultLimits( 0 );
+        List<String> observableRepoIds = getObservableRepos();
+        try
+        {
+            SearchResults searchResults =
+                repositorySearch.search( getPrincipal(), getObservableRepos(), queryString, limits,
+                                         Collections.<String>emptyList() );
+            return getArtifacts( searchResults );
+        }
+        catch ( RepositorySearchException e )
+        {
+            log.error( e.getMessage(), e );
+            throw new ArchivaRestServiceException( e.getMessage() );
+        }
+    }
+
+    public List<Artifact> getArtifactByChecksum( String checksum )
+        throws ArchivaRestServiceException
+    {
+        return null;  //To change body of implemented methods use File | Settings | File Templates.
+    }
+
+    public List<Artifact> getArtifactVersions( String groupId, String artifactId )
+        throws ArchivaRestServiceException
+    {
+        return null;  //To change body of implemented methods use File | Settings | File Templates.
+    }
+
+    public List<Dependency> getDependencies( String groupId, String artifactId, String version )
+        throws ArchivaRestServiceException
+    {
+        return null;  //To change body of implemented methods use File | Settings | File Templates.
+    }
+
+
+    protected List<String> getObservableRepos()
+    {
+        try
+        {
+            List<String> ids = userRepositories.getObservableRepositoryIds( getPrincipal() );
+            return ids == null ? Collections.<String>emptyList() : ids;
+        }
+        catch ( PrincipalNotFoundException e )
+        {
+            log.warn( e.getMessage(), e );
+        }
+        catch ( AccessDeniedException e )
+        {
+            log.warn( e.getMessage(), e );
+        }
+        catch ( ArchivaSecurityException e )
+        {
+            log.warn( e.getMessage(), e );
+        }
+        return Collections.emptyList();
+    }
+
+    protected String getPrincipal()
+    {
+        RedbackRequestInformation redbackRequestInformation = RedbackAuthenticationThreadLocal.get();
+
+        return redbackRequestInformation == null
+            ? UserManager.GUEST_USERNAME
+            : ( redbackRequestInformation.getUser() == null
+                ? UserManager.GUEST_USERNAME
+                : redbackRequestInformation.getUser().getUsername() );
+    }
+
+    protected List<Artifact> getArtifacts( SearchResults searchResults )
+    {
+        if ( searchResults == null || searchResults.isEmpty() )
+        {
+            return Collections.emptyList();
+        }
+        List<Artifact> artifacts = new ArrayList<Artifact>( searchResults.getReturnedHitsCount() );
+        for ( SearchResultHit searchResultHit : searchResults.getHits() )
+        {
+            Artifact artifact = new BeanReplicator().replicateBean( searchResultHit, Artifact.class );
+            artifacts.add( artifact );
+            // duplicate Artifact one per available version
+            if ( searchResultHit.getVersions().size() > 1 )
+            {
+                for ( String version : searchResultHit.getVersions() )
+                {
+                    Artifact versionned = new BeanReplicator().replicateBean( searchResultHit, Artifact.class );
+                    versionned.setVersion( version );
+                    artifacts.add( versionned );
+                }
+            }
+        }
+        return artifacts;
+    }
+}
index 9dbc8e6773d0376787210a3c091a5ab8a9e81493..af17b5ae3d53f8fe9c9e2368ccc5635e9b4cb386 100644 (file)
@@ -35,9 +35,9 @@
   -->
   <import resource="classpath:META-INF/cxf/cxf-servlet.xml"/>
 
-  <context:annotation-config />
+  <context:annotation-config/>
   <context:component-scan
-    base-package="org.apache.archiva.rest.services"/>
+      base-package="org.apache.archiva.rest.services"/>
 
   <jaxrs:server id="archivaServices" address="/archivaServices">
 
       <ref bean="proxyConnectorService#rest"/>
       <ref bean="networkProxyService#rest"/>
       <ref bean="archivaAdministrationService#default"/>
+      <ref bean="searchService#rest"/>
     </jaxrs:serviceBeans>
 
     <jaxrs:outInterceptors>
       <ref bean="threadLocalUserCleaner#rest"/>
     </jaxrs:outInterceptors>
 
-   </jaxrs:server>
+  </jaxrs:server>
 
 </beans>
\ No newline at end of file
index 79a3e82231c5fa168bbc2f19d4cb0720e9d2cf31..39fa6ae76b1c24d569eba4c3d765b3f365aa4220 100644 (file)
@@ -28,6 +28,7 @@ import org.apache.archiva.rest.api.services.ProxyConnectorService;
 import org.apache.archiva.rest.api.services.RemoteRepositoriesService;
 import org.apache.archiva.rest.api.services.RepositoriesService;
 import org.apache.archiva.rest.api.services.RepositoryGroupService;
+import org.apache.archiva.rest.api.services.SearchService;
 import org.apache.cxf.jaxrs.client.JAXRSClientFactory;
 import org.apache.cxf.jaxrs.client.WebClient;
 import org.apache.maven.archiva.common.utils.FileUtil;
@@ -52,15 +53,36 @@ public abstract class AbstractArchivaRestTest
 
     protected RepositoriesService getRepositoriesService()
     {
-        return JAXRSClientFactory.create( "http://localhost:" + port + "/services/archivaServices/",
-                                          RepositoriesService.class );
+        return getRepositoriesService( null );
+    }
+
+    protected RepositoriesService getRepositoriesService( String authzHeader )
+    {
+        RepositoriesService service =
+            JAXRSClientFactory.create( "http://localhost:" + port + "/services/archivaServices/",
+                                       RepositoriesService.class );
+
+        if ( authzHeader != null )
+        {
+            WebClient.client( service ).header( "Authorization", authzHeader );
+        }
+        WebClient.getConfig( service ).getHttpConduit().getClient().setReceiveTimeout( 100000000 );
+        return service;
 
     }
 
-    protected ManagedRepositoriesService getManagedRepositoriesService()
+    protected ManagedRepositoriesService getManagedRepositoriesService( String authzHeader )
     {
-        return JAXRSClientFactory.create( "http://localhost:" + port + "/services/archivaServices/",
-                                          ManagedRepositoriesService.class );
+        ManagedRepositoriesService service =
+            JAXRSClientFactory.create( "http://localhost:" + port + "/services/archivaServices/",
+                                       ManagedRepositoriesService.class );
+
+        if ( authzHeader != null )
+        {
+            WebClient.client( service ).header( "Authorization", authzHeader );
+        }
+        WebClient.getConfig( service ).getHttpConduit().getClient().setReceiveTimeout( 100000000 );
+        return service;
 
     }
 
@@ -117,6 +139,20 @@ public abstract class AbstractArchivaRestTest
         return service;
     }
 
+    protected SearchService getSearchService( String authzHeader )
+    {
+        SearchService service =
+            JAXRSClientFactory.create( "http://localhost:" + port + "/services/archivaServices/", SearchService.class );
+
+        if ( authzHeader != null )
+        {
+            WebClient.client( service ).header( "Authorization", authzHeader );
+        }
+        WebClient.getConfig( service ).getHttpConduit().getClient().setReceiveTimeout( 100000000 );
+        return service;
+
+    }
+
     protected ManagedRepository getTestManagedRepository()
     {
         String location = new File( FileUtil.getBasedir(), "target/test-repo" ).getAbsolutePath();
index c885706874bca6037b787067af4d53b676597874..c7acbc7361887ab2f44fdcece0ff2af6aa9e4b3d 100644 (file)
@@ -21,12 +21,8 @@ package org.apache.archiva.rest.services;
 
 import org.apache.archiva.rest.api.model.ManagedRepository;
 import org.apache.archiva.rest.api.services.ManagedRepositoriesService;
-import org.apache.cxf.jaxrs.client.WebClient;
-import org.apache.maven.archiva.common.utils.FileUtil;
 import org.junit.Test;
 
-import java.io.File;
-
 /**
  * @author Olivier Lamy
  */
@@ -39,9 +35,8 @@ public class ManagedRepositoriesServiceTest
     public void addManagedRepo()
         throws Exception
     {
-        ManagedRepositoriesService service = getManagedRepositoriesService();
-        WebClient.client( service ).header( "Authorization", authorizationHeader );
-        WebClient.getConfig( service ).getHttpConduit().getClient().setReceiveTimeout( 300000 );
+        ManagedRepositoriesService service = getManagedRepositoriesService( authorizationHeader );
+
         ManagedRepository repo = getTestManagedRepository();
         if ( service.getManagedRepository( repo.getId() ) != null )
         {
@@ -59,9 +54,8 @@ public class ManagedRepositoriesServiceTest
     public void updateManagedRepo()
         throws Exception
     {
-        ManagedRepositoriesService service = getManagedRepositoriesService();
-        WebClient.client( service ).header( "Authorization", authorizationHeader );
-        WebClient.getConfig( service ).getHttpConduit().getClient().setReceiveTimeout( 300000 );
+        ManagedRepositoriesService service = getManagedRepositoriesService( authorizationHeader );
+
         ManagedRepository repo = getTestManagedRepository();
         if ( service.getManagedRepository( repo.getId() ) != null )
         {
@@ -81,13 +75,10 @@ public class ManagedRepositoriesServiceTest
         assertNotNull( repo );
         assertEquals( "toto", repo.getName() );
 
-
         service.deleteManagedRepository( repo.getId(), true );
         assertNull( service.getManagedRepository( repo.getId() ) );
 
     }
 
 
-
-
 }
index a9b14cd890456e7fa30ea984bda0b282f5610c9c..faa417cc7ef2a6ab4da845465a48487f847392dc 100644 (file)
@@ -60,8 +60,8 @@ public class RepositoriesServiceTest
         WebClient.client( service ).header( "Authorization", authorizationHeader );
         WebClient.getConfig( service ).getHttpConduit().getClient().setReceiveTimeout( 300000 );
 
-        ManagedRepositoriesService managedRepositoriesService = getManagedRepositoriesService();
-        WebClient.client( managedRepositoriesService ).header( "Authorization", authorizationHeader );
+        ManagedRepositoriesService managedRepositoriesService = getManagedRepositoriesService( authorizationHeader );
+
         WebClient.getConfig( managedRepositoriesService ).getHttpConduit().getClient().setReceiveTimeout( 300000 );
 
         String repoId = managedRepositoriesService.getManagedRepositories().get( 0 ).getId();
index f048da826b4ddd1754d41123f5aac66946bacb0b..96a02654cbe3b1b007b1eee8a5e1f3a50cbec06e 100644 (file)
@@ -43,8 +43,8 @@ public class RepositoryGroupServiceTest
 
         assertTrue( service.getRepositoriesGroups().isEmpty() );
 
-        ManagedRepositoriesService managedRepositoriesService = getManagedRepositoriesService();
-        WebClient.client( managedRepositoriesService ).header( "Authorization", authorizationHeader );
+        ManagedRepositoriesService managedRepositoriesService = getManagedRepositoriesService( authorizationHeader );
+
         WebClient.getConfig( service ).getHttpConduit().getClient().setReceiveTimeout( 300000 );
 
         ManagedRepository managedRepository = getTestManagedRepository();
diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/SearchServiceTest.java b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/SearchServiceTest.java
new file mode 100644 (file)
index 0000000..857abf5
--- /dev/null
@@ -0,0 +1,105 @@
+package org.apache.archiva.rest.services;
+/*
+ * 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.rest.api.model.Artifact;
+import org.apache.archiva.rest.api.model.ManagedRepository;
+import org.apache.archiva.rest.api.services.ManagedRepositoriesService;
+import org.apache.archiva.rest.api.services.SearchService;
+import org.apache.commons.io.FileUtils;
+import org.junit.Test;
+
+import java.io.File;
+import java.util.List;
+
+/**
+ * @author Olivier Lamy
+ */
+public class SearchServiceTest
+    extends AbstractArchivaRestTest
+{
+    @Test
+    public void quickSearchOnArtifactId()
+        throws Exception
+    {
+
+        // olamy temporary disabled due to huge refactoring
+        if (true)
+        {
+            return;
+        }
+
+        String testRepoId = "test-repo";
+        // force guest user creation if not exists
+        if ( getUserService( authorizationHeader ).getGuestUser() == null )
+        {
+            assertNotNull( getUserService( authorizationHeader ).createGuestUser() );
+        }
+
+        File targetRepo = new File( System.getProperty( "targetDir", "./target" ), "test-repo" );
+
+        if ( targetRepo.exists() )
+        {
+            FileUtils.deleteDirectory( targetRepo );
+        }
+
+        File sourceRepo = new File( "src/test/repo-with-osgi" );
+
+        FileUtils.copyDirectory( sourceRepo, targetRepo );
+
+        ManagedRepository managedRepository = new ManagedRepository();
+        managedRepository.setId( testRepoId );
+        managedRepository.setName( "test repo" );
+        managedRepository.setCronExpression( "* * * * * ?" );
+
+        managedRepository.setLocation( targetRepo.getPath() );
+
+        ManagedRepositoriesService service = getManagedRepositoriesService( authorizationHeader );
+        service.addManagedRepository( managedRepository );
+
+        getRepositoriesService( authorizationHeader ).scanRepository( testRepoId, true );
+
+        while ( getRepositoriesService( authorizationHeader ).alreadyScanning( testRepoId ) )
+        {
+            Thread.sleep( 1000 );
+        }
+
+        SearchService searchService = getSearchService( authorizationHeader );
+
+        List<Artifact> artifacts = searchService.quickSearch( "commons-logging" );
+
+        assertNotNull( artifacts );
+        assertTrue( " empty results for commons-logging search", artifacts.size() > 0 );
+        log.info( "artifacts for commons-logginf search {}", artifacts );
+
+        deleteTestRepo( testRepoId );
+    }
+
+    private void deleteTestRepo( String id )
+        throws Exception
+    {
+        if ( getManagedRepositoriesService( authorizationHeader ).getManagedRepository( id ) != null )
+        {
+            getManagedRepositoriesService( authorizationHeader ).deleteManagedRepository( id, true );
+        }
+    }
+
+}
+
+
diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-cli/commons-cli/1.0/commons-cli-1.0-sources.jar b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-cli/commons-cli/1.0/commons-cli-1.0-sources.jar
new file mode 100644 (file)
index 0000000..8f67432
Binary files /dev/null and b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-cli/commons-cli/1.0/commons-cli-1.0-sources.jar differ
diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-cli/commons-cli/1.0/commons-cli-1.0-sources.jar.sha1 b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-cli/commons-cli/1.0/commons-cli-1.0-sources.jar.sha1
new file mode 100644 (file)
index 0000000..eebab12
--- /dev/null
@@ -0,0 +1 @@
+fc9b2f6fb941aadf5ea34f68c983b0e6bfbf2ca7
\ No newline at end of file
diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-cli/commons-cli/1.0/commons-cli-1.0.jar b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-cli/commons-cli/1.0/commons-cli-1.0.jar
new file mode 100644 (file)
index 0000000..22a004e
Binary files /dev/null and b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-cli/commons-cli/1.0/commons-cli-1.0.jar differ
diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-cli/commons-cli/1.0/commons-cli-1.0.jar.sha1 b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-cli/commons-cli/1.0/commons-cli-1.0.jar.sha1
new file mode 100644 (file)
index 0000000..c22c98b
--- /dev/null
@@ -0,0 +1 @@
+6dac9733315224fc562f6268df58e92d65fd0137
\ No newline at end of file
diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-cli/commons-cli/1.0/commons-cli-1.0.pom b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-cli/commons-cli/1.0/commons-cli-1.0.pom
new file mode 100644 (file)
index 0000000..cfc5a04
--- /dev/null
@@ -0,0 +1,76 @@
+<project>
+  <modelVersion>4.0.0</modelVersion>
+  <groupId>commons-cli</groupId>
+  <artifactId>commons-cli</artifactId>
+  <name>CLI</name>
+  <version>1.0</version>
+  <description>Commons CLI provides a simple API for working with the command line arguments and options.</description>
+  <inceptionYear>2002</inceptionYear>
+  <developers>
+    <developer>
+      <id>jstrachan</id>
+      <name>James Strachan</name>
+      <email>jstrachan@apache.org</email>
+      <organization>SpiritSoft, Inc.</organization>
+    </developer>
+    <developer>
+      <id>bob</id>
+      <name>bob mcwhirter</name>
+      <email>bob@werken.com</email>
+      <organization>Werken</organization>
+    </developer>
+    <developer>
+      <id>jkeyes</id>
+      <name>John Keyes</name>
+      <email>jbjk@mac.com</email>
+      <organization>integral Source</organization>
+    </developer>
+  </developers>
+  <contributors>
+    <contributor>
+      <name>Berin Loritsch</name>
+      <email>bloritsch@apache.org</email>
+      <roles>
+        <role>helped in the Avalon CLI merge</role>
+      </roles>
+    </contributor>
+    <contributor>
+      <name>Peter Maddocks</name>
+      <email>peter_maddocks@hp.com</email>
+      <organization>Hewlett-Packard</organization>
+      <roles>
+        <role>supplied patch</role>
+      </roles>
+    </contributor>
+  </contributors>
+  <build>
+    <plugins>
+      <plugin>
+        <artifactId>maven-surefire-plugin</artifactId>
+        <configuration>
+          <includes>
+            <include>**/*Test*.java</include>
+          </includes>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+  <dependencies>
+    <dependency>
+      <groupId>commons-logging</groupId>
+      <artifactId>commons-logging</artifactId>
+      <version>1.0</version>
+    </dependency>
+    <dependency>
+      <groupId>commons-lang</groupId>
+      <artifactId>commons-lang</artifactId>
+      <version>1.0</version>
+    </dependency>
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <version>3.7</version>
+      <scope>test</scope>
+    </dependency>
+  </dependencies>
+</project>
\ No newline at end of file
diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-cli/commons-cli/1.0/commons-cli-1.0.pom.sha1 b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-cli/commons-cli/1.0/commons-cli-1.0.pom.sha1
new file mode 100644 (file)
index 0000000..1d926c9
--- /dev/null
@@ -0,0 +1 @@
+bc51fd74ed7c8ccf75b3abc84b3613d6ba60eb89  /home/projects/maven/repository-staging/to-ibiblio/maven2/commons-cli/commons-cli/1.0/commons-cli-1.0.pom\r
diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.0.1/commons-logging-1.0.1-javadoc.jar b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.0.1/commons-logging-1.0.1-javadoc.jar
new file mode 100644 (file)
index 0000000..77ca3a9
Binary files /dev/null and b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.0.1/commons-logging-1.0.1-javadoc.jar differ
diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.0.1/commons-logging-1.0.1-javadoc.jar.md5 b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.0.1/commons-logging-1.0.1-javadoc.jar.md5
new file mode 100644 (file)
index 0000000..7cda458
--- /dev/null
@@ -0,0 +1 @@
+c40f1b459fdf90848bfeef8b5856eba6
\ No newline at end of file
diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.0.1/commons-logging-1.0.1-javadoc.jar.sha1 b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.0.1/commons-logging-1.0.1-javadoc.jar.sha1
new file mode 100644 (file)
index 0000000..a92bb1c
--- /dev/null
@@ -0,0 +1 @@
+098d85a82cd48a746e1304825ba70b8df25f4131
\ No newline at end of file
diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.0.1/commons-logging-1.0.1.jar b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.0.1/commons-logging-1.0.1.jar
new file mode 100644 (file)
index 0000000..c64e88c
Binary files /dev/null and b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.0.1/commons-logging-1.0.1.jar differ
diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.0.1/commons-logging-1.0.1.jar.md5 b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.0.1/commons-logging-1.0.1.jar.md5
new file mode 100644 (file)
index 0000000..62bd727
--- /dev/null
@@ -0,0 +1 @@
+e1b1720a761ca36eaa47e1c7d802e676
\ No newline at end of file
diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.0.1/commons-logging-1.0.1.jar.sha1 b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.0.1/commons-logging-1.0.1.jar.sha1
new file mode 100644 (file)
index 0000000..3724daf
--- /dev/null
@@ -0,0 +1 @@
+2e8405d4a28a0b359fbfb8855bde0fdeb0099858
\ No newline at end of file
diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.0.1/commons-logging-1.0.1.pom b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.0.1/commons-logging-1.0.1.pom
new file mode 100644 (file)
index 0000000..956fcd3
--- /dev/null
@@ -0,0 +1,30 @@
+<project>
+  <modelVersion>4.0.0</modelVersion>
+  <groupId>commons-logging</groupId>
+  <artifactId>commons-logging</artifactId>
+  <name>Logging</name>
+  <version>1.0.1</version>
+  <description>Commons Logging</description>
+  <inceptionYear>2002</inceptionYear>
+  <build />
+  <dependencies>
+    <dependency>
+      <groupId>log4j</groupId>
+      <artifactId>log4j</artifactId>
+      <version>1.1.3</version>
+      <optional>true</optional>
+    </dependency>
+    <dependency>
+      <groupId>logkit</groupId>
+      <artifactId>logkit</artifactId>
+      <version>1.0.1</version>
+      <optional>true</optional>
+    </dependency>
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <version>3.7</version>
+      <scope>test</scope>
+    </dependency>
+  </dependencies>
+</project>
diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.0.1/commons-logging-1.0.1.pom.md5 b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.0.1/commons-logging-1.0.1.pom.md5
new file mode 100644 (file)
index 0000000..cdd2818
--- /dev/null
@@ -0,0 +1 @@
+17548178996d55e5f1561a6fd675616f  /home/projects/maven/repository-staging/to-ibiblio/maven2/commons-logging/commons-logging/1.0.1/commons-logging-1.0.1.pom\r
diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.0.1/commons-logging-1.0.1.pom.sha1 b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.0.1/commons-logging-1.0.1.pom.sha1
new file mode 100644 (file)
index 0000000..355c5ec
--- /dev/null
@@ -0,0 +1 @@
+665b8439aad27af8b87fd3fefa11d901d851c9d5  /home/projects/maven/repository-staging/to-ibiblio/maven2/commons-logging/commons-logging/1.0.1/commons-logging-1.0.1.pom\r
diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.0.1/maven-metadata.xml b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.0.1/maven-metadata.xml
new file mode 100644 (file)
index 0000000..dbb6f0a
--- /dev/null
@@ -0,0 +1,5 @@
+<metadata>
+  <groupId>commons-logging</groupId>
+  <artifactId>commons-logging</artifactId>
+  <version>1.0.1</version>
+</metadata>
\ No newline at end of file
diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.0.1/maven-metadata.xml.md5 b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.0.1/maven-metadata.xml.md5
new file mode 100644 (file)
index 0000000..91dc5e9
--- /dev/null
@@ -0,0 +1 @@
+629e92df42c9735e1794689ea6e2f1e5  ./commons-logging/commons-logging/1.0.1/maven-metadata.xml\r
diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.0.1/maven-metadata.xml.sha1 b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.0.1/maven-metadata.xml.sha1
new file mode 100644 (file)
index 0000000..ff58c9b
--- /dev/null
@@ -0,0 +1 @@
+e8e65fd3a18876a01e3f771015c3ad052ca01af5  /home/maven/repository-staging/to-ibiblio/maven2/commons-logging/commons-logging/1.0.1/maven-metadata.xml\r
diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.0.2/commons-logging-1.0.2-javadoc.jar b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.0.2/commons-logging-1.0.2-javadoc.jar
new file mode 100644 (file)
index 0000000..994637f
Binary files /dev/null and b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.0.2/commons-logging-1.0.2-javadoc.jar differ
diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.0.2/commons-logging-1.0.2-javadoc.jar.md5 b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.0.2/commons-logging-1.0.2-javadoc.jar.md5
new file mode 100644 (file)
index 0000000..06e29d8
--- /dev/null
@@ -0,0 +1 @@
+23bc0c53b59b1689d3cbd97de42e0a74
\ No newline at end of file
diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.0.2/commons-logging-1.0.2-javadoc.jar.sha1 b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.0.2/commons-logging-1.0.2-javadoc.jar.sha1
new file mode 100644 (file)
index 0000000..a21af97
--- /dev/null
@@ -0,0 +1 @@
+635c2d062a007ffc71a956d45a149f0896ffed8d
\ No newline at end of file
diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.0.2/commons-logging-1.0.2.jar b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.0.2/commons-logging-1.0.2.jar
new file mode 100644 (file)
index 0000000..aca1e41
Binary files /dev/null and b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.0.2/commons-logging-1.0.2.jar differ
diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.0.2/commons-logging-1.0.2.jar.md5 b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.0.2/commons-logging-1.0.2.jar.md5
new file mode 100644 (file)
index 0000000..03af6e3
--- /dev/null
@@ -0,0 +1 @@
+bdb6d37e652f164451ebd0cb10b7f645
\ No newline at end of file
diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.0.2/commons-logging-1.0.2.jar.sha1 b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.0.2/commons-logging-1.0.2.jar.sha1
new file mode 100644 (file)
index 0000000..6d343de
--- /dev/null
@@ -0,0 +1 @@
+37c659e57293656ebef1a247fc6ceb738ebdfc74
\ No newline at end of file
diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.0.2/commons-logging-1.0.2.pom b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.0.2/commons-logging-1.0.2.pom
new file mode 100644 (file)
index 0000000..6a2cebb
--- /dev/null
@@ -0,0 +1,30 @@
+<project>
+  <modelVersion>4.0.0</modelVersion>
+  <groupId>commons-logging</groupId>
+  <artifactId>commons-logging</artifactId>
+  <name>Logging</name>
+  <version>1.0.2</version>
+  <description>Commons Logging</description>
+  <inceptionYear>2002</inceptionYear>
+  <build />
+  <dependencies>
+    <dependency>
+      <groupId>log4j</groupId>
+      <artifactId>log4j</artifactId>
+      <version>1.1.3</version>
+      <optional>true</optional>
+    </dependency>
+    <dependency>
+      <groupId>logkit</groupId>
+      <artifactId>logkit</artifactId>
+      <version>1.0.1</version>
+      <optional>true</optional>
+    </dependency>
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <version>3.7</version>
+      <scope>test</scope>
+    </dependency>
+  </dependencies>
+</project>
diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.0.2/commons-logging-1.0.2.pom.md5 b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.0.2/commons-logging-1.0.2.pom.md5
new file mode 100644 (file)
index 0000000..93a58b6
--- /dev/null
@@ -0,0 +1 @@
+b7e001b135a56678ac81f21ac2469957  /home/projects/maven/repository-staging/to-ibiblio/maven2/commons-logging/commons-logging/1.0.2/commons-logging-1.0.2.pom\r
diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.0.2/commons-logging-1.0.2.pom.sha1 b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.0.2/commons-logging-1.0.2.pom.sha1
new file mode 100644 (file)
index 0000000..906aa58
--- /dev/null
@@ -0,0 +1 @@
+994768b3b18380239296871de3d732935d390c24  /home/projects/maven/repository-staging/to-ibiblio/maven2/commons-logging/commons-logging/1.0.2/commons-logging-1.0.2.pom\r
diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.0.2/maven-metadata.xml b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.0.2/maven-metadata.xml
new file mode 100644 (file)
index 0000000..3f42d43
--- /dev/null
@@ -0,0 +1,5 @@
+<metadata>
+  <groupId>commons-logging</groupId>
+  <artifactId>commons-logging</artifactId>
+  <version>1.0.2</version>
+</metadata>
\ No newline at end of file
diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.0.2/maven-metadata.xml.md5 b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.0.2/maven-metadata.xml.md5
new file mode 100644 (file)
index 0000000..9db4760
--- /dev/null
@@ -0,0 +1 @@
+32d0d002721d3669f8d01970fb7d556c  ./commons-logging/commons-logging/1.0.2/maven-metadata.xml\r
diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.0.2/maven-metadata.xml.sha1 b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.0.2/maven-metadata.xml.sha1
new file mode 100644 (file)
index 0000000..a6ddbca
--- /dev/null
@@ -0,0 +1 @@
+db4cb003a7eacd19b5eb9747a484f23209ea20fd  /home/maven/repository-staging/to-ibiblio/maven2/commons-logging/commons-logging/1.0.2/maven-metadata.xml\r
diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.0.3/commons-logging-1.0.3-javadoc.jar b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.0.3/commons-logging-1.0.3-javadoc.jar
new file mode 100644 (file)
index 0000000..ce4d7ec
Binary files /dev/null and b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.0.3/commons-logging-1.0.3-javadoc.jar differ
diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.0.3/commons-logging-1.0.3-javadoc.jar.md5 b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.0.3/commons-logging-1.0.3-javadoc.jar.md5
new file mode 100644 (file)
index 0000000..ba413f3
--- /dev/null
@@ -0,0 +1 @@
+852ef679e9998498e7d4ac6121c45316
\ No newline at end of file
diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.0.3/commons-logging-1.0.3-javadoc.jar.sha1 b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.0.3/commons-logging-1.0.3-javadoc.jar.sha1
new file mode 100644 (file)
index 0000000..b4a76d4
--- /dev/null
@@ -0,0 +1 @@
+d0773fcb73e98a977b54c70c289fe06e60d57643
\ No newline at end of file
diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.0.3/commons-logging-1.0.3.jar b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.0.3/commons-logging-1.0.3.jar
new file mode 100644 (file)
index 0000000..b99c937
Binary files /dev/null and b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.0.3/commons-logging-1.0.3.jar differ
diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.0.3/commons-logging-1.0.3.jar.md5 b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.0.3/commons-logging-1.0.3.jar.md5
new file mode 100644 (file)
index 0000000..4b9f4d1
--- /dev/null
@@ -0,0 +1 @@
+5bc8bdd15b18018e84fd862993aaca42
\ No newline at end of file
diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.0.3/commons-logging-1.0.3.jar.sha1 b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.0.3/commons-logging-1.0.3.jar.sha1
new file mode 100644 (file)
index 0000000..9e50b25
--- /dev/null
@@ -0,0 +1 @@
+760c711c71588bc273d3e56d196d720a7678cd93
\ No newline at end of file
diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.0.3/commons-logging-1.0.3.pom b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.0.3/commons-logging-1.0.3.pom
new file mode 100644 (file)
index 0000000..c46b27f
--- /dev/null
@@ -0,0 +1,31 @@
+<project>
+  <modelVersion>4.0.0</modelVersion>
+  <groupId>commons-logging</groupId>
+  <artifactId>commons-logging</artifactId>
+  <name>Logging</name>
+  <version>1.0.3</version>
+  <description>Commons Logging</description>
+  <url>http://jakarta.apache.org/commons/logging/</url>
+  <inceptionYear>2001</inceptionYear>
+  <build />
+  <dependencies>
+    <dependency>
+      <groupId>log4j</groupId>
+      <artifactId>log4j</artifactId>
+      <version>1.2.6</version>
+      <optional>true</optional>
+    </dependency>
+    <dependency>
+      <groupId>logkit</groupId>
+      <artifactId>logkit</artifactId>
+      <version>1.0.1</version>
+      <optional>true</optional>
+    </dependency>
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <version>3.7</version>
+      <scope>test</scope>
+    </dependency>
+  </dependencies>
+</project>
diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.0.3/commons-logging-1.0.3.pom.md5 b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.0.3/commons-logging-1.0.3.pom.md5
new file mode 100644 (file)
index 0000000..02d6c5f
--- /dev/null
@@ -0,0 +1 @@
+881dca51df49b39efb7b81b05b31278d  /home/projects/maven/repository-staging/to-ibiblio/maven2/commons-logging/commons-logging/1.0.3/commons-logging-1.0.3.pom\r
diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.0.3/commons-logging-1.0.3.pom.sha1 b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.0.3/commons-logging-1.0.3.pom.sha1
new file mode 100644 (file)
index 0000000..c03effc
--- /dev/null
@@ -0,0 +1 @@
+b7de43bb310eb1dbfd00a34cec30500fa13cb577  /home/projects/maven/repository-staging/to-ibiblio/maven2/commons-logging/commons-logging/1.0.3/commons-logging-1.0.3.pom\r
diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.0.3/maven-metadata.xml b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.0.3/maven-metadata.xml
new file mode 100644 (file)
index 0000000..d733c03
--- /dev/null
@@ -0,0 +1,5 @@
+<metadata>
+  <groupId>commons-logging</groupId>
+  <artifactId>commons-logging</artifactId>
+  <version>1.0.3</version>
+</metadata>
\ No newline at end of file
diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.0.3/maven-metadata.xml.md5 b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.0.3/maven-metadata.xml.md5
new file mode 100644 (file)
index 0000000..425ad3e
--- /dev/null
@@ -0,0 +1 @@
+15cae318f3bfbde23028f26c8ba153aa  ./commons-logging/commons-logging/1.0.3/maven-metadata.xml\r
diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.0.3/maven-metadata.xml.sha1 b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.0.3/maven-metadata.xml.sha1
new file mode 100644 (file)
index 0000000..0557855
--- /dev/null
@@ -0,0 +1 @@
+7f4047267ed6d4679ee568460c2abea4fe8146b6  /home/maven/repository-staging/to-ibiblio/maven2/commons-logging/commons-logging/1.0.3/maven-metadata.xml\r
diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.0.4/commons-logging-1.0.4-javadoc.jar b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.0.4/commons-logging-1.0.4-javadoc.jar
new file mode 100644 (file)
index 0000000..efacb52
Binary files /dev/null and b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.0.4/commons-logging-1.0.4-javadoc.jar differ
diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.0.4/commons-logging-1.0.4-javadoc.jar.md5 b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.0.4/commons-logging-1.0.4-javadoc.jar.md5
new file mode 100644 (file)
index 0000000..1308a1a
--- /dev/null
@@ -0,0 +1 @@
+f0626403d6ba70cd8758d74a4d557a86
\ No newline at end of file
diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.0.4/commons-logging-1.0.4-javadoc.jar.sha1 b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.0.4/commons-logging-1.0.4-javadoc.jar.sha1
new file mode 100644 (file)
index 0000000..c9243b3
--- /dev/null
@@ -0,0 +1 @@
+e6ab582bb54e0eba076f314d98272457261501ee
\ No newline at end of file
diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.0.4/commons-logging-1.0.4-sources.jar b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.0.4/commons-logging-1.0.4-sources.jar
new file mode 100644 (file)
index 0000000..fc4bc9f
Binary files /dev/null and b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.0.4/commons-logging-1.0.4-sources.jar differ
diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.0.4/commons-logging-1.0.4-sources.jar.md5 b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.0.4/commons-logging-1.0.4-sources.jar.md5
new file mode 100644 (file)
index 0000000..75ba570
--- /dev/null
@@ -0,0 +1 @@
+0a95b57dbd6ac8fc8da869de59709477  commons-logging/commons-logging/1.0.4/commons-logging-1.0.4-sources.jar\r
diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.0.4/commons-logging-1.0.4-sources.jar.sha1 b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.0.4/commons-logging-1.0.4-sources.jar.sha1
new file mode 100644 (file)
index 0000000..9563546
--- /dev/null
@@ -0,0 +1 @@
+08d3424a318e818f88568dfb3b55c58583364ba9  commons-logging/commons-logging/1.0.4/commons-logging-1.0.4-sources.jar\r
diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.0.4/commons-logging-1.0.4.jar b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.0.4/commons-logging-1.0.4.jar
new file mode 100644 (file)
index 0000000..b73a80f
Binary files /dev/null and b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.0.4/commons-logging-1.0.4.jar differ
diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.0.4/commons-logging-1.0.4.jar.md5 b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.0.4/commons-logging-1.0.4.jar.md5
new file mode 100644 (file)
index 0000000..1156a2e
--- /dev/null
@@ -0,0 +1 @@
+8a507817b28077e0478add944c64586a
\ No newline at end of file
diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.0.4/commons-logging-1.0.4.jar.sha1 b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.0.4/commons-logging-1.0.4.jar.sha1
new file mode 100644 (file)
index 0000000..7e0a60e
--- /dev/null
@@ -0,0 +1 @@
+f029a2aefe2b3e1517573c580f948caac31b1056
\ No newline at end of file
diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.0.4/commons-logging-1.0.4.pom b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.0.4/commons-logging-1.0.4.pom
new file mode 100644 (file)
index 0000000..7c1017d
--- /dev/null
@@ -0,0 +1,165 @@
+<project>
+  <modelVersion>4.0.0</modelVersion>
+  <groupId>commons-logging</groupId>
+  <artifactId>commons-logging</artifactId>
+  <name>Logging</name>
+  <version>1.0.4</version>
+  <description>Commons Logging is a thin adapter allowing configurable bridging to other,
+    well known logging systems.</description>
+  <url>http://jakarta.apache.org/commons/logging/</url>
+  <issueManagement>
+    <url>http://issues.apache.org/bugzilla/</url>
+  </issueManagement>
+  <ciManagement>
+    <notifiers>
+      <notifier>
+        <configuration>
+          <address>commons-dev@jakarta.apache.org</address>
+        </configuration>
+      </notifier>
+    </notifiers>
+  </ciManagement>
+  <inceptionYear>2001</inceptionYear>
+  <mailingLists>
+    <mailingList>
+      <name>Commons Dev List</name>
+      <subscribe>commons-dev-subscribe@jakarta.apache.org</subscribe>
+      <unsubscribe>commons-dev-unsubscribe@jakarta.apache.org</unsubscribe>
+      <archive>http://nagoya.apache.org/eyebrowse/SummarizeList?listName=commons-dev@jakarta.apache.org</archive>
+    </mailingList>
+    <mailingList>
+      <name>Commons User List</name>
+      <subscribe>commons-user-subscribe@jakarta.apache.org</subscribe>
+      <unsubscribe>commons-user-unsubscribe@jakarta.apache.org</unsubscribe>
+      <archive>http://nagoya.apache.org/eyebrowse/SummarizeList?listName=commons-user@jakarta.apache.org</archive>
+    </mailingList>
+  </mailingLists>
+  <developers>
+    <developer>
+      <id>morgand</id>
+      <name>Morgan Delagrange</name>
+      <email>morgand at apache dot org</email>
+      <organization>Apache</organization>
+      <roles>
+        <role>Java Developer</role>
+      </roles>
+    </developer>
+    <developer>
+      <id>rwaldhoff</id>
+      <name>Rodney Waldhoff</name>
+      <email>rwaldhoff at apache org</email>
+      <organization>Apache Software Foundation</organization>
+    </developer>
+    <developer>
+      <id>craigmcc</id>
+      <name>Craig McClanahan</name>
+      <email>craigmcc at apache org</email>
+      <organization>Apache Software Foundation</organization>
+    </developer>
+    <developer>
+      <id>sanders</id>
+      <name>Scott Sanders</name>
+      <email>sanders at apache dot org</email>
+      <organization>Apache Software Foundation</organization>
+    </developer>
+    <developer>
+      <id>rdonkin</id>
+      <name>Robert Burrell Donkin</name>
+      <email>rdonkin at apache dot org</email>
+      <organization>Apache Software Foundation</organization>
+    </developer>
+    <developer>
+      <id>donaldp</id>
+      <name>Peter Donald</name>
+      <email>donaldp at apache dot org</email>
+      <organization></organization>
+    </developer>
+    <developer>
+      <id>costin</id>
+      <name>Costin Manolache</name>
+      <email>costin at apache dot org</email>
+      <organization>Apache Software Foundation</organization>
+    </developer>
+    <developer>
+      <id>rsitze</id>
+      <name>Richard Sitze</name>
+      <email>rsitze at apache dot org</email>
+      <organization>Apache Software Foundation</organization>
+    </developer>
+    <developer>
+      <id>baliuka</id>
+      <name>Juozas Baliuka</name>
+      <email>baliuka@apache.org</email>
+      <organization></organization>
+      <roles>
+        <role>Java Developer</role>
+      </roles>
+    </developer>
+  </developers>
+  <licenses>
+    <license>
+      <name>The Apache Software License, Version 2.0</name>
+      <url>/LICENSE.txt</url>
+    </license>
+  </licenses>
+  <scm>
+    <connection>scm:cvs:pserver:anoncvs@cvs.apache.org:/home/cvspublic:jakarta-commons/logging</connection>
+    <url>http://cvs.apache.org/viewcvs/jakarta-commons/logging/</url>
+  </scm>
+  <organization>
+    <name>The Apache Software Foundation</name>
+    <url>http://jakarta.apache.org</url>
+  </organization>
+  <build>
+    <sourceDirectory>src/java</sourceDirectory>
+    <testSourceDirectory>src/test</testSourceDirectory>
+    <plugins>
+      <plugin>
+        <artifactId>maven-surefire-plugin</artifactId>
+        <configuration>
+          <includes>
+            <include>**/AvalonLoggerTest.java</include>
+          </includes>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+  <dependencies>
+    <dependency>
+      <groupId>log4j</groupId>
+      <artifactId>log4j</artifactId>
+      <version>1.2.6</version>
+      <optional>true</optional>
+    </dependency>
+    <dependency>
+      <groupId>logkit</groupId>
+      <artifactId>logkit</artifactId>
+      <version>1.0.1</version>
+      <optional>true</optional>
+    </dependency>
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <version>3.7</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>avalon-framework</groupId>
+      <artifactId>avalon-framework</artifactId>
+      <version>4.1.3</version>
+      <optional>true</optional>
+    </dependency>
+  </dependencies>
+  <distributionManagement>
+    <repository>
+      <id>default</id>
+      <name>Default Repository</name>
+      <url>file:///www/jakarta.apache.org/builds/jakarta-commons/logging/</url>
+    </repository>
+    <site>
+      <id>default</id>
+      <name>Default Site</name>
+      <url>scp://jakarta.apache.org//www/jakarta.apache.org/commons/logging/</url>
+    </site>
+  </distributionManagement>
+</project>
diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.0.4/commons-logging-1.0.4.pom.md5 b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.0.4/commons-logging-1.0.4.pom.md5
new file mode 100644 (file)
index 0000000..65216d8
--- /dev/null
@@ -0,0 +1 @@
+2794b156c9725ac6382c22663ae42124  /home/projects/maven/repository-staging/to-ibiblio/maven2/commons-logging/commons-logging/1.0.4/commons-logging-1.0.4.pom\r
diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.0.4/commons-logging-1.0.4.pom.sha1 b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.0.4/commons-logging-1.0.4.pom.sha1
new file mode 100644 (file)
index 0000000..676ff7b
--- /dev/null
@@ -0,0 +1 @@
+7d32e7520b801cabc3dc704d2afe59d020d00c45  /home/projects/maven/repository-staging/to-ibiblio/maven2/commons-logging/commons-logging/1.0.4/commons-logging-1.0.4.pom\r
diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.0.4/maven-metadata.xml b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.0.4/maven-metadata.xml
new file mode 100644 (file)
index 0000000..536a7be
--- /dev/null
@@ -0,0 +1,5 @@
+<metadata>
+  <groupId>commons-logging</groupId>
+  <artifactId>commons-logging</artifactId>
+  <version>1.0.4</version>
+</metadata>
\ No newline at end of file
diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.0.4/maven-metadata.xml.md5 b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.0.4/maven-metadata.xml.md5
new file mode 100644 (file)
index 0000000..b0beda6
--- /dev/null
@@ -0,0 +1 @@
+182e4358962671c46ee4242d9dad4013  ./commons-logging/commons-logging/1.0.4/maven-metadata.xml\r
diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.0.4/maven-metadata.xml.sha1 b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.0.4/maven-metadata.xml.sha1
new file mode 100644 (file)
index 0000000..722baf9
--- /dev/null
@@ -0,0 +1 @@
+5bb716617b7904d05e5563801f72ebcce96a161a  /home/maven/repository-staging/to-ibiblio/maven2/commons-logging/commons-logging/1.0.4/maven-metadata.xml\r
diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.0/commons-logging-1.0-javadoc.jar b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.0/commons-logging-1.0-javadoc.jar
new file mode 100644 (file)
index 0000000..42b59d1
Binary files /dev/null and b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.0/commons-logging-1.0-javadoc.jar differ
diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.0/commons-logging-1.0-javadoc.jar.md5 b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.0/commons-logging-1.0-javadoc.jar.md5
new file mode 100644 (file)
index 0000000..ea8ffa0
--- /dev/null
@@ -0,0 +1 @@
+cd31f6e132e9076168247b5b62e7d4f2
\ No newline at end of file
diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.0/commons-logging-1.0-javadoc.jar.sha1 b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.0/commons-logging-1.0-javadoc.jar.sha1
new file mode 100644 (file)
index 0000000..461afce
--- /dev/null
@@ -0,0 +1 @@
+e3f9527e9e04311a8d411b93bc06930574070839
\ No newline at end of file
diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.0/commons-logging-1.0.jar b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.0/commons-logging-1.0.jar
new file mode 100644 (file)
index 0000000..33232cd
Binary files /dev/null and b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.0/commons-logging-1.0.jar differ
diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.0/commons-logging-1.0.jar.md5 b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.0/commons-logging-1.0.jar.md5
new file mode 100644 (file)
index 0000000..7c997d2
--- /dev/null
@@ -0,0 +1 @@
+240b26992977c9ad119efb91cb21f8f8
\ No newline at end of file
diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.0/commons-logging-1.0.jar.sha1 b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.0/commons-logging-1.0.jar.sha1
new file mode 100644 (file)
index 0000000..58918b6
--- /dev/null
@@ -0,0 +1 @@
+f10838aa1add95b8cd26b8c9c07b2278c21e64b4
\ No newline at end of file
diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.0/commons-logging-1.0.pom b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.0/commons-logging-1.0.pom
new file mode 100644 (file)
index 0000000..402a9df
--- /dev/null
@@ -0,0 +1,6 @@
+<project>
+  <modelVersion>4.0.0</modelVersion>
+  <groupId>commons-logging</groupId>
+  <artifactId>commons-logging</artifactId>
+  <version>1.0</version>
+</project>
diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.0/commons-logging-1.0.pom.md5 b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.0/commons-logging-1.0.pom.md5
new file mode 100644 (file)
index 0000000..acb6710
--- /dev/null
@@ -0,0 +1 @@
+aa412f75c470cd28468a20bd4c811e7d  /home/projects/maven/repository-staging/to-ibiblio/maven2/commons-logging/commons-logging/1.0/commons-logging-1.0.pom\r
diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.0/commons-logging-1.0.pom.sha1 b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.0/commons-logging-1.0.pom.sha1
new file mode 100644 (file)
index 0000000..3c6069d
--- /dev/null
@@ -0,0 +1 @@
+4f58df6cca7ad7b863e8186e5dc25a8ef502e374  /home/projects/maven/repository-staging/to-ibiblio/maven2/commons-logging/commons-logging/1.0/commons-logging-1.0.pom\r
diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.0/maven-metadata.xml b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.0/maven-metadata.xml
new file mode 100644 (file)
index 0000000..db699f5
--- /dev/null
@@ -0,0 +1,5 @@
+<metadata>
+  <groupId>commons-logging</groupId>
+  <artifactId>commons-logging</artifactId>
+  <version>1.0</version>
+</metadata>
\ No newline at end of file
diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.0/maven-metadata.xml.md5 b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.0/maven-metadata.xml.md5
new file mode 100644 (file)
index 0000000..f43d7b9
--- /dev/null
@@ -0,0 +1 @@
+d507f2c419364009f089592dfd9acea2  ./commons-logging/commons-logging/1.0/maven-metadata.xml\r
diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.0/maven-metadata.xml.sha1 b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.0/maven-metadata.xml.sha1
new file mode 100644 (file)
index 0000000..a0ac3dd
--- /dev/null
@@ -0,0 +1 @@
+5fe9e6d013ddf2a2f9e2b21582024d4f8e2f7ca5  /home/maven/repository-staging/to-ibiblio/maven2/commons-logging/commons-logging/1.0/maven-metadata.xml\r
diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.1/commons-logging-1.1-sources.jar b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.1/commons-logging-1.1-sources.jar
new file mode 100644 (file)
index 0000000..1e036f1
Binary files /dev/null and b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.1/commons-logging-1.1-sources.jar differ
diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.1/commons-logging-1.1-sources.jar.md5 b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.1/commons-logging-1.1-sources.jar.md5
new file mode 100644 (file)
index 0000000..b896085
--- /dev/null
@@ -0,0 +1 @@
+6c6e00b54fdb9e3489554b49dface8ec  /home/csanchez/repository-staging/to-ibiblio/maven2/commons-logging/commons-logging/1.1/commons-logging-1.1-sources.jar\r
diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.1/commons-logging-1.1-sources.jar.sha1 b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.1/commons-logging-1.1-sources.jar.sha1
new file mode 100644 (file)
index 0000000..4925697
--- /dev/null
@@ -0,0 +1 @@
+5c2bd34c9a05067c72dcf08cd248630561a9c852  /home/csanchez/repository-staging/to-ibiblio/maven2/commons-logging/commons-logging/1.1/commons-logging-1.1-sources.jar\r
diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.1/commons-logging-1.1.jar b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.1/commons-logging-1.1.jar
new file mode 100644 (file)
index 0000000..2ff9bbd
Binary files /dev/null and b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.1/commons-logging-1.1.jar differ
diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.1/commons-logging-1.1.jar.md5 b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.1/commons-logging-1.1.jar.md5
new file mode 100644 (file)
index 0000000..42c7efb
--- /dev/null
@@ -0,0 +1 @@
+6b62417e77b000a87de66ee3935edbf5  /home/csanchez/repository-staging/to-ibiblio/maven2/commons-logging/commons-logging/1.1/commons-logging-1.1.jar\r
diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.1/commons-logging-1.1.jar.sha1 b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.1/commons-logging-1.1.jar.sha1
new file mode 100644 (file)
index 0000000..5a6ea7b
--- /dev/null
@@ -0,0 +1 @@
+ba24d5de831911b684c92cd289ed5ff826271824  /home/csanchez/repository-staging/to-ibiblio/maven2/commons-logging/commons-logging/1.1/commons-logging-1.1.jar\r
diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.1/commons-logging-1.1.pom b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.1/commons-logging-1.1.pom
new file mode 100644 (file)
index 0000000..b1ea16f
--- /dev/null
@@ -0,0 +1,191 @@
+<?xml version="1.0" encoding="UTF-8"?><project>
+  <modelVersion>4.0.0</modelVersion>
+  <groupId>commons-logging</groupId>
+  <artifactId>commons-logging</artifactId>
+  <name>Logging</name>
+  <version>1.1</version>
+  <description>Commons Logging is a thin adapter allowing configurable bridging to other,
+    well known logging systems.</description>
+  <url>http://jakarta.apache.org/commons/${pom.artifactId.substring(8)}/</url>
+  <issueManagement>
+    <url>http://issues.apache.org/bugzilla/</url>
+  </issueManagement>
+  <ciManagement>
+    <notifiers>
+      <notifier>
+        <configuration>
+          <address>commons-dev@jakarta.apache.org</address>
+        </configuration>
+      </notifier>
+    </notifiers>
+  </ciManagement>
+  <inceptionYear>2001</inceptionYear>
+  <mailingLists>
+    <mailingList>
+      <name>Commons Dev List</name>
+      <subscribe>commons-dev-subscribe@jakarta.apache.org</subscribe>
+      <unsubscribe>commons-dev-unsubscribe@jakarta.apache.org</unsubscribe>
+      <archive>http://mail-archives.apache.org/mod_mbox/jakarta-commons-dev/</archive>
+    </mailingList>
+    <mailingList>
+      <name>Commons User List</name>
+      <subscribe>commons-user-subscribe@jakarta.apache.org</subscribe>
+      <unsubscribe>commons-user-unsubscribe@jakarta.apache.org</unsubscribe>
+      <archive>http://mail-archives.apache.org/mod_mbox/jakarta-commons-user/</archive>
+    </mailingList>
+  </mailingLists>
+  <developers>
+    <developer>
+      <id>morgand</id>
+      <name>Morgan Delagrange</name>
+      <email>morgand at apache dot org</email>
+      <organization>Apache</organization>
+      <roles>
+        <role>Java Developer</role>
+      </roles>
+    </developer>
+    <developer>
+      <id>rwaldhoff</id>
+      <name>Rodney Waldhoff</name>
+      <email>rwaldhoff at apache org</email>
+      <organization>Apache Software Foundation</organization>
+    </developer>
+    <developer>
+      <id>craigmcc</id>
+      <name>Craig McClanahan</name>
+      <email>craigmcc at apache org</email>
+      <organization>Apache Software Foundation</organization>
+    </developer>
+    <developer>
+      <id>sanders</id>
+      <name>Scott Sanders</name>
+      <email>sanders at apache dot org</email>
+      <organization>Apache Software Foundation</organization>
+    </developer>
+    <developer>
+      <id>rdonkin</id>
+      <name>Robert Burrell Donkin</name>
+      <email>rdonkin at apache dot org</email>
+      <organization>Apache Software Foundation</organization>
+    </developer>
+    <developer>
+      <id>donaldp</id>
+      <name>Peter Donald</name>
+      <email>donaldp at apache dot org</email>
+      <organization></organization>
+    </developer>
+    <developer>
+      <id>costin</id>
+      <name>Costin Manolache</name>
+      <email>costin at apache dot org</email>
+      <organization>Apache Software Foundation</organization>
+    </developer>
+    <developer>
+      <id>rsitze</id>
+      <name>Richard Sitze</name>
+      <email>rsitze at apache dot org</email>
+      <organization>Apache Software Foundation</organization>
+    </developer>
+    <developer>
+      <id>baliuka</id>
+      <name>Juozas Baliuka</name>
+      <email>baliuka@apache.org</email>
+      <organization></organization>
+      <roles>
+        <role>Java Developer</role>
+      </roles>
+    </developer>
+    <developer>
+      <id>skitching</id>
+      <name>Simon Kitching</name>
+      <email>skitching@apache.org</email>
+      <organization>Apache Software Foundation</organization>
+    </developer>
+    <developer>
+      <id>dennisl</id>
+      <name>Dennis Lundberg</name>
+      <email>dennisl@apache.org</email>
+      <organization>Apache Software Foundation</organization>
+    </developer>
+    <developer>
+      <id>bstansberry</id>
+      <name>Brian Stansberry</name>
+    </developer>
+  </developers>
+  <licenses>
+    <license>
+      <name>The Apache Software License, Version 2.0</name>
+      <url>/LICENSE.txt</url>
+    </license>
+  </licenses>
+  <scm>
+    <connection>scm:svn:http://svn.apache.org/repos/asf/jakarta/commons/proper/${pom.artifactId.substring(8)}/trunk</connection>
+    <url>http://svn.apache.org/repos/asf/jakarta/commons/proper/${pom.artifactId.substring(8)}/trunk</url>
+  </scm>
+  <organization>
+    <name>The Apache Software Foundation</name>
+    <url>http://jakarta.apache.org</url>
+  </organization>
+  <build>
+    <sourceDirectory>src/java</sourceDirectory>
+    <testSourceDirectory>src/test</testSourceDirectory>
+    <plugins>
+      <plugin>
+        <artifactId>maven-surefire-plugin</artifactId>
+        <configuration>
+          <includes>
+            <include>**/AvalonLoggerTest.java</include>
+          </includes>
+        </configuration>
+      </plugin>
+      <plugin>
+        <artifactId>maven-xdoc-plugin</artifactId>
+        <version>1.9.2</version>
+        <configuration>
+          <comment>&lt;strong>Site Only&lt;/strong> - v1.9.2 (minimum)</comment>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+  <dependencies>
+    <dependency>
+      <groupId>log4j</groupId>
+      <artifactId>log4j</artifactId>
+      <version>1.2.12</version>
+    </dependency>
+    <dependency>
+      <groupId>logkit</groupId>
+      <artifactId>logkit</artifactId>
+      <version>1.0.1</version>
+    </dependency>
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <version>3.8.1</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>avalon-framework</groupId>
+      <artifactId>avalon-framework</artifactId>
+      <version>4.1.3</version>
+    </dependency>
+    <dependency>
+      <groupId>javax.servlet</groupId>
+      <artifactId>servlet-api</artifactId>
+      <version>2.3</version>
+    </dependency>
+  </dependencies>
+  <distributionManagement>
+    <repository>
+      <id>default</id>
+      <name>Default Repository</name>
+      <url>file:///www/jakarta.apache.org/builds/jakarta-commons/${pom.artifactId.substring(8)}/</url>
+    </repository>
+    <site>
+      <id>default</id>
+      <name>Default Site</name>
+      <url>scp://cvs.apache.org//www/jakarta.apache.org/commons/${pom.artifactId.substring(8)}/</url>
+    </site>
+    <status>converted</status>
+  </distributionManagement>
+</project>
\ No newline at end of file
diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.1/commons-logging-1.1.pom.md5 b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.1/commons-logging-1.1.pom.md5
new file mode 100644 (file)
index 0000000..fc51c08
--- /dev/null
@@ -0,0 +1 @@
+219b31dbb491c609210577941a27a390  /home/csanchez/repository-staging/to-ibiblio/maven2/commons-logging/commons-logging/1.1/commons-logging-1.1.pom\r
diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.1/commons-logging-1.1.pom.sha1 b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.1/commons-logging-1.1.pom.sha1
new file mode 100644 (file)
index 0000000..0b450cc
--- /dev/null
@@ -0,0 +1 @@
+d80c5278c4f112aba0a6e987d7321676ce074a22  /home/csanchez/repository-staging/to-ibiblio/maven2/commons-logging/commons-logging/1.1/commons-logging-1.1.pom\r
diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.1/maven-metadata.xml b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.1/maven-metadata.xml
new file mode 100644 (file)
index 0000000..3a46a4f
--- /dev/null
@@ -0,0 +1,5 @@
+<metadata>
+  <groupId>commons-logging</groupId>
+  <artifactId>commons-logging</artifactId>
+  <version>1.1</version>
+</metadata>
\ No newline at end of file
diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.1/maven-metadata.xml.md5 b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.1/maven-metadata.xml.md5
new file mode 100644 (file)
index 0000000..ecf3cf5
--- /dev/null
@@ -0,0 +1 @@
+3da6bff52079500a1deb0b50b592f6cc  ./commons-logging/commons-logging/1.1/maven-metadata.xml\r
diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.1/maven-metadata.xml.sha1 b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/commons-logging/1.1/maven-metadata.xml.sha1
new file mode 100644 (file)
index 0000000..a16925e
--- /dev/null
@@ -0,0 +1 @@
+0672ee0df7fb5db281603d0fd9328086b8b1a912  /home/maven/repository-staging/to-ibiblio/maven2/commons-logging/commons-logging/1.1/maven-metadata.xml\r
diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/maven-metadata.xml b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/maven-metadata.xml
new file mode 100644 (file)
index 0000000..6f725ea
--- /dev/null
@@ -0,0 +1,15 @@
+<metadata>
+  <groupId>commons-logging</groupId>
+  <artifactId>commons-logging</artifactId>
+  <version>1.0</version>
+  <versioning>
+    <versions>
+      <version>1.0</version>
+      <version>1.0.1</version>
+      <version>1.0.2</version>
+      <version>1.0.3</version>
+      <version>1.0.4</version>
+      <version>1.1</version>
+    </versions>
+  </versioning>
+</metadata>
diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/maven-metadata.xml.md5 b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/maven-metadata.xml.md5
new file mode 100644 (file)
index 0000000..303079f
--- /dev/null
@@ -0,0 +1 @@
+57ae0a2f19db170eb6a012e255dfe329  /home/maven/repository-staging/to-ibiblio/maven2/commons-logging/commons-logging/maven-metadata.xml\r
diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/maven-metadata.xml.sha1 b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/commons-logging/maven-metadata.xml.sha1
new file mode 100644 (file)
index 0000000..0a2ec82
--- /dev/null
@@ -0,0 +1 @@
+fa606c3906d034dd7b98ebbf0a0655479a9dc956  /home/maven/repository-staging/to-ibiblio/maven2/commons-logging/commons-logging/maven-metadata.xml\r
diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/org/apache/felix/org.apache.felix.bundlerepository/1.6.6/org.apache.felix.bundlerepository-1.6.6.jar b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/org/apache/felix/org.apache.felix.bundlerepository/1.6.6/org.apache.felix.bundlerepository-1.6.6.jar
new file mode 100644 (file)
index 0000000..218330e
Binary files /dev/null and b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/org/apache/felix/org.apache.felix.bundlerepository/1.6.6/org.apache.felix.bundlerepository-1.6.6.jar differ
diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/org/apache/felix/org.apache.felix.bundlerepository/1.6.6/org.apache.felix.bundlerepository-1.6.6.pom b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/org/apache/felix/org.apache.felix.bundlerepository/1.6.6/org.apache.felix.bundlerepository-1.6.6.pom
new file mode 100644 (file)
index 0000000..19831ee
--- /dev/null
@@ -0,0 +1,138 @@
+<!--
+ 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.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+  <parent>
+    <groupId>org.apache.felix</groupId>
+    <artifactId>felix-parent</artifactId>
+    <version>2.1</version>
+    <relativePath>../pom/pom.xml</relativePath>
+  </parent>
+  <modelVersion>4.0.0</modelVersion>
+  <packaging>bundle</packaging>
+  <name>Apache Felix Bundle Repository</name>
+  <description>Bundle repository service.</description>
+  <artifactId>org.apache.felix.bundlerepository</artifactId>
+  <version>1.6.6</version>
+  <scm>
+    <connection>scm:svn:http://svn.apache.org/repos/asf/felix/releases/org.apache.felix.bundlerepository-1.6.6</connection>
+    <developerConnection>scm:svn:https://svn.apache.org/repos/asf/felix/releases/org.apache.felix.bundlerepository-1.6.6</developerConnection>
+    <url>http://svn.apache.org/repos/asf/felix/releases/org.apache.felix.bundlerepository-1.6.6</url>
+  </scm>
+  <dependencies>
+    <dependency>
+      <groupId>${project.groupId}</groupId>
+      <artifactId>org.apache.felix.utils</artifactId>
+      <version>1.1.0</version>
+      <optional>true</optional>
+    </dependency>
+    <dependency>
+      <groupId>${project.groupId}</groupId>
+      <artifactId>org.osgi.service.obr</artifactId>
+      <version>1.0.2</version>
+      <optional>true</optional>
+    </dependency>
+    <dependency>
+      <groupId>${project.groupId}</groupId>
+      <artifactId>org.apache.felix.shell</artifactId>
+      <version>1.4.1</version>
+      <optional>true</optional>
+    </dependency>
+    <dependency>
+      <groupId>net.sf.kxml</groupId>
+      <artifactId>kxml2</artifactId>
+      <version>2.3.0</version>
+      <optional>true</optional>
+      <exclusions>
+        <exclusion>
+          <groupId>xmlpull</groupId>
+          <artifactId>xmlpull</artifactId>
+        </exclusion>
+      </exclusions>
+    </dependency>
+    <dependency>
+        <groupId>org.osgi</groupId>
+        <artifactId>org.osgi.compendium</artifactId>
+        <version>4.0.0</version>
+        <optional>true</optional>
+    </dependency>
+    <dependency>
+       <groupId>org.osgi</groupId>
+        <artifactId>org.osgi.core</artifactId>
+        <version>4.1.0</version>
+    </dependency>
+    <dependency>
+        <groupId>org.codehaus.woodstox</groupId>
+        <artifactId>woodstox-core-asl</artifactId>
+        <version>4.0.7</version>
+        <optional>true</optional>
+    </dependency>
+    <dependency>
+        <groupId>org.easymock</groupId>
+        <artifactId>easymock</artifactId>
+        <version>2.4</version>
+    </dependency>
+  </dependencies>
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.felix</groupId>
+        <artifactId>maven-bundle-plugin</artifactId>
+        <version>2.3.4</version>
+        <extensions>true</extensions>
+        <configuration>
+          <instructions>
+            <Export-Package>org.apache.felix.bundlerepository;version="2.0"</Export-Package>
+            <Private-Package>
+                org.kxml2.io,
+                org.xmlpull.v1,
+                org.apache.felix.bundlerepository.impl.*,
+                org.apache.felix.utils.*
+            </Private-Package>
+            <Import-Package>!javax.xml.parsers,!org.xml.sax,org.osgi.service.log;resolution:=optional,org.osgi.service.obr;resolution:=optional,javax.xml.stream;resolution:=optional,*</Import-Package>
+            <DynamicImport-Package>org.apache.felix.shell</DynamicImport-Package>
+            <Bundle-Activator>${project.artifactId}.impl.Activator</Bundle-Activator>
+            <Bundle-DocURL>http://felix.apache.org/site/apache-felix-osgi-bundle-repository.html</Bundle-DocURL>
+            <Bundle-Url>http://felix.apache.org/site/downloads.cgi</Bundle-Url>
+            <Bundle-Source>http://felix.apache.org/site/downloads.cgi</Bundle-Source>
+            <Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
+            <Bundle-Vendor>The Apache Software Foundation</Bundle-Vendor>
+            <Export-Service>org.apache.felix.bundlerepository.RepositoryAdmin,org.osgi.service.obr.RepositoryAdmin</Export-Service>
+            <_versionpolicy>[$(version;==;$(@)),$(version;+;$(@)))</_versionpolicy>
+            <Include-Resource>META-INF/LICENSE=LICENSE,META-INF/LICENSE.kxml2=LICENSE.kxml2,META-INF/NOTICE=NOTICE,META-INF/DEPENDENCIES=DEPENDENCIES</Include-Resource>
+          </instructions>
+        </configuration>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.rat</groupId>
+        <artifactId>apache-rat-plugin</artifactId>
+        <configuration>
+          <excludeSubProjects>false</excludeSubProjects>
+          <useEclipseDefaultExcludes>true</useEclipseDefaultExcludes>
+          <useMavenDefaultExcludes>true</useMavenDefaultExcludes>
+          <excludes>
+            <param>doc/*</param>
+            <param>maven-eclipse.xml</param>
+            <param>.checkstyle</param>
+            <param>.externalToolBuilders/*</param>
+          </excludes>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+</project>
diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/org/apache/karaf/features/org.apache.karaf.features.command/2.2.2/org.apache.karaf.features.command-2.2.2.jar b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/org/apache/karaf/features/org.apache.karaf.features.command/2.2.2/org.apache.karaf.features.command-2.2.2.jar
new file mode 100644 (file)
index 0000000..e211324
Binary files /dev/null and b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/org/apache/karaf/features/org.apache.karaf.features.command/2.2.2/org.apache.karaf.features.command-2.2.2.jar differ
diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/org/apache/karaf/features/org.apache.karaf.features.command/2.2.2/org.apache.karaf.features.command-2.2.2.pom b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/org/apache/karaf/features/org.apache.karaf.features.command/2.2.2/org.apache.karaf.features.command-2.2.2.pom
new file mode 100644 (file)
index 0000000..67e206f
--- /dev/null
@@ -0,0 +1,5 @@
+#Generated by org.apache.felix.bundleplugin
+#Thu Jun 30 15:25:37 NDT 2011
+version=2.2.2
+groupId=org.apache.karaf.features
+artifactId=org.apache.karaf.features.command
diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/org/apache/karaf/features/org.apache.karaf.features.core/2.2.1/org.apache.karaf.features.core-2.2.1.jar b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/org/apache/karaf/features/org.apache.karaf.features.core/2.2.1/org.apache.karaf.features.core-2.2.1.jar
new file mode 100644 (file)
index 0000000..a6c5b35
Binary files /dev/null and b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/org/apache/karaf/features/org.apache.karaf.features.core/2.2.1/org.apache.karaf.features.core-2.2.1.jar differ
diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/org/apache/karaf/features/org.apache.karaf.features.core/2.2.1/org.apache.karaf.features.core-2.2.1.pom b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/org/apache/karaf/features/org.apache.karaf.features.core/2.2.1/org.apache.karaf.features.core-2.2.1.pom
new file mode 100644 (file)
index 0000000..6cd219e
--- /dev/null
@@ -0,0 +1,137 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+
+    <!--
+
+        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.
+    -->
+
+    <modelVersion>4.0.0</modelVersion>
+
+    <parent>
+        <groupId>org.apache.karaf.features</groupId>
+        <artifactId>features</artifactId>
+        <version>2.2.1</version>
+    </parent>
+
+    <artifactId>org.apache.karaf.features.core</artifactId>
+    <packaging>bundle</packaging>
+    <name>Apache Karaf :: Features :: Core</name>
+    <description>This bundle is the core implementation of the Karaf features support.</description>
+
+    <properties>
+        <appendedResourcesDirectory>${basedir}/../../etc/appended-resources</appendedResourcesDirectory>
+    </properties>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.osgi</groupId>
+            <artifactId>org.osgi.core</artifactId>
+            <scope>provided</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>org.osgi</groupId>
+            <artifactId>org.osgi.compendium</artifactId>
+            <scope>provided</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.felix</groupId>
+            <artifactId>org.apache.felix.utils</artifactId>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.felix</groupId>
+            <artifactId>org.apache.felix.bundlerepository</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.karaf.shell</groupId>
+            <artifactId>org.apache.karaf.shell.console</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.karaf.shell</groupId>
+            <artifactId>org.apache.karaf.shell.obr</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>org.springframework.osgi</groupId>
+            <artifactId>spring-osgi-core</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.servicemix.bundles</groupId>
+            <artifactId>org.apache.servicemix.bundles.junit</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.easymock</groupId>
+            <artifactId>easymock</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-jdk14</artifactId>
+            <scope>test</scope>
+        </dependency>
+    </dependencies>
+
+    <build>
+        <resources>
+            <resource>
+                <directory>${project.basedir}/src/main/resources</directory>
+                <includes>
+                    <include>**/*</include>
+                </includes>
+            </resource>
+            <resource>
+                <directory>${project.basedir}/src/main/resources</directory>
+                <filtering>true</filtering>
+                <includes>
+                    <include>**/*.info</include>
+                </includes>
+            </resource>
+        </resources>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-bundle-plugin</artifactId>
+                <configuration>
+                    <instructions>
+                        <Export-Package>org.apache.karaf.features;version=${project.version}</Export-Package>
+                        <Import-Package>
+                            !org.apache.karaf.features,
+                            javax.management,
+                            javax.management.loading,
+                            org.apache.felix.service.command,
+                            org.apache.felix.gogo.commands,
+                            org.apache.karaf.shell.console,
+                            org.osgi.service.event*;resolution:=optional,
+                            *
+                        </Import-Package>
+                        <Private-Package>
+                            org.apache.karaf.features.internal,
+                            org.apache.felix.utils.version,
+                            org.apache.felix.utils.manifest
+                        </Private-Package>
+                    </instructions>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+</project>
diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/org/apache/karaf/features/org.apache.karaf.features.core/2.2.2/org.apache.karaf.features.core-2.2.2.jar b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/org/apache/karaf/features/org.apache.karaf.features.core/2.2.2/org.apache.karaf.features.core-2.2.2.jar
new file mode 100644 (file)
index 0000000..0e6bb50
Binary files /dev/null and b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/org/apache/karaf/features/org.apache.karaf.features.core/2.2.2/org.apache.karaf.features.core-2.2.2.jar differ
diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/org/apache/karaf/features/org.apache.karaf.features.core/2.2.2/org.apache.karaf.features.core-2.2.2.pom b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-osgi/org/apache/karaf/features/org.apache.karaf.features.core/2.2.2/org.apache.karaf.features.core-2.2.2.pom
new file mode 100644 (file)
index 0000000..e5782e9
--- /dev/null
@@ -0,0 +1,137 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+
+    <!--
+
+        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.
+    -->
+
+    <modelVersion>4.0.0</modelVersion>
+
+    <parent>
+        <groupId>org.apache.karaf.features</groupId>
+        <artifactId>features</artifactId>
+        <version>2.2.2</version>
+    </parent>
+
+    <artifactId>org.apache.karaf.features.core</artifactId>
+    <packaging>bundle</packaging>
+    <name>Apache Karaf :: Features :: Core</name>
+    <description>This bundle is the core implementation of the Karaf features support.</description>
+
+    <properties>
+        <appendedResourcesDirectory>${basedir}/../../etc/appended-resources</appendedResourcesDirectory>
+    </properties>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.osgi</groupId>
+            <artifactId>org.osgi.core</artifactId>
+            <scope>provided</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>org.osgi</groupId>
+            <artifactId>org.osgi.compendium</artifactId>
+            <scope>provided</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.felix</groupId>
+            <artifactId>org.apache.felix.utils</artifactId>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.felix</groupId>
+            <artifactId>org.apache.felix.bundlerepository</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.karaf.shell</groupId>
+            <artifactId>org.apache.karaf.shell.console</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.karaf.shell</groupId>
+            <artifactId>org.apache.karaf.shell.obr</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>org.springframework.osgi</groupId>
+            <artifactId>spring-osgi-core</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.servicemix.bundles</groupId>
+            <artifactId>org.apache.servicemix.bundles.junit</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.easymock</groupId>
+            <artifactId>easymock</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-jdk14</artifactId>
+            <scope>test</scope>
+        </dependency>
+    </dependencies>
+
+    <build>
+        <resources>
+            <resource>
+                <directory>${project.basedir}/src/main/resources</directory>
+                <includes>
+                    <include>**/*</include>
+                </includes>
+            </resource>
+            <resource>
+                <directory>${project.basedir}/src/main/resources</directory>
+                <filtering>true</filtering>
+                <includes>
+                    <include>**/*.info</include>
+                </includes>
+            </resource>
+        </resources>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-bundle-plugin</artifactId>
+                <configuration>
+                    <instructions>
+                        <Export-Package>org.apache.karaf.features;version=${project.version}</Export-Package>
+                        <Import-Package>
+                            !org.apache.karaf.features,
+                            javax.management,
+                            javax.management.loading,
+                            org.apache.felix.service.command,
+                            org.apache.felix.gogo.commands,
+                            org.apache.karaf.shell.console,
+                            org.osgi.service.event*;resolution:=optional,
+                            *
+                        </Import-Package>
+                        <Private-Package>
+                            org.apache.karaf.features.internal,
+                            org.apache.felix.utils.version,
+                            org.apache.felix.utils.manifest
+                        </Private-Package>
+                    </instructions>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+</project>
index 4108e25f77982385632f370bb4980ddd9377ec2b..40ed834f37c6ef41e91800557ed6eeaee3d96005 100644 (file)
       <artifactId>archiva-plexus-bridge</artifactId>
     </dependency>
 
+    <dependency>
+      <groupId>org.apache.archiva</groupId>
+      <artifactId>archiva-repository-admin-api</artifactId>
+    </dependency>
+
+
+    <dependency>
+      <groupId>org.apache.archiva</groupId>
+      <artifactId>archiva-repository-admin-default</artifactId>
+    </dependency>
+
     <dependency>
       <groupId>org.apache.archiva</groupId>
       <artifactId>metadata-repository-api</artifactId>
index bc8e863fce5225d0b83f2d3618b1085b7e39e30b..72d064744b217bb6108f6d06fe4ff240fffb6904 100644 (file)
@@ -19,7 +19,7 @@ package org.apache.archiva.web.tags;
  * under the License.
  */
 
-import org.apache.archiva.admin.repository.managed.ManagedRepository;
+import org.apache.archiva.admin.model.managed.ManagedRepository;
 import org.apache.archiva.web.util.ContextUtils;
 import org.apache.commons.lang.StringEscapeUtils;
 import org.slf4j.Logger;
index 78c5f851d57e9edecfa6b6e6496532178c0d5af9..001b67b597c32a8edac72c0a445e6eb46fc709ab 100644 (file)
@@ -21,13 +21,13 @@ package org.apache.maven.archiva.web.action;
 \r
 import com.opensymphony.xwork2.ActionContext;\r
 import com.opensymphony.xwork2.ActionSupport;\r
-import org.apache.archiva.admin.AuditInformation;\r
+import org.apache.archiva.admin.model.AuditInformation;\r
 import org.apache.archiva.audit.AuditEvent;\r
 import org.apache.archiva.audit.AuditListener;\r
 import org.apache.archiva.audit.Auditable;\r
 import org.apache.archiva.metadata.repository.RepositorySessionFactory;\r
-import org.apache.commons.lang.StringUtils;\r
 import org.apache.archiva.security.ArchivaXworkUser;\r
+import org.apache.commons.lang.StringUtils;\r
 import org.apache.struts2.ServletActionContext;\r
 import org.apache.struts2.interceptor.SessionAware;\r
 import org.codehaus.plexus.redback.users.User;\r
index f9a65f572378cf6bdb1ab4211a933f73175f4c0d..837563bf5cbbabb10074688cd0a51d87afdce6c8 100644 (file)
@@ -59,12 +59,11 @@ public class SearchAction
     /**
      * Query string.
      */
+    private String q;
 
     // FIXME olamy WTF here??
     private ArchivaConfiguration archivaConfiguration;
 
-    private String q;
-
     /**
      * The Search Results.
      */
index c3feab958a9b1328b3ed4a6dddf4bec1a97d895b..9c4cbeee593326945670e5e29f7aed8e4fc7de53 100644 (file)
@@ -20,8 +20,8 @@ package org.apache.maven.archiva.web.action.admin.appearance;
  */
 
 import com.opensymphony.xwork2.Preparable;
-import org.apache.archiva.admin.repository.admin.ArchivaAdministration;
-import org.apache.archiva.admin.repository.admin.OrganisationInformation;
+import org.apache.archiva.admin.model.admin.ArchivaAdministration;
+import org.apache.archiva.admin.model.admin.OrganisationInformation;
 import org.apache.maven.archiva.web.action.AbstractActionSupport;
 
 import javax.inject.Inject;
index 647cae7aea5c8896126d7bf4bd635714cfece2be..27276a8a384acd29caa98f4c69aad0e91dcbed15 100644 (file)
@@ -20,8 +20,8 @@ package org.apache.maven.archiva.web.action.admin.appearance;
  */
 
 import com.opensymphony.xwork2.Validateable;
-import org.apache.archiva.admin.repository.RepositoryAdminException;
-import org.apache.archiva.admin.repository.admin.OrganisationInformation;
+import org.apache.archiva.admin.model.RepositoryAdminException;
+import org.apache.archiva.admin.model.admin.OrganisationInformation;
 import org.apache.archiva.security.common.ArchivaRoleConstants;
 import org.apache.commons.lang.StringUtils;
 import org.codehaus.plexus.redback.rbac.Resource;
index 45ea7092889793a141f9ea19ee907b60918e6955..a89bc1db9649039b7b653da67a27d61132600d10 100644 (file)
@@ -19,11 +19,11 @@ package org.apache.maven.archiva.web.action.admin.connectors.proxy;
  * under the License.
  */
 
-import org.apache.archiva.admin.repository.RepositoryAdminException;
-import org.apache.archiva.admin.repository.managed.ManagedRepositoryAdmin;
-import org.apache.archiva.admin.repository.proxyconnector.ProxyConnector;
-import org.apache.archiva.admin.repository.proxyconnector.ProxyConnectorAdmin;
-import org.apache.archiva.admin.repository.remote.RemoteRepositoryAdmin;
+import org.apache.archiva.admin.model.RepositoryAdminException;
+import org.apache.archiva.admin.model.managed.ManagedRepositoryAdmin;
+import org.apache.archiva.admin.model.proxyconnector.ProxyConnector;
+import org.apache.archiva.admin.model.proxyconnector.ProxyConnectorAdmin;
+import org.apache.archiva.admin.model.remote.RemoteRepositoryAdmin;
 import org.apache.archiva.security.common.ArchivaRoleConstants;
 import org.apache.commons.lang.StringUtils;
 import org.apache.maven.archiva.web.action.AbstractActionSupport;
index 6f92a879b13ded5b87c8f99c0da648d5cd77c18c..ad3d832bee24f14b4060e138eedec8316a39d284 100644 (file)
@@ -20,8 +20,8 @@ package org.apache.maven.archiva.web.action.admin.connectors.proxy;
  */
 
 import com.opensymphony.xwork2.Preparable;
-import org.apache.archiva.admin.repository.RepositoryAdminException;
-import org.apache.archiva.admin.repository.proxyconnector.ProxyConnector;
+import org.apache.archiva.admin.model.RepositoryAdminException;
+import org.apache.archiva.admin.model.proxyconnector.ProxyConnector;
 import org.apache.commons.lang.StringUtils;
 import org.apache.maven.archiva.configuration.ArchivaConfiguration;
 import org.apache.maven.archiva.policies.DownloadErrorPolicy;
index 40455de430333372ce92cc18a786e763cfd5b194..dc32b9cdff367091064deddf33ada5e0ab467ba5 100644 (file)
@@ -19,8 +19,8 @@ package org.apache.maven.archiva.web.action.admin.connectors.proxy;
  * under the License.
  */
 
-import org.apache.archiva.admin.repository.RepositoryAdminException;
-import org.apache.archiva.admin.repository.proxyconnector.ProxyConnector;
+import org.apache.archiva.admin.model.RepositoryAdminException;
+import org.apache.archiva.admin.model.proxyconnector.ProxyConnector;
 import org.apache.commons.lang.StringUtils;
 import org.springframework.context.annotation.Scope;
 import org.springframework.stereotype.Controller;
index 589892ebcf898b960947ca62c39e3d2e49ab29d7..933ff043162eb669dfe8545427fff313e5acdbe7 100644 (file)
@@ -19,8 +19,8 @@ package org.apache.maven.archiva.web.action.admin.connectors.proxy;
  * under the License.
  */
 
-import org.apache.archiva.admin.repository.RepositoryAdminException;
-import org.apache.archiva.admin.repository.proxyconnector.ProxyConnector;
+import org.apache.archiva.admin.model.RepositoryAdminException;
+import org.apache.archiva.admin.model.proxyconnector.ProxyConnector;
 import org.springframework.context.annotation.Scope;
 import org.springframework.stereotype.Controller;
 
index d8c214ca555420906fb19a229e08b9c9d6b7a84f..b719f0b1c3c01b0a2235b8ae87550f3854d51abd 100644 (file)
@@ -1,7 +1,7 @@
 package org.apache.maven.archiva.web.action.admin.connectors.proxy;
 
-import org.apache.archiva.admin.repository.RepositoryAdminException;
-import org.apache.archiva.admin.repository.proxyconnector.ProxyConnector;
+import org.apache.archiva.admin.model.RepositoryAdminException;
+import org.apache.archiva.admin.model.proxyconnector.ProxyConnector;
 import org.springframework.context.annotation.Scope;
 import org.springframework.stereotype.Controller;
 
index 21f572520c980d241d98b4af30d36aa3f21d1db2..3df4904be86003a5289e1255360535237fcecf88 100644 (file)
@@ -19,8 +19,8 @@ package org.apache.maven.archiva.web.action.admin.connectors.proxy;
  * under the License.
  */
 
-import org.apache.archiva.admin.repository.RepositoryAdminException;
-import org.apache.archiva.admin.repository.proxyconnector.ProxyConnector;
+import org.apache.archiva.admin.model.RepositoryAdminException;
+import org.apache.archiva.admin.model.proxyconnector.ProxyConnector;
 import org.springframework.context.annotation.Scope;
 import org.springframework.stereotype.Controller;
 
index c06597a3f2ba4cc7fdaaeb7a836ace1fcb57fbf5..8d17d8d489cd66da53fd4be8873d38855b37092b 100644 (file)
@@ -1,7 +1,7 @@
 package org.apache.maven.archiva.web.action.admin.connectors.proxy;
 
-import org.apache.archiva.admin.repository.RepositoryAdminException;
-import org.apache.archiva.admin.repository.proxyconnector.ProxyConnector;
+import org.apache.archiva.admin.model.RepositoryAdminException;
+import org.apache.archiva.admin.model.proxyconnector.ProxyConnector;
 import org.springframework.context.annotation.Scope;
 import org.springframework.stereotype.Controller;
 
index 90c98ee633be4e3543c23d776e9941a649579e1e..50b8048d3be30a26aceb64a1dc373934df7af08c 100644 (file)
@@ -20,9 +20,9 @@ package org.apache.maven.archiva.web.action.admin.connectors.proxy;
  */
 
 import com.opensymphony.xwork2.Preparable;
-import org.apache.archiva.admin.repository.AbstractRepository;
-import org.apache.archiva.admin.repository.RepositoryAdminException;
-import org.apache.archiva.admin.repository.proxyconnector.ProxyConnector;
+import org.apache.archiva.admin.model.AbstractRepository;
+import org.apache.archiva.admin.model.RepositoryAdminException;
+import org.apache.archiva.admin.model.proxyconnector.ProxyConnector;
 import org.springframework.context.annotation.Scope;
 import org.springframework.stereotype.Controller;
 
index d37894cb597b6e56e0bf18258ee8fda968a5255a..5ae02c838223ef8997801853fca4557fa1711e9b 100644 (file)
@@ -19,8 +19,8 @@ package org.apache.maven.archiva.web.action.admin.connectors.proxy;
  * under the License.
  */
 
-import org.apache.archiva.admin.repository.RepositoryAdminException;
-import org.apache.archiva.admin.repository.proxyconnector.ProxyConnector;
+import org.apache.archiva.admin.model.RepositoryAdminException;
+import org.apache.archiva.admin.model.proxyconnector.ProxyConnector;
 import org.apache.commons.lang.StringUtils;
 import org.springframework.context.annotation.Scope;
 import org.springframework.stereotype.Controller;
index 5986630c430c89011d188952258047a125a02a02..cdffc3b6b8abcf8c5c6ef34b9b033c4fd9d9d3fb 100644 (file)
@@ -21,9 +21,9 @@ package org.apache.maven.archiva.web.action.admin.legacy;
 
 import com.opensymphony.xwork2.Preparable;
 import com.opensymphony.xwork2.Validateable;
-import org.apache.archiva.admin.repository.RepositoryAdminException;
-import org.apache.archiva.admin.repository.admin.ArchivaAdministration;
-import org.apache.archiva.admin.repository.admin.LegacyArtifactPath;
+import org.apache.archiva.admin.model.RepositoryAdminException;
+import org.apache.archiva.admin.model.admin.ArchivaAdministration;
+import org.apache.archiva.admin.model.admin.LegacyArtifactPath;
 import org.apache.commons.lang.StringUtils;
 import org.apache.maven.archiva.model.ArtifactReference;
 import org.apache.maven.archiva.repository.ManagedRepositoryContent;
index 220d7b145b797d04c535a6d60e368c0100ce922e..79f4abc638cfeaf46f248b86e1b9bc2d7782e5dd 100644 (file)
@@ -19,8 +19,8 @@ package org.apache.maven.archiva.web.action.admin.legacy;
  * under the License.\r
  */\r
 \r
-import org.apache.archiva.admin.repository.RepositoryAdminException;\r
-import org.apache.archiva.admin.repository.admin.ArchivaAdministration;\r
+import org.apache.archiva.admin.model.RepositoryAdminException;\r
+import org.apache.archiva.admin.model.admin.ArchivaAdministration;\r
 import org.apache.maven.archiva.web.action.AbstractActionSupport;\r
 import org.springframework.context.annotation.Scope;\r
 import org.springframework.stereotype.Controller;\r
index 1aadd0a6b339492b6e860fc8c994fd0b2c1ed701..d4a4cdcb9ff9274de521da72a7fbba2f28da24d4 100644 (file)
@@ -20,9 +20,9 @@ package org.apache.maven.archiva.web.action.admin.legacy;
  */\r
 \r
 import com.opensymphony.xwork2.Preparable;\r
-import org.apache.archiva.admin.repository.RepositoryAdminException;\r
-import org.apache.archiva.admin.repository.admin.ArchivaAdministration;\r
-import org.apache.archiva.admin.repository.admin.LegacyArtifactPath;\r
+import org.apache.archiva.admin.model.RepositoryAdminException;\r
+import org.apache.archiva.admin.model.admin.ArchivaAdministration;\r
+import org.apache.archiva.admin.model.admin.LegacyArtifactPath;\r
 import org.apache.archiva.security.common.ArchivaRoleConstants;\r
 import org.apache.archiva.web.util.ContextUtils;\r
 import org.apache.maven.archiva.web.action.AbstractActionSupport;\r
index 9779a3c7d6571642bb6a505a18b7599954bd2880..8a6ad4be3e76dc2c4f2b11d0360897e7c2c41dde 100644 (file)
@@ -21,9 +21,9 @@ package org.apache.maven.archiva.web.action.admin.networkproxies;
 
 import com.opensymphony.xwork2.Preparable;
 import com.opensymphony.xwork2.Validateable;
-import org.apache.archiva.admin.repository.RepositoryAdminException;
-import org.apache.archiva.admin.repository.networkproxy.NetworkProxy;
-import org.apache.archiva.admin.repository.networkproxy.NetworkProxyAdmin;
+import org.apache.archiva.admin.model.RepositoryAdminException;
+import org.apache.archiva.admin.model.networkproxy.NetworkProxy;
+import org.apache.archiva.admin.model.networkproxy.NetworkProxyAdmin;
 import org.apache.archiva.security.common.ArchivaRoleConstants;
 import org.apache.commons.lang.StringUtils;
 import org.apache.maven.archiva.web.action.AbstractActionSupport;
index 1d73e032ee809dddc9994752e91e43562e9306b5..4a8365adc1506fcc49ef576eba53714bc991bdd2 100644 (file)
@@ -20,8 +20,8 @@ package org.apache.maven.archiva.web.action.admin.networkproxies;
  */
 
 import com.opensymphony.xwork2.Preparable;
-import org.apache.archiva.admin.repository.networkproxy.NetworkProxy;
-import org.apache.archiva.admin.repository.networkproxy.NetworkProxyAdmin;
+import org.apache.archiva.admin.model.networkproxy.NetworkProxy;
+import org.apache.archiva.admin.model.networkproxy.NetworkProxyAdmin;
 import org.apache.archiva.security.common.ArchivaRoleConstants;
 import org.apache.maven.archiva.web.action.AbstractActionSupport;
 import org.codehaus.plexus.redback.rbac.Resource;
index 5f8ffeab440f46d61b46a3ad39cd22c8db927cc7..e2bc9f43bde02d6346bf8ce3a4e0191b3e9a6ac5 100644 (file)
@@ -19,8 +19,8 @@ package org.apache.maven.archiva.web.action.admin.repositories;
  * under the License.
  */
 
+import org.apache.archiva.admin.model.managed.ManagedRepositoryAdmin;
 import org.apache.archiva.admin.repository.RepositoryCommonValidator;
-import org.apache.archiva.admin.repository.managed.ManagedRepositoryAdmin;
 import org.apache.archiva.audit.Auditable;
 import org.apache.archiva.security.common.ArchivaRoleConstants;
 import org.apache.maven.archiva.configuration.ArchivaConfiguration;
index 118cd45d42e1d85c23b5a35764e071360cc4e766..24e9714f032bad8f4025d7a1348c2b7da64d2cbc 100644 (file)
@@ -21,8 +21,8 @@ package org.apache.maven.archiva.web.action.admin.repositories;
 
 import com.opensymphony.xwork2.Preparable;
 import com.opensymphony.xwork2.Validateable;
-import org.apache.archiva.admin.repository.RepositoryAdminException;
-import org.apache.archiva.admin.repository.managed.ManagedRepository;
+import org.apache.archiva.admin.model.RepositoryAdminException;
+import org.apache.archiva.admin.model.managed.ManagedRepository;
 import org.apache.commons.lang.StringUtils;
 import org.apache.maven.archiva.configuration.Configuration;
 import org.codehaus.redback.components.scheduler.CronExpressionValidator;
index 606332674a8f677cb22b67db941f0dcfa965c8ad..4261dc02886989f799d66c257a700f2dc46de968 100644 (file)
@@ -21,8 +21,8 @@ package org.apache.maven.archiva.web.action.admin.repositories;
 
 import com.opensymphony.xwork2.Preparable;
 import com.opensymphony.xwork2.Validateable;
-import org.apache.archiva.admin.repository.RepositoryAdminException;
-import org.apache.archiva.admin.repository.remote.RemoteRepository;
+import org.apache.archiva.admin.model.RepositoryAdminException;
+import org.apache.archiva.admin.model.remote.RemoteRepository;
 import org.apache.maven.archiva.configuration.Configuration;
 import org.springframework.context.annotation.Scope;
 import org.springframework.stereotype.Controller;
index 9aee5081cec7adf974273ffa3f5ab4d4f713d1b9..9b2113afb691cee9549cb1157e736043c52ea0b3 100644 (file)
@@ -20,7 +20,8 @@ package org.apache.maven.archiva.web.action.admin.repositories;
  */
 
 import com.opensymphony.xwork2.Preparable;
-import org.apache.archiva.admin.repository.RepositoryAdminException;
+import org.apache.archiva.admin.model.RepositoryAdminException;
+import org.apache.archiva.admin.model.managed.ManagedRepository;
 import org.apache.commons.lang.StringUtils;
 import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
 import org.springframework.context.annotation.Scope;
@@ -39,20 +40,19 @@ public class DeleteManagedRepositoryAction
 {
 
 
-    private ManagedRepositoryConfiguration repository;
+    private ManagedRepository repository;
 
-    private ManagedRepositoryConfiguration stagingRepository;
+    private ManagedRepository stagingRepository;
 
     private String repoid;
 
-    // FIXME olamy use ManagedRepositoryAdmin rather tha, directly archivaConfiguration
     public void prepare()
+        throws RepositoryAdminException
     {
         if ( StringUtils.isNotBlank( repoid ) )
         {
-            this.repository = archivaConfiguration.getConfiguration().findManagedRepositoryById( repoid );
-            this.stagingRepository =
-                archivaConfiguration.getConfiguration().findManagedRepositoryById( repoid + "-stage" );
+            this.repository = getManagedRepositoryAdmin().getManagedRepository( repoid );
+            this.stagingRepository = getManagedRepositoryAdmin().getManagedRepository( repoid + "-stage" );
         }
     }
 
@@ -79,7 +79,7 @@ public class DeleteManagedRepositoryAction
 
     private String deleteRepository( boolean deleteContents )
     {
-        ManagedRepositoryConfiguration existingRepository = repository;
+        ManagedRepository existingRepository = repository;
         if ( existingRepository == null )
         {
             addActionError( "A repository with that id does not exist" );
@@ -103,12 +103,12 @@ public class DeleteManagedRepositoryAction
         return result;
     }
 
-    public ManagedRepositoryConfiguration getRepository()
+    public ManagedRepository getRepository()
     {
         return repository;
     }
 
-    public void setRepository( ManagedRepositoryConfiguration repository )
+    public void setRepository( ManagedRepository repository )
     {
         this.repository = repository;
     }
index a994bd5a8b9dcdf5c6813962d6234f2243f2a214..eafe8181a78e04a7a153a0b94476c7f4d66b6753 100644 (file)
@@ -20,8 +20,8 @@ package org.apache.maven.archiva.web.action.admin.repositories;
  */
 
 import com.opensymphony.xwork2.Preparable;
-import org.apache.archiva.admin.repository.RepositoryAdminException;
-import org.apache.archiva.admin.repository.remote.RemoteRepository;
+import org.apache.archiva.admin.model.RepositoryAdminException;
+import org.apache.archiva.admin.model.remote.RemoteRepository;
 import org.apache.commons.lang.StringUtils;
 import org.springframework.context.annotation.Scope;
 import org.springframework.stereotype.Controller;
index 541b77830a642e31508ca6365d2c95ec84bca939..4f2f7c78abe41e014a7d065a9fb371c535463a96 100644 (file)
@@ -20,16 +20,18 @@ package org.apache.maven.archiva.web.action.admin.repositories;
  */
 
 import com.opensymphony.xwork2.Preparable;
-import org.apache.archiva.audit.AuditEvent;
+import org.apache.archiva.admin.model.RepositoryAdminException;
+import org.apache.archiva.admin.model.group.RepositoryGroup;
+import org.apache.archiva.admin.model.group.RepositoryGroupAdmin;
 import org.apache.commons.lang.StringUtils;
-import org.apache.maven.archiva.configuration.Configuration;
 import org.apache.maven.archiva.configuration.RepositoryGroupConfiguration;
 import org.springframework.context.annotation.Scope;
 import org.springframework.stereotype.Controller;
 
+import javax.inject.Inject;
+
 /**
  * DeleteRepositoryGroupAction
- *
  */
 @Controller( "deleteRepositoryGroupAction" )
 @Scope( "prototype" )
@@ -37,15 +39,20 @@ public class DeleteRepositoryGroupAction
     extends AbstractRepositoriesAdminAction
     implements Preparable
 {
-    private RepositoryGroupConfiguration repositoryGroup;
+    private RepositoryGroup repositoryGroup;
+
+    @Inject
+    private RepositoryGroupAdmin repositoryGroupAdmin;
 
     private String repoGroupId;
 
     public void prepare()
+        throws RepositoryAdminException
     {
+
         if ( StringUtils.isNotBlank( repoGroupId ) )
         {
-            this.repositoryGroup = archivaConfiguration.getConfiguration().findRepositoryGroupById( repoGroupId );
+            this.repositoryGroup = repositoryGroupAdmin.getRepositoryGroup( repoGroupId );
         }
     }
 
@@ -62,26 +69,32 @@ public class DeleteRepositoryGroupAction
 
     public String delete()
     {
-        Configuration config = archivaConfiguration.getConfiguration();
 
-        RepositoryGroupConfiguration group = config.findRepositoryGroupById( repoGroupId );
-        if ( group == null )
+        try
         {
-            addActionError( "A repository group with that id does not exist." );
+            RepositoryGroup group = repositoryGroupAdmin.getRepositoryGroup( repoGroupId );
+            if ( group == null )
+            {
+                addActionError( "A repository group with that id does not exist." );
+                return ERROR;
+            }
+
+            repositoryGroupAdmin.deleteRepositoryGroup( repoGroupId, getAuditInformation() );
+            return SUCCESS;
+        }
+        catch ( RepositoryAdminException e )
+        {
+            addActionError( "error occured " + e.getMessage() );
             return ERROR;
         }
-
-        config.removeRepositoryGroup( group );
-        triggerAuditEvent( AuditEvent.DELETE_REPO_GROUP + " " + repoGroupId );
-        return saveConfiguration( config );
     }
 
-    public RepositoryGroupConfiguration getRepositoryGroup()
+    public RepositoryGroup getRepositoryGroup()
     {
         return repositoryGroup;
     }
 
-    public void setRepositoryGroup( RepositoryGroupConfiguration repositoryGroup )
+    public void setRepositoryGroup( RepositoryGroup repositoryGroup )
     {
         this.repositoryGroup = repositoryGroup;
     }
index a692d3f636f590677b37e54ae7a1efd369881ed1..14732f956cf9bcbdbbfa28dc666986054ca57179 100644 (file)
@@ -21,8 +21,8 @@ package org.apache.maven.archiva.web.action.admin.repositories;
 
 import com.opensymphony.xwork2.Preparable;
 import com.opensymphony.xwork2.Validateable;
-import org.apache.archiva.admin.repository.RepositoryAdminException;
-import org.apache.archiva.admin.repository.managed.ManagedRepository;
+import org.apache.archiva.admin.model.RepositoryAdminException;
+import org.apache.archiva.admin.model.managed.ManagedRepository;
 import org.apache.commons.lang.StringUtils;
 import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
 import org.codehaus.redback.components.scheduler.CronExpressionValidator;
index 7e9cf00ac679e618e09aec059c7ae8d0236afb67..49b8cfd12acee2ee1deb4e211dd43b0b4df40494 100644 (file)
@@ -20,8 +20,8 @@ package org.apache.maven.archiva.web.action.admin.repositories;
  */
 
 import com.opensymphony.xwork2.Preparable;
-import org.apache.archiva.admin.repository.RepositoryAdminException;
-import org.apache.archiva.admin.repository.remote.RemoteRepository;
+import org.apache.archiva.admin.model.RepositoryAdminException;
+import org.apache.archiva.admin.model.remote.RemoteRepository;
 import org.apache.commons.lang.StringUtils;
 import org.springframework.context.annotation.Scope;
 import org.springframework.stereotype.Controller;
index d0bc90f221bc7c574c0436dcbedbc2d6586f4340..a8af45def177f8f0b48714365238b885b9222577 100644 (file)
@@ -20,12 +20,12 @@ package org.apache.maven.archiva.web.action.admin.repositories;
  */
 
 import com.opensymphony.xwork2.Preparable;
-import org.apache.archiva.admin.repository.RepositoryAdminException;
-import org.apache.archiva.admin.repository.group.RepositoryGroupAdmin;
-import org.apache.archiva.admin.repository.managed.ManagedRepository;
-import org.apache.archiva.admin.repository.managed.ManagedRepositoryAdmin;
-import org.apache.archiva.admin.repository.remote.RemoteRepository;
-import org.apache.archiva.admin.repository.remote.RemoteRepositoryAdmin;
+import org.apache.archiva.admin.model.RepositoryAdminException;
+import org.apache.archiva.admin.model.group.RepositoryGroupAdmin;
+import org.apache.archiva.admin.model.managed.ManagedRepository;
+import org.apache.archiva.admin.model.managed.ManagedRepositoryAdmin;
+import org.apache.archiva.admin.model.remote.RemoteRepository;
+import org.apache.archiva.admin.model.remote.RemoteRepositoryAdmin;
 import org.apache.archiva.admin.repository.utils.RepositoryComparator;
 import org.apache.archiva.metadata.repository.MetadataRepository;
 import org.apache.archiva.metadata.repository.MetadataRepositoryException;
@@ -35,7 +35,6 @@ import org.apache.archiva.metadata.repository.stats.RepositoryStatisticsManager;
 import org.apache.archiva.security.common.ArchivaRoleConstants;
 import org.apache.archiva.web.util.ContextUtils;
 import org.apache.maven.archiva.configuration.ArchivaConfiguration;
-import org.apache.maven.archiva.configuration.Configuration;
 import org.apache.maven.archiva.web.action.AbstractActionSupport;
 import org.apache.struts2.interceptor.ServletRequestAware;
 import org.codehaus.plexus.redback.rbac.Resource;
@@ -65,9 +64,6 @@ public class RepositoriesAction
     implements SecureAction, ServletRequestAware, Preparable
 {
 
-    @Inject
-    private ArchivaConfiguration archivaConfiguration;
-
     @Inject
     private ManagedRepositoryAdmin managedRepositoryAdmin;
 
index 463ac6e8c343cb0293577bf57949ac055e237d59..b92d8fb5217e529738ee4160798393278be634f7 100644 (file)
@@ -20,10 +20,10 @@ package org.apache.maven.archiva.web.action.admin.repositories;
  */
 
 import com.opensymphony.xwork2.Preparable;
-import org.apache.archiva.admin.repository.RepositoryAdminException;
-import org.apache.archiva.admin.repository.group.RepositoryGroup;
-import org.apache.archiva.admin.repository.group.RepositoryGroupAdmin;
-import org.apache.archiva.admin.repository.managed.ManagedRepository;
+import org.apache.archiva.admin.model.RepositoryAdminException;
+import org.apache.archiva.admin.model.group.RepositoryGroup;
+import org.apache.archiva.admin.model.group.RepositoryGroupAdmin;
+import org.apache.archiva.admin.model.managed.ManagedRepository;
 import org.apache.archiva.web.util.ContextUtils;
 import org.apache.struts2.interceptor.ServletRequestAware;
 import org.springframework.context.annotation.Scope;
index 9139a9e356bedfc231d6e07bc20f5661cd8ae192..1b15394d6a6c9c6adeb548820d79f94084c10450 100644 (file)
@@ -29,13 +29,14 @@ import java.util.List;
 
 /**
  * SortRepositoriesAction
- *
+ * FIXME remove access to archivaconfiguration
  */
 @Controller( "sortRepositoriesAction" )
 @Scope( "prototype" )
 public class SortRepositoriesAction
     extends AbstractRepositoriesAdminAction
 {
+
     private String repoGroupId;
 
     private String targetRepo;
index c61810965b50e0e6f75049eb9b6459bffa82901f..489ee3f5f3376ee65d45b35bb6330d18e5f9ebf0 100644 (file)
@@ -21,9 +21,9 @@ package org.apache.maven.archiva.web.action.admin.scanning;
 
 import com.opensymphony.xwork2.Preparable;
 import com.opensymphony.xwork2.Validateable;
-import org.apache.archiva.admin.repository.RepositoryAdminException;
-import org.apache.archiva.admin.repository.admin.ArchivaAdministration;
-import org.apache.archiva.admin.repository.admin.FileType;
+import org.apache.archiva.admin.model.RepositoryAdminException;
+import org.apache.archiva.admin.model.admin.ArchivaAdministration;
+import org.apache.archiva.admin.model.admin.FileType;
 import org.apache.archiva.admin.repository.admin.FiletypeToMapClosure;
 import org.apache.archiva.audit.Auditable;
 import org.apache.archiva.repository.scanner.RepositoryContentConsumers;
index 49635f30ebfbcc8c6565de182a33e707a57c4aa3..c13829d580adc4c58f7e4064b632d68434f2414f 100644 (file)
@@ -19,6 +19,8 @@ package org.apache.maven.archiva.web.action;
  * under the License.
  */
 
+import net.sf.beanlib.provider.replicator.BeanReplicator;
+import org.apache.archiva.admin.model.managed.ManagedRepository;
 import org.apache.archiva.metadata.model.ArtifactMetadata;
 import org.apache.archiva.metadata.repository.MetadataRepository;
 import org.apache.archiva.metadata.repository.RepositorySession;
@@ -131,7 +133,9 @@ public class DeleteArtifactActionTest
         Configuration config = createConfiguration();
 
         ManagedRepositoryContent repoContent = new ManagedDefaultRepositoryContent();
-        repoContent.setRepository( config.findManagedRepositoryById( REPOSITORY_ID ) );
+        repoContent.setRepository(
+            new BeanReplicator().replicateBean( config.findManagedRepositoryById( REPOSITORY_ID ),
+                                                ManagedRepository.class ) );
 
         configurationControl.expectAndReturn( configuration.getConfiguration(), config );
         repositoryFactoryControl.expectAndReturn( repositoryFactory.getManagedRepositoryContent( REPOSITORY_ID ),
index 83cb871e5555c09de3721d491e7d7b3e91a831e1..9b7de4f40068df110a7ad03a98e5115bde8c102c 100644 (file)
@@ -20,6 +20,8 @@ package org.apache.maven.archiva.web.action;
  */
 
 import com.opensymphony.xwork2.Action;
+import net.sf.beanlib.provider.replicator.BeanReplicator;
+import org.apache.archiva.admin.model.managed.ManagedRepository;
 import org.apache.archiva.metadata.model.ArtifactMetadata;
 import org.apache.archiva.metadata.model.Dependency;
 import org.apache.archiva.metadata.model.MailingList;
@@ -58,7 +60,7 @@ public class ShowArtifactActionTest
     private static final String TEST_SNAPSHOT_VERSION = "1.0-SNAPSHOT";
 
     private static final String TEST_TS_SNAPSHOT_VERSION = "1.0-20091120.111111-1";
-    
+
     private static final String TEST_NAMESPACE = "namespace";
 
     private static final String OTHER_TEST_REPO = "first-repo";
@@ -74,6 +76,44 @@ public class ShowArtifactActionTest
 
     private static final String TEST_TYPE = "jar";
 
+    protected void setUp()
+        throws Exception
+    {
+        super.setUp();
+        action = (ShowArtifactAction) getActionProxy( "/showArtifact.action" ).getAction();
+
+        metadataResolver = new TestMetadataResolver();
+        MetadataRepository repo = mock( MetadataRepository.class );
+        RepositorySession repositorySession = mock( RepositorySession.class );
+        when( repositorySession.getResolver() ).thenReturn( metadataResolver );
+        when( repositorySession.getRepository() ).thenReturn( repo );
+        TestRepositorySessionFactory repositorySessionFactory =
+            applicationContext.getBean( "repositorySessionFactory#test", TestRepositorySessionFactory.class );
+        repositorySessionFactory.setRepositorySession( repositorySession );
+
+        RepositoryContentFactory factory = mock( RepositoryContentFactory.class );
+
+        action.setRepositoryFactory( factory );
+
+        ManagedRepository config = new ManagedRepository();
+        config.setId( TEST_REPO );
+        config.setLocation( new File( "target/test-repo" ).getAbsolutePath() );
+
+        ManagedRepositoryContent content = new ManagedDefaultRepositoryContent();
+        content.setRepository( config );
+        when( factory.getManagedRepositoryContent( TEST_REPO ) ).thenReturn( content );
+
+        ArchivaConfiguration archivaConfig = mock( ArchivaConfiguration.class );
+
+        Configuration configuration = new Configuration();
+        configuration.addManagedRepository(
+            new BeanReplicator().replicateBean( config, ManagedRepositoryConfiguration.class ) );
+        when( archivaConfig.getConfiguration() ).thenReturn( configuration );
+
+        when( factory.getArchivaConfiguration() ).thenReturn( archivaConfig );
+
+    }
+
     public void testInstantiation()
     {
         assertFalse( action == getActionProxy( "/showArtifact.action" ).getAction() );
@@ -293,49 +333,49 @@ public class ShowArtifactActionTest
         assertNull( action.getMailingLists() );
         assertTrue( action.getArtifacts().isEmpty() );
     }
-    
+
     public void testMetadataHasRepositoryFacetProblem()
     {
         String errMsg = "Error in resolving artifact's parent POM file: Sample Parent POM not found";
-        ProjectVersionMetadata metaData = createProjectModel(TEST_SNAPSHOT_VERSION);
-        metaData.addFacet( createRepositoryProblemFacet( TEST_REPO, errMsg, 
-                                                         TEST_GROUP_ID, TEST_SNAPSHOT_VERSION, TEST_NAMESPACE ) );
-        
-        
+        ProjectVersionMetadata metaData = createProjectModel( TEST_SNAPSHOT_VERSION );
+        metaData.addFacet(
+            createRepositoryProblemFacet( TEST_REPO, errMsg, TEST_GROUP_ID, TEST_SNAPSHOT_VERSION, TEST_NAMESPACE ) );
+
         metadataResolver.setProjectVersion( TEST_REPO, TEST_GROUP_ID, TEST_ARTIFACT_ID, metaData );
-        
+
         metadataResolver.setArtifacts( TEST_REPO, TEST_GROUP_ID, TEST_ARTIFACT_ID, TEST_SNAPSHOT_VERSION,
-                                  TEST_SNAPSHOT_ARTIFACTS );
+                                       TEST_SNAPSHOT_ARTIFACTS );
 
         action.setGroupId( TEST_GROUP_ID );
         action.setArtifactId( TEST_ARTIFACT_ID );
         action.setVersion( TEST_SNAPSHOT_VERSION );
 
         String result = action.artifact();
-        
+
         assertEquals( Action.SUCCESS, result );
 
         assertTrue( action.hasActionErrors() );
         assertFalse( action.hasActionMessages() );
         assertEquals( "Artifact metadata is incomplete: " + errMsg, action.getActionErrors().toArray()[0].toString() );
     }
-    
+
     public void testMetadataIncomplete()
     {
-        ProjectVersionMetadata metaData = createProjectModel(TEST_SNAPSHOT_VERSION);
+        ProjectVersionMetadata metaData = createProjectModel( TEST_SNAPSHOT_VERSION );
         metaData.setIncomplete( true );
-        
+
         metadataResolver.setProjectVersion( TEST_REPO, TEST_GROUP_ID, TEST_ARTIFACT_ID, metaData );
-        
+
         metadataResolver.setArtifacts( TEST_REPO, TEST_GROUP_ID, TEST_ARTIFACT_ID, TEST_SNAPSHOT_VERSION,
-                                  TEST_SNAPSHOT_ARTIFACTS );
+                                       TEST_SNAPSHOT_ARTIFACTS );
 
         action.setGroupId( TEST_GROUP_ID );
         action.setArtifactId( TEST_ARTIFACT_ID );
-        action.setVersion( TEST_SNAPSHOT_VERSION );;
+        action.setVersion( TEST_SNAPSHOT_VERSION );
+        ;
 
         String result = action.artifact();
-        
+
         assertEquals( Action.SUCCESS, result );
 
         assertTrue( action.hasActionErrors() );
@@ -679,8 +719,9 @@ public class ShowArtifactActionTest
         assertTrue( action.getActionErrors().isEmpty() );
         assertTrue( action.getActionMessages().isEmpty() );
     }
-    
-    private RepositoryProblemFacet createRepositoryProblemFacet( String repoId, String errMsg, String projectId, String projectVersion, String namespace )
+
+    private RepositoryProblemFacet createRepositoryProblemFacet( String repoId, String errMsg, String projectId,
+                                                                 String projectVersion, String namespace )
     {
         RepositoryProblemFacet repoProblemFacet = new RepositoryProblemFacet();
         repoProblemFacet.setRepositoryId( repoId );
@@ -692,41 +733,4 @@ public class ShowArtifactActionTest
         repoProblemFacet.setNamespace( namespace );
         return repoProblemFacet;
     }
-
-    protected void setUp()
-        throws Exception
-    {
-        super.setUp();
-        action = (ShowArtifactAction) getActionProxy( "/showArtifact.action" ).getAction();
-
-        metadataResolver = new TestMetadataResolver();
-        MetadataRepository repo = mock( MetadataRepository.class );
-        RepositorySession repositorySession = mock( RepositorySession.class );
-        when( repositorySession.getResolver() ).thenReturn( metadataResolver );
-        when( repositorySession.getRepository() ).thenReturn( repo );
-        TestRepositorySessionFactory repositorySessionFactory =
-            applicationContext.getBean( "repositorySessionFactory#test", TestRepositorySessionFactory.class );
-        repositorySessionFactory.setRepositorySession( repositorySession );
-
-        RepositoryContentFactory factory = mock( RepositoryContentFactory.class );
-
-        action.setRepositoryFactory( factory );
-
-        ManagedRepositoryConfiguration config = new ManagedRepositoryConfiguration();
-        config.setId( TEST_REPO );
-        config.setLocation( new File( "target/test-repo" ).getAbsolutePath() );
-
-        ManagedRepositoryContent content = new ManagedDefaultRepositoryContent();
-        content.setRepository( config );
-        when( factory.getManagedRepositoryContent( TEST_REPO ) ).thenReturn( content );
-
-        ArchivaConfiguration archivaConfig = mock( ArchivaConfiguration.class );
-
-        Configuration configuration = new Configuration();
-        configuration.addManagedRepository( config );
-        when( archivaConfig.getConfiguration() ).thenReturn( configuration );
-
-        when( factory.getArchivaConfiguration() ).thenReturn( archivaConfig );
-
-    }
 }
index e9e80111f356915287e927aaf99c87a234a54487..e3c81ed7b636dc38d24195de376ef0f03c089bc9 100644 (file)
@@ -20,6 +20,8 @@ package org.apache.maven.archiva.web.action;
  */
 
 import com.opensymphony.xwork2.Action;
+import net.sf.beanlib.provider.replicator.BeanReplicator;
+import org.apache.archiva.admin.model.managed.ManagedRepository;
 import org.apache.archiva.audit.AuditEvent;
 import org.apache.archiva.audit.AuditListener;
 import org.apache.archiva.checksum.ChecksumAlgorithm;
@@ -140,19 +142,22 @@ public class UploadActionTest
     private void assertAllArtifactsIncludingSupportArtifactsArePresent( String repoLocation, String artifact,
                                                                         String version )
     {
-        assertTrue( new File( repoLocation, "/org/apache/archiva/artifact-upload/" + version + "/" + artifact + ".jar" ).exists() );
+        assertTrue( new File( repoLocation,
+                              "/org/apache/archiva/artifact-upload/" + version + "/" + artifact + ".jar" ).exists() );
         assertTrue( new File( repoLocation, "/org/apache/archiva/artifact-upload/" + version + "/" + artifact
             + ".jar.sha1" ).exists() );
         assertTrue( new File( repoLocation, "/org/apache/archiva/artifact-upload/" + version + "/" + artifact
             + ".jar.md5" ).exists() );
 
-        assertTrue( new File( repoLocation, "/org/apache/archiva/artifact-upload/" + version + "/" + artifact + ".pom" ).exists() );
+        assertTrue( new File( repoLocation,
+                              "/org/apache/archiva/artifact-upload/" + version + "/" + artifact + ".pom" ).exists() );
         assertTrue( new File( repoLocation, "/org/apache/archiva/artifact-upload/" + version + "/" + artifact
             + ".pom.sha1" ).exists() );
         assertTrue( new File( repoLocation, "/org/apache/archiva/artifact-upload/" + version + "/" + artifact
             + ".pom.md5" ).exists() );
 
-        assertTrue( new File( repoLocation, "/org/apache/archiva/artifact-upload/" + MetadataTools.MAVEN_METADATA ).exists() );
+        assertTrue(
+            new File( repoLocation, "/org/apache/archiva/artifact-upload/" + MetadataTools.MAVEN_METADATA ).exists() );
         assertTrue( new File( repoLocation, "/org/apache/archiva/artifact-upload/" + MetadataTools.MAVEN_METADATA
             + ".sha1" ).exists() );
         assertTrue( new File( repoLocation, "/org/apache/archiva/artifact-upload/" + MetadataTools.MAVEN_METADATA
@@ -162,40 +167,37 @@ public class UploadActionTest
     private void verifyVersionMetadataChecksums( String repoLocation, String version )
         throws IOException
     {
-        ChecksummedFile checksum =
-            new ChecksummedFile( new File( repoLocation, "/org/apache/archiva/artifact-upload/" + version + "/"
-                + MetadataTools.MAVEN_METADATA ) );
+        ChecksummedFile checksum = new ChecksummedFile( new File( repoLocation,
+                                                                  "/org/apache/archiva/artifact-upload/" + version + "/"
+                                                                      + MetadataTools.MAVEN_METADATA ) );
         String sha1 = checksum.calculateChecksum( ChecksumAlgorithm.SHA1 );
         String md5 = checksum.calculateChecksum( ChecksumAlgorithm.MD5 );
 
-        String contents =
-            FileUtils.readFileToString( new File( repoLocation, "/org/apache/archiva/artifact-upload/" + version + "/"
-                + MetadataTools.MAVEN_METADATA + ".sha1" ) );
+        String contents = FileUtils.readFileToString( new File( repoLocation,
+                                                                "/org/apache/archiva/artifact-upload/" + version + "/"
+                                                                    + MetadataTools.MAVEN_METADATA + ".sha1" ) );
         assertTrue( StringUtils.contains( contents, sha1 ) );
 
-        contents =
-            FileUtils.readFileToString( new File( repoLocation, "/org/apache/archiva/artifact-upload/" + version + "/"
-                + MetadataTools.MAVEN_METADATA + ".md5" ) );
+        contents = FileUtils.readFileToString( new File( repoLocation,
+                                                         "/org/apache/archiva/artifact-upload/" + version + "/"
+                                                             + MetadataTools.MAVEN_METADATA + ".md5" ) );
         assertTrue( StringUtils.contains( contents, md5 ) );
     }
 
     private void verifyProjectMetadataChecksums( String repoLocation )
         throws IOException
     {
-        ChecksummedFile checksum =
-            new ChecksummedFile( new File( repoLocation, "/org/apache/archiva/artifact-upload/"
-                + MetadataTools.MAVEN_METADATA ) );
+        ChecksummedFile checksum = new ChecksummedFile(
+            new File( repoLocation, "/org/apache/archiva/artifact-upload/" + MetadataTools.MAVEN_METADATA ) );
         String sha1 = checksum.calculateChecksum( ChecksumAlgorithm.SHA1 );
         String md5 = checksum.calculateChecksum( ChecksumAlgorithm.MD5 );
 
-        String contents =
-            FileUtils.readFileToString( new File( repoLocation, "/org/apache/archiva/artifact-upload/"
-                + MetadataTools.MAVEN_METADATA + ".sha1" ) );
+        String contents = FileUtils.readFileToString(
+            new File( repoLocation, "/org/apache/archiva/artifact-upload/" + MetadataTools.MAVEN_METADATA + ".sha1" ) );
         assertTrue( StringUtils.contains( contents, sha1 ) );
 
-        contents =
-            FileUtils.readFileToString( new File( repoLocation, "/org/apache/archiva/artifact-upload/"
-                + MetadataTools.MAVEN_METADATA + ".md5" ) );
+        contents = FileUtils.readFileToString(
+            new File( repoLocation, "/org/apache/archiva/artifact-upload/" + MetadataTools.MAVEN_METADATA + ".md5" ) );
         assertTrue( StringUtils.contains( contents, md5 ) );
     }
 
@@ -206,40 +208,34 @@ public class UploadActionTest
         String sha1;
         String md5;
         String contents;
-        checksum =
-            new ChecksummedFile( new File( repoLocation, "/org/apache/archiva/artifact-upload/" + version + "/"
-                + artifact + ".pom" ) );
+        checksum = new ChecksummedFile(
+            new File( repoLocation, "/org/apache/archiva/artifact-upload/" + version + "/" + artifact + ".pom" ) );
         sha1 = checksum.calculateChecksum( ChecksumAlgorithm.SHA1 );
         md5 = checksum.calculateChecksum( ChecksumAlgorithm.MD5 );
 
-        contents =
-            FileUtils.readFileToString( new File( repoLocation, "/org/apache/archiva/artifact-upload/" + version + "/"
-                + artifact + ".pom.sha1" ) );
+        contents = FileUtils.readFileToString(
+            new File( repoLocation, "/org/apache/archiva/artifact-upload/" + version + "/" + artifact + ".pom.sha1" ) );
         assertTrue( StringUtils.contains( contents, sha1 ) );
 
-        contents =
-            FileUtils.readFileToString( new File( repoLocation, "/org/apache/archiva/artifact-upload/" + version + "/"
-                + artifact + ".pom.md5" ) );
+        contents = FileUtils.readFileToString(
+            new File( repoLocation, "/org/apache/archiva/artifact-upload/" + version + "/" + artifact + ".pom.md5" ) );
         assertTrue( StringUtils.contains( contents, md5 ) );
     }
 
     private void verifyArtifactChecksums( String repoLocation, String artifact, String version )
         throws IOException
     {
-        ChecksummedFile checksum =
-            new ChecksummedFile( new File( repoLocation, "/org/apache/archiva/artifact-upload/" + version + "/"
-                + artifact + ".jar" ) );
+        ChecksummedFile checksum = new ChecksummedFile(
+            new File( repoLocation, "/org/apache/archiva/artifact-upload/" + version + "/" + artifact + ".jar" ) );
         String sha1 = checksum.calculateChecksum( ChecksumAlgorithm.SHA1 );
         String md5 = checksum.calculateChecksum( ChecksumAlgorithm.MD5 );
 
-        String contents =
-            FileUtils.readFileToString( new File( repoLocation, "/org/apache/archiva/artifact-upload/" + version + "/"
-                + artifact + ".jar.sha1" ) );
+        String contents = FileUtils.readFileToString(
+            new File( repoLocation, "/org/apache/archiva/artifact-upload/" + version + "/" + artifact + ".jar.sha1" ) );
         assertTrue( StringUtils.contains( contents, sha1 ) );
 
-        contents =
-            FileUtils.readFileToString( new File( repoLocation, "/org/apache/archiva/artifact-upload/" + version + "/"
-                + artifact + ".jar.md5" ) );
+        contents = FileUtils.readFileToString(
+            new File( repoLocation, "/org/apache/archiva/artifact-upload/" + version + "/" + artifact + ".jar.md5" ) );
         assertTrue( StringUtils.contains( contents, md5 ) );
     }
 
@@ -256,12 +252,12 @@ public class UploadActionTest
         {
             endIndex = artifactsList[index].indexOf( ".pom" );
         }
-        
+
         timestamp = artifactsList[index].substring( startIndex, endIndex );
 
         return timestamp;
     }
-    
+
     private MockControl mockAuditLogs( List<String> resources )
     {
         return mockAuditLogs( AuditEvent.UPLOAD_FILE, resources );
@@ -286,16 +282,17 @@ public class UploadActionTest
         uploadAction.setAuditListeners( Collections.singletonList( listener ) );
         return control;
     }
-    
+
     public void testArtifactUploadWithPomSuccessful()
         throws Exception
     {
         setUploadParameters( "1.0", null, new File( FileUtil.getBasedir(),
                                                     "target/test-classes/upload-artifact-test/artifact-to-be-uploaded.jar" ),
-                             new File( FileUtil.getBasedir(), "target/test-classes/upload-artifact-test/pom.xml" ), false );
+                             new File( FileUtil.getBasedir(), "target/test-classes/upload-artifact-test/pom.xml" ),
+                             false );
 
         ManagedRepositoryContent content = new ManagedDefaultRepositoryContent();
-        content.setRepository( config.findManagedRepositoryById( REPOSITORY_ID ) );
+        content.setRepository( getManagedRepository( config.findManagedRepositoryById( REPOSITORY_ID ) ) );
 
         archivaConfigControl.expectAndReturn( archivaConfig.getConfiguration(), config );
         repoFactoryControl.expectAndReturn( repoFactory.getManagedRepositoryContent( REPOSITORY_ID ), content );
@@ -327,10 +324,11 @@ public class UploadActionTest
     {
         setUploadParameters( "1.0", "tests", new File( FileUtil.getBasedir(),
                                                        "target/test-classes/upload-artifact-test/artifact-to-be-uploaded.jar" ),
-                             new File( FileUtil.getBasedir(), "target/test-classes/upload-artifact-test/pom.xml" ), false );
+                             new File( FileUtil.getBasedir(), "target/test-classes/upload-artifact-test/pom.xml" ),
+                             false );
 
         ManagedRepositoryContent content = new ManagedDefaultRepositoryContent();
-        content.setRepository( config.findManagedRepositoryById( REPOSITORY_ID ) );
+        content.setRepository( getManagedRepository( config.findManagedRepositoryById( REPOSITORY_ID ) ) );
 
         archivaConfigControl.expectAndReturn( archivaConfig.getConfiguration(), config );
         repoFactoryControl.expectAndReturn( repoFactory.getManagedRepositoryContent( REPOSITORY_ID ), content );
@@ -350,16 +348,22 @@ public class UploadActionTest
         control.verify();
 
         String repoLocation = config.findManagedRepositoryById( REPOSITORY_ID ).getLocation();
-        assertTrue( new File( repoLocation, "/org/apache/archiva/artifact-upload/1.0/artifact-upload-1.0-tests.jar" ).exists() );
+        assertTrue( new File( repoLocation,
+                              "/org/apache/archiva/artifact-upload/1.0/artifact-upload-1.0-tests.jar" ).exists() );
         assertTrue( new File( repoLocation,
                               "/org/apache/archiva/artifact-upload/1.0/artifact-upload-1.0-tests.jar.sha1" ).exists() );
-        assertTrue( new File( repoLocation, "/org/apache/archiva/artifact-upload/1.0/artifact-upload-1.0-tests.jar.md5" ).exists() );
+        assertTrue( new File( repoLocation,
+                              "/org/apache/archiva/artifact-upload/1.0/artifact-upload-1.0-tests.jar.md5" ).exists() );
 
-        assertTrue( new File( repoLocation, "/org/apache/archiva/artifact-upload/1.0/artifact-upload-1.0.pom" ).exists() );
-        assertTrue( new File( repoLocation, "/org/apache/archiva/artifact-upload/1.0/artifact-upload-1.0.pom.sha1" ).exists() );
-        assertTrue( new File( repoLocation, "/org/apache/archiva/artifact-upload/1.0/artifact-upload-1.0.pom.md5" ).exists() );
+        assertTrue(
+            new File( repoLocation, "/org/apache/archiva/artifact-upload/1.0/artifact-upload-1.0.pom" ).exists() );
+        assertTrue(
+            new File( repoLocation, "/org/apache/archiva/artifact-upload/1.0/artifact-upload-1.0.pom.sha1" ).exists() );
+        assertTrue(
+            new File( repoLocation, "/org/apache/archiva/artifact-upload/1.0/artifact-upload-1.0.pom.md5" ).exists() );
 
-        assertTrue( new File( repoLocation, "/org/apache/archiva/artifact-upload/" + MetadataTools.MAVEN_METADATA ).exists() );
+        assertTrue(
+            new File( repoLocation, "/org/apache/archiva/artifact-upload/" + MetadataTools.MAVEN_METADATA ).exists() );
         assertTrue( new File( repoLocation, "/org/apache/archiva/artifact-upload/" + MetadataTools.MAVEN_METADATA
             + ".sha1" ).exists() );
         assertTrue( new File( repoLocation, "/org/apache/archiva/artifact-upload/" + MetadataTools.MAVEN_METADATA
@@ -377,7 +381,7 @@ public class UploadActionTest
                              null, true );
 
         ManagedRepositoryContent content = new ManagedDefaultRepositoryContent();
-        content.setRepository( config.findManagedRepositoryById( REPOSITORY_ID ) );
+        content.setRepository( getManagedRepository( config.findManagedRepositoryById( REPOSITORY_ID ) ) );
 
         archivaConfigControl.expectAndReturn( archivaConfig.getConfiguration(), config );
         repoFactoryControl.expectAndReturn( repoFactory.getManagedRepositoryContent( REPOSITORY_ID ), content );
@@ -412,7 +416,7 @@ public class UploadActionTest
                              null, false );
 
         ManagedRepositoryContent content = new ManagedDefaultRepositoryContent();
-        content.setRepository( config.findManagedRepositoryById( REPOSITORY_ID ) );
+        content.setRepository( getManagedRepository( config.findManagedRepositoryById( REPOSITORY_ID ) ) );
 
         archivaConfigControl.expectAndReturn( archivaConfig.getConfiguration(), config );
         repoFactoryControl.expectAndReturn( repoFactory.getManagedRepositoryContent( REPOSITORY_ID ), content );
@@ -447,10 +451,10 @@ public class UploadActionTest
 
         assertTrue(
             new File( repoLocation, "/org/apache/archiva/artifact-upload/" + MetadataTools.MAVEN_METADATA ).exists() );
-        assertTrue( new File( repoLocation, "/org/apache/archiva/artifact-upload/" + MetadataTools.MAVEN_METADATA +
-            ".sha1" ).exists() );
-        assertTrue( new File( repoLocation, "/org/apache/archiva/artifact-upload/" + MetadataTools.MAVEN_METADATA +
-            ".md5" ).exists() );
+        assertTrue( new File( repoLocation, "/org/apache/archiva/artifact-upload/" + MetadataTools.MAVEN_METADATA
+            ".sha1" ).exists() );
+        assertTrue( new File( repoLocation, "/org/apache/archiva/artifact-upload/" + MetadataTools.MAVEN_METADATA
+            ".md5" ).exists() );
 
         // verify checksums of jar file
         ChecksummedFile checksum = new ChecksummedFile(
@@ -502,11 +506,14 @@ public class UploadActionTest
         repoFactoryControl.verify();
 
         String repoLocation = config.findManagedRepositoryById( REPOSITORY_ID ).getLocation();
-        assertFalse( new File( repoLocation, "/org/apache/archiva/artifact-upload/1.0/artifact-upload-1.0.jar" ).exists() );
+        assertFalse(
+            new File( repoLocation, "/org/apache/archiva/artifact-upload/1.0/artifact-upload-1.0.jar" ).exists() );
 
-        assertFalse( new File( repoLocation, "/org/apache/archiva/artifact-upload/1.0/artifact-upload-1.0.pom" ).exists() );
+        assertFalse(
+            new File( repoLocation, "/org/apache/archiva/artifact-upload/1.0/artifact-upload-1.0.pom" ).exists() );
 
-        assertFalse( new File( repoLocation, "/org/apache/archiva/artifact-upload/" + MetadataTools.MAVEN_METADATA ).exists() );
+        assertFalse(
+            new File( repoLocation, "/org/apache/archiva/artifact-upload/" + MetadataTools.MAVEN_METADATA ).exists() );
     }
 
     public void testArtifactUploadSnapshots()
@@ -517,7 +524,7 @@ public class UploadActionTest
                              null, true );
 
         ManagedRepositoryContent content = new ManagedDefaultRepositoryContent();
-        content.setRepository( config.findManagedRepositoryById( REPOSITORY_ID ) );
+        content.setRepository( getManagedRepository( config.findManagedRepositoryById( REPOSITORY_ID ) ) );
 
         archivaConfigControl.expectAndReturn( archivaConfig.getConfiguration(), config );
         repoFactoryControl.expectAndReturn( repoFactory.getManagedRepositoryContent( REPOSITORY_ID ), content );
@@ -546,10 +553,12 @@ public class UploadActionTest
         assertEquals( 9, artifactsList.length );
         assertTrue( new File( repoLocation, "/org/apache/archiva/artifact-upload/1.0-SNAPSHOT/"
             + MetadataTools.MAVEN_METADATA ).exists() );
-        assertTrue( new File( repoLocation, "/org/apache/archiva/artifact-upload/1.0-SNAPSHOT/"
-            + MetadataTools.MAVEN_METADATA + ".sha1" ).exists() );
-        assertTrue( new File( repoLocation, "/org/apache/archiva/artifact-upload/1.0-SNAPSHOT/"
-            + MetadataTools.MAVEN_METADATA + ".md5" ).exists() );
+        assertTrue( new File( repoLocation,
+                              "/org/apache/archiva/artifact-upload/1.0-SNAPSHOT/" + MetadataTools.MAVEN_METADATA
+                                  + ".sha1" ).exists() );
+        assertTrue( new File( repoLocation,
+                              "/org/apache/archiva/artifact-upload/1.0-SNAPSHOT/" + MetadataTools.MAVEN_METADATA
+                                  + ".md5" ).exists() );
 
         int startIndex = "artifact-upload-1.0-".length();
         String timestampPath = getTimestamp( artifactsList, startIndex, 0 );
@@ -562,8 +571,8 @@ public class UploadActionTest
         verifyVersionMetadataChecksums( repoLocation, "1.0-SNAPSHOT" );
 
         // verify build number
-        File metadataFile =
-            new File( repoLocation, "/org/apache/archiva/artifact-upload/1.0-SNAPSHOT/" + MetadataTools.MAVEN_METADATA );
+        File metadataFile = new File( repoLocation, "/org/apache/archiva/artifact-upload/1.0-SNAPSHOT/"
+            + MetadataTools.MAVEN_METADATA );
         ArchivaRepositoryMetadata artifactMetadata = RepositoryMetadataReader.read( metadataFile );
 
         SnapshotVersion snapshotVersion = artifactMetadata.getSnapshotVersion();
@@ -583,35 +592,34 @@ public class UploadActionTest
 
         // MRM-1353
         // upload snapshot artifact again and check if build number was incremented
-        setUploadParameters( "1.0-SNAPSHOT", null,
-                             new File( FileUtil.getBasedir(),
-                                       "target/test-classes/upload-artifact-test/artifact-to-be-uploaded.jar" ), null,
-                             true );
+        setUploadParameters( "1.0-SNAPSHOT", null, new File( FileUtil.getBasedir(),
+                                                             "target/test-classes/upload-artifact-test/artifact-to-be-uploaded.jar" ),
+                             null, true );
 
         archivaConfigControl.expectAndReturn( archivaConfig.getConfiguration(), config );
         repoFactoryControl.expectAndReturn( repoFactory.getManagedRepositoryContent( REPOSITORY_ID ), content );
-        
+
         archivaConfigControl.replay();
         repoFactoryControl.replay();
-        
+
         fmt = new SimpleDateFormat( "yyyyMMdd.HHmmss" );
         fmt.setTimeZone( TimeZone.getTimeZone( "UTC" ) );
         timestamp = fmt.format( new Date() );
-        
+
         control = mockAuditLogs( Arrays.asList(
-                       "org/apache/archiva/artifact-upload/1.0-SNAPSHOT/artifact-upload-1.0-" + timestamp + "-2.jar",
-                       "org/apache/archiva/artifact-upload/1.0-SNAPSHOT/artifact-upload-1.0-" + timestamp + "-2.pom" ) );
-        
+            "org/apache/archiva/artifact-upload/1.0-SNAPSHOT/artifact-upload-1.0-" + timestamp + "-2.jar",
+            "org/apache/archiva/artifact-upload/1.0-SNAPSHOT/artifact-upload-1.0-" + timestamp + "-2.pom" ) );
+
         returnString = uploadAction.doUpload();
         assertEquals( Action.SUCCESS, returnString );
 
         archivaConfigControl.verify();
         repoFactoryControl.verify();
         control.verify();
-        
+
         artifactsList = new File( repoLocation, "/org/apache/archiva/artifact-upload/1.0-SNAPSHOT/" ).list();
         Arrays.sort( artifactsList );
-        
+
         assertEquals( 15, artifactsList.length );
 
         timestampPath = getTimestamp( artifactsList, startIndex, 6 );
@@ -624,8 +632,8 @@ public class UploadActionTest
         verifyVersionMetadataChecksums( repoLocation, "1.0-SNAPSHOT" );
 
         // verify build number set in metadata and in filename
-        metadataFile =
-            new File( repoLocation, "/org/apache/archiva/artifact-upload/1.0-SNAPSHOT/" + MetadataTools.MAVEN_METADATA );
+        metadataFile = new File( repoLocation,
+                                 "/org/apache/archiva/artifact-upload/1.0-SNAPSHOT/" + MetadataTools.MAVEN_METADATA );
         artifactMetadata = RepositoryMetadataReader.read( metadataFile );
 
         snapshotVersion = artifactMetadata.getSnapshotVersion();
@@ -648,7 +656,7 @@ public class UploadActionTest
         ManagedRepositoryContent content = new ManagedDefaultRepositoryContent();
         ManagedRepositoryConfiguration repoConfig = config.findManagedRepositoryById( REPOSITORY_ID );
         repoConfig.setBlockRedeployments( false );
-        content.setRepository( repoConfig );
+        content.setRepository( getManagedRepository( repoConfig ) );
 
         archivaConfigControl.expectAndReturn( archivaConfig.getConfiguration(), config );
         repoFactoryControl.expectAndReturn( repoFactory.getManagedRepositoryContent( REPOSITORY_ID ), content );
@@ -712,7 +720,7 @@ public class UploadActionTest
                              null, true );
 
         ManagedRepositoryContent content = new ManagedDefaultRepositoryContent();
-        content.setRepository( config.findManagedRepositoryById( REPOSITORY_ID ) );
+        content.setRepository( getManagedRepository( config.findManagedRepositoryById( REPOSITORY_ID ) ) );
 
         archivaConfigControl.expectAndReturn( archivaConfig.getConfiguration(), config, 2 );
         repoFactoryControl.expectAndReturn( repoFactory.getManagedRepositoryContent( REPOSITORY_ID ), content, 2 );
@@ -754,7 +762,7 @@ public class UploadActionTest
         ManagedRepositoryContent content = new ManagedDefaultRepositoryContent();
         ManagedRepositoryConfiguration repoConfig = config.findManagedRepositoryById( REPOSITORY_ID );
         repoConfig.setBlockRedeployments( false );
-        content.setRepository( repoConfig );
+        content.setRepository( getManagedRepository( repoConfig ) );
 
         archivaConfigControl.expectAndReturn( archivaConfig.getConfiguration(), config, 2 );
         repoFactoryControl.expectAndReturn( repoFactory.getManagedRepositoryContent( REPOSITORY_ID ), content, 2 );
@@ -789,4 +797,9 @@ public class UploadActionTest
         verifyPomChecksums( repoLocation, "artifact-upload-1.0", "1.0" );
         verifyProjectMetadataChecksums( repoLocation );
     }
+
+    ManagedRepository getManagedRepository( ManagedRepositoryConfiguration conf )
+    {
+        return new BeanReplicator().replicateBean( conf, ManagedRepository.class );
+    }
 }
index e3b99dc32714c6780e8d4dd7199b8a3620974e05..dc9fa17410fb1b9def30105facc25d6f0985ec27 100644 (file)
@@ -20,9 +20,9 @@ package org.apache.maven.archiva.web.action.admin.connectors.proxy;
  */
 
 import com.opensymphony.xwork2.Action;
+import org.apache.archiva.admin.model.proxyconnector.ProxyConnector;
 import org.apache.archiva.admin.repository.managed.DefaultManagedRepositoryAdmin;
 import org.apache.archiva.admin.repository.proxyconnector.DefaultProxyConnectorAdmin;
-import org.apache.archiva.admin.repository.proxyconnector.ProxyConnector;
 import org.apache.archiva.admin.repository.remote.DefaultRemoteRepositoryAdmin;
 import org.apache.maven.archiva.configuration.ArchivaConfiguration;
 import org.apache.maven.archiva.configuration.Configuration;
@@ -37,8 +37,8 @@ import org.apache.maven.archiva.policies.PropagateErrorsOnUpdateDownloadPolicy;
 import org.apache.maven.archiva.policies.ReleasesPolicy;
 import org.apache.maven.archiva.policies.SnapshotsPolicy;
 import org.apache.maven.archiva.web.action.AbstractWebworkTestCase;
-import org.codehaus.redback.integration.interceptor.SecureActionBundle;
 import org.codehaus.plexus.registry.RegistryException;
+import org.codehaus.redback.integration.interceptor.SecureActionBundle;
 import org.easymock.MockControl;
 
 import java.util.List;
index 6562995abd9eec97528fa5fa7d353bc56094fc5b..fdc42f1051e416b9a8c94410ef26dfb9850aa193 100644 (file)
@@ -20,9 +20,9 @@ package org.apache.maven.archiva.web.action.admin.connectors.proxy;
  */
 
 import com.opensymphony.xwork2.Action;
+import org.apache.archiva.admin.model.proxyconnector.ProxyConnector;
 import org.apache.archiva.admin.repository.managed.DefaultManagedRepositoryAdmin;
 import org.apache.archiva.admin.repository.proxyconnector.DefaultProxyConnectorAdmin;
-import org.apache.archiva.admin.repository.proxyconnector.ProxyConnector;
 import org.apache.archiva.admin.repository.remote.DefaultRemoteRepositoryAdmin;
 import org.apache.maven.archiva.configuration.ArchivaConfiguration;
 import org.apache.maven.archiva.configuration.Configuration;
index 77b82513fbbcc9d9f5f75c898feb7aae7ece3987..667c49a306332c026a0ef6942324ff8433fd4e0c 100644 (file)
@@ -21,7 +21,7 @@ package org.apache.maven.archiva.web.action.admin.legacy;
 
 import com.opensymphony.xwork2.validator.ActionValidatorManager;
 import junit.framework.TestCase;
-import org.apache.archiva.admin.repository.admin.LegacyArtifactPath;
+import org.apache.archiva.admin.model.admin.LegacyArtifactPath;
 import org.apache.archiva.web.validator.utils.ValidatorUtil;
 import org.apache.maven.archiva.web.action.admin.repositories.DefaultActionValidatorManagerFactory;
 
index 8b1efe1739629968caa7dda30b8a76d09d101694..bd71d5547e396320d79ebd9a0ba92a8e805f8308 100644 (file)
@@ -20,17 +20,16 @@ package org.apache.maven.archiva.web.action.admin.networkproxies;
  */
 
 import com.opensymphony.xwork2.validator.ActionValidatorManager;
+import junit.framework.TestCase;
+import org.apache.archiva.admin.model.networkproxy.NetworkProxy;
+import org.apache.archiva.web.validator.utils.ValidatorUtil;
+import org.apache.maven.archiva.web.action.admin.repositories.DefaultActionValidatorManagerFactory;
+
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
-import junit.framework.TestCase;
-import org.apache.archiva.admin.repository.networkproxy.NetworkProxy;
-import org.apache.maven.archiva.configuration.NetworkProxyConfiguration;
-import org.apache.maven.archiva.web.action.admin.repositories.DefaultActionValidatorManagerFactory;
-import org.apache.archiva.web.validator.utils.ValidatorUtil;
-
 public class ConfigureNetworkProxyActionTest extends TestCase
 {
     private static final String EMPTY_STRING = "";
index 623eec1859907b22ee4fc150db6966ba3ab27dae..39b2bf662d7210299fd1e0c11cdf4c32c6f0a9e1 100644 (file)
@@ -20,8 +20,8 @@ package org.apache.maven.archiva.web.action.admin.repositories;
  */
 
 import com.opensymphony.xwork2.validator.ActionValidatorManager;
-import org.apache.archiva.admin.repository.managed.ManagedRepository;
-import org.apache.archiva.admin.repository.managed.ManagedRepositoryAdmin;
+import org.apache.archiva.admin.model.managed.ManagedRepository;
+import org.apache.archiva.admin.model.managed.ManagedRepositoryAdmin;
 import org.apache.struts2.StrutsSpringTestCase;
 
 import java.io.File;
index 0f753e87124aa070a6698cc1c61d641742cd7af7..e3bab24e65de857ee82a6cec76f46803a192b736 100644 (file)
@@ -20,9 +20,9 @@ package org.apache.maven.archiva.web.action.admin.repositories;
  */
 
 import com.opensymphony.xwork2.Action;
+import org.apache.archiva.admin.model.managed.ManagedRepository;
 import org.apache.archiva.admin.repository.RepositoryCommonValidator;
 import org.apache.archiva.admin.repository.managed.DefaultManagedRepositoryAdmin;
-import org.apache.archiva.admin.repository.managed.ManagedRepository;
 import org.apache.archiva.scheduler.repository.RepositoryArchivaTaskScheduler;
 import org.apache.archiva.scheduler.repository.RepositoryTask;
 import org.apache.archiva.security.ArchivaRoleConstants;
index ec244ccb62fc07eb5bcc07e3eb22845afcaa3eb1..adf74c7f968787250791e650b426103b662d0568 100644 (file)
@@ -20,8 +20,8 @@ package org.apache.maven.archiva.web.action.admin.repositories;
  */
 
 import com.opensymphony.xwork2.Action;
+import org.apache.archiva.admin.model.remote.RemoteRepository;
 import org.apache.archiva.admin.repository.remote.DefaultRemoteRepositoryAdmin;
-import org.apache.archiva.admin.repository.remote.RemoteRepository;
 import org.apache.maven.archiva.configuration.ArchivaConfiguration;
 import org.apache.maven.archiva.configuration.Configuration;
 import org.apache.maven.archiva.web.action.AbstractActionTestCase;
index 736073f1f972bbee3d153226ce9853b759612f33..f47f44f0f356dc18ba51e129a6845484ee5941eb 100644 (file)
@@ -20,14 +20,18 @@ package org.apache.maven.archiva.web.action.admin.repositories;
  */
 
 import com.opensymphony.xwork2.Action;
+import net.sf.beanlib.provider.replicator.BeanReplicator;
+import org.apache.archiva.admin.model.RepositoryAdminException;
+import org.apache.archiva.admin.model.managed.ManagedRepository;
+import org.apache.archiva.admin.model.managed.ManagedRepositoryAdmin;
 import org.apache.archiva.admin.repository.managed.DefaultManagedRepositoryAdmin;
-import org.apache.archiva.admin.repository.managed.ManagedRepositoryAdmin;
 import org.apache.archiva.audit.AuditEvent;
 import org.apache.archiva.audit.AuditListener;
 import org.apache.archiva.metadata.repository.MetadataRepository;
 import org.apache.archiva.metadata.repository.RepositorySession;
 import org.apache.archiva.metadata.repository.memory.TestRepositorySessionFactory;
 import org.apache.archiva.metadata.repository.stats.RepositoryStatisticsManager;
+import org.apache.archiva.security.ArchivaRoleConstants;
 import org.apache.maven.archiva.configuration.ArchivaConfiguration;
 import org.apache.maven.archiva.configuration.Configuration;
 import org.apache.maven.archiva.configuration.IndeterminateConfigurationException;
@@ -35,7 +39,6 @@ import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
 import org.apache.maven.archiva.configuration.ProxyConnectorConfiguration;
 import org.apache.maven.archiva.configuration.RemoteRepositoryConfiguration;
 import org.apache.maven.archiva.configuration.RepositoryGroupConfiguration;
-import org.apache.archiva.security.ArchivaRoleConstants;
 import org.apache.maven.archiva.web.action.AbstractActionTestCase;
 import org.apache.maven.archiva.web.action.AuditEventArgumentsMatcher;
 import org.codehaus.plexus.redback.role.RoleManager;
@@ -128,7 +131,7 @@ public class DeleteManagedRepositoryActionTest
     }
 
     public void testSecureActionBundle()
-        throws SecureActionException
+        throws SecureActionException, RepositoryAdminException
     {
         archivaConfiguration.getConfiguration();
         archivaConfigurationControl.setReturnValue( new Configuration() );
@@ -173,7 +176,7 @@ public class DeleteManagedRepositoryActionTest
     public void testDeleteRepositoryConfirmation()
         throws Exception
     {
-        ManagedRepositoryConfiguration originalRepository = createRepository();
+        ManagedRepository originalRepository = createRepository();
         Configuration configuration = createConfigurationForEditing( originalRepository );
 
         archivaConfiguration.getConfiguration();
@@ -189,7 +192,7 @@ public class DeleteManagedRepositoryActionTest
 
         action.prepare();
         assertEquals( REPO_ID, action.getRepoid() );
-        ManagedRepositoryConfiguration repository = action.getRepository();
+        ManagedRepository repository = action.getRepository();
         assertNotNull( repository );
         assertRepositoryEquals( repository, createRepository() );
 
@@ -305,13 +308,13 @@ public class DeleteManagedRepositoryActionTest
     {
         repositoryStatisticsManagerControl.replay();
 
-        ManagedRepositoryConfiguration originalRepository = createRepository();
+        ManagedRepository originalRepository = createRepository();
         Configuration configuration = prepDeletionTest( originalRepository, 3 );
 
         String status = action.execute();
         assertEquals( Action.SUCCESS, status );
 
-        ManagedRepositoryConfiguration repository = action.getRepository();
+        ManagedRepository repository = action.getRepository();
         assertRepositoryEquals( repository, createRepository() );
         assertEquals( Collections.singletonList( originalRepository ), configuration.getManagedRepositories() );
 
@@ -321,9 +324,8 @@ public class DeleteManagedRepositoryActionTest
     }
 
 
-    private Configuration prepDeletionTest( ManagedRepositoryConfiguration originalRepository,
-                                            int expectCountGetConfig )
-        throws RegistryException, IndeterminateConfigurationException
+    private Configuration prepDeletionTest( ManagedRepository originalRepository, int expectCountGetConfig )
+        throws RegistryException, IndeterminateConfigurationException, RepositoryAdminException
     {
         location.mkdirs();
 
@@ -347,7 +349,7 @@ public class DeleteManagedRepositoryActionTest
 
         action.prepare();
         assertEquals( REPO_ID, action.getRepoid() );
-        ManagedRepositoryConfiguration repository = action.getRepository();
+        ManagedRepository repository = action.getRepository();
         assertNotNull( repository );
         assertRepositoryEquals( repository, createRepository() );
 
@@ -355,16 +357,15 @@ public class DeleteManagedRepositoryActionTest
         return configuration;
     }
 
-    private void assertRepositoryEquals( ManagedRepositoryConfiguration expectedRepository,
-                                         ManagedRepositoryConfiguration actualRepository )
+    private void assertRepositoryEquals( ManagedRepository expectedRepository, ManagedRepository actualRepository )
     {
         assertEquals( expectedRepository.getDaysOlder(), actualRepository.getDaysOlder() );
         assertEquals( expectedRepository.getId(), actualRepository.getId() );
-        assertEquals( expectedRepository.getIndexDir(), actualRepository.getIndexDir() );
+        assertEquals( expectedRepository.getIndexDirectory(), actualRepository.getIndexDirectory() );
         assertEquals( expectedRepository.getLayout(), actualRepository.getLayout() );
         assertEquals( expectedRepository.getLocation(), actualRepository.getLocation() );
         assertEquals( expectedRepository.getName(), actualRepository.getName() );
-        assertEquals( expectedRepository.getRefreshCronExpression(), actualRepository.getRefreshCronExpression() );
+        assertEquals( expectedRepository.getCronExpression(), actualRepository.getCronExpression() );
         assertEquals( expectedRepository.getRetentionCount(), actualRepository.getRetentionCount() );
         assertEquals( expectedRepository.isDeleteReleasedSnapshots(), actualRepository.isDeleteReleasedSnapshots() );
         assertEquals( expectedRepository.isScanned(), actualRepository.isScanned() );
@@ -372,21 +373,22 @@ public class DeleteManagedRepositoryActionTest
         assertEquals( expectedRepository.isSnapshots(), actualRepository.isSnapshots() );
     }
 
-    private Configuration createConfigurationForEditing( ManagedRepositoryConfiguration repositoryConfiguration )
+    private Configuration createConfigurationForEditing( ManagedRepository repositoryConfiguration )
     {
         Configuration configuration = new Configuration();
-        configuration.addManagedRepository( repositoryConfiguration );
+        configuration.addManagedRepository(
+            new BeanReplicator().replicateBean( repositoryConfiguration, ManagedRepositoryConfiguration.class ) );
         return configuration;
     }
 
-    private ManagedRepositoryConfiguration createRepository()
+    private ManagedRepository createRepository()
     {
-        ManagedRepositoryConfiguration r = new ManagedRepositoryConfiguration();
+        ManagedRepository r = new ManagedRepository();
         r.setId( REPO_ID );
         r.setName( "repo name" );
         r.setLocation( location.getAbsolutePath() );
         r.setLayout( "default" );
-        r.setRefreshCronExpression( "* 0/5 * * * ?" );
+        r.setCronExpression( "* 0/5 * * * ?" );
         r.setDaysOlder( 0 );
         r.setRetentionCount( 0 );
         r.setReleases( true );
index 429be1242daa993c680ef95bfbefb5f69ec3f4c3..8493e47eec5c2ddf9c9996a53044a9866c0db146 100644 (file)
@@ -20,9 +20,9 @@ package org.apache.maven.archiva.web.action.admin.repositories;
  */
 
 import com.opensymphony.xwork2.Action;
-import org.apache.archiva.admin.repository.RepositoryAdminException;
+import org.apache.archiva.admin.model.RepositoryAdminException;
+import org.apache.archiva.admin.model.remote.RemoteRepository;
 import org.apache.archiva.admin.repository.remote.DefaultRemoteRepositoryAdmin;
-import org.apache.archiva.admin.repository.remote.RemoteRepository;
 import org.apache.maven.archiva.configuration.ArchivaConfiguration;
 import org.apache.maven.archiva.configuration.Configuration;
 import org.apache.maven.archiva.configuration.IndeterminateConfigurationException;
index bcf3d58ebfec573013a0809bef97aeee5ad67510..239f25fc25381ea3a050b8c8d4efbf5168c1b2b0 100644 (file)
@@ -20,6 +20,8 @@ package org.apache.maven.archiva.web.action.admin.repositories;
  */
 
 import com.opensymphony.xwork2.Action;
+import org.apache.archiva.admin.model.RepositoryAdminException;
+import org.apache.archiva.admin.model.group.RepositoryGroup;
 import org.apache.maven.archiva.configuration.ArchivaConfiguration;
 import org.apache.maven.archiva.configuration.Configuration;
 import org.apache.maven.archiva.configuration.RepositoryGroupConfiguration;
@@ -58,7 +60,7 @@ public class DeleteRepositoryGroupActionTest
     }
 
     public void testSecureActionBundle()
-        throws SecureActionException
+        throws SecureActionException, RepositoryAdminException
     {
         archivaConfiguration.getConfiguration();
         archivaConfigurationControl.setReturnValue( new Configuration() );
@@ -84,7 +86,7 @@ public class DeleteRepositoryGroupActionTest
 
         action.prepare();
         assertEquals( REPO_GROUP_ID, action.getRepoGroupId() );
-        RepositoryGroupConfiguration repoGroup = action.getRepositoryGroup();
+        RepositoryGroup repoGroup = action.getRepositoryGroup();
         assertNotNull( repoGroup );
         assertEquals( repoGroup.getId(), action.getRepoGroupId() );
         assertEquals( Collections.singletonList( origRepoGroup ), configuration.getRepositoryGroups() );
@@ -104,7 +106,7 @@ public class DeleteRepositoryGroupActionTest
 
         action.prepare();
         assertEquals( REPO_GROUP_ID, action.getRepoGroupId() );
-        RepositoryGroupConfiguration repoGroup = action.getRepositoryGroup();
+        RepositoryGroup repoGroup = action.getRepositoryGroup();
         assertNotNull( repoGroup );
         assertEquals( Collections.singletonList( repoGroup ), configuration.getRepositoryGroups() );
 
@@ -129,7 +131,7 @@ public class DeleteRepositoryGroupActionTest
 
         action.prepare();
         assertEquals( REPO_GROUP_ID, action.getRepoGroupId() );
-        RepositoryGroupConfiguration repoGroup = action.getRepositoryGroup();
+        RepositoryGroup repoGroup = action.getRepositoryGroup();
         assertNotNull( repoGroup );
 
         String status = action.execute();
index bbad0454b03712469ee255376a91c5db19789e45..bda4130328c4b14d61a7595b4ef54e27500e2f77 100644 (file)
@@ -20,10 +20,10 @@ package org.apache.maven.archiva.web.action.admin.repositories;
  */
 
 import com.opensymphony.xwork2.Action;
-import org.apache.archiva.admin.repository.RepositoryAdminException;
+import org.apache.archiva.admin.model.RepositoryAdminException;
+import org.apache.archiva.admin.model.managed.ManagedRepository;
 import org.apache.archiva.admin.repository.RepositoryCommonValidator;
 import org.apache.archiva.admin.repository.managed.DefaultManagedRepositoryAdmin;
-import org.apache.archiva.admin.repository.managed.ManagedRepository;
 import org.apache.archiva.audit.AuditListener;
 import org.apache.archiva.metadata.repository.MetadataRepository;
 import org.apache.archiva.metadata.repository.RepositorySession;
@@ -31,12 +31,12 @@ import org.apache.archiva.metadata.repository.memory.TestRepositorySessionFactor
 import org.apache.archiva.metadata.repository.stats.RepositoryStatisticsManager;
 import org.apache.archiva.scheduler.repository.RepositoryArchivaTaskScheduler;
 import org.apache.archiva.scheduler.repository.RepositoryTask;
+import org.apache.archiva.security.ArchivaRoleConstants;
+import org.apache.archiva.web.validator.utils.ValidatorUtil;
 import org.apache.commons.io.FileUtils;
 import org.apache.maven.archiva.configuration.ArchivaConfiguration;
 import org.apache.maven.archiva.configuration.Configuration;
 import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
-import org.apache.archiva.security.ArchivaRoleConstants;
-import org.apache.archiva.web.validator.utils.ValidatorUtil;
 import org.codehaus.plexus.redback.role.RoleManager;
 import org.codehaus.plexus.registry.Registry;
 import org.codehaus.redback.integration.interceptor.SecureActionBundle;
index 3d6ca071994489a657a2da76cbb0c6cd640cdbfe..f89c14598e853f251c79c9207438ede3847d186b 100644 (file)
@@ -20,9 +20,9 @@ package org.apache.maven.archiva.web.action.admin.repositories;
  */
 
 import com.opensymphony.xwork2.Action;
-import org.apache.archiva.admin.repository.RepositoryAdminException;
+import org.apache.archiva.admin.model.RepositoryAdminException;
+import org.apache.archiva.admin.model.remote.RemoteRepository;
 import org.apache.archiva.admin.repository.remote.DefaultRemoteRepositoryAdmin;
-import org.apache.archiva.admin.repository.remote.RemoteRepository;
 import org.apache.maven.archiva.configuration.ArchivaConfiguration;
 import org.apache.maven.archiva.configuration.Configuration;
 import org.apache.maven.archiva.configuration.RemoteRepositoryConfiguration;
index 92e14d50a12e4c330eea8faa40a0679e29a057c8..844778aa947d34732b443d9546392ac971d909cf 100644 (file)
@@ -22,9 +22,9 @@ package org.apache.maven.archiva.web.action.admin.repositories;
 import com.meterware.servletunit.ServletRunner;
 import com.meterware.servletunit.ServletUnitClient;
 import com.opensymphony.xwork2.Action;
-import org.apache.archiva.admin.repository.RepositoryAdminException;
+import org.apache.archiva.admin.model.RepositoryAdminException;
+import org.apache.archiva.admin.model.group.RepositoryGroup;
 import org.apache.archiva.admin.repository.group.DefaultRepositoryGroupAdmin;
-import org.apache.archiva.admin.repository.group.RepositoryGroup;
 import org.apache.archiva.admin.repository.managed.DefaultManagedRepositoryAdmin;
 import org.apache.maven.archiva.configuration.ArchivaConfiguration;
 import org.apache.maven.archiva.configuration.Configuration;
index 1be3a0551e03e8b1071f785ea39de5f919db571e..2bc0f3e82689d2c06ec54ea01e7ffe6259436b8a 100644 (file)
@@ -52,7 +52,7 @@
     </dependency>
     <dependency>
       <groupId>org.apache.archiva</groupId>
-      <artifactId>archiva-repository-admin</artifactId>
+      <artifactId>archiva-repository-admin-api</artifactId>
     </dependency>
     <dependency>
       <groupId>org.apache.archiva</groupId>
       <artifactId>httpunit</artifactId>
       <scope>test</scope>
     </dependency>
+    <dependency>
+      <groupId>org.apache.archiva</groupId>
+      <artifactId>archiva-repository-admin-default</artifactId>
+      <scope>test</scope>
+    </dependency>
   </dependencies>
   <build>
     <plugins>
index 99a490fbff8735a83b393c2a9f241e4588dee370..7797d534b5960b638f479d35405ce4a0db2c6ce6 100644 (file)
@@ -19,6 +19,7 @@ package org.apache.maven.archiva.webdav;
  * under the License.
  */
 
+import org.apache.archiva.admin.model.managed.ManagedRepository;
 import org.apache.archiva.audit.AuditEvent;
 import org.apache.archiva.audit.AuditListener;
 import org.apache.archiva.scheduler.ArchivaTaskScheduler;
@@ -90,7 +91,7 @@ public class ArchivaDavResource
 
     private String remoteAddr;
 
-    private final ManagedRepositoryConfiguration repository;
+    private final ManagedRepository repository;
 
     private final MimeTypes mimeTypes;
 
@@ -104,7 +105,7 @@ public class ArchivaDavResource
 
     private Logger log = LoggerFactory.getLogger( ArchivaDavResource.class );
 
-    public ArchivaDavResource( String localResource, String logicalResource, ManagedRepositoryConfiguration repository,
+    public ArchivaDavResource( String localResource, String logicalResource, ManagedRepository repository,
                                DavSession session, ArchivaDavResourceLocator locator, DavResourceFactory factory,
                                MimeTypes mimeTypes, List<AuditListener> auditListeners,
                                RepositoryArchivaTaskScheduler scheduler )
@@ -124,7 +125,7 @@ public class ArchivaDavResource
         this.scheduler = scheduler;
     }
 
-    public ArchivaDavResource( String localResource, String logicalResource, ManagedRepositoryConfiguration repository,
+    public ArchivaDavResource( String localResource, String logicalResource, ManagedRepository repository,
                                String remoteAddr, String principal, DavSession session,
                                ArchivaDavResourceLocator locator, DavResourceFactory factory, MimeTypes mimeTypes,
                                List<AuditListener> auditListeners, RepositoryArchivaTaskScheduler scheduler )
index 2aabf858a71c3cb46a7eaee4faf180c7da6f5e2f..224e0a9285a173e046bb2d76c692a3e1dc9622ef 100644 (file)
@@ -19,9 +19,9 @@ package org.apache.maven.archiva.webdav;
  * under the License.
  */
 
-import org.apache.archiva.admin.repository.RepositoryAdminException;
-import org.apache.archiva.admin.repository.managed.ManagedRepository;
-import org.apache.archiva.admin.repository.managed.ManagedRepositoryAdmin;
+import org.apache.archiva.admin.model.RepositoryAdminException;
+import org.apache.archiva.admin.model.managed.ManagedRepository;
+import org.apache.archiva.admin.model.managed.ManagedRepositoryAdmin;
 import org.apache.archiva.security.ServletAuthenticator;
 import org.apache.jackrabbit.webdav.DavException;
 import org.apache.jackrabbit.webdav.DavLocatorFactory;
index fc1370c52b840a8c7011e7e30d18655143e36aa8..571b2015d0f88cbc087065fcf529ec83416782ae 100644 (file)
@@ -36,67 +36,66 @@ public class TestMetadataRepository
 {
     public ProjectMetadata getProject( String repoId, String namespace, String projectId )
     {
-        return null;  //To change body of implemented methods use File | Settings | File Templates.
+        return null;
     }
 
     public ProjectVersionMetadata getProjectVersion( String repoId, String namespace, String projectId,
                                                      String projectVersion )
     {
-        return null;  //To change body of implemented methods use File | Settings | File Templates.
+        return null;
     }
 
     public Collection<String> getArtifactVersions( String repoId, String namespace, String projectId,
                                                    String projectVersion )
     {
-        return null;  //To change body of implemented methods use File | Settings | File Templates.
+        return null;
     }
 
     public Collection<ProjectVersionReference> getProjectReferences( String repoId, String namespace, String projectId,
                                                                      String projectVersion )
     {
-        return null;  //To change body of implemented methods use File | Settings | File Templates.
+        return null;
     }
 
     public Collection<String> getRootNamespaces( String repoId )
     {
-        return null;  //To change body of implemented methods use File | Settings | File Templates.
+        return null;
     }
 
     public Collection<String> getNamespaces( String repoId, String namespace )
     {
-        return null;  //To change body of implemented methods use File | Settings | File Templates.
+        return null;
     }
 
     public Collection<String> getProjects( String repoId, String namespace )
     {
-        return null;  //To change body of implemented methods use File | Settings | File Templates.
+        return null;
     }
 
     public Collection<String> getProjectVersions( String repoId, String namespace, String projectId )
     {
-        return null;  //To change body of implemented methods use File | Settings | File Templates.
+        return null;
     }
 
     public void updateProject( String repoId, ProjectMetadata project )
     {
-        //To change body of implemented methods use File | Settings | File Templates.
     }
 
     public void updateArtifact( String repoId, String namespace, String projectId, String projectVersion,
                                 ArtifactMetadata artifactMeta )
     {
-        //To change body of implemented methods use File | Settings | File Templates.
+
     }
 
     public void updateProjectVersion( String repoId, String namespace, String projectId,
                                       ProjectVersionMetadata versionMetadata )
     {
-        //To change body of implemented methods use File | Settings | File Templates.
+
     }
 
     public void updateNamespace( String repoId, String namespace )
     {
-        //To change body of implemented methods use File | Settings | File Templates.
+
     }
 
     public List<String> getMetadataFacets( String repodId, String facetId )
@@ -106,78 +105,78 @@ public class TestMetadataRepository
 
     public MetadataFacet getMetadataFacet( String repositoryId, String facetId, String name )
     {
-        return null;  //To change body of implemented methods use File | Settings | File Templates.
+        return null;
     }
 
     public void addMetadataFacet( String repositoryId, MetadataFacet metadataFacet )
     {
-        //To change body of implemented methods use File | Settings | File Templates.
+
     }
 
     public void removeMetadataFacets( String repositoryId, String facetId )
     {
-        //To change body of implemented methods use File | Settings | File Templates.
+
     }
 
     public void removeMetadataFacet( String repoId, String facetId, String name )
     {
-        //To change body of implemented methods use File | Settings | File Templates.
+
     }
 
     public List<ArtifactMetadata> getArtifactsByDateRange( String repoId, Date startTime, Date endTime )
     {
-        return null;  //To change body of implemented methods use File | Settings | File Templates.
+        return null;
     }
 
     public Collection<String> getRepositories()
     {
-        return null;  //To change body of implemented methods use File | Settings | File Templates.
+        return null;
     }
 
     public List<ArtifactMetadata> getArtifactsByChecksum( String repoId, String checksum )
     {
-        return null;  //To change body of implemented methods use File | Settings | File Templates.
+        return null;
     }
 
     public void removeArtifact( String repositoryId, String namespace, String project, String version, String id )
     {
-        //To change body of implemented methods use File | Settings | File Templates.
+
     }
 
     public void removeRepository( String repoId )
     {
-        //To change body of implemented methods use File | Settings | File Templates.
+
     }
 
     public Collection<ArtifactMetadata> getArtifacts( String repoId, String namespace, String projectId,
                                                       String projectVersion )
     {
-        return null;  //To change body of implemented methods use File | Settings | File Templates.
+        return null;
     }
 
     public void save()
     {
-        //To change body of implemented methods use File | Settings | File Templates.
+
     }
 
     public void close()
     {
-        //To change body of implemented methods use File | Settings | File Templates.
+
     }
 
     public void revert()
     {
-        //To change body of implemented methods use File | Settings | File Templates.
+
     }
 
     public boolean canObtainAccess( Class<?> aClass )
     {
-        return false;  //To change body of implemented methods use File | Settings | File Templates.
+        return false;
     }
 
     public Object obtainAccess( Class<?> aClass )
     {
-        return null;  //To change body of implemented methods use File | Settings | File Templates.
+        return null;
     }
 
     public List<ArtifactMetadata> getArtifacts( String repositoryId )
index cab60b2ec8048f0c517945b16cbcce8f5e09dee8..3409dcc4bb24111e510c780c2878d3a6d28db357 100644 (file)
@@ -26,7 +26,7 @@ import com.meterware.servletunit.ServletUnitClient;
 import junit.framework.Assert;
 import junit.framework.TestCase;
 import net.sf.ehcache.CacheManager;
-import org.apache.archiva.admin.repository.managed.ManagedRepository;
+import org.apache.archiva.admin.model.managed.ManagedRepository;
 import org.apache.commons.io.FileUtils;
 import org.apache.maven.archiva.configuration.ArchivaConfiguration;
 import org.apache.maven.archiva.configuration.Configuration;
index b4a355ac960e55399b717e3f292e06707d6ad876..2853b2a169006b37d905507af3f3cadff484dfb0 100644 (file)
@@ -20,6 +20,11 @@ package org.apache.maven.archiva.webdav;
  */
 
 import junit.framework.TestCase;
+import org.apache.archiva.admin.model.RepositoryAdminException;
+import org.apache.archiva.admin.model.group.RepositoryGroup;
+import org.apache.archiva.admin.model.managed.ManagedRepository;
+import org.apache.archiva.admin.repository.group.DefaultRepositoryGroupAdmin;
+import org.apache.archiva.admin.repository.managed.DefaultManagedRepositoryAdmin;
 import org.apache.archiva.common.plexusbridge.PlexusSisuBridge;
 import org.apache.archiva.common.plexusbridge.PlexusSisuBridgeException;
 import org.apache.commons.io.FileUtils;
@@ -29,7 +34,6 @@ import org.apache.jackrabbit.webdav.DavServletRequest;
 import org.apache.jackrabbit.webdav.DavServletResponse;
 import org.apache.maven.archiva.configuration.ArchivaConfiguration;
 import org.apache.maven.archiva.configuration.Configuration;
-import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
 import org.apache.maven.archiva.configuration.RepositoryGroupConfiguration;
 import org.apache.maven.archiva.proxy.DefaultRepositoryProxyConnectors;
 import org.apache.maven.archiva.repository.ManagedRepositoryContent;
@@ -101,6 +105,13 @@ public class ArchivaDavResourceFactoryTest
     @Inject
     PlexusSisuBridge plexusSisuBridge;
 
+    @Inject
+    DefaultManagedRepositoryAdmin defaultManagedRepositoryAdmin;
+
+    @Inject
+    DefaultRepositoryGroupAdmin defaultRepositoryGroupAdmin;
+
+
     @Before
     public void setUp()
         throws Exception
@@ -118,19 +129,36 @@ public class ArchivaDavResourceFactoryTest
         archivaConfiguration = (ArchivaConfiguration) archivaConfigurationControl.getMock();
 
         config = new Configuration();
-        config.addManagedRepository(
-            createManagedRepository( RELEASES_REPO, new File( "target/test-classes/" + RELEASES_REPO ).getPath(),
-                                     "default" ) );
-        config.addManagedRepository(
-            createManagedRepository( INTERNAL_REPO, new File( "target/test-classes/" + INTERNAL_REPO ).getPath(),
-                                     "default" ) );
-
-        RepositoryGroupConfiguration repoGroupConfig = new RepositoryGroupConfiguration();
+        archivaConfiguration.getConfiguration();
+        archivaConfigurationControl.setReturnValue( config, 5, 20 );
+        archivaConfiguration.save( config );
+        archivaConfigurationControl.setVoidCallable( 1, 4 );
+        archivaConfigurationControl.replay();
+
+        defaultManagedRepositoryAdmin.setArchivaConfiguration( archivaConfiguration );
+        defaultManagedRepositoryAdmin.getRepositoryCommonValidator().setArchivaConfiguration( archivaConfiguration );
+        if ( defaultManagedRepositoryAdmin.getManagedRepository( RELEASES_REPO ) == null )
+        {
+            defaultManagedRepositoryAdmin.addManagedRepository(
+                createManagedRepository( RELEASES_REPO, new File( "target/test-classes/" + RELEASES_REPO ).getPath(),
+                                         "default" ), false, null );
+        }
+        if ( defaultManagedRepositoryAdmin.getManagedRepository( INTERNAL_REPO ) == null )
+        {
+            defaultManagedRepositoryAdmin.addManagedRepository(
+                createManagedRepository( INTERNAL_REPO, new File( "target/test-classes/" + INTERNAL_REPO ).getPath(),
+                                         "default" ), false, null );
+        }
+        RepositoryGroup repoGroupConfig = new RepositoryGroup();
         repoGroupConfig.setId( LOCAL_REPO_GROUP );
         repoGroupConfig.addRepository( RELEASES_REPO );
         repoGroupConfig.addRepository( INTERNAL_REPO );
 
-        config.addRepositoryGroup( repoGroupConfig );
+        defaultRepositoryGroupAdmin.setArchivaConfiguration( archivaConfiguration );
+        if ( defaultManagedRepositoryAdmin.getManagedRepository( LOCAL_REPO_GROUP ) == null )
+        {
+            defaultRepositoryGroupAdmin.addRepositoryGroup( repoGroupConfig, null );
+        }
 
         repoContentFactoryControl = MockClassControl.createControl( RepositoryContentFactory.class );
         repoFactory = (RepositoryContentFactory) repoContentFactoryControl.getMock();
@@ -146,9 +174,9 @@ public class ArchivaDavResourceFactoryTest
         resourceFactory.setConnectors( new OverridingRepositoryProxyConnectors() );
     }
 
-    private ManagedRepositoryConfiguration createManagedRepository( String id, String location, String layout )
+    private ManagedRepository createManagedRepository( String id, String location, String layout )
     {
-        ManagedRepositoryConfiguration repoConfig = new ManagedRepositoryConfiguration();
+        ManagedRepository repoConfig = new ManagedRepository();
         repoConfig.setId( id );
         repoConfig.setName( id );
         repoConfig.setLocation( location );
@@ -158,9 +186,10 @@ public class ArchivaDavResourceFactoryTest
     }
 
     private ManagedRepositoryContent createManagedRepositoryContent( String repoId )
+        throws RepositoryAdminException
     {
         ManagedRepositoryContent repoContent = new ManagedDefaultRepositoryContent();
-        repoContent.setRepository( config.findManagedRepositoryById( repoId ) );
+        repoContent.setRepository( defaultManagedRepositoryAdmin.getManagedRepository( repoId ) );
 
         return repoContent;
     }
@@ -182,13 +211,15 @@ public class ArchivaDavResourceFactoryTest
                                                                     new ArchivaDavLocatorFactory() );
 
         ManagedRepositoryContent internalRepo = createManagedRepositoryContent( INTERNAL_REPO );
+        ManagedRepositoryContent releasesRepo = createManagedRepositoryContent( RELEASES_REPO );
 
         try
         {
+            archivaConfigurationControl.reset();
             archivaConfigurationControl.expectAndReturn( archivaConfiguration.getConfiguration(), config );
             requestControl.expectAndReturn( request.getMethod(), "GET", 2 );
             repoContentFactoryControl.expectAndReturn( repoFactory.getManagedRepositoryContent( RELEASES_REPO ),
-                                                       createManagedRepositoryContent( RELEASES_REPO ) );
+                                                       releasesRepo );
             requestControl.expectAndReturn( request.getRemoteAddr(), "http://localhost:8080", 2 );
             requestControl.expectAndReturn( request.getDavSession(), new ArchivaDavSession(), 2 );
             repoRequestControl.expectAndReturn(
@@ -247,14 +278,17 @@ public class ArchivaDavResourceFactoryTest
 
         ManagedRepositoryContent internalRepo = createManagedRepositoryContent( INTERNAL_REPO );
 
+        ManagedRepositoryContent releasesRepo = createManagedRepositoryContent( RELEASES_REPO );
+
         try
         {
+            archivaConfigurationControl.reset();
             archivaConfigurationControl.expectAndReturn( archivaConfiguration.getConfiguration(), config );
             requestControl.expectAndReturn( request.getMethod(), "GET", 2 );
             repoContentFactoryControl.expectAndReturn( repoFactory.getManagedRepositoryContent( INTERNAL_REPO ),
                                                        internalRepo );
             repoContentFactoryControl.expectAndReturn( repoFactory.getManagedRepositoryContent( RELEASES_REPO ),
-                                                       createManagedRepositoryContent( RELEASES_REPO ) );
+                                                       releasesRepo );
             requestControl.expectAndReturn( request.getRemoteAddr(), "http://localhost:8080", 2 );
             requestControl.expectAndReturn( request.getDavSession(), new ArchivaDavSession(), 2 );
             repoRequestControl.expectAndReturn(
@@ -299,9 +333,9 @@ public class ArchivaDavResourceFactoryTest
             + "/org/apache/archiva/archiva/1.2-SNAPSHOT/archiva-1.2-SNAPSHOT.jar", LOCAL_REPO_GROUP,
                                                                     new ArchivaDavLocatorFactory() );
 
-        config.addManagedRepository(
+        defaultManagedRepositoryAdmin.addManagedRepository(
             createManagedRepository( LOCAL_MIRROR_REPO, new File( "target/test-classes/local-mirror" ).getPath(),
-                                     "default" ) );
+                                     "default" ), false, null );
 
         List<RepositoryGroupConfiguration> repoGroups = new ArrayList<RepositoryGroupConfiguration>();
         RepositoryGroupConfiguration repoGroup = new RepositoryGroupConfiguration();
@@ -318,6 +352,7 @@ public class ArchivaDavResourceFactoryTest
 
         try
         {
+            archivaConfigurationControl.reset();
             archivaConfigurationControl.expectAndReturn( archivaConfiguration.getConfiguration(), config );
             requestControl.expectAndReturn( request.getMethod(), "GET", 4 );
             repoContentFactoryControl.expectAndReturn( repoFactory.getManagedRepositoryContent( INTERNAL_REPO ),
@@ -384,6 +419,7 @@ public class ArchivaDavResourceFactoryTest
 
         try
         {
+            archivaConfigurationControl.reset();
             archivaConfigurationControl.expectAndReturn( archivaConfiguration.getConfiguration(), config );
             repoContentFactoryControl.expectAndReturn( repoFactory.getManagedRepositoryContent( INTERNAL_REPO ),
                                                        internalRepo );
@@ -438,6 +474,7 @@ public class ArchivaDavResourceFactoryTest
 
         try
         {
+            archivaConfigurationControl.reset();
             archivaConfigurationControl.expectAndReturn( archivaConfiguration.getConfiguration(), config );
             repoContentFactoryControl.expectAndReturn( repoFactory.getManagedRepositoryContent( INTERNAL_REPO ),
                                                        internalRepo );
@@ -467,9 +504,9 @@ public class ArchivaDavResourceFactoryTest
     public void testRequestMetadataRepoIsLegacy()
         throws Exception
     {
-        config.addManagedRepository(
+        defaultManagedRepositoryAdmin.addManagedRepository(
             createManagedRepository( LEGACY_REPO, new File( "target/test-classes/" + LEGACY_REPO ).getPath(),
-                                     "legacy" ) );
+                                     "legacy" ), false, null );
         DavResourceLocator locator =
             new ArchivaDavResourceLocator( "", "/repository/" + LEGACY_REPO + "/eclipse/maven-metadata.xml",
                                            LEGACY_REPO, new ArchivaDavLocatorFactory() );
@@ -482,6 +519,7 @@ public class ArchivaDavResourceFactoryTest
 
         try
         {
+            archivaConfigurationControl.reset();
             archivaConfigurationControl.expectAndReturn( archivaConfiguration.getConfiguration(), config );
             repoContentFactoryControl.expectAndReturn( repoFactory.getManagedRepositoryContent( LEGACY_REPO ),
                                                        legacyRepo );
index c737f8e6894b7bb55c8425ab43426287caf0d7f3..b62758df3d23be58d3e942e7d7581e133f519dd5 100644 (file)
@@ -20,6 +20,7 @@ package org.apache.maven.archiva.webdav;
  */
 
 import junit.framework.TestCase;
+import org.apache.archiva.admin.model.managed.ManagedRepository;
 import org.apache.archiva.audit.AuditListener;
 import org.apache.commons.io.FileUtils;
 import org.apache.jackrabbit.webdav.DavException;
@@ -72,7 +73,7 @@ public class DavResourceTest
 
     private LockManager lockManager;
 
-    private ManagedRepositoryConfiguration repository = new ManagedRepositoryConfiguration();
+    private ManagedRepository repository = new ManagedRepository();
     
     @Override
     @Before
index 835eaf9bbdb0d8bbf672e2e96bc7e42766b410da..a9c21d21ea094bce33589f2fe2bd70327a2d05b0 100644 (file)
@@ -19,15 +19,13 @@ package org.apache.maven.archiva.webdav;
  * under the License.
  */
 
-import org.apache.archiva.admin.repository.managed.ManagedRepository;
-import org.apache.maven.archiva.configuration.ArchivaConfiguration;
-import org.apache.maven.archiva.configuration.Configuration;
-import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
-import org.apache.maven.archiva.webdav.RepositoryServlet;
-
 import com.meterware.httpunit.GetMethodWebRequest;
 import com.meterware.httpunit.WebRequest;
 import com.meterware.httpunit.WebResponse;
+import org.apache.archiva.admin.model.managed.ManagedRepository;
+import org.apache.maven.archiva.configuration.ArchivaConfiguration;
+import org.apache.maven.archiva.configuration.Configuration;
+import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
 import org.junit.Test;
 
 import java.io.File;
index 2105b3b4575d7eca471298608f9470011a74346c..5f221617ae21ce30b2be0fecb0c98dfafd76a4d0 100644 (file)
@@ -19,19 +19,19 @@ package org.apache.maven.archiva.webdav;
  * under the License.
  */
 
-import java.util.List;
-
+import org.apache.archiva.admin.model.admin.ArchivaAdministration;
 import org.apache.archiva.repository.scanner.RepositoryContentConsumers;
-import org.apache.maven.archiva.configuration.ArchivaConfiguration;
 import org.apache.maven.archiva.consumers.InvalidRepositoryContentConsumer;
 import org.apache.maven.archiva.consumers.KnownRepositoryContentConsumer;
 
+import java.util.List;
+
 public class StubRepositoryContentConsumers
     extends RepositoryContentConsumers
 {
-    public StubRepositoryContentConsumers(ArchivaConfiguration configuration)
+    public StubRepositoryContentConsumers( ArchivaAdministration archivaAdministration )
     {
-        super(configuration);
+        super( archivaAdministration );
     }
 
     @Override
index f5bd767e03cfc23027ea144293f27fa4c94e932c..cb4d130ac7745cc43d2ef31dda7769b6dfcda59b 100644 (file)
@@ -19,7 +19,7 @@ package org.apache.maven.archiva.webdav;
  * under the License.
  */
 
-import org.apache.archiva.admin.repository.RepositoryAdminException;
+import org.apache.archiva.admin.model.RepositoryAdminException;
 
 import javax.servlet.ServletConfig;
 
index 8dce1e56d445c8e849ac387a0166ea98049fe06d..2ffae6d769bd259b7a3b9c6da40be983a1c37acd 100644 (file)
@@ -37,7 +37,7 @@
     </dependency>
     <dependency>
       <groupId>org.apache.archiva</groupId>
-      <artifactId>archiva-repository-admin</artifactId>
+      <artifactId>archiva-repository-admin-api</artifactId>
     </dependency>
     <dependency>
       <groupId>com.atlassian.xmlrpc</groupId>
index f50bab5e9d4886a75ca96bc1a32a6436f30b29d1..3fe121b2f32f328e2f1e1737e7893aa6aea26c5d 100644 (file)
@@ -20,7 +20,7 @@ package org.apache.archiva.web.xmlrpc.api;
  */
 
 import com.atlassian.xmlrpc.ServiceObject;
-import org.apache.archiva.admin.repository.RepositoryAdminException;
+import org.apache.archiva.admin.model.RepositoryAdminException;
 import org.apache.archiva.web.xmlrpc.api.beans.ManagedRepository;
 import org.apache.archiva.web.xmlrpc.api.beans.RemoteRepository;
 
index e6597f8453056806ec1bc6691b3a0869f0f73888..8a5ccc70307db39195897630a2b5f3b30c3da41e 100644 (file)
@@ -41,7 +41,7 @@
     </dependency>
     <dependency>
       <groupId>org.apache.archiva</groupId>
-      <artifactId>archiva-repository-admin</artifactId>
+      <artifactId>archiva-repository-admin-api</artifactId>
     </dependency>
     <dependency>
       <groupId>org.apache.archiva</groupId>
       <artifactId>mockito-all</artifactId>
       <scope>test</scope>
     </dependency>
+    <dependency>
+      <groupId>org.apache.archiva</groupId>
+      <artifactId>archiva-repository-admin-default</artifactId>
+      <scope>test</scope>
+    </dependency>
   </dependencies>
   <build>
     <pluginManagement>
index bdc558afd509f6602cd919e2ba8a089cc8c5d665..b7b0004d7ff9426bea28a0b74b35b14bbad045d6 100644 (file)
@@ -19,10 +19,10 @@ package org.apache.archiva.web.xmlrpc.services;
  * under the License.
  */
 
-import org.apache.archiva.admin.AuditInformation;
-import org.apache.archiva.admin.repository.RepositoryAdminException;
-import org.apache.archiva.admin.repository.managed.ManagedRepositoryAdmin;
-import org.apache.archiva.admin.repository.remote.RemoteRepositoryAdmin;
+import org.apache.archiva.admin.model.AuditInformation;
+import org.apache.archiva.admin.model.RepositoryAdminException;
+import org.apache.archiva.admin.model.managed.ManagedRepositoryAdmin;
+import org.apache.archiva.admin.model.remote.RemoteRepositoryAdmin;
 import org.apache.archiva.audit.AuditEvent;
 import org.apache.archiva.audit.AuditListener;
 import org.apache.archiva.metadata.model.ArtifactMetadata;
@@ -315,7 +315,7 @@ public class AdministrationServiceImpl
     {
         List<ManagedRepository> managedRepos = new ArrayList<ManagedRepository>();
 
-        for ( org.apache.archiva.admin.repository.managed.ManagedRepository repoConfig : managedRepositoryAdmin.getManagedRepositories() )
+        for ( org.apache.archiva.admin.model.managed.ManagedRepository repoConfig : managedRepositoryAdmin.getManagedRepositories() )
         {
             ManagedRepository repo =
                 new ManagedRepository( repoConfig.getId(), repoConfig.getName(), repoConfig.getLocation(),
@@ -334,7 +334,7 @@ public class AdministrationServiceImpl
     {
         List<RemoteRepository> remoteRepos = new ArrayList<RemoteRepository>();
 
-        for ( org.apache.archiva.admin.repository.remote.RemoteRepository repoConfig : remoteRepositoryAdmin.getRemoteRepositories() )
+        for ( org.apache.archiva.admin.model.remote.RemoteRepository repoConfig : remoteRepositoryAdmin.getRemoteRepositories() )
         {
             RemoteRepository repo = new RemoteRepository( repoConfig.getId(), repoConfig.getName(), repoConfig.getUrl(),
                                                           repoConfig.getLayout() );
@@ -368,8 +368,8 @@ public class AdministrationServiceImpl
         throws Exception
     {
 
-        org.apache.archiva.admin.repository.managed.ManagedRepository repository =
-            new org.apache.archiva.admin.repository.managed.ManagedRepository( repoId, name, location, layout,
+        org.apache.archiva.admin.model.managed.ManagedRepository repository =
+            new org.apache.archiva.admin.model.managed.ManagedRepository( repoId, name, location, layout,
                                                                                snapshotsIncluded, releasesIncluded,
                                                                                blockRedeployments, cronExpression, null,
                                                                                false, daysOlder, retentionCount,
index 8acdd2f4b9525838d63066e5d635426cc11e7645..cfedde318ac2f649ea93d6123e3a3da86a390d7a 100644 (file)
@@ -20,6 +20,7 @@ package org.apache.archiva.web.xmlrpc.services;
  */
 
 import junit.framework.TestCase;
+import net.sf.beanlib.provider.replicator.BeanReplicator;
 import org.apache.archiva.admin.repository.RepositoryCommonValidator;
 import org.apache.archiva.admin.repository.managed.DefaultManagedRepositoryAdmin;
 import org.apache.archiva.admin.repository.remote.DefaultRemoteRepositoryAdmin;
@@ -399,7 +400,8 @@ public class AdministrationServiceImplTest
         configControl.expectAndReturn( config.findManagedRepositoryById( "internal" ), managedRepo );
 
         ManagedDefaultRepositoryContent repoContent = new ManagedDefaultRepositoryContent();
-        repoContent.setRepository( managedRepo );
+        repoContent.setRepository( new BeanReplicator().replicateBean( managedRepo,
+                                                                       org.apache.archiva.admin.model.managed.ManagedRepository.class ) );
 
         repoFactoryControl.expectAndReturn( repositoryFactory.getManagedRepositoryContent( "internal" ), repoContent );
 
@@ -451,7 +453,8 @@ public class AdministrationServiceImplTest
         configControl.expectAndReturn( config.findManagedRepositoryById( "internal" ), managedRepo );
 
         ManagedLegacyRepositoryContent repoContent = new ManagedLegacyRepositoryContent();
-        repoContent.setRepository( managedRepo );
+        repoContent.setRepository( new BeanReplicator().replicateBean( managedRepo,
+                                                                       org.apache.archiva.admin.model.managed.ManagedRepository.class ) );
         repoContent.setFileTypes( fileTypes );
         repoContent.setLegacyPathParser( parser );
 
@@ -511,7 +514,8 @@ public class AdministrationServiceImplTest
         configControl.expectAndReturn( config.findManagedRepositoryById( "internal" ), managedRepo );
 
         ManagedDefaultRepositoryContent repoContent = new ManagedDefaultRepositoryContent();
-        repoContent.setRepository( managedRepo );
+        repoContent.setRepository( new BeanReplicator().replicateBean( managedRepo,
+                                                                       org.apache.archiva.admin.model.managed.ManagedRepository.class ) );
 
         repoFactoryControl.expectAndReturn( repositoryFactory.getManagedRepositoryContent( "internal" ), repoContent );
 
index 697cab1a76c29a878e0c85a3995ccd6743c996b5..241f317f2dc7ffc1bb9334fb513027504bbf442e 100644 (file)
       <groupId>org.apache.archiva</groupId>
       <artifactId>metadata-repository-api</artifactId>
     </dependency>
+    <!-- FIXME this deps must be removed -->
+    <dependency>
+      <groupId>org.apache.archiva</groupId>
+      <artifactId>archiva-configuration</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.archiva</groupId>
+      <artifactId>archiva-repository-admin-api</artifactId>
+    </dependency>
     <dependency>
       <groupId>org.apache.archiva</groupId>
       <artifactId>archiva-checksum</artifactId>
index bb033fd28ff03ba9f4a3cf376c117f9f2ea17a24..235094dd7460ad6fc18684811ad8299b2848a000 100644 (file)
@@ -19,6 +19,7 @@ package org.apache.archiva.reports.consumers;
  * under the License.
  */
 
+import org.apache.archiva.admin.model.managed.ManagedRepository;
 import org.apache.archiva.checksum.ChecksumAlgorithm;
 import org.apache.archiva.checksum.ChecksummedFile;
 import org.apache.archiva.metadata.model.ArtifactMetadata;
@@ -32,7 +33,6 @@ import org.apache.commons.collections.CollectionUtils;
 import org.apache.maven.archiva.configuration.ArchivaConfiguration;
 import org.apache.maven.archiva.configuration.ConfigurationNames;
 import org.apache.maven.archiva.configuration.FileTypes;
-import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
 import org.apache.maven.archiva.consumers.AbstractMonitoredConsumer;
 import org.apache.maven.archiva.consumers.ConsumerException;
 import org.apache.maven.archiva.consumers.KnownRepositoryContentConsumer;
@@ -138,7 +138,7 @@ public class DuplicateArtifactsConsumer
         return Collections.emptyList();
     }
 
-    public void beginScan( ManagedRepositoryConfiguration repo, Date whenGathered )
+    public void beginScan( ManagedRepository repo, Date whenGathered )
         throws ConsumerException
     {
         repoId = repo.getId();
@@ -146,7 +146,7 @@ public class DuplicateArtifactsConsumer
         repositorySession = repositorySessionFactory.createSession();
     }
 
-    public void beginScan( ManagedRepositoryConfiguration repo, Date whenGathered, boolean executeOnEntireRepo )
+    public void beginScan( ManagedRepository repo, Date whenGathered, boolean executeOnEntireRepo )
         throws ConsumerException
     {
         beginScan( repo, whenGathered );
index 359f7a4998a6c2c9f916005dac33d5b6389b8e37..fb1cc6bb062a8b5678053f538caf96180477e353 100644 (file)
@@ -20,6 +20,7 @@ package org.apache.archiva.reports.consumers;
  */
 
 import junit.framework.TestCase;
+import org.apache.archiva.admin.model.managed.ManagedRepository;
 import org.apache.archiva.metadata.model.ArtifactMetadata;
 import org.apache.archiva.metadata.model.MetadataFacet;
 import org.apache.archiva.metadata.repository.MetadataRepository;
@@ -57,7 +58,7 @@ public class DuplicateArtifactsConsumerTest
     @Named( value = "knownRepositoryContentConsumer#duplicate-artifacts" )
     private DuplicateArtifactsConsumer consumer;
 
-    private ManagedRepositoryConfiguration config;
+    private ManagedRepository config;
 
     private MetadataRepository metadataRepository;
 
@@ -92,7 +93,7 @@ public class DuplicateArtifactsConsumerTest
 
         assertNotNull( consumer );
 
-        config = new ManagedRepositoryConfiguration();
+        config = new ManagedRepository();
         config.setId( TEST_REPO );
         config.setLocation( new File( "target/test-repository" ).getAbsolutePath() );
 
diff --git a/pom.xml b/pom.xml
index 3e35d4c9de7520b6ba9d1ffc586799905eba9516..e04378727bf50150fe72845e98412a48bc9a2a67 100644 (file)
--- a/pom.xml
+++ b/pom.xml
       </dependency>
       <dependency>
         <groupId>org.apache.archiva</groupId>
-        <artifactId>archiva-repository-admin</artifactId>
+        <artifactId>archiva-repository-admin-api</artifactId>
+        <version>${project.version}</version>
+      </dependency>
+      <dependency>
+        <groupId>org.apache.archiva</groupId>
+        <artifactId>archiva-repository-admin-default</artifactId>
         <version>${project.version}</version>
       </dependency>
       <dependency>
       </dependency>
 
       <!-- redback -->
+      <dependency>
+        <groupId>org.codehaus.redback</groupId>
+        <artifactId>redback-users-api</artifactId>
+        <version>${redback.version}</version>
+      </dependency>
 
       <dependency>
         <groupId>org.codehaus.redback</groupId>
           </exclusion>
         </exclusions>
       </dependency>
+      <dependency>
+        <groupId>org.codehaus.redback</groupId>
+        <artifactId>redback-rbac-cached</artifactId>
+        <version>${redback.version}</version>
+        <exclusions>
+          <exclusion>
+            <groupId>commons-logging</groupId>
+            <artifactId>commons-logging</artifactId>
+          </exclusion>
+        </exclusions>
+      </dependency>
       <dependency>
         <groupId>org.codehaus.redback</groupId>
         <artifactId>redback-struts2-content</artifactId>