]> source.dussan.org Git - archiva.git/commitdiff
[MRM-462] removed unneeded classes
authorBrett Porter <brett@apache.org>
Wed, 12 Sep 2007 06:51:45 +0000 (06:51 +0000)
committerBrett Porter <brett@apache.org>
Wed, 12 Sep 2007 06:51:45 +0000 (06:51 +0000)
git-svn-id: https://svn.apache.org/repos/asf/maven/archiva/branches@574803 13f79535-47bb-0310-9956-ffa450edef68

MRM-462/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/connectors/proxy/ProxyConnectorsAction.java
MRM-462/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/AdminRepositoryConfiguration.java [deleted file]
MRM-462/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/ConfigureRepositoryAction.java
MRM-462/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/RepositoryConfigurationAdminTransformer.java [deleted file]
MRM-462/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/admin/repositories/ConfigureRepositoryActionTest.java

index 3dfded5492e8739cc5e2c8cd0b1edc9682fc1af4..1b005e152bbd28042bcf9a96da783e90021a8998 100644 (file)
@@ -22,12 +22,10 @@ package org.apache.maven.archiva.web.action.admin.connectors.proxy;
 import com.opensymphony.xwork.Preparable;
 import org.apache.commons.collections.Closure;
 import org.apache.commons.collections.CollectionUtils;
-import org.apache.commons.collections.Transformer;
 import org.apache.maven.archiva.configuration.ArchivaConfiguration;
 import org.apache.maven.archiva.configuration.Configuration;
 import org.apache.maven.archiva.configuration.ProxyConnectorConfiguration;
 import org.apache.maven.archiva.security.ArchivaRoleConstants;
-import org.apache.maven.archiva.web.action.admin.repositories.AdminRepositoryConfiguration;
 import org.codehaus.plexus.redback.rbac.Resource;
 import org.codehaus.plexus.redback.xwork.interceptor.SecureAction;
 import org.codehaus.plexus.redback.xwork.interceptor.SecureActionBundle;
@@ -50,42 +48,25 @@ public class ProxyConnectorsAction
     extends PlexusActionSupport
     implements SecureAction, Preparable
 {
-    /**
-     * @plexus.requirement role-hint="adminrepoconfig"
-     */
-    private Transformer repoConfigToAdmin;
-
     /**
      * @plexus.requirement
      */
     private ArchivaConfiguration archivaConfiguration;
 
-    private Map /*<String,AdminRepositoryConfiguration>*/repoMap;
+    private Map repoMap;
 
     /**
      * Map of Proxy Connectors.
      */
-    private Map /*<String,AdminProxyConnector>*/proxyConnectorMap;
+    private Map proxyConnectorMap;
 
     public void prepare()
-        throws Exception
     {
         Configuration config = archivaConfiguration.getConfiguration();
 
         repoMap = new HashMap();
-
-        Closure addToRepoMap = new Closure()
-        {
-            public void execute( Object input )
-            {
-                AdminRepositoryConfiguration arepo =
-                    (AdminRepositoryConfiguration) repoConfigToAdmin.transform( input );
-                repoMap.put( arepo.getId(), arepo );
-            }
-        };
-
-        CollectionUtils.forAllDo( config.getManagedRepositories(), addToRepoMap );
-        CollectionUtils.forAllDo( config.getRemoteRepositories(), addToRepoMap );
+        repoMap.putAll( config.getRemoteRepositoriesAsMap() );
+        repoMap.putAll( config.getManagedRepositoriesAsMap() );
 
         proxyConnectorMap = new HashMap();
 
@@ -129,18 +110,8 @@ public class ProxyConnectorsAction
         return repoMap;
     }
 
-    public void setRepoMap( Map repoMap )
-    {
-        this.repoMap = repoMap;
-    }
-
     public Map getProxyConnectorMap()
     {
         return proxyConnectorMap;
     }
-
-    public void setProxyConnectorMap( Map proxyConnectorMap )
-    {
-        this.proxyConnectorMap = proxyConnectorMap;
-    }
 }
