archiva-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From br...@apache.org
Subject svn commit: r891064 [1/2] - in /archiva/branches/MRM-1025: ./ archiva-modules/ archiva-modules/archiva-base/archiva-consumers/archiva-metadata-consumer/src/main/java/org/apache/archiva/consumers/metadata/ archiva-modules/archiva-base/archiva-model/src/...
Date Tue, 15 Dec 2009 23:07:39 GMT
Author: brett
Date: Tue Dec 15 23:07:36 2009
New Revision: 891064

URL: http://svn.apache.org/viewvc?rev=891064&view=rev
Log:
[MRM-1301] migrate reports to metadata repository

Added:
    archiva/branches/MRM-1025/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/AbstractRepositoryBasedAction.java
    archiva/branches/MRM-1025/archiva-modules/plugins/problem-reports/   (with props)
    archiva/branches/MRM-1025/archiva-modules/plugins/problem-reports/pom.xml
    archiva/branches/MRM-1025/archiva-modules/plugins/problem-reports/src/
    archiva/branches/MRM-1025/archiva-modules/plugins/problem-reports/src/main/
    archiva/branches/MRM-1025/archiva-modules/plugins/problem-reports/src/main/java/
    archiva/branches/MRM-1025/archiva-modules/plugins/problem-reports/src/main/java/org/
    archiva/branches/MRM-1025/archiva-modules/plugins/problem-reports/src/main/java/org/apache/
    archiva/branches/MRM-1025/archiva-modules/plugins/problem-reports/src/main/java/org/apache/archiva/
    archiva/branches/MRM-1025/archiva-modules/plugins/problem-reports/src/main/java/org/apache/archiva/reports/
    archiva/branches/MRM-1025/archiva-modules/plugins/problem-reports/src/main/java/org/apache/archiva/reports/RepositoryProblemEventListener.java
      - copied, changed from r889234, archiva/branches/MRM-1025/archiva-modules/archiva-database/src/main/java/org/apache/maven/archiva/database/RepositoryDatabaseEventListener.java
    archiva/branches/MRM-1025/archiva-modules/plugins/problem-reports/src/main/java/org/apache/archiva/reports/RepositoryProblemFacet.java
    archiva/branches/MRM-1025/archiva-modules/plugins/problem-reports/src/main/java/org/apache/archiva/reports/RepositoryProblemFacetFactory.java
    archiva/branches/MRM-1025/archiva-modules/plugins/problem-reports/src/main/java/org/apache/archiva/reports/consumers/
    archiva/branches/MRM-1025/archiva-modules/plugins/problem-reports/src/main/java/org/apache/archiva/reports/consumers/DuplicateArtifactsConsumer.java   (contents, props changed)
      - copied, changed from r889234, archiva/branches/MRM-1025/archiva-modules/archiva-reporting/archiva-artifact-reports/src/main/java/org/apache/maven/archiva/reporting/artifact/DuplicateArtifactsConsumer.java
    archiva/branches/MRM-1025/archiva-modules/plugins/problem-reports/src/test/
    archiva/branches/MRM-1025/archiva-modules/plugins/problem-reports/src/test/java/
    archiva/branches/MRM-1025/archiva-modules/plugins/problem-reports/src/test/java/org/
    archiva/branches/MRM-1025/archiva-modules/plugins/problem-reports/src/test/java/org/apache/
    archiva/branches/MRM-1025/archiva-modules/plugins/problem-reports/src/test/java/org/apache/archiva/
Removed:
    archiva/branches/MRM-1025/archiva-modules/archiva-base/archiva-model/src/main/java/org/apache/maven/archiva/model/RepositoryProblemReport.java
    archiva/branches/MRM-1025/archiva-modules/archiva-database/src/main/java/org/apache/maven/archiva/database/RepositoryProblemDAO.java
    archiva/branches/MRM-1025/archiva-modules/archiva-database/src/main/java/org/apache/maven/archiva/database/constraints/ArtifactsByChecksumConstraint.java
    archiva/branches/MRM-1025/archiva-modules/archiva-database/src/main/java/org/apache/maven/archiva/database/constraints/OlderArtifactsByAgeConstraint.java
    archiva/branches/MRM-1025/archiva-modules/archiva-database/src/main/java/org/apache/maven/archiva/database/constraints/OlderSnapshotArtifactsByAgeConstraint.java
    archiva/branches/MRM-1025/archiva-modules/archiva-database/src/main/java/org/apache/maven/archiva/database/constraints/RangeConstraint.java
    archiva/branches/MRM-1025/archiva-modules/archiva-database/src/main/java/org/apache/maven/archiva/database/constraints/RepositoryProblemByArtifactConstraint.java
    archiva/branches/MRM-1025/archiva-modules/archiva-database/src/main/java/org/apache/maven/archiva/database/constraints/RepositoryProblemByGroupIdConstraint.java
    archiva/branches/MRM-1025/archiva-modules/archiva-database/src/main/java/org/apache/maven/archiva/database/constraints/RepositoryProblemByRepositoryIdConstraint.java
    archiva/branches/MRM-1025/archiva-modules/archiva-database/src/main/java/org/apache/maven/archiva/database/constraints/RepositoryProblemByTypeConstraint.java
    archiva/branches/MRM-1025/archiva-modules/archiva-database/src/main/java/org/apache/maven/archiva/database/constraints/RepositoryProblemConstraint.java
    archiva/branches/MRM-1025/archiva-modules/archiva-database/src/main/java/org/apache/maven/archiva/database/constraints/SqlBuilder.java
    archiva/branches/MRM-1025/archiva-modules/archiva-database/src/main/java/org/apache/maven/archiva/database/constraints/UniqueFieldConstraint.java
    archiva/branches/MRM-1025/archiva-modules/archiva-database/src/main/java/org/apache/maven/archiva/database/jdo/JdoRepositoryProblemDAO.java
    archiva/branches/MRM-1025/archiva-modules/archiva-database/src/test/java/org/apache/maven/archiva/database/constraints/AllTests.java
    archiva/branches/MRM-1025/archiva-modules/archiva-database/src/test/java/org/apache/maven/archiva/database/constraints/ArtifactsByChecksumConstraintTest.java
    archiva/branches/MRM-1025/archiva-modules/archiva-database/src/test/java/org/apache/maven/archiva/database/constraints/OlderArtifactsByAgeConstraintTest.java
    archiva/branches/MRM-1025/archiva-modules/archiva-database/src/test/java/org/apache/maven/archiva/database/constraints/OlderSnapshotArtifactsByAgeConstraintTest.java
    archiva/branches/MRM-1025/archiva-modules/archiva-database/src/test/java/org/apache/maven/archiva/database/constraints/RangeConstraintTest.java
    archiva/branches/MRM-1025/archiva-modules/archiva-database/src/test/java/org/apache/maven/archiva/database/constraints/RepositoryProblemByGroupIdConstraintTest.java
    archiva/branches/MRM-1025/archiva-modules/archiva-database/src/test/java/org/apache/maven/archiva/database/constraints/RepositoryProblemByRepositoryIdConstraintTest.java
    archiva/branches/MRM-1025/archiva-modules/archiva-database/src/test/java/org/apache/maven/archiva/database/constraints/RepositoryProblemConstraintTest.java
    archiva/branches/MRM-1025/archiva-modules/archiva-database/src/test/java/org/apache/maven/archiva/database/constraints/UniqueFieldConstraintTest.java
    archiva/branches/MRM-1025/archiva-modules/archiva-reporting/
    archiva/branches/MRM-1025/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/admin/repositories/RepositoryProblemDAOStub.java
Modified:
    archiva/branches/MRM-1025/archiva-modules/archiva-base/archiva-consumers/archiva-metadata-consumer/src/main/java/org/apache/archiva/consumers/metadata/ArchivaMetadataCreationConsumer.java
    archiva/branches/MRM-1025/archiva-modules/archiva-base/archiva-model/src/main/mdo/archiva-base.xml
    archiva/branches/MRM-1025/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/archiva/metadata/repository/TestMetadataRepository.java
    archiva/branches/MRM-1025/archiva-modules/archiva-database/src/main/java/org/apache/maven/archiva/database/ArchivaDAO.java
    archiva/branches/MRM-1025/archiva-modules/archiva-database/src/main/java/org/apache/maven/archiva/database/RepositoryDatabaseEventListener.java
    archiva/branches/MRM-1025/archiva-modules/archiva-database/src/main/java/org/apache/maven/archiva/database/jdo/JdoArchivaDAO.java
    archiva/branches/MRM-1025/archiva-modules/archiva-database/src/test/java/org/apache/maven/archiva/database/jdo/JdoArchivaDAOTest.java
    archiva/branches/MRM-1025/archiva-modules/archiva-web/archiva-webapp/pom.xml
    archiva/branches/MRM-1025/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/BrowseAction.java
    archiva/branches/MRM-1025/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/SearchAction.java
    archiva/branches/MRM-1025/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/ShowArtifactAction.java
    archiva/branches/MRM-1025/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/reports/GenerateReportAction.java
    archiva/branches/MRM-1025/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/applicationContext.xml
    archiva/branches/MRM-1025/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/reports/basicReport.jsp
    archiva/branches/MRM-1025/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/metadata/repository/memory/TestMetadataRepository.java
    archiva/branches/MRM-1025/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/admin/repositories/ArchivaDAOStub.java
    archiva/branches/MRM-1025/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/reports/GenerateReportActionTest.java
    archiva/branches/MRM-1025/archiva-modules/archiva-web/archiva-webapp/src/test/resources/org/apache/maven/archiva/web/action/DeleteArtifactActionTest.xml
    archiva/branches/MRM-1025/archiva-modules/archiva-web/archiva-webapp/src/test/resources/org/apache/maven/archiva/web/action/reports/GenerateReportActionTest.xml
    archiva/branches/MRM-1025/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/metadata/repository/TestMetadataRepository.java
    archiva/branches/MRM-1025/archiva-modules/metadata/metadata-model/src/main/java/org/apache/archiva/metadata/model/MetadataFacet.java
    archiva/branches/MRM-1025/archiva-modules/metadata/metadata-repository-api/src/main/java/org/apache/archiva/metadata/repository/MetadataRepository.java
    archiva/branches/MRM-1025/archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/metadata/repository/storage/maven2/MavenProjectFacet.java
    archiva/branches/MRM-1025/archiva-modules/plugins/metadata-repository-file/src/main/java/org/apache/archiva/metadata/repository/file/FileMetadataRepository.java
    archiva/branches/MRM-1025/archiva-modules/plugins/metadata-repository-file/src/test/java/org/apache/archiva/metadata/repository/file/FileMetadataRepositoryTest.java
    archiva/branches/MRM-1025/archiva-modules/plugins/pom.xml
    archiva/branches/MRM-1025/archiva-modules/plugins/repository-statistics/src/main/java/org/apache/archiva/metadata/repository/stats/DefaultRepositoryStatisticsManager.java
    archiva/branches/MRM-1025/archiva-modules/plugins/repository-statistics/src/main/java/org/apache/archiva/metadata/repository/stats/RepositoryStatistics.java
    archiva/branches/MRM-1025/archiva-modules/plugins/repository-statistics/src/test/java/org/apache/archiva/metadata/repository/stats/RepositoryStatisticsManagerTest.java
    archiva/branches/MRM-1025/archiva-modules/pom.xml
    archiva/branches/MRM-1025/pom.xml

