archiva-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From joak...@apache.org
Subject svn commit: r534044 [1/2] - in /maven/archiva/branches/archiva-jpox-database-refactor: archiva-base/archiva-configuration/src/main/mdo/ archiva-database/src/main/java/org/apache/maven/archiva/database/ archiva-database/src/main/java/org/apache/maven/ar...
Date Tue, 01 May 2007 12:46:49 GMT
Author: joakime
Date: Tue May  1 05:46:46 2007
New Revision: 534044

URL: http://svn.apache.org/viewvc?view=rev&rev=534044
Log:
Updates for admin screens

Added:
    maven/archiva/branches/archiva-jpox-database-refactor/archiva-database/src/main/java/org/apache/maven/archiva/database/constraints/MostRecentRepositoryScanStatistics.java   (with props)
    maven/archiva/branches/archiva-jpox-database-refactor/archiva-database/src/test/java/org/apache/maven/archiva/database/constraints/MostRecentRepositoryScanStatisticsTest.java   (with props)
    maven/archiva/branches/archiva-jpox-database-refactor/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/AbstractRepositoryAction.java   (with props)
    maven/archiva/branches/archiva-jpox-database-refactor/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/EditRepositoryAction.java   (with props)
    maven/archiva/branches/archiva-jpox-database-refactor/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/IndexRepositoryAction.java
      - copied, changed from r533137, maven/archiva/branches/archiva-jpox-database-refactor/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/RunRepositoryTaskAction.java
    maven/archiva/branches/archiva-jpox-database-refactor/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/SaveRepositoryAction.java   (with props)
    maven/archiva/branches/archiva-jpox-database-refactor/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/models/
    maven/archiva/branches/archiva-jpox-database-refactor/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/models/AdminModel.java
      - copied, changed from r533137, maven/archiva/branches/archiva-jpox-database-refactor/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/AdminModel.java
    maven/archiva/branches/archiva-jpox-database-refactor/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/models/AdminRepositoryConfiguration.java   (with props)
    maven/archiva/branches/archiva-jpox-database-refactor/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/interceptor/WebworkIsDoingStrangeThingsInterceptor.java   (with props)
    maven/archiva/branches/archiva-jpox-database-refactor/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/tags/CopyPasteSnippet.java   (with props)
    maven/archiva/branches/archiva-jpox-database-refactor/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/tags/CopyPasteSnippetTag.java   (with props)
    maven/archiva/branches/archiva-jpox-database-refactor/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/util/ContextUtils.java   (with props)
Removed:
    maven/archiva/branches/archiva-jpox-database-refactor/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/AbstractConfigureRepositoryAction.java
    maven/archiva/branches/archiva-jpox-database-refactor/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/AdminModel.java
    maven/archiva/branches/archiva-jpox-database-refactor/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/ConfigureProxiedRepositoryAction.java
    maven/archiva/branches/archiva-jpox-database-refactor/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/ConfigureSyncedRepositoryAction.java
    maven/archiva/branches/archiva-jpox-database-refactor/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/DeleteProxiedRepositoryAction.java
    maven/archiva/branches/archiva-jpox-database-refactor/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/DeleteSyncedRepositoryAction.java
    maven/archiva/branches/archiva-jpox-database-refactor/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/RunRepositoryTaskAction.java
    maven/archiva/branches/archiva-jpox-database-refactor/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/component/
    maven/archiva/branches/archiva-jpox-database-refactor/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/addProxiedRepository.jsp
    maven/archiva/branches/archiva-jpox-database-refactor/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/addSyncedRepository.jsp
    maven/archiva/branches/archiva-jpox-database-refactor/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/deleteProxiedRepository.jsp
    maven/archiva/branches/archiva-jpox-database-refactor/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/deleteSyncedRepository.jsp
    maven/archiva/branches/archiva-jpox-database-refactor/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/editProxiedRepository.jsp
    maven/archiva/branches/archiva-jpox-database-refactor/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/editSyncedRepository.jsp
    maven/archiva/branches/archiva-jpox-database-refactor/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/managedRepositories.jsp
    maven/archiva/branches/archiva-jpox-database-refactor/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/proxiedRepositories.jsp
    maven/archiva/branches/archiva-jpox-database-refactor/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/selectSyncedRepository.jsp
    maven/archiva/branches/archiva-jpox-database-refactor/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/syncedRepositories.jsp
Modified:
    maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-configuration/src/main/mdo/configuration.mdo
    maven/archiva/branches/archiva-jpox-database-refactor/archiva-database/src/main/java/org/apache/maven/archiva/database/ArchivaDAO.java
    maven/archiva/branches/archiva-jpox-database-refactor/archiva-database/src/main/java/org/apache/maven/archiva/database/jdo/JdoArchivaDAO.java
    maven/archiva/branches/archiva-jpox-database-refactor/archiva-database/src/test/java/org/apache/maven/archiva/database/AbstractArchivaDatabaseTestCase.java
    maven/archiva/branches/archiva-jpox-database-refactor/archiva-database/src/test/java/org/apache/maven/archiva/database/constraints/ArtifactsProcessedConstraintTest.java
    maven/archiva/branches/archiva-jpox-database-refactor/archiva-scheduled/src/main/java/org/apache/maven/archiva/scheduled/ArchivaTaskQueue.java
    maven/archiva/branches/archiva-jpox-database-refactor/archiva-scheduled/src/main/java/org/apache/maven/archiva/scheduled/ArchivaTaskScheduler.java
    maven/archiva/branches/archiva-jpox-database-refactor/archiva-scheduled/src/main/java/org/apache/maven/archiva/scheduled/DefaultArchivaTaskScheduler.java
    maven/archiva/branches/archiva-jpox-database-refactor/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/ConfigureAction.java
    maven/archiva/branches/archiva-jpox-database-refactor/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/ConfigureRepositoryAction.java
    maven/archiva/branches/archiva-jpox-database-refactor/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/RepositoriesAction.java
    maven/archiva/branches/archiva-jpox-database-refactor/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/repository/RepositoryServlet.java
    maven/archiva/branches/archiva-jpox-database-refactor/archiva-web/archiva-webapp/src/main/resources/META-INF/plexus/application.xml
    maven/archiva/branches/archiva-jpox-database-refactor/archiva-web/archiva-webapp/src/main/resources/META-INF/taglib.tld
    maven/archiva/branches/archiva-jpox-database-refactor/archiva-web/archiva-webapp/src/main/resources/log4j.xml
    maven/archiva/branches/archiva-jpox-database-refactor/archiva-web/archiva-webapp/src/main/resources/webwork.properties
    maven/archiva/branches/archiva-jpox-database-refactor/archiva-web/archiva-webapp/src/main/resources/xwork.xml
    maven/archiva/branches/archiva-jpox-database-refactor/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/addRepository.jsp
    maven/archiva/branches/archiva-jpox-database-refactor/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/editRepository.jsp
    maven/archiva/branches/archiva-jpox-database-refactor/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/include/managedRepositoryForm.jspf
    maven/archiva/branches/archiva-jpox-database-refactor/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/repositories.jsp
    maven/archiva/branches/archiva-jpox-database-refactor/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/decorators/default.jsp
    maven/archiva/branches/archiva-jpox-database-refactor/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/tags/currentWWUrl.tag
    maven/archiva/branches/archiva-jpox-database-refactor/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/web.xml
    maven/archiva/branches/archiva-jpox-database-refactor/archiva-web/archiva-webapp/src/main/webapp/css/maven-theme.css

Modified: maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-configuration/src/main/mdo/configuration.mdo
URL: http://svn.apache.org/viewvc/maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-configuration/src/main/mdo/configuration.mdo?view=diff&rev=534044&r1=534043&r2=534044
==============================================================================
--- maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-configuration/src/main/mdo/configuration.mdo (original)
+++ maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-configuration/src/main/mdo/configuration.mdo Tue May  1 05:46:46 2007
@@ -257,7 +257,47 @@
           </description>
           <defaultValue>0 0,30 * * * ?</defaultValue>
         </field>
-      </fields>
+      </fields>
+      <codeSegments>
+        <codeSegment>
+          <version>1.0.0+</version>
+          <code><![CDATA[
+    /**
+     * Utility method to help determine if configuration refers to a remote repository.
+     * 
+     * @return true if configuration belongs to a remote repository. 
+     *      (note: false does not automatically mean this is a managed repository,
+     *      you must use {@link #isManaged()} to test for that.)
+     */
+    public boolean isRemote()
+    {
+        if ( this.url == null )
+        {
+            return false;
+        }
+
+        return !this.url.startsWith( "file" );
+    }
+
+    /**
+     * Utility method to help determine if configuration refers to a managed repository.
+     * 
+     * @return true if configuration belongs to a managed repository. 
+     *      (note: false does not automatically mean this is a remote repository,
+     *      you must use {@link #isRemote()} to test for that.)
+     */
+    public boolean isManaged()
+    {
+        if ( this.url == null )
+        {
+            return false;
+        }
+
+        return this.url.startsWith( "file" );
+    }          
+          ]]></code>
+        </codeSegment>
+      </codeSegments>
     </class>
     
     <!-- 

Modified: maven/archiva/branches/archiva-jpox-database-refactor/archiva-database/src/main/java/org/apache/maven/archiva/database/ArchivaDAO.java
URL: http://svn.apache.org/viewvc/maven/archiva/branches/archiva-jpox-database-refactor/archiva-database/src/main/java/org/apache/maven/archiva/database/ArchivaDAO.java?view=diff&rev=534044&r1=534043&r2=534044
==============================================================================
--- maven/archiva/branches/archiva-jpox-database-refactor/archiva-database/src/main/java/org/apache/maven/archiva/database/ArchivaDAO.java (original)
+++ maven/archiva/branches/archiva-jpox-database-refactor/archiva-database/src/main/java/org/apache/maven/archiva/database/ArchivaDAO.java Tue May  1 05:46:46 2007
@@ -19,6 +19,7 @@
  * under the License.
  */
 