diff --git a/MRM-462/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/AdminRepositoryConfiguration.java b/MRM-462/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/AdminRepositoryConfiguration.java
deleted file mode 100644 (file)
index 0e38ce0..0000000
+++ /dev/null
@@ -1,71 +0,0 @@
-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.ManagedRepositoryConfiguration;
-import org.apache.maven.archiva.model.RepositoryContentStatistics;
-
-/**
- * AdminRepositoryConfiguration
- *
- * @author <a href="mailto:joakime@apache.org">Joakim Erdfelt</a>
- * @version $Id$
- * @todo! split from remote repo (which shouldn't need stats, use native class)
- */
-public class AdminRepositoryConfiguration
-    extends ManagedRepositoryConfiguration
-{
-    private RepositoryContentStatistics stats;
-
-    public AdminRepositoryConfiguration()
-    {
-    }
-
-    /**
-     * Copy Constructor.
-     */
-    public AdminRepositoryConfiguration( ManagedRepositoryConfiguration repoconfig )
-    {
-        this.setId( repoconfig.getId() );
-        this.setName( repoconfig.getName() );
-        this.setLocation( repoconfig.getLocation() );
-        this.setLayout( repoconfig.getLayout() );
-        this.setIndexed( repoconfig.isIndexed() );
-        this.setReleases( repoconfig.isReleases() );
-        this.setSnapshots( repoconfig.isSnapshots() );
-
-        this.setIndexDir( repoconfig.getIndexDir() );
-        this.setRefreshCronExpression( repoconfig.getRefreshCronExpression() );
-
-        this.setDaysOlder( repoconfig.getDaysOlder() );
-        this.setRetentionCount( repoconfig.getRetentionCount() );
-        this.setDeleteReleasedSnapshots( repoconfig.isDeleteReleasedSnapshots() );
-    }
-
-    public RepositoryContentStatistics getStats()
-    {
-        return stats;
-    }
-
-    public void setStats( RepositoryContentStatistics stats )
-    {
-        this.stats = stats;
-    }
-}
index 437ef009a65b824a4ee3657991caecffa40cde75..b1c1251f85dfe1c64fe6047d2779b45be5df671f 100644 (file)
@@ -45,7 +45,7 @@ public class ConfigureRepositoryAction
     /**
      * The model for this action.
      */
-    private AdminRepositoryConfiguration repository;
+    private ManagedRepositoryConfiguration repository;
 
     /**
      * @plexus.requirement role-hint="default"
@@ -67,7 +67,7 @@ public class ConfigureRepositoryAction
         String result = SUCCESS;
         if ( StringUtils.equals( mode, "delete-entry" ) || StringUtils.equals( mode, "delete-contents" ) )
         {
-            AdminRepositoryConfiguration existingRepository = repository;
+            ManagedRepositoryConfiguration existingRepository = repository;
             if ( existingRepository == null )
             {
                 addActionError( "A repository with that id does not exist" );
@@ -116,7 +116,7 @@ public class ConfigureRepositoryAction
         return result;
     }
 
-    public AdminRepositoryConfiguration getRepository()
+    public ManagedRepositoryConfiguration getRepository()
     {
         return repository;
     }
@@ -126,16 +126,13 @@ public class ConfigureRepositoryAction
         String id = repoid;
         if ( id == null )
         {
-            this.repository = new AdminRepositoryConfiguration();
+            this.repository = new ManagedRepositoryConfiguration();
             this.repository.setReleases( false );
             this.repository.setIndexed( false );
         }
-
-        ManagedRepositoryConfiguration repoconfig =
-            archivaConfiguration.getConfiguration().findManagedRepositoryById( id );
-        if ( repoconfig != null )
+        else
         {
-            this.repository = new AdminRepositoryConfiguration( repoconfig );
+            repository = archivaConfiguration.getConfiguration().findManagedRepositoryById( id );
         }
     }
 
@@ -230,7 +227,7 @@ public class ConfigureRepositoryAction
         return containsError;
     }
 
-    private void addRepository( AdminRepositoryConfiguration repository, Configuration configuration )
+    private void addRepository( ManagedRepositoryConfiguration repository, Configuration configuration )
         throws IOException, RoleManagerException
     {
         // Normalize the path
@@ -251,7 +248,7 @@ public class ConfigureRepositoryAction
         roleManager.createTemplatedRole( "archiva-repository-observer", repository.getId() );
     }
 
-    private void removeContents( AdminRepositoryConfiguration existingRepository )
+    private void removeContents( ManagedRepositoryConfiguration existingRepository )
         throws IOException
     {
         FileUtils.deleteDirectory( new File( existingRepository.getLocation() ) );
diff --git a/MRM-462/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/RepositoryConfigurationAdminTransformer.java b/MRM-462/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/RepositoryConfigurationAdminTransformer.java
deleted file mode 100644 (file)
index 56fa502..0000000
+++ /dev/null
@@ -1,72 +0,0 @@
-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.collections.Transformer;
-import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
-import org.apache.maven.archiva.database.ArchivaDAO;
-import org.apache.maven.archiva.database.constraints.MostRecentRepositoryScanStatistics;
-import org.apache.maven.archiva.model.RepositoryContentStatistics;
-
-import java.util.List;
-
-/**
- * RepositoryConfigurationAdminTransformer
- *
- * @author <a href="mailto:joakime@apache.org">Joakim Erdfelt</a>
- * @version $Id$
- * @todo check usages!
- * @plexus.component role="org.apache.commons.collections.Transformer"
- * role-hint="adminrepoconfig"
- */
-public class RepositoryConfigurationAdminTransformer
-    implements Transformer
-{
-    /**
-     * @plexus.requirement role-hint="jdo"
-     */
-    private ArchivaDAO dao;
-
-    public Object transform( Object input )
-    {
-        if ( input instanceof ManagedRepositoryConfiguration )
-        {
-            ManagedRepositoryConfiguration repoconfig = (ManagedRepositoryConfiguration) input;
-            AdminRepositoryConfiguration arepo = new AdminRepositoryConfiguration( repoconfig );
-
-            arepo.setStats( getLatestStats( arepo.getId() ) );
-
-            return arepo;
-        }
-
-        return null;
-    }
-
-    private RepositoryContentStatistics getLatestStats( String repoId )
-    {
-        List results = dao.query( new MostRecentRepositoryScanStatistics( repoId ) );
-        if ( results.isEmpty() )
-        {
-            return null;
-        }
-
-        return (RepositoryContentStatistics) results.get( 0 );
-    }
-}
index 58c7ced358ad3a15e8d290e3e974146874e2cfcd..a7c7a106088913c088053327561a2c577ac37596 100644 (file)
@@ -98,7 +98,7 @@ public class ConfigureRepositoryActionTest
         action.prepare();
         assertNull( action.getRepoid() );
         assertNull( action.getMode() );
