mirror of https://github.com/apache/archiva.git
[MRM-1520] remove duplicate beans : fix for ManagedRepositoryAdmin
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1171190 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
c8ef0abdec
commit
44ebf70e2d
|
@ -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();
|
||||
}
|
||||
|
||||
|
|
|
@ -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 );
|
||||
}
|
||||
|
|
|
@ -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 )
|
||||
|
|
|
@ -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 );
|
||||
}
|
||||
|
|
|
@ -34,6 +34,12 @@
|
|||
|
||||
</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>
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
}
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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 );
|
||||
}
|
||||
|
||||
|
|
|
@ -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 );
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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 );
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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() );
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue