archiva-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From joak...@apache.org
Subject svn commit: r579417 [1/2] - in /maven/archiva/trunk/archiva-web/archiva-webapp/src: main/java/org/apache/maven/archiva/web/action/admin/repositories/ main/resources/ main/resources/org/apache/maven/archiva/web/action/admin/repositories/ main/webapp/WEB...
Date Wed, 26 Sep 2007 00:01:03 GMT
Author: joakime
Date: Tue Sep 25 17:01:01 2007
New Revision: 579417

URL: http://svn.apache.org/viewvc?rev=579417&view=rev
Log:
[MRM-494] leaving repository ID blank on the add repository page goes to the edit page where ID cannot be edited
Overhauled repository admin actions to be more consistent with best practices.
Split into seperate actions.
Added -validation.xml files.
Added unit tests.


Added:
    maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/AbstractManagedRepositoriesAction.java   (with props)
    maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/AbstractRemoteRepositoriesAction.java   (with props)
    maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/AbstractRepositoriesAdminAction.java   (with props)
    maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/AddManagedRepositoryAction.java   (with props)
    maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/AddRemoteRepositoryAction.java   (with props)
    maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/DeleteManagedRepositoryAction.java   (with props)
    maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/DeleteRemoteRepositoryAction.java   (with props)
    maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/EditManagedRepositoryAction.java   (with props)
    maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/EditRemoteRepositoryAction.java   (with props)
    maven/archiva/trunk/archiva-web/archiva-webapp/src/main/resources/org/apache/maven/archiva/web/action/admin/repositories/
    maven/archiva/trunk/archiva-web/archiva-webapp/src/main/resources/org/apache/maven/archiva/web/action/admin/repositories/AddManagedRepositoryAction-validation.xml   (with props)
    maven/archiva/trunk/archiva-web/archiva-webapp/src/main/resources/org/apache/maven/archiva/web/action/admin/repositories/AddRemoteRepositoryAction-validation.xml   (with props)
    maven/archiva/trunk/archiva-web/archiva-webapp/src/main/resources/org/apache/maven/archiva/web/action/admin/repositories/EditManagedRepositoryAction-validation.xml   (with props)
    maven/archiva/trunk/archiva-web/archiva-webapp/src/main/resources/org/apache/maven/archiva/web/action/admin/repositories/EditRemoteRepositoryAction-validation.xml   (with props)
    maven/archiva/trunk/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/admin/repositories/AddManagedRepositoryActionTest.java   (with props)
    maven/archiva/trunk/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/admin/repositories/AddRemoteRepositoryActionTest.java   (with props)
    maven/archiva/trunk/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/admin/repositories/DeleteManagedRepositoryActionTest.java   (with props)
    maven/archiva/trunk/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/admin/repositories/DeleteRemoteRepositoryActionTest.java   (with props)
    maven/archiva/trunk/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/admin/repositories/EditManagedRepositoryActionTest.java   (with props)
    maven/archiva/trunk/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/admin/repositories/EditRemoteRepositoryActionTest.java   (with props)
    maven/archiva/trunk/archiva-web/archiva-webapp/src/test/resources/log4j.xml   (with props)
Removed:
    maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/AbstractConfigureRepositoryAction.java
    maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/ConfigureRemoteRepositoryAction.java
    maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/ConfigureRepositoryAction.java
    maven/archiva/trunk/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/admin/repositories/ConfigureRemoteRepositoryActionTest.java
    maven/archiva/trunk/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/admin/repositories/ConfigureRepositoryActionTest.java
Modified:
    maven/archiva/trunk/archiva-web/archiva-webapp/src/main/resources/xwork.xml
    maven/archiva/trunk/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/addRemoteRepository.jsp
    maven/archiva/trunk/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/addRepository.jsp
    maven/archiva/trunk/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/deleteRemoteRepository.jsp
    maven/archiva/trunk/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/deleteRepository.jsp
    maven/archiva/trunk/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/editRemoteRepository.jsp
    maven/archiva/trunk/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/editRepository.jsp
    maven/archiva/trunk/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/repositories.jsp
    maven/archiva/trunk/archiva-web/archiva-webapp/src/main/webapp/css/site.css

Added: maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/AbstractManagedRepositoriesAction.java
URL: http://svn.apache.org/viewvc/maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/AbstractManagedRepositoriesAction.java?rev=579417&view=auto
==============================================================================
--- maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/AbstractManagedRepositoriesAction.java (added)
+++ maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/AbstractManagedRepositoriesAction.java Tue Sep 25 17:01:01 2007
@@ -0,0 +1,107 @@
+package org.apache.maven.archiva.web.action.admin.repositories;
+
+/*
+ * 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.io.FileUtils;
+import org.apache.maven.archiva.configuration.Configuration;
+import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
+import org.codehaus.plexus.redback.role.RoleManager;
+import org.codehaus.plexus.redback.role.RoleManagerException;
+
+import java.io.File;
+import java.io.IOException;
+
+/**
+ * Abstract ManagedRepositories Action.
+ * 
+ * Place for all generic methods used in Managed Repository Administration.
+ *
+ * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
+ * @version $Id$
+ */
+public abstract class AbstractManagedRepositoriesAction
+    extends AbstractRepositoriesAdminAction
+{
+    /**
+     * @plexus.requirement role-hint="default"
+     */
+    protected RoleManager roleManager;
+
+    public RoleManager getRoleManager()
+    {
+        return roleManager;
+    }
+
+    public void setRoleManager( RoleManager roleManager )
+    {
+        this.roleManager = roleManager;
+    }
+
+    protected void addRepository( ManagedRepositoryConfiguration repository, Configuration configuration )
+        throws IOException
+    {
+        // Normalize the path
+        File file = new File( repository.getLocation() );
+        repository.setLocation( file.getCanonicalPath() );
+        if ( !file.exists() )
+        {
+            file.mkdirs();
+        }
+        if ( !file.exists() || !file.isDirectory() )
+        {
+            throw new IOException( "unable to add repository - can not create the root directory: " + file );
+        }
+
+        configuration.addManagedRepository( repository );
+
+    }
+
+    protected void addRepositoryRoles( ManagedRepositoryConfiguration newRepository ) throws RoleManagerException
+    {
+        // TODO: double check these are configured on start up
+        // TODO: belongs in the business logic
+        roleManager.createTemplatedRole( "archiva-repository-manager", newRepository.getId() );
+        roleManager.createTemplatedRole( "archiva-repository-observer", newRepository.getId() );
+    }
+
+    protected void removeContents( ManagedRepositoryConfiguration existingRepository )
+        throws IOException
+    {
+        FileUtils.deleteDirectory( new File( existingRepository.getLocation() ) );
+    }
+
+    protected void removeRepository( String repoId, Configuration configuration )
+    {
+        ManagedRepositoryConfiguration toremove = configuration.findManagedRepositoryById( repoId );
+        if ( toremove != null )
+        {
+            configuration.removeManagedRepository( toremove );
+        }
+    }
+
+    protected void removeRepositoryRoles( ManagedRepositoryConfiguration existingRepository )
+        throws RoleManagerException
+    {
+        roleManager.removeTemplatedRole( "archiva-repository-manager", existingRepository.getId() );
+        roleManager.removeTemplatedRole( "archiva-repository-observer", existingRepository.getId() );
+
+        getLogger().debug( "removed user roles associated with repository " + existingRepository.getId() );
+    }
+}

