From cfaf9559dd58f0b52ddd3bb906ff5f428c7e6486 Mon Sep 17 00:00:00 2001 From: Olivier Lamy Date: Sun, 19 May 2013 22:28:52 +0000 Subject: [PATCH] use generics git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1484362 13f79535-47bb-0310-9956-ffa450edef68 --- .../metadata/repository/TestMetadataRepository.java | 2 +- .../search/mock/MockRepositorySessionFactory.java | 2 +- .../metadata/repository/TestMetadataRepository.java | 2 +- .../admin/mock/MockRepositorySessionFactory.java | 2 +- .../indexing/mock/MockRepositorySessionFactory.java | 2 +- .../processor/NewArtifactsRssFeedProcessorTest.java | 2 +- .../webtest/memory/TestMetadataRepository.java | 2 +- .../metadata/repository/TestMetadataRepository.java | 2 +- .../metadata/repository/MetadataRepository.java | 2 +- .../metadata/repository/TestMetadataRepository.java | 12 ++++++------ .../repository/file/FileMetadataRepository.java | 2 +- .../repository/jcr/JcrMetadataRepository.java | 4 ++-- 12 files changed, 18 insertions(+), 18 deletions(-) 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 index 00cd4d241..1426cab8f 100644 --- 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 @@ -173,7 +173,7 @@ public class TestMetadataRepository return false; } - public Object obtainAccess( Class aClass ) + public T obtainAccess( Class aClass ) { return null; } diff --git a/archiva-modules/archiva-base/archiva-indexer/src/test/java/org/apache/archiva/indexer/search/mock/MockRepositorySessionFactory.java b/archiva-modules/archiva-base/archiva-indexer/src/test/java/org/apache/archiva/indexer/search/mock/MockRepositorySessionFactory.java index 66838594b..2acbcb57c 100644 --- a/archiva-modules/archiva-base/archiva-indexer/src/test/java/org/apache/archiva/indexer/search/mock/MockRepositorySessionFactory.java +++ b/archiva-modules/archiva-base/archiva-indexer/src/test/java/org/apache/archiva/indexer/search/mock/MockRepositorySessionFactory.java @@ -256,7 +256,7 @@ public class MockRepositorySessionFactory return false; //To change body of implemented methods use File | Settings | File Templates. } - public Object obtainAccess( Class aClass ) + public T obtainAccess( Class aClass ) { return null; //To change body of implemented methods use File | Settings | File Templates. } diff --git a/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/archiva/metadata/repository/TestMetadataRepository.java b/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/archiva/metadata/repository/TestMetadataRepository.java index d7c52cea3..533951968 100644 --- a/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/archiva/metadata/repository/TestMetadataRepository.java +++ b/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/archiva/metadata/repository/TestMetadataRepository.java @@ -178,7 +178,7 @@ public class TestMetadataRepository return false; } - public Object obtainAccess( Class aClass ) + public T obtainAccess( Class aClass ) { return null; //To change body of implemented methods use File | Settings | File Templates. } diff --git a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/test/java/org/apache/archiva/admin/mock/MockRepositorySessionFactory.java b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/test/java/org/apache/archiva/admin/mock/MockRepositorySessionFactory.java index c594a9e75..7be9d6cb7 100644 --- a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/test/java/org/apache/archiva/admin/mock/MockRepositorySessionFactory.java +++ b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/test/java/org/apache/archiva/admin/mock/MockRepositorySessionFactory.java @@ -256,7 +256,7 @@ public class MockRepositorySessionFactory return false; //To change body of implemented methods use File | Settings | File Templates. } - public Object obtainAccess( Class aClass ) + public T obtainAccess( Class aClass ) { return null; //To change body of implemented methods use File | Settings | File Templates. } diff --git a/archiva-modules/archiva-scheduler/archiva-scheduler-indexing/src/test/java/org/apache/archiva/scheduler/indexing/mock/MockRepositorySessionFactory.java b/archiva-modules/archiva-scheduler/archiva-scheduler-indexing/src/test/java/org/apache/archiva/scheduler/indexing/mock/MockRepositorySessionFactory.java index a42b6aeda..85c01299a 100644 --- a/archiva-modules/archiva-scheduler/archiva-scheduler-indexing/src/test/java/org/apache/archiva/scheduler/indexing/mock/MockRepositorySessionFactory.java +++ b/archiva-modules/archiva-scheduler/archiva-scheduler-indexing/src/test/java/org/apache/archiva/scheduler/indexing/mock/MockRepositorySessionFactory.java @@ -256,7 +256,7 @@ public class MockRepositorySessionFactory return false; //To change body of implemented methods use File | Settings | File Templates. } - public Object obtainAccess( Class aClass ) + public T obtainAccess( Class aClass ) { return null; //To change body of implemented methods use File | Settings | File Templates. } diff --git a/archiva-modules/archiva-web/archiva-rss/src/test/java/org/apache/archiva/rss/processor/NewArtifactsRssFeedProcessorTest.java b/archiva-modules/archiva-web/archiva-rss/src/test/java/org/apache/archiva/rss/processor/NewArtifactsRssFeedProcessorTest.java index b6f25bec5..a83f38301 100644 --- a/archiva-modules/archiva-web/archiva-rss/src/test/java/org/apache/archiva/rss/processor/NewArtifactsRssFeedProcessorTest.java +++ b/archiva-modules/archiva-web/archiva-rss/src/test/java/org/apache/archiva/rss/processor/NewArtifactsRssFeedProcessorTest.java @@ -250,7 +250,7 @@ public class NewArtifactsRssFeedProcessorTest return false; } - public Object obtainAccess( Class aClass ) + public T obtainAccess( Class aClass ) { throw new UnsupportedOperationException(); } diff --git a/archiva-modules/archiva-web/archiva-web-common/src/test/java/org/apache/archiva/webtest/memory/TestMetadataRepository.java b/archiva-modules/archiva-web/archiva-web-common/src/test/java/org/apache/archiva/webtest/memory/TestMetadataRepository.java index 02d428515..8f9fc13bd 100644 --- a/archiva-modules/archiva-web/archiva-web-common/src/test/java/org/apache/archiva/webtest/memory/TestMetadataRepository.java +++ b/archiva-modules/archiva-web/archiva-web-common/src/test/java/org/apache/archiva/webtest/memory/TestMetadataRepository.java @@ -220,7 +220,7 @@ public class TestMetadataRepository return false; } - public Object obtainAccess( Class aClass ) + public T obtainAccess( Class aClass ) { return null; } diff --git a/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/metadata/repository/TestMetadataRepository.java b/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/metadata/repository/TestMetadataRepository.java index b07884a74..8fe7a6c29 100644 --- a/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/metadata/repository/TestMetadataRepository.java +++ b/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/metadata/repository/TestMetadataRepository.java @@ -174,7 +174,7 @@ public class TestMetadataRepository return false; } - public Object obtainAccess( Class aClass ) + public T obtainAccess( Class aClass ) { return null; } diff --git a/archiva-modules/metadata/metadata-repository-api/src/main/java/org/apache/archiva/metadata/repository/MetadataRepository.java b/archiva-modules/metadata/metadata-repository-api/src/main/java/org/apache/archiva/metadata/repository/MetadataRepository.java index c9fe7570c..f35a601e4 100644 --- a/archiva-modules/metadata/metadata-repository-api/src/main/java/org/apache/archiva/metadata/repository/MetadataRepository.java +++ b/archiva-modules/metadata/metadata-repository-api/src/main/java/org/apache/archiva/metadata/repository/MetadataRepository.java @@ -219,6 +219,6 @@ public interface MetadataRepository boolean canObtainAccess( Class aClass ); - Object obtainAccess( Class aClass ) + T obtainAccess( Class aClass ) throws MetadataRepositoryException; } diff --git a/archiva-modules/plugins/maven2-repository/src/test/java/org/apache/archiva/metadata/repository/TestMetadataRepository.java b/archiva-modules/plugins/maven2-repository/src/test/java/org/apache/archiva/metadata/repository/TestMetadataRepository.java index ba4cc6952..251232738 100644 --- a/archiva-modules/plugins/maven2-repository/src/test/java/org/apache/archiva/metadata/repository/TestMetadataRepository.java +++ b/archiva-modules/plugins/maven2-repository/src/test/java/org/apache/archiva/metadata/repository/TestMetadataRepository.java @@ -176,27 +176,27 @@ public class TestMetadataRepository 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 ) + public T obtainAccess( Class aClass ) { - 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, diff --git a/archiva-modules/plugins/metadata-store-file/src/main/java/org/apache/archiva/metadata/repository/file/FileMetadataRepository.java b/archiva-modules/plugins/metadata-store-file/src/main/java/org/apache/archiva/metadata/repository/file/FileMetadataRepository.java index f0a3abc33..7bc605f67 100644 --- a/archiva-modules/plugins/metadata-store-file/src/main/java/org/apache/archiva/metadata/repository/file/FileMetadataRepository.java +++ b/archiva-modules/plugins/metadata-store-file/src/main/java/org/apache/archiva/metadata/repository/file/FileMetadataRepository.java @@ -559,7 +559,7 @@ public class FileMetadataRepository return false; } - public Object obtainAccess( Class aClass ) + public T obtainAccess( Class aClass ) { throw new IllegalArgumentException( "Access using " + aClass + " is not supported on the file metadata storage" ); diff --git a/archiva-modules/plugins/metadata-store-jcr/src/main/java/org/apache/archiva/metadata/repository/jcr/JcrMetadataRepository.java b/archiva-modules/plugins/metadata-store-jcr/src/main/java/org/apache/archiva/metadata/repository/jcr/JcrMetadataRepository.java index 764387ee7..9336a0fcc 100644 --- a/archiva-modules/plugins/metadata-store-jcr/src/main/java/org/apache/archiva/metadata/repository/jcr/JcrMetadataRepository.java +++ b/archiva-modules/plugins/metadata-store-jcr/src/main/java/org/apache/archiva/metadata/repository/jcr/JcrMetadataRepository.java @@ -1256,14 +1256,14 @@ public class JcrMetadataRepository return aClass == Session.class; } - public Object obtainAccess( Class aClass ) + public T obtainAccess( Class aClass ) throws MetadataRepositoryException { if ( aClass == Session.class ) { try { - return getJcrSession(); + return (T) getJcrSession(); } catch ( RepositoryException e ) { -- 2.39.5