archiva-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From joak...@apache.org
Subject svn commit: r507550 [4/7] - in /maven/archiva/branches/archiva-MRM-239: ./ archiva-cli/src/main/java/org/apache/maven/archiva/cli/ archiva-converter/src/main/java/org/apache/maven/archiva/converter/ archiva-converter/src/main/java/org/apache/maven/arch...
Date Wed, 14 Feb 2007 14:45:07 GMT
Added: maven/archiva/branches/archiva-MRM-239/archiva-discoverer/src/test/resources/org/apache/maven/archiva/discoverer/consumers/GenericModelConsumerTest.xml
URL: http://svn.apache.org/viewvc/maven/archiva/branches/archiva-MRM-239/archiva-discoverer/src/test/resources/org/apache/maven/archiva/discoverer/consumers/GenericModelConsumerTest.xml?view=auto&rev=507550
==============================================================================
--- maven/archiva/branches/archiva-MRM-239/archiva-discoverer/src/test/resources/org/apache/maven/archiva/discoverer/consumers/GenericModelConsumerTest.xml (added)
+++ maven/archiva/branches/archiva-MRM-239/archiva-discoverer/src/test/resources/org/apache/maven/archiva/discoverer/consumers/GenericModelConsumerTest.xml Wed Feb 14 06:44:59 2007
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+  ~ 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.
+  -->
+
+<component-set>
+  <components>
+    <component>
+      <role>org.apache.maven.archiva.discoverer.DiscovererConsumer</role>
+      <role-hint>mock-model</role-hint>
+      <implementation>org.apache.maven.archiva.discoverer.consumers.MockModelConsumer</implementation>
+      <requirements>
+        <requirement>
+          <role>org.apache.maven.artifact.factory.ArtifactFactory</role>
+        </requirement>
+      </requirements>
+    </component>
+  </components>
+</component-set>
\ No newline at end of file

Propchange: maven/archiva/branches/archiva-MRM-239/archiva-discoverer/src/test/resources/org/apache/maven/archiva/discoverer/consumers/GenericModelConsumerTest.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/archiva/branches/archiva-MRM-239/archiva-discoverer/src/test/resources/org/apache/maven/archiva/discoverer/consumers/GenericModelConsumerTest.xml
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Propchange: maven/archiva/branches/archiva-MRM-239/archiva-discoverer/src/test/resources/org/apache/maven/archiva/discoverer/consumers/GenericModelConsumerTest.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: maven/archiva/branches/archiva-MRM-239/archiva-discoverer/src/test/resources/org/apache/maven/archiva/discoverer/consumers/GenericRepositoryMetadataConsumerTest.xml
URL: http://svn.apache.org/viewvc/maven/archiva/branches/archiva-MRM-239/archiva-discoverer/src/test/resources/org/apache/maven/archiva/discoverer/consumers/GenericRepositoryMetadataConsumerTest.xml?view=auto&rev=507550
==============================================================================
--- maven/archiva/branches/archiva-MRM-239/archiva-discoverer/src/test/resources/org/apache/maven/archiva/discoverer/consumers/GenericRepositoryMetadataConsumerTest.xml (added)
+++ maven/archiva/branches/archiva-MRM-239/archiva-discoverer/src/test/resources/org/apache/maven/archiva/discoverer/consumers/GenericRepositoryMetadataConsumerTest.xml Wed Feb 14 06:44:59 2007
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+  ~ 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.
+  -->
+
+<component-set>
+  <components>
+    <component>
+      <role>org.apache.maven.archiva.discoverer.DiscovererConsumer</role>
+      <role-hint>mock-metadata</role-hint>
+      <implementation>org.apache.maven.archiva.discoverer.consumers.MockRepositoryMetadataConsumer</implementation>
+      <requirements>
+        <requirement>
+          <role>org.apache.maven.artifact.factory.ArtifactFactory</role>
+        </requirement>
+      </requirements>
+    </component>
+  </components>
+</component-set>
\ No newline at end of file

Propchange: maven/archiva/branches/archiva-MRM-239/archiva-discoverer/src/test/resources/org/apache/maven/archiva/discoverer/consumers/GenericRepositoryMetadataConsumerTest.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/archiva/branches/archiva-MRM-239/archiva-discoverer/src/test/resources/org/apache/maven/archiva/discoverer/consumers/GenericRepositoryMetadataConsumerTest.xml
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Propchange: maven/archiva/branches/archiva-MRM-239/archiva-discoverer/src/test/resources/org/apache/maven/archiva/discoverer/consumers/GenericRepositoryMetadataConsumerTest.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Modified: maven/archiva/branches/archiva-MRM-239/archiva-indexer/src/main/java/org/apache/maven/archiva/indexer/RepositoryArtifactIndex.java
URL: http://svn.apache.org/viewvc/maven/archiva/branches/archiva-MRM-239/archiva-indexer/src/main/java/org/apache/maven/archiva/indexer/RepositoryArtifactIndex.java?view=diff&rev=507550&r1=507549&r2=507550
==============================================================================
--- maven/archiva/branches/archiva-MRM-239/archiva-indexer/src/main/java/org/apache/maven/archiva/indexer/RepositoryArtifactIndex.java (original)
+++ maven/archiva/branches/archiva-MRM-239/archiva-indexer/src/main/java/org/apache/maven/archiva/indexer/RepositoryArtifactIndex.java Wed Feb 14 06:44:59 2007
@@ -21,6 +21,7 @@
 
 import org.apache.maven.archiva.indexer.query.Query;
 import org.apache.maven.archiva.indexer.record.RepositoryIndexRecordFactory;
+import org.apache.maven.artifact.Artifact;
 
 import java.util.Collection;
 import java.util.List;
@@ -89,6 +90,17 @@
     Collection getAllRecordKeys()
         throws RepositoryIndexException;
 