Propchange: maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/AbstractManagedRepositoriesAction.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/AbstractManagedRepositoriesAction.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Propchange: maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/AbstractManagedRepositoriesAction.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/AbstractRemoteRepositoriesAction.java
URL: http://svn.apache.org/viewvc/maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/AbstractRemoteRepositoriesAction.java?rev=579417&view=auto
==============================================================================
--- maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/AbstractRemoteRepositoriesAction.java (added)
+++ maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/AbstractRemoteRepositoriesAction.java Tue Sep 25 17:01:01 2007
@@ -0,0 +1,51 @@
+package org.apache.maven.archiva.web.action.admin.repositories;
+
+import org.apache.maven.archiva.configuration.Configuration;
+import org.apache.maven.archiva.configuration.RemoteRepositoryConfiguration;
+import org.codehaus.plexus.redback.role.RoleManagerException;
+
+import java.io.IOException;
+
+/*
+ * 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.
+ */
+
+/**
+ * AbstractRemoteRepositoriesAction 
+ *
+ * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
+ * @version $Id$
+ */
+public class AbstractRemoteRepositoriesAction
+    extends AbstractRepositoriesAdminAction
+{
+    protected void addRepository( RemoteRepositoryConfiguration repository, Configuration configuration )
+        throws IOException, RoleManagerException
+    {
+        configuration.addRemoteRepository( repository );
+    }
+
+    protected void removeRepository( String repoId, Configuration configuration )
+    {
+        RemoteRepositoryConfiguration toremove = configuration.findRemoteRepositoryById( repoId );
+        if ( toremove != null )
+        {
+            configuration.removeRemoteRepository( toremove );
+        }
+    }
+}

Propchange: maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/AbstractRemoteRepositoriesAction.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/AbstractRemoteRepositoriesAction.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Propchange: maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/AbstractRemoteRepositoriesAction.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/AbstractRepositoriesAdminAction.java
URL: http://svn.apache.org/viewvc/maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/AbstractRepositoriesAdminAction.java?rev=579417&view=auto
==============================================================================
--- maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/AbstractRepositoriesAdminAction.java (added)
+++ maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/AbstractRepositoriesAdminAction.java Tue Sep 25 17:01:01 2007
@@ -0,0 +1,104 @@
+package org.apache.maven.archiva.web.action.admin.repositories;
+
+/*
+ * 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.ArchivaConfiguration;
+import org.apache.maven.archiva.configuration.Configuration;
+import org.apache.maven.archiva.configuration.IndeterminateConfigurationException;
+import org.apache.maven.archiva.configuration.InvalidConfigurationException;
+import org.apache.maven.archiva.security.ArchivaRoleConstants;
+import org.codehaus.plexus.redback.rbac.Resource;
+import org.codehaus.plexus.redback.xwork.interceptor.SecureAction;
+import org.codehaus.plexus.redback.xwork.interceptor.SecureActionBundle;
+import org.codehaus.plexus.redback.xwork.interceptor.SecureActionException;
+import org.codehaus.plexus.registry.RegistryException;
+import org.codehaus.plexus.xwork.action.PlexusActionSupport;
+
+import java.io.IOException;
+
+/**
+ * Abstract AdminRepositories Action base.
+ * 
+ * Base class for all repository administrative functions.
+ * This should be neutral to the type of action (add/edit/delete) and type of repo (managed/remote)
+ *
+ * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
+ * @version $Id$
+ */
+public abstract class AbstractRepositoriesAdminAction
+    extends PlexusActionSupport
+    implements SecureAction
+{
+    /**
+     * @plexus.requirement
+     */
+    protected ArchivaConfiguration archivaConfiguration;
+
+    public ArchivaConfiguration getArchivaConfiguration()
+    {
+        return archivaConfiguration;
+    }
+
+    public SecureActionBundle getSecureActionBundle()
+        throws SecureActionException
+    {
+        SecureActionBundle bundle = new SecureActionBundle();
+
+        bundle.setRequiresAuthentication( true );
+        bundle.addRequiredAuthorization( ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION, Resource.GLOBAL );
+
+        return bundle;
+    }
+
+    public void setArchivaConfiguration( ArchivaConfiguration archivaConfiguration )
+    {
+        this.archivaConfiguration = archivaConfiguration;
+    }
+
+    /**
+     * Save the configuration.
+     * 
+     * @param configuration the configuration to save.
+     * @return the webwork result code to issue.
+     * @throws IOException thrown if unable to save file to disk.
+     * @throws InvalidConfigurationException thrown if configuration is invalid.
+     * @throws RegistryException thrown if configuration subsystem has a problem saving the configuration to disk.
+     */
+    protected String saveConfiguration( Configuration configuration )
+    {
+        try
+        {
+            archivaConfiguration.save( configuration );
+            addActionMessage( "Successfully saved configuration" );
+        }
+        catch ( IndeterminateConfigurationException e )
+        {
+            addActionError( e.getMessage() );
+            return INPUT;
+        }
+        catch ( RegistryException e )
+        {
+            addActionError( "Configuration Registry Exception: " + e.getMessage() );
+            return INPUT;
+        }
+
+        return SUCCESS;
+    }
+}

Propchange: maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/AbstractRepositoriesAdminAction.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/AbstractRepositoriesAdminAction.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Propchange: maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/AbstractRepositoriesAdminAction.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/AddManagedRepositoryAction.java
URL: http://svn.apache.org/viewvc/maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/AddManagedRepositoryAction.java?rev=579417&view=auto
==============================================================================
--- maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/AddManagedRepositoryAction.java (added)
+++ maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/AddManagedRepositoryAction.java Tue Sep 25 17:01:01 2007
@@ -0,0 +1,123 @@
+package org.apache.maven.archiva.web.action.admin.repositories;
+
+/*
+ * 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.Preparable;
+import com.opensymphony.xwork.Validateable;
+
+import org.apache.maven.archiva.configuration.Configuration;
+import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
+import org.codehaus.plexus.redback.role.RoleManagerException;
+import org.codehaus.plexus.scheduler.CronExpressionValidator;
+
+import java.io.IOException;
+
+/**
+ * AddManagedRepositoryAction 
+ *
+ * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
+ * @version $Id$
+ * 
+ * @plexus.component role="com.opensymphony.xwork.Action" role-hint="addManagedRepositoryAction"
+ */
+public class AddManagedRepositoryAction
+    extends AbstractManagedRepositoriesAction
+    implements Preparable, Validateable
+{
+    /**
+     * The model for this action.
+     */
+    private ManagedRepositoryConfiguration repository;
+
+    public void prepare()
+    {
+        this.repository = new ManagedRepositoryConfiguration();
+        this.repository.setReleases( false );
+        this.repository.setScanned( false );
+    }
+
+    public String input()
+    {
+        this.repository.setReleases( true );
+        this.repository.setScanned( true );
+
+        return INPUT;
+    }
+
+    public String commit()
+    {
+        Configuration configuration = archivaConfiguration.getConfiguration();
+
+        String result;
+        try
+        {
+            addRepository( repository, configuration );
+            addRepositoryRoles( repository );
+            result = saveConfiguration( configuration );
+        }
+        catch ( RoleManagerException e )
+        {
+            addActionError( "Role Manager Exception: " + e.getMessage() );
+            result = INPUT;
+        }
+        catch ( IOException e )
+        {
+            addActionError( "Role Manager Exception: " + e.getMessage() );
+            result = INPUT;
+        }
+
+        return result;
+    }
+
+    @Override
+    public void validate()
+    {
+        Configuration config = archivaConfiguration.getConfiguration();
+
+        CronExpressionValidator validator = new CronExpressionValidator();
+        String repoId = repository.getId();
+
+        if ( config.getManagedRepositoriesAsMap().containsKey( repoId ) )
+        {
+            addFieldError( "repository.id", "Unable to add new repository with id [" + repoId
+                + "], that id already exists as a managed repository." );
+        }
+        else if ( config.getRemoteRepositoriesAsMap().containsKey( repoId ) )
+        {
+            addFieldError( "repository.id", "Unable to add new repository with id [" + repoId
+                + "], that id already exists as a remote repository." );
+        }
+
+        if ( !validator.validate( repository.getRefreshCronExpression() ) )
+        {
+            addFieldError( "repository.refreshCronExpression", "Invalid cron expression." );
+        }
+    }
+
+    public ManagedRepositoryConfiguration getRepository()
+    {
+        return repository;
+    }
+
+    public void setRepository( ManagedRepositoryConfiguration repository )
+    {
+        this.repository = repository;
+    }
+}

