]> source.dussan.org Git - archiva.git/commitdiff
[MRM-1520] remove duplicate beans : fix for ManagedRepositoryAdmin
authorOlivier Lamy <olamy@apache.org>
Thu, 15 Sep 2011 17:37:35 +0000 (17:37 +0000)
committerOlivier Lamy <olamy@apache.org>
Thu, 15 Sep 2011 17:37:35 +0000 (17:37 +0000)
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1171190 13f79535-47bb-0310-9956-ffa450edef68

14 files changed:
archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-api/src/main/java/org/apache/archiva/admin/model/beans/ManagedRepository.java
archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/managed/DefaultManagedRepositoryAdmin.java
archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/test/java/org/apache/archiva/admin/repository/AbstractRepositoryAdminTest.java
archiva-modules/archiva-scheduler/archiva-scheduler-repository/src/test/java/org/apache/archiva/mock/MockManagedRepositoryAdmin.java
archiva-modules/archiva-web/archiva-rest/archiva-rest-api/pom.xml
archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/model/ManagedRepository.java [deleted file]
archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/services/ManagedRepositoriesService.java
archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultManagedRepositoriesService.java
archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/AbstractArchivaRestTest.java
archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/ManagedRepositoriesServiceTest.java
archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/RepositoriesServiceTest.java
archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/RepositoryGroupServiceTest.java
archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/SearchServiceTest.java
archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-services/src/main/java/org/apache/archiva/web/xmlrpc/services/AdministrationServiceImpl.java

index 30270d8bf0ad62750a8b626db20ed5483fc5bb2e..8e4dbcb75cb259bb90594412224041ff5c054a4d 100644 (file)
@@ -21,12 +21,14 @@ package org.apache.archiva.admin.model.beans;
 
 import org.apache.archiva.admin.model.AbstractRepository;
 
+import javax.xml.bind.annotation.XmlRootElement;
 import java.io.Serializable;
 
 /**
  * @author Olivier Lamy
  * @since 1.4
  */
+@XmlRootElement( name = "managedRepository" )
 public class ManagedRepository
     extends AbstractRepository
     implements Serializable
@@ -67,6 +69,10 @@ public class ManagedRepository
 
     private boolean deleteReleasedSnapshots;
 
+    private boolean stageRepoNeeded;
+
+    private boolean resetStats;
+
     public ManagedRepository()
     {
         // no op
@@ -74,9 +80,10 @@ public class ManagedRepository
 
     public ManagedRepository( String id, String name, String location, String layout, boolean snapshots,
                               boolean releases, boolean blockRedeployments, String cronExpression, String indexDir,
-                              boolean scanned, int daysOlder, int retentionCount, boolean deleteReleasedSnapshots )
+                              boolean scanned, int daysOlder, int retentionCount, boolean deleteReleasedSnapshots,
+                              boolean stageRepoNeeded )
     {
-        super(id, name, layout);
+        super( id, name, layout );
 
         this.location = location;
         this.snapshots = snapshots;
@@ -88,6 +95,8 @@ public class ManagedRepository
         this.daysOlder = daysOlder;
         this.retentionCount = retentionCount;
         this.deleteReleasedSnapshots = deleteReleasedSnapshots;
+        this.stageRepoNeeded = stageRepoNeeded;
+        this.resetStats = resetStats;
     }
 
     public String getLocation()
@@ -206,6 +215,25 @@ public class ManagedRepository
         this.deleteReleasedSnapshots = deleteReleasedSnapshots;
     }
 
+    public boolean isStageRepoNeeded()
+    {
+        return stageRepoNeeded;
+    }
+
+    public void setStageRepoNeeded( boolean stageRepoNeeded )
+    {
+        this.stageRepoNeeded = stageRepoNeeded;
+    }
+
+    public boolean isResetStats()
+    {
+        return resetStats;
+    }
+
+    public void setResetStats( boolean resetStats )
+    {
+        this.resetStats = resetStats;
+    }
 
     @Override
     public String toString()
@@ -223,8 +251,9 @@ public class ManagedRepository
         sb.append( ", daysOlder=" ).append( daysOlder );
         sb.append( ", retentionCount=" ).append( retentionCount );
         sb.append( ", deleteReleasedSnapshots=" ).append( deleteReleasedSnapshots );