+import java.io.Serializable;
 import java.util.List;
 
 /**
@@ -38,6 +39,14 @@
      * @return the List of results.
      */
     List query( SimpleConstraint constraint );
+
+    /**
+     * Perform a simple save of a peristable object to the database.
+     * 
+     * @param o the serializable (persistable) object to save.
+     * @return the post-serialized object.
+     */
+    Object save( Serializable obj );
 
     ArtifactDAO getArtifactDAO();
 

Added: maven/archiva/branches/archiva-jpox-database-refactor/archiva-database/src/main/java/org/apache/maven/archiva/database/constraints/MostRecentRepositoryScanStatistics.java
URL: http://svn.apache.org/viewvc/maven/archiva/branches/archiva-jpox-database-refactor/archiva-database/src/main/java/org/apache/maven/archiva/database/constraints/MostRecentRepositoryScanStatistics.java?view=auto&rev=534044
==============================================================================
--- maven/archiva/branches/archiva-jpox-database-refactor/archiva-database/src/main/java/org/apache/maven/archiva/database/constraints/MostRecentRepositoryScanStatistics.java (added)
+++ maven/archiva/branches/archiva-jpox-database-refactor/archiva-database/src/main/java/org/apache/maven/archiva/database/constraints/MostRecentRepositoryScanStatistics.java Tue May  1 05:46:46 2007
@@ -0,0 +1,54 @@
+package org.apache.maven.archiva.database.constraints;
+
+/*
+ * 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.model.RepositoryContentStatistics;
+
+/**
+ * MostRecentRepositoryScanStatistics 
+ *
+ * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
+ * @version $Id$
+ */
+public class MostRecentRepositoryScanStatistics
+    extends AbstractSimpleConstraint
+{
+    private String sql;
+
+    public MostRecentRepositoryScanStatistics( String repoId )
+    {
+        sql = "SELECT FROM " + RepositoryContentStatistics.class.getName()
+            + " WHERE repositoryId == repoId PARAMETERS String repoId"
+            + " ORDER BY whenGathered DESCENDING"
+            + " RANGE 1,1";
+
+        super.params = new Object[] { repoId };
+    }
+
+    public Class getResultClass()
+    {
+        return RepositoryContentStatistics.class;
+    }
+
+    public String getSelectSql()
+    {
+        return sql;
+    }
+}

Propchange: maven/archiva/branches/archiva-jpox-database-refactor/archiva-database/src/main/java/org/apache/maven/archiva/database/constraints/MostRecentRepositoryScanStatistics.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/archiva/branches/archiva-jpox-database-refactor/archiva-database/src/main/java/org/apache/maven/archiva/database/constraints/MostRecentRepositoryScanStatistics.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: maven/archiva/branches/archiva-jpox-database-refactor/archiva-database/src/main/java/org/apache/maven/archiva/database/constraints/MostRecentRepositoryScanStatistics.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: maven/archiva/branches/archiva-jpox-database-refactor/archiva-database/src/main/java/org/apache/maven/archiva/database/jdo/JdoArchivaDAO.java
URL: http://svn.apache.org/viewvc/maven/archiva/branches/archiva-jpox-database-refactor/archiva-database/src/main/java/org/apache/maven/archiva/database/jdo/JdoArchivaDAO.java?view=diff&rev=534044&r1=534043&r2=534044
==============================================================================
--- maven/archiva/branches/archiva-jpox-database-refactor/archiva-database/src/main/java/org/apache/maven/archiva/database/jdo/JdoArchivaDAO.java (original)
+++ maven/archiva/branches/archiva-jpox-database-refactor/archiva-database/src/main/java/org/apache/maven/archiva/database/jdo/JdoArchivaDAO.java Tue May  1 05:46:46 2007
@@ -27,6 +27,7 @@
 import org.apache.maven.archiva.database.SimpleConstraint;
 import org.codehaus.plexus.logging.AbstractLogEnabled;
 
+import java.io.Serializable;
 import java.util.List;
 
 /**
@@ -45,37 +46,42 @@
      * @plexus.requirement role-hint="archiva"
      */
     private JdoAccess jdo;
-    
+
     /**
      * @plexus.requirement role-hint="jdo"
      */
     private ArtifactDAO artifactDAO;
-    
+
     /**
      * @plexus.requirement role-hint="jdo"
      */
     private ProjectModelDAO projectModelDAO;
-    
+
     /**
      * @plexus.requirement role-hint="jdo"
      */
     private RepositoryDAO repositoryDAO;
-    
+
     /**
      * @plexus.requirement role-hint="jdo"
      */
     private RepositoryProblemDAO repositoryProblemDAO;
-    
+
     public List query( SimpleConstraint constraint )
     {
         return jdo.queryObjects( constraint );
     }
 
+    public Object save( Serializable obj )
+    {
+        return jdo.saveObject( obj );
+    }
+
     public ArtifactDAO getArtifactDAO()
     {
         return artifactDAO;
     }
-    
+
     public ProjectModelDAO getProjectModelDAO()
     {
         return projectModelDAO;

Modified: maven/archiva/branches/archiva-jpox-database-refactor/archiva-database/src/test/java/org/apache/maven/archiva/database/AbstractArchivaDatabaseTestCase.java
URL: http://svn.apache.org/viewvc/maven/archiva/branches/archiva-jpox-database-refactor/archiva-database/src/test/java/org/apache/maven/archiva/database/AbstractArchivaDatabaseTestCase.java?view=diff&rev=534044&r1=534043&r2=534044
==============================================================================
--- maven/archiva/branches/archiva-jpox-database-refactor/archiva-database/src/test/java/org/apache/maven/archiva/database/AbstractArchivaDatabaseTestCase.java (original)
+++ maven/archiva/branches/archiva-jpox-database-refactor/archiva-database/src/test/java/org/apache/maven/archiva/database/AbstractArchivaDatabaseTestCase.java Tue May  1 05:46:46 2007
@@ -26,6 +26,8 @@
 
 import java.io.File;
 import java.net.URL;
+import java.text.SimpleDateFormat;
+import java.util.Date;
 import java.util.Iterator;
 import java.util.Map;
 import java.util.Properties;
@@ -42,41 +44,43 @@
 public class AbstractArchivaDatabaseTestCase
     extends PlexusTestCase
 {
+    private static final String TIMESTAMP = "yyyy/MM/dd HH:mm:ss";
+
     protected ArchivaDAO dao;
-    
+
     protected void setUp()
         throws Exception
     {
         super.setUp();
-        
+
         DefaultConfigurableJdoFactory jdoFactory = (DefaultConfigurableJdoFactory) lookup( JdoFactory.ROLE, "archiva" );
         assertEquals( DefaultConfigurableJdoFactory.class.getName(), jdoFactory.getClass().getName() );
 
-        jdoFactory.setPersistenceManagerFactoryClass( "org.jpox.PersistenceManagerFactoryImpl" ); 
+        jdoFactory.setPersistenceManagerFactoryClass( "org.jpox.PersistenceManagerFactoryImpl" );
 
         /* derby version
-        File derbyDbDir = new File( "target/plexus-home/testdb" );
-        if ( derbyDbDir.exists() )
-        {
-            FileUtils.deleteDirectory( derbyDbDir );
-        }
-
-        jdoFactory.setDriverName( System.getProperty( "jdo.test.driver", "org.apache.derby.jdbc.EmbeddedDriver" ) );   
-        jdoFactory.setUrl( System.getProperty( "jdo.test.url", "jdbc:derby:" + derbyDbDir.getAbsolutePath() + ";create=true" ) );
-         */   
+         File derbyDbDir = new File( "target/plexus-home/testdb" );
+         if ( derbyDbDir.exists() )
+         {
+         FileUtils.deleteDirectory( derbyDbDir );
+         }
+
+         jdoFactory.setDriverName( System.getProperty( "jdo.test.driver", "org.apache.derby.jdbc.EmbeddedDriver" ) );   
+         jdoFactory.setUrl( System.getProperty( "jdo.test.url", "jdbc:derby:" + derbyDbDir.getAbsolutePath() + ";create=true" ) );
+         */
 
-        jdoFactory.setDriverName( System.getProperty( "jdo.test.driver", "org.hsqldb.jdbcDriver" ) );   
+        jdoFactory.setDriverName( System.getProperty( "jdo.test.driver", "org.hsqldb.jdbcDriver" ) );
         jdoFactory.setUrl( System.getProperty( "jdo.test.url", "jdbc:hsqldb:mem:" + getName() ) );
-        
-        jdoFactory.setUserName( System.getProperty( "jdo.test.user", "sa" ) ); 
 
-        jdoFactory.setPassword( System.getProperty( "jdo.test.pass", "" ) ); 
+        jdoFactory.setUserName( System.getProperty( "jdo.test.user", "sa" ) );
+
+        jdoFactory.setPassword( System.getProperty( "jdo.test.pass", "" ) );
 
-        jdoFactory.setProperty( "org.jpox.transactionIsolation", "READ_COMMITTED" );  
+        jdoFactory.setProperty( "org.jpox.transactionIsolation", "READ_COMMITTED" );
 
-        jdoFactory.setProperty( "org.jpox.poid.transactionIsolation", "READ_COMMITTED" );  
+        jdoFactory.setProperty( "org.jpox.poid.transactionIsolation", "READ_COMMITTED" );
 
-        jdoFactory.setProperty( "org.jpox.autoCreateSchema", "true" );  
+        jdoFactory.setProperty( "org.jpox.autoCreateSchema", "true" );
 
         jdoFactory.setProperty( "javax.jdo.option.RetainValues", "true" );
 
@@ -99,8 +103,7 @@
             System.setProperty( (String) entry.getKey(), (String) entry.getValue() );
         }
 
-        URL jdoFileUrls[] = new URL[] { getClass()
-            .getResource( "/org/apache/maven/archiva/model/package.jdo" ) }; 
+        URL jdoFileUrls[] = new URL[] { getClass().getResource( "/org/apache/maven/archiva/model/package.jdo" ) };
 
         if ( ( jdoFileUrls == null ) || ( jdoFileUrls[0] == null ) )
         {
@@ -122,5 +125,19 @@
         pm.close();
 
         this.dao = (ArchivaDAO) lookup( ArchivaDAO.class.getName(), "jdo" );
+    }
+
+    protected Date toDate( String txt )
+        throws Exception
+    {
+        SimpleDateFormat sdf = new SimpleDateFormat( TIMESTAMP );
+        return sdf.parse( txt );
+    }
+
+    protected String fromDate( Date date )
+        throws Exception
+    {
+        SimpleDateFormat sdf = new SimpleDateFormat( TIMESTAMP );
+        return sdf.format( date );
     }
 }

Modified: maven/archiva/branches/archiva-jpox-database-refactor/archiva-database/src/test/java/org/apache/maven/archiva/database/constraints/ArtifactsProcessedConstraintTest.java
URL: http://svn.apache.org/viewvc/maven/archiva/branches/archiva-jpox-database-refactor/archiva-database/src/test/java/org/apache/maven/archiva/database/constraints/ArtifactsProcessedConstraintTest.java?view=diff&rev=534044&r1=534043&r2=534044
==============================================================================
--- maven/archiva/branches/archiva-jpox-database-refactor/archiva-database/src/test/java/org/apache/maven/archiva/database/constraints/ArtifactsProcessedConstraintTest.java (original)
+++ maven/archiva/branches/archiva-jpox-database-refactor/archiva-database/src/test/java/org/apache/maven/archiva/database/constraints/ArtifactsProcessedConstraintTest.java Tue May  1 05:46:46 2007
@@ -23,7 +23,6 @@
 import org.apache.maven.archiva.database.ArtifactDAO;
 import org.apache.maven.archiva.model.ArchivaArtifact;
 
-import java.text.SimpleDateFormat;
 import java.util.Date;
 import java.util.Iterator;
 import java.util.List;
@@ -57,13 +56,6 @@
         return artifact;
     }
 