Propchange: maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/AddManagedRepositoryAction.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/AddManagedRepositoryAction.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Propchange: maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/AddManagedRepositoryAction.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/AddRemoteRepositoryAction.java
URL: http://svn.apache.org/viewvc/maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/AddRemoteRepositoryAction.java?rev=579417&view=auto
==============================================================================
--- maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/AddRemoteRepositoryAction.java (added)
+++ maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/AddRemoteRepositoryAction.java Tue Sep 25 17:01:01 2007
@@ -0,0 +1,111 @@
+package org.apache.maven.archiva.web.action.admin.repositories;
+
+/*
+ * 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.Preparable;
+import com.opensymphony.xwork.Validateable;
+
+import org.apache.maven.archiva.configuration.Configuration;
+import org.apache.maven.archiva.configuration.RemoteRepositoryConfiguration;
+import org.codehaus.plexus.redback.role.RoleManagerException;
+
+import java.io.IOException;
+
+/**
+ * AddRemoteRepositoryAction 
+ *
+ * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
+ * @version $Id$
+ * 
+ * @plexus.component role="com.opensymphony.xwork.Action" role-hint="addRemoteRepositoryAction"
+ */
+public class AddRemoteRepositoryAction
+    extends AbstractRemoteRepositoriesAction
+    implements Preparable, Validateable
+{
+    /**
+     * The model for this action.
+     */
+    private RemoteRepositoryConfiguration repository;    
+    
+    public void prepare()
+    {
+        this.repository = new RemoteRepositoryConfiguration();
+    }
+
+    public String input()
+    {
+        return INPUT;
+    }
+
+    public String commit()
+    {
+        Configuration configuration = archivaConfiguration.getConfiguration();
+        
+        // Save the repository configuration.
+        String result;
+        try
+        {
+            addRepository( repository, configuration );
+            result = saveConfiguration( configuration );
+        }
+        catch ( IOException e )
+        {
+            addActionError( "I/O Exception: " + e.getMessage() );
+            result = INPUT;
+        }
+        catch ( RoleManagerException e )
+        {
+            addActionError( "Role Manager Exception: " + e.getMessage() );
+            result = INPUT;
+        }
+
+        return result;
+    }
+    
+    @Override
+    public void validate()
+    {
+        Configuration config = archivaConfiguration.getConfiguration();
+        
+        String repoId = repository.getId();
+        
+        if ( config.getManagedRepositoriesAsMap().containsKey( repoId ) )
+        {
+            addFieldError( "repository.id", "Unable to add new repository with id [" + repoId
+                + "], that id already exists as a managed repository." );
+        }
+        else if ( config.getRemoteRepositoriesAsMap().containsKey( repoId ) )
+        {
+            addFieldError( "repository.id", "Unable to add new repository with id [" + repoId
+                + "], that id already exists as a remote repository." );
+        }
+    }
+    
+    public RemoteRepositoryConfiguration getRepository()
+    {
+        return repository;
+    }
+
+    public void setRepository( RemoteRepositoryConfiguration repository )
+    {
+        this.repository = repository;
+    }
+}

Propchange: maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/AddRemoteRepositoryAction.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/AddRemoteRepositoryAction.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Propchange: maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/AddRemoteRepositoryAction.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/DeleteManagedRepositoryAction.java
URL: http://svn.apache.org/viewvc/maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/DeleteManagedRepositoryAction.java?rev=579417&view=auto
==============================================================================
--- maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/DeleteManagedRepositoryAction.java (added)
+++ maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/DeleteManagedRepositoryAction.java Tue Sep 25 17:01:01 2007
@@ -0,0 +1,148 @@
+package org.apache.maven.archiva.web.action.admin.repositories;
+
+/*
+ * 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.Preparable;
+
+import org.apache.commons.lang.StringUtils;
+import org.apache.maven.archiva.configuration.Configuration;
+import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
+import org.codehaus.plexus.redback.role.RoleManagerException;
+
+import java.io.IOException;
+
+/**
+ * DeleteManagedRepositoryAction 
+ *
+ * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
+ * @version $Id$
+ * 
+ * @plexus.component role="com.opensymphony.xwork.Action" role-hint="deleteManagedRepositoryAction"
+ */
+public class DeleteManagedRepositoryAction
+    extends AbstractManagedRepositoriesAction
+    implements Preparable
+{
+    private ManagedRepositoryConfiguration repository;
+
+    private String repoid;
+
+    public void prepare()
+    {
+        if ( StringUtils.isNotBlank( repoid ) )
+        {
+            this.repository = archivaConfiguration.getConfiguration().findManagedRepositoryById( repoid );
+        }
+    }
+
+    public String confirmDelete()
+    {
+        if ( StringUtils.isBlank( repoid ) )
+        {
+            addActionError( "Unable to delete managed repository: repository id was blank." );
+            return ERROR;
+        }
+
+        return INPUT;
+    }
+
+    public String deleteEntry()
+    {
+        return deleteRepository( false );
+    }
+
+    public String deleteContents()
+    {
+        return deleteRepository( true );
+    }
+
+    private String deleteRepository( boolean deleteContents )
+    {
+        ManagedRepositoryConfiguration existingRepository = repository;
+        if ( existingRepository == null )
+        {
+            addActionError( "A repository with that id does not exist" );
+            return ERROR;
+        }
+
+        String result = SUCCESS;
+
+        try
+        {
+            Configuration configuration = archivaConfiguration.getConfiguration();
+            removeRepository( repoid, configuration );
+            result = saveConfiguration( configuration );
+
+            if ( result.equals( SUCCESS ) )
+            {
+                cleanupRepositoryData( existingRepository );
+
+                if ( deleteContents )
+                {
+                    removeContents( existingRepository );
+                }
+            }
+        }
+        catch ( IOException e )
+        {
+            addActionError( "Unable to delete repository: " + e.getMessage() );
+            result = ERROR;
+        }
+        catch ( RoleManagerException e )
+        {
+            addActionError( "Unable to delete repository: " + e.getMessage() );
+            result = ERROR;
+        }
+
+        return result;
+    }
+
+    private void cleanupRepositoryData( ManagedRepositoryConfiguration cleanupRepository )
+        throws RoleManagerException
+    {
+        removeRepositoryRoles( cleanupRepository );
+
+        // TODO: [MRM-382] Remove index from artifacts of deleted managed repositories.
+
+        // TODO: [MRM-265] After removing a managed repository - Browse/Search still see it
+        
+        // TODO: [MRM-520] Proxy Connectors are not deleted with the deletion of a Repository.
+    }
+
+    public ManagedRepositoryConfiguration getRepository()
+    {
+        return repository;
+    }
+
+    public void setRepository( ManagedRepositoryConfiguration repository )
+    {
+        this.repository = repository;
+    }
+
+    public String getRepoid()
+    {
+        return repoid;
+    }
+
+    public void setRepoid( String repoid )
+    {
+        this.repoid = repoid;
+    }
+}