+        sb.append( ", stageRepoNeeded=" ).append( stageRepoNeeded );
+        sb.append( ", resetStats=" ).append( resetStats );
         sb.append( '}' );
-        sb.append( super.toString() );
         return sb.toString();
     }
 
index ac3e0ecd23c9434b45e81aa405fc8b02572cd870..9b3f784bb0909a6a489450eb4754cbdb75b4a2ac 100644 (file)
@@ -113,7 +113,7 @@ public class DefaultManagedRepositoryAdmin
                                        repoConfig.getLayout(), repoConfig.isSnapshots(), repoConfig.isReleases(),
                                        repoConfig.isBlockRedeployments(), repoConfig.getRefreshCronExpression(),
                                        repoConfig.getIndexDir(), repoConfig.isScanned(), repoConfig.getDaysOlder(),
-                                       repoConfig.getRetentionCount(), repoConfig.isDeleteReleasedSnapshots() );
+                                       repoConfig.getRetentionCount(), repoConfig.isDeleteReleasedSnapshots(), false );
 
             managedRepos.add( repo );
         }
index 9b88fc5df51f874dc11e6a38f48a48c5c42140cd..e62ecad90e514f50d7f114e02c5f16a74e2a4975 100644 (file)
@@ -94,7 +94,7 @@ public abstract class AbstractRepositoryAdminTest
     protected ManagedRepository getTestManagedRepository( String repoId, String repoLocation )
     {
         return new ManagedRepository( repoId, "test repo", repoLocation, "default", false, true, true, "0 0 * * * ?",
-                                      repoLocation + "/.index", false, 1, 2, true );
+                                      repoLocation + "/.index", false, 1, 2, true, false );
     }
 
     protected File clearRepoLocation( String path )
index 2f88528d696aa4c513bf46ae732321b899915c04..f1eb0240bd6fa6f71eb77ea06adbfcf8f84b926b 100644 (file)
@@ -54,7 +54,7 @@ public class MockManagedRepositoryAdmin
                                        repoConfig.getLayout(), repoConfig.isSnapshots(), repoConfig.isReleases(),
                                        repoConfig.isBlockRedeployments(), repoConfig.getRefreshCronExpression(),
                                        repoConfig.getIndexDir(), repoConfig.isScanned(), repoConfig.getDaysOlder(),
-                                       repoConfig.getRetentionCount(), repoConfig.isDeleteReleasedSnapshots() );
+                                       repoConfig.getRetentionCount(), repoConfig.isDeleteReleasedSnapshots(), true );
 
             managedRepos.add( repo );
         }
index 79d833ea1351595b8aec0179d6cd2305b1cc2353..e049f0af710e55741689fdf41e856769527ee838 100644 (file)
 
     </dependency>
 
+    <dependency>
+      <groupId>org.apache.archiva</groupId>
+      <artifactId>archiva-repository-admin-api</artifactId>
+
+    </dependency>
+
     <dependency>
       <groupId>org.codehaus.redback</groupId>
       <artifactId>redback-authorization-api</artifactId>
diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/model/ManagedRepository.java b/archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/model/ManagedRepository.java
deleted file mode 100644 (file)
index afab71e..0000000
+++ /dev/null
@@ -1,288 +0,0 @@
-package org.apache.archiva.rest.api.model;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import javax.xml.bind.annotation.XmlRootElement;
-import java.io.Serializable;
-
-/**
- * @since 1.4
- */
-@XmlRootElement( name = "managedRepository" )
-public class ManagedRepository
-    implements Serializable
-{
-    private String id;
-
-    private String name;
-
-    private String layout;
-
-    private String location;
-
-    private boolean snapshots = false;
-
-    private boolean releases = false;
-
-    private boolean blockRedeployments;
-
-    private boolean stageRepoNeeded;
-
-    // default value
-    private String cronExpression = "0 0 * * * ?";
-
-    private boolean resetStats;
-
-    private boolean scanned = false;
-
-    /**
-     * default model value
-     */
-    private int daysOlder = 100;
-
-    /**
-     * default model value
-     */
-    private int retentionCount = 2;
-
-    private boolean deleteReleasedSnapshots;
-
-    private String indexDirectory;
-
-    public ManagedRepository()
-    {
-        // no op
-    }
-
-    public ManagedRepository( String id, String name, String location, String layout, boolean snapshots,
-                              boolean releases, boolean blockRedeployments, boolean stageRepoNeeded,
-                              String cronExpression )
-    {
-        this.id = id;
-        this.name = name;
-        this.location = location;
-        this.layout = layout;
-        this.snapshots = snapshots;
-        this.releases = releases;
-        this.blockRedeployments = blockRedeployments;
-        this.stageRepoNeeded = stageRepoNeeded;
-        this.cronExpression = cronExpression;
-    }
-
-    public String getId()
-    {
-        return this.id;
-    }
-
-    public String getLayout()
-    {
-        return this.layout;
-    }
-
-    public String getName()
-    {
-        return this.name;
-    }
-
-    public String getLocation()
-    {
-        return this.location;
-    }
-
-
-    public boolean isReleases()
-    {
-        return this.releases;
-    }
-
-    /**
-     * Get null
-     */
-    public boolean isSnapshots()
-    {
-        return this.snapshots;
-    }
-
-    public void setId( String id )
-    {
-        this.id = id;
-    }
-
-    public void setLayout( String layout )
-    {
-        this.layout = layout;
-    }
-
-    public void setName( String name )
-    {
-        this.name = name;
-    }
-
-    public void setReleases( boolean releases )
-    {
-        this.releases = releases;
-    }
-
-    public void setSnapshots( boolean snapshots )
-    {
-        this.snapshots = snapshots;
-    }
-
-    public void setLocation( String location )
-    {
-        this.location = location;
-    }
-
-    public boolean isBlockRedeployments()
-    {
-        return blockRedeployments;
-    }
-
-    public void setBlockRedeployments( boolean blockRedeployments )
-    {
-        this.blockRedeployments = blockRedeployments;
-    }
-
-    public String getCronExpression()
-    {
-        return cronExpression;
-    }
-
-    public void setCronExpression( String cronExpression )
-    {
-        this.cronExpression = cronExpression;
-    }
-
-    public boolean isStageRepoNeeded()
-    {
-        return stageRepoNeeded;
-    }
-
-    public void setStageRepoNeeded( boolean stageRepoNeeded )
-    {
-        this.stageRepoNeeded = stageRepoNeeded;
-    }
-
-    public boolean isResetStats()
-    {
-        return resetStats;
-    }
-
-    public void setResetStats( boolean resetStats )
-    {
-        this.resetStats = resetStats;
-    }
-
-    public boolean isScanned()
-    {
-        return scanned;
-    }
-
-    public void setScanned( boolean scanned )
-    {
-        this.scanned = scanned;
-    }
-
-    public String getIndexDirectory()
-    {
-        return indexDirectory;
-    }
-
-    public void setIndexDirectory( String indexDirectory )
-    {
-        this.indexDirectory = indexDirectory;
-    }
-
-    public int getDaysOlder()
-    {
-        return daysOlder;
-    }
-
-    public void setDaysOlder( int daysOlder )
-    {
-        this.daysOlder = daysOlder;
-    }
-
-    public int getRetentionCount()
-    {
-        return retentionCount;
-    }
-
-    public void setRetentionCount( int retentionCount )
-    {
-        this.retentionCount = retentionCount;
-    }
-
-    public boolean isDeleteReleasedSnapshots()
-    {
-        return deleteReleasedSnapshots;
-    }
-
-    public void setDeleteReleasedSnapshots( boolean deleteReleasedSnapshots )
-    {
-        this.deleteReleasedSnapshots = deleteReleasedSnapshots;
-    }
-
-    public int hashCode()
-    {
-        int result = 17;
-        result = 37 * result + ( id != null ? id.hashCode() : 0 );
-        return result;
-    }
-
-    public boolean equals( Object other )
-    {
-        if ( this == other )
-        {
-            return true;
-        }
-
-        if ( !( other instanceof ManagedRepository ) )
-        {
-            return false;
-        }
-
-        ManagedRepository that = (ManagedRepository) other;
-        boolean result = true;
-        result = result && ( getId() == null ? that.getId() == null : getId().equals( that.getId() ) );
-        return result;
-    }
-
-    @Override
-    public String toString()
-    {
-        final StringBuilder sb = new StringBuilder();
-        sb.append( "ManagedRepository" );
-        sb.append( "{id='" ).append( id ).append( '\'' );
-        sb.append( ", name='" ).append( name ).append( '\'' );
-        sb.append( ", layout='" ).append( layout ).append( '\'' );
-        sb.append( ", location='" ).append( location ).append( '\'' );
-        sb.append( ", snapshots=" ).append( snapshots );
-        sb.append( ", releases=" ).append( releases );
-        sb.append( ", blockRedeployments=" ).append( blockRedeployments );
-        sb.append( ", stageRepoNeeded=" ).append( stageRepoNeeded );
-        sb.append( ", cronExpression='" ).append( cronExpression ).append( '\'' );
-        sb.append( ", resetStats=" ).append( resetStats );
-        sb.append( ", scanned=" ).append( scanned );
-        sb.append( ", indexDirectory='" ).append( indexDirectory ).append( '\'' );
-        sb.append( '}' );
-        return sb.toString();
-    }
-}
\ No newline at end of file
index 04ac8380174f240ca3868ce5fb6ca98fcd4a9be6..e9992247219b22cee33d7197bc71089dd666ca6f 100644 (file)
@@ -19,7 +19,7 @@ package org.apache.archiva.rest.api.services;
  * under the License.
  */
 