-    private Date toDate( String txt )
-        throws Exception
-    {
-        SimpleDateFormat sdf = new SimpleDateFormat( "yyyy/MM/dd HH:mm:ss" );
-        return sdf.parse( txt );
-    }
-    
     public void assertResults( String type, List results, String expectedArtifacts[] )
     {
         assertNotNull( "Results[" + type + "] should not be null.", results );

Added: maven/archiva/branches/archiva-jpox-database-refactor/archiva-database/src/test/java/org/apache/maven/archiva/database/constraints/MostRecentRepositoryScanStatisticsTest.java
URL: http://svn.apache.org/viewvc/maven/archiva/branches/archiva-jpox-database-refactor/archiva-database/src/test/java/org/apache/maven/archiva/database/constraints/MostRecentRepositoryScanStatisticsTest.java?view=auto&rev=534044
==============================================================================
--- maven/archiva/branches/archiva-jpox-database-refactor/archiva-database/src/test/java/org/apache/maven/archiva/database/constraints/MostRecentRepositoryScanStatisticsTest.java (added)
+++ maven/archiva/branches/archiva-jpox-database-refactor/archiva-database/src/test/java/org/apache/maven/archiva/database/constraints/MostRecentRepositoryScanStatisticsTest.java Tue May  1 05:46:46 2007
@@ -0,0 +1,86 @@
+package org.apache.maven.archiva.database.constraints;
+
+/*
+ * 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.database.AbstractArchivaDatabaseTestCase;
+import org.apache.maven.archiva.model.RepositoryContentStatistics;
+
+import java.util.List;
+
+/**
+ * MostRecentRepositoryScanStatisticsTest 
+ *
+ * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
+ * @version $Id$
+ */
+public class MostRecentRepositoryScanStatisticsTest
+    extends AbstractArchivaDatabaseTestCase
+{
+    private RepositoryContentStatistics createStats( String repoId, String timestamp, long duration, long totalfiles,
+                                                     long newfiles )
+        throws Exception
+    {
+        RepositoryContentStatistics stats = new RepositoryContentStatistics();
+        stats.setRepositoryId( repoId );
+        stats.setDuration( duration );
+        stats.setNewFileCount( newfiles );
+        stats.setTotalFileCount( totalfiles );
+        stats.setWhenGathered( toDate( timestamp ) );
+
+        return stats;
+    }
+
+    protected void setUp()
+        throws Exception
+    {
+        super.setUp();
+
+        dao.save( createStats( "internal", "2007/02/21 10:00:00", 20000, 12000, 400 ) );
+        dao.save( createStats( "internal", "2007/02/20 10:00:00", 20000, 11800, 0 ) );
+        dao.save( createStats( "internal", "2007/02/19 10:00:00", 20000, 11800, 100 ) );
+        dao.save( createStats( "internal", "2007/02/18 10:00:00", 20000, 11700, 320 ) );
+    }
+
+    public void testNotProcessedYet()
+        throws Exception
+    {
+        List results = dao.query( new MostRecentRepositoryScanStatistics( "central" ) );
+        assertNotNull( "Not Processed Yet", results );
+        assertTrue( "Not Processed Yet", results.isEmpty() );
+    }
+
+    public void testStats()
+        throws Exception
+    {
+        List results = dao.query( new MostRecentRepositoryScanStatistics( "internal" ) );
+        assertNotNull( "Stats: results (not null)", results );
+        assertEquals( "Stats: results.size", 1, results.size() );
+
+        Object o = results.get( 0 );
+        assertTrue( "Stats: result[0] instanceof RepositoryScanStatistics", o instanceof RepositoryContentStatistics );
+        RepositoryContentStatistics stats = (RepositoryContentStatistics) o;
+        assertEquals( "Stats: id", "internal", stats.getRepositoryId() );
+        assertEquals( "Stats: when gathered", "2007/02/21 10:00:00", fromDate( stats.getWhenGathered() ) );
+        assertEquals( "Stats: duration", 20000, stats.getDuration() );
+        assertEquals( "Stats: total file count", 12000, stats.getTotalFileCount() );
+        assertEquals( "Stats: new file count", 400, stats.getNewFileCount() );
+    }
+
+}

Propchange: maven/archiva/branches/archiva-jpox-database-refactor/archiva-database/src/test/java/org/apache/maven/archiva/database/constraints/MostRecentRepositoryScanStatisticsTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/archiva/branches/archiva-jpox-database-refactor/archiva-database/src/test/java/org/apache/maven/archiva/database/constraints/MostRecentRepositoryScanStatisticsTest.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: maven/archiva/branches/archiva-jpox-database-refactor/archiva-database/src/test/java/org/apache/maven/archiva/database/constraints/MostRecentRepositoryScanStatisticsTest.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: maven/archiva/branches/archiva-jpox-database-refactor/archiva-scheduled/src/main/java/org/apache/maven/archiva/scheduled/ArchivaTaskQueue.java
URL: http://svn.apache.org/viewvc/maven/archiva/branches/archiva-jpox-database-refactor/archiva-scheduled/src/main/java/org/apache/maven/archiva/scheduled/ArchivaTaskQueue.java?view=diff&rev=534044&r1=534043&r2=534044
==============================================================================
--- maven/archiva/branches/archiva-jpox-database-refactor/archiva-scheduled/src/main/java/org/apache/maven/archiva/scheduled/ArchivaTaskQueue.java (original)
+++ maven/archiva/branches/archiva-jpox-database-refactor/archiva-scheduled/src/main/java/org/apache/maven/archiva/scheduled/ArchivaTaskQueue.java Tue May  1 05:46:46 2007
@@ -19,7 +19,15 @@
  * under the License.
  */
 
+import org.apache.commons.lang.StringUtils;
+import org.apache.maven.archiva.scheduled.tasks.DatabaseTask;
+import org.apache.maven.archiva.scheduled.tasks.RepositoryTask;
 import org.codehaus.plexus.taskqueue.DefaultTaskQueue;
+import org.codehaus.plexus.taskqueue.Task;
+import org.codehaus.plexus.taskqueue.TaskQueueException;
+
+import java.util.Iterator;
+import java.util.List;
 
 /**
  * ArchivaTaskQueue 
@@ -38,5 +46,75 @@
     {
         super();
         /* do nothing special */
+    }
+
+    public boolean hasDatabaseTaskInQueue()
+    {
+        try
+        {
+            List queue = getQueueSnapshot();
+            Iterator it = queue.iterator();
+            while ( it.hasNext() )
+            {
+                Task task = (Task) it.next();
+                if ( task instanceof DatabaseTask )
+                {
+                    return true;
+                }
+            }
+            return false;
+        }
+        catch ( TaskQueueException e )
+        {
+            return false;
+        }
+    }
+
+    public boolean hasFilesystemTaskInQueue()
+    {
+        try
+        {
+            List queue = getQueueSnapshot();
+            Iterator it = queue.iterator();
+            while ( it.hasNext() )
+            {
+                Task task = (Task) it.next();
+                if ( task instanceof RepositoryTask )
+                {
+                    return true;
+                }
+            }
+            return false;
+        }
+        catch ( TaskQueueException e )
+        {
+            return false;
+        }
+    }
+
+    public boolean hasRepositoryTaskInQueue( String repoid )
+    {
+        try
+        {
+            List queue = getQueueSnapshot();
+            Iterator it = queue.iterator();
+            while ( it.hasNext() )
+            {
+                Task task = (Task) it.next();
+                if ( task instanceof RepositoryTask )
+                {
+                    RepositoryTask rtask = (RepositoryTask) task;
+                    if ( StringUtils.equals( repoid, rtask.getRepositoryId() ) )
+                    {
+                        return true;
+                    }
+                }
+            }
+            return false;
+        }
+        catch ( TaskQueueException e )
+        {
+            return false;
+        }
     }
 }