Propchange: maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/DeleteManagedRepositoryAction.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/DeleteManagedRepositoryAction.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Propchange: maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/DeleteManagedRepositoryAction.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/DeleteRemoteRepositoryAction.java
URL: http://svn.apache.org/viewvc/maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/DeleteRemoteRepositoryAction.java?rev=579417&view=auto
==============================================================================
--- maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/DeleteRemoteRepositoryAction.java (added)
+++ maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/DeleteRemoteRepositoryAction.java Tue Sep 25 17:01:01 2007
@@ -0,0 +1,106 @@
+package org.apache.maven.archiva.web.action.admin.repositories;
+
+/*
+ * 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.Preparable;
+
+import org.apache.commons.lang.StringUtils;
+import org.apache.maven.archiva.configuration.Configuration;
+import org.apache.maven.archiva.configuration.RemoteRepositoryConfiguration;
+
+/**
+ * DeleteRemoteRepositoryAction 
+ *
+ * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
+ * @version $Id$
+ * 
+ * @plexus.component role="com.opensymphony.xwork.Action" role-hint="deleteRemoteRepositoryAction"
+ */
+public class DeleteRemoteRepositoryAction
+    extends AbstractRemoteRepositoriesAction
+    implements Preparable
+{
+    private RemoteRepositoryConfiguration repository;
+
+    private String repoid;
+
+    public void prepare()
+    {
+        if ( StringUtils.isNotBlank( repoid ) )
+        {
+            this.repository = archivaConfiguration.getConfiguration().findRemoteRepositoryById( repoid );
+        }
+    }
+
+    public String confirmDelete()
+    {
+        if ( StringUtils.isBlank( repoid ) )
+        {
+            addActionError( "Unable to delete remote repository: repository id was blank." );
+            return ERROR;
+        }
+
+        return INPUT;
+    }
+
+    public String delete()
+    {
+        String result = SUCCESS;
+        RemoteRepositoryConfiguration existingRepository = repository;
+        if ( existingRepository == null )
+        {
+            addActionError( "A repository with that id does not exist" );
+            return ERROR;
+        }
+
+        Configuration configuration = archivaConfiguration.getConfiguration();
+        removeRepository( repoid, configuration );
+        result = saveConfiguration( configuration );
+        
+        cleanupRepositoryData( existingRepository );
+
+        return result;
+    }
+
+    private void cleanupRepositoryData( RemoteRepositoryConfiguration existingRepository )
+    {
+        // TODO: [MRM-520] Proxy Connectors are not deleted with the deletion of a Repository.
+    }
+
+    public RemoteRepositoryConfiguration getRepository()
+    {
+        return repository;
+    }
+
+    public void setRepository( RemoteRepositoryConfiguration repository )
+    {
+        this.repository = repository;
+    }
+
+    public String getRepoid()
+    {
+        return repoid;
+    }
+
+    public void setRepoid( String repoid )
+    {
+        this.repoid = repoid;
+    }
+}

Propchange: maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/DeleteRemoteRepositoryAction.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/DeleteRemoteRepositoryAction.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Propchange: maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/DeleteRemoteRepositoryAction.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/EditManagedRepositoryAction.java
URL: http://svn.apache.org/viewvc/maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/EditManagedRepositoryAction.java?rev=579417&view=auto
==============================================================================
--- maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/EditManagedRepositoryAction.java (added)
+++ maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/EditManagedRepositoryAction.java Tue Sep 25 17:01:01 2007
@@ -0,0 +1,131 @@
+package org.apache.maven.archiva.web.action.admin.repositories;
+
+/*
+ * 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.Preparable;
+import com.opensymphony.xwork.Validateable;
+
+import org.apache.commons.lang.StringUtils;
+import org.apache.maven.archiva.configuration.Configuration;
+import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
+import org.codehaus.plexus.redback.role.RoleManagerException;
+import org.codehaus.plexus.scheduler.CronExpressionValidator;
+
+import java.io.IOException;
+
+/**
+ * AddManagedRepositoryAction 
+ *
+ * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
+ * @version $Id$
+ * 
+ * @plexus.component role="com.opensymphony.xwork.Action" role-hint="editManagedRepositoryAction"
+ */
+public class EditManagedRepositoryAction
+    extends AbstractManagedRepositoriesAction
+    implements Preparable, Validateable
+{
+    /**
+     * The model for this action.
+     */
+    private ManagedRepositoryConfiguration repository;
+
+    private String repoid;
+
+    public void prepare()
+    {
+        if ( StringUtils.isNotBlank( repoid ) )
+        {
+            repository = archivaConfiguration.getConfiguration().findManagedRepositoryById( repoid );
+        }
+    }
+
+    public String input()
+    {
+        if ( repository == null )
+        {
+            addActionError( "Edit failure, unable to edit a repository with a blank repository id." );
+            return ERROR;
+        }
+
+        return INPUT;
+    }
+
+    public String commit()
+    {
+        // Ensure that the fields are valid.
+        Configuration configuration = archivaConfiguration.getConfiguration();
+
+        // We are in edit mode, remove the old repository configuration.
+        removeRepository( repository.getId(), configuration );
+
+        // Save the repository configuration.
+        String result;
+        try
+        {
+            addRepository( repository, configuration );
+            addRepositoryRoles( repository );
+            result = saveConfiguration( configuration );
+        }
+        catch ( IOException e )
+        {
+            addActionError( "I/O Exception: " + e.getMessage() );
+            result = ERROR;
+        }
+        catch ( RoleManagerException e )
+        {
+            addActionError( "Role Manager Exception: " + e.getMessage() );
+            result = ERROR;
+        }
+
+        return result;
+    }
+    
+    @Override
+    public void validate()
+    {
+        CronExpressionValidator validator = new CronExpressionValidator();
+
+        if ( !validator.validate( repository.getRefreshCronExpression() ) )
+        {
+            addFieldError( "repository.refreshCronExpression", "Invalid cron expression." );
+        }
+    }
+
+    public String getRepoid()
+    {
+        return repoid;
+    }
+
+    public void setRepoid( String repoid )
+    {
+        this.repoid = repoid;
+    }
+
+    public ManagedRepositoryConfiguration getRepository()
+    {
+        return repository;
+    }
+
+    public void setRepository( ManagedRepositoryConfiguration repository )
+    {
+        this.repository = repository;
+    }
+}

Propchange: maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/EditManagedRepositoryAction.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/EditManagedRepositoryAction.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Propchange: maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/EditManagedRepositoryAction.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/EditRemoteRepositoryAction.java
URL: http://svn.apache.org/viewvc/maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/EditRemoteRepositoryAction.java?rev=579417&view=auto
==============================================================================
--- maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/EditRemoteRepositoryAction.java (added)
+++ maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/EditRemoteRepositoryAction.java Tue Sep 25 17:01:01 2007
@@ -0,0 +1,120 @@
+package org.apache.maven.archiva.web.action.admin.repositories;
+
+/*
+ * 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.Preparable;
+
+import org.apache.commons.lang.StringUtils;
+import org.apache.maven.archiva.configuration.Configuration;
+import org.apache.maven.archiva.configuration.RemoteRepositoryConfiguration;
+import org.codehaus.plexus.redback.role.RoleManagerException;
+
+import java.io.IOException;
+
+/**
+ * EditRemoteRepositoryAction 
+ *
+ * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
+ * @version $Id$
+ * 
+ * @plexus.component role="com.opensymphony.xwork.Action" role-hint="editRemoteRepositoryAction" 
+ */
+public class EditRemoteRepositoryAction
+    extends AbstractRemoteRepositoriesAction
+    implements Preparable
+{
+    /**
+     * The model for this action.
+     */
+    private RemoteRepositoryConfiguration repository;
+
+    /**
+     * The repository id to edit.
+     */
+    private String repoid;
+
+    public void prepare()
+    {
+        String id = repoid;
+        if ( StringUtils.isNotBlank( repoid ) )
+        {
+            this.repository = archivaConfiguration.getConfiguration().findRemoteRepositoryById( id );
+        }
+    }
+
+    public String input()
+    {
+        if ( StringUtils.isBlank( repoid ) )
+        {
+            addActionError( "Edit failure, unable to edit a repository with a blank repository id." );
+            return ERROR;
+        }
+        
+        return INPUT;
+    }
+
+    public String commit()
+    {
+        Configuration configuration = archivaConfiguration.getConfiguration();
+        
+        // We are in edit mode, remove the old repository configuration.
+        removeRepository( repository.getId(), configuration );
+
+        // Save the repository configuration.
+        String result;
+        try
+        {
+            addRepository( repository, configuration );
+            result = saveConfiguration( configuration );
+        }
+        catch ( IOException e )
+        {
+            addActionError( "I/O Exception: " + e.getMessage() );
+            result = INPUT;
+        }
+        catch ( RoleManagerException e )
+        {
+            addActionError( "Role Manager Exception: " + e.getMessage() );
+            result = INPUT;
+        }
+
+        return result;
+    }
+    
+    public RemoteRepositoryConfiguration getRepository()
+    {
+        return repository;
+    }
+
+    public void setRepository( RemoteRepositoryConfiguration repository )
+    {
+        this.repository = repository;
+    }
+
+    public String getRepoid()
+    {
+        return repoid;
+    }
+
+    public void setRepoid( String repoid )
+    {
+        this.repoid = repoid;
+    }
+}