+    /**
+     * Indexes the artifact specified. If the artifact is already in the repository they it is updated. 
+     * This method should use less memory than indexRecords as the records can be created and disposed of on the fly.
+     *
+     * @param artifact  the artifact to index
+     * @param factory   the artifact to record factory
+     * @throws RepositoryIndexException if there is a problem indexing the artifacts
+     */
+    void indexArtifact( Artifact artifact, RepositoryIndexRecordFactory factory )
+        throws RepositoryIndexException;
+    
     /**
      * Indexes the artifacts found within the specified list. If the artifacts are already in the
      * repository they are updated. This method should use less memory than indexRecords as the records can be

Modified: maven/archiva/branches/archiva-MRM-239/archiva-indexer/src/main/java/org/apache/maven/archiva/indexer/lucene/LuceneRepositoryArtifactIndex.java
URL: http://svn.apache.org/viewvc/maven/archiva/branches/archiva-MRM-239/archiva-indexer/src/main/java/org/apache/maven/archiva/indexer/lucene/LuceneRepositoryArtifactIndex.java?view=diff&rev=507550&r1=507549&r2=507550
==============================================================================
--- maven/archiva/branches/archiva-MRM-239/archiva-indexer/src/main/java/org/apache/maven/archiva/indexer/lucene/LuceneRepositoryArtifactIndex.java (original)
+++ maven/archiva/branches/archiva-MRM-239/archiva-indexer/src/main/java/org/apache/maven/archiva/indexer/lucene/LuceneRepositoryArtifactIndex.java Wed Feb 14 06:44:59 2007
@@ -351,6 +351,40 @@
             lastUpdatedTime = System.currentTimeMillis();
         }
     }
+    
+    public void indexArtifact( Artifact artifact, RepositoryIndexRecordFactory factory )
+        throws RepositoryIndexException
+    {
+        IndexModifier indexModifier = null;
+        try
+        {
+            indexModifier = new IndexModifier( indexLocation, getAnalyzer(), !exists() );
+
+            RepositoryIndexRecord record = factory.createRecord( artifact );
+
+            if ( record != null )
+            {
+                Term term = new Term( FLD_PK, record.getPrimaryKey() );
+
+                indexModifier.deleteDocuments( term );
+
+                Document document = converter.convert( record );
+                document.add( new Field( FLD_PK, record.getPrimaryKey(), Field.Store.NO, Field.Index.UN_TOKENIZED ) );
+
+                indexModifier.addDocument( document );
+            }
+            indexModifier.optimize();
+        }
+        catch ( IOException e )
+        {
+            throw new RepositoryIndexException( "Error updating index: " + e.getMessage(), e );
+        }
+        finally
+        {
+            closeQuietly( indexModifier );
+            lastUpdatedTime = System.currentTimeMillis();
+        }
+    }    
 
     public List getAllGroupIds()
         throws RepositoryIndexException

Modified: maven/archiva/branches/archiva-MRM-239/archiva-reports-standard/pom.xml
URL: http://svn.apache.org/viewvc/maven/archiva/branches/archiva-MRM-239/archiva-reports-standard/pom.xml?view=diff&rev=507550&r1=507549&r2=507550
==============================================================================
--- maven/archiva/branches/archiva-MRM-239/archiva-reports-standard/pom.xml (original)
+++ maven/archiva/branches/archiva-MRM-239/archiva-reports-standard/pom.xml Wed Feb 14 06:44:59 2007
@@ -77,6 +77,41 @@
       <groupId>commons-io</groupId>
       <artifactId>commons-io</artifactId>
     </dependency>
+    <dependency>
+      <groupId>org.codehaus.plexus</groupId>
+      <artifactId>plexus-jdo2</artifactId>
+      <version>1.0-alpha-8</version>
+      <exclusions>
+        <exclusion>
+          <groupId>xerces</groupId>
+          <artifactId>xercesImpl</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>xerces</groupId>
+          <artifactId>xmlParserAPIs</artifactId>
+        </exclusion>
+      </exclusions>
+    </dependency>
+    <dependency>
+      <groupId>jpox</groupId>
+      <artifactId>jpox</artifactId>
+      <version>1.1.6</version>
+      <scope>compile</scope>
+      <exclusions>
+        <!-- targeting JDK 1.4 we don't need this -->
+        <exclusion>
+          <groupId>javax.sql</groupId>
+          <artifactId>jdbc-stdext</artifactId>
+        </exclusion>
+      </exclusions>
+    </dependency>
+    <!--  TEST DEPS -->
+    <dependency>
+      <groupId>hsqldb</groupId>
+      <artifactId>hsqldb</artifactId>
+      <version>1.7.3.3</version>
+      <scope>test</scope>
+    </dependency>
   </dependencies>
   <build>
     <plugins>
@@ -84,19 +119,45 @@
         <groupId>org.codehaus.modello</groupId>
         <artifactId>modello-maven-plugin</artifactId>
         <version>1.0-alpha-14-SNAPSHOT</version>
+        <configuration>
+          <version>1.0.0</version>
+          <packageWithVersion>false</packageWithVersion>
+          <model>src/main/mdo/reporting.mdo</model>
+        </configuration>
         <executions>
           <execution>
+            <id>modello-java</id>
             <goals>
-              <goal>xpp3-writer</goal>
               <goal>java</goal>
+              <goal>jpox-metadata-class</goal>
+              <!--
+              <goal>xpp3-writer</goal>
               <goal>xpp3-reader</goal>
+               -->
+            </goals>
+          </execution>
+          <execution>
+            <id>jpox-jdo-mapping</id>
+            <goals>
+              <goal>jpox-jdo-mapping</goal>
+            </goals>
+            <configuration>
+              <outputDirectory>${basedir}/target/classes/org/apache/maven/archiva/reporting/model/</outputDirectory>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
+      <plugin>
+       <groupId>org.codehaus.mojo</groupId>
+        <artifactId>jpox-maven-plugin</artifactId>
+        <version>1.1.6-SNAPSHOT</version>
+        <executions>
+          <execution>
+            <goals>
+              <goal>enhance</goal>
             </goals>
           </execution>
         </executions>
-        <configuration>
-          <version>1.0.0</version>
-          <model>src/main/mdo/reporting.mdo</model>
-        </configuration>
       </plugin>
       <plugin>
         <groupId>org.codehaus.mojo</groupId>

Added: maven/archiva/branches/archiva-MRM-239/archiva-reports-standard/src/main/java/org/apache/maven/archiva/reporting/ReportingException.java
URL: http://svn.apache.org/viewvc/maven/archiva/branches/archiva-MRM-239/archiva-reports-standard/src/main/java/org/apache/maven/archiva/reporting/ReportingException.java?view=auto&rev=507550
==============================================================================
--- maven/archiva/branches/archiva-MRM-239/archiva-reports-standard/src/main/java/org/apache/maven/archiva/reporting/ReportingException.java (added)
+++ maven/archiva/branches/archiva-MRM-239/archiva-reports-standard/src/main/java/org/apache/maven/archiva/reporting/ReportingException.java Wed Feb 14 06:44:59 2007
@@ -0,0 +1,50 @@
+package org.apache.maven.archiva.reporting;
+
+/*
+ * 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.
+ */
+
+/**
+ * ReportingException 
+ *
+ * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
+ * @version $Id$
+ */
+public class ReportingException
+    extends Exception
+{
+
+    public ReportingException()
+    {
+    }
+
+    public ReportingException( String message )
+    {
+        super( message );
+    }
+
+    public ReportingException( Throwable cause )
+    {
+        super( cause );
+    }
+
+    public ReportingException( String message, Throwable cause )
+    {
+        super( message, cause );
+    }
+}

Propchange: maven/archiva/branches/archiva-MRM-239/archiva-reports-standard/src/main/java/org/apache/maven/archiva/reporting/ReportingException.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/archiva/branches/archiva-MRM-239/archiva-reports-standard/src/main/java/org/apache/maven/archiva/reporting/ReportingException.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Propchange: maven/archiva/branches/archiva-MRM-239/archiva-reports-standard/src/main/java/org/apache/maven/archiva/reporting/ReportingException.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: maven/archiva/branches/archiva-MRM-239/archiva-reports-standard/src/main/java/org/apache/maven/archiva/reporting/database/AbstractJdoDatabase.java
URL: http://svn.apache.org/viewvc/maven/archiva/branches/archiva-MRM-239/archiva-reports-standard/src/main/java/org/apache/maven/archiva/reporting/database/AbstractJdoDatabase.java?view=auto&rev=507550
==============================================================================
--- maven/archiva/branches/archiva-MRM-239/archiva-reports-standard/src/main/java/org/apache/maven/archiva/reporting/database/AbstractJdoDatabase.java (added)
+++ maven/archiva/branches/archiva-MRM-239/archiva-reports-standard/src/main/java/org/apache/maven/archiva/reporting/database/AbstractJdoDatabase.java Wed Feb 14 06:44:59 2007
@@ -0,0 +1,237 @@
+package org.apache.maven.archiva.reporting.database;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.codehaus.plexus.jdo.JdoFactory;
+import org.codehaus.plexus.personality.plexus.lifecycle.phase.Initializable;
+import org.codehaus.plexus.personality.plexus.lifecycle.phase.InitializationException;
+
+import java.util.List;
+
+import javax.jdo.Extent;
+import javax.jdo.JDOException;
+import javax.jdo.JDOHelper;
+import javax.jdo.JDOObjectNotFoundException;
+import javax.jdo.JDOUserException;
+import javax.jdo.PersistenceManager;
+import javax.jdo.PersistenceManagerFactory;
+import javax.jdo.Query;
+import javax.jdo.Transaction;
+
+/**
+ * AbstractJdoResults - Base class for all JDO related results.
+ *
+ * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
+ * @version $Id$
+ */
+public abstract class AbstractJdoDatabase
+    implements Initializable
+{
+    /**
+     * @plexus.requirement role-hint="archiva"
+     */
+    private JdoFactory jdoFactory;
+
+    private PersistenceManagerFactory pmf;
+
+    // -------------------------------------------------------------------
+    // JPOX / JDO Specifics.
+    // -------------------------------------------------------------------
+
+    protected List getAllObjects( Class clazz, String ordering )
+    {
+        PersistenceManager pm = getPersistenceManager();
+        Transaction tx = pm.currentTransaction();
+
+        try
+        {
+            tx.begin();
+
+            Extent extent = pm.getExtent( clazz, true );
+
+            Query query = pm.newQuery( extent );
+
+            if ( ordering != null )
+            {
+                query.setOrdering( ordering );
+            }
+
+//            for ( Iterator i = fetchGroups.iterator(); i.hasNext(); )
+//            {
+//                pm.getFetchPlan().addGroup( (String) i.next() );
+//            }
+
+            List result = (List) query.execute();
+
+            result = (List) pm.detachCopyAll( result );
+
+            tx.commit();
+
+            return result;
+        }
+        finally
+        {
+            rollbackIfActive( tx );
+        }
+    }
+
+    protected Object getObjectByKey( Class clazz, Object key )
+        throws JDOObjectNotFoundException, JDOException
+    {
+        if ( key == null )
+        {
+            throw new JDOException( "Unable to get object from jdo using null key." );
+        }
+
+        PersistenceManager pm = getPersistenceManager();
+        Transaction tx = pm.currentTransaction();
+
+        try
+        {
+            tx.begin();
+
+            //            if ( fetchGroup != null )
+            //            {
+            //                pm.getFetchPlan().addGroup( fetchGroup );
+            //            }
+
+            Object objectId = pm.newObjectIdInstance( clazz, key.toString() );
+
+            Object object = pm.getObjectById( objectId );
+
+            object = pm.detachCopy( object );
+
+            tx.commit();
+
+            return object;
+        }
+        finally
+        {
+            rollbackIfActive( tx );
+        }
+    }
+
+    public void initialize()
+        throws InitializationException
+    {
+        pmf = jdoFactory.getPersistenceManagerFactory();
+    }
+
+    protected void removeObject( Object o )
+    {
+        PersistenceManager pm = getPersistenceManager();
+        Transaction tx = pm.currentTransaction();
+
+        try
+        {
+            tx.begin();
+
+            o = pm.getObjectById( pm.getObjectId( o ) );
+
+            pm.deletePersistent( o );
+
+            tx.commit();
+        }
+        finally
+        {
+            rollbackIfActive( tx );
+        }
+    }
+
+    protected Object saveObject( Object object )
+    {
+        return saveObject( object, null );
+    }
+
+    protected Object saveObject( Object object, String fetchGroups[] )
+        throws JDOException
+    {
+        PersistenceManager pm = getPersistenceManager();
+        Transaction tx = pm.currentTransaction();
+
+        try
+        {
+            tx.begin();
+
+            if ( ( JDOHelper.getObjectId( object ) != null ) && !JDOHelper.isDetached( object ) )
+            {
+                throw new JDOException( "Existing object is not detached: " + object );
+            }
+
+            if ( fetchGroups != null )
+            {
+                for ( int i = 0; i >= fetchGroups.length; i++ )
+                {
+                    pm.getFetchPlan().addGroup( fetchGroups[i] );
+                }
+            }
+
+            pm.makePersistent( object );
+
+            object = pm.detachCopy( object );
+
+            tx.commit();
+
+            return object;
+        }
+        finally
+        {
+            rollbackIfActive( tx );
+        }
+    }
+
+    private PersistenceManager getPersistenceManager()
+    {
+        PersistenceManager pm = pmf.getPersistenceManager();
+
+        pm.getFetchPlan().setMaxFetchDepth( -1 );
+
+        return pm;
+    }
+
+    protected static void closePersistenceManager( PersistenceManager pm )
+    {
+        try
+        {
+            pm.close();
+        }
+        catch ( JDOUserException e )
+        {
+            // ignore
+        }
+    }
+
+    protected static void rollbackIfActive( Transaction tx )
+    {
+        PersistenceManager pm = tx.getPersistenceManager();
+
+        try
+        {
+            if ( tx.isActive() )
+            {
+                tx.rollback();
+            }
+        }
+        finally
+        {
+            closePersistenceManager( pm );
+        }
+    }
+}