Modified: maven/archiva/branches/archiva-jpox-database-refactor/archiva-scheduled/src/main/java/org/apache/maven/archiva/scheduled/ArchivaTaskScheduler.java
URL: http://svn.apache.org/viewvc/maven/archiva/branches/archiva-jpox-database-refactor/archiva-scheduled/src/main/java/org/apache/maven/archiva/scheduled/ArchivaTaskScheduler.java?view=diff&rev=534044&r1=534043&r2=534044
==============================================================================
--- maven/archiva/branches/archiva-jpox-database-refactor/archiva-scheduled/src/main/java/org/apache/maven/archiva/scheduled/ArchivaTaskScheduler.java (original)
+++ maven/archiva/branches/archiva-jpox-database-refactor/archiva-scheduled/src/main/java/org/apache/maven/archiva/scheduled/ArchivaTaskScheduler.java Tue May  1 05:46:46 2007
@@ -32,11 +32,15 @@
      * The Plexus component role.
      */
     public final static String ROLE = ArchivaTaskScheduler.class.getName();
+    
+    public ArchivaTaskQueue getTaskQueue();
 
-    public void runDatabaseTasks() throws TaskExecutionException;
+    public void scheduleAllRepositoryTasks()
+        throws TaskExecutionException;
 
-    public void runAllRepositoryTasks() throws TaskExecutionException;
-    
-    public void runRepositoryTasks( String repositoryId ) throws TaskExecutionException;
-    
-} 
+    public void scheduleDatabaseTasks()
+        throws TaskExecutionException;
+
+    public void scheduleRepositoryTask( String repositoryId )
+        throws TaskExecutionException;
+}

Modified: maven/archiva/branches/archiva-jpox-database-refactor/archiva-scheduled/src/main/java/org/apache/maven/archiva/scheduled/DefaultArchivaTaskScheduler.java
URL: http://svn.apache.org/viewvc/maven/archiva/branches/archiva-jpox-database-refactor/archiva-scheduled/src/main/java/org/apache/maven/archiva/scheduled/DefaultArchivaTaskScheduler.java?view=diff&rev=534044&r1=534043&r2=534044
==============================================================================
--- maven/archiva/branches/archiva-jpox-database-refactor/archiva-scheduled/src/main/java/org/apache/maven/archiva/scheduled/DefaultArchivaTaskScheduler.java (original)
+++ maven/archiva/branches/archiva-jpox-database-refactor/archiva-scheduled/src/main/java/org/apache/maven/archiva/scheduled/DefaultArchivaTaskScheduler.java Tue May  1 05:46:46 2007
@@ -20,12 +20,8 @@
  */
 
 import org.apache.maven.archiva.configuration.ArchivaConfiguration;
-import org.apache.maven.archiva.configuration.Configuration;
 import org.apache.maven.archiva.configuration.RepositoryConfiguration;
-import org.apache.maven.archiva.database.ArchivaDatabaseException;
-import org.apache.maven.archiva.database.ObjectNotFoundException;
-import org.apache.maven.archiva.database.RepositoryDAO;
-import org.apache.maven.archiva.model.ArchivaRepository;
+import org.apache.maven.archiva.scheduled.tasks.ArchivaTask;
 import org.codehaus.plexus.logging.AbstractLogEnabled;
 import org.codehaus.plexus.personality.plexus.lifecycle.phase.Startable;
 import org.codehaus.plexus.personality.plexus.lifecycle.phase.StartingException;
@@ -34,7 +30,6 @@
 import org.codehaus.plexus.registry.RegistryListener;
 import org.codehaus.plexus.scheduler.Scheduler;
 import org.codehaus.plexus.taskqueue.TaskQueue;
-import org.codehaus.plexus.taskqueue.TaskQueueException;
 import org.codehaus.plexus.taskqueue.execution.TaskExecutionException;
 import org.quartz.CronTrigger;
 import org.quartz.JobDataMap;
@@ -73,12 +68,12 @@
     private ArchivaConfiguration archivaConfiguration;
   
     
-    public static final String DATABASE_DISCOVERER_GROUP = "database-group";
+    public static final String DATABASE_SCAN_GROUP = "database-group";
     
     public static final String DATABASE_JOB = "database-job";
     public static final String DATABASE_JOB_TRIGGER = "database-job-trigger";
    
-    public static final String REPOSITORY_DISCOVERER_GROUP = "repository-group";
+    public static final String REPOSITORY_SCAN_GROUP = "repository-group";
     
     public static final String REPOSITORY_JOB = "repository-job";
     public static final String REPOSITORY_JOB_TRIGGER = "repository-job-trigger";
@@ -119,17 +114,18 @@
         
         // setup the unprocessed artifact job
         JobDetail repositoryJob =
-            new JobDetail( REPOSITORY_JOB + ":" + repoConfig.getId() , REPOSITORY_DISCOVERER_GROUP, RepositoryTaskJob.class );
+            new JobDetail( REPOSITORY_JOB + ":" + repoConfig.getId() , REPOSITORY_SCAN_GROUP, RepositoryTaskJob.class );
 
         JobDataMap dataMap = new JobDataMap();
         dataMap.put( RepositoryTaskJob.TASK_QUEUE, archivaTaskQueue );
+        dataMap.put( RepositoryTaskJob.TASK_QUEUE_POLICY, ArchivaTask.QUEUE_POLICY_WAIT );
         dataMap.put( RepositoryTaskJob.TASK_REPOSITORY, repoConfig.getId() );
         repositoryJob.setJobDataMap( dataMap );
        
         try 
         {
             CronTrigger trigger =
-                new CronTrigger( REPOSITORY_JOB_TRIGGER + ":" + repoConfig.getId() , REPOSITORY_DISCOVERER_GROUP, cronString );
+                new CronTrigger( REPOSITORY_JOB_TRIGGER + ":" + repoConfig.getId() , REPOSITORY_SCAN_GROUP, cronString );
         
             scheduler.scheduleJob( repositoryJob, trigger );
         }
@@ -147,7 +143,7 @@
         
         // setup the unprocessed artifact job
         JobDetail databaseJob =
-            new JobDetail( DATABASE_JOB, DATABASE_DISCOVERER_GROUP, DatabaseTaskJob.class );
+            new JobDetail( DATABASE_JOB, DATABASE_SCAN_GROUP, DatabaseTaskJob.class );
 
         JobDataMap dataMap = new JobDataMap();
         dataMap.put( DatabaseTaskJob.TASK_QUEUE, archivaTaskQueue );
@@ -156,7 +152,7 @@
         try 
         {
             CronTrigger trigger =
-                new CronTrigger( DATABASE_JOB_TRIGGER, DATABASE_DISCOVERER_GROUP, cronString );
+                new CronTrigger( DATABASE_JOB_TRIGGER, DATABASE_SCAN_GROUP, cronString );
         
             scheduler.scheduleJob( databaseJob, trigger );
         }
@@ -172,7 +168,7 @@
     {
         try
         {
-            scheduler.unscheduleJob( DATABASE_JOB, DATABASE_DISCOVERER_GROUP );         
+            scheduler.unscheduleJob( DATABASE_JOB, DATABASE_SCAN_GROUP );         
         }
         catch ( SchedulerException e )
         {
@@ -198,7 +194,7 @@
             
             try
             {
-                scheduler.unscheduleJob( DATABASE_JOB, DATABASE_DISCOVERER_GROUP );
+                scheduler.unscheduleJob( DATABASE_JOB, DATABASE_SCAN_GROUP );
             
                 scheduleDatabaseJobs();
             }
@@ -224,7 +220,7 @@
                     try
                     {
                         // unschedule handles jobs that might not exist
-                        scheduler.unscheduleJob( REPOSITORY_JOB + ":" + repoConfig.getId() , REPOSITORY_DISCOVERER_GROUP );
+                        scheduler.unscheduleJob( REPOSITORY_JOB + ":" + repoConfig.getId() , REPOSITORY_SCAN_GROUP );
                         scheduleRepositoryJobs( repoConfig );
                     }
                     catch ( SchedulerException e )
@@ -236,7 +232,7 @@
         }
     }
 
-    public void runAllRepositoryTasks() throws TaskExecutionException
+    public void scheduleAllRepositoryTasks() throws TaskExecutionException
     {
         try
         {
@@ -256,7 +252,7 @@
         }
     }
 
-    public void runDatabaseTasks() throws TaskExecutionException
+    public void scheduleDatabaseTasks() throws TaskExecutionException
     {
         try
         {
@@ -269,7 +265,7 @@
         }
     }
 
-    public void runRepositoryTasks( String repositoryId ) throws TaskExecutionException
+    public void scheduleRepositoryTask( String repositoryId ) throws TaskExecutionException
     {
         try
         {
@@ -282,7 +278,9 @@
             throw new TaskExecutionException( "Unable to schedule repository jobs: " + e.getMessage(), e );
         } 
     }