Modified: archiva/branches/MRM-1025/archiva-modules/archiva-base/archiva-consumers/archiva-metadata-consumer/src/main/java/org/apache/archiva/consumers/metadata/ArchivaMetadataCreationConsumer.java
URL: http://svn.apache.org/viewvc/archiva/branches/MRM-1025/archiva-modules/archiva-base/archiva-consumers/archiva-metadata-consumer/src/main/java/org/apache/archiva/consumers/metadata/ArchivaMetadataCreationConsumer.java?rev=891064&r1=891063&r2=891064&view=diff
==============================================================================
--- archiva/branches/MRM-1025/archiva-modules/archiva-base/archiva-consumers/archiva-metadata-consumer/src/main/java/org/apache/archiva/consumers/metadata/ArchivaMetadataCreationConsumer.java (original)
+++ archiva/branches/MRM-1025/archiva-modules/archiva-base/archiva-consumers/archiva-metadata-consumer/src/main/java/org/apache/archiva/consumers/metadata/ArchivaMetadataCreationConsumer.java Tue Dec 15 23:07:36 2009
@@ -162,7 +162,7 @@
         project.setId( artifact.getArtifactId() );
 
         // TODO: maybe not too efficient since it may have already been read and stored for this artifact
-        ProjectVersionMetadata versionMetadata = null;
+        ProjectVersionMetadata versionMetadata;
         try
         {
             versionMetadata =
@@ -174,6 +174,11 @@
             throw new ConsumerException( e.getMessage(), e );
         }
 
+        if ( versionMetadata == null )
+        {
+            throw new ConsumerException( "Unable to read metadata for artifact: " + artifact );
+        }
+
         ArtifactMetadata artifactMeta = new ArtifactMetadata();
         artifactMeta.setRepositoryId( repository.getId() );
         artifactMeta.setNamespace( artifact.getGroupId() );
@@ -202,7 +207,6 @@
             log.error( "Error attempting to get SHA-1 checksum for " + file + ": " + e.getMessage() );
         }
 