Propchange: maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/EditRemoteRepositoryAction.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/EditRemoteRepositoryAction.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Propchange: maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/EditRemoteRepositoryAction.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: maven/archiva/trunk/archiva-web/archiva-webapp/src/main/resources/org/apache/maven/archiva/web/action/admin/repositories/AddManagedRepositoryAction-validation.xml
URL: http://svn.apache.org/viewvc/maven/archiva/trunk/archiva-web/archiva-webapp/src/main/resources/org/apache/maven/archiva/web/action/admin/repositories/AddManagedRepositoryAction-validation.xml?rev=579417&view=auto
==============================================================================
--- maven/archiva/trunk/archiva-web/archiva-webapp/src/main/resources/org/apache/maven/archiva/web/action/admin/repositories/AddManagedRepositoryAction-validation.xml (added)
+++ maven/archiva/trunk/archiva-web/archiva-webapp/src/main/resources/org/apache/maven/archiva/web/action/admin/repositories/AddManagedRepositoryAction-validation.xml Tue Sep 25 17:01:01 2007
@@ -0,0 +1,40 @@
+<?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.
+  -->
+
+<!DOCTYPE validators PUBLIC "-//OpenSymphony Group//XWork Validator 1.0.2//EN"
+    "http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd">
+
+<validators>
+  <field name="repository.id">
+    <field-validator type="requiredstring">
+      <message>You must enter a repository identifier.</message>
+    </field-validator>
+  </field>
+  <field name="repository.location">
+    <field-validator type="requiredstring">
+      <message>You must enter a directory.</message>
+    </field-validator>
+  </field>
+  <field name="repository.name">
+    <field-validator type="requiredstring">
+      <message>You must enter a repository name.</message>
+    </field-validator>
+  </field>
+</validators>
\ No newline at end of file

Propchange: maven/archiva/trunk/archiva-web/archiva-webapp/src/main/resources/org/apache/maven/archiva/web/action/admin/repositories/AddManagedRepositoryAction-validation.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/archiva/trunk/archiva-web/archiva-webapp/src/main/resources/org/apache/maven/archiva/web/action/admin/repositories/AddManagedRepositoryAction-validation.xml
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Propchange: maven/archiva/trunk/archiva-web/archiva-webapp/src/main/resources/org/apache/maven/archiva/web/action/admin/repositories/AddManagedRepositoryAction-validation.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: maven/archiva/trunk/archiva-web/archiva-webapp/src/main/resources/org/apache/maven/archiva/web/action/admin/repositories/AddRemoteRepositoryAction-validation.xml
URL: http://svn.apache.org/viewvc/maven/archiva/trunk/archiva-web/archiva-webapp/src/main/resources/org/apache/maven/archiva/web/action/admin/repositories/AddRemoteRepositoryAction-validation.xml?rev=579417&view=auto
==============================================================================
--- maven/archiva/trunk/archiva-web/archiva-webapp/src/main/resources/org/apache/maven/archiva/web/action/admin/repositories/AddRemoteRepositoryAction-validation.xml (added)
+++ maven/archiva/trunk/archiva-web/archiva-webapp/src/main/resources/org/apache/maven/archiva/web/action/admin/repositories/AddRemoteRepositoryAction-validation.xml Tue Sep 25 17:01:01 2007
@@ -0,0 +1,40 @@
+<?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.
+  -->
+
+<!DOCTYPE validators PUBLIC "-//OpenSymphony Group//XWork Validator 1.0.2//EN"
+    "http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd">
+
+<validators>
+  <field name="repository.id">
+    <field-validator type="requiredstring">
+      <message>You must enter a repository identifier.</message>
+    </field-validator>
+  </field>
+  <field name="repository.url">
+    <field-validator type="requiredstring">
+      <message>You must enter a url.</message>
+    </field-validator>
+  </field>
+  <field name="repository.name">
+    <field-validator type="requiredstring">
+      <message>You must enter a repository name.</message>
+    </field-validator>
+  </field>
+</validators>
\ No newline at end of file

Propchange: maven/archiva/trunk/archiva-web/archiva-webapp/src/main/resources/org/apache/maven/archiva/web/action/admin/repositories/AddRemoteRepositoryAction-validation.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/archiva/trunk/archiva-web/archiva-webapp/src/main/resources/org/apache/maven/archiva/web/action/admin/repositories/AddRemoteRepositoryAction-validation.xml
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Propchange: maven/archiva/trunk/archiva-web/archiva-webapp/src/main/resources/org/apache/maven/archiva/web/action/admin/repositories/AddRemoteRepositoryAction-validation.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: maven/archiva/trunk/archiva-web/archiva-webapp/src/main/resources/org/apache/maven/archiva/web/action/admin/repositories/EditManagedRepositoryAction-validation.xml
URL: http://svn.apache.org/viewvc/maven/archiva/trunk/archiva-web/archiva-webapp/src/main/resources/org/apache/maven/archiva/web/action/admin/repositories/EditManagedRepositoryAction-validation.xml?rev=579417&view=auto
==============================================================================
--- maven/archiva/trunk/archiva-web/archiva-webapp/src/main/resources/org/apache/maven/archiva/web/action/admin/repositories/EditManagedRepositoryAction-validation.xml (added)
+++ maven/archiva/trunk/archiva-web/archiva-webapp/src/main/resources/org/apache/maven/archiva/web/action/admin/repositories/EditManagedRepositoryAction-validation.xml Tue Sep 25 17:01:01 2007
@@ -0,0 +1,40 @@
+<?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.
+  -->
+
+<!DOCTYPE validators PUBLIC "-//OpenSymphony Group//XWork Validator 1.0.2//EN"
+    "http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd">
+
+<validators>
+  <field name="repository.id">
+    <field-validator type="requiredstring">
+      <message>You must enter a repository identifier.</message>
+    </field-validator>
+  </field>
+  <field name="repository.location">
+    <field-validator type="requiredstring">
+      <message>You must enter a directory.</message>
+    </field-validator>
+  </field>
+  <field name="repository.name">
+    <field-validator type="requiredstring">
+      <message>You must enter a repository name.</message>
+    </field-validator>
+  </field>
+</validators>
\ No newline at end of file

Propchange: maven/archiva/trunk/archiva-web/archiva-webapp/src/main/resources/org/apache/maven/archiva/web/action/admin/repositories/EditManagedRepositoryAction-validation.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/archiva/trunk/archiva-web/archiva-webapp/src/main/resources/org/apache/maven/archiva/web/action/admin/repositories/EditManagedRepositoryAction-validation.xml
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Propchange: maven/archiva/trunk/archiva-web/archiva-webapp/src/main/resources/org/apache/maven/archiva/web/action/admin/repositories/EditManagedRepositoryAction-validation.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: maven/archiva/trunk/archiva-web/archiva-webapp/src/main/resources/org/apache/maven/archiva/web/action/admin/repositories/EditRemoteRepositoryAction-validation.xml
URL: http://svn.apache.org/viewvc/maven/archiva/trunk/archiva-web/archiva-webapp/src/main/resources/org/apache/maven/archiva/web/action/admin/repositories/EditRemoteRepositoryAction-validation.xml?rev=579417&view=auto
==============================================================================
--- maven/archiva/trunk/archiva-web/archiva-webapp/src/main/resources/org/apache/maven/archiva/web/action/admin/repositories/EditRemoteRepositoryAction-validation.xml (added)
+++ maven/archiva/trunk/archiva-web/archiva-webapp/src/main/resources/org/apache/maven/archiva/web/action/admin/repositories/EditRemoteRepositoryAction-validation.xml Tue Sep 25 17:01:01 2007
@@ -0,0 +1,40 @@
+<?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.
+  -->
+
+<!DOCTYPE validators PUBLIC "-//OpenSymphony Group//XWork Validator 1.0.2//EN"
+    "http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd">
+
+<validators>
+  <field name="repository.id">
+    <field-validator type="requiredstring">
+      <message>You must enter a repository identifier.</message>
+    </field-validator>
+  </field>
+  <field name="repository.url">
+    <field-validator type="requiredstring">
+      <message>You must enter a url.</message>
+    </field-validator>
+  </field>
+  <field name="repository.name">
+    <field-validator type="requiredstring">
+      <message>You must enter a repository name.</message>
+    </field-validator>
+  </field>
+</validators>
\ No newline at end of file

