]> source.dussan.org Git - archiva.git/commitdiff
clear warnings for archiva-database
authorBrett Porter <brett@apache.org>
Tue, 17 Mar 2009 14:28:40 +0000 (14:28 +0000)
committerBrett Porter <brett@apache.org>
Tue, 17 Mar 2009 14:28:40 +0000 (14:28 +0000)
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@755266 13f79535-47bb-0310-9956-ffa450edef68

46 files changed:
archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/project/resolvers/ProjectModelResolutionListener.java
archiva-modules/archiva-database/src/main/java/org/apache/maven/archiva/database/ArchivaDAO.java
archiva-modules/archiva-database/src/main/java/org/apache/maven/archiva/database/RepositoryContentStatisticsDAO.java
archiva-modules/archiva-database/src/main/java/org/apache/maven/archiva/database/SimpleConstraint.java
archiva-modules/archiva-database/src/main/java/org/apache/maven/archiva/database/browsing/DefaultRepositoryBrowsing.java
archiva-modules/archiva-database/src/main/java/org/apache/maven/archiva/database/constraints/MostRecentRepositoryScanStatistics.java
archiva-modules/archiva-database/src/main/java/org/apache/maven/archiva/database/constraints/UniqueArtifactIdConstraint.java
archiva-modules/archiva-database/src/main/java/org/apache/maven/archiva/database/constraints/UniqueFieldConstraint.java
archiva-modules/archiva-database/src/main/java/org/apache/maven/archiva/database/jdo/JdoAccess.java
archiva-modules/archiva-database/src/main/java/org/apache/maven/archiva/database/jdo/JdoArchivaDAO.java
archiva-modules/archiva-database/src/main/java/org/apache/maven/archiva/database/jdo/JdoArtifactDAO.java
archiva-modules/archiva-database/src/main/java/org/apache/maven/archiva/database/jdo/JdoProjectModelDAO.java
archiva-modules/archiva-database/src/main/java/org/apache/maven/archiva/database/jdo/JdoRepositoryContentStatisticsDAO.java
archiva-modules/archiva-database/src/main/java/org/apache/maven/archiva/database/jdo/JdoRepositoryProblemDAO.java
archiva-modules/archiva-database/src/main/java/org/apache/maven/archiva/database/project/ProjectModelToDatabaseListener.java
archiva-modules/archiva-database/src/main/java/org/apache/maven/archiva/database/updater/DatabaseConsumers.java
archiva-modules/archiva-database/src/main/java/org/apache/maven/archiva/database/updater/JdoDatabaseUpdater.java
archiva-modules/archiva-database/src/test/java/org/apache/maven/archiva/database/RepositoryDatabaseEventListenerTest.java
archiva-modules/archiva-database/src/test/java/org/apache/maven/archiva/database/browsing/RepositoryBrowsingTest.java
archiva-modules/archiva-database/src/test/java/org/apache/maven/archiva/database/constraints/ArtifactsByChecksumConstraintTest.java
archiva-modules/archiva-database/src/test/java/org/apache/maven/archiva/database/constraints/ArtifactsByRepositoryConstraintTest.java
archiva-modules/archiva-database/src/test/java/org/apache/maven/archiva/database/constraints/ArtifactsProcessedConstraintTest.java
archiva-modules/archiva-database/src/test/java/org/apache/maven/archiva/database/constraints/ArtifactsRelatedConstraintTest.java
archiva-modules/archiva-database/src/test/java/org/apache/maven/archiva/database/constraints/MostRecentRepositoryScanStatisticsTest.java
archiva-modules/archiva-database/src/test/java/org/apache/maven/archiva/database/constraints/OlderArtifactsByAgeConstraintTest.java
archiva-modules/archiva-database/src/test/java/org/apache/maven/archiva/database/constraints/OlderSnapshotArtifactsByAgeConstraintTest.java
archiva-modules/archiva-database/src/test/java/org/apache/maven/archiva/database/constraints/ProjectsByArtifactUsageConstraintTest.java
archiva-modules/archiva-database/src/test/java/org/apache/maven/archiva/database/constraints/RangeConstraintTest.java
archiva-modules/archiva-database/src/test/java/org/apache/maven/archiva/database/constraints/RecentArtifactsByAgeConstraintTest.java
archiva-modules/archiva-database/src/test/java/org/apache/maven/archiva/database/constraints/RepositoryContentStatisticsByRepositoryConstraintTest.java
archiva-modules/archiva-database/src/test/java/org/apache/maven/archiva/database/constraints/RepositoryProblemByGroupIdConstraintTest.java
archiva-modules/archiva-database/src/test/java/org/apache/maven/archiva/database/constraints/RepositoryProblemByRepositoryIdConstraintTest.java
archiva-modules/archiva-database/src/test/java/org/apache/maven/archiva/database/constraints/RepositoryProblemConstraintTest.java
archiva-modules/archiva-database/src/test/java/org/apache/maven/archiva/database/constraints/UniqueArtifactIdConstraintTest.java
archiva-modules/archiva-database/src/test/java/org/apache/maven/archiva/database/constraints/UniqueFieldConstraintTest.java
archiva-modules/archiva-database/src/test/java/org/apache/maven/archiva/database/constraints/UniqueGroupIdConstraintTest.java
archiva-modules/archiva-database/src/test/java/org/apache/maven/archiva/database/constraints/UniqueVersionConstraintTest.java
archiva-modules/archiva-database/src/test/java/org/apache/maven/archiva/database/jdo/JdoArtifactDAOTest.java
archiva-modules/archiva-database/src/test/java/org/apache/maven/archiva/database/jdo/JdoProjectModelDAOTest.java
archiva-modules/archiva-database/src/test/java/org/apache/maven/archiva/database/jdo/JdoRepositoryContentStatisticsDAOTest.java
archiva-modules/archiva-database/src/test/java/org/apache/maven/archiva/database/updater/DatabaseConsumersTest.java
archiva-modules/archiva-scheduled/src/main/java/org/apache/maven/archiva/scheduled/DefaultArchivaTaskScheduler.java
archiva-modules/archiva-scheduled/src/main/java/org/apache/maven/archiva/scheduled/executors/ArchivaRepositoryScanningTaskExecutor.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/repositories/RepositoriesAction.java
archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/reports/GenerateReportAction.java

index ba84ea5803c5fa44b2a0f419a6eb6c72311bb9d2..2587429df49c4b750f1be48ef7dddf8e38a3c445 100644 (file)
@@ -40,7 +40,7 @@ public interface ProjectModelResolutionListener
      * @see #resolutionSuccess(VersionedReference, ProjectModelResolver, ArchivaProjectModel)
      * @see #resolutionNotFound(VersionedReference, List)
      */
-    public void resolutionStart( VersionedReference projectRef, List resolverList );
+    public void resolutionStart( VersionedReference projectRef, List<ProjectModelResolver> resolverList );
 
     /**
      * Indicates that a resolution against a specific resolver is about 
@@ -92,5 +92,5 @@ public interface ProjectModelResolutionListener
      * @param resolverList the {@link List} of {@link ProjectModelResolver}'s that was be searched.
      * @see #resolutionStart(VersionedReference, List)
      */
-    public void resolutionNotFound( VersionedReference projectRef, List resolverList );
+    public void resolutionNotFound( VersionedReference projectRef, List<ProjectModelResolver> resolverList );
 }
index 49e6025fd7192ad43e1746e7f52c5775e4eb70a8..76566b4d7afe0cdb2c8a1bbe7cfdc69b3d1107c9 100644 (file)
@@ -37,7 +37,7 @@ public interface ArchivaDAO
      * @param constraint the constraint to use.
      * @return the List of results.
      */