Propchange: maven/archiva/branches/archiva-MRM-239/archiva-reports-standard/src/main/java/org/apache/maven/archiva/reporting/database/AbstractJdoDatabase.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/archiva/branches/archiva-MRM-239/archiva-reports-standard/src/main/java/org/apache/maven/archiva/reporting/database/AbstractJdoDatabase.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Propchange: maven/archiva/branches/archiva-MRM-239/archiva-reports-standard/src/main/java/org/apache/maven/archiva/reporting/database/AbstractJdoDatabase.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: maven/archiva/branches/archiva-MRM-239/archiva-reports-standard/src/main/java/org/apache/maven/archiva/reporting/database/AbstractResultsDatabase.java
URL: http://svn.apache.org/viewvc/maven/archiva/branches/archiva-MRM-239/archiva-reports-standard/src/main/java/org/apache/maven/archiva/reporting/database/AbstractResultsDatabase.java?view=auto&rev=507550
==============================================================================
--- maven/archiva/branches/archiva-MRM-239/archiva-reports-standard/src/main/java/org/apache/maven/archiva/reporting/database/AbstractResultsDatabase.java (added)
+++ maven/archiva/branches/archiva-MRM-239/archiva-reports-standard/src/main/java/org/apache/maven/archiva/reporting/database/AbstractResultsDatabase.java Wed Feb 14 06:44:59 2007
@@ -0,0 +1,80 @@
+package org.apache.maven.archiva.reporting.database;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.maven.archiva.reporting.model.Result;
+
+/**
+ * AbstractResultsDatabase 
+ *
+ * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
+ * @version $Id$
+ */
+public abstract class AbstractResultsDatabase
+    extends AbstractJdoDatabase
+{
+    /**
+     * <p>
+     * Get the number of failures in the database.
+     * </p>
+     * 
+     * <p>
+     * <b>WARNING:</b> This is a very resource intensive request. Use sparingly.
+     * </p>
+     * 
+     * @return the number of failures in the database.
+     */
+    public abstract int getNumFailures();
+
+    /**
+     * <p>
+     * Get the number of warnings in the database.
+     * </p>
+     * 
+     * <p>
+     * <b>WARNING:</b> This is a very resource intensive request. Use sparingly.
+     * </p>
+     * 
+     * @return the number of warnings in the database.
+     */
+    public abstract int getNumWarnings();
+    
+    /**
+     * <p>
+     * Get the number of notices in the database.
+     * </p>
+     * 
+     * <p>
+     * <b>WARNING:</b> This is a very resource intensive request. Use sparingly.
+     * </p>
+     * 
+     * @return the number of notices in the database.
+     */
+    public abstract int getNumNotices();
+    
+    protected static Result createResult( String processor, String problem, String reason )
+    {
+        Result result = new Result();
+        result.setProcessor( processor );
+        result.setProblem( problem );
+        result.setReason( reason );
+        return result;
+    }
+}

Propchange: maven/archiva/branches/archiva-MRM-239/archiva-reports-standard/src/main/java/org/apache/maven/archiva/reporting/database/AbstractResultsDatabase.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/archiva/branches/archiva-MRM-239/archiva-reports-standard/src/main/java/org/apache/maven/archiva/reporting/database/AbstractResultsDatabase.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Propchange: maven/archiva/branches/archiva-MRM-239/archiva-reports-standard/src/main/java/org/apache/maven/archiva/reporting/database/AbstractResultsDatabase.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: maven/archiva/branches/archiva-MRM-239/archiva-reports-standard/src/main/java/org/apache/maven/archiva/reporting/database/ArtifactResultsDatabase.java
URL: http://svn.apache.org/viewvc/maven/archiva/branches/archiva-MRM-239/archiva-reports-standard/src/main/java/org/apache/maven/archiva/reporting/database/ArtifactResultsDatabase.java?view=auto&rev=507550
==============================================================================
--- maven/archiva/branches/archiva-MRM-239/archiva-reports-standard/src/main/java/org/apache/maven/archiva/reporting/database/ArtifactResultsDatabase.java (added)
+++ maven/archiva/branches/archiva-MRM-239/archiva-reports-standard/src/main/java/org/apache/maven/archiva/reporting/database/ArtifactResultsDatabase.java Wed Feb 14 06:44:59 2007
@@ -0,0 +1,250 @@
+package org.apache.maven.archiva.reporting.database;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.commons.lang.StringUtils;
+import org.apache.maven.archiva.reporting.model.ArtifactResults;
+import org.apache.maven.archiva.reporting.model.ArtifactResultsKey;
+import org.apache.maven.archiva.reporting.model.Result;
+import org.apache.maven.artifact.Artifact;
+
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+
+import javax.jdo.JDOObjectNotFoundException;
+
+/**
+ * ArtifactResultsDatabase - Database of ArtifactResults. 
+ *
+ * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
+ * @version $Id$
+ * 
+ * @plexus.component role="org.apache.maven.archiva.reporting.database.ArtifactResultsDatabase"
+ */
+public class ArtifactResultsDatabase
+    extends AbstractResultsDatabase
+{
+    // -------------------------------------------------------------------
+    // ArtifactResults methods.
+    // -------------------------------------------------------------------
+
+    public static final String ROLE = ArtifactResultsDatabase.class.getName();
+
+    public void addFailure( Artifact artifact, String processor, String problem, String reason )
+    {
+        ArtifactResults results = getArtifactResults( artifact );
+        Result result = createResult( processor, problem, reason );
+
+        if ( !results.getFailures().contains( result ) )
+        {
+            results.addFailure( result );
+        }
+
+        saveObject( results );
+    }
+
+    public void addNotice( Artifact artifact, String processor, String problem, String reason )
+    {
+        ArtifactResults results = getArtifactResults( artifact );
+        Result result = createResult( processor, problem, reason );
+
+        if ( !results.getNotices().contains( result ) )
+        {
+            results.addNotice( result );
+        }
+
+        saveObject( results );
+    }
+
+    public void addWarning( Artifact artifact, String processor, String problem, String reason )
+    {
+        ArtifactResults results = getArtifactResults( artifact );
+        Result result = createResult( processor, problem, reason );
+
+        if ( !results.getWarnings().contains( result ) )
+        {
+            results.addWarning( result );
+        }
+
+        saveObject( results );
+    }
+
+    public void clearResults( ArtifactResults results )
+    {
+        results.getFailures().clear();
+        results.getWarnings().clear();
+        results.getNotices().clear();
+
+        saveObject( results );
+    }
+
+    public List getAllArtifactResults()
+    {
+        return getAllObjects( ArtifactResults.class, null );
+    }
+
+    public Iterator getIterator()
+    {
+        List allartifacts = getAllArtifactResults();
+        if ( allartifacts == null )
+        {
+            return Collections.EMPTY_LIST.iterator();
+        }
+
+        return allartifacts.iterator();
+    }
+
+    public void remove( ArtifactResults results )
+    {
+        removeObject( results );
+    }
+
+    public void remove( Artifact artifact )
+    {
+        try
+        {
+            ArtifactResults results = lookupArtifactResults( artifact );
+            remove( results );
+        }
+        catch ( JDOObjectNotFoundException e )
+        {
+            // nothing to do.
+        }
+    }
+
+    /**
+     * Get an {@link ArtifactResults} from the store.
+     * If the store does not have one, create it.
+     * 
+     * Equivalent to calling {@link #lookupArtifactResults(Artifact)} then if
+     * not found, using {@link #createArtifactResults(Artifact)}.
+     * 
+     * @param artifact the artifact information
+     * @return the ArtifactResults object (may not be in database yet, so don't forget to {@link #saveObject(Object)})
+     * @see #lookupArtifactResults(Artifact)
+     * @see #createArtifactResults(Artifact)
+     */
+    public ArtifactResults getArtifactResults( Artifact artifact )
+    {
+        ArtifactResults results;
+
+        try
+        {
+            results = lookupArtifactResults( artifact );
+        }
+        catch ( JDOObjectNotFoundException e )
+        {
+            results = createArtifactResults( artifact );
+        }
+
+        return results;
+    }
+
+    /**
+     * Create a new {@link ArtifactResults} object from the provided Artifact information.
+     * 
+     * @param artifact the artifact information.
+     * @return the new {@link ArtifactResults} object.
+     * @see #getArtifactResults(Artifact)
+     * @see #lookupArtifactResults(Artifact)
+     */
+    private ArtifactResults createArtifactResults( Artifact artifact )
+    {
+        /* The funky StringUtils.defaultString() is used because of database constraints.
+         * The ArtifactResults object has a complex primary key consisting of groupId, artifactId, version,
+         * type, classifier.
+         * This also means that none of those fields may be null.  however, that doesn't eliminate the
+         * ability to have an empty string in place of a null.
+         */
+
+        ArtifactResults results = new ArtifactResults();
+        results.setGroupId( StringUtils.defaultString( artifact.getGroupId() ) );
+        results.setArtifactId( StringUtils.defaultString( artifact.getArtifactId() ) );
+        results.setVersion( StringUtils.defaultString( artifact.getVersion() ) );
+        results.setType( StringUtils.defaultString( artifact.getType() ) );
+        results.setClassifier( StringUtils.defaultString( artifact.getClassifier() ) );
+
+        return results;
+    }
+
+    /**
+     * Lookup the {@link ArtifactResults} in the JDO store from the information in
+     * the provided Artifact.
+     * 
+     * @param artifact the artifact information.
+     * @return the previously saved {@link ArtifactResults} from the JDO store.
+     * @throws JDOObjectNotFoundException if the {@link ArtifactResults} are not found.
+     * @see #getArtifactResults(Artifact)
+     * @see #createArtifactResults(Artifact)
+     */
+    private ArtifactResults lookupArtifactResults( Artifact artifact )
+        throws JDOObjectNotFoundException
+    {
+        /* The funky StringUtils.defaultString() is used because of database constraints.
+         * The ArtifactResults object has a complex primary key consisting of groupId, artifactId, version,
+         * type, classifier.
+         * This also means that none of those fields may be null.  however, that doesn't eliminate the
+         * ability to have an empty string in place of a null.
+         */
+
+        ArtifactResultsKey key = new ArtifactResultsKey();
+        key.groupId = StringUtils.defaultString( artifact.getGroupId() );
+        key.artifactId = StringUtils.defaultString( artifact.getArtifactId() );
+        key.version = StringUtils.defaultString( artifact.getVersion() );
+        key.type = StringUtils.defaultString( artifact.getType() );
+        key.classifier = StringUtils.defaultString( artifact.getClassifier() );
+
+        return (ArtifactResults) getObjectByKey( ArtifactResults.class, key );
+    }
+
+    public int getNumFailures()
+    {
+        int count = 0;
+        for ( Iterator it = getIterator(); it.hasNext(); )
+        {
+            ArtifactResults results = (ArtifactResults) it.next();
+            count += results.getFailures().size();
+        }
+        return count;
+    }
+
+    public int getNumNotices()
+    {
+        int count = 0;
+        for ( Iterator it = getIterator(); it.hasNext(); )
+        {
+            ArtifactResults results = (ArtifactResults) it.next();
+            count += results.getNotices().size();
+        }
+        return count;
+    }
+
+    public int getNumWarnings()
+    {
+        int count = 0;
+        for ( Iterator it = getIterator(); it.hasNext(); )
+        {
+            ArtifactResults results = (ArtifactResults) it.next();
+            count += results.getWarnings().size();
+        }
+        return count;
+    }
+}