-        AdminRepositoryConfiguration configuration = action.getRepository();
+        ManagedRepositoryConfiguration configuration = action.getRepository();
         assertNotNull( configuration );
         assertNull( configuration.getId() );
         // check all booleans are false
@@ -140,7 +140,7 @@ public class ConfigureRepositoryActionTest
 
         action.prepare();
         action.setMode( "add" );
-        AdminRepositoryConfiguration repository = action.getRepository();
+        ManagedRepositoryConfiguration repository = action.getRepository();
         populateRepository( repository );
 
         assertFalse( location.exists() );
@@ -168,7 +168,7 @@ public class ConfigureRepositoryActionTest
         action.prepare();
         assertEquals( REPO_ID, action.getRepoid() );
         assertNull( action.getMode() );
-        AdminRepositoryConfiguration repository = action.getRepository();
+        ManagedRepositoryConfiguration repository = action.getRepository();
         assertNotNull( repository );
         assertRepositoryEquals( repository, createRepository() );
 
@@ -199,7 +199,7 @@ public class ConfigureRepositoryActionTest
 
         action.prepare();
         action.setMode( "edit" );
-        AdminRepositoryConfiguration repository = action.getRepository();
+        ManagedRepositoryConfiguration repository = action.getRepository();
         populateRepository( repository );
         repository.setName( "new repo name" );
 
@@ -229,7 +229,7 @@ public class ConfigureRepositoryActionTest
         action.prepare();
         assertEquals( REPO_ID, action.getRepoid() );
         assertNull( action.getMode() );
-        AdminRepositoryConfiguration repository = action.getRepository();
+        ManagedRepositoryConfiguration repository = action.getRepository();
         assertNotNull( repository );
         assertRepositoryEquals( repository, createRepository() );
 
@@ -266,7 +266,7 @@ public class ConfigureRepositoryActionTest
         ManagedRepositoryConfiguration originalRepository = createRepository();
         Configuration configuration = executeDeletionTest( "unmodified", originalRepository );
 
-        AdminRepositoryConfiguration repository = action.getRepository();
+        ManagedRepositoryConfiguration repository = action.getRepository();
         assertRepositoryEquals( repository, createRepository() );
         assertEquals( Collections.singletonList( originalRepository ), configuration.getManagedRepositories() );
 
@@ -294,7 +294,7 @@ public class ConfigureRepositoryActionTest
         action.prepare();
         assertEquals( REPO_ID, action.getRepoid() );
         assertEquals( mode, action.getMode() );
-        AdminRepositoryConfiguration repository = action.getRepository();
+        ManagedRepositoryConfiguration repository = action.getRepository();
         assertNotNull( repository );
         assertRepositoryEquals( repository, createRepository() );