-    List query( SimpleConstraint constraint );
+    List<?> query( SimpleConstraint constraint );
 
     /**
      * Perform a simple save of a peristable object to the database.
index 64689e9177bf0e0e8ccbee4d276eed87d4ff3714..b607eccf072de48a133604f91bc537c442ab9004 100644 (file)
@@ -30,7 +30,7 @@ import org.apache.maven.archiva.model.RepositoryContentStatistics;
  */
 public interface RepositoryContentStatisticsDAO
 {
-    public List queryRepositoryContentStatistics( Constraint constraint )
+    public List<RepositoryContentStatistics> queryRepositoryContentStatistics( Constraint constraint )
         throws ObjectNotFoundException, ArchivaDatabaseException;
 
     public RepositoryContentStatistics saveRepositoryContentStatistics( RepositoryContentStatistics stats );
index ad75e7808497f54839be1424838017c902f85833..bdfb0992683619071074eade299bcfb28d619183 100644 (file)
@@ -47,7 +47,7 @@ public interface SimpleConstraint extends Constraint
      * 
      * @return the result class.
      */
-    public Class getResultClass();
+    public Class<?> getResultClass();
     
     /**
      * When working with result classes that are not persistable,
index 9fd8b0182966f395eea3a74dd2eb5eeb60669ecf..dfe6c74bf604c07ccaad9bad6b57a72174fff225 100644 (file)
@@ -68,13 +68,14 @@ public class DefaultRepositoryBrowsing
     /**
      * @see RepositoryBrowsing#getRoot(String, List)
      */
+    @SuppressWarnings("unchecked")
     public BrowsingResults getRoot( final String principal, final List<String> observableRepositoryIds )
     {
         final BrowsingResults results = new BrowsingResults();
 
         if ( !observableRepositoryIds.isEmpty() )
         {
-            final List<String> groups = dao.query( new UniqueGroupIdConstraint( observableRepositoryIds ) );
+            final List<String> groups = (List<String>) dao.query( new UniqueGroupIdConstraint( observableRepositoryIds ) );
             results.setSelectedRepositoryIds( observableRepositoryIds );
             results.setGroupIds( GroupIdFilter.filterGroups( groups ) );
         }
@@ -84,6 +85,7 @@ public class DefaultRepositoryBrowsing
     /**
      * @see RepositoryBrowsing#selectArtifactId(String, List, String, String)
      */
+    @SuppressWarnings("unchecked")
     public BrowsingResults selectArtifactId( final String principal, final List<String> observableRepositoryIds,
                                              final String groupId, final String artifactId )
     {
@@ -93,7 +95,7 @@ public class DefaultRepositoryBrowsing
         {
             // NOTE: No group Id or artifact Id's should be returned here.
             List<String> versions =
-                dao.query( new UniqueVersionConstraint( observableRepositoryIds, groupId, artifactId ) );
+                (List<String>) dao.query( new UniqueVersionConstraint( observableRepositoryIds, groupId, artifactId ) );
             results.setSelectedRepositoryIds( observableRepositoryIds );
 
             results.setVersions( processSnapshots( versions ) );
@@ -104,6 +106,7 @@ public class DefaultRepositoryBrowsing
     /**
      * @see RepositoryBrowsing#selectGroupId(String, List, String)
      */
+    @SuppressWarnings("unchecked")
     public BrowsingResults selectGroupId( final String principal, final List<String> observableRepositoryIds,
                                           final String groupId )
     {
@@ -111,9 +114,9 @@ public class DefaultRepositoryBrowsing
 
         if ( !observableRepositoryIds.isEmpty() )
         {
-            final List<String> groups = dao.query( new UniqueGroupIdConstraint( observableRepositoryIds, groupId ) );
+            final List<String> groups = (List<String>) dao.query( new UniqueGroupIdConstraint( observableRepositoryIds, groupId ) );
             final List<String> artifacts =
-                dao.query( new UniqueArtifactIdConstraint( observableRepositoryIds, groupId ) );
+                (List<String>) dao.query( new UniqueArtifactIdConstraint( observableRepositoryIds, groupId ) );
 
             // Remove searched for groupId from groups list.
             // Easier to do this here, vs doing it in the SQL query.
@@ -179,6 +182,7 @@ public class DefaultRepositoryBrowsing
     /**
      * @see RepositoryBrowsing#getOtherSnapshotVersions(List, String, String, String)
      */
+    @SuppressWarnings("unchecked")
     public List<String> getOtherSnapshotVersions( List<String> observableRepositoryIds, String groupId,
                                                  String artifactId, String version )
         throws ObjectNotFoundException, ArchivaDatabaseException
@@ -188,7 +192,7 @@ public class DefaultRepositoryBrowsing
         if ( VersionUtil.isSnapshot( version ) )
         {
             List<String> versions =
-                dao.query( new UniqueVersionConstraint( observableRepositoryIds, groupId, artifactId ) );
+                (List<String>) dao.query( new UniqueVersionConstraint( observableRepositoryIds, groupId, artifactId ) );
 
             for ( String uniqueVersion : versions )
             {   
@@ -259,7 +263,7 @@ public class DefaultRepositoryBrowsing
         if ( results == null )
         {
             // defensive. to honor contract as specified. never null.
-            return Collections.EMPTY_LIST;
+            return Collections.emptyList();
         }
 
         return results;
@@ -312,6 +316,7 @@ public class DefaultRepositoryBrowsing
      * @param pomArtifact
      * @throws ArchivaDatabaseException
      */
+    @SuppressWarnings("unchecked")
     private ArchivaArtifact handleGenericSnapshots( final String groupId, final String artifactId,
                                                     final String version, final String repositoryId )
         throws ArchivaDatabaseException
@@ -320,7 +325,7 @@ public class DefaultRepositoryBrowsing
 
         if ( VersionUtil.isGenericSnapshot( version ) )
         {
-            final List<String> versions = dao.query( new UniqueVersionConstraint( groupId, artifactId ) );
+            final List<String> versions = (List<String>) dao.query( new UniqueVersionConstraint( groupId, artifactId ) );
             Collections.sort( versions );
             Collections.reverse( versions );
 
index 9b7c054b3898b86640fc53a90a1309a628300c6b..a01de2164387fd2c478ecf90917235fa3a1a5b5d 100644 (file)
@@ -40,7 +40,7 @@ public class MostRecentRepositoryScanStatistics
         super.params = new Object[]{repoId};
     }
 
-    public Class getResultClass()
+    public Class<?> getResultClass()
     {
         return RepositoryContentStatistics.class;
     }
index ac0c850d143e7bdb5c0fe1e1fe9e75d332aacd0b..1449352afdbb19082d4e8775eff75e75c1050aaf 100644 (file)
@@ -35,7 +35,7 @@ public class UniqueArtifactIdConstraint
 {
     private StringBuffer sql = new StringBuffer();
     
-    private Class resultClass;
+    private Class<?> resultClass;
     
     /**
      * Obtain a set of unique ArtifactIds for the specified groupId.
index 8e22ac2558224755f3fced2d90c980fa547ee080..9cdbda9d76a63975119671f6d200bfce80a08a37 100644 (file)
@@ -45,7 +45,7 @@ public class UniqueFieldConstraint
         super.params = new Object[]{fieldNamePrefix};
     }
 
-    public Class getResultClass()
+    public Class<?> getResultClass()
     {
         return String.class;
     }
index f75fc64314de87b36077124d812a456a5b3e5cf5..27c39bf52e3b82b9f89cab254e7b69e33cecfba0 100644 (file)
@@ -151,7 +151,7 @@ public class JdoAccess
         return pm;
     }
 
-    public void enableCache( Class clazz )
+    public void enableCache( Class<?> clazz )
     {
         DataStoreCache cache = pmf.getDataStoreCache();
         cache.pinAll( clazz, false ); // Pin all objects of type clazz from now on
@@ -200,12 +200,12 @@ public class JdoAccess
         }
     }
 
-    public List getAllObjects( Class clazz )
+    public List<?> getAllObjects( Class<?> clazz )
     {
         return queryObjects( clazz, null );
     }
 
-    public List queryObjects( Class clazz, Constraint constraint )
+    public List<?> queryObjects( Class<?> clazz, Constraint constraint )
     {
         PersistenceManager pm = getPersistenceManager();
         Transaction tx = pm.currentTransaction();
@@ -214,7 +214,7 @@ public class JdoAccess
         {
             tx.begin();
 
-            List result = null;
+            List<?> result = null;
 
             if ( constraint != null )
             {
@@ -236,7 +236,7 @@ public class JdoAccess
                 result = processUnconstrained( pm, clazz );
             }
 
-            result = (List) pm.detachCopyAll( result );
+            result = (List<?>) pm.detachCopyAll( result );
 
             tx.commit();
 
@@ -248,7 +248,7 @@ public class JdoAccess
         }
     }
 
-    public List queryObjects( SimpleConstraint constraint )
+    public List<?> queryObjects( SimpleConstraint constraint )
     {
         PersistenceManager pm = getPersistenceManager();
         Transaction tx = pm.currentTransaction();
@@ -257,16 +257,16 @@ public class JdoAccess
         {
             tx.begin();
 
-            List result = processConstraint( pm, constraint );
+            List<?> result = processConstraint( pm, constraint );
 
             // Only detach if results are known to be persistable.
             if ( constraint.isResultsPersistable() )
             {
-                result = (List) pm.detachCopyAll( result );
+                result = (List<?>) pm.detachCopyAll( result );
             }
             else
             {
-                List copiedResults = new ArrayList();
+                List<Object> copiedResults = new ArrayList<Object>();
                 copiedResults.addAll( result );
                 result = copiedResults;
             }
@@ -281,14 +281,14 @@ public class JdoAccess
         }
     }
 
-    private List processUnconstrained( PersistenceManager pm, Class clazz )
+    private List<?> processUnconstrained( PersistenceManager pm, Class<?> clazz )
     {
         Extent extent = pm.getExtent( clazz, true );
         Query query = pm.newQuery( extent );
-        return (List) query.execute();
+        return (List<?>) query.execute();
     }
 
-    private List processConstraint( PersistenceManager pm, SimpleConstraint constraint )
+    private List<?> processConstraint( PersistenceManager pm, SimpleConstraint constraint )
     {
         Query query = pm.newQuery( constraint.getSelectSql() );
 
@@ -309,10 +309,10 @@ public class JdoAccess
             return processParameterizedQuery( query, constraint.getParameters() );
         }
 
-        return (List) query.execute();
+        return (List<?>) query.execute();
     }
 
-    private List processConstraint( PersistenceManager pm, Class clazz, DeclarativeConstraint constraint )
+    private List<?> processConstraint( PersistenceManager pm, Class<?> clazz, DeclarativeConstraint constraint )
     {
         Extent extent = pm.getExtent( clazz, true );
         Query query = pm.newQuery( extent );
@@ -380,26 +380,26 @@ public class JdoAccess
         }
         else
         {
-            return (List) query.execute();
+            return (List<?>) query.execute();
         }
     }
 
-    private List processParameterizedQuery( Query query, Object parameters[] )
+    private List<?> processParameterizedQuery( Query query, Object parameters[] )
     {
         switch ( parameters.length )
         {
             case 1:
-                return (List) query.execute( parameters[0] );
+                return (List<?>) query.execute( parameters[0] );
             case 2:
-                return (List) query.execute( parameters[0], parameters[1] );
+                return (List<?>) query.execute( parameters[0], parameters[1] );
             case 3:
-                return (List) query.execute( parameters[0], parameters[1], parameters[2] );
+                return (List<?>) query.execute( parameters[0], parameters[1], parameters[2] );
             default:
                 throw new JDOException( "Unable to use more than 3 parameters." );
         }
     }
 
-    public Object getObjectById( Class clazz, Object id, String fetchGroup )
+    public Object getObjectById( Class<?> clazz, Object id, String fetchGroup )
         throws ObjectNotFoundException, ArchivaDatabaseException
     {
         if ( id == null )
@@ -456,7 +456,7 @@ public class JdoAccess
         }
     }
 
-    public Object getObjectById( Class clazz, String id, String fetchGroup )
+    public Object getObjectById( Class<?> clazz, String id, String fetchGroup )
         throws ObjectNotFoundException, ArchivaDatabaseException
     {
         if ( StringUtils.isEmpty( id ) )
@@ -473,7 +473,7 @@ public class JdoAccess
         return ( JDOHelper.getObjectId( object ) != null );
     }
 
-    public boolean objectExistsById( Class clazz, String id )
+    public boolean objectExistsById( Class<?> clazz, String id )
         throws ArchivaDatabaseException
     {
         try
@@ -492,7 +492,7 @@ public class JdoAccess
     {
         if ( o == null )
         {
-            throw new ArchivaDatabaseException( "Unable to remove null object '" + o.getClass().getName() + "'" );
+            throw new ArchivaDatabaseException( "Unable to remove null object" );
         }
 
         PersistenceManager pm = getPersistenceManager();
@@ -570,7 +570,7 @@ public class JdoAccess
         // ignore
     }
 
-    public void removeAll( Class aClass )
+    public void removeAll( Class<?> aClass )
     {
         PersistenceManager pm = getPersistenceManager();
         Transaction tx = pm.currentTransaction();
index 420e044a27f3c2bada260e249ad418bce4c96133..54d30af86a1ea9679fd0f78e8c5522601886255d 100644 (file)
@@ -65,7 +65,7 @@ public class JdoArchivaDAO
     private RepositoryContentStatisticsDAO repositoryContentStatisticsDAO;
 
 
-    public List query( SimpleConstraint constraint )
+    public List<?> query( SimpleConstraint constraint )
     {
         return jdo.queryObjects( constraint );
     }
index 38e13ea41a11388bfc714dbe74a7d8742f9fdb08..8380d9e1df7fdda390c93ff175573f6a56a56fa0 100644 (file)
@@ -19,6 +19,9 @@ package org.apache.maven.archiva.database.jdo;
  * under the License.
  */
 
+import java.util.ArrayList;
+import java.util.List;
+
 import org.apache.maven.archiva.database.ArchivaDatabaseException;
 import org.apache.maven.archiva.database.ArtifactDAO;
 import org.apache.maven.archiva.database.Constraint;
@@ -27,10 +30,6 @@ import org.apache.maven.archiva.model.ArchivaArtifact;
 import org.apache.maven.archiva.model.ArchivaArtifactModel;
 import org.apache.maven.archiva.model.jpox.ArchivaArtifactModelKey;
 
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
 /**
  * JdoArtifactDAO 
  *
@@ -82,20 +81,19 @@ public class JdoArtifactDAO
         return new ArchivaArtifact( model );
     }
 
-    public List queryArtifacts( Constraint constraint )
+    @SuppressWarnings("unchecked")
+    public List<ArchivaArtifact> queryArtifacts( Constraint constraint )
         throws ObjectNotFoundException, ArchivaDatabaseException
     {
-        List results = jdo.queryObjects( ArchivaArtifactModel.class, constraint );
-        if ( ( results == null ) || results.isEmpty() )
+        List<ArchivaArtifactModel> results = (List<ArchivaArtifactModel>) jdo.queryObjects( ArchivaArtifactModel.class, constraint );
+        if ( results == null )
         {
-            return results;
+            return null;
         }
 
-        List ret = new ArrayList();
-        Iterator it = results.iterator();
-        while ( it.hasNext() )
+        List<ArchivaArtifact> ret = new ArrayList<ArchivaArtifact>();
+        for ( ArchivaArtifactModel model : results )
         {
-            ArchivaArtifactModel model = (ArchivaArtifactModel) it.next();
             ret.add( new ArchivaArtifact( model ) );
         }
 
index 614868993b62faf00c1d1227047e470caa3b44cf..12c223018b46642d19e33757b0235e8e4e56d1e1 100644 (file)
@@ -73,10 +73,11 @@ public class JdoProjectModelDAO
         return (ArchivaProjectModel) jdo.getObjectById( ArchivaProjectModel.class, key, null );
     }
 
+    @SuppressWarnings("unchecked")
     public List<ArchivaProjectModel> queryProjectModels( Constraint constraint )
         throws ObjectNotFoundException, ArchivaDatabaseException
     {
-        return jdo.queryObjects( ArchivaProjectModel.class, constraint );
+        return (List<ArchivaProjectModel>) jdo.queryObjects( ArchivaProjectModel.class, constraint );
     }
 
     public ArchivaProjectModel saveProjectModel( ArchivaProjectModel model )
index 21936fac2db247fcd9daffe3c2bc8bcab3e57a98..23be22b2b85c9787b189b8fcf7ccae5c522a9edf 100644 (file)
@@ -48,12 +48,11 @@ public class JdoRepositoryContentStatisticsDAO
         jdo.removeObject( stats );
     }
 
-    public List queryRepositoryContentStatistics( Constraint constraint )
+    @SuppressWarnings("unchecked")
+    public List<RepositoryContentStatistics> queryRepositoryContentStatistics( Constraint constraint )
         throws ObjectNotFoundException, ArchivaDatabaseException
     {
-        List results = jdo.queryObjects( RepositoryContentStatistics.class, constraint );
-        
-        return results;
+        return (List<RepositoryContentStatistics>) jdo.queryObjects( RepositoryContentStatistics.class, constraint );
     }
 
     public RepositoryContentStatistics saveRepositoryContentStatistics( RepositoryContentStatistics stats )
index 5f4fd16755efb48cc63d134a7d308397b186b3ec..3179bd238e08aa127e99d2a0d6d1fb68556dd696 100644 (file)
@@ -42,10 +42,11 @@ public class JdoRepositoryProblemDAO
      */
     private JdoAccess jdo;
 
-    public List queryRepositoryProblems( Constraint constraint )
+    @SuppressWarnings("unchecked")
+    public List<RepositoryProblem> queryRepositoryProblems( Constraint constraint )
         throws ObjectNotFoundException, ArchivaDatabaseException
     {
-        return jdo.queryObjects( RepositoryProblem.class, constraint );
+        return (List<RepositoryProblem>) jdo.queryObjects( RepositoryProblem.class, constraint );
     }
 
     public RepositoryProblem saveRepositoryProblem( RepositoryProblem problem )
index 5529d3849a0dbf0baf05caedbde90325e13d0bac..edba43335262708169ae2e1f1fd45e263bc4d780 100644 (file)
@@ -116,12 +116,12 @@ public class ProjectModelToDatabaseListener
         /* do nothing */
     }
 
-    public void resolutionNotFound( VersionedReference projectRef, List resolverList )
+    public void resolutionNotFound( VersionedReference projectRef, List<ProjectModelResolver> resolverList )
     {
         /* do nothing */
     }
 
-    public void resolutionStart( VersionedReference projectRef, List resolverList )
+    public void resolutionStart( VersionedReference projectRef, List<ProjectModelResolver> resolverList )
     {
         /* do nothing */
     }
index e79e51b505fc64b771b33e6a0f194db0d8fb7fc2..af6d12b979eeeb202a5c4e157ed105d05520b203 100644 (file)
@@ -19,6 +19,9 @@ package org.apache.maven.archiva.database.updater;
  * under the License.
  */
 
+import java.util.ArrayList;
+import java.util.List;
+
 import org.apache.commons.collections.CollectionUtils;
 import org.apache.commons.collections.Predicate;
 import org.apache.commons.collections.functors.OrPredicate;
@@ -32,10 +35,6 @@ import org.springframework.beans.BeansException;
 import org.springframework.context.ApplicationContext;
 import org.springframework.context.ApplicationContextAware;
 
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
 /**
  * DatabaseConsumers 
  *
@@ -114,9 +113,10 @@ public class DatabaseConsumers
      * 
      * @return the list of selected {@link DatabaseUnprocessedArtifactConsumer} objects.
      */
-    public List getSelectedUnprocessedConsumers()
+    @SuppressWarnings("unchecked")
+    public List<ArchivaArtifactConsumer> getSelectedUnprocessedConsumers()
     {
-        List ret = new ArrayList();
+        List<ArchivaArtifactConsumer> ret = new ArrayList<ArchivaArtifactConsumer>();
         ret.addAll( CollectionUtils.select( getAvailableUnprocessedConsumers(), selectedUnprocessedConsumers ) );
         return ret;
     }
@@ -127,9 +127,10 @@ public class DatabaseConsumers
      * 
      * @return the list of selected {@link DatabaseCleanupConsumer} objects.
      */
-    public List getSelectedCleanupConsumers()
+    @SuppressWarnings("unchecked")
+    public List<ArchivaArtifactConsumer> getSelectedCleanupConsumers()
     {
-        List ret = new ArrayList();
+        List<ArchivaArtifactConsumer> ret = new ArrayList<ArchivaArtifactConsumer>();
         ret.addAll( CollectionUtils.select( getAvailableCleanupConsumers(), selectedCleanupConsumers ) );
         return ret;
     }
@@ -140,9 +141,10 @@ public class DatabaseConsumers
      * 
      * @return the list of all available {@link DatabaseUnprocessedArtifactConsumer} objects.
      */
-    public List getAvailableUnprocessedConsumers()
+    @SuppressWarnings("unchecked")
+    public List<DatabaseUnprocessedArtifactConsumer> getAvailableUnprocessedConsumers()
     {       
-        return new ArrayList( applicationContext.getBeansOfType( DatabaseUnprocessedArtifactConsumer.class ).values() );
+        return new ArrayList<DatabaseUnprocessedArtifactConsumer>( applicationContext.getBeansOfType( DatabaseUnprocessedArtifactConsumer.class ).values() );
     }
 
     /**
@@ -151,9 +153,10 @@ public class DatabaseConsumers
      * 
      * @return the list of all available {@link DatabaseCleanupConsumer} objects.
      */
-    public List getAvailableCleanupConsumers()
+    @SuppressWarnings("unchecked")
+    public List<DatabaseCleanupConsumer> getAvailableCleanupConsumers()
     {
-        return new ArrayList( applicationContext.getBeansOfType( DatabaseCleanupConsumer.class ).values() );
+        return new ArrayList<DatabaseCleanupConsumer>( applicationContext.getBeansOfType( DatabaseCleanupConsumer.class ).values() );
     }
     
     /**
@@ -163,11 +166,9 @@ public class DatabaseConsumers
      */
     public void executeCleanupConsumer( ArchivaArtifact artifact )
     {
-        List consumers = getSelectedCleanupConsumers();
-        Iterator it = consumers.iterator();
-        while ( it.hasNext() )
+        List<ArchivaArtifactConsumer> consumers = getSelectedCleanupConsumers();
+        for ( ArchivaArtifactConsumer consumer : consumers )
         {
-            ArchivaArtifactConsumer consumer = (ArchivaArtifactConsumer) it.next();
             consumer.beginScan();
         }
         
@@ -182,9 +183,8 @@ public class DatabaseConsumers
         
         CollectionUtils.forAllDo( consumers, processArtifactClosure );
         
-        while ( it.hasNext() )
+        for ( ArchivaArtifactConsumer consumer : consumers )
         {
-            ArchivaArtifactConsumer consumer = (ArchivaArtifactConsumer) it.next();
             consumer.completeScan();
         }
     }
index 41bd5bf52231e6e1da55498d7de1c97963806d32..613c4034916238c247ac533e9899de8fec9bb277 100644 (file)
@@ -67,10 +67,11 @@ public class JdoDatabaseUpdater
         updateAllProcessed();
     }
 
+    @SuppressWarnings("unchecked")
     public void updateAllUnprocessed()
         throws ArchivaDatabaseException
     {
-        List unprocessedArtifacts = dao.getArtifactDAO().queryArtifacts( new ArtifactsProcessedConstraint( false ) );
+        List<ArchivaArtifact> unprocessedArtifacts = dao.getArtifactDAO().queryArtifacts( new ArtifactsProcessedConstraint( false ) );
 
         beginConsumerLifecycle( dbConsumers.getSelectedUnprocessedConsumers() );
 
@@ -79,10 +80,10 @@ public class JdoDatabaseUpdater
             // Process each consumer.
             Predicate predicate = UnprocessedArtifactPredicate.getInstance();
 
-            Iterator it = IteratorUtils.filteredIterator( unprocessedArtifacts.iterator(), predicate );
+            Iterator<ArchivaArtifact> it = IteratorUtils.filteredIterator( unprocessedArtifacts.iterator(), predicate );
             while ( it.hasNext() )
             {
-                ArchivaArtifact artifact = (ArchivaArtifact) it.next();
+                ArchivaArtifact artifact = it.next();
                 updateUnprocessed( artifact );
             }
         }
@@ -92,10 +93,11 @@ public class JdoDatabaseUpdater
         }
     }
 
+    @SuppressWarnings("unchecked")
     public void updateAllProcessed()
         throws ArchivaDatabaseException
     {
-        List processedArtifacts = dao.getArtifactDAO().queryArtifacts( new ArtifactsProcessedConstraint( true ) );
+        List<ArchivaArtifact> processedArtifacts = dao.getArtifactDAO().queryArtifacts( new ArtifactsProcessedConstraint( true ) );
 
         beginConsumerLifecycle( dbConsumers.getSelectedCleanupConsumers() );
 
@@ -104,10 +106,10 @@ public class JdoDatabaseUpdater
             // Process each consumer.
             Predicate predicate = NotPredicate.getInstance( UnprocessedArtifactPredicate.getInstance() );
 
-            Iterator it = IteratorUtils.filteredIterator( processedArtifacts.iterator(), predicate );
+            Iterator<ArchivaArtifact> it = IteratorUtils.filteredIterator( processedArtifacts.iterator(), predicate );
             while ( it.hasNext() )
             {
-                ArchivaArtifact artifact = (ArchivaArtifact) it.next();
+                ArchivaArtifact artifact = it.next();
                 updateProcessed( artifact );
             }
         }
@@ -117,22 +119,18 @@ public class JdoDatabaseUpdater
         }
     }
 
-    private void endConsumerLifecycle( List consumers )
+    private void endConsumerLifecycle( List<ArchivaArtifactConsumer> consumers )
     {
-        Iterator it = consumers.iterator();
-        while ( it.hasNext() )
+        for ( ArchivaArtifactConsumer consumer : consumers )
         {
-            ArchivaArtifactConsumer consumer = (ArchivaArtifactConsumer) it.next();
             consumer.completeScan();
         }
     }
 
-    private void beginConsumerLifecycle( List consumers )
+    private void beginConsumerLifecycle( List<ArchivaArtifactConsumer> consumers )
     {
-        Iterator it = consumers.iterator();
-        while ( it.hasNext() )
+        for ( ArchivaArtifactConsumer consumer : consumers )
         {
-            ArchivaArtifactConsumer consumer = (ArchivaArtifactConsumer) it.next();
             consumer.beginScan();
         }
     }
@@ -140,7 +138,7 @@ public class JdoDatabaseUpdater
     public void updateUnprocessed( ArchivaArtifact artifact )
         throws ArchivaDatabaseException
     {
-        List consumers = dbConsumers.getSelectedUnprocessedConsumers();
+        List<ArchivaArtifactConsumer> consumers = dbConsumers.getSelectedUnprocessedConsumers();
 
         if ( CollectionUtils.isEmpty( consumers ) )
         {
@@ -158,7 +156,7 @@ public class JdoDatabaseUpdater
     public void updateProcessed( ArchivaArtifact artifact )
         throws ArchivaDatabaseException
     {
-        List consumers = dbConsumers.getSelectedCleanupConsumers();
+        List<ArchivaArtifactConsumer> consumers = dbConsumers.getSelectedCleanupConsumers();
 
         if ( CollectionUtils.isEmpty( consumers ) )
         {
index e566ec629928c7c322cd7c3856a613d0e1504460..b5c09d87d901081da047469220512614810058ef 100644 (file)
@@ -42,6 +42,7 @@ public class RepositoryDatabaseEventListenerTest
         listener = (RepositoryListener) lookup( RepositoryListener.class.getName(), "database" );
     }
 
+    @SuppressWarnings("unchecked")
     public void testWiring()
     {
         List<RepositoryListener> listeners =
index 8ec1d5f2cc9787266b4db91f75bbf5ed89f138cd..77d80ed7a93b7d5c10d2d7404ff68bec3e99a8ad 100644 (file)
@@ -195,7 +195,7 @@ public class RepositoryBrowsingTest
         assertTrue( results.contains( "2.1-20070522.153141-2" ) ); 
     }
     
-    private void assertGroupIds( String msg, List actualGroupIds, String[] expectedGroupIds )
+    private void assertGroupIds( String msg, List<String> actualGroupIds, String[] expectedGroupIds )
     {
         assertEquals( msg + ": groupIds.length", expectedGroupIds.length, actualGroupIds.size() );
 
index 61078f1d05e325d90983cfb8d359559b9e5064af..0b5fa0da2fb8660e8baa20501a67eff1d911e03a 100644 (file)
@@ -193,7 +193,7 @@ public class ArtifactsByChecksumConstraintTest
     private void assertConstraint( String msg, int count, ArtifactsByChecksumConstraint constraint )
         throws Exception
     {
-        List results = artifactDao.queryArtifacts( constraint );
+        List<ArchivaArtifact> results = artifactDao.queryArtifacts( constraint );
         assertNotNull( msg + ": Not Null", results );
         assertEquals( msg + ": Results.size", count, results.size() );
     }
index 5751c26e225ffbef850940c1106ac007d4886f16..8b2841f0ae2246eceecd7240f6cb2c54a264036a 100644 (file)
@@ -167,7 +167,7 @@ public class ArtifactsByRepositoryConstraintTest
     private void assertConstraint( String msg, int count, ArtifactsByRepositoryConstraint constraint )
         throws Exception
     {
-        List results = artifactDao.queryArtifacts( constraint );
+        List<ArchivaArtifact> results = artifactDao.queryArtifacts( constraint );
         assertNotNull( msg + ": Not Null", results );
         assertEquals( msg + ": Results.size", count, results.size() );
     }
index c1da3c42fc67bcc8ba807509e4a1e44694668741..65719df90fe0792ec6116e69c03d09677ca7e86c 100644 (file)
@@ -19,14 +19,13 @@ package org.apache.maven.archiva.database.constraints;
  * under the License.
  */
 
+import java.util.Date;
+import java.util.List;
+
 import org.apache.maven.archiva.database.AbstractArchivaDatabaseTestCase;
 import org.apache.maven.archiva.database.ArtifactDAO;
 import org.apache.maven.archiva.model.ArchivaArtifact;
 
-import java.util.Date;
-import java.util.Iterator;
-import java.util.List;
-
 /**
  * ArtifactsProcessedConstraintTest 
  *
@@ -55,7 +54,7 @@ public class ArtifactsProcessedConstraintTest
         return artifact;
     }
 
-    public void assertResults( String type, List results, String expectedArtifacts[] )
+    public void assertResults( String type, List<ArchivaArtifact> results, String expectedArtifacts[] )
     {
         assertNotNull( "Results[" + type + "] should not be null.", results );
         assertEquals( "Results[" + type + "].size", expectedArtifacts.length, results.size() );
@@ -65,10 +64,8 @@ public class ArtifactsProcessedConstraintTest
             String artifactId = expectedArtifacts[i];
 
             int found = 0;
-            Iterator it = results.iterator();
-            while ( it.hasNext() )
+            for ( ArchivaArtifact artifact : results )
             {
-                ArchivaArtifact artifact = (ArchivaArtifact) it.next();
                 if ( artifactId.equals( artifact.getArtifactId() ) )
                 {
                     found++;
@@ -107,14 +104,14 @@ public class ArtifactsProcessedConstraintTest
     public void testNotProcessed()
         throws Exception
     {
-        List results = dao.getArtifactDAO().queryArtifacts( new ArtifactsProcessedConstraint( false ) );
+        List<ArchivaArtifact> results = dao.getArtifactDAO().queryArtifacts( new ArtifactsProcessedConstraint( false ) );
         assertResults( "not-processed", results, new String[] { "archiva-common", "archiva-database" } );
     }
 
     public void testProcessed()
         throws Exception
     {
-        List results = dao.getArtifactDAO().queryArtifacts( new ArtifactsProcessedConstraint( true ) );
+        List<ArchivaArtifact> results = dao.getArtifactDAO().queryArtifacts( new ArtifactsProcessedConstraint( true ) );
         assertResults( "processed", results, new String[] { "archiva-utils", "archiva-old" } );
     }
 
@@ -122,7 +119,7 @@ public class ArtifactsProcessedConstraintTest
         throws Exception
     {
         Date since = toDate( "2006/01/01 12:00:00" );
-        List results = dao.getArtifactDAO().queryArtifacts( new ArtifactsProcessedConstraint( since ) );
+        List<ArchivaArtifact> results = dao.getArtifactDAO().queryArtifacts( new ArtifactsProcessedConstraint( since ) );
         assertResults( "processed", results, new String[] { "archiva-utils" } );
     }
 
@@ -130,7 +127,7 @@ public class ArtifactsProcessedConstraintTest
         throws Exception
     {
         Date since = toDate( "2001/01/01 12:00:00" );
-        List results = dao.getArtifactDAO().queryArtifacts( new ArtifactsProcessedConstraint( since ) );
+        List<ArchivaArtifact> results = dao.getArtifactDAO().queryArtifacts( new ArtifactsProcessedConstraint( since ) );
         assertResults( "processed", results, new String[] { "archiva-utils", "archiva-old" } );
     }
 }
index 94a99af06d7f5db740f59bd10809158f09506b63..fc4de5b26f51a9b40cedaeb78120b91be04fb551 100644 (file)
@@ -82,7 +82,7 @@ public class ArtifactsRelatedConstraintTest
     private void assertConstraint( int expectedHits, Constraint constraint )
         throws Exception
     {
-        List results = artifactDao.queryArtifacts( constraint );
+        List<ArchivaArtifact> results = artifactDao.queryArtifacts( constraint );
         assertNotNull( "Related Artifacts: Not Null", results );
         assertEquals( "Related Artifacts: Results.size", expectedHits, results.size() );
     }
index 5214faa3424fcdf2c9ab57533f8563f049c18844..070a247691413f8b861c08a75c4fe7c07a8e4655 100644 (file)
@@ -58,18 +58,20 @@ public class MostRecentRepositoryScanStatisticsTest
         dao.save( createStats( "internal", "2007/02/18 10:00:00", 20000, 11700, 320 ) );
     }
 
+    @SuppressWarnings("unchecked")
     public void testNotProcessedYet()
         throws Exception
     {
-        List results = dao.query( new MostRecentRepositoryScanStatistics( "central" ) );
+        List<RepositoryContentStatistics> results = (List<RepositoryContentStatistics>) dao.query( new MostRecentRepositoryScanStatistics( "central" ) );
         assertNotNull( "Not Processed Yet", results );
         assertTrue( "Not Processed Yet", results.isEmpty() );
     }
 
+    @SuppressWarnings("unchecked")
     public void testStats()
         throws Exception
     {
-        List results = dao.query( new MostRecentRepositoryScanStatistics( "internal" ) );
+        List<RepositoryContentStatistics> results = (List<RepositoryContentStatistics>) dao.query( new MostRecentRepositoryScanStatistics( "internal" ) );
         assertNotNull( "Stats: results (not null)", results );
         assertEquals( "Stats: results.size", 1, results.size() );
 
index 2b2dc7a741513ad4d40a0e16e3696b42031e835d..c4936d274759ac52d014b09aea6d5d42a36a3b16 100644 (file)
@@ -95,7 +95,7 @@ public class OlderArtifactsByAgeConstraintTest
     private void assertConstraint( int expectedHits, Constraint constraint )
         throws Exception
     {
-        List results = artifactDao.queryArtifacts( constraint );
+        List<ArchivaArtifact> results = artifactDao.queryArtifacts( constraint );
         assertNotNull( "Older Artifacts By Age: Not Null", results );
         assertEquals( "Older Artifacts By Age: Results.size", expectedHits, results.size() );
     }
index 13659dc6fc1c4c8fa9621e396a2f8b699151171b..1cf8a6c9164fcb48f29cfb1926a241ca88f914d3 100644 (file)
@@ -110,7 +110,7 @@ public class OlderSnapshotArtifactsByAgeConstraintTest
     private void assertConstraint( int expectedHits, Constraint constraint )
         throws Exception
     {
-        List results = artifactDao.queryArtifacts( constraint );
+        List<ArchivaArtifact> results = artifactDao.queryArtifacts( constraint );
         assertNotNull( "Older Snapshot Artifacts By Age: Not Null", results );
         assertEquals( "Older Snapshot Artifacts By Age: Results.size", expectedHits, results.size() );
     }
index 646c6381d101c7c485569d7e8a4b5087fb76dc87..7795b3a9a354c16545228574f4294501b7edb3bf 100644 (file)
@@ -108,7 +108,7 @@ public class ProjectsByArtifactUsageConstraintTest
     private void assertConstraint( int expectedHits, DeclarativeConstraint constraint )
         throws Exception
     {
-        List results = dao.getProjectModelDAO().queryProjectModels( constraint );
+        List<ArchivaProjectModel> results = dao.getProjectModelDAO().queryProjectModels( constraint );
         assertNotNull( "Projects By Artifact Usage: Not Null", results );
         assertEquals( "Projects By Artifact Usage: Results.size", expectedHits, results.size() );
     }
index aa06189551fae8ec3e8244d96371029860f587e2..8f627983d11ac2715d47ee6c4b6c7f87ff54395a 100644 (file)
@@ -81,7 +81,7 @@ public class RangeConstraintTest
     private void assertConstraint( int expectedHits, Constraint constraint )
         throws Exception
     {
-        List results = repoProblemDao.queryRepositoryProblems( constraint );
+        List<RepositoryProblem> results = repoProblemDao.queryRepositoryProblems( constraint );
         assertNotNull( "Range Constraint: Not Null", results );
         assertEquals( "Range Constraint: Results.size", expectedHits, results.size() );
     }
index 3b4827884285d73b030bb8946d45b3cf47a9897c..da59b761b95423f996928560b57ebfa6c4b5dec5 100644 (file)
@@ -97,7 +97,7 @@ public class RecentArtifactsByAgeConstraintTest
     private void assertConstraint( int expectedHits, Constraint constraint )
         throws Exception
     {
-        List results = artifactDao.queryArtifacts( constraint );
+        List<ArchivaArtifact> results = artifactDao.queryArtifacts( constraint );
         assertNotNull( "Recent Artifacts By Age: Not Null", results );
         assertEquals( "Recent Artifacts By Age: Results.size", expectedHits, results.size() );
     }
index 71f10a73549bcbca2dd600e9d7b46b670869345b..2f500d77f879203883a0795139f90e6ff36d6f37 100644 (file)
@@ -67,7 +67,7 @@ public class RepositoryContentStatisticsByRepositoryConstraintTest
         throws Exception
     {
         Constraint constraint = new RepositoryContentStatisticsByRepositoryConstraint( "internal" );
-        List results = dao.getRepositoryContentStatisticsDAO().queryRepositoryContentStatistics( constraint );
+        List<RepositoryContentStatistics> results = dao.getRepositoryContentStatisticsDAO().queryRepositoryContentStatistics( constraint );
         assertNotNull( "Stats: results (not null)", results );
         assertEquals( "Stats: results.size", 4, results.size() );
 
@@ -83,7 +83,7 @@ public class RepositoryContentStatisticsByRepositoryConstraintTest
         Constraint constraint =
             new RepositoryContentStatisticsByRepositoryConstraint( "internal", toDate( "2007/10/18 8:00:00" ),
                                                                    toDate( "2007/10/20 8:00:00" ) );
-        List results = dao.getRepositoryContentStatisticsDAO().queryRepositoryContentStatistics( constraint );
+        List<RepositoryContentStatistics> results = dao.getRepositoryContentStatisticsDAO().queryRepositoryContentStatistics( constraint );
         assertNotNull( "Stats: results (not null)", results );
         assertEquals( "Stats: results.size", 3, results.size() );
 
index cc8b3f42b3067c86617bbf49f72dd90d9d664d22..14f66f412e4a38d477b8c4d290f6340351f5c03c 100644 (file)
@@ -19,14 +19,14 @@ package org.apache.maven.archiva.database.constraints;
  * under the License.
  */
 
+import java.util.List;
+
 import org.apache.maven.archiva.database.AbstractArchivaDatabaseTestCase;
 import org.apache.maven.archiva.database.ArchivaDAO;
 import org.apache.maven.archiva.database.Constraint;
 import org.apache.maven.archiva.database.RepositoryProblemDAO;
 import org.apache.maven.archiva.model.RepositoryProblem;
 
-import java.util.List;
-
 /**
  * RepositoryProblemByGroupIdConstraintTest
  */
@@ -89,7 +89,7 @@ public class RepositoryProblemByGroupIdConstraintTest
     private void assertConstraint( int expectedHits, Constraint constraint )
         throws Exception
     {
-        List results = repoProblemDao.queryRepositoryProblems( constraint );
+        List<RepositoryProblem> results = repoProblemDao.queryRepositoryProblems( constraint );
         assertNotNull( "Repository Problems by Group Id: Not Null", results );
         assertEquals( "Repository Problems by Group Id: Results.size", expectedHits, results.size() );
     }
index 425fc0e8d3ef7cf0bf798dfcf7a3bf236cb832d7..59d8016cd896c66400b7b7507e0da603500834bf 100644 (file)
@@ -86,7 +86,7 @@ public class RepositoryProblemByRepositoryIdConstraintTest
     private void assertConstraint( int expectedHits, Constraint constraint )
         throws Exception
     {
-        List results = repoProblemDao.queryRepositoryProblems( constraint );
+        List<RepositoryProblem> results = repoProblemDao.queryRepositoryProblems( constraint );
         assertNotNull( "Repository Problems by Repository Id: Not Null", results );
         assertEquals( "Repository Problems by Repository Id: Results.size", expectedHits, results.size() );
     }
index a593281ac384b6fd3ede6beebdf4d2c1debbd5cc..cc8dd55fa23864eb01ca6681968fbe298ed1bf09 100644 (file)
@@ -122,7 +122,7 @@ public class RepositoryProblemConstraintTest
     private void assertConstraint( int expectedHits, Constraint constraint )
         throws Exception
     {
-        List results = repoProblemDao.queryRepositoryProblems( constraint );
+        List<RepositoryProblem> results = repoProblemDao.queryRepositoryProblems( constraint );
         assertNotNull( "Repository Problems: Not Null", results );
         assertEquals( "Repository Problems: Results.size", expectedHits, results.size() );
     }
index 85535ab69f195122acac65c71f3a2f1031e77672..45a0316b4bed5da0d3c797c01311331cf3fd8b12 100644 (file)
@@ -112,12 +112,13 @@ public class UniqueArtifactIdConstraintTest
         artifactDao.saveArtifact( artifact );
     }
     
+    @SuppressWarnings("unchecked")
     private void assertConstraintWithMultipleResultTypes( String[] artifactIds, SimpleConstraint constraint )
         throws Exception
     {
         String prefix = "Unique Artifact IDs: ";
     
-        List<Object[]> results = dao.query( constraint );
+        List<Object[]> results = (List<Object[]>) dao.query( constraint );
         assertNotNull( prefix + "Not Null", results );
         assertEquals( prefix + "Results.size", artifactIds.length, results.size() );
     
@@ -134,11 +135,12 @@ public class UniqueArtifactIdConstraintTest
         }
     }
     
+    @SuppressWarnings("unchecked")
     private void assertConstraint( String[] artifactIds, SimpleConstraint constraint )
     {
         String prefix = "Unique Artifact IDs: ";
 
-        List<String> results = dao.query( constraint );
+        List<String> results = (List<String>) dao.query( constraint );
         assertNotNull( prefix + "Not Null", results );
         assertEquals( prefix + "Results.size", artifactIds.length, results.size() );
 
index 36724d182685e1070100d0ccb476398d13590be5..0edc344b618ae5d70d98581443c809634425f1e5 100644 (file)
@@ -110,7 +110,7 @@ public class UniqueFieldConstraintTest
     private void assertConstraint( int expectedHits, SimpleConstraint constraint )
         throws Exception
     {
-        List results = archivaDao.query( constraint );
+        List<?> results = archivaDao.query( constraint );
         assertNotNull( "Repository Problems: Not Null", results );
         assertEquals( "Repository Problems: Results.size", expectedHits, results.size() );
     }
index 8439d532a706c5115b9c0a4fca8d00ec9475d104..9eaf7a4bc010da12b4c2077e7c91c0d387dad495 100644 (file)
@@ -231,12 +231,13 @@ public class UniqueGroupIdConstraintTest
                           new UniqueGroupIdConstraint( observableRepositories ) );
     }   
     
+    @SuppressWarnings("unchecked")
     private void assertConstraint( String[] expectedGroupIds, SimpleConstraint constraint )
         throws Exception
     {
         String prefix = "Unique Group IDs: ";
 
-        List<String> results = dao.query( constraint );
+        List<String> results = (List<String>) dao.query( constraint );
         assertNotNull( prefix + "Not Null", results );
         assertEquals( prefix + "Results.size", expectedGroupIds.length, results.size() );
 
index f94b65c4f5dc6ab9684c14bacddde6a213caf193..4d12bf49c1d8c535d2c283a576efa3f618ee8f41 100644 (file)
@@ -108,11 +108,12 @@ public class UniqueVersionConstraintTest
         assertConstraint( new String[] { "3.0" }, new UniqueVersionConstraint( "org.codehaus.modello", "modellong" ) );
     }
 
+    @SuppressWarnings("unchecked")
     private void assertConstraint( String[] versions, SimpleConstraint constraint )
     {
         String prefix = "Unique Versions: ";
 
-        List<String> results = dao.query( constraint );
+        List<String> results = (List<String>) dao.query( constraint );
         assertNotNull( prefix + "Not Null", results );
         assertEquals( prefix + "Results.size", versions.length, results.size() );
 
index 2fab7ade0d74587879205ef2dd398896003b85ec..a21e3ecb25a1693f7cfe81be9a9756020816386c 100644 (file)
@@ -19,18 +19,18 @@ package org.apache.maven.archiva.database.jdo;
  * under the License.
  */
 
-import org.apache.maven.archiva.database.AbstractArchivaDatabaseTestCase;
-import org.apache.maven.archiva.database.ArtifactDAO;
-import org.apache.maven.archiva.model.ArchivaArtifact;
-import org.apache.maven.archiva.model.ArchivaArtifactModel;
-import org.apache.maven.archiva.model.jpox.ArchivaArtifactModelKey;
-
 import java.util.Date;
 import java.util.List;
 
 import javax.jdo.JDOHelper;
 import javax.jdo.spi.JDOImplHelper;
 
+import org.apache.maven.archiva.database.AbstractArchivaDatabaseTestCase;
+import org.apache.maven.archiva.database.ArtifactDAO;
+import org.apache.maven.archiva.model.ArchivaArtifact;
+import org.apache.maven.archiva.model.ArchivaArtifactModel;
+import org.apache.maven.archiva.model.jpox.ArchivaArtifactModelKey;
+
 /**
  * JdoArtifactDAOTest 
  *
@@ -76,7 +76,7 @@ public class JdoArtifactDAOTest
         assertEquals( "org.apache.maven.archiva:archiva-test-module:1.0::jar:testrepo", savedKeyId );
 
         // Test that something has been saved.
-        List artifacts = artiDao.queryArtifacts( null );
+        List<ArchivaArtifact> artifacts = artiDao.queryArtifacts( null );
         assertNotNull( artifacts );
         assertEquals( 1, artifacts.size() );
 
index bc5f63e2fb0ed7564a6d79caa51e2f4749b778e6..c5116846816a683ee84cf90db337c38bae576594 100644 (file)
@@ -19,6 +19,13 @@ package org.apache.maven.archiva.database.jdo;
  * under the License.
  */
 
+import java.io.File;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
+import javax.jdo.JDOHelper;
+
 import org.apache.commons.beanutils.PropertyUtils;
 import org.apache.commons.lang.StringUtils;
 import org.apache.maven.archiva.database.AbstractArchivaDatabaseTestCase;
@@ -27,14 +34,6 @@ import org.apache.maven.archiva.model.ArchivaProjectModel;
 import org.apache.maven.archiva.repository.project.ProjectModelReader;
 import org.apache.maven.archiva.repository.project.readers.ProjectModel400Reader;
 
-import java.io.File;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.Iterator;
-import java.util.List;
-
-import javax.jdo.JDOHelper;
-
 /**
  * JdoProjectModelDAOTest 
  *
@@ -65,7 +64,7 @@ public class JdoProjectModelDAOTest
         assertEquals( "org.apache.maven.archiva:archiva-test-module:1.0", savedKeyId );
 
         // Test that something has been saved.
-        List projects = projectDao.queryProjectModels( null );
+        List<ArchivaProjectModel> projects = projectDao.queryProjectModels( null );
         assertNotNull( projects );
         assertEquals( 1, projects.size() );
 
@@ -133,7 +132,7 @@ public class JdoProjectModelDAOTest
         assertNotNull( "Project model should not be null.", savedModel );
 
         // Test proper detachment of sub-objects.
-        List exprs = new ArrayList();
+        List<String> exprs = new ArrayList<String>();
         exprs.add( "parentProject.groupId" );
         exprs.add( "organization.name" );
         exprs.add( "issueManagement.system" );
@@ -149,10 +148,8 @@ public class JdoProjectModelDAOTest
         exprs.add( "licenses[0].url" );
         exprs.add( "mailingLists[0].name" );
 
-        Iterator it = exprs.iterator();
-        while ( it.hasNext() )
+        for ( String expr : exprs )
         {
-            String expr = (String) it.next();
             try
             {
                 Object obj = PropertyUtils.getProperty( model, expr );
index 9dd7921e076a8e9ce463544397251c2a2982da79..0034e3853779ae96e9c6f467c5c05764c48f6302 100644 (file)
@@ -51,7 +51,7 @@ public class JdoRepositoryContentStatisticsDAOTest
         assertEquals( "1[OID]org.apache.maven.archiva.model.RepositoryContentStatistics", savedKeyId );
 
         // query
-        List results =
+        List<RepositoryContentStatistics> results =
            repoContentStatisticsDAO.queryRepositoryContentStatistics( new RepositoryContentStatisticsByRepositoryConstraint(
                                                                                                                               "internal" ) );
         assertNotNull( results );
index d13e86d149a8b408b08449ba9c0125f584ef1e0b..b66fb4cc34130dc60fe34f7c6ce57a2cb996966e 100644 (file)
@@ -44,7 +44,7 @@ public class DatabaseConsumersTest
         throws Exception
     {
         DatabaseConsumers dbconsumers = lookupDbConsumers();
-        List available = dbconsumers.getAvailableCleanupConsumers();
+        List<DatabaseCleanupConsumer> available = dbconsumers.getAvailableCleanupConsumers();
         assertNotNull( "Available Cleanup Consumers should never be null.", available );
 
         assertTrue( "Available Cleanup Consumers should have entries.", CollectionUtils.isNotEmpty( available ) );
@@ -54,7 +54,7 @@ public class DatabaseConsumersTest
         throws Exception
     {
         DatabaseConsumers dbconsumers = lookupDbConsumers();
-        List available = dbconsumers.getAvailableUnprocessedConsumers();
+        List<DatabaseUnprocessedArtifactConsumer> available = dbconsumers.getAvailableUnprocessedConsumers();
         assertNotNull( "Available Unprocessed Consumers should never be null.", available );
 
         assertTrue( "Available Unprocessed Consumers should have entries.", CollectionUtils.isNotEmpty( available ) );
@@ -64,7 +64,7 @@ public class DatabaseConsumersTest
         throws Exception
     {
         DatabaseConsumers dbconsumers = lookupDbConsumers();
-        List available = dbconsumers.getSelectedCleanupConsumers();
+        List<ArchivaArtifactConsumer> available = dbconsumers.getSelectedCleanupConsumers();
         assertNotNull( "Selected Cleanup Consumers should never be null.", available );
 
         assertTrue( "Selected Cleanup Consumers should have entries.", CollectionUtils.isNotEmpty( available ) );
@@ -74,7 +74,7 @@ public class DatabaseConsumersTest
         throws Exception
     {
         DatabaseConsumers dbconsumers = lookupDbConsumers();
-        List available = dbconsumers.getSelectedUnprocessedConsumers();
+        List<ArchivaArtifactConsumer> available = dbconsumers.getSelectedUnprocessedConsumers();
         assertNotNull( "Selected Unprocessed Consumers should never be null.", available );
 
         assertTrue( "Selected Unprocessed Consumers should have entries.", CollectionUtils.isNotEmpty( available ) );
index 1a468d8b24c5cd2ae443232f0d886dd3a1e66141..599de9736505a6e71887b5ce08d4556dfdc91b91 100644 (file)
@@ -151,10 +151,11 @@ public class DefaultArchivaTaskScheduler
         }
     }
 
+    @SuppressWarnings("unchecked")
     private boolean isPreviouslyScanned( ManagedRepositoryConfiguration repoConfig )
     {
         List<RepositoryScanStatistics> results =
-            dao.query( new MostRecentRepositoryScanStatistics( repoConfig.getId() ) );
+            (List<RepositoryScanStatistics>) dao.query( new MostRecentRepositoryScanStatistics( repoConfig.getId() ) );
 
         if ( results != null && !results.isEmpty() )
         {
@@ -320,6 +321,7 @@ public class DefaultArchivaTaskScheduler
         }
     }
 
+    @SuppressWarnings("unchecked")
     public boolean isProcessingAnyRepositoryTask()
         throws ArchivaException
     {
@@ -337,6 +339,7 @@ public class DefaultArchivaTaskScheduler
         return !queue.isEmpty();
     }
 
+    @SuppressWarnings("unchecked")
     public boolean isProcessingRepositoryTask( String repositoryId )
         throws ArchivaException
     {
@@ -354,6 +357,7 @@ public class DefaultArchivaTaskScheduler
         return CollectionUtils.exists( queue, new RepositoryTaskSelectionPredicate( repositoryId ) );
     }
 
+    @SuppressWarnings("unchecked")
     public boolean isProcessingDatabaseTask()
         throws ArchivaException
     {
index 08187c989b9433d5a258c9db23d03f4d88bd8681..6163ed4f549094f6e7cbccd8b0e0e036b3ce9488 100644 (file)
@@ -31,6 +31,7 @@ import org.apache.maven.archiva.database.constraints.ArtifactsByRepositoryConstr
 import org.apache.maven.archiva.database.constraints.MostRecentRepositoryScanStatistics;
 import org.apache.maven.archiva.database.constraints.UniqueArtifactIdConstraint;
 import org.apache.maven.archiva.database.constraints.UniqueGroupIdConstraint;
+import org.apache.maven.archiva.model.ArchivaArtifact;
 import org.apache.maven.archiva.model.RepositoryContentStatistics;
 import org.apache.maven.archiva.repository.RepositoryException;
 import org.apache.maven.archiva.repository.scanner.RepositoryScanStatistics;
@@ -85,6 +86,7 @@ public class ArchivaRepositoryScanningTaskExecutor
         log.info( "Initialized " + this.getClass().getName() );
     }
 
+    @SuppressWarnings("unchecked")
     public void executeTask( Task task )
         throws TaskExecutionException
     {
@@ -107,7 +109,7 @@ public class ArchivaRepositoryScanningTaskExecutor
 
             long sinceWhen = RepositoryScanner.FRESH_SCAN;
 
-            List<RepositoryContentStatistics> results = dao.query( new MostRecentRepositoryScanStatistics( arepo.getId() ) );
+            List<RepositoryContentStatistics> results = (List<RepositoryContentStatistics>) dao.query( new MostRecentRepositoryScanStatistics( arepo.getId() ) );
 
             if ( CollectionUtils.isNotEmpty( results ) )
             {
@@ -129,6 +131,7 @@ public class ArchivaRepositoryScanningTaskExecutor
         }    
     }
 
+    @SuppressWarnings("unchecked")
     private RepositoryContentStatistics constructRepositoryStatistics( ManagedRepositoryConfiguration arepo,
                                                                        long sinceWhen,
                                                                        List<RepositoryContentStatistics> results,
@@ -145,7 +148,7 @@ public class ArchivaRepositoryScanningTaskExecutor
         // total artifact count
         try
         {
-            List artifacts = dao.getArtifactDAO().queryArtifacts( 
+            List<ArchivaArtifact> artifacts = dao.getArtifactDAO().queryArtifacts( 
                       new ArtifactsByRepositoryConstraint( arepo.getId(), stats.getWhenGathered(), "groupId", true ) );            
             dbstats.setTotalArtifactCount( artifacts.size() );
         }
@@ -166,10 +169,10 @@ public class ArchivaRepositoryScanningTaskExecutor
         List<String> repos = new ArrayList<String>();
         repos.add( arepo.getId() ); 
         
-        List<String> groupIds = dao.query( new UniqueGroupIdConstraint( repos ) );
+        List<String> groupIds = (List<String>) dao.query( new UniqueGroupIdConstraint( repos ) );
         dbstats.setTotalGroupCount( groupIds.size() );
                 
-        List<Object[]> artifactIds = dao.query( new UniqueArtifactIdConstraint( arepo.getId(), true ) );
+        List<Object[]> artifactIds = (List<Object[]>) dao.query( new UniqueArtifactIdConstraint( arepo.getId(), true ) );
         dbstats.setTotalProjectCount( artifactIds.size() );
                         
         return dbstats;
index dab1bf0ebc9daebb6cf3765678bb341d66080326..493121c908da333cb32510d30910073b4641304f 100644 (file)
@@ -34,26 +34,27 @@ import org.apache.archiva.indexer.search.SearchResultLimits;
 import org.apache.archiva.indexer.search.SearchResults;
 import org.apache.commons.collections.CollectionUtils;
 import org.apache.commons.lang.StringUtils;
+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.database.ArchivaDAO;
 import org.apache.maven.archiva.database.ArtifactDAO;
 import org.apache.maven.archiva.database.Constraint;
 import org.apache.maven.archiva.database.constraints.ArtifactsByChecksumConstraint;
+import org.apache.maven.archiva.database.constraints.UniqueVersionConstraint;
+import org.apache.maven.archiva.model.ArchivaArtifact;
 import org.apache.maven.archiva.security.AccessDeniedException;
 import org.apache.maven.archiva.security.ArchivaSecurityException;
 import org.apache.maven.archiva.security.ArchivaXworkUser;
 import org.apache.maven.archiva.security.PrincipalNotFoundException;
 import org.apache.maven.archiva.security.UserRepositories;
-
-import com.opensymphony.xwork2.ActionContext;
-import com.opensymphony.xwork2.Preparable;
-import org.apache.maven.archiva.common.utils.VersionUtil;
-import org.apache.maven.archiva.database.constraints.UniqueVersionConstraint;
 import org.apache.struts2.ServletActionContext;
 import org.springframework.web.context.WebApplicationContext;
 import org.springframework.web.context.support.WebApplicationContextUtils;
 
+import com.opensymphony.xwork2.ActionContext;
+import com.opensymphony.xwork2.Preparable;
+
 /**
  * Search all indexed fields by the given criteria.
  *
@@ -69,8 +70,6 @@ public class SearchAction
 
     private ArchivaConfiguration archivaConfiguration;
 
-    private Map<String, ManagedRepositoryConfiguration> managedRepositories;
-
     private String q;
 
     /**
@@ -97,7 +96,7 @@ public class SearchAction
 
     private static final String ARTIFACT = "artifact";
 
-    private List databaseResults;
+    private List<ArchivaArtifact> databaseResults;
     
     private int currentPage = 0;
     
@@ -262,6 +261,7 @@ public class SearchAction
         return SUCCESS;
     }
 
+    @SuppressWarnings("unchecked")
     public String quickSearch()
         throws MalformedURLException
     {
@@ -335,8 +335,8 @@ public class SearchAction
         for ( SearchResultHit resultHit : results.getHits() )
         {
             final List<String> versions =
-                dao.query( new UniqueVersionConstraint( getObservableRepos(), resultHit.getGroupId(),
-                                                        resultHit.getArtifactId() ) );
+                (List<String>) dao.query( new UniqueVersionConstraint( getObservableRepos(), resultHit.getGroupId(),
+                                                    resultHit.getArtifactId() ) );
             if ( versions != null && !versions.isEmpty() )
             {
                 resultHit.setVersion( null );
@@ -400,6 +400,7 @@ public class SearchAction
         return INPUT;
     }
 
+    @SuppressWarnings("unchecked")
     private String getPrincipal()
     {
         return archivaXworkUser.getActivePrincipal( ActionContext.getContext().getSession() );
@@ -481,7 +482,7 @@ public class SearchAction
         return results;
     }
 
-    public List getDatabaseResults()
+    public List<ArchivaArtifact> getDatabaseResults()
     {
         return databaseResults;
     }
@@ -543,7 +544,6 @@ public class SearchAction
 
     public void setManagedRepositories( Map<String, ManagedRepositoryConfiguration> managedRepositories )
     {
-        this.managedRepositories = managedRepositories;
     }
 
     public String getGroupId()
index ec349b9af407dff67849950ca705a6f57a9c12e7..c36cc1ab88c3aa3ed89e8d43b2c34635ddfbcc99 100644 (file)
@@ -94,6 +94,7 @@ public class RepositoriesAction
         return bundle;
     }
 
+    @SuppressWarnings("unchecked")
     public void prepare()
     {
         Configuration config = archivaConfiguration.getConfiguration();
@@ -109,7 +110,7 @@ public class RepositoriesAction
         for ( ManagedRepositoryConfiguration repo : managedRepositories )
         {
             List<RepositoryContentStatistics> results =
-                dao.query( new MostRecentRepositoryScanStatistics( repo.getId() ) );
+                (List<RepositoryContentStatistics>) dao.query( new MostRecentRepositoryScanStatistics( repo.getId() ) );
             if ( !results.isEmpty() )
             {
                 repositoryStatistics.put( repo.getId(), results.get( 0 ) );
index 94c9f5eead6e482fa9bda86f90130bd41c23beb8..f38012909d1e2cdab9eee67a87ee0bfcd2ae3dc3 100644 (file)
@@ -152,12 +152,13 @@ public class GenerateReportAction
     
     private InputStream inputStream;
     
+    @SuppressWarnings("unchecked")
     public void prepare()
     {
         repositoryIds = new ArrayList<String>();
         repositoryIds.add( ALL_REPOSITORIES ); // comes first to be first in the list
-        repositoryIds.addAll(
-            dao.query( new UniqueFieldConstraint( RepositoryProblem.class.getName(), "repositoryId" ) ) );
+        repositoryIds.addAll( (List<String>) dao.query( new UniqueFieldConstraint( RepositoryProblem.class.getName(),
+                                                                                   "repositoryId" ) ) );
         
         availableRepositories = new ArrayList<String>();
      
@@ -449,7 +450,7 @@ public class GenerateReportAction
         {   
             try
             {                
-                List contentStats = repoContentStatsDao.queryRepositoryContentStatistics( 
+                List<RepositoryContentStatistics> contentStats = repoContentStatsDao.queryRepositoryContentStatistics( 
                          new RepositoryContentStatisticsByRepositoryConstraint( repo, startDateInDF, endDateInDF ) );
 
                 if ( contentStats == null || contentStats.isEmpty() )