Propchange: maven/archiva/branches/archiva-MRM-239/archiva-reports-standard/src/main/java/org/apache/maven/archiva/reporting/database/ArtifactResultsDatabase.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/archiva/branches/archiva-MRM-239/archiva-reports-standard/src/main/java/org/apache/maven/archiva/reporting/database/ArtifactResultsDatabase.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Propchange: maven/archiva/branches/archiva-MRM-239/archiva-reports-standard/src/main/java/org/apache/maven/archiva/reporting/database/ArtifactResultsDatabase.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: maven/archiva/branches/archiva-MRM-239/archiva-reports-standard/src/main/java/org/apache/maven/archiva/reporting/database/MetadataResultsDatabase.java
URL: http://svn.apache.org/viewvc/maven/archiva/branches/archiva-MRM-239/archiva-reports-standard/src/main/java/org/apache/maven/archiva/reporting/database/MetadataResultsDatabase.java?view=auto&rev=507550
==============================================================================
--- maven/archiva/branches/archiva-MRM-239/archiva-reports-standard/src/main/java/org/apache/maven/archiva/reporting/database/MetadataResultsDatabase.java (added)
+++ maven/archiva/branches/archiva-MRM-239/archiva-reports-standard/src/main/java/org/apache/maven/archiva/reporting/database/MetadataResultsDatabase.java Wed Feb 14 06:44:59 2007
@@ -0,0 +1,209 @@
+package org.apache.maven.archiva.reporting.database;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.commons.lang.StringUtils;
+import org.apache.maven.archiva.reporting.model.MetadataResults;
+import org.apache.maven.archiva.reporting.model.MetadataResultsKey;
+import org.apache.maven.archiva.reporting.model.Result;
+import org.apache.maven.artifact.repository.metadata.RepositoryMetadata;
+
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+
+import javax.jdo.JDOObjectNotFoundException;
+
+/**
+ * MetadataResultsDatabase 
+ *
+ * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
+ * @version $Id$
+ * 
+ * @plexus.component role="org.apache.maven.archiva.reporting.database.MetadataResultsDatabase"
+ */
+public class MetadataResultsDatabase
+    extends AbstractResultsDatabase
+{
+    public static final String ROLE = MetadataResultsDatabase.class.getName();
+
+    public void addFailure( RepositoryMetadata metadata, String processor, String problem, String reason )
+    {
+        MetadataResults results = getMetadataResults( metadata );
+        Result result = createResult( processor, problem, reason );
+
+        if ( !results.getFailures().contains( result ) )
+        {
+            results.addFailure( result );
+        }
+
+        saveObject( results );
+    }
+
+    public void addWarning( RepositoryMetadata metadata, String processor, String problem, String reason )
+    {
+        MetadataResults results = getMetadataResults( metadata );
+        Result result = createResult( processor, problem, reason );
+
+        if ( !results.getWarnings().contains( result ) )
+        {
+            results.addWarning( result );
+        }
+
+        saveObject( results );
+    }
+
+    public void addNotice( RepositoryMetadata metadata, String processor, String problem, String reason )
+    {
+        MetadataResults results = getMetadataResults( metadata );
+        Result result = createResult( processor, problem, reason );
+
+        if ( !results.getNotices().contains( result ) )
+        {
+            results.addNotice( result );
+        }
+
+        saveObject( results );
+    }
+
+    public void clearResults( MetadataResults results )
+    {
+        results.getFailures().clear();
+        results.getWarnings().clear();
+        results.getNotices().clear();
+
+        saveObject( results );
+    }
+
+    public List getAllMetadataResults()
+    {
+        return getAllObjects( MetadataResults.class, null );
+    }
+
+    public Iterator getIterator()
+    {
+        List allmetadatas = getAllMetadataResults();
+        if ( allmetadatas == null )
+        {
+            return Collections.EMPTY_LIST.iterator();
+        }
+
+        return allmetadatas.iterator();
+    }
+
+    public void remove( MetadataResults results )
+    {
+        removeObject( results );
+    }
+
+    public void remove( RepositoryMetadata metadata )
+    {
+        try
+        {
+            MetadataResults results = lookupMetadataResults( metadata );
+            remove( results );
+        }
+        catch ( JDOObjectNotFoundException e )
+        {
+            // nothing to do.
+        }
+    }
+
+    public MetadataResults getMetadataResults( RepositoryMetadata metadata )
+    {
+        MetadataResults results;
+
+        try
+        {
+            results = lookupMetadataResults( metadata );
+        }
+        catch ( JDOObjectNotFoundException e )
+        {
+            results = createMetadataResults( metadata );
+        }
+
+        return results;
+    }
+
+    private MetadataResults createMetadataResults( RepositoryMetadata metadata )
+    {
+        /* The funky StringUtils.defaultString() is used because of database constraints.
+         * The MetadataResults object has a complex primary key consisting of groupId, artifactId, and version.
+         * This also means that none of those fields may be null.  however, that doesn't eliminate the
+         * ability to have an empty string in place of a null.
+         */
+
+        MetadataResults results = new MetadataResults();
+        results.setGroupId( StringUtils.defaultString( metadata.getGroupId() ) );
+        results.setArtifactId( StringUtils.defaultString( metadata.getArtifactId() ) );
+        results.setVersion( StringUtils.defaultString( metadata.getBaseVersion() ) );
+
+        return results;
+    }
+
+    private MetadataResults lookupMetadataResults( RepositoryMetadata metadata )
+    {
+        /* The funky StringUtils.defaultString() is used because of database constraints.
+         * The MetadataResults object has a complex primary key consisting of groupId, artifactId, and version.
+         * This also means that none of those fields may be null.  however, that doesn't eliminate the
+         * ability to have an empty string in place of a null.
+         */
+
+        MetadataResultsKey key = new MetadataResultsKey();
+        key.groupId = StringUtils.defaultString( metadata.getGroupId(), "" );
+        key.artifactId = StringUtils.defaultString( metadata.getArtifactId(), "" );
+        key.version = StringUtils.defaultString( metadata.getBaseVersion(), "" );
+
+        return (MetadataResults) getObjectByKey( MetadataResults.class, key );
+    }
+
+    public int getNumFailures()
+    {
+        int count = 0;
+        for ( Iterator it = getIterator(); it.hasNext(); )
+        {
+            MetadataResults results = (MetadataResults) it.next();
+            count += results.getFailures().size();
+        }
+        return count;
+    }
+
+    public int getNumNotices()
+    {
+        int count = 0;
+        for ( Iterator it = getIterator(); it.hasNext(); )
+        {
+            MetadataResults results = (MetadataResults) it.next();
+            count += results.getNotices().size();
+        }
+        return count;
+    }
+
+    public int getNumWarnings()
+    {
+        int count = 0;
+        for ( Iterator it = getIterator(); it.hasNext(); )
+        {
+            MetadataResults results = (MetadataResults) it.next();
+            count += results.getWarnings().size();
+        }
+        return count;
+    }
+}