-
-    
     
+    public ArchivaTaskQueue getTaskQueue()
+    {
+        return (ArchivaTaskQueue) archivaTaskQueue;
+    }
 }

Added: maven/archiva/branches/archiva-jpox-database-refactor/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/AbstractRepositoryAction.java
URL: http://svn.apache.org/viewvc/maven/archiva/branches/archiva-jpox-database-refactor/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/AbstractRepositoryAction.java?view=auto&rev=534044
==============================================================================
--- maven/archiva/branches/archiva-jpox-database-refactor/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/AbstractRepositoryAction.java (added)
+++ maven/archiva/branches/archiva-jpox-database-refactor/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/AbstractRepositoryAction.java Tue May  1 05:46:46 2007
@@ -0,0 +1,208 @@
+package org.apache.maven.archiva.web.action.admin;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import com.opensymphony.xwork.ActionContext;
+import com.opensymphony.xwork.ModelDriven;
+import com.opensymphony.xwork.Preparable;
+
+import org.apache.maven.archiva.configuration.ArchivaConfiguration;
+import org.apache.maven.archiva.configuration.InvalidConfigurationException;
+import org.apache.maven.archiva.configuration.RepositoryConfiguration;
+import org.apache.maven.archiva.security.ArchivaRoleConstants;
+import org.apache.maven.archiva.web.action.admin.models.AdminRepositoryConfiguration;
+import org.codehaus.plexus.rbac.profile.RoleProfileException;
+import org.codehaus.plexus.rbac.profile.RoleProfileManager;
+import org.codehaus.plexus.registry.RegistryException;
+import org.codehaus.plexus.security.authorization.AuthorizationException;
+import org.codehaus.plexus.security.authorization.AuthorizationResult;
+import org.codehaus.plexus.security.rbac.RbacManagerException;
+import org.codehaus.plexus.security.rbac.Resource;
+import org.codehaus.plexus.security.system.SecuritySession;
+import org.codehaus.plexus.security.system.SecuritySystem;
+import org.codehaus.plexus.security.ui.web.interceptor.SecureAction;
+import org.codehaus.plexus.security.ui.web.interceptor.SecureActionBundle;
+import org.codehaus.plexus.security.ui.web.interceptor.SecureActionException;
+import org.codehaus.plexus.xwork.action.PlexusActionSupport;
+
+import java.io.File;
+import java.io.IOException;
+
+/**
+ * AbstractRepositoryAction 
+ *
+ * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
+ * @version $Id$
+ */
+public abstract class AbstractRepositoryAction
+    extends PlexusActionSupport
+    implements ModelDriven, Preparable, SecureAction
+{
+    protected static final String SUCCESS = "success";
+
+    /**
+     * @plexus.requirement role-hint="archiva"
+     */
+    private RoleProfileManager roleProfileManager;
+
+    /**
+     * @plexus.requirement
+     */
+    private SecuritySystem securitySystem;
+
+    private String repoid;
+
+    private String mode;
+
+    /**
+     * @plexus.requirement
+     */
+    protected ArchivaConfiguration archivaConfiguration;
+
+    /**
+     * The model for this action.
+     */
+    protected AdminRepositoryConfiguration repository;
+
+    public String getMode()
+    {
+        return this.mode;
+    }
+
+    public Object getModel()
+    {
+        return getRepository();
+    }
+
+    public String getRepoid()
+    {
+        return repoid;
+    }
+
+    public SecureActionBundle getSecureActionBundle()
+        throws SecureActionException
+    {
+        SecureActionBundle bundle = new SecureActionBundle();
+
+        bundle.setRequiresAuthentication( true );
+        bundle.addRequiredAuthorization( ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION, Resource.GLOBAL );
+
+        return bundle;
+    }
+
+    public String input()
+    {
+        getLogger().info( "input()" );
+        return INPUT;
+    }
+
+    public abstract void prepare()
+        throws Exception;
+
+    public void setMode( String mode )
+    {
+        this.mode = mode;
+    }
+
+    public void setRepoid( String repoid )
+    {
+        this.repoid = repoid;
+    }
+
+    protected void addRepository( AdminRepositoryConfiguration repository )
+        throws IOException, RoleProfileException
+    {
+        getLogger().info( ".addRepository(" + repository + ")" );
+
+        if ( repository.isManaged() )
+        {
+            // Normalize the path
+            File file = new File( repository.getDirectory() );
+            repository.setDirectory( file.getCanonicalPath() );
+            if ( !file.exists() )
+            {
+                file.mkdirs();
+                // TODO: error handling when this fails, or is not a directory!
+            }
+        }
+
+        archivaConfiguration.getConfiguration().addRepository( repository );
+
+        // TODO: double check these are configured on start up
+        roleProfileManager.getDynamicRole( "archiva-repository-manager", repository.getId() );
+
+        roleProfileManager.getDynamicRole( "archiva-repository-observer", repository.getId() );
+    }
+
+    protected AdminRepositoryConfiguration getRepository()
+    {
+        if ( repository == null )
+        {
+            repository = new AdminRepositoryConfiguration();
+        }
+
+        return repository;
+    }
+
+    protected boolean operationAllowed( String permission, String repoid )
+    {
+        ActionContext context = ActionContext.getContext();
+        SecuritySession securitySession = (SecuritySession) context.get( SecuritySession.ROLE );
+
+        AuthorizationResult authzResult;
+        try
+        {
+            authzResult = securitySystem.authorize( securitySession, permission, repoid );
+
+            return authzResult.isAuthorized();
+        }
+        catch ( AuthorizationException e )
+        {
+            getLogger().info(
+                              "Unable to authorize permission: " + permission + " against repo: " + repoid
+                                  + " due to: " + e.getMessage() );
+            return false;
+        }
+    }
+
+    protected void removeRepository( String repoId )
+    {
+        getLogger().info( ".removeRepository()" );
+
+        RepositoryConfiguration toremove = archivaConfiguration.getConfiguration().findRepositoryById( repoId );
+        if ( toremove != null )
+        {
+            archivaConfiguration.getConfiguration().removeRepository( toremove );
+        }
+    }
+
+    protected String saveConfiguration()
+        throws IOException, InvalidConfigurationException, RbacManagerException, RoleProfileException,
+        RegistryException
+    {
+        getLogger().info( ".saveConfiguration()" );
+
+        archivaConfiguration.save( archivaConfiguration.getConfiguration() );
+
+        addActionMessage( "Successfully saved configuration" );
+
+        return SUCCESS;
+    }
+}

Propchange: maven/archiva/branches/archiva-jpox-database-refactor/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/AbstractRepositoryAction.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/archiva/branches/archiva-jpox-database-refactor/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/AbstractRepositoryAction.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: maven/archiva/branches/archiva-jpox-database-refactor/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/AbstractRepositoryAction.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: maven/archiva/branches/archiva-jpox-database-refactor/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/ConfigureAction.java
URL: http://svn.apache.org/viewvc/maven/archiva/branches/archiva-jpox-database-refactor/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/ConfigureAction.java?view=diff&rev=534044&r1=534043&r2=534044
==============================================================================
--- maven/archiva/branches/archiva-jpox-database-refactor/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/ConfigureAction.java (original)
+++ maven/archiva/branches/archiva-jpox-database-refactor/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/ConfigureAction.java Tue May  1 05:46:46 2007
@@ -60,6 +60,7 @@
     
     public void validate()
     {
+        getLogger().info( "validate()" );
         //validate cron expression
     }
 