Propchange: maven/archiva/trunk/archiva-web/archiva-webapp/src/main/resources/org/apache/maven/archiva/web/action/admin/repositories/EditRemoteRepositoryAction-validation.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/archiva/trunk/archiva-web/archiva-webapp/src/main/resources/org/apache/maven/archiva/web/action/admin/repositories/EditRemoteRepositoryAction-validation.xml
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Propchange: maven/archiva/trunk/archiva-web/archiva-webapp/src/main/resources/org/apache/maven/archiva/web/action/admin/repositories/EditRemoteRepositoryAction-validation.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Modified: maven/archiva/trunk/archiva-web/archiva-webapp/src/main/resources/xwork.xml
URL: http://svn.apache.org/viewvc/maven/archiva/trunk/archiva-web/archiva-webapp/src/main/resources/xwork.xml?rev=579417&r1=579416&r2=579417&view=diff
==============================================================================
--- maven/archiva/trunk/archiva-web/archiva-webapp/src/main/resources/xwork.xml (original)
+++ maven/archiva/trunk/archiva-web/archiva-webapp/src/main/resources/xwork.xml Tue Sep 25 17:01:01 2007
@@ -228,52 +228,52 @@
       <result type="redirect-action">repositories</result>
     </action>
 
-    <action name="addRepository" class="configureRepositoryAction" method="add">
+    <action name="addRepository" class="addManagedRepositoryAction" method="input">
       <result name="input">/WEB-INF/jsp/admin/addRepository.jsp</result>
       <result name="error">/WEB-INF/jsp/admin/addRepository.jsp</result>
       <result name="success" type="redirect-action">repositories</result>
       <interceptor-ref name="configuredPrepareParamsStack"/>
     </action>
 
-    <action name="editRepository" class="configureRepositoryAction" method="edit">
+    <action name="editRepository" class="editManagedRepositoryAction" method="input">
       <result name="input">/WEB-INF/jsp/admin/editRepository.jsp</result>
       <result name="error">/WEB-INF/jsp/admin/editRepository.jsp</result>
       <result name="success" type="redirect-action">repositories</result>
       <interceptor-ref name="configuredPrepareParamsStack"/>
     </action>
 
-    <action name="confirmDeleteRepository" class="configureRepositoryAction">
-      <result>/WEB-INF/jsp/admin/deleteRepository.jsp</result>
+    <action name="confirmDeleteRepository" class="deleteManagedRepositoryAction" method="confirmDelete">
+      <result name="input">/WEB-INF/jsp/admin/deleteRepository.jsp</result>
       <interceptor-ref name="configuredPrepareParamsStack"/>
     </action>
 
-    <action name="deleteRepository" class="configureRepositoryAction" method="delete">
+    <action name="deleteRepository" class="deleteManagedRepositoryAction" method="delete">
       <result name="input">/WEB-INF/jsp/admin/deleteRepository.jsp</result>
       <result name="error">/WEB-INF/jsp/admin/deleteRepository.jsp</result>
       <result name="success" type="redirect-action">repositories</result>
       <interceptor-ref name="configuredPrepareParamsStack"/>
     </action>
 
-    <action name="addRemoteRepository" class="configureRemoteRepositoryAction" method="add">
+    <action name="addRemoteRepository" class="addRemoteRepositoryAction" method="input">
       <result name="input">/WEB-INF/jsp/admin/addRemoteRepository.jsp</result>
       <result name="error">/WEB-INF/jsp/admin/addRemoteRepository.jsp</result>
       <result name="success" type="redirect-action">repositories</result>
       <interceptor-ref name="configuredPrepareParamsStack"/>
     </action>
 
-    <action name="editRemoteRepository" class="configureRemoteRepositoryAction" method="edit">
+    <action name="editRemoteRepository" class="editRemoteRepositoryAction" method="input">
       <result name="input">/WEB-INF/jsp/admin/editRemoteRepository.jsp</result>
       <result name="error">/WEB-INF/jsp/admin/editRemoteRepository.jsp</result>
       <result name="success" type="redirect-action">repositories</result>
       <interceptor-ref name="configuredPrepareParamsStack"/>
     </action>
 
-    <action name="confirmDeleteRemoteRepository" class="configureRemoteRepositoryAction">
-      <result>/WEB-INF/jsp/admin/deleteRemoteRepository.jsp</result>
+    <action name="confirmDeleteRemoteRepository" class="deleteRemoteRepositoryAction" method="confirmDelete">
+      <result name="input">/WEB-INF/jsp/admin/deleteRemoteRepository.jsp</result>
       <interceptor-ref name="configuredPrepareParamsStack"/>
     </action>
 
-    <action name="deleteRemoteRepository" class="configureRemoteRepositoryAction" method="delete">
+    <action name="deleteRemoteRepository" class="deleteRemoteRepositoryAction" method="delete">
       <result name="input">/WEB-INF/jsp/admin/deleteRemoteRepository.jsp</result>
       <result name="error">/WEB-INF/jsp/admin/deleteRemoteRepository.jsp</result>
       <result name="success" type="redirect-action">repositories</result>

Modified: maven/archiva/trunk/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/addRemoteRepository.jsp
URL: http://svn.apache.org/viewvc/maven/archiva/trunk/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/addRemoteRepository.jsp?rev=579417&r1=579416&r2=579417&view=diff
==============================================================================
--- maven/archiva/trunk/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/addRemoteRepository.jsp (original)
+++ maven/archiva/trunk/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/addRemoteRepository.jsp Tue Sep 25 17:01:01 2007
@@ -34,7 +34,7 @@
   <h2>Add Repository</h2>
 
   <ww:actionmessage/>
-  <ww:form method="post" action="addRemoteRepository" namespace="/admin" validate="true">
+  <ww:form method="post" action="addRemoteRepository!commit" namespace="/admin" validate="true">
     <ww:textfield name="repository.id" label="Identifier" size="10" required="true"/>
     <%@ include file="/WEB-INF/jsp/admin/include/remoteRepositoryForm.jspf" %>
     <ww:submit value="Add Repository"/>

Modified: maven/archiva/trunk/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/addRepository.jsp
URL: http://svn.apache.org/viewvc/maven/archiva/trunk/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/addRepository.jsp?rev=579417&r1=579416&r2=579417&view=diff
==============================================================================
--- maven/archiva/trunk/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/addRepository.jsp (original)
+++ maven/archiva/trunk/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/addRepository.jsp Tue Sep 25 17:01:01 2007
@@ -34,7 +34,7 @@
   <h2>Add Repository</h2>
 
   <ww:actionmessage/>
-  <ww:form method="post" action="addRepository" namespace="/admin" validate="true">
+  <ww:form method="post" action="addRepository!commit" namespace="/admin" validate="true">
     <ww:textfield name="repository.id" label="Identifier" size="10" required="true"/>
     <%@ include file="/WEB-INF/jsp/admin/include/repositoryForm.jspf" %>
     <ww:submit value="Add Repository"/>