Propchange: maven/archiva/branches/archiva-MRM-239/archiva-reports-standard/src/main/java/org/apache/maven/archiva/reporting/database/MetadataResultsDatabase.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/archiva/branches/archiva-MRM-239/archiva-reports-standard/src/main/java/org/apache/maven/archiva/reporting/database/MetadataResultsDatabase.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Propchange: maven/archiva/branches/archiva-MRM-239/archiva-reports-standard/src/main/java/org/apache/maven/archiva/reporting/database/MetadataResultsDatabase.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: maven/archiva/branches/archiva-MRM-239/archiva-reports-standard/src/main/java/org/apache/maven/archiva/reporting/database/ReportingDatabase.java
URL: http://svn.apache.org/viewvc/maven/archiva/branches/archiva-MRM-239/archiva-reports-standard/src/main/java/org/apache/maven/archiva/reporting/database/ReportingDatabase.java?view=diff&rev=507550&r1=507549&r2=507550
==============================================================================
--- maven/archiva/branches/archiva-MRM-239/archiva-reports-standard/src/main/java/org/apache/maven/archiva/reporting/database/ReportingDatabase.java (original)
+++ maven/archiva/branches/archiva-MRM-239/archiva-reports-standard/src/main/java/org/apache/maven/archiva/reporting/database/ReportingDatabase.java Wed Feb 14 06:44:59 2007
@@ -19,618 +19,106 @@
  * under the License.
  */
 
-import org.apache.maven.archiva.reporting.group.ReportGroup;
-import org.apache.maven.archiva.reporting.model.ArtifactResults;
-import org.apache.maven.archiva.reporting.model.MetadataResults;
-import org.apache.maven.archiva.reporting.model.Reporting;
-import org.apache.maven.archiva.reporting.model.Result;
-import org.apache.maven.artifact.Artifact;
-import org.apache.maven.artifact.repository.ArtifactRepository;
-import org.apache.maven.artifact.repository.metadata.RepositoryMetadata;
-
-import java.util.Date;
-import java.util.HashMap;
 import java.util.Iterator;