@@ -67,6 +68,7 @@
         throws IOException, RepositoryIndexException, RepositoryIndexSearchException, InvalidConfigurationException,
         RegistryException
     {
+        getLogger().info( "execute()" );
         // TODO: if this didn't come from the form, go to configure.action instead of going through with re-saving what was just loaded
         // TODO: if this is changed, do we move the index or recreate it?
 

Modified: maven/archiva/branches/archiva-jpox-database-refactor/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/ConfigureRepositoryAction.java
URL: http://svn.apache.org/viewvc/maven/archiva/branches/archiva-jpox-database-refactor/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/ConfigureRepositoryAction.java?view=diff&rev=534044&r1=534043&r2=534044
==============================================================================
--- maven/archiva/branches/archiva-jpox-database-refactor/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/ConfigureRepositoryAction.java (original)
+++ maven/archiva/branches/archiva-jpox-database-refactor/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/ConfigureRepositoryAction.java Tue May  1 05:46:46 2007
@@ -19,9 +19,25 @@
  * under the License.
  */
 
-//import org.apache.maven.archiva.configuration.AbstractRepositoryConfiguration;
+import com.opensymphony.xwork.ModelDriven;
+import com.opensymphony.xwork.Preparable;
+
+import org.apache.commons.lang.StringUtils;
+import org.apache.maven.archiva.configuration.ArchivaConfiguration;
+import org.apache.maven.archiva.configuration.Configuration;
+import org.apache.maven.archiva.configuration.InvalidConfigurationException;
 import org.apache.maven.archiva.configuration.RepositoryConfiguration;
+import org.apache.maven.archiva.security.ArchivaRoleConstants;
+import org.apache.maven.archiva.web.action.admin.models.AdminRepositoryConfiguration;
 import org.codehaus.plexus.rbac.profile.RoleProfileException;
+import org.codehaus.plexus.rbac.profile.RoleProfileManager;
+import org.codehaus.plexus.registry.RegistryException;
+import org.codehaus.plexus.security.rbac.RbacManagerException;
+import org.codehaus.plexus.security.rbac.Resource;
+import org.codehaus.plexus.security.ui.web.interceptor.SecureAction;
+import org.codehaus.plexus.security.ui.web.interceptor.SecureActionBundle;
+import org.codehaus.plexus.security.ui.web.interceptor.SecureActionException;
+import org.codehaus.plexus.xwork.action.PlexusActionSupport;
 
 import java.io.File;
 import java.io.IOException;
@@ -32,44 +48,244 @@
  * @plexus.component role="com.opensymphony.xwork.Action" role-hint="configureRepositoryAction"
  */
 public class ConfigureRepositoryAction
-    extends AbstractConfigureRepositoryAction
+    extends PlexusActionSupport
+    implements ModelDriven, Preparable, SecureAction
 {
-//    protected void removeRepository( AbstractRepositoryConfiguration existingRepository )
-//    {
-//        configuration.removeRepository( (RepositoryConfiguration) existingRepository );
-//    }
-//
-//    protected AbstractRepositoryConfiguration getRepository( String id )
-//    {
-//        return configuration.getRepositoryById( id );
-//    }
+    /**
+     * @plexus.requirement
+     */
+    private ArchivaConfiguration archivaConfiguration;
+
+    /**
+     * @plexus.requirement role-hint="archiva"
+     */
+    private RoleProfileManager roleProfileManager;
+
+    /**
+     * The repository.
+     */
+    private AdminRepositoryConfiguration repository;
+
+    /**
+     * The repository ID to lookup when editing a repository.
+     */
+    private String repoId;
+
+    /**
+     * The previously read configuration.
+     */
+    private Configuration configuration;
+
+    public String add()
+        throws IOException, InvalidConfigurationException, RbacManagerException, RoleProfileException,
+        RegistryException
+    {
+        // TODO: if this didn't come from the form, go to configure.action instead of going through with re-saving what was just loaded
+        getLogger().info( ".add()" );
+
+        AdminRepositoryConfiguration existingRepository = getRepository( repository.getId() );
+        if ( existingRepository != null )
+        {
+            addFieldError( "id", "A repository with that id already exists" );
+            return INPUT;
+        }
+
+        return saveConfiguration();
+    }
+
+    public String edit()
+        throws IOException, InvalidConfigurationException, RbacManagerException, RoleProfileException,
+        RegistryException
+    {
+        // TODO: if this didn't come from the form, go to configure.action instead of going through with re-saving what was just loaded
+        getLogger().info( ".edit()" );
+
+        if ( StringUtils.isBlank( repository.getId() ) )
+        {
+            addFieldError( "id", "A repository with a blank id cannot be editted." );
+            return INPUT;
+        }
+
+        removeRepository( getRepository() );
+
+        addRepository();
+
+        return saveConfiguration();
+    }
+
+    public Configuration getConfiguration()
+    {
+        return configuration;
+    }
+
+    public Object getModel()
+    {
+        getLogger().info( ".getModel()" );
+        if( repository == null )
+        {
+            repository = createRepository();
+        }
+        
+        return repository;
+    }
+
+    public String getRepoId()
+    {
+        return repoId;
+    }
+
+    public SecureActionBundle getSecureActionBundle()
+        throws SecureActionException
+    {
+        SecureActionBundle bundle = new SecureActionBundle();
+
+        bundle.setRequiresAuthentication( true );
 
-    protected void addRepository()
+        if ( getRepoId() != null )
+        {
+            // TODO: this is not right. It needs to change based on method. But is this really the right way to restrict this area?
+            // TODO: not right. We only care about this permission on managed repositories. Otherwise, it's configuration
+            bundle.addRequiredAuthorization( ArchivaRoleConstants.OPERATION_EDIT_REPOSITORY, getRepoId() );
+        }
+        else
+        {
+            bundle.addRequiredAuthorization( ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION, Resource.GLOBAL );
+        }
+
+        return bundle;
+    }
+
+    public String input()
+    {
+        getLogger().info( ".input()" );
+        return INPUT;
+    }
+    
+    public String doDefault()
+        throws Exception
+    {
+        getLogger().info( ".doDefault()" );
+        return super.doDefault();
+    }
+    
+    public String doInput()
+        throws Exception
+    {
+        getLogger().info( ".doInput()" );
+        return super.doInput();
+    }
+    
+    public void validate()
+    {
+        getLogger().info( ".validate()" );
+        // super.validate();
+    }
+    
+    public String execute()
+        throws Exception
+    {
+        getLogger().info( ".execute()" );
+        return super.execute();
+    }
+
+    public void prepare()
+    {
+        getLogger().info( ".prepare()" );
+        configuration = archivaConfiguration.getConfiguration();
+
+        if ( repository == null )
+        {
+            repository = getRepository( repoId );
+        }
+        if ( repository == null )
+        {
+            repository = createRepository();
+        }
+    }
+
+    public void setRepoId( String repoId )
+    {
+        this.repoId = repoId;
+    }
+    
+    private void addRepository()
         throws IOException, RoleProfileException
     {
-//        RepositoryConfiguration repository = (RepositoryConfiguration) getRepository();
-//
-//        // Normalize the path
-//        File file = new File( repository.getDirectory() );
-//        repository.setDirectory( file.getCanonicalPath() );
-//        if ( !file.exists() )
-//        {
-//            file.mkdirs();
-//            // TODO: error handling when this fails, or is not a directory!
-//        }
-//
-//        configuration.addRepository( repository );
-//
-//        // TODO: double check these are configured on start up
-//        roleProfileManager.getDynamicRole( "archiva-repository-manager", repository.getId() );
-//
-//        roleProfileManager.getDynamicRole( "archiva-repository-observer", repository.getId() );
-    }
-
-//    protected AbstractRepositoryConfiguration createRepository()
-//    {
-//        RepositoryConfiguration repository = new RepositoryConfiguration();
-//        repository.setIndexed( false );
-//        return repository;
-//    }
+        getLogger().info( ".addRepository()" );
+        AdminRepositoryConfiguration repository = (AdminRepositoryConfiguration) getRepository();
+
+        if ( repository.isManaged() )
+        {
+            // Normalize the path
+            File file = new File( repository.getDirectory() );
+            repository.setDirectory( file.getCanonicalPath() );
+            if ( !file.exists() )
+            {
+                file.mkdirs();
+                // TODO: error handling when this fails, or is not a directory!
+            }
+        }
+
+        configuration.addRepository( repository );
+
+        // TODO: double check these are configured on start up
+        roleProfileManager.getDynamicRole( "archiva-repository-manager", repository.getId() );
+
+        roleProfileManager.getDynamicRole( "archiva-repository-observer", repository.getId() );
+    }
+
+    private AdminRepositoryConfiguration createRepository()
+    {
+        getLogger().info( ".createRepository()" );
+        AdminRepositoryConfiguration repository = new AdminRepositoryConfiguration();
+        repository.setIndexed( false );
+        return repository;
+    }
+
+    private AdminRepositoryConfiguration getRepository()
+    {
+        return repository;
+    }
+
+    private AdminRepositoryConfiguration getRepository( String id )
+    {
+        getLogger().info( ".getRepository(" + id + ")" );
+
+        RepositoryConfiguration repoconfig = configuration.findRepositoryById( id );
+        if ( repoconfig == null )
+        {
+            return createRepository();
+        }
+        return new AdminRepositoryConfiguration( repoconfig );
+    }
+
+    private boolean removeRepository( RepositoryConfiguration existingRepository )
+    {
+        getLogger().info( ".removeRepository()" );
+
+        RepositoryConfiguration toremove = configuration.findRepositoryById( existingRepository.getId() );
+        if ( toremove != null )
+        {
+            configuration.removeRepository( toremove );
+            return true;
+        }
+        
+        return false;
+    }
+
+    private String saveConfiguration()
+        throws IOException, InvalidConfigurationException, RbacManagerException, RoleProfileException,
+        RegistryException
+    {
+        getLogger().info( ".saveConfiguration()" );
+        addRepository();
+
+        archivaConfiguration.save( configuration );
+
+        // TODO: do we need to check if indexing is needed?
+
+        addActionMessage( "Successfully saved configuration" );
+
+        return SUCCESS;
+    }
 }

Added: maven/archiva/branches/archiva-jpox-database-refactor/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/EditRepositoryAction.java
URL: http://svn.apache.org/viewvc/maven/archiva/branches/archiva-jpox-database-refactor/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/EditRepositoryAction.java?view=auto&rev=534044
==============================================================================
--- maven/archiva/branches/archiva-jpox-database-refactor/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/EditRepositoryAction.java (added)
+++ maven/archiva/branches/archiva-jpox-database-refactor/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/EditRepositoryAction.java Tue May  1 05:46:46 2007
@@ -0,0 +1,71 @@
+package org.apache.maven.archiva.web.action.admin;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.maven.archiva.configuration.RepositoryConfiguration;
+import org.apache.maven.archiva.security.ArchivaRoleConstants;
+import org.apache.maven.archiva.web.action.admin.models.AdminRepositoryConfiguration;
+
+/**
+ * EditRepositoryAction 
+ *
+ * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
+ * @version $Id$
+ * 
+ * @plexus.component role="com.opensymphony.xwork.Action" role-hint="editRepositoryAction"
+ */
+public class EditRepositoryAction
+    extends AbstractRepositoryAction
+{
+    public String edit()
+    {
+        getLogger().info( ".edit()" );
+
+        if ( operationAllowed( ArchivaRoleConstants.OPERATION_EDIT_REPOSITORY, getRepoid() ) )
+        {
+            addActionError( "You do not have the appropriate permissions to edit the " + getRepoid() + " repository." );
+            return ERROR;
+        }
+
+        return INPUT;
+    }
+
+    public void prepare()
+        throws Exception
+    {
+        String id = getRepoid();
+        if ( id == null )
+        {
+            // TODO: Throw error?
+            return;
+        }
+
+        RepositoryConfiguration repoconfig = archivaConfiguration.getConfiguration().findRepositoryById( id );
+        if ( repoconfig != null )
+        {
+            this.repository = new AdminRepositoryConfiguration( repoconfig );
+        }
+    }
+
+    public String getMode()
+    {
+        return "edit";
+    }
+}