Modified: maven/archiva/trunk/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/deleteRemoteRepository.jsp
URL: http://svn.apache.org/viewvc/maven/archiva/trunk/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/deleteRemoteRepository.jsp?rev=579417&r1=579416&r2=579417&view=diff
==============================================================================
--- maven/archiva/trunk/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/deleteRemoteRepository.jsp (original)
+++ maven/archiva/trunk/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/deleteRemoteRepository.jsp Tue Sep 25 17:01:01 2007
@@ -21,32 +21,51 @@
 
 <html>
 <head>
-  <title>Admin: Delete Repository</title>
+  <title>Admin: Delete Remote Repository</title>
   <ww:head/>
 </head>
 
 <body>
 
-<h1>Admin: Delete Repository</h1>
+<h1>Admin: Delete Remote Repository</h1>
 
 <ww:actionerror/>
 
 <div id="contentArea">
 
-  <h2>Delete Repository</h2>
-
-  <blockquote>
-    <strong><span class="statusFailed">WARNING:</span> This operation can not be undone.</strong>
-  </blockquote>
+  <div class="warningbox">
+    <p>
+      <strong>WARNING: This operation can not be undone.</strong>
+    </p>
+  </div>
 
   <p>
-    Are you sure you want to delete the repository <code>[ ${repoid} ]</code> ?
+    Are you sure you want to delete the following remote repository?
   </p>
 
-  <ww:form method="post" action="deleteRemoteRepository" namespace="/admin" validate="true">
+  <div class="infobox">
+    <table class="infotable">
+      <tr>
+        <td>ID:</td>
+        <td><code>${repository.id}</code></td>
+      </tr>
+      <tr>
+        <td>Name:</td>
+        <td>${repository.name}</td>
+      </tr>
+      <tr>
+        <td>URL:</td>
+        <td><a href="${repository.url}">${repository.url}</a></td>
+      </tr>
+    </table>
+  </div>
+
+  <ww:form method="post" action="deleteRemoteRepository" namespace="/admin" validate="true" theme="simple">
     <ww:hidden name="repoid"/>
-    <ww:submit value="Confirm" method="delete"/>
-    <ww:submit value="Cancel" method="execute"/>
+    <div class="buttons">
+      <ww:submit value="Confirm" method="delete"/>
+      <ww:submit value="Cancel" method="execute"/>
+    </div>
   </ww:form>
 </div>
 

Modified: maven/archiva/trunk/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/deleteRepository.jsp
URL: http://svn.apache.org/viewvc/maven/archiva/trunk/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/deleteRepository.jsp?rev=579417&r1=579416&r2=579417&view=diff
==============================================================================
--- maven/archiva/trunk/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/deleteRepository.jsp (original)
+++ maven/archiva/trunk/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/deleteRepository.jsp Tue Sep 25 17:01:01 2007
@@ -21,31 +21,52 @@
 
 <html>
 <head>
-  <title>Admin: Delete Repository</title>
+  <title>Admin: Delete Managed Repository</title>
   <ww:head/>
 </head>
 
 <body>
 
-<h1>Admin: Delete Repository</h1>
+<h1>Admin: Delete Managed Repository</h1>
 
 <ww:actionerror/>
 
 <div id="contentArea">
 
-  <h2>Delete Repository</h2>
+  <div class="warningbox">
+    <p>
+      <strong>WARNING: This operation can not be undone.</strong>
+    </p>
+  </div>
+  
+  <p>
+    Are you sure you want to delete the following managed repository?
+  </p>
+
+  <div class="infobox">
+    <table class="infotable">
+      <tr>
+        <td>ID:</td>
+        <td><code>${repository.id}</code></td>
+      </tr>
+      <tr>
+        <td>Name:</td>
+        <td>${repository.name}</td>
+      </tr>
+      <tr>
+        <td>Directory:</td>
+        <td>${repository.location}</td>
+      </tr>
+    </table>
+  </div>
 
-  <blockquote>
-    <strong><span class="statusFailed">WARNING:</span> This operation can not be undone.</strong>
-  </blockquote>
-
-  <ww:form method="post" action="deleteRepository" namespace="/admin" validate="true">
+  <ww:form method="post" action="deleteRepository" namespace="/admin" validate="true" theme="simple">
     <ww:hidden name="repoid"/>
-    <ww:radio list="#@java.util.LinkedHashMap@{'delete-contents' : 'Remove the repository and delete its contents from disk',
-    'delete-entry' : 'Remove the repository from the management list, but leave the contents unmodified'}"
-              name="deleteMode" theme="archiva"/>
-    <ww:submit value="Confirm" method="delete"/>
-    <ww:submit value="Cancel" method="execute"/>
+    <div class="buttons">
+      <ww:submit value="Delete Configuration Only" method="deleteEntry" />
+      <ww:submit value="Delete Configuration and Contents" method="deleteContents" />
+      <ww:submit value="Cancel" method="execute"/>
+    </div>
   </ww:form>
 </div>
 

Modified: maven/archiva/trunk/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/editRemoteRepository.jsp
URL: http://svn.apache.org/viewvc/maven/archiva/trunk/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/editRemoteRepository.jsp?rev=579417&r1=579416&r2=579417&view=diff
==============================================================================
--- maven/archiva/trunk/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/editRemoteRepository.jsp (original)
+++ maven/archiva/trunk/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/editRemoteRepository.jsp Tue Sep 25 17:01:01 2007
@@ -36,7 +36,7 @@
   <h2>Edit Repository</h2>
 
   <ww:actionmessage/>
-  <ww:form method="post" action="editRemoteRepository" namespace="/admin" validate="false">
+  <ww:form method="post" action="editRemoteRepository!commit" namespace="/admin" validate="false">
     <ww:hidden name="repository.id"/>
     <%@ include file="/WEB-INF/jsp/admin/include/remoteRepositoryForm.jspf" %>
     <ww:submit value="Update Repository"/>

Modified: maven/archiva/trunk/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/editRepository.jsp
URL: http://svn.apache.org/viewvc/maven/archiva/trunk/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/editRepository.jsp?rev=579417&r1=579416&r2=579417&view=diff
==============================================================================
--- maven/archiva/trunk/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/editRepository.jsp (original)
+++ maven/archiva/trunk/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/editRepository.jsp Tue Sep 25 17:01:01 2007
@@ -36,7 +36,7 @@
   <h2>Edit Repository</h2>
 
   <ww:actionmessage/>
-  <ww:form method="post" action="editRepository" namespace="/admin" validate="false">
+  <ww:form method="post" action="editRepository!commit" namespace="/admin" validate="false">
     <ww:hidden name="repository.id"/>
     <%@ include file="/WEB-INF/jsp/admin/include/repositoryForm.jspf" %>
     <ww:submit value="Update Repository"/>

Modified: maven/archiva/trunk/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/repositories.jsp
URL: http://svn.apache.org/viewvc/maven/archiva/trunk/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/repositories.jsp?rev=579417&r1=579416&r2=579417&view=diff
==============================================================================
--- maven/archiva/trunk/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/repositories.jsp (original)
+++ maven/archiva/trunk/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/repositories.jsp Tue Sep 25 17:01:01 2007
@@ -40,7 +40,7 @@
 <div class="admin">
 <div class="controls">
   <redback:ifAuthorized permission="archiva-manage-configuration">
-    <ww:url id="addRepositoryUrl" action="addRepository" method="addInput"/>
+    <ww:url id="addRepositoryUrl" action="addRepository"/>
     <ww:a href="%{addRepositoryUrl}">
       <img src="<c:url value="/images/icons/create.png" />" alt="" width="16" height="16"/>
       Add
@@ -72,7 +72,7 @@
 <div class="controls">
     <%-- TODO: make some icons --%>
   <redback:ifAnyAuthorized permissions="archiva-manage-configuration">
-    <ww:url id="editRepositoryUrl" action="editRepository" method="editInput">
+    <ww:url id="editRepositoryUrl" action="editRepository">
       <ww:param name="repoid" value="%{'${repository.id}'}"/>
     </ww:url>
     <ww:url id="deleteRepositoryUrl" action="confirmDeleteRepository">