-import java.util.LinkedHashSet;
-import java.util.Map;
-import java.util.Set;
 
 /**
+ * The Main Reporting Database.
+ * 
  * @todo i18n, including message formatting and parameterisation
+ * @plexus.component role="org.apache.maven.archiva.reporting.database.ReportingDatabase"
  */
 public class ReportingDatabase
 {
-    private final Reporting reporting;
-
-    private Map artifactMap;
-
-    private Map metadataMap;
-
-    private int numFailures;
-
-    private int numWarnings;
-
-    private ArtifactRepository repository;
-
-    private boolean inProgress;
-
-    private long startTime;
-
-    private final ReportGroup reportGroup;
-
-    private Set metadataWithProblems;
-
-    private Map filteredDatabases = new HashMap();
-
-    private int numNotices;
-
-    public ReportingDatabase( ReportGroup reportGroup )
-    {
-        this( reportGroup, new Reporting() );
-    }
-
-    public ReportingDatabase( ReportGroup reportGroup, Reporting reporting )
-    {
-        this( reportGroup, reporting, null );
-    }
-
-    public ReportingDatabase( ReportGroup reportGroup, ArtifactRepository repository )
-    {
-        this( reportGroup, new Reporting(), repository );
-    }
-
-    public ReportingDatabase( ReportGroup reportGroup, Reporting reporting, ArtifactRepository repository )
-    {
-        this.reportGroup = reportGroup;
-
-        this.reporting = reporting;
-
-        this.repository = repository;
-
-        initArtifactMap();
-
-        initMetadataMap();
-    }
-
-    public void addFailure( Artifact artifact, String processor, String problem, String reason )
-    {
-        ArtifactResults results = getArtifactResults( artifact );
-        Result result = createResult( processor, problem, reason );
-        if ( !results.getFailures().contains( result ) )
-        {
-            results.addFailure( result );
-            numFailures++;
-        }
-        updateTimings();
-
-        if ( filteredDatabases.containsKey( problem ) )
-        {
-            ReportingDatabase reportingDatabase = (ReportingDatabase) filteredDatabases.get( problem );
-
-            reportingDatabase.addFailure( artifact, processor, problem, reason );
-        }
-    }
-
-    public void addNotice( Artifact artifact, String processor, String problem, String reason )
-    {
-        ArtifactResults results = getArtifactResults( artifact );
-        Result result = createResult( processor, problem, reason );
-        if ( !results.getNotices().contains( result ) )
-        {
-            results.addNotice( result );
-            numNotices++;
-        }
-        updateTimings();
-
-        if ( filteredDatabases.containsKey( problem ) )
-        {
-            ReportingDatabase reportingDatabase = (ReportingDatabase) filteredDatabases.get( problem );
-
-            reportingDatabase.addNotice( artifact, processor, problem, reason );
-        }
-    }
-
-    public void addWarning( Artifact artifact, String processor, String problem, String reason )
-    {
-        ArtifactResults results = getArtifactResults( artifact );
-        Result result = createResult( processor, problem, reason );
-        if ( !results.getWarnings().contains( result ) )
-        {
-            results.addWarning( result );
-            numWarnings++;
-        }
-        updateTimings();
-
-        if ( filteredDatabases.containsKey( problem ) )
-        {
-            ReportingDatabase reportingDatabase = (ReportingDatabase) filteredDatabases.get( problem );
-
-            reportingDatabase.addWarning( artifact, processor, problem, reason );
-        }
-    }
-
-    ArtifactResults getArtifactResults( Artifact artifact )
-    {
-        return getArtifactResults( artifact.getGroupId(), artifact.getArtifactId(), artifact.getVersion(),
-                                   artifact.getType(), artifact.getClassifier() );
-    }
-
-    private ArtifactResults getArtifactResults( String groupId, String artifactId, String version, String type,
-                                                String classifier )
-    {
-        Map artifactMap = this.artifactMap;
-
-        String key = getArtifactKey( groupId, artifactId, version, type, classifier );
-        ArtifactResults results = (ArtifactResults) artifactMap.get( key );
-        if ( results == null )
-        {
-            results = new ArtifactResults();
-            results.setArtifactId( artifactId );
-            results.setClassifier( classifier );
-            results.setGroupId( groupId );
-            results.setType( type );
-            results.setVersion( version );
-
-            artifactMap.put( key, results );
-            reporting.getArtifacts().add( results );
-        }
-
-        return results;
-    }
-
-    private void initArtifactMap()
-    {
-        Map map = new HashMap();
-        for ( Iterator i = reporting.getArtifacts().iterator(); i.hasNext(); )
-        {
-            ArtifactResults result = (ArtifactResults) i.next();
-
-            String key = getArtifactKey( result.getGroupId(), result.getArtifactId(), result.getVersion(),
-                                         result.getType(), result.getClassifier() );
-            map.put( key, result );
-
-            numFailures += result.getFailures().size();
-            numWarnings += result.getWarnings().size();
-            numNotices += result.getNotices().size();
-        }
-        artifactMap = map;
-    }
-
-    private static String getArtifactKey( String groupId, String artifactId, String version, String type,
-                                          String classifier )
-    {
-        return groupId + ":" + artifactId + ":" + version + ":" + type + ":" + classifier;
-    }
-
-    private static Result createResult( String processor, String problem, String reason )
-    {
-        Result result = new Result();
-        result.setProcessor( processor );
-        result.setProblem( problem );
-        result.setReason( reason );
-        return result;
-    }
-
-    public void addFailure( RepositoryMetadata metadata, String processor, String problem, String reason )
-    {
-        MetadataResults results = getMetadataResults( metadata, System.currentTimeMillis() );
-        if ( !metadataWithProblems.contains( results ) )
-        {
-            metadataWithProblems.add( results );
-        }
-        Result result = createResult( processor, problem, reason );
-        if ( !results.getFailures().contains( result ) )
-        {
-            results.addFailure( result );
-            numFailures++;
-        }
-        updateTimings();
-
-        if ( filteredDatabases.containsKey( problem ) )
-        {
-            ReportingDatabase reportingDatabase = (ReportingDatabase) filteredDatabases.get( problem );
-
-            reportingDatabase.addFailure( metadata, processor, problem, reason );
-        }
-    }
-
-    public void addWarning( RepositoryMetadata metadata, String processor, String problem, String reason )
-    {
-        MetadataResults results = getMetadataResults( metadata, System.currentTimeMillis() );
-        if ( !metadataWithProblems.contains( results ) )
-        {
-            metadataWithProblems.add( results );
-        }
-        Result result = createResult( processor, problem, reason );
-        if ( !results.getWarnings().contains( result ) )
-        {
-            results.addWarning( result );
-            numWarnings++;
-        }
-        updateTimings();
-
-        if ( filteredDatabases.containsKey( problem ) )
-        {
-            ReportingDatabase reportingDatabase = (ReportingDatabase) filteredDatabases.get( problem );
-
-            reportingDatabase.addWarning( metadata, processor, problem, reason );
-        }
-    }
-
-    public void addNotice( RepositoryMetadata metadata, String processor, String problem, String reason )
-    {
-        MetadataResults results = getMetadataResults( metadata, System.currentTimeMillis() );
-        if ( !metadataWithProblems.contains( results ) )
-        {
-            metadataWithProblems.add( results );
-        }
-        Result result = createResult( processor, problem, reason );
-        if ( !results.getNotices().contains( result ) )
-        {
-            results.addNotice( result );
-            numNotices++;
-        }
-        updateTimings();
-
-        if ( filteredDatabases.containsKey( problem ) )
-        {
-            ReportingDatabase reportingDatabase = (ReportingDatabase) filteredDatabases.get( problem );
-
-            reportingDatabase.addNotice( metadata, processor, problem, reason );
-        }
-    }
-
-    public Set getMetadataWithProblems()
-    {
-        return metadataWithProblems;
-    }
-
-    private void initMetadataMap()
-    {
-        Map map = new HashMap();
-        Set problems = new LinkedHashSet();
+    public static final String ROLE = ReportingDatabase.class.getName();
 
-        for ( Iterator i = reporting.getMetadata().iterator(); i.hasNext(); )
-        {
-            MetadataResults result = (MetadataResults) i.next();
-
-            String key = getMetadataKey( result.getGroupId(), result.getArtifactId(), result.getVersion() );
-
-            map.put( key, result );
-
-            numFailures += result.getFailures().size();
-            numWarnings += result.getWarnings().size();
-            numNotices += result.getNotices().size();
-
-            if ( !result.getFailures().isEmpty() || !result.getWarnings().isEmpty() || !result.getNotices().isEmpty() )
-            {
-                problems.add( result );
-            }
-        }
-        metadataMap = map;
-        metadataWithProblems = problems;
-    }
-
-    private static String getMetadataKey( String groupId, String artifactId, String version )
-    {
-        return groupId + ":" + artifactId + ":" + version;
-    }
-
-    public int getNumFailures()
-    {
-        return numFailures;
-    }
-
-    public int getNumWarnings()
-    {
-        return numWarnings;
-    }
+    /**
+     * @plexus.requirement
+     */
+    private ArtifactResultsDatabase artifactDatabase;
 
-    public Reporting getReporting()
-    {
-        return reporting;
-    }
+    /**
+     * @plexus.requirement
+     */
+    private MetadataResultsDatabase metadataDatabase;
 
     public Iterator getArtifactIterator()
     {
-        return reporting.getArtifacts().iterator();
+        return artifactDatabase.getIterator();
     }
 
     public Iterator getMetadataIterator()
     {
-        return reporting.getMetadata().iterator();
+        return metadataDatabase.getIterator();
     }
 
-    public boolean isMetadataUpToDate( RepositoryMetadata metadata, long timestamp )
+    public void clear()
     {
-        String key = getMetadataKey( metadata.getGroupId(), metadata.getArtifactId(), metadata.getBaseVersion() );
-        Map map = metadataMap;
-        MetadataResults results = (MetadataResults) map.get( key );
-        return results != null && results.getLastModified() >= timestamp;
     }
 
     /**
-     * Make sure the metadata record exists, but remove any previous reports in preparation for adding new ones.
-     *
-     * @param metadata     the metadata
-     * @param lastModified the modification time of the file being tracked
+     * <p>
+     * Get the number of failures in the database.
+     * </p>
+     * 
+     * <p>
+     * <b>WARNING:</b> This is a very resource intensive request. Use sparingly.
+     * </p>
+     * 
+     * @return the number of failures in the database.
      */
-    public void cleanMetadata( RepositoryMetadata metadata, long lastModified )
-    {
-        MetadataResults results = getMetadataResults( metadata, lastModified );
-
-        results.setLastModified( lastModified );
-
-        numFailures -= results.getFailures().size();
-        results.getFailures().clear();
-
-        numWarnings -= results.getWarnings().size();
-        results.getWarnings().clear();
-
-        numNotices -= results.getWarnings().size();
-        results.getNotices().clear();
-
-        metadataWithProblems.remove( results );
-    }
-
-    MetadataResults getMetadataResults( RepositoryMetadata metadata, long lastModified )
-    {
-        return getMetadataResults( metadata.getGroupId(), metadata.getArtifactId(), metadata.getBaseVersion(),
-                                   lastModified );
-    }
-
-    private MetadataResults getMetadataResults( String groupId, String artifactId, String baseVersion,
-                                                long lastModified )
-    {
-        String key = getMetadataKey( groupId, artifactId, baseVersion );
-        Map metadataMap = this.metadataMap;
-        MetadataResults results = (MetadataResults) metadataMap.get( key );
-        if ( results == null )
-        {
-            results = new MetadataResults();
-            results.setArtifactId( artifactId );
-            results.setGroupId( groupId );
-            results.setVersion( baseVersion );
-            results.setLastModified( lastModified );
-
-            metadataMap.put( key, results );
-            reporting.getMetadata().add( results );
-        }
-        return results;
-    }
-
-    public void removeArtifact( Artifact artifact )
-    {
-        Map map = artifactMap;
-
-        String key = getArtifactKey( artifact.getGroupId(), artifact.getArtifactId(), artifact.getVersion(),
-                                     artifact.getType(), artifact.getClassifier() );
-        ArtifactResults results = (ArtifactResults) map.get( key );
-        if ( results != null )
-        {
-            for ( Iterator i = reporting.getArtifacts().iterator(); i.hasNext(); )
-            {
-                if ( results.equals( i.next() ) )
-                {
-                    i.remove();
-                }
-            }
-
-            numFailures -= results.getFailures().size();
-            numWarnings -= results.getWarnings().size();
-            numNotices -= results.getNotices().size();
-
-            map.remove( key );
-        }
-    }
-
-    public ArtifactRepository getRepository()
-    {
-        return repository;
-    }
-
-    public boolean isInProgress()
-    {
-        return inProgress;
-    }
-
-    public void setInProgress( boolean inProgress )
-    {
-        this.inProgress = inProgress;
-
-        if ( inProgress )
-        {
-            startTime = System.currentTimeMillis();
-        }
-    }
-
-    public void clear()
-    {
-        // clear the values rather than destroy the instance so that the "inProgress" indicator is in tact.
-        numWarnings = 0;
-        numNotices = 0;
-        numFailures = 0;
-
-        artifactMap.clear();
-        metadataMap.clear();
-        metadataWithProblems.clear();
-        filteredDatabases.clear();
-
-        reporting.getArtifacts().clear();
-        reporting.getMetadata().clear();
-
-        updateTimings();
-    }
-
-    public void setStartTime( long startTime )
-    {
-        this.startTime = startTime;
-    }
-
-    public long getStartTime()
-    {
-        return startTime;
-    }
-
-    public void updateTimings()
-    {
-        long startTime = getStartTime();
-        Date endTime = new Date();
-        if ( startTime > 0 )
-        {
-            getReporting().setExecutionTime( endTime.getTime() - startTime );
-        }
-        getReporting().setLastModified( endTime.getTime() );
-    }
-
-    public ReportGroup getReportGroup()
+    public int getNumFailures()
     {
-        return reportGroup;
+        int count = 0;
+        count += artifactDatabase.getNumFailures();
+        count += metadataDatabase.getNumFailures();
+        return count;
     }
 
-    public ReportingDatabase getFilteredDatabase( String filter )
+    /**
+     * <p>
+     * Get the number of notices in the database.
+     * </p>
+     * 
+     * <p>
+     * <b>WARNING:</b> This is a very resource intensive request. Use sparingly.
+     * </p>
+     * 
+     * @return the number of notices in the database.
+     */
+    public int getNumNotices()
     {
-        ReportingDatabase reportingDatabase = (ReportingDatabase) filteredDatabases.get( filter );
-
-        if ( reportingDatabase == null )
-        {
-            reportingDatabase = new ReportingDatabase( reportGroup, repository );
-
-            Reporting reporting = reportingDatabase.getReporting();
-            reporting.setExecutionTime( this.reporting.getExecutionTime() );
-            reporting.setLastModified( this.reporting.getLastModified() );
-
-            for ( Iterator i = this.reporting.getArtifacts().iterator(); i.hasNext(); )
-            {
-                ArtifactResults results = (ArtifactResults) i.next();
-                ArtifactResults targetResults = null;
-                for ( Iterator j = results.getFailures().iterator(); j.hasNext(); )
-                {
-                    Result result = (Result) j.next();
-
-                    if ( filter.equals( result.getProcessor() ) )
-                    {
-                        if ( targetResults == null )
-                        {
-                            // lazily create so it is not added unless it has to be
-                            targetResults = createArtifactResults( reportingDatabase, results );
-                        }
-
-                        targetResults.addFailure( result );
-                        reportingDatabase.numFailures++;
-                    }
-                }
-                for ( Iterator j = results.getWarnings().iterator(); j.hasNext(); )
-                {
-                    Result result = (Result) j.next();
-
-                    if ( filter.equals( result.getProcessor() ) )
-                    {
-                        if ( targetResults == null )
-                        {
-                            // lazily create so it is not added unless it has to be
-                            targetResults = createArtifactResults( reportingDatabase, results );
-                        }
-
-                        targetResults.addWarning( result );
-                        reportingDatabase.numWarnings++;
-                    }
-                }
-                for ( Iterator j = results.getNotices().iterator(); j.hasNext(); )
-                {
-                    Result result = (Result) j.next();
-
-                    if ( filter.equals( result.getProcessor() ) )
-                    {
-                        if ( targetResults == null )
-                        {
-                            // lazily create so it is not added unless it has to be
-                            targetResults = createArtifactResults( reportingDatabase, results );
-                        }
-
-                        targetResults.addNotice( result );
-                        reportingDatabase.numNotices++;
-                    }
-                }
-            }
-            for ( Iterator i = this.reporting.getMetadata().iterator(); i.hasNext(); )
-            {
-                MetadataResults results = (MetadataResults) i.next();
-                MetadataResults targetResults = null;
-                for ( Iterator j = results.getFailures().iterator(); j.hasNext(); )
-                {
-                    Result result = (Result) j.next();
-
-                    if ( filter.equals( result.getProcessor() ) )
-                    {
-                        if ( targetResults == null )
-                        {
-                            // lazily create so it is not added unless it has to be
-                            targetResults = createMetadataResults( reportingDatabase, results );
-                        }
-
-                        targetResults.addFailure( result );
-                        reportingDatabase.numFailures++;
-                    }
-                }
-                for ( Iterator j = results.getWarnings().iterator(); j.hasNext(); )
-                {
-                    Result result = (Result) j.next();
-
-                    if ( filter.equals( result.getProcessor() ) )
-                    {
-                        if ( targetResults == null )
-                        {
-                            // lazily create so it is not added unless it has to be
-                            targetResults = createMetadataResults( reportingDatabase, results );
-                        }
-
-                        targetResults.addWarning( result );
-                        reportingDatabase.numWarnings++;
-                    }
-                }
-                for ( Iterator j = results.getNotices().iterator(); j.hasNext(); )
-                {
-                    Result result = (Result) j.next();
-
-                    if ( filter.equals( result.getProcessor() ) )
-                    {
-                        if ( targetResults == null )
-                        {
-                            // lazily create so it is not added unless it has to be
-                            targetResults = createMetadataResults( reportingDatabase, results );
-                        }
-
-                        targetResults.addNotice( result );
-                        reportingDatabase.numNotices++;
-                    }
-                }
-            }
-
-            filteredDatabases.put( filter, reportingDatabase );
-        }
-
-        return reportingDatabase;
+        int count = 0;
+        count += artifactDatabase.getNumNotices();
+        count += metadataDatabase.getNumNotices();
+        return count;
     }
 
-    private static MetadataResults createMetadataResults( ReportingDatabase reportingDatabase, MetadataResults results )
+    /**
+     * <p>
+     * Get the number of warnings in the database.
+     * </p>
+     * 
+     * <p>
+     * <b>WARNING:</b> This is a very resource intensive request. Use sparingly.
+     * </p>
+     * 
+     * @return the number of warnings in the database.
+     */
+    public int getNumWarnings()
     {
-        MetadataResults targetResults = reportingDatabase.getMetadataResults( results.getGroupId(),
-                                                                              results.getArtifactId(),
-                                                                              results.getVersion(),
-                                                                              results.getLastModified() );
-        reportingDatabase.metadataWithProblems.add( targetResults );
-        return targetResults;
+        int count = 0;
+        count += artifactDatabase.getNumWarnings();
+        count += metadataDatabase.getNumWarnings();
+        return count;
     }
 
-    private static ArtifactResults createArtifactResults( ReportingDatabase reportingDatabase, ArtifactResults results )
+    public ArtifactResultsDatabase getArtifactDatabase()
     {
-        return reportingDatabase.getArtifactResults( results.getGroupId(), results.getArtifactId(),
-                                                     results.getVersion(), results.getType(), results.getClassifier() );
+        return artifactDatabase;
     }
 
-    public int getNumNotices()
+    public MetadataResultsDatabase getMetadataDatabase()
     {
-        return numNotices;
+        return metadataDatabase;
     }
 }