Propchange: maven/archiva/branches/archiva-jpox-database-refactor/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/EditRepositoryAction.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/archiva/branches/archiva-jpox-database-refactor/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/EditRepositoryAction.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: maven/archiva/branches/archiva-jpox-database-refactor/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/EditRepositoryAction.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Copied: maven/archiva/branches/archiva-jpox-database-refactor/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/IndexRepositoryAction.java (from r533137, maven/archiva/branches/archiva-jpox-database-refactor/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/RunRepositoryTaskAction.java)
URL: http://svn.apache.org/viewvc/maven/archiva/branches/archiva-jpox-database-refactor/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/IndexRepositoryAction.java?view=diff&rev=534044&p1=maven/archiva/branches/archiva-jpox-database-refactor/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/RunRepositoryTaskAction.java&r1=533137&p2=maven/archiva/branches/archiva-jpox-database-refactor/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/IndexRepositoryAction.java&r2=534044
==============================================================================
--- maven/archiva/branches/archiva-jpox-database-refactor/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/RunRepositoryTaskAction.java (original)
+++ maven/archiva/branches/archiva-jpox-database-refactor/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/IndexRepositoryAction.java Tue May  1 05:46:46 2007
@@ -19,33 +19,81 @@
  * under the License.
  */
 
-//import org.apache.maven.archiva.scheduler.RepositoryTaskScheduler;
+import org.apache.commons.lang.StringUtils;
+import org.apache.maven.archiva.scheduled.ArchivaTaskScheduler;
+import org.apache.maven.archiva.scheduled.DefaultArchivaTaskScheduler;
+import org.apache.maven.archiva.scheduled.tasks.ArchivaTask;
+import org.apache.maven.archiva.scheduled.tasks.RepositoryTask;
 import org.apache.maven.archiva.security.ArchivaRoleConstants;
 import org.codehaus.plexus.security.rbac.Resource;
 import org.codehaus.plexus.security.ui.web.interceptor.SecureAction;
 import org.codehaus.plexus.security.ui.web.interceptor.SecureActionBundle;
 import org.codehaus.plexus.security.ui.web.interceptor.SecureActionException;
-//import org.codehaus.plexus.taskqueue.execution.TaskExecutionException;
+import org.codehaus.plexus.taskqueue.TaskQueueException;
 import org.codehaus.plexus.xwork.action.PlexusActionSupport;
 
 /**
  * Configures the application.
  *
- * @plexus.component role="com.opensymphony.xwork.Action" role-hint="runRepositoryTaskAction"
+ * @plexus.component role="com.opensymphony.xwork.Action" role-hint="indexRepositoryAction"
  */
-public class RunRepositoryTaskAction
+public class IndexRepositoryAction
     extends PlexusActionSupport
     implements SecureAction
 {
-//    /**
-//     * @plexus.requirement
-//     */
-//    private RepositoryTaskScheduler taskScheduler;
+    /**
+     * @plexus.requirement
+     */
+    private ArchivaTaskScheduler taskScheduler;
 
-    public String runRefresh()
+    private String repoid;
+
+    public String run()
     {
-//        taskScheduler.runDataRefresh();
+        if ( StringUtils.isBlank( repoid ) )
+        {
+            addActionError( "Cannot run indexer on blank repository id." );
+            return SUCCESS;
+        }
+
+        RepositoryTask task = new RepositoryTask();
+        task.setRepositoryId( repoid );
+        task.setName( DefaultArchivaTaskScheduler.REPOSITORY_JOB + ":" + repoid );
+        task.setQueuePolicy( ArchivaTask.QUEUE_POLICY_WAIT );
+
+        boolean scheduleTask = false;
+
+        if ( taskScheduler.getTaskQueue().hasFilesystemTaskInQueue() )
+        {
+            if ( taskScheduler.getTaskQueue().hasRepositoryTaskInQueue( repoid ) )
+            {
+                addActionError( "Repository [" + repoid + "] task was already queued." );
+            }
+            else
+            {
+                scheduleTask = true;
+            }
+        }
+        else
+        {
+            scheduleTask = true;
+        }
+
+        if ( scheduleTask )
+        {
+            try
+            {
+                taskScheduler.getTaskQueue().put( task );
+                addActionMessage( "Your request to have repository [" + repoid + "] be indexed has been queued." );
+            }
+            catch ( TaskQueueException e )
+            {
+                addActionError( "Unable to queue your request to have repository [" + repoid + "] be indexed: "
+                    + e.getMessage() );
+            }
+        }
 
+        // Return to the repositories screen.
         return SUCCESS;
     }
 
@@ -58,5 +106,15 @@
         bundle.addRequiredAuthorization( ArchivaRoleConstants.OPERATION_RUN_INDEXER, Resource.GLOBAL );
 
         return bundle;
+    }
+
+    public String getRepoid()
+    {
+        return repoid;
+    }
+
+    public void setRepoid( String repoid )
+    {
+        this.repoid = repoid;
     }
 }

Modified: maven/archiva/branches/archiva-jpox-database-refactor/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/RepositoriesAction.java
URL: http://svn.apache.org/viewvc/maven/archiva/branches/archiva-jpox-database-refactor/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/RepositoriesAction.java?view=diff&rev=534044&r1=534043&r2=534044
==============================================================================
--- maven/archiva/branches/archiva-jpox-database-refactor/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/RepositoriesAction.java (original)
+++ maven/archiva/branches/archiva-jpox-database-refactor/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/RepositoriesAction.java Tue May  1 05:46:46 2007
@@ -26,13 +26,21 @@
 
 import org.apache.maven.archiva.configuration.ArchivaConfiguration;
 import org.apache.maven.archiva.database.ArchivaDAO;
+import org.apache.maven.archiva.database.constraints.MostRecentRepositoryScanStatistics;
+import org.apache.maven.archiva.model.RepositoryContentStatistics;
 import org.apache.maven.archiva.security.ArchivaRoleConstants;
+import org.apache.maven.archiva.web.action.admin.models.AdminModel;
+import org.apache.maven.archiva.web.action.admin.models.AdminRepositoryConfiguration;
+import org.apache.maven.archiva.web.util.ContextUtils;
 import org.codehaus.plexus.security.rbac.Resource;
 import org.codehaus.plexus.security.ui.web.interceptor.SecureAction;
 import org.codehaus.plexus.security.ui.web.interceptor.SecureActionBundle;
 import org.codehaus.plexus.security.ui.web.interceptor.SecureActionException;
 import org.codehaus.plexus.xwork.action.PlexusActionSupport;
 
+import java.util.Iterator;
+import java.util.List;
+
 import javax.servlet.http.HttpServletRequest;
 
 /**
@@ -48,28 +56,29 @@
     implements ModelDriven, Preparable, Validateable, SecureAction, ServletRequestAware
 {
     /**
-     * @plexus.requirement
-     */
-    private ArchivaConfiguration archivaConfiguration;
-
-    /**
      * @plexus.requirement role-hint="jdo"
      */
     private ArchivaDAO dao;
 
-    private HttpServletRequest request;
+    /**
+     * @plexus.requirement
+     */
+    private ArchivaConfiguration archivaConfiguration;
 
     private AdminModel model;
 
+    private String baseUrl;
+
     public Object getModel()
     {
-        return model;
+        return getAdminModel();
     }
 
     public void prepare()
         throws Exception
     {
-        model = new AdminModel( archivaConfiguration.getConfiguration() );
+        model = null;
+        getModel();
     }
 
     public void validate()
@@ -77,6 +86,13 @@
         super.validate();
     }
 
+    public String execute()
+        throws Exception
+    {
+        getLogger().info( ".execute()" );
+        return super.execute();
+    }
+
     public SecureActionBundle getSecureActionBundle()
         throws SecureActionException
     {
@@ -90,22 +106,44 @@
 
     public void setServletRequest( HttpServletRequest request )
     {
-        this.request = request;
-        StringBuffer baseUrl = new StringBuffer();
+        this.baseUrl = ContextUtils.getBaseURL( request, "repository" );
+    }
 
-        baseUrl.append( request.getScheme() );
-        baseUrl.append( request.getServerName() );
-        int portnum = request.getServerPort();
-
-        // Only add port if non-standard.
-        if ( ( "https".equalsIgnoreCase( request.getScheme() ) && ( portnum != 443 ) )
-            || ( "http".equalsIgnoreCase( request.getScheme() ) && ( portnum != 80 ) ) )
+    public AdminModel getAdminModel()
+    {
+        if ( model == null )
         {
-            baseUrl.append( ":" ).append( String.valueOf( portnum ) );
+            model = new AdminModel( archivaConfiguration.getConfiguration() );
+            model.setBaseUrl( baseUrl );
+            updateLastIndexed( model.getManagedRepositories() );
         }
-        baseUrl.append( request.getContextPath() );
-        baseUrl.append( "/repository" );
 
-        model.setBaseUrl( baseUrl.toString() );
+        return model;
+    }
+
+    private void updateLastIndexed( List managedRepositories )
+    {
+        Iterator it = managedRepositories.iterator();
+        while ( it.hasNext() )
+        {
+            AdminRepositoryConfiguration config = (AdminRepositoryConfiguration) it.next();
+
+            List results = dao.query( new MostRecentRepositoryScanStatistics( config.getId() ) );
+            if ( !results.isEmpty() )
+            {
+                RepositoryContentStatistics stats = (RepositoryContentStatistics) results.get( 0 );
+                config.setStats( stats );
+            }
+        }
+    }
+
+    public String getBaseUrlB()
+    {
+        return baseUrl;
+    }
+
+    public void setBaseUrlB( String baseUrl )
+    {
+        this.baseUrl = baseUrl;
     }
 }