@@ -230,7 +230,7 @@
 
 <div class="controls">
   <redback:ifAuthorized permission="archiva-manage-configuration">
-    <ww:url id="addRepositoryUrl" action="addRemoteRepository" method="input"/>
+    <ww:url id="addRepositoryUrl" action="addRemoteRepository"/>
     <ww:a href="%{addRepositoryUrl}">
       <img src="<c:url value="/images/icons/create.png" />" alt="" width="16" height="16"/>
       Add
@@ -260,7 +260,7 @@
 
         <div class="controls">
           <redback:ifAnyAuthorized permissions="archiva-manage-configuration">
-            <ww:url id="editRepositoryUrl" action="editRemoteRepository" method="input">
+            <ww:url id="editRepositoryUrl" action="editRemoteRepository">
               <ww:param name="repoid" value="%{'${repository.id}'}"/>
             </ww:url>
             <ww:a href="%{editRepositoryUrl}">

Modified: maven/archiva/trunk/archiva-web/archiva-webapp/src/main/webapp/css/site.css
URL: http://svn.apache.org/viewvc/maven/archiva/trunk/archiva-web/archiva-webapp/src/main/webapp/css/site.css?rev=579417&r1=579416&r2=579417&view=diff
==============================================================================
--- maven/archiva/trunk/archiva-web/archiva-webapp/src/main/webapp/css/site.css (original)
+++ maven/archiva/trunk/archiva-web/archiva-webapp/src/main/webapp/css/site.css Tue Sep 25 17:01:01 2007
@@ -367,3 +367,24 @@
 div.admin table.consumers td strong {
 	font-size: 0.8em;
 }
+
+div.warningbox {
+	margin: 20px 40px 20px 40px;
+	border: 1px solid #CC0000;
+	background-color: #FFCCCC;
+	color: #000000;
+	font-size: 15pt;
+	padding: 20px;
+}
+
+div.infobox {
+	margin: 20px 40px 20px 40px;
+	border: 1px solid #0000CC;
+	background-color: #EEEEFF;
+	font-size: 9pt;
+	padding: 20px;
+}
+
+div.buttons {
+	text-align: center;
+}
\ No newline at end of file

Added: maven/archiva/trunk/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/admin/repositories/AddManagedRepositoryActionTest.java
URL: http://svn.apache.org/viewvc/maven/archiva/trunk/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/admin/repositories/AddManagedRepositoryActionTest.java?rev=579417&view=auto
==============================================================================
--- maven/archiva/trunk/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/admin/repositories/AddManagedRepositoryActionTest.java (added)
+++ maven/archiva/trunk/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/admin/repositories/AddManagedRepositoryActionTest.java Tue Sep 25 17:01:01 2007
@@ -0,0 +1,167 @@
+package org.apache.maven.archiva.web.action.admin.repositories;
+
+/*
+ * 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.Action;
+
+import org.apache.commons.io.FileUtils;
+import org.apache.maven.archiva.configuration.ArchivaConfiguration;
+import org.apache.maven.archiva.configuration.Configuration;
+import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
+import org.codehaus.plexus.PlexusTestCase;
+import org.codehaus.plexus.redback.role.RoleManager;
+import org.codehaus.plexus.redback.xwork.interceptor.SecureActionBundle;
+import org.codehaus.plexus.redback.xwork.interceptor.SecureActionException;
+import org.easymock.MockControl;
+
+import java.io.File;
+import java.util.Collections;
+
+/**
+ * AddManagedRepositoryActionTest 
+ *
+ * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
+ * @version $Id$
+ */
+public class AddManagedRepositoryActionTest
+    extends PlexusTestCase
+{
+    private AddManagedRepositoryAction action;
+
+    private RoleManager roleManager;
+
+    private MockControl roleManagerControl;
+
+    private MockControl archivaConfigurationControl;
+
+    private ArchivaConfiguration archivaConfiguration;
+
+    private static final String REPO_ID = "repo-ident";
+
+    private File location;
+
+    protected void setUp()
+        throws Exception
+    {
+        super.setUp();
+
+        action = (AddManagedRepositoryAction) lookup( Action.class.getName(), "addManagedRepositoryAction" );
+
+        archivaConfigurationControl = MockControl.createControl( ArchivaConfiguration.class );
+        archivaConfiguration = (ArchivaConfiguration) archivaConfigurationControl.getMock();
+        action.setArchivaConfiguration( archivaConfiguration );
+
+        roleManagerControl = MockControl.createControl( RoleManager.class );
+        roleManager = (RoleManager) roleManagerControl.getMock();
+        action.setRoleManager( roleManager );
+        location = getTestFile( "target/test/location" );
+    }
+
+    public void testSecureActionBundle()
+        throws SecureActionException
+    {
+        archivaConfiguration.getConfiguration();
+        archivaConfigurationControl.setReturnValue( new Configuration() );
+        archivaConfigurationControl.replay();
+
+        action.prepare();
+        SecureActionBundle bundle = action.getSecureActionBundle();
+        assertTrue( bundle.requiresAuthentication() );
+        assertEquals( 1, bundle.getAuthorizationTuples().size() );
+    }
+
+    public void testAddRepositoryInitialPage()
+        throws Exception
+    {
+        archivaConfiguration.getConfiguration();
+        archivaConfigurationControl.setReturnValue( new Configuration() );
+        archivaConfigurationControl.replay();
+
+        action.prepare();
+        ManagedRepositoryConfiguration configuration = action.getRepository();
+        assertNotNull( configuration );
+        assertNull( configuration.getId() );
+        // check all booleans are false
+        assertFalse( configuration.isDeleteReleasedSnapshots() );
+        assertFalse( configuration.isScanned() );
+        assertFalse( configuration.isReleases() );
+        assertFalse( configuration.isSnapshots() );
+
+        String status = action.input();
+        assertEquals( Action.INPUT, status );
+
+        // check defaults
+        assertFalse( configuration.isDeleteReleasedSnapshots() );
+        assertTrue( configuration.isScanned() );
+        assertTrue( configuration.isReleases() );
+        assertFalse( configuration.isSnapshots() );
+    }
+
+    public void testAddRepository()
+        throws Exception
+    {
+        FileUtils.deleteDirectory( location );
+
+        // TODO: should be in the business model
+        roleManager.createTemplatedRole( "archiva-repository-manager", REPO_ID );
+        roleManager.createTemplatedRole( "archiva-repository-observer", REPO_ID );
+
+        roleManagerControl.replay();
+
+        Configuration configuration = new Configuration();
+        archivaConfiguration.getConfiguration();
+        archivaConfigurationControl.setReturnValue( configuration );
+
+        archivaConfiguration.save( configuration );
+
+        archivaConfigurationControl.replay();
+
+        action.prepare();
+        ManagedRepositoryConfiguration repository = action.getRepository();
+        populateRepository( repository );
+
+        assertFalse( location.exists() );
+        String status = action.commit();
+        assertEquals( Action.SUCCESS, status );
+        assertTrue( location.exists() );
+
+        assertEquals( Collections.singletonList( repository ), configuration.getManagedRepositories() );
+
+        roleManagerControl.verify();
+        archivaConfigurationControl.verify();
+    }
+    
+    private void populateRepository( ManagedRepositoryConfiguration repository )
+    {
+        repository.setId( REPO_ID );
+        repository.setName( "repo name" );
+        repository.setLocation( location.getAbsolutePath() );
+        repository.setLayout( "default" );
+        repository.setRefreshCronExpression( "* 0/5 * * * ?" );
+        repository.setDaysOlder( 31 );
+        repository.setRetentionCount( 20 );
+        repository.setReleases( true );
+        repository.setSnapshots( true );
+        repository.setScanned( false );
+        repository.setDeleteReleasedSnapshots( true );
+    }
+
+    // TODO: test errors during add, other actions
+}



Mime
View raw message