Modified: maven/archiva/branches/archiva-MRM-239/archiva-reports-standard/src/main/java/org/apache/maven/archiva/reporting/group/AbstractReportGroup.java
URL: http://svn.apache.org/viewvc/maven/archiva/branches/archiva-MRM-239/archiva-reports-standard/src/main/java/org/apache/maven/archiva/reporting/group/AbstractReportGroup.java?view=diff&rev=507550&r1=507549&r2=507550
==============================================================================
--- maven/archiva/branches/archiva-MRM-239/archiva-reports-standard/src/main/java/org/apache/maven/archiva/reporting/group/AbstractReportGroup.java (original)
+++ maven/archiva/branches/archiva-MRM-239/archiva-reports-standard/src/main/java/org/apache/maven/archiva/reporting/group/AbstractReportGroup.java Wed Feb 14 06:44:59 2007
@@ -19,7 +19,6 @@
  * under the License.
  */
 
-import org.apache.maven.archiva.reporting.database.ReportingDatabase;
 import org.apache.maven.archiva.reporting.processor.ArtifactReportProcessor;
 import org.apache.maven.archiva.reporting.processor.MetadataReportProcessor;
 import org.apache.maven.artifact.Artifact;
@@ -46,7 +45,7 @@
      */
     private Map metadataReports;
 
-    public void processArtifact( Artifact artifact, Model model, ReportingDatabase reportingDatabase )
+    public void processArtifact( Artifact artifact, Model model )
     {
         for ( Iterator i = artifactReports.entrySet().iterator(); i.hasNext(); )
         {
@@ -56,13 +55,12 @@
             {
                 ArtifactReportProcessor report = (ArtifactReportProcessor) entry.getValue();
 
-                report.processArtifact( artifact, model, reportingDatabase );
+                report.processArtifact( artifact, model );
             }
         }
     }
 
-    public void processMetadata( RepositoryMetadata repositoryMetadata, ArtifactRepository repository,
-                                 ReportingDatabase reportingDatabase )
+    public void processMetadata( RepositoryMetadata repositoryMetadata, ArtifactRepository repository )
     {
         for ( Iterator i = metadataReports.entrySet().iterator(); i.hasNext(); )
         {
@@ -72,7 +70,7 @@
             {
                 MetadataReportProcessor report = (MetadataReportProcessor) entry.getValue();
 
-                report.processMetadata( repositoryMetadata, repository, reportingDatabase );
+                report.processMetadata( repositoryMetadata, repository );
             }
         }
     }

Modified: maven/archiva/branches/archiva-MRM-239/archiva-reports-standard/src/main/java/org/apache/maven/archiva/reporting/group/DefaultReportGroup.java
URL: http://svn.apache.org/viewvc/maven/archiva/branches/archiva-MRM-239/archiva-reports-standard/src/main/java/org/apache/maven/archiva/reporting/group/DefaultReportGroup.java?view=diff&rev=507550&r1=507549&r2=507550
==============================================================================
--- maven/archiva/branches/archiva-MRM-239/archiva-reports-standard/src/main/java/org/apache/maven/archiva/reporting/group/DefaultReportGroup.java (original)
+++ maven/archiva/branches/archiva-MRM-239/archiva-reports-standard/src/main/java/org/apache/maven/archiva/reporting/group/DefaultReportGroup.java Wed Feb 14 06:44:59 2007
@@ -25,7 +25,8 @@
 /**
  * The default report set, for repository health.
  *
- * @plexus.component role="org.apache.maven.archiva.reporting.group.ReportGroup" role-hint="health"
+ * @plexus.component role="org.apache.maven.archiva.reporting.group.ReportGroup" 
+ *      role-hint="health"
  * @todo could these report groups be assembled dynamically by configuration rather than as explicit components? eg, reportGroup.addReport( ARP ), reportGroup.addReport( MRP )
  */
 public class DefaultReportGroup
@@ -61,10 +62,5 @@
     public String getName()
     {
         return "Repository Health";
-    }
-
-    public String getFilename()
-    {
-        return "health-report.xml";
     }
 }

Modified: maven/archiva/branches/archiva-MRM-239/archiva-reports-standard/src/main/java/org/apache/maven/archiva/reporting/group/ReportGroup.java
URL: http://svn.apache.org/viewvc/maven/archiva/branches/archiva-MRM-239/archiva-reports-standard/src/main/java/org/apache/maven/archiva/reporting/group/ReportGroup.java?view=diff&rev=507550&r1=507549&r2=507550
==============================================================================
--- maven/archiva/branches/archiva-MRM-239/archiva-reports-standard/src/main/java/org/apache/maven/archiva/reporting/group/ReportGroup.java (original)
+++ maven/archiva/branches/archiva-MRM-239/archiva-reports-standard/src/main/java/org/apache/maven/archiva/reporting/group/ReportGroup.java Wed Feb 14 06:44:59 2007
@@ -19,7 +19,6 @@
  * under the License.
  */
 