-
         // TODO: transaction
         // read the metadata and update it if it is newer or doesn't exist
         metadataRepository.updateArtifact( repository.getId(), project.getNamespace(), project.getId(),

Modified: archiva/branches/MRM-1025/archiva-modules/archiva-base/archiva-model/src/main/mdo/archiva-base.xml
URL: http://svn.apache.org/viewvc/archiva/branches/MRM-1025/archiva-modules/archiva-base/archiva-model/src/main/mdo/archiva-base.xml?rev=891064&r1=891063&r2=891064&view=diff
==============================================================================
--- archiva/branches/MRM-1025/archiva-modules/archiva-base/archiva-model/src/main/mdo/archiva-base.xml (original)
+++ archiva/branches/MRM-1025/archiva-modules/archiva-base/archiva-model/src/main/mdo/archiva-base.xml Tue Dec 15 23:07:36 2009
@@ -44,14 +44,6 @@
             <multiplicity>*</multiplicity>
           </association>
         </field>
-        <field>
-          <name>repositoryProblems</name>
-          <version>1.0.0+</version>
-          <association>
-            <type>RepositoryProblem</type>
-            <multiplicity>*</multiplicity>
-          </association>
-        </field>
       </fields>
       <codeSegments>
         <codeSegment>
@@ -838,107 +830,5 @@
         </codeSegment>
       </codeSegments>
     </class>
-
-    <!-- _______________________________________________________________
-          _   _            _ _   _
-         | | | | ___  __ _| | |_| |__
-         | |_| |/ _ \/ _` | | __| '_ \
-         |  _  |  __/ (_| | | |_| | | |
-         |_| |_|\___|\__,_|_|\__|_| |_|
-      -->
-
-    <class stash.storable="true"
-           jpox.table="REPOSITORY_PROBLEMS">
-      <name>RepositoryProblem</name>
-      <version>1.0.0+</version>
-      <fields>
-        <field stash.maxSize="50">
-          <name>repositoryId</name>
-          <version>1.0.0+</version>
-          <required>true</required>
-          <type>String</type>
-          <description>
-            The repository associated with this path and problem.
-          </description>
-        </field>
-        <field stash.maxSize="250"
-               jpox.column="REPO_PATH">
-          <name>path</name>
-          <version>1.0.0+</version>
-          <type>String</type>
-          <required>true</required>
-          <description>
-            The path into the repository for the problem.
-          </description>
-        </field>
-        <field stash.maxSize="250">
-          <name>groupId</name>
-          <version>1.0.0+</version>
-          <type>String</type>
-          <required>false</required>
-          <description>
-            The Group ID of the repository content with the problem.
-          </description>
-        </field>
-        <field stash.maxSize="80">
-          <name>artifactId</name>
-          <version>1.0.0+</version>
-          <type>String</type>
-          <required>false</required>
-          <description>
-            The Artifact ID of the repository content with the problem.
-          </description>
-        </field>
-        <field stash.maxSize="50">
-          <name>version</name>
-          <version>1.0.0+</version>
-          <type>String</type>
-          <required>false</required>
-          <description>
-            The version of the repository content with the problem.
-          </description>
-        </field>
-        <field stash.maxSize="50"
-               jpox.column="PROBLEM_TYPE">
-          <name>type</name>
-          <identifier>false</identifier>
-          <version>1.0.0+</version>
-          <required>true</required>
-          <type>String</type>
-          <description>
-            The type of health problem.
-          </description>
-        </field>
-        <field stash.maxSize="20"
-               jpox.column="PROBLEM_ORIGIN">
-          <name>origin</name>
-          <identifier>false</identifier>
-          <version>1.0.0+</version>
-          <required>true</required>
-          <type>String</type>
-          <description>
-            The origin of the health problem.
-          </description>
-        </field>
-        <field stash.maxSize="4096">
-          <name>message</name>
-          <identifier>false</identifier>
-          <version>1.0.0+</version>
-          <required>true</required>
-          <type>String</type>
-          <description>
-            The origin of the health problem.
-          </description>
-        </field>
-      </fields>
-      <codeSegments>
-        <codeSegment>
-          <version>1.0.0+</version>
-          <code><![CDATA[
-    private static final long serialVersionUID = -3426958367216659565L;
-          ]]></code>
-        </codeSegment>
-      </codeSegments>
-    </class>
   </classes>
 </model>

Modified: archiva/branches/MRM-1025/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/archiva/metadata/repository/TestMetadataRepository.java
URL: http://svn.apache.org/viewvc/archiva/branches/MRM-1025/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/archiva/metadata/repository/TestMetadataRepository.java?rev=891064&r1=891063&r2=891064&view=diff
==============================================================================
--- archiva/branches/MRM-1025/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/archiva/metadata/repository/TestMetadataRepository.java (original)
+++ archiva/branches/MRM-1025/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/archiva/metadata/repository/TestMetadataRepository.java Tue Dec 15 23:07:36 2009
@@ -116,7 +116,7 @@
         return null;  //To change body of implemented methods use File | Settings | File Templates.
     }
 
-    public void addMetadataFacet( String repositoryId, String facetId, String name, MetadataFacet metadataFacet )
+    public void addMetadataFacet( String repositoryId, String facetId, MetadataFacet metadataFacet )
     {
         //To change body of implemented methods use File | Settings | File Templates.
     }
@@ -126,6 +126,11 @@
         //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.

Modified: archiva/branches/MRM-1025/archiva-modules/archiva-database/src/main/java/org/apache/maven/archiva/database/ArchivaDAO.java
URL: http://svn.apache.org/viewvc/archiva/branches/MRM-1025/archiva-modules/archiva-database/src/main/java/org/apache/maven/archiva/database/ArchivaDAO.java?rev=891064&r1=891063&r2=891064&view=diff
==============================================================================
--- archiva/branches/MRM-1025/archiva-modules/archiva-database/src/main/java/org/apache/maven/archiva/database/ArchivaDAO.java (original)
+++ archiva/branches/MRM-1025/archiva-modules/archiva-database/src/main/java/org/apache/maven/archiva/database/ArchivaDAO.java Tue Dec 15 23:07:36 2009
@@ -40,6 +40,4 @@
 
     ArtifactDAO getArtifactDAO();
 
-    RepositoryProblemDAO getRepositoryProblemDAO();
-
 }

Modified: archiva/branches/MRM-1025/archiva-modules/archiva-database/src/main/java/org/apache/maven/archiva/database/RepositoryDatabaseEventListener.java
URL: http://svn.apache.org/viewvc/archiva/branches/MRM-1025/archiva-modules/archiva-database/src/main/java/org/apache/maven/archiva/database/RepositoryDatabaseEventListener.java?rev=891064&r1=891063&r2=891064&view=diff
==============================================================================
--- archiva/branches/MRM-1025/archiva-modules/archiva-database/src/main/java/org/apache/maven/archiva/database/RepositoryDatabaseEventListener.java (original)
+++ archiva/branches/MRM-1025/archiva-modules/archiva-database/src/main/java/org/apache/maven/archiva/database/RepositoryDatabaseEventListener.java Tue Dec 15 23:07:36 2009
@@ -19,11 +19,7 @@
  * under the License.
  */
 
-import java.util.List;
-
-import org.apache.maven.archiva.database.constraints.RepositoryProblemByArtifactConstraint;
 import org.apache.maven.archiva.model.ArchivaArtifact;
-import org.apache.maven.archiva.model.RepositoryProblem;
 import org.apache.maven.archiva.repository.ManagedRepositoryContent;
 import org.apache.maven.archiva.repository.events.RepositoryListener;
 
@@ -40,11 +36,6 @@
      */
     private ArtifactDAO artifactDAO;
 
-    /**
-     * @plexus.requirement role-hint="jdo"
-     */
-    private RepositoryProblemDAO repositoryProblemDAO;
-
     public void deleteArtifact( ManagedRepositoryContent repository, ArchivaArtifact artifact )
     {
         try
@@ -58,25 +49,5 @@
         {
             // ignored
         }
-
-        try
-        {
-            // Remove all repository problems related to this artifact
-            Constraint artifactConstraint = new RepositoryProblemByArtifactConstraint( artifact );
-            List<RepositoryProblem> repositoryProblems =
-                repositoryProblemDAO.queryRepositoryProblems( artifactConstraint );
-
-            if ( repositoryProblems != null )
-            {
-                for ( RepositoryProblem repositoryProblem : repositoryProblems )
-                {
-                    repositoryProblemDAO.deleteRepositoryProblem( repositoryProblem );
-                }
-            }
-        }
-        catch ( ArchivaDatabaseException e )
-        {
-            // ignored
-        }
     }
 }

Modified: archiva/branches/MRM-1025/archiva-modules/archiva-database/src/main/java/org/apache/maven/archiva/database/jdo/JdoArchivaDAO.java
URL: http://svn.apache.org/viewvc/archiva/branches/MRM-1025/archiva-modules/archiva-database/src/main/java/org/apache/maven/archiva/database/jdo/JdoArchivaDAO.java?rev=891064&r1=891063&r2=891064&view=diff
==============================================================================
--- archiva/branches/MRM-1025/archiva-modules/archiva-database/src/main/java/org/apache/maven/archiva/database/jdo/JdoArchivaDAO.java (original)
+++ archiva/branches/MRM-1025/archiva-modules/archiva-database/src/main/java/org/apache/maven/archiva/database/jdo/JdoArchivaDAO.java Tue Dec 15 23:07:36 2009
@@ -23,7 +23,6 @@
 
 import org.apache.maven.archiva.database.ArchivaDAO;
 import org.apache.maven.archiva.database.ArtifactDAO;
-import org.apache.maven.archiva.database.RepositoryProblemDAO;
 import org.apache.maven.archiva.database.SimpleConstraint;
 
 /**
@@ -46,11 +45,6 @@
      */
     private ArtifactDAO artifactDAO;
 
-    /**
-     * @plexus.requirement role-hint="jdo"
-     */
-    private RepositoryProblemDAO repositoryProblemDAO;
-
     public JdoArchivaDAO()
     {
         super();    //To change body of overridden methods use File | Settings | File Templates.
@@ -66,9 +60,4 @@
         return artifactDAO;
     }
 
-    public RepositoryProblemDAO getRepositoryProblemDAO()
-    {
-        return repositoryProblemDAO;
-    }
-
 }

Modified: archiva/branches/MRM-1025/archiva-modules/archiva-database/src/test/java/org/apache/maven/archiva/database/jdo/JdoArchivaDAOTest.java
URL: http://svn.apache.org/viewvc/archiva/branches/MRM-1025/archiva-modules/archiva-database/src/test/java/org/apache/maven/archiva/database/jdo/JdoArchivaDAOTest.java?rev=891064&r1=891063&r2=891064&view=diff
==============================================================================
--- archiva/branches/MRM-1025/archiva-modules/archiva-database/src/test/java/org/apache/maven/archiva/database/jdo/JdoArchivaDAOTest.java (original)
+++ archiva/branches/MRM-1025/archiva-modules/archiva-database/src/test/java/org/apache/maven/archiva/database/jdo/JdoArchivaDAOTest.java Tue Dec 15 23:07:36 2009
@@ -32,6 +32,5 @@
     public void testSubDAOs()
     {
         assertNotNull( "Artifact DAO", dao.getArtifactDAO() );
-        assertNotNull( "Repository Problem DAO", dao.getRepositoryProblemDAO() );
     }
 }

Modified: archiva/branches/MRM-1025/archiva-modules/archiva-web/archiva-webapp/pom.xml
URL: http://svn.apache.org/viewvc/archiva/branches/MRM-1025/archiva-modules/archiva-web/archiva-webapp/pom.xml?rev=891064&r1=891063&r2=891064&view=diff
==============================================================================
--- archiva/branches/MRM-1025/archiva-modules/archiva-web/archiva-webapp/pom.xml (original)
+++ archiva/branches/MRM-1025/archiva-modules/archiva-web/archiva-webapp/pom.xml Tue Dec 15 23:07:36 2009
@@ -31,16 +31,11 @@
   <dependencies>
     <dependency>
       <groupId>org.apache.archiva</groupId>
-      <artifactId>archiva-report-manager</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.archiva</groupId>
       <artifactId>repository-statistics</artifactId>
     </dependency>
     <dependency>
       <groupId>org.apache.archiva</groupId>
-      <artifactId>archiva-artifact-reports</artifactId>
-      <scope>runtime</scope>
+      <artifactId>problem-reports</artifactId>
     </dependency>
     <dependency>
       <groupId>org.apache.archiva</groupId>

Added: archiva/branches/MRM-1025/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/AbstractRepositoryBasedAction.java
URL: http://svn.apache.org/viewvc/archiva/branches/MRM-1025/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/AbstractRepositoryBasedAction.java?rev=891064&view=auto
==============================================================================
--- archiva/branches/MRM-1025/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/AbstractRepositoryBasedAction.java (added)
+++ archiva/branches/MRM-1025/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/AbstractRepositoryBasedAction.java Tue Dec 15 23:07:36 2009
@@ -0,0 +1,63 @@
+package org.apache.maven.archiva.web.action;
+
+/*
+ * 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.Collections;
+import java.util.List;
+
+import org.apache.maven.archiva.security.AccessDeniedException;
+import org.apache.maven.archiva.security.ArchivaSecurityException;
+import org.apache.maven.archiva.security.PrincipalNotFoundException;
+import org.apache.maven.archiva.security.UserRepositories;
+
+public class AbstractRepositoryBasedAction
+    extends PlexusActionSupport
+{
+    /**
+     * @plexus.requirement
+     */
+    private UserRepositories userRepositories;
+
+    protected List<String> getObservableRepos()
+    {
+        try
+        {
+            return userRepositories.getObservableRepositoryIds( getPrincipal() );
+        }
+        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();
+    }
+
+    public void setUserRepositories( UserRepositories userRepositories )
+    {
+        this.userRepositories = userRepositories;
+    }
+}

Modified: archiva/branches/MRM-1025/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/BrowseAction.java
URL: http://svn.apache.org/viewvc/archiva/branches/MRM-1025/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/BrowseAction.java?rev=891064&r1=891063&r2=891064&view=diff
==============================================================================
--- archiva/branches/MRM-1025/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/BrowseAction.java (original)
+++ archiva/branches/MRM-1025/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/BrowseAction.java Tue Dec 15 23:07:36 2009
@@ -32,31 +32,21 @@
 import org.apache.archiva.metadata.repository.storage.maven2.MavenProjectFacet;
 import org.apache.commons.collections.CollectionUtils;
 import org.apache.commons.lang.StringUtils;
-import org.apache.maven.archiva.security.AccessDeniedException;
-import org.apache.maven.archiva.security.ArchivaSecurityException;
-import org.apache.maven.archiva.security.PrincipalNotFoundException;
-import org.apache.maven.archiva.security.UserRepositories;
 
 /**
  * Browse the repository.
  *
- * @todo cache browsing results.
  * @todo implement repository selectors (all or specific repository)
  * @plexus.component role="com.opensymphony.xwork2.Action" role-hint="browseAction" instantiation-strategy="per-lookup"
  */
 public class BrowseAction
-    extends PlexusActionSupport
+    extends AbstractRepositoryBasedAction
 {
     /**
      * @plexus.requirement
      */
     private MetadataResolver metadataResolver;
 
-    /**
-     * @plexus.requirement
-     */
-    private UserRepositories userRepositories;
-
     private String groupId;
 
     private String artifactId;
@@ -289,28 +279,6 @@
         }
     }
 
-    private List<String> getObservableRepos()
-    {
-        try
-        {
-            return userRepositories.getObservableRepositoryIds( getPrincipal() );
-        }
-        catch ( PrincipalNotFoundException e )
-        {
-            log.warn( e.getMessage(), e );
-        }
-        catch ( AccessDeniedException e )
-        {
-            log.warn( e.getMessage(), e );
-            // TODO: pass this onto the screen.
-        }
-        catch ( ArchivaSecurityException e )
-        {
-            log.warn( e.getMessage(), e );
-        }
-        return Collections.emptyList();
-    }
-
     public String getGroupId()
     {
         return groupId;

Modified: archiva/branches/MRM-1025/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/SearchAction.java
URL: http://svn.apache.org/viewvc/archiva/branches/MRM-1025/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/SearchAction.java?rev=891064&r1=891063&r2=891064&view=diff
==============================================================================
--- archiva/branches/MRM-1025/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/SearchAction.java (original)
+++ archiva/branches/MRM-1025/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/SearchAction.java Tue Dec 15 23:07:36 2009
@@ -21,7 +21,6 @@
 
 import java.net.MalformedURLException;
 import java.util.ArrayList;
-import java.util.Collections;
 import java.util.LinkedHashMap;
 import java.util.List;
 import java.util.Map;
@@ -40,10 +39,6 @@
 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.security.AccessDeniedException;
-import org.apache.maven.archiva.security.ArchivaSecurityException;
-import org.apache.maven.archiva.security.PrincipalNotFoundException;
-import org.apache.maven.archiva.security.UserRepositories;
 import org.apache.struts2.ServletActionContext;
 import org.springframework.web.context.WebApplicationContext;
 import org.springframework.web.context.support.WebApplicationContextUtils;
@@ -54,7 +49,7 @@
  * @plexus.component role="com.opensymphony.xwork2.Action" role-hint="searchAction" instantiation-strategy="per-lookup"
  */
 public class SearchAction 
-    extends PlexusActionSupport
+    extends AbstractRepositoryBasedAction
     implements Preparable
 {
     /**
@@ -69,12 +64,7 @@
      * The Search Results.
      */
     private SearchResults results;
-    
-    /**
-     * @plexus.requirement
-     */
-    private UserRepositories userRepositories;
-    
+
     private static final String RESULTS = "results";
 
     private static final String ARTIFACT = "artifact";
@@ -303,14 +293,6 @@
         {
             totalPages = totalPages + 1;
         }
-        // TODO: filter / combine the artifacts by version? (is that even possible with non-artifact hits?)
-
-        /* I don't think that we should, as I expect us to utilize the 'score' system in lucene in
-         * the future to return relevant links better.
-         * I expect the lucene scoring system to take multiple hits on different areas of a single document
-         * to result in a higher score.
-         *   - Joakim
-         */
 
         if( !isEqualToPreviousSearchTerm( q ) )
         {
@@ -357,27 +339,6 @@
         return INPUT;
     }
 
-    private List<String> getObservableRepos()
-    {
-        try
-        {
-            return userRepositories.getObservableRepositoryIds( getPrincipal() );
-        }
-        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();
-    }
-
     private void buildCompleteQueryString( String searchTerm )
     {
         if ( searchTerm.indexOf( COMPLETE_QUERY_STRING_SEPARATOR ) != -1 )
@@ -594,16 +555,6 @@
         this.nexusSearch = nexusSearch;
     }
 
-    public UserRepositories getUserRepositories()
-    {
-        return userRepositories;
-    }
-
-    public void setUserRepositories( UserRepositories userRepositories )
-    {
-        this.userRepositories = userRepositories;
-    }
-
     public Map<String, String> getSearchFields()
     {
         return searchFields;

Modified: archiva/branches/MRM-1025/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/ShowArtifactAction.java
URL: http://svn.apache.org/viewvc/archiva/branches/MRM-1025/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/ShowArtifactAction.java?rev=891064&r1=891063&r2=891064&view=diff
==============================================================================
--- archiva/branches/MRM-1025/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/ShowArtifactAction.java (original)
+++ archiva/branches/MRM-1025/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/ShowArtifactAction.java Tue Dec 15 23:07:36 2009
@@ -20,7 +20,6 @@
  */
 
 import java.util.ArrayList;
-import java.util.Collections;
 import java.util.List;
 
 import com.opensymphony.xwork2.Validateable;
@@ -31,10 +30,6 @@
 import org.apache.archiva.metadata.repository.MetadataResolver;
 import org.apache.archiva.metadata.repository.MetadataResolverException;
 import org.apache.commons.lang.StringUtils;
-import org.apache.maven.archiva.security.AccessDeniedException;
-import org.apache.maven.archiva.security.ArchivaSecurityException;
-import org.apache.maven.archiva.security.PrincipalNotFoundException;
-import org.apache.maven.archiva.security.UserRepositories;
 
 /**
  * Browse the repository.
@@ -44,7 +39,7 @@
  * @plexus.component role="com.opensymphony.xwork2.Action" role-hint="showArtifactAction" instantiation-strategy="per-lookup"
  */
 public class ShowArtifactAction
-    extends PlexusActionSupport
+    extends AbstractRepositoryBasedAction
     implements Validateable
 {
     /* .\ Not Exposed \._____________________________________________ */
@@ -52,11 +47,6 @@
     /**
      * @plexus.requirement
      */
-    private UserRepositories userRepositories;
-
-    /**
-     * @plexus.requirement
-     */
     private MetadataResolver metadataResolver;
 
     /* .\ Exposed Output Objects \.__________________________________ */
@@ -209,8 +199,7 @@
      */
     public String reports()
     {
-        // TODO: hook up reports on project - this.reports = artifactsDatabase.findArtifactResults( groupId, artifactId,
-        // version );
+        // TODO: hook up reports on project
 
         return SUCCESS;
     }
@@ -274,28 +263,6 @@
         return artifact();
     }
 
-    private List<String> getObservableRepos()
-    {
-        try
-        {
-            return userRepositories.getObservableRepositoryIds( getPrincipal() );
-        }
-        catch ( PrincipalNotFoundException e )
-        {
-            log.warn( e.getMessage(), e );
-        }
-        catch ( AccessDeniedException e )
-        {
-            log.warn( e.getMessage(), e );
-            // TODO: pass this onto the screen.
-        }
-        catch ( ArchivaSecurityException e )
-        {
-            log.warn( e.getMessage(), e );
-        }
-        return Collections.emptyList();
-    }
-
     @Override
     public void validate()
     {

Modified: archiva/branches/MRM-1025/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/reports/GenerateReportAction.java
URL: http://svn.apache.org/viewvc/archiva/branches/MRM-1025/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/reports/GenerateReportAction.java?rev=891064&r1=891063&r2=891064&view=diff
==============================================================================
--- archiva/branches/MRM-1025/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/reports/GenerateReportAction.java (original)
+++ archiva/branches/MRM-1025/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/reports/GenerateReportAction.java Tue Dec 15 23:07:36 2009
@@ -27,31 +27,23 @@
 import java.util.ArrayList;
 import java.util.Calendar;
 import java.util.Collection;
+import java.util.Collections;
 import java.util.Date;
 import java.util.List;
 import java.util.Map;
 import java.util.TreeMap;
-import javax.servlet.http.HttpServletRequest;
 
 import com.opensymphony.xwork2.Preparable;
+import org.apache.archiva.metadata.repository.MetadataRepository;
 import org.apache.archiva.metadata.repository.stats.RepositoryStatistics;
 import org.apache.archiva.metadata.repository.stats.RepositoryStatisticsManager;
+import org.apache.archiva.reports.RepositoryProblemFacet;
 import org.apache.commons.io.IOUtils;
 import org.apache.commons.lang.StringUtils;
 import org.apache.commons.lang.time.DateUtils;
 import org.apache.maven.archiva.configuration.ArchivaConfiguration;
-import org.apache.maven.archiva.database.ArchivaDAO;
-import org.apache.maven.archiva.database.Constraint;
-import org.apache.maven.archiva.database.constraints.RangeConstraint;
-import org.apache.maven.archiva.database.constraints.RepositoryProblemByGroupIdConstraint;
-import org.apache.maven.archiva.database.constraints.RepositoryProblemByRepositoryIdConstraint;
-import org.apache.maven.archiva.database.constraints.RepositoryProblemConstraint;
-import org.apache.maven.archiva.database.constraints.UniqueFieldConstraint;
-import org.apache.maven.archiva.model.RepositoryProblem;
-import org.apache.maven.archiva.model.RepositoryProblemReport;
 import org.apache.maven.archiva.security.ArchivaRoleConstants;
-import org.apache.maven.archiva.web.action.PlexusActionSupport;
-import org.apache.struts2.interceptor.ServletRequestAware;
+import org.apache.maven.archiva.web.action.AbstractRepositoryBasedAction;
 import org.codehaus.plexus.redback.rbac.Resource;
 import org.codehaus.redback.integration.interceptor.SecureAction;
 import org.codehaus.redback.integration.interceptor.SecureActionBundle;
@@ -63,8 +55,8 @@
  * @plexus.component role="com.opensymphony.xwork2.Action" role-hint="generateReport" instantiation-strategy="per-lookup"
  */
 public class GenerateReportAction
-    extends PlexusActionSupport
-    implements SecureAction, ServletRequestAware, Preparable
+    extends AbstractRepositoryBasedAction
+    implements SecureAction, Preparable
 {
     public static final String ALL_REPOSITORIES = "All Repositories";
 
@@ -79,11 +71,6 @@
     private Logger log = LoggerFactory.getLogger( GenerateReportAction.class );
 
     /**
-     * @plexus.requirement role-hint="jdo"
-     */
-    private ArchivaDAO dao;
-
-    /**
      * @plexus.requirement
      */
     private ArchivaConfiguration archivaConfiguration;
@@ -93,8 +80,6 @@
      */
     private RepositoryStatisticsManager repositoryStatisticsManager;
 
-    private HttpServletRequest request;
-
     private String groupId;
 
     private String repositoryId;
@@ -113,8 +98,8 @@
 
     private Collection<String> repositoryIds;
 
-    private Map<String, List<RepositoryProblemReport>> repositoriesMap =
-        new TreeMap<String, List<RepositoryProblemReport>>();
+    private Map<String, List<RepositoryProblemFacet>> repositoriesMap =
+        new TreeMap<String, List<RepositoryProblemFacet>>();
 
     private List<String> availableRepositories;
 
@@ -124,13 +109,17 @@
 
     private boolean lastPage;
 
+    /**
+     * @plexus.requirement
+     */
+    private MetadataRepository metadataRepository;
+
     @SuppressWarnings("unchecked")
     public void prepare()
     {
         repositoryIds = new ArrayList<String>();
         repositoryIds.add( ALL_REPOSITORIES ); // comes first to be first in the list
-        repositoryIds.addAll( (List<String>) dao.query(
-            new UniqueFieldConstraint( RepositoryProblem.class.getName(), "repositoryId" ) ) );
+        repositoryIds.addAll( getObservableRepos() );
 
         availableRepositories = new ArrayList<String>();
 
@@ -228,8 +217,7 @@
 
                 if ( stats.isEmpty() )
                 {
-                    addActionError(
-                        "No statistics available for repository. Repository might not have been scanned." );
+                    addActionError( "No statistics available for repository. Repository might not have been scanned." );
                     return ERROR;
                 }
 
@@ -289,7 +277,7 @@
         selectedRepositories = parseSelectedRepositories();
         List<RepositoryStatistics> repositoryStatistics = new ArrayList<RepositoryStatistics>();
 
-        StringBuffer input = null;
+        StringBuffer input;
         if ( selectedRepositories.size() > 1 )
         {
             try
@@ -425,6 +413,7 @@
     }
 
     // hack for parsing the struts list passed as param in <s:url ../>
+
     private List<String> parseSelectedRepositories()
     {
         List<String> pasedSelectedRepos = new ArrayList<String>();
@@ -499,31 +488,65 @@
             return INPUT;
         }
 
-        List<RepositoryProblem> problemArtifacts =
-            dao.getRepositoryProblemDAO().queryRepositoryProblems( configureConstraint() );
+        List<String> observableRepos = getObservableRepos();
+        Collection<String> repoIds;
+        if ( StringUtils.isEmpty( repositoryId ) || ALL_REPOSITORIES.equals( repositoryId ) )
+        {
+            repoIds = observableRepos;
+        }
+        else if ( observableRepos.contains( repositoryId ) )
+        {
+            repoIds = Collections.singletonList( repositoryId );
+        }
+        else
+        {
+            repoIds = Collections.emptyList();
+        }
 
-        String contextPath =
-            request.getRequestURL().substring( 0, request.getRequestURL().indexOf( request.getRequestURI() ) );
-        for ( RepositoryProblem problem : problemArtifacts )
+        List<RepositoryProblemFacet> problemArtifacts = new ArrayList<RepositoryProblemFacet>();
+        for ( String repoId : repoIds )
         {
-            RepositoryProblemReport problemArtifactReport = new RepositoryProblemReport( problem );
+            // TODO: improve performance by navigating into a group subtree. Currently group is property, not part of name of item
+            for ( String name : metadataRepository.getMetadataFacets( repoId, RepositoryProblemFacet.FACET_ID ) )
+            {
+                RepositoryProblemFacet metadataFacet =
+                    (RepositoryProblemFacet) metadataRepository.getMetadataFacet( repoId,
+                                                                                  RepositoryProblemFacet.FACET_ID,
+                                                                                  name );
 
-            problemArtifactReport.setGroupURL( contextPath + "/browse/" + problem.getGroupId() );
-            problemArtifactReport.setArtifactURL(
-                contextPath + "/browse/" + problem.getGroupId() + "/" + problem.getArtifactId() );
+                if ( StringUtils.isEmpty( groupId ) || groupId.equals( metadataFacet.getNamespace() ) )
+                {
+                    problemArtifacts.add( metadataFacet );
+                }
+            }
+        }
+
+        // TODO: getting range only after reading is not efficient for a large number of artifacts
+        int lowerBound = ( page - 1 ) * rowCount;
+        int upperBound = ( page * rowCount ) + 1; // Add 1 to check if it's the last page or not.
+        if ( upperBound <= problemArtifacts.size() )
+        {
+            problemArtifacts = problemArtifacts.subList( lowerBound, upperBound );
+        }
+        else
+        {
+            problemArtifacts = problemArtifacts.subList( lowerBound, problemArtifacts.size() );
+        }
 
-            List<RepositoryProblemReport> problemsList;
-            if ( repositoriesMap.containsKey( problemArtifactReport.getRepositoryId() ) )
+        for ( RepositoryProblemFacet problem : problemArtifacts )
+        {
+            List<RepositoryProblemFacet> problemsList;
+            if ( repositoriesMap.containsKey( problem.getRepositoryId() ) )
             {
-                problemsList = repositoriesMap.get( problemArtifactReport.getRepositoryId() );
+                problemsList = repositoriesMap.get( problem.getRepositoryId() );
             }
             else
             {
-                problemsList = new ArrayList<RepositoryProblemReport>();
-                repositoriesMap.put( problemArtifactReport.getRepositoryId(), problemsList );
+                problemsList = new ArrayList<RepositoryProblemFacet>();
+                repositoriesMap.put( problem.getRepositoryId(), problemsList );
             }
 
-            problemsList.add( problemArtifactReport );
+            problemsList.add( problem );
         }
 
         // TODO: handling should be improved
@@ -542,36 +565,6 @@
         }
     }
 
-    private Constraint configureConstraint()
-    {
-        Constraint constraint;
-
-        int[] range =
-            new int[]{( page - 1 ) * rowCount, ( page * rowCount ) + 1}; // Add 1 to check if it's the last page or not.
-
-        if ( groupId != null && ( !groupId.equals( "" ) ) )
-        {
-            if ( repositoryId != null && ( !repositoryId.equals( "" ) && !repositoryId.equals( ALL_REPOSITORIES ) ) )
-            {
-                constraint = new RepositoryProblemConstraint( range, groupId, repositoryId );
-            }
-            else
-            {
-                constraint = new RepositoryProblemByGroupIdConstraint( range, groupId );
-            }
-        }
-        else if ( repositoryId != null && ( !repositoryId.equals( "" ) && !repositoryId.equals( ALL_REPOSITORIES ) ) )
-        {
-            constraint = new RepositoryProblemByRepositoryIdConstraint( range, repositoryId );
-        }
-        else
-        {
-            constraint = new RangeConstraint( range, "repositoryId" );
-        }
-
-        return constraint;
-    }
-
     public SecureActionBundle getSecureActionBundle()
         throws SecureActionException
     {
@@ -588,11 +581,6 @@
         return repositoryIds;
     }
 
-    public void setServletRequest( HttpServletRequest request )
-    {
-        this.request = request;
-    }
-
     public String getGroupId()
     {
         return groupId;
@@ -633,12 +621,12 @@
         this.rowCount = rowCount;
     }
 
-    public void setRepositoriesMap( Map<String, List<RepositoryProblemReport>> repositoriesMap )
+    public void setRepositoriesMap( Map<String, List<RepositoryProblemFacet>> repositoriesMap )
     {
         this.repositoriesMap = repositoriesMap;
     }
 
-    public Map<String, List<RepositoryProblemReport>> getRepositoriesMap()
+    public Map<String, List<RepositoryProblemFacet>> getRepositoriesMap()
     {
         return repositoriesMap;
     }
@@ -717,4 +705,9 @@
     {
         this.repositoryStatisticsManager = repositoryStatisticsManager;
     }
+
+    public void setMetadataRepository( MetadataRepository metadataRepository )
+    {
+        this.metadataRepository = metadataRepository;
+    }
 }

Modified: archiva/branches/MRM-1025/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/applicationContext.xml
URL: http://svn.apache.org/viewvc/archiva/branches/MRM-1025/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/applicationContext.xml?rev=891064&r1=891063&r2=891064&view=diff
==============================================================================
--- archiva/branches/MRM-1025/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/applicationContext.xml (original)
+++ archiva/branches/MRM-1025/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/applicationContext.xml Tue Dec 15 23:07:36 2009
@@ -42,8 +42,8 @@
   <!-- Web Services : Search Service -->
   <bean name="searchService" lazy-init="true" scope="singleton" class="org.apache.archiva.web.xmlrpc.services.SearchServiceImpl">    
     <constructor-arg ref="xmlRpcUserRepositories"/>   
-    <constructor-arg ref="archivaDAO#jdo"/>
     <constructor-arg ref="metadataResolver"/>
+    <constructor-arg ref="metadataRepository"/>
     <constructor-arg ref="nexusSearch"/>
   </bean>
   

Modified: archiva/branches/MRM-1025/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/reports/basicReport.jsp
URL: http://svn.apache.org/viewvc/archiva/branches/MRM-1025/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/reports/basicReport.jsp?rev=891064&r1=891063&r2=891064&view=diff
==============================================================================
--- archiva/branches/MRM-1025/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/reports/basicReport.jsp (original)
+++ archiva/branches/MRM-1025/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/reports/basicReport.jsp Tue Dec 15 23:07:36 2009
@@ -37,14 +37,14 @@
 	<c:forEach var="report" items='${repository.value}'>
 	
 	    <p>
-      	<archiva:groupIdLink var="${report.groupId}" includeTop="true"/>
+      	<archiva:groupIdLink var="${report.namespace}" includeTop="true"/>
       	<c:set var="url">
         <s:url action="browseArtifact" namespace="/">
-          <s:param name="groupId" value="%{#attr.report.groupId}"/>
-          <s:param name="artifactId" value="%{#attr.report.artifactId}"/>
+          <s:param name="groupId" value="%{#attr.report.namespace}"/>
+          <s:param name="artifactId" value="%{#attr.report.project}"/>
         </s:url>
       	</c:set>
-      	<a href="${url}">${report.artifactId}</a> /
+      	<a href="${url}">${report.project}</a> /
       	<strong>${report.version}</strong>
     	</p>
     
@@ -54,18 +54,18 @@
 
   <c:set var="prevPageUrl">
     <s:url action="generateReport" namespace="/">
-      <s:param name="groupId" value="${groupId}"/>
-      <s:param name="repositoryId" value="${repositoryId}"/>
-      <s:param name="rowCount" value="${rowCount}"/>
-      <s:param name="page" value="${page - 1}"/>
+      <s:param name="groupId" />
+      <s:param name="repositoryId" />
+      <s:param name="rowCount" />
+      <s:param name="page" value="%{#attr.page - 1}"/>
     </s:url>
   </c:set>
   <c:set var="nextPageUrl">
     <s:url action="generateReport" namespace="/">
-      <s:param name="groupId" value="${groupId}"/>
-      <s:param name="repositoryId" value="${repositoryId}"/>
-      <s:param name="rowCount" value="${rowCount}"/>
-      <s:param name="page" value="${page + 1}"/>
+      <s:param name="groupId" />
+      <s:param name="repositoryId" />
+      <s:param name="rowCount" />
+      <s:param name="page" value="%{#attr.page + 1}"/>
     </s:url>
   </c:set>
   <s:set name="page" value="page"/>

Modified: archiva/branches/MRM-1025/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/metadata/repository/memory/TestMetadataRepository.java
URL: http://svn.apache.org/viewvc/archiva/branches/MRM-1025/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/metadata/repository/memory/TestMetadataRepository.java?rev=891064&r1=891063&r2=891064&view=diff
==============================================================================
--- archiva/branches/MRM-1025/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/metadata/repository/memory/TestMetadataRepository.java (original)
+++ archiva/branches/MRM-1025/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/metadata/repository/memory/TestMetadataRepository.java Tue Dec 15 23:07:36 2009
@@ -156,7 +156,7 @@
         throw new UnsupportedOperationException();
     }
 
-    public void addMetadataFacet( String repositoryId, String facetId, String name, MetadataFacet metadataFacet )
+    public void addMetadataFacet( String repositoryId, String facetId, MetadataFacet metadataFacet )
     {
         throw new UnsupportedOperationException();
     }
@@ -166,6 +166,11 @@
         throw new UnsupportedOperationException();
     }
 
+    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 artifacts;

Modified: archiva/branches/MRM-1025/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/admin/repositories/ArchivaDAOStub.java
URL: http://svn.apache.org/viewvc/archiva/branches/MRM-1025/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/admin/repositories/ArchivaDAOStub.java?rev=891064&r1=891063&r2=891064&view=diff
==============================================================================
--- archiva/branches/MRM-1025/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/admin/repositories/ArchivaDAOStub.java (original)
+++ archiva/branches/MRM-1025/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/admin/repositories/ArchivaDAOStub.java Tue Dec 15 23:07:36 2009
@@ -23,9 +23,7 @@
 
 import org.apache.maven.archiva.database.ArchivaDAO;
 import org.apache.maven.archiva.database.ArtifactDAO;
-import org.apache.maven.archiva.database.RepositoryProblemDAO;
 import org.apache.maven.archiva.database.SimpleConstraint;
-import org.apache.maven.archiva.database.constraints.UniqueFieldConstraint;
 
 /**
  * Stub class for Archiva DAO to avoid having to set up a database for tests.
@@ -38,16 +36,8 @@
 
     private ArtifactDAO artifactDao;
 
-    private List<String> repositoryIds;
-
-    private RepositoryProblemDAO repositoryProblemDAO;
-
     public List<?> query( SimpleConstraint constraint )
     {
-        if ( constraint instanceof UniqueFieldConstraint )
-        {
-            return repositoryIds;
-        }
         throw new UnsupportedOperationException();
     }
 
@@ -56,23 +46,9 @@
         return artifactDao;
     }
 
-    public RepositoryProblemDAO getRepositoryProblemDAO()
-    {
-        return repositoryProblemDAO;
-    }
-
     public void setArtifactDao( ArtifactDAO artifactDao )
     {
         this.artifactDao = artifactDao;
     }
 
-    public void setRepositoryIds( List<String> repositoryIds )
-    {
-        this.repositoryIds = repositoryIds;
-    }
-
-    public void setRepositoryProblemDAO( RepositoryProblemDAO repositoryProblemDAO )
-    {
-        this.repositoryProblemDAO = repositoryProblemDAO;
-    }
 }

Modified: archiva/branches/MRM-1025/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/reports/GenerateReportActionTest.java
URL: http://svn.apache.org/viewvc/archiva/branches/MRM-1025/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/reports/GenerateReportActionTest.java?rev=891064&r1=891063&r2=891064&view=diff
==============================================================================
--- archiva/branches/MRM-1025/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/reports/GenerateReportActionTest.java (original)
+++ archiva/branches/MRM-1025/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/reports/GenerateReportActionTest.java Tue Dec 15 23:07:36 2009
@@ -26,22 +26,14 @@
 import java.util.Date;
 import java.util.List;
 
-import com.meterware.servletunit.ServletRunner;
-import com.meterware.servletunit.ServletUnitClient;
 import com.opensymphony.xwork2.Action;
+import org.apache.archiva.metadata.model.MetadataFacet;
+import org.apache.archiva.metadata.repository.MetadataRepository;
 import org.apache.archiva.metadata.repository.stats.RepositoryStatistics;
 import org.apache.archiva.metadata.repository.stats.RepositoryStatisticsManager;
+import org.apache.archiva.reports.RepositoryProblemFacet;
 import org.apache.commons.io.IOUtils;
-import org.apache.maven.archiva.database.ArchivaDAO;
 import org.apache.maven.archiva.database.ArchivaDatabaseException;
-import org.apache.maven.archiva.database.RepositoryProblemDAO;
-import org.apache.maven.archiva.database.constraints.RangeConstraint;
-import org.apache.maven.archiva.database.constraints.RepositoryProblemByGroupIdConstraint;
-import org.apache.maven.archiva.database.constraints.RepositoryProblemByRepositoryIdConstraint;
-import org.apache.maven.archiva.database.constraints.RepositoryProblemConstraint;
-import org.apache.maven.archiva.model.RepositoryProblem;
-import org.apache.maven.archiva.model.RepositoryProblemReport;
-import org.apache.maven.archiva.web.action.admin.repositories.ArchivaDAOStub;
 import org.codehaus.plexus.spring.PlexusInSpringTestCase;
 import org.easymock.MockControl;
 
@@ -59,36 +51,33 @@
 
     private static final String INTERNAL = "internal";
 
-    private RepositoryProblemDAO repositoryProblemDAO;
-
-    private MockControl repositoryProblemDAOControl;
-
     private static final String GROUP_ID = "groupId";
 
-    private static final String URL = "http://localhost/reports/generateReport.action";
-
     private RepositoryStatisticsManager repositoryStatisticsManager;
 
     private MockControl repositoryStatisticsManagerControl;
 
+    private MockControl metadataRepositoryControl;
+
+    private MetadataRepository metadataRepository;
+
+    private static final String PROBLEM = "problem";
+
     @Override
     protected void setUp()
         throws Exception
     {
         super.setUp();
 
-        ArchivaDAOStub archivaDAOStub = (ArchivaDAOStub) lookup( ArchivaDAO.class, "jdo" );
-        archivaDAOStub.setRepositoryIds( Arrays.asList( "repo1", "repo2" ) );
-
-        repositoryProblemDAOControl = MockControl.createControl( RepositoryProblemDAO.class );
-        repositoryProblemDAO = (RepositoryProblemDAO) repositoryProblemDAOControl.getMock();
-        archivaDAOStub.setRepositoryProblemDAO( repositoryProblemDAO );
-
         action = (GenerateReportAction) lookup( Action.class, "generateReport" );
 
         repositoryStatisticsManagerControl = MockControl.createControl( RepositoryStatisticsManager.class );
         repositoryStatisticsManager = (RepositoryStatisticsManager) repositoryStatisticsManagerControl.getMock();
         action.setRepositoryStatisticsManager( repositoryStatisticsManager );
+
+        metadataRepositoryControl = MockControl.createControl( MetadataRepository.class );
+        metadataRepository = (MetadataRepository) metadataRepositoryControl.getMock();
+        action.setMetadataRepository( metadataRepository );
     }
 
     private void prepareAction( List<String> selectedRepositories, List<String> availableRepositories )
@@ -96,7 +85,7 @@
         action.setSelectedRepositories( selectedRepositories );
         action.prepare();
 
-        assertEquals( Arrays.asList( GenerateReportAction.ALL_REPOSITORIES, "repo1", "repo2" ),
+        assertEquals( Arrays.asList( GenerateReportAction.ALL_REPOSITORIES, INTERNAL, SNAPSHOTS ),
                       action.getRepositoryIds() );
         assertEquals( availableRepositories, action.getAvailableRepositories() );
     }
@@ -424,42 +413,41 @@
     public void testHealthReportSingleRepo()
         throws Exception
     {
-        RepositoryProblem problem1 = createProblem( GROUP_ID, "artifactId", INTERNAL );
-        RepositoryProblem problem2 = createProblem( GROUP_ID, "artifactId-2", INTERNAL );
-        repositoryProblemDAOControl.expectAndReturn( repositoryProblemDAO.queryRepositoryProblems(
-            new RepositoryProblemByRepositoryIdConstraint( new int[]{0, 101}, INTERNAL ) ),
-                                                     Arrays.asList( problem1, problem2 ) );
-        repositoryProblemDAOControl.replay();
+        RepositoryProblemFacet problem1 = createProblem( GROUP_ID, "artifactId", INTERNAL );
+        RepositoryProblemFacet problem2 = createProblem( GROUP_ID, "artifactId-2", INTERNAL );
+
+        metadataRepositoryControl.expectAndReturn(
+            metadataRepository.getMetadataFacets( INTERNAL, RepositoryProblemFacet.FACET_ID ),
+            Arrays.asList( problem1.getName(), problem2.getName() ) );
+        metadataRepositoryControl.expectAndReturn(
+            metadataRepository.getMetadataFacet( INTERNAL, RepositoryProblemFacet.FACET_ID, problem1.getName() ),
+            problem1 );
+        metadataRepositoryControl.expectAndReturn(
+            metadataRepository.getMetadataFacet( INTERNAL, RepositoryProblemFacet.FACET_ID, problem2.getName() ),
+            problem2 );
+        metadataRepositoryControl.replay();
 
         action.setRepositoryId( INTERNAL );
-        ServletRunner sr = new ServletRunner();
-        ServletUnitClient sc = sr.newClient();
 
-        action.setServletRequest( sc.newInvocation( URL ).getRequest() );
         prepareAction( Collections.<String>emptyList(), Arrays.asList( SNAPSHOTS, INTERNAL ) );
 
         String result = action.execute();
         assertSuccessResult( result );
 
-        RepositoryProblemReport problemReport1 = createProblemReport( problem1 );
-        RepositoryProblemReport problemReport2 = createProblemReport( problem2 );
         assertEquals( Collections.singleton( INTERNAL ), action.getRepositoriesMap().keySet() );
-        assertEquals( Arrays.asList( problemReport1, problemReport2 ), action.getRepositoriesMap().get( INTERNAL ) );
+        assertEquals( Arrays.asList( problem1, problem2 ), action.getRepositoriesMap().get( INTERNAL ) );
 
-        repositoryProblemDAOControl.verify();
+        metadataRepositoryControl.verify();
     }
 
     public void testHealthReportInvalidRowCount()
         throws Exception
     {
-        repositoryProblemDAOControl.replay();
+        metadataRepositoryControl.replay();
 
         action.setRowCount( 0 );
         action.setRepositoryId( INTERNAL );
-        ServletRunner sr = new ServletRunner();
-        ServletUnitClient sc = sr.newClient();
 
-        action.setServletRequest( sc.newInvocation( URL ).getRequest() );
         prepareAction( Collections.<String>emptyList(), Arrays.asList( SNAPSHOTS, INTERNAL ) );
 
         String result = action.execute();
@@ -467,113 +455,119 @@
         assertFalse( action.hasActionErrors() );
         assertTrue( action.hasFieldErrors() );
 
-        repositoryProblemDAOControl.verify();
+        metadataRepositoryControl.verify();
     }
 
     public void testHealthReportAllRepos()
         throws Exception
     {
-        RepositoryProblem problem1 = createProblem( GROUP_ID, "artifactId", INTERNAL );
-        RepositoryProblem problem2 = createProblem( GROUP_ID, "artifactId-2", SNAPSHOTS );
-        repositoryProblemDAOControl.expectAndReturn(
-            repositoryProblemDAO.queryRepositoryProblems( new RangeConstraint( new int[]{0, 101} ) ),
-            Arrays.asList( problem1, problem2 ) );
-        repositoryProblemDAOControl.replay();
+        RepositoryProblemFacet problem1 = createProblem( GROUP_ID, "artifactId", INTERNAL );
+        RepositoryProblemFacet problem2 = createProblem( GROUP_ID, "artifactId-2", SNAPSHOTS );
+        metadataRepositoryControl.expectAndReturn(
+            metadataRepository.getMetadataFacets( INTERNAL, RepositoryProblemFacet.FACET_ID ),
+            Arrays.asList( problem1.getName() ) );
+        metadataRepositoryControl.expectAndReturn(
+            metadataRepository.getMetadataFacets( SNAPSHOTS, RepositoryProblemFacet.FACET_ID ),
+            Arrays.asList( problem2.getName() ) );
+        metadataRepositoryControl.expectAndReturn(
+            metadataRepository.getMetadataFacet( INTERNAL, RepositoryProblemFacet.FACET_ID, problem1.getName() ),
+            problem1 );
+        metadataRepositoryControl.expectAndReturn(
+            metadataRepository.getMetadataFacet( SNAPSHOTS, RepositoryProblemFacet.FACET_ID, problem2.getName() ),
+            problem2 );
+        metadataRepositoryControl.replay();
 
         action.setRepositoryId( GenerateReportAction.ALL_REPOSITORIES );
-        ServletRunner sr = new ServletRunner();
-        ServletUnitClient sc = sr.newClient();
 
-        action.setServletRequest( sc.newInvocation( URL ).getRequest() );
         prepareAction( Collections.<String>emptyList(), Arrays.asList( SNAPSHOTS, INTERNAL ) );
 
         String result = action.execute();
         assertSuccessResult( result );
 
-        RepositoryProblemReport problemReport1 = createProblemReport( problem1 );
-        RepositoryProblemReport problemReport2 = createProblemReport( problem2 );
         assertEquals( Arrays.asList( INTERNAL, SNAPSHOTS ),
                       new ArrayList<String>( action.getRepositoriesMap().keySet() ) );
-        assertEquals( Arrays.asList( problemReport1 ), action.getRepositoriesMap().get( INTERNAL ) );
-        assertEquals( Arrays.asList( problemReport2 ), action.getRepositoriesMap().get( SNAPSHOTS ) );
+        assertEquals( Arrays.asList( problem1 ), action.getRepositoriesMap().get( INTERNAL ) );
+        assertEquals( Arrays.asList( problem2 ), action.getRepositoriesMap().get( SNAPSHOTS ) );
 
-        repositoryProblemDAOControl.verify();
+        metadataRepositoryControl.verify();
     }
 
     public void testHealthReportSingleRepoByCorrectGroupId()
         throws Exception
     {
-        RepositoryProblem problem1 = createProblem( GROUP_ID, "artifactId", INTERNAL );
-        RepositoryProblem problem2 = createProblem( GROUP_ID, "artifactId-2", INTERNAL );
-        repositoryProblemDAOControl.expectAndReturn( repositoryProblemDAO.queryRepositoryProblems(
-            new RepositoryProblemConstraint( new int[]{0, 101}, GROUP_ID, INTERNAL ) ),
-                                                     Arrays.asList( problem1, problem2 ) );
-        repositoryProblemDAOControl.replay();
+        RepositoryProblemFacet problem1 = createProblem( GROUP_ID, "artifactId", INTERNAL );
+        RepositoryProblemFacet problem2 = createProblem( GROUP_ID, "artifactId-2", INTERNAL );
+        metadataRepositoryControl.expectAndReturn(
+            metadataRepository.getMetadataFacets( INTERNAL, RepositoryProblemFacet.FACET_ID ),
+            Arrays.asList( problem1.getName(), problem2.getName() ) );
+        metadataRepositoryControl.expectAndReturn(
+            metadataRepository.getMetadataFacet( INTERNAL, RepositoryProblemFacet.FACET_ID, problem1.getName() ),
+            problem1 );
+        metadataRepositoryControl.expectAndReturn(
+            metadataRepository.getMetadataFacet( INTERNAL, RepositoryProblemFacet.FACET_ID, problem2.getName() ),
+            problem2 );
+        metadataRepositoryControl.replay();
 
         action.setGroupId( GROUP_ID );
         action.setRepositoryId( INTERNAL );
-        ServletRunner sr = new ServletRunner();
-        ServletUnitClient sc = sr.newClient();
 
-        action.setServletRequest( sc.newInvocation( URL ).getRequest() );
         prepareAction( Collections.<String>emptyList(), Arrays.asList( SNAPSHOTS, INTERNAL ) );
 
         String result = action.execute();
         assertSuccessResult( result );
 
-        RepositoryProblemReport problemReport1 = createProblemReport( problem1 );
-        RepositoryProblemReport problemReport2 = createProblemReport( problem2 );
         assertEquals( Collections.singleton( INTERNAL ), action.getRepositoriesMap().keySet() );
-        assertEquals( Arrays.asList( problemReport1, problemReport2 ), action.getRepositoriesMap().get( INTERNAL ) );
+        assertEquals( Arrays.asList( problem1, problem2 ), action.getRepositoriesMap().get( INTERNAL ) );
 
-        repositoryProblemDAOControl.verify();
+        metadataRepositoryControl.verify();
     }
 
     public void testHealthReportSingleRepoByCorrectGroupIdAllRepositories()
         throws Exception
     {
-        RepositoryProblem problem1 = createProblem( GROUP_ID, "artifactId", INTERNAL );
-        RepositoryProblem problem2 = createProblem( GROUP_ID, "artifactId-2", SNAPSHOTS );
-        repositoryProblemDAOControl.expectAndReturn( repositoryProblemDAO.queryRepositoryProblems(
-            new RepositoryProblemByGroupIdConstraint( new int[]{0, 101}, GROUP_ID ) ),
-                                                     Arrays.asList( problem1, problem2 ) );
-        repositoryProblemDAOControl.replay();
+        RepositoryProblemFacet problem1 = createProblem( GROUP_ID, "artifactId", INTERNAL );
+        RepositoryProblemFacet problem2 = createProblem( GROUP_ID, "artifactId-2", SNAPSHOTS );
+        metadataRepositoryControl.expectAndReturn(
+            metadataRepository.getMetadataFacets( INTERNAL, RepositoryProblemFacet.FACET_ID ),
+            Arrays.asList( problem1.getName() ) );
+        metadataRepositoryControl.expectAndReturn(
+            metadataRepository.getMetadataFacets( SNAPSHOTS, RepositoryProblemFacet.FACET_ID ),
+            Arrays.asList( problem2.getName() ) );
+        metadataRepositoryControl.expectAndReturn(
+            metadataRepository.getMetadataFacet( INTERNAL, RepositoryProblemFacet.FACET_ID, problem1.getName() ),
+            problem1 );
+        metadataRepositoryControl.expectAndReturn(
+            metadataRepository.getMetadataFacet( SNAPSHOTS, RepositoryProblemFacet.FACET_ID, problem2.getName() ),
+            problem2 );
+        metadataRepositoryControl.replay();
 
         action.setGroupId( GROUP_ID );
         action.setRepositoryId( GenerateReportAction.ALL_REPOSITORIES );
-        ServletRunner sr = new ServletRunner();
-        ServletUnitClient sc = sr.newClient();
 
-        action.setServletRequest( sc.newInvocation( URL ).getRequest() );
         prepareAction( Collections.<String>emptyList(), Arrays.asList( SNAPSHOTS, INTERNAL ) );
 
         String result = action.execute();
         assertSuccessResult( result );
 
-        RepositoryProblemReport problemReport1 = createProblemReport( problem1 );
-        RepositoryProblemReport problemReport2 = createProblemReport( problem2 );
         assertEquals( Arrays.asList( INTERNAL, SNAPSHOTS ),
                       new ArrayList<String>( action.getRepositoriesMap().keySet() ) );
-        assertEquals( Arrays.asList( problemReport1 ), action.getRepositoriesMap().get( INTERNAL ) );
-        assertEquals( Arrays.asList( problemReport2 ), action.getRepositoriesMap().get( SNAPSHOTS ) );
+        assertEquals( Arrays.asList( problem1 ), action.getRepositoriesMap().get( INTERNAL ) );
+        assertEquals( Arrays.asList( problem2 ), action.getRepositoriesMap().get( SNAPSHOTS ) );
 
-        repositoryProblemDAOControl.verify();
+        metadataRepositoryControl.verify();
     }
 
     public void testHealthReportSingleRepoByIncorrectGroupId()
         throws Exception
     {
-        repositoryProblemDAOControl.expectAndReturn( repositoryProblemDAO.queryRepositoryProblems(
-            new RepositoryProblemConstraint( new int[]{0, 101}, "not.it", INTERNAL ) ),
-                                                     Collections.<Object>emptyList() );
-        repositoryProblemDAOControl.replay();
+        metadataRepositoryControl.expectAndReturn(
+            metadataRepository.getMetadataFacets( INTERNAL, RepositoryProblemFacet.FACET_ID ),
+            Collections.<MetadataFacet>emptyList() );
+        metadataRepositoryControl.replay();
 
         action.setGroupId( "not.it" );
         action.setRepositoryId( INTERNAL );
-        ServletRunner sr = new ServletRunner();
-        ServletUnitClient sc = sr.newClient();
 
-        action.setServletRequest( sc.newInvocation( URL ).getRequest() );
         prepareAction( Collections.<String>emptyList(), Arrays.asList( SNAPSHOTS, INTERNAL ) );
 
         String result = action.execute();
@@ -581,7 +575,7 @@
         assertFalse( action.hasActionErrors() );
         assertFalse( action.hasFieldErrors() );
 
-        repositoryProblemDAOControl.verify();
+        metadataRepositoryControl.verify();
     }
 
     private void assertMultiRepoCsvResult()
@@ -595,20 +589,13 @@
                 "snapshots,0,0,0,0,0\n" + "internal,0,0,0,0,0\n", IOUtils.toString( action.getInputStream() ) );
     }
 
-    private RepositoryProblemReport createProblemReport( RepositoryProblem problem )
-    {
-        RepositoryProblemReport problemReport = new RepositoryProblemReport( problem );
-        problemReport.setGroupURL( "http://localhost/browse/" + problem.getGroupId() );
-        problemReport.setArtifactURL( problemReport.getGroupURL() + "/" + problem.getArtifactId() );
-        return problemReport;
-    }
-
-    private RepositoryProblem createProblem( String groupId, String artifactId, String repoId )
+    private RepositoryProblemFacet createProblem( String groupId, String artifactId, String repoId )
     {
-        RepositoryProblem problem = new RepositoryProblem();
+        RepositoryProblemFacet problem = new RepositoryProblemFacet();
         problem.setRepositoryId( repoId );
-        problem.setGroupId( groupId );
-        problem.setArtifactId( artifactId );
+        problem.setNamespace( groupId );
+        problem.setProject( artifactId );
+        problem.setProblem( PROBLEM );
         return problem;
     }
 

Modified: archiva/branches/MRM-1025/archiva-modules/archiva-web/archiva-webapp/src/test/resources/org/apache/maven/archiva/web/action/DeleteArtifactActionTest.xml
URL: http://svn.apache.org/viewvc/archiva/branches/MRM-1025/archiva-modules/archiva-web/archiva-webapp/src/test/resources/org/apache/maven/archiva/web/action/DeleteArtifactActionTest.xml?rev=891064&r1=891063&r2=891064&view=diff
==============================================================================
--- archiva/branches/MRM-1025/archiva-modules/archiva-web/archiva-webapp/src/test/resources/org/apache/maven/archiva/web/action/DeleteArtifactActionTest.xml (original)
+++ archiva/branches/MRM-1025/archiva-modules/archiva-web/archiva-webapp/src/test/resources/org/apache/maven/archiva/web/action/DeleteArtifactActionTest.xml Tue Dec 15 23:07:36 2009
@@ -31,11 +31,6 @@
       </requirements>
     </component>
     <component>
-      <role>org.apache.maven.archiva.database.RepositoryProblemDAO</role>
-      <role-hint>jdo</role-hint>
-      <implementation>org.apache.maven.archiva.web.action.admin.repositories.RepositoryProblemDAOStub</implementation>
-    </component>
-    <component>
       <role>org.apache.maven.archiva.database.ArtifactDAO</role>
       <role-hint>jdo</role-hint>
       <implementation>org.apache.maven.archiva.web.action.admin.repositories.ArtifactDAOStub</implementation>

Modified: archiva/branches/MRM-1025/archiva-modules/archiva-web/archiva-webapp/src/test/resources/org/apache/maven/archiva/web/action/reports/GenerateReportActionTest.xml
URL: http://svn.apache.org/viewvc/archiva/branches/MRM-1025/archiva-modules/archiva-web/archiva-webapp/src/test/resources/org/apache/maven/archiva/web/action/reports/GenerateReportActionTest.xml?rev=891064&r1=891063&r2=891064&view=diff
==============================================================================
--- archiva/branches/MRM-1025/archiva-modules/archiva-web/archiva-webapp/src/test/resources/org/apache/maven/archiva/web/action/reports/GenerateReportActionTest.xml (original)
+++ archiva/branches/MRM-1025/archiva-modules/archiva-web/archiva-webapp/src/test/resources/org/apache/maven/archiva/web/action/reports/GenerateReportActionTest.xml Tue Dec 15 23:07:36 2009
@@ -20,20 +20,15 @@
 <component-set>
   <components>
     <component>
-      <role>org.apache.maven.archiva.database.ArchivaDAO</role>
-      <role-hint>jdo</role-hint>
-      <implementation>org.apache.maven.archiva.web.action.admin.repositories.ArchivaDAOStub</implementation>
-      <requirements>
-        <requirement>
-          <role>org.apache.maven.archiva.database.ArtifactDAO</role>
-          <role-hint>jdo</role-hint>
-        </requirement>
-      </requirements>
-    </component>
-    <component>
-      <role>org.apache.maven.archiva.database.ArtifactDAO</role>
-      <role-hint>jdo</role-hint>
-      <implementation>org.apache.maven.archiva.web.action.admin.repositories.ArtifactDAOStub</implementation>
+      <role>org.apache.maven.archiva.security.UserRepositories</role>
+      <role-hint>default</role-hint>
+      <implementation>org.apache.maven.archiva.security.UserRepositoriesStub</implementation>
+      <configuration>
+        <repoIds>
+          <repoId>internal</repoId>
+          <repoId>snapshots</repoId>
+        </repoIds>
+      </configuration>
     </component>
   </components>
 </component-set>
\ No newline at end of file

Modified: archiva/branches/MRM-1025/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/metadata/repository/TestMetadataRepository.java
URL: http://svn.apache.org/viewvc/archiva/branches/MRM-1025/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/metadata/repository/TestMetadataRepository.java?rev=891064&r1=891063&r2=891064&view=diff
==============================================================================
--- archiva/branches/MRM-1025/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/metadata/repository/TestMetadataRepository.java (original)
+++ archiva/branches/MRM-1025/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/metadata/repository/TestMetadataRepository.java Tue Dec 15 23:07:36 2009
@@ -116,7 +116,7 @@
         return null;  //To change body of implemented methods use File | Settings | File Templates.
     }
 
-    public void addMetadataFacet( String repositoryId, String facetId, String name, MetadataFacet metadataFacet )
+    public void addMetadataFacet( String repositoryId, String facetId, MetadataFacet metadataFacet )
     {
         //To change body of implemented methods use File | Settings | File Templates.
     }
@@ -126,6 +126,11 @@
         //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.

Modified: archiva/branches/MRM-1025/archiva-modules/metadata/metadata-model/src/main/java/org/apache/archiva/metadata/model/MetadataFacet.java
URL: http://svn.apache.org/viewvc/archiva/branches/MRM-1025/archiva-modules/metadata/metadata-model/src/main/java/org/apache/archiva/metadata/model/MetadataFacet.java?rev=891064&r1=891063&r2=891064&view=diff
==============================================================================
--- archiva/branches/MRM-1025/archiva-modules/metadata/metadata-model/src/main/java/org/apache/archiva/metadata/model/MetadataFacet.java (original)
+++ archiva/branches/MRM-1025/archiva-modules/metadata/metadata-model/src/main/java/org/apache/archiva/metadata/model/MetadataFacet.java Tue Dec 15 23:07:36 2009
@@ -25,6 +25,8 @@
 {
     String getFacetId();
 
+    String getName();
+
     Map<String, String> toProperties();
 
     void fromProperties( Map<String, String> properties );

Modified: archiva/branches/MRM-1025/archiva-modules/metadata/metadata-repository-api/src/main/java/org/apache/archiva/metadata/repository/MetadataRepository.java
URL: http://svn.apache.org/viewvc/archiva/branches/MRM-1025/archiva-modules/metadata/metadata-repository-api/src/main/java/org/apache/archiva/metadata/repository/MetadataRepository.java?rev=891064&r1=891063&r2=891064&view=diff
==============================================================================
--- archiva/branches/MRM-1025/archiva-modules/metadata/metadata-repository-api/src/main/java/org/apache/archiva/metadata/repository/MetadataRepository.java (original)
+++ archiva/branches/MRM-1025/archiva-modules/metadata/metadata-repository-api/src/main/java/org/apache/archiva/metadata/repository/MetadataRepository.java Tue Dec 15 23:07:36 2009
@@ -55,10 +55,12 @@
 
     MetadataFacet getMetadataFacet( String repositoryId, String facetId, String name );
 
-    void addMetadataFacet( String repositoryId, String facetId, String name, MetadataFacet metadataFacet );
+    void addMetadataFacet( String repositoryId, String facetId, MetadataFacet metadataFacet );
 
     void removeMetadataFacets( String repositoryId, String facetId );
 
+    void removeMetadataFacet( String repoId, String facetId, String name );
+
     List<ArtifactMetadata> getArtifactsByDateRange( String repoId, Date startTime, Date endTime );
 
     Collection<String> getRepositories();

Modified: archiva/branches/MRM-1025/archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/metadata/repository/storage/maven2/MavenProjectFacet.java
URL: http://svn.apache.org/viewvc/archiva/branches/MRM-1025/archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/metadata/repository/storage/maven2/MavenProjectFacet.java?rev=891064&r1=891063&r2=891064&view=diff
==============================================================================
--- archiva/branches/MRM-1025/archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/metadata/repository/storage/maven2/MavenProjectFacet.java (original)
+++ archiva/branches/MRM-1025/archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/metadata/repository/storage/maven2/MavenProjectFacet.java Tue Dec 15 23:07:36 2009
@@ -82,6 +82,12 @@
         return FACET_ID;
     }
 
+    public String getName()
+    {
+        // TODO: not needed, perhaps version metadata facet should be separate interface?
+        return null;
+    }
+
     public Map<String, String> toProperties()
     {
         HashMap<String, String> properties = new HashMap<String, String>();

Modified: archiva/branches/MRM-1025/archiva-modules/plugins/metadata-repository-file/src/main/java/org/apache/archiva/metadata/repository/file/FileMetadataRepository.java
URL: http://svn.apache.org/viewvc/archiva/branches/MRM-1025/archiva-modules/plugins/metadata-repository-file/src/main/java/org/apache/archiva/metadata/repository/file/FileMetadataRepository.java?rev=891064&r1=891063&r2=891064&view=diff
==============================================================================
--- archiva/branches/MRM-1025/archiva-modules/plugins/metadata-repository-file/src/main/java/org/apache/archiva/metadata/repository/file/FileMetadataRepository.java (original)
+++ archiva/branches/MRM-1025/archiva-modules/plugins/metadata-repository-file/src/main/java/org/apache/archiva/metadata/repository/file/FileMetadataRepository.java Tue Dec 15 23:07:36 2009
@@ -246,8 +246,28 @@
     public List<String> getMetadataFacets( String repoId, String facetId )
     {
         File directory = getMetadataDirectory( repoId, facetId );
-        String[] list = directory.list();
-        return list != null ? Arrays.asList( list ) : Collections.<String>emptyList();
+        List<String> facets = new ArrayList<String>();
+        recurse( facets, "", directory );
+        return facets;
+    }
+
+    private void recurse( List<String> facets, String prefix, File directory )
+    {
+        File[] list = directory.listFiles();
+        if ( list != null )
+        {
+            for ( File dir : list )
+            {
+                if ( dir.isDirectory() )
+                {
+                    recurse( facets, prefix + "/" + dir.getName(), dir );
+                }
+                else if ( dir.getName().equals( METADATA_KEY + ".properties" ) )
+                {
+                    facets.add( prefix.substring( 1 ) );
+                }
+            }
+        }
     }
 
     public MetadataFacet getMetadataFacet( String repositoryId, String facetId, String name )
@@ -283,14 +303,15 @@
         return metadataFacet;
     }
 
-    public void addMetadataFacet( String repositoryId, String facetId, String name, MetadataFacet metadataFacet )
+    public void addMetadataFacet( String repositoryId, String facetId, MetadataFacet metadataFacet )
     {
         Properties properties = new Properties();
         properties.putAll( metadataFacet.toProperties() );
 
         try
         {
-            writeProperties( properties, new File( getMetadataDirectory( repositoryId, facetId ), name ),
+            writeProperties( properties,
+                             new File( getMetadataDirectory( repositoryId, facetId ), metadataFacet.getName() ),
                              METADATA_KEY );
         }
         catch ( IOException e )
@@ -313,6 +334,20 @@
         }
     }
 
+    public void removeMetadataFacet( String repoId, String facetId, String name )
+    {
+        File dir = new File( getMetadataDirectory( repoId, facetId ), name );
+        try
+        {
+            FileUtils.deleteDirectory( dir );
+        }
+        catch ( IOException e )
+        {
+            // TODO
+            e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
+        }
+    }
+
     public List<ArtifactMetadata> getArtifactsByDateRange( String repoId, Date startTime, Date endTime )
     {
         // TODO: this is quite slow - if we are to persist with this repository implementation we should build an index



Mime
View raw message