-import org.apache.archiva.rest.api.model.ManagedRepository;
+import org.apache.archiva.admin.model.beans.ManagedRepository;
 import org.apache.archiva.security.common.ArchivaRoleConstants;
 import org.codehaus.plexus.redback.authorization.RedbackAuthorization;
 
index bdc727be3c9fced2adb167fa686272857e70c894..7c08ab9009216d7af6da204407ae43854acf0c65 100644 (file)
@@ -19,9 +19,9 @@ package org.apache.archiva.rest.services;
  */
 
 import org.apache.archiva.admin.model.RepositoryAdminException;
+import org.apache.archiva.admin.model.beans.ManagedRepository;
 import org.apache.archiva.admin.model.managed.ManagedRepositoryAdmin;
 import org.apache.archiva.common.plexusbridge.PlexusSisuBridge;
-import org.apache.archiva.rest.api.model.ManagedRepository;
 import org.apache.archiva.rest.api.services.ArchivaRestServiceException;
 import org.apache.archiva.rest.api.services.ManagedRepositoriesService;
 import org.apache.commons.lang.StringUtils;
@@ -64,7 +64,11 @@ public class DefaultManagedRepositoriesService
                 ManagedRepository repo =
                     new ManagedRepository( repoConfig.getId(), repoConfig.getName(), repoConfig.getLocation(),
                                            repoConfig.getLayout(), repoConfig.isSnapshots(), repoConfig.isReleases(),
-                                           repoConfig.isBlockRedeployments(), false, repoConfig.getCronExpression() );
+                                           repoConfig.isBlockRedeployments(), repoConfig.getCronExpression(),
+                                           repoConfig.getIndexDirectory(), repoConfig.isScanned(),
+                                           repoConfig.getDaysOlder(), repoConfig.getRetentionCount(),
+                                           repoConfig.isDeleteReleasedSnapshots(), repoConfig.isStageRepoNeeded() );
+
                 managedRepos.add( repo );
             }
 
index 48ec6c6fbc371db334289d09b5d4855ca291cc86..893d29736d74d4c4ee1b82e627123aa3982c014f 100644 (file)
@@ -19,7 +19,7 @@ package org.apache.archiva.rest.services;
  */
 
 
-import org.apache.archiva.rest.api.model.ManagedRepository;
+import org.apache.archiva.admin.model.beans.ManagedRepository;
 import org.apache.archiva.rest.api.services.ArchivaAdministrationService;
 import org.apache.archiva.rest.api.services.ManagedRepositoriesService;
 import org.apache.archiva.rest.api.services.NetworkProxyService;
@@ -165,6 +165,8 @@ public abstract class AbstractArchivaRestTest
     protected ManagedRepository getTestManagedRepository()
     {
         String location = new File( FileUtil.getBasedir(), "target/test-repo" ).getAbsolutePath();
-        return new ManagedRepository( "TEST", "test", location, "default", true, true, false, false, "2 * * * * ?" );
+        return new ManagedRepository( "TEST", "test", location, "default", true, true, false, "2 * * * * ?", null,
+                                      false, 2, 3, true, false );
+
     }
 }