-import org.apache.maven.archiva.reporting.database.ReportingDatabase;
 import org.apache.maven.artifact.Artifact;
 import org.apache.maven.artifact.repository.ArtifactRepository;
 import org.apache.maven.artifact.repository.metadata.RepositoryMetadata;
@@ -43,19 +42,16 @@
      *
      * @param artifact          the artifact to process
      * @param model             the POM associated with the artifact to process
-     * @param reportingDatabase the report database to store results in
      */
-    void processArtifact( Artifact artifact, Model model, ReportingDatabase reportingDatabase );
+    void processArtifact( Artifact artifact, Model model );
 
     /**
      * Run any metadata related reports in the report set.
      *
      * @param repositoryMetadata the metadata to process
      * @param repository         the repository the metadata is located in
-     * @param reportingDatabase  the report database to store results in
      */
-    void processMetadata( RepositoryMetadata repositoryMetadata, ArtifactRepository repository,
-                          ReportingDatabase reportingDatabase );
+    void processMetadata( RepositoryMetadata repositoryMetadata, ArtifactRepository repository );
 
     /**
      * Whether a report with the given role hint is included in this report set.
@@ -79,11 +75,4 @@
      * @return the report name
      */
     String getName();
-
-    /**
-     * Get the filename of the reports within the repository's reports directory.
-     *
-     * @return the filename
-     */
-    String getFilename();
 }

Added: maven/archiva/branches/archiva-MRM-239/archiva-reports-standard/src/main/java/org/apache/maven/archiva/reporting/model/ArtifactResultsKey.java
URL: http://svn.apache.org/viewvc/maven/archiva/branches/archiva-MRM-239/archiva-reports-standard/src/main/java/org/apache/maven/archiva/reporting/model/ArtifactResultsKey.java?view=auto&rev=507550
==============================================================================
--- maven/archiva/branches/archiva-MRM-239/archiva-reports-standard/src/main/java/org/apache/maven/archiva/reporting/model/ArtifactResultsKey.java (added)
+++ maven/archiva/branches/archiva-MRM-239/archiva-reports-standard/src/main/java/org/apache/maven/archiva/reporting/model/ArtifactResultsKey.java Wed Feb 14 06:44:59 2007
@@ -0,0 +1,158 @@
+package org.apache.maven.archiva.reporting.model;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.commons.lang.StringUtils;
+
+import java.io.Serializable;
+
+/**
+ * ArtifactResultsKey - used by jpox for application identity for the {@link ArtifactResults} object and table. 
+ *
+ * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
+ * @version $Id$
+ */
+public class ArtifactResultsKey
+    implements Serializable
+{
+    public String groupId = "";
+
+    public String artifactId = "";
+
+    public String version = "";
+
+    public String type = "";
+
+    public String classifier = "";
+
+    public ArtifactResultsKey()
+    {
+        /* do nothing */
+    }
+
+    public ArtifactResultsKey( String key )
+    {
+        String parts[] = StringUtils.splitPreserveAllTokens( key, ':' );
+        groupId = parts[0];
+        artifactId = parts[1];
+        version = parts[2];
+        type = parts[3];
+        classifier = parts[4];
+    }
+
+    public String toString()
+    {
+        return StringUtils.join( new String[] { groupId, artifactId, version, type, classifier }, ':' );
+    }
+
+    public int hashCode()
+    {
+        final int PRIME = 31;
+        int result = 1;
+        result = PRIME * result + ( ( groupId == null ) ? 0 : groupId.hashCode() );
+        result = PRIME * result + ( ( artifactId == null ) ? 0 : artifactId.hashCode() );
+        result = PRIME * result + ( ( version == null ) ? 0 : version.hashCode() );
+        result = PRIME * result + ( ( type == null ) ? 0 : type.hashCode() );
+        result = PRIME * result + ( ( classifier == null ) ? 0 : classifier.hashCode() );
+        return result;
+    }
+
+    public boolean equals( Object obj )
+    {
+        if ( this == obj )
+        {
+            return true;
+        }
+
+        if ( obj == null )
+        {
+            return false;
+        }
+
+        if ( getClass() != obj.getClass() )
+        {
+            return false;
+        }
+
+        final ArtifactResultsKey other = (ArtifactResultsKey) obj;
+
+        if ( groupId == null )
+        {
+            if ( other.groupId != null )
+            {
+                return false;
+            }
+        }
+        else if ( !groupId.equals( other.groupId ) )
+        {
+            return false;
+        }
+
+        if ( artifactId == null )
+        {
+            if ( other.artifactId != null )
+            {
+                return false;
+            }
+        }
+        else if ( !artifactId.equals( other.artifactId ) )
+        {
+            return false;
+        }
+
+        if ( version == null )
+        {
+            if ( other.version != null )
+            {
+                return false;
+            }
+        }
+        else if ( !version.equals( other.version ) )
+        {
+            return false;
+        }
+
+        if ( type == null )
+        {
+            if ( other.type != null )
+            {
+                return false;
+            }
+        }
+        else if ( !type.equals( other.type ) )
+        {
+            return false;
+        }
+
+        if ( classifier == null )
+        {
+            if ( other.classifier != null )
+            {
+                return false;
+            }
+        }
+        else if ( !classifier.equals( other.classifier ) )
+        {
+            return false;
+        }
+
+        return true;
+    }
+}

Propchange: maven/archiva/branches/archiva-MRM-239/archiva-reports-standard/src/main/java/org/apache/maven/archiva/reporting/model/ArtifactResultsKey.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/archiva/branches/archiva-MRM-239/archiva-reports-standard/src/main/java/org/apache/maven/archiva/reporting/model/ArtifactResultsKey.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Propchange: maven/archiva/branches/archiva-MRM-239/archiva-reports-standard/src/main/java/org/apache/maven/archiva/reporting/model/ArtifactResultsKey.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: maven/archiva/branches/archiva-MRM-239/archiva-reports-standard/src/main/java/org/apache/maven/archiva/reporting/model/MetadataResultsKey.java
URL: http://svn.apache.org/viewvc/maven/archiva/branches/archiva-MRM-239/archiva-reports-standard/src/main/java/org/apache/maven/archiva/reporting/model/MetadataResultsKey.java?view=auto&rev=507550
==============================================================================
--- maven/archiva/branches/archiva-MRM-239/archiva-reports-standard/src/main/java/org/apache/maven/archiva/reporting/model/MetadataResultsKey.java (added)
+++ maven/archiva/branches/archiva-MRM-239/archiva-reports-standard/src/main/java/org/apache/maven/archiva/reporting/model/MetadataResultsKey.java Wed Feb 14 06:44:59 2007
@@ -0,0 +1,126 @@
+package org.apache.maven.archiva.reporting.model;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.commons.lang.StringUtils;
+
+import java.io.Serializable;
+
+/**
+ * MetadataResultsKey - used by jpox for application identity for the {@link MetadataResults} object and table. 
+ *
+ * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
+ * @version $Id$
+ */
+public class MetadataResultsKey
+    implements Serializable
+{
+    public String groupId = "";
+
+    public String artifactId = "";
+
+    public String version = "";
+
+    public MetadataResultsKey()
+    {
+        /* do nothing */
+    }
+
+    public MetadataResultsKey( String key )
+    {
+        String parts[] = StringUtils.splitPreserveAllTokens( key, ':' );
+        groupId = parts[0];
+        artifactId = parts[1];
+        version = parts[2];
+    }
+
+    public String toString()
+    {
+        return StringUtils.join( new String[] { groupId, artifactId, version }, ':' );
+    }
+
+    public int hashCode()
+    {
+        final int PRIME = 31;
+        int result = 1;
+        result = PRIME * result + ( ( groupId == null ) ? 0 : groupId.hashCode() );
+        result = PRIME * result + ( ( artifactId == null ) ? 0 : artifactId.hashCode() );
+        result = PRIME * result + ( ( version == null ) ? 0 : version.hashCode() );
+        return result;
+    }
+
+    public boolean equals( Object obj )
+    {
+        if ( this == obj )
+        {
+            return true;
+        }
+
+        if ( obj == null )
+        {
+            return false;
+        }
+
+        if ( getClass() != obj.getClass() )
+        {
+            return false;
+        }
+
+        final ArtifactResultsKey other = (ArtifactResultsKey) obj;
+
+        if ( groupId == null )
+        {
+            if ( other.groupId != null )
+            {
+                return false;
+            }
+        }
+        else if ( !groupId.equals( other.groupId ) )
+        {
+            return false;
+        }
+
+        if ( artifactId == null )
+        {
+            if ( other.artifactId != null )
+            {
+                return false;
+            }
+        }
+        else if ( !artifactId.equals( other.artifactId ) )
+        {
+            return false;
+        }
+
+        if ( version == null )
+        {
+            if ( other.version != null )
+            {
+                return false;
+            }
+        }
+        else if ( !version.equals( other.version ) )
+        {
+            return false;
+        }
+
+        return true;
+    }    
+}

Propchange: maven/archiva/branches/archiva-MRM-239/archiva-reports-standard/src/main/java/org/apache/maven/archiva/reporting/model/MetadataResultsKey.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/archiva/branches/archiva-MRM-239/archiva-reports-standard/src/main/java/org/apache/maven/archiva/reporting/model/MetadataResultsKey.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Propchange: maven/archiva/branches/archiva-MRM-239/archiva-reports-standard/src/main/java/org/apache/maven/archiva/reporting/model/MetadataResultsKey.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain



Mime
View raw message