Added: maven/archiva/branches/archiva-jpox-database-refactor/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/SaveRepositoryAction.java
URL: http://svn.apache.org/viewvc/maven/archiva/branches/archiva-jpox-database-refactor/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/SaveRepositoryAction.java?view=auto&rev=534044
==============================================================================
--- maven/archiva/branches/archiva-jpox-database-refactor/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/SaveRepositoryAction.java (added)
+++ maven/archiva/branches/archiva-jpox-database-refactor/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/SaveRepositoryAction.java Tue May  1 05:46:46 2007
@@ -0,0 +1,93 @@
+package org.apache.maven.archiva.web.action.admin;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.commons.lang.StringUtils;
+import org.apache.maven.archiva.configuration.InvalidConfigurationException;
+import org.codehaus.plexus.rbac.profile.RoleProfileException;
+import org.codehaus.plexus.registry.RegistryException;
+import org.codehaus.plexus.security.rbac.RbacManagerException;
+
+import java.io.IOException;
+
+/**
+ * SaveRepositoryAction 
+ *
+ * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
+ * @version $Id$
+ * 
+ * @plexus.component role="com.opensymphony.xwork.Action" role-hint="saveRepositoryAction" 
+ */
+public class SaveRepositoryAction
+    extends AbstractRepositoryAction
+{
+    public void prepare()
+        throws Exception
+    {
+        /* nothing to do here */
+    }
+
+    public String save()
+    {
+        String mode = getMode();
+        String repoId = getRepository().getId();
+        
+        getLogger().info( "edit(" + mode + ":" + repoId + ")" );
+        
+        if ( StringUtils.isBlank( repository.getId() ) )
+        {
+            addFieldError( "id", "A repository with a blank id cannot be saved." );
+            return SUCCESS;
+        }
+
+        if( StringUtils.equalsIgnoreCase( "edit", mode ) )
+        {
+            removeRepository( repoId );
+        }
+
+        try
+        {
+            addRepository( getRepository() );
+            saveConfiguration();
+        }
+        catch ( IOException e )
+        {
+            addActionError( "I/O Exception: " + e.getMessage() );
+        }
+        catch ( RoleProfileException e )
+        {
+            addActionError( "Role Profile Exception: " + e.getMessage() );
+        }
+        catch ( InvalidConfigurationException e )
+        {
+            addActionError( "Invalid Configuration Exception: " + e.getMessage() );
+        }
+        catch ( RbacManagerException e )
+        {
+            addActionError( "RBAC Manager Exception: " + e.getMessage() );
+        }
+        catch ( RegistryException e )
+        {
+            addActionError( "Configuration Registry Exception: " + e.getMessage() );
+        }
+        
+        return SUCCESS;
+    }
+}

Propchange: maven/archiva/branches/archiva-jpox-database-refactor/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/SaveRepositoryAction.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/archiva/branches/archiva-jpox-database-refactor/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/SaveRepositoryAction.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: maven/archiva/branches/archiva-jpox-database-refactor/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/SaveRepositoryAction.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Copied: maven/archiva/branches/archiva-jpox-database-refactor/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/models/AdminModel.java (from r533137, maven/archiva/branches/archiva-jpox-database-refactor/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/AdminModel.java)
URL: http://svn.apache.org/viewvc/maven/archiva/branches/archiva-jpox-database-refactor/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/models/AdminModel.java?view=diff&rev=534044&p1=maven/archiva/branches/archiva-jpox-database-refactor/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/AdminModel.java&r1=533137&p2=maven/archiva/branches/archiva-jpox-database-refactor/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/models/AdminModel.java&r2=534044
==============================================================================
--- maven/archiva/branches/archiva-jpox-database-refactor/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/AdminModel.java (original)
+++ maven/archiva/branches/archiva-jpox-database-refactor/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/models/AdminModel.java Tue May  1 05:46:46 2007
@@ -1,4 +1,4 @@
-package org.apache.maven.archiva.web.action.admin;
+package org.apache.maven.archiva.web.action.admin.models;
 
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
@@ -21,11 +21,12 @@
 
 import org.apache.maven.archiva.configuration.Configuration;
 import org.apache.maven.archiva.configuration.RepositoryConfiguration;
-import org.apache.maven.archiva.model.RepositoryURL;
 
 import java.util.ArrayList;
+import java.util.HashMap;
 import java.util.Iterator;
 import java.util.List;
+import java.util.Map;
 
 /**
  * AdminModel 
@@ -36,11 +37,13 @@
 public class AdminModel
 {
     private String baseUrl;
-    
+
     private List managedRepositories = new ArrayList();
 
     private List remoteRepositories = new ArrayList();
 
+    private Map repoMap = new HashMap();
+
     public AdminModel()
     {
         /* do nothing */
@@ -48,19 +51,25 @@
 
     public AdminModel( Configuration configuration )
     {
+        repoMap.putAll( configuration.createRepositoryMap() );
+
         Iterator it = configuration.getRepositories().iterator();
         while ( it.hasNext() )
         {
             RepositoryConfiguration repoconfig = (RepositoryConfiguration) it.next();
-            RepositoryURL repourl = new RepositoryURL( repoconfig.getUrl() );
-            if ( "file".equals( repourl.getProtocol() ) )
+            if ( repoconfig.isManaged() )
             {
-                managedRepositories.add( repoconfig );
+                managedRepositories.add( new AdminRepositoryConfiguration( repoconfig ) );
             }
-            else
+            else if ( repoconfig.isRemote() )
             {
                 remoteRepositories.add( repoconfig );
             }
+            else
+            {
+                // Should never occur, but it is possible that the configuration could
+                // contain a repository configuration which is null.
+            }
         }
     }
 
@@ -92,5 +101,10 @@
     public void setBaseUrl( String baseUrl )
     {
         this.baseUrl = baseUrl;
+    }
+
+    public String toString()
+    {
+        return "[ActionModel]";
     }
 }

Added: maven/archiva/branches/archiva-jpox-database-refactor/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/models/AdminRepositoryConfiguration.java
URL: http://svn.apache.org/viewvc/maven/archiva/branches/archiva-jpox-database-refactor/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/models/AdminRepositoryConfiguration.java?view=auto&rev=534044
==============================================================================
--- maven/archiva/branches/archiva-jpox-database-refactor/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/models/AdminRepositoryConfiguration.java (added)
+++ maven/archiva/branches/archiva-jpox-database-refactor/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/models/AdminRepositoryConfiguration.java Tue May  1 05:46:46 2007
@@ -0,0 +1,102 @@
+package org.apache.maven.archiva.web.action.admin.models;
+
+/*
+ * 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.common.utils.PathUtil;
+import org.apache.maven.archiva.configuration.RepositoryConfiguration;
+import org.apache.maven.archiva.model.RepositoryContentStatistics;
+import org.apache.maven.archiva.model.RepositoryURL;
+
+import java.io.File;
+
+/**
+ * AdminRepositoryConfiguration 
+ *
+ * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
+ * @version $Id$
+ */
+public class AdminRepositoryConfiguration
+    extends RepositoryConfiguration
+{
+    private String directory;
+
+    private RepositoryContentStatistics stats;
+
+    public AdminRepositoryConfiguration()
+    {
+        super();
+    }
+
+    /**
+     * Copy Constructor.
+     */
+    public AdminRepositoryConfiguration( RepositoryConfiguration repoconfig )
+    {
+        this.setId( repoconfig.getId() );
+        this.setName( repoconfig.getName() );
+        this.setUrl( repoconfig.getUrl() );
+        this.setLayout( repoconfig.getLayout() );
+        this.setIndexed( repoconfig.isIndexed() );
+        this.setReleases( repoconfig.isReleases() );
+        this.setSnapshots( repoconfig.isSnapshots() );
+
+        this.setIndexDir( repoconfig.getIndexDir() );
+        this.setRefreshCronExpression( repoconfig.getRefreshCronExpression() );
+
+        if ( repoconfig.isManaged() )
+        {
+            RepositoryURL url = new RepositoryURL( repoconfig.getUrl() );
+            this.setDirectory( url.getPath() );
+        }
+    }
+
+    public boolean isDirectoryExists()
+    {
+        if ( StringUtils.isBlank( directory ) )
+        {
+            return false;
+        }
+
+        File dir = new File( directory );
+        return ( dir.exists() && dir.isDirectory() );
+    }
+
+    public String getDirectory()
+    {
+        return directory;
+    }
+
+    public void setDirectory( String directory )
+    {
+        this.directory = directory;
+        this.setUrl( PathUtil.toUrl( directory ) );
+    }
+
+    public RepositoryContentStatistics getStats()
+    {
+        return stats;
+    }
+
+    public void setStats( RepositoryContentStatistics stats )
+    {
+        this.stats = stats;
+    }
+}

Propchange: maven/archiva/branches/archiva-jpox-database-refactor/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/models/AdminRepositoryConfiguration.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/archiva/branches/archiva-jpox-database-refactor/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/models/AdminRepositoryConfiguration.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: maven/archiva/branches/archiva-jpox-database-refactor/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/models/AdminRepositoryConfiguration.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain



Mime
View raw message