index c7acbc7361887ab2f44fdcece0ff2af6aa9e4b3d..12ececb973d77a848944d158c090e2d39b3f20ec 100644 (file)
@@ -19,7 +19,7 @@ package org.apache.archiva.rest.services;
  * under the License.
  */
 
-import org.apache.archiva.rest.api.model.ManagedRepository;
+import org.apache.archiva.admin.model.beans.ManagedRepository;
 import org.apache.archiva.rest.api.services.ManagedRepositoriesService;
 import org.junit.Test;
 
index faa417cc7ef2a6ab4da845465a48487f847392dc..0dacb9d670aac778b39a4d9da41a24650ca913e4 100644 (file)
@@ -19,7 +19,7 @@ package org.apache.archiva.rest.services;
  * under the License.
  */
 
-import org.apache.archiva.rest.api.model.ManagedRepository;
+import org.apache.archiva.admin.model.beans.ManagedRepository;
 import org.apache.archiva.rest.api.services.ManagedRepositoriesService;
 import org.apache.archiva.rest.api.services.RepositoriesService;
 import org.apache.cxf.jaxrs.client.ServerWebApplicationException;
@@ -78,7 +78,8 @@ public class RepositoriesServiceTest
     protected ManagedRepository getTestManagedRepository()
     {
         String location = new File( FileUtil.getBasedir(), "target/test-repo" ).getAbsolutePath();
-        return new ManagedRepository( "TEST", "test", location, "default", true, true, false, false, "2 * * * * ?" );
+        return new ManagedRepository( "TEST", "test", location, "default", true, true, true, "2 * * * * ?", null, false,
+                                      80, 80, true, false );
     }
 
 }
index 96a02654cbe3b1b007b1eee8a5e1f3a50cbec06e..18f8a1a1f28e1e520ef8f588ba217dcfb8ae1059 100644 (file)
@@ -18,7 +18,7 @@ package org.apache.archiva.rest.services;
  * under the License.
  */
 
-import org.apache.archiva.rest.api.model.ManagedRepository;
+import org.apache.archiva.admin.model.beans.ManagedRepository;
 import org.apache.archiva.rest.api.model.RepositoryGroup;
 import org.apache.archiva.rest.api.services.ManagedRepositoriesService;
 import org.apache.archiva.rest.api.services.RepositoryGroupService;
index 0e9f5aaa2bc7ad3b75763c0d72e937dd76c293e7..12a31bb4419b54cd66050b2f6556a5f4f5b30ffb 100644 (file)
@@ -18,8 +18,8 @@ package org.apache.archiva.rest.services;
  * under the License.
  */
 
+import org.apache.archiva.admin.model.beans.ManagedRepository;
 import org.apache.archiva.rest.api.model.Artifact;
-import org.apache.archiva.rest.api.model.ManagedRepository;
 import org.apache.archiva.rest.api.model.SearchRequest;
 import org.apache.archiva.rest.api.services.ManagedRepositoriesService;
 import org.apache.archiva.rest.api.services.SearchService;
index 8d2e92f5aa298b85c3f299eedfc1314358570c35..6187272e960a0055fe1b8071727a4450d1e05346 100644 (file)
@@ -367,10 +367,10 @@ public class AdministrationServiceImpl
 
         org.apache.archiva.admin.model.beans.ManagedRepository repository =
             new org.apache.archiva.admin.model.beans.ManagedRepository( repoId, name, location, layout,
-                                                                          snapshotsIncluded, releasesIncluded,
-                                                                          blockRedeployments, cronExpression, null,
-                                                                          false, daysOlder, retentionCount,
-                                                                          deleteReleasedSnapshots );
+                                                                        snapshotsIncluded, releasesIncluded,
+                                                                        blockRedeployments, cronExpression, null, false,
+                                                                        daysOlder, retentionCount,
+                                                                        deleteReleasedSnapshots, false );
         return managedRepositoryAdmin.addManagedRepository( repository, stageRepoNeeded, getAuditInformation() );
 
     }