mirror of
https://github.com/apache/archiva.git
synced 2025-02-06 01:59:18 +00:00
[MRM-1504] Add a new module for repository administration management
split the repo admin in two modules : api and default implementation (to be able to more easily change the impl). Use the repo admin api consumers and indexing modules. git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1170135 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
5c067f2a4d
commit
919a5ac3eb
1
.gitignore
vendored
1
.gitignore
vendored
@ -15,3 +15,4 @@ archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/lib/
|
||||
archiva-modules/archiva-web/archiva-webapp-test/cargo-installs/
|
||||
*.ipr
|
||||
*.iws
|
||||
.DS_Store
|
||||
|
@ -19,13 +19,13 @@
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
|
||||
import org.apache.archiva.admin.model.managed.ManagedRepository;
|
||||
import org.apache.maven.archiva.consumers.AbstractMonitoredConsumer;
|
||||
import org.apache.maven.archiva.consumers.ConsumerException;
|
||||
import org.apache.maven.archiva.consumers.RepositoryContentConsumer;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* AbstractProgressConsumer
|
||||
*
|
||||
@ -37,13 +37,13 @@ public abstract class AbstractProgressConsumer
|
||||
{
|
||||
private int count = 0;
|
||||
|
||||
public void beginScan( ManagedRepositoryConfiguration repository, Date whenGathered )
|
||||
public void beginScan( ManagedRepository repository, Date whenGathered )
|
||||
throws ConsumerException
|
||||
{
|
||||
this.count = 0;
|
||||
}
|
||||
|
||||
public void beginScan( ManagedRepositoryConfiguration repository, Date whenGathered, boolean executeOnEntireRepo )
|
||||
public void beginScan( ManagedRepository repository, Date whenGathered, boolean executeOnEntireRepo )
|
||||
throws ConsumerException
|
||||
{
|
||||
beginScan( repository, whenGathered );
|
||||
|
@ -21,6 +21,7 @@
|
||||
|
||||
import com.sampullara.cli.Args;
|
||||
import com.sampullara.cli.Argument;
|
||||
import org.apache.archiva.admin.model.managed.ManagedRepository;
|
||||
import org.apache.archiva.common.plexusbridge.PlexusSisuBridge;
|
||||
import org.apache.archiva.common.plexusbridge.PlexusSisuBridgeException;
|
||||
import org.apache.archiva.repository.scanner.RepositoryScanStatistics;
|
||||
@ -165,7 +166,7 @@ private void doScan( String path, String[] consumers )
|
||||
WagonManager wagonManager = plexusSisuBridge.lookup( WagonManager.class );
|
||||
wagonManager.addMirror( "internal", "*", new File( path ).toURL().toExternalForm() );
|
||||
|
||||
ManagedRepositoryConfiguration repo = new ManagedRepositoryConfiguration();
|
||||
ManagedRepository repo = new ManagedRepository();
|
||||
repo.setId( "cliRepo" );
|
||||
repo.setName( "Archiva CLI Provided Repo" );
|
||||
repo.setLocation( path );
|
||||
|
@ -0,0 +1,39 @@
|
||||
package org.apache.maven.archiva.common;
|
||||
/*
|
||||
* 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 java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Olivier Lamy
|
||||
* @since 1.4
|
||||
*/
|
||||
public class FileTypeUtils
|
||||
{
|
||||
|
||||
/**
|
||||
* Default exclusions from artifact consumers that are using the file types. Note that this is simplistic in the
|
||||
* case of the support files (based on extension) as it is elsewhere - it may be better to match these to actual
|
||||
* artifacts and exclude later during scanning.
|
||||
*/
|
||||
public static final List<String> DEFAULT_EXCLUSIONS =
|
||||
Arrays.asList( "**/maven-metadata.xml", "**/maven-metadata-*.xml", "**/*.sha1", "**/*.asc", "**/*.md5",
|
||||
"**/*.pgp", "**/.index/**", "**/.indexer/**" );
|
||||
}
|
@ -22,6 +22,7 @@
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.apache.commons.collections.Predicate;
|
||||
import org.apache.commons.configuration.CombinedConfiguration;
|
||||
import org.apache.maven.archiva.common.FileTypeUtils;
|
||||
import org.apache.maven.archiva.configuration.functors.FiletypeSelectionPredicate;
|
||||
import org.apache.maven.archiva.configuration.io.registry.ConfigurationRegistryReader;
|
||||
import org.codehaus.plexus.registry.Registry;
|
||||
@ -77,10 +78,9 @@ public class FileTypes
|
||||
* Default exclusions from artifact consumers that are using the file types. Note that this is simplistic in the
|
||||
* case of the support files (based on extension) as it is elsewhere - it may be better to match these to actual
|
||||
* artifacts and exclude later during scanning.
|
||||
* @deprecated
|
||||
*/
|
||||
public static final List<String> DEFAULT_EXCLUSIONS =
|
||||
Arrays.asList( "**/maven-metadata.xml", "**/maven-metadata-*.xml", "**/*.sha1", "**/*.asc", "**/*.md5",
|
||||
"**/*.pgp", "**/.index/**", "**/.indexer/**" );
|
||||
public static final List<String> DEFAULT_EXCLUSIONS = FileTypeUtils.DEFAULT_EXCLUSIONS;
|
||||
|
||||
public void setArchivaConfiguration( ArchivaConfiguration archivaConfiguration )
|
||||
{
|
||||
|
@ -32,7 +32,11 @@
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.apache.archiva</groupId>
|
||||
<artifactId>archiva-configuration</artifactId>
|
||||
<artifactId>archiva-repository-admin-api</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.archiva</groupId>
|
||||
<artifactId>archiva-common</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>commons-collections</groupId>
|
||||
|
@ -19,13 +19,13 @@
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
import org.apache.maven.archiva.common.FileTypeUtils;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.maven.archiva.configuration.FileTypes;
|
||||
|
||||
/**
|
||||
* AbstractMonitoredConsumer
|
||||
*
|
||||
@ -101,7 +101,7 @@ public boolean isProcessUnmodified()
|
||||
|
||||
protected List<String> getDefaultArtifactExclusions()
|
||||
{
|
||||
return FileTypes.DEFAULT_EXCLUSIONS;
|
||||
return FileTypeUtils.DEFAULT_EXCLUSIONS;
|
||||
}
|
||||
|
||||
|
||||
|
@ -27,5 +27,5 @@
|
||||
public interface InvalidRepositoryContentConsumer
|
||||
extends RepositoryContentConsumer
|
||||
{
|
||||
|
||||
// no op
|
||||
}
|
||||
|
@ -19,7 +19,7 @@
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
|
||||
import org.apache.archiva.admin.model.managed.ManagedRepository;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
@ -60,7 +60,7 @@ public interface RepositoryContentConsumer
|
||||
* @param whenGathered the start of the repository scan
|
||||
* @throws ConsumerException if there was a problem with using the provided repository with the consumer.
|
||||
*/
|
||||
void beginScan( ManagedRepositoryConfiguration repository, Date whenGathered )
|
||||
void beginScan( ManagedRepository repository, Date whenGathered )
|
||||
throws ConsumerException;
|
||||
|
||||
/**
|
||||
@ -73,9 +73,9 @@ void beginScan( ManagedRepositoryConfiguration repository, Date whenGathered )
|
||||
* @param whenGathered the start of the repository scan
|
||||
* @param executeOnEntireRepo flags whether the consumer will be executed on an entire repository or just on a specific resource
|
||||
* @throws ConsumerException if there was a problem with using the provided repository with the consumer.
|
||||
* @see RepositoryContentConsumer#beginScan(org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration, java.util.Date)
|
||||
* @see RepositoryContentConsumer#beginScan(ManagedRepository, java.util.Date)
|
||||
*/
|
||||
void beginScan( ManagedRepositoryConfiguration repository, Date whenGathered, boolean executeOnEntireRepo )
|
||||
void beginScan( ManagedRepository repository, Date whenGathered, boolean executeOnEntireRepo )
|
||||
throws ConsumerException;
|
||||
|
||||
/**
|
||||
|
@ -44,6 +44,10 @@
|
||||
<groupId>org.apache.archiva</groupId>
|
||||
<artifactId>archiva-consumer-api</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.archiva</groupId>
|
||||
<artifactId>archiva-repository-admin-api</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.archiva</groupId>
|
||||
<artifactId>archiva-repository-layer</artifactId>
|
||||
@ -84,10 +88,36 @@
|
||||
<artifactId>mockito-all</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.archiva</groupId>
|
||||
<artifactId>archiva-repository-admin-default</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.codehaus.redback</groupId>
|
||||
<artifactId>redback-rbac-cached</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.derby</groupId>
|
||||
<artifactId>derby</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<build>
|
||||
<pluginManagement>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<configuration>
|
||||
<systemPropertyVariables>
|
||||
<appserver.base>${basedir}/target/appserver-base</appserver.base>
|
||||
<plexus.home>${project.build.outputDirectory}</plexus.home>
|
||||
<java.io.tmpdir>${project.build.outputDirectory}</java.io.tmpdir>
|
||||
</systemPropertyVariables>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.rat</groupId>
|
||||
<artifactId>apache-rat-plugin</artifactId>
|
||||
|
@ -19,12 +19,12 @@
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
import org.apache.archiva.admin.model.managed.ManagedRepository;
|
||||
import org.apache.archiva.checksum.ChecksumAlgorithm;
|
||||
import org.apache.archiva.checksum.ChecksummedFile;
|
||||
import org.apache.maven.archiva.configuration.ArchivaConfiguration;
|
||||
import org.apache.maven.archiva.configuration.ConfigurationNames;
|
||||
import org.apache.maven.archiva.configuration.FileTypes;
|
||||
import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
|
||||
import org.apache.maven.archiva.consumers.AbstractMonitoredConsumer;
|
||||
import org.apache.maven.archiva.consumers.ConsumerException;
|
||||
import org.apache.maven.archiva.consumers.KnownRepositoryContentConsumer;
|
||||
@ -96,13 +96,13 @@ public boolean isPermanent()
|
||||
return false;
|
||||
}
|
||||
|
||||
public void beginScan( ManagedRepositoryConfiguration repo, Date whenGathered )
|
||||
public void beginScan( ManagedRepository repo, Date whenGathered )
|
||||
throws ConsumerException
|
||||
{
|
||||
this.repositoryDir = new File( repo.getLocation() );
|
||||
}
|
||||
|
||||
public void beginScan( ManagedRepositoryConfiguration repo, Date whenGathered, boolean executeOnEntireRepo )
|
||||
public void beginScan( ManagedRepository repo, Date whenGathered, boolean executeOnEntireRepo )
|
||||
throws ConsumerException
|
||||
{
|
||||
beginScan( repo, whenGathered );
|
||||
|
@ -19,12 +19,10 @@
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.archiva.admin.model.managed.ManagedRepository;
|
||||
import org.apache.maven.archiva.configuration.ArchivaConfiguration;
|
||||
import org.apache.maven.archiva.configuration.ConfigurationNames;
|
||||
import org.apache.maven.archiva.configuration.FileTypes;
|
||||
import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
|
||||
import org.apache.maven.archiva.consumers.AbstractMonitoredConsumer;
|
||||
import org.apache.maven.archiva.consumers.ConsumerException;
|
||||
import org.apache.maven.archiva.consumers.KnownRepositoryContentConsumer;
|
||||
@ -92,13 +90,13 @@ public boolean isPermanent()
|
||||
return false;
|
||||
}
|
||||
|
||||
public void beginScan( ManagedRepositoryConfiguration repository, Date whenGathered )
|
||||
public void beginScan( ManagedRepository repository, Date whenGathered )
|
||||
throws ConsumerException
|
||||
{
|
||||
this.repositoryDir = new File( repository.getLocation() );
|
||||
}
|
||||
|
||||
public void beginScan( ManagedRepositoryConfiguration repository, Date whenGathered, boolean executeOnEntireRepo )
|
||||
public void beginScan( ManagedRepository repository, Date whenGathered, boolean executeOnEntireRepo )
|
||||
throws ConsumerException
|
||||
{
|
||||
beginScan( repository, whenGathered );
|
||||
|
@ -19,8 +19,8 @@
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
import org.apache.archiva.admin.model.managed.ManagedRepository;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
|
||||
import org.apache.maven.archiva.consumers.AbstractMonitoredConsumer;
|
||||
import org.apache.maven.archiva.consumers.ConsumerException;
|
||||
import org.apache.maven.archiva.consumers.KnownRepositoryContentConsumer;
|
||||
@ -91,13 +91,13 @@ public boolean isPermanent()
|
||||
return false;
|
||||
}
|
||||
|
||||
public void beginScan( ManagedRepositoryConfiguration repository, Date whenGathered )
|
||||
public void beginScan( ManagedRepository repository, Date whenGathered )
|
||||
throws ConsumerException
|
||||
{
|
||||
this.repositoryDir = new File( repository.getLocation() );
|
||||
}
|
||||
|
||||
public void beginScan( ManagedRepositoryConfiguration repository, Date whenGathered, boolean executeOnEntireRepo )
|
||||
public void beginScan( ManagedRepository repository, Date whenGathered, boolean executeOnEntireRepo )
|
||||
throws ConsumerException
|
||||
{
|
||||
beginScan( repository, whenGathered );
|
||||
|
@ -19,16 +19,10 @@
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.archiva.admin.model.managed.ManagedRepository;
|
||||
import org.apache.maven.archiva.configuration.ArchivaConfiguration;
|
||||
import org.apache.maven.archiva.configuration.ConfigurationNames;
|
||||
import org.apache.maven.archiva.configuration.FileTypes;
|
||||
import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
|
||||
import org.apache.maven.archiva.consumers.AbstractMonitoredConsumer;
|
||||
import org.apache.maven.archiva.consumers.ConsumerException;
|
||||
import org.apache.maven.archiva.consumers.KnownRepositoryContentConsumer;
|
||||
@ -52,6 +46,11 @@
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.inject.Inject;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* MetadataUpdaterConsumer will create and update the metadata present within the repository.
|
||||
@ -129,7 +128,7 @@ public void setIncludes( List<String> includes )
|
||||
this.includes = includes;
|
||||
}
|
||||
|
||||
public void beginScan( ManagedRepositoryConfiguration repoConfig, Date whenGathered )
|
||||
public void beginScan( ManagedRepository repoConfig, Date whenGathered )
|
||||
throws ConsumerException
|
||||
{
|
||||
try
|
||||
@ -148,7 +147,7 @@ public void beginScan( ManagedRepositoryConfiguration repoConfig, Date whenGathe
|
||||
}
|
||||
}
|
||||
|
||||
public void beginScan( ManagedRepositoryConfiguration repository, Date whenGathered, boolean executeOnEntireRepo )
|
||||
public void beginScan( ManagedRepository repository, Date whenGathered, boolean executeOnEntireRepo )
|
||||
throws ConsumerException
|
||||
{
|
||||
beginScan( repository, whenGathered );
|
||||
|
@ -19,10 +19,10 @@
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
import org.apache.archiva.admin.model.managed.ManagedRepository;
|
||||
import org.apache.archiva.common.plexusbridge.DigesterUtils;
|
||||
import org.apache.archiva.common.plexusbridge.PlexusSisuBridge;
|
||||
import org.apache.archiva.common.plexusbridge.PlexusSisuBridgeException;
|
||||
import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
|
||||
import org.apache.maven.archiva.consumers.AbstractMonitoredConsumer;
|
||||
import org.apache.maven.archiva.consumers.ConsumerException;
|
||||
import org.apache.maven.archiva.consumers.KnownRepositoryContentConsumer;
|
||||
@ -39,7 +39,6 @@
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@ -106,13 +105,13 @@ public boolean isPermanent()
|
||||
return false;
|
||||
}
|
||||
|
||||
public void beginScan( ManagedRepositoryConfiguration repository, Date whenGathered )
|
||||
public void beginScan( ManagedRepository repository, Date whenGathered )
|
||||
throws ConsumerException
|
||||
{
|
||||
this.repositoryDir = new File( repository.getLocation() );
|
||||
}
|
||||
|
||||
public void beginScan( ManagedRepositoryConfiguration repository, Date whenGathered, boolean executeOnEntireRepo )
|
||||
public void beginScan( ManagedRepository repository, Date whenGathered, boolean executeOnEntireRepo )
|
||||
throws ConsumerException
|
||||
{
|
||||
beginScan( repository, whenGathered );
|
||||
|
@ -19,13 +19,14 @@
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
import org.apache.archiva.admin.model.RepositoryAdminException;
|
||||
import org.apache.archiva.admin.model.managed.ManagedRepository;
|
||||
import org.apache.archiva.admin.model.managed.ManagedRepositoryAdmin;
|
||||
import org.apache.archiva.metadata.repository.MetadataRepository;
|
||||
import org.apache.archiva.metadata.repository.RepositorySession;
|
||||
import org.apache.archiva.repository.events.RepositoryListener;
|
||||
import org.apache.maven.archiva.common.utils.VersionComparator;
|
||||
import org.apache.maven.archiva.common.utils.VersionUtil;
|
||||
import org.apache.maven.archiva.configuration.ArchivaConfiguration;
|
||||
import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
|
||||
import org.apache.maven.archiva.model.ArchivaArtifact;
|
||||
import org.apache.maven.archiva.model.ArtifactReference;
|
||||
import org.apache.maven.archiva.model.ProjectReference;
|
||||
@ -50,7 +51,7 @@
|
||||
* This will look in a single managed repository, and purge any snapshots that are present
|
||||
* that have a corresponding released version on the same repository.
|
||||
* </p>
|
||||
*
|
||||
* <p/>
|
||||
* <p>
|
||||
* So, if you have the following (presented in the m2/default layout form) ...
|
||||
* <pre>
|
||||
@ -74,19 +75,19 @@ public class CleanupReleasedSnapshotsRepositoryPurge
|
||||
{
|
||||
private MetadataTools metadataTools;
|
||||
|
||||
private ArchivaConfiguration archivaConfig;
|
||||
private ManagedRepositoryAdmin managedRepositoryAdmin;
|
||||
|
||||
private RepositoryContentFactory repoContentFactory;
|
||||
|
||||
public CleanupReleasedSnapshotsRepositoryPurge( ManagedRepositoryContent repository, MetadataTools metadataTools,
|
||||
ArchivaConfiguration archivaConfig,
|
||||
ManagedRepositoryAdmin managedRepositoryAdmin,
|
||||
RepositoryContentFactory repoContentFactory,
|
||||
RepositorySession repositorySession,
|
||||
List<RepositoryListener> listeners )
|
||||
{
|
||||
super( repository, repositorySession, listeners );
|
||||
this.metadataTools = metadataTools;
|
||||
this.archivaConfig = archivaConfig;
|
||||
this.managedRepositoryAdmin = managedRepositoryAdmin;
|
||||
this.repoContentFactory = repoContentFactory;
|
||||
}
|
||||
|
||||
@ -118,15 +119,15 @@ public void process( String path )
|
||||
// Gather up all of the versions.
|
||||
List<String> allVersions = new ArrayList<String>( repository.getVersions( reference ) );
|
||||
|
||||
List<ManagedRepositoryConfiguration> repos = archivaConfig.getConfiguration().getManagedRepositories();
|
||||
for ( ManagedRepositoryConfiguration repo : repos )
|
||||
List<ManagedRepository> repos = managedRepositoryAdmin.getManagedRepositories();
|
||||
for ( ManagedRepository repo : repos )
|
||||
{
|
||||
if ( repo.isReleases() && !repo.getId().equals( repository.getId() ) )
|
||||
{
|
||||
try
|
||||
{
|
||||
ManagedRepositoryContent repoContent = repoContentFactory.getManagedRepositoryContent(
|
||||
repo.getId() );
|
||||
ManagedRepositoryContent repoContent =
|
||||
repoContentFactory.getManagedRepositoryContent( repo.getId() );
|
||||
allVersions.addAll( repoContent.getVersions( reference ) );
|
||||
}
|
||||
catch ( RepositoryNotFoundException e )
|
||||
@ -167,9 +168,9 @@ public void process( String path )
|
||||
versionRef.setGroupId( artifactRef.getGroupId() );
|
||||
versionRef.setArtifactId( artifactRef.getArtifactId() );
|
||||
|
||||
ArchivaArtifact artifact = new ArchivaArtifact( artifactRef.getGroupId(), artifactRef.getArtifactId(),
|
||||
artifactRef.getVersion(), artifactRef.getClassifier(),
|
||||
artifactRef.getType(), repository.getId() );
|
||||
ArchivaArtifact artifact =
|
||||
new ArchivaArtifact( artifactRef.getGroupId(), artifactRef.getArtifactId(), artifactRef.getVersion(),
|
||||
artifactRef.getClassifier(), artifactRef.getType(), repository.getId() );
|
||||
|
||||
MetadataRepository metadataRepository = repositorySession.getRepository();
|
||||
for ( String version : snapshotVersions )
|
||||
@ -195,6 +196,9 @@ public void process( String path )
|
||||
{
|
||||
updateMetadata( artifactRef );
|
||||
}
|
||||
} catch ( RepositoryAdminException e )
|
||||
{
|
||||
throw new RepositoryPurgeException( e.getMessage(), e );
|
||||
}
|
||||
catch ( LayoutException e )
|
||||
{
|
||||
|
@ -19,13 +19,14 @@
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
import org.apache.archiva.admin.model.managed.ManagedRepository;
|
||||
import org.apache.archiva.admin.model.managed.ManagedRepositoryAdmin;
|
||||
import org.apache.archiva.metadata.repository.RepositorySession;
|
||||
import org.apache.archiva.metadata.repository.RepositorySessionFactory;
|
||||
import org.apache.archiva.repository.events.RepositoryListener;
|
||||
import org.apache.maven.archiva.configuration.ArchivaConfiguration;
|
||||
import org.apache.maven.archiva.configuration.ConfigurationNames;
|
||||
import org.apache.maven.archiva.configuration.FileTypes;
|
||||
import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
|
||||
import org.apache.maven.archiva.consumers.AbstractMonitoredConsumer;
|
||||
import org.apache.maven.archiva.consumers.ConsumerException;
|
||||
import org.apache.maven.archiva.consumers.KnownRepositoryContentConsumer;
|
||||
@ -36,7 +37,6 @@
|
||||
import org.apache.maven.archiva.repository.metadata.MetadataTools;
|
||||
import org.codehaus.plexus.registry.Registry;
|
||||
import org.codehaus.plexus.registry.RegistryListener;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.annotation.Scope;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@ -75,11 +75,14 @@ public class RepositoryPurgeConsumer
|
||||
@Named( value = "archivaConfiguration#default" )
|
||||
private ArchivaConfiguration configuration;
|
||||
|
||||
@Inject
|
||||
private ManagedRepositoryAdmin managedRepositoryAdmin;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@Inject
|
||||
@Named(value = "repositoryContentFactory#default")
|
||||
@Named( value = "repositoryContentFactory#default" )
|
||||
private RepositoryContentFactory repositoryContentFactory;
|
||||
|
||||
/**
|
||||
@ -92,7 +95,7 @@ public class RepositoryPurgeConsumer
|
||||
*
|
||||
*/
|
||||
@Inject
|
||||
@Named(value = "fileTypes")
|
||||
@Named( value = "fileTypes" )
|
||||
private FileTypes filetypes;
|
||||
|
||||
private List<String> includes = new ArrayList<String>();
|
||||
@ -111,7 +114,6 @@ public class RepositoryPurgeConsumer
|
||||
|
||||
/**
|
||||
* TODO: this could be multiple implementations and needs to be configured.
|
||||
*
|
||||
*/
|
||||
@Inject
|
||||
private RepositorySessionFactory repositorySessionFactory;
|
||||
@ -143,7 +145,7 @@ public List<String> getIncludes()
|
||||
return this.includes;
|
||||
}
|
||||
|
||||
public void beginScan( ManagedRepositoryConfiguration repository, Date whenGathered )
|
||||
public void beginScan( ManagedRepository repository, Date whenGathered )
|
||||
throws ConsumerException
|
||||
{
|
||||
ManagedRepositoryContent repositoryContent;
|
||||
@ -174,13 +176,13 @@ public void beginScan( ManagedRepositoryConfiguration repository, Date whenGathe
|
||||
listeners );
|
||||
}
|
||||
|
||||
cleanUp = new CleanupReleasedSnapshotsRepositoryPurge( repositoryContent, metadataTools, configuration,
|
||||
cleanUp = new CleanupReleasedSnapshotsRepositoryPurge( repositoryContent, metadataTools, managedRepositoryAdmin,
|
||||
repositoryContentFactory, repositorySession, listeners );
|
||||
|
||||
deleteReleasedSnapshots = repository.isDeleteReleasedSnapshots();
|
||||
}
|
||||
|
||||
public void beginScan( ManagedRepositoryConfiguration repository, Date whenGathered, boolean executeOnEntireRepo )
|
||||
public void beginScan( ManagedRepository repository, Date whenGathered, boolean executeOnEntireRepo )
|
||||
throws ConsumerException
|
||||
{
|
||||
beginScan( repository, whenGathered );
|
||||
|
@ -0,0 +1,185 @@
|
||||
package org.apache.archiva.metadata.repository;
|
||||
|
||||
/*
|
||||
* 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.archiva.metadata.model.ArtifactMetadata;
|
||||
import org.apache.archiva.metadata.model.MetadataFacet;
|
||||
import org.apache.archiva.metadata.model.ProjectMetadata;
|
||||
import org.apache.archiva.metadata.model.ProjectVersionMetadata;
|
||||
import org.apache.archiva.metadata.model.ProjectVersionReference;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
public class TestMetadataRepository
|
||||
implements MetadataRepository
|
||||
{
|
||||
public ProjectMetadata getProject( String repoId, String namespace, String projectId )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public ProjectVersionMetadata getProjectVersion( String repoId, String namespace, String projectId,
|
||||
String projectVersion )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public Collection<String> getArtifactVersions( String repoId, String namespace, String projectId,
|
||||
String projectVersion )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public Collection<ProjectVersionReference> getProjectReferences( String repoId, String namespace, String projectId,
|
||||
String projectVersion )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public Collection<String> getRootNamespaces( String repoId )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public Collection<String> getNamespaces( String repoId, String namespace )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public Collection<String> getProjects( String repoId, String namespace )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public Collection<String> getProjectVersions( String repoId, String namespace, String projectId )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public void updateProject( String repoId, ProjectMetadata project )
|
||||
{
|
||||
}
|
||||
|
||||
public void updateArtifact( String repoId, String namespace, String projectId, String projectVersion,
|
||||
ArtifactMetadata artifactMeta )
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void updateProjectVersion( String repoId, String namespace, String projectId,
|
||||
ProjectVersionMetadata versionMetadata )
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void updateNamespace( String repoId, String namespace )
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public List<String> getMetadataFacets( String repodId, String facetId )
|
||||
{
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
public MetadataFacet getMetadataFacet( String repositoryId, String facetId, String name )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public void addMetadataFacet( String repositoryId, MetadataFacet metadataFacet )
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void removeMetadataFacets( String repositoryId, String facetId )
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void removeMetadataFacet( String repoId, String facetId, String name )
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public List<ArtifactMetadata> getArtifactsByDateRange( String repoId, Date startTime, Date endTime )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public Collection<String> getRepositories()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public List<ArtifactMetadata> getArtifactsByChecksum( String repoId, String checksum )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public void removeArtifact( String repositoryId, String namespace, String project, String version, String id )
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void removeRepository( String repoId )
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public Collection<ArtifactMetadata> getArtifacts( String repoId, String namespace, String projectId,
|
||||
String projectVersion )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public void save()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void close()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void revert()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public boolean canObtainAccess( Class<?> aClass )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public Object obtainAccess( Class<?> aClass )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public List<ArtifactMetadata> getArtifacts( String repositoryId )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
@ -20,7 +20,7 @@
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
@Service("repositorySessionFactory#test")
|
||||
@Service( "repositorySessionFactory#test" )
|
||||
public class TestRepositorySessionFactory
|
||||
implements RepositorySessionFactory
|
||||
{
|
||||
@ -30,7 +30,14 @@ public class TestRepositorySessionFactory
|
||||
|
||||
public RepositorySession createSession()
|
||||
{
|
||||
return new RepositorySession( repository, resolver );
|
||||
return new RepositorySession( new TestMetadataRepository(), resolver )
|
||||
{
|
||||
@Override
|
||||
public void close()
|
||||
{
|
||||
return;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
public void setRepository( MetadataRepository repository )
|
||||
|
@ -1,9 +1,9 @@
|
||||
package org.apache.maven.archiva.consumers.core;
|
||||
|
||||
import org.apache.archiva.admin.model.managed.ManagedRepository;
|
||||
import org.apache.archiva.checksum.ChecksumAlgorithm;
|
||||
import org.apache.archiva.checksum.ChecksummedFile;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
|
||||
import org.apache.maven.archiva.consumers.KnownRepositoryContentConsumer;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
@ -33,7 +33,7 @@
|
||||
public class ArtifactMissingChecksumsConsumerTest
|
||||
extends AbstractArtifactConsumerTest
|
||||
{
|
||||
private ManagedRepositoryConfiguration repoConfig;
|
||||
private ManagedRepository repoConfig;
|
||||
|
||||
@Before
|
||||
public void setUp()
|
||||
@ -41,7 +41,7 @@ public void setUp()
|
||||
{
|
||||
super.setUp();
|
||||
|
||||
repoConfig = new ManagedRepositoryConfiguration();
|
||||
repoConfig = new ManagedRepository();
|
||||
repoConfig.setId( "test-repo" );
|
||||
repoConfig.setName( "Test Repository" );
|
||||
repoConfig.setLayout( "default" );
|
||||
|
@ -20,6 +20,7 @@
|
||||
*/
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import org.apache.archiva.admin.model.managed.ManagedRepository;
|
||||
import org.apache.archiva.metadata.repository.MetadataRepository;
|
||||
import org.apache.archiva.metadata.repository.RepositorySession;
|
||||
import org.apache.archiva.repository.events.RepositoryListener;
|
||||
@ -76,7 +77,7 @@ public abstract class AbstractRepositoryPurgeTest
|
||||
|
||||
protected static final String RELEASES_TEST_REPO_NAME = "Releases Test Repo One";
|
||||
|
||||
private ManagedRepositoryConfiguration config;
|
||||
private ManagedRepository config;
|
||||
|
||||
private ManagedRepositoryContent repo;
|
||||
|
||||
@ -117,9 +118,9 @@ public void tearDown()
|
||||
repo = null;
|
||||
}
|
||||
|
||||
public ManagedRepositoryConfiguration getRepoConfiguration( String repoId, String repoName )
|
||||
public ManagedRepository getRepoConfiguration( String repoId, String repoName )
|
||||
{
|
||||
config = new ManagedRepositoryConfiguration();
|
||||
config = new ManagedRepository();
|
||||
config.setId( repoId );
|
||||
config.setName( repoName );
|
||||
config.setDaysOlder( TEST_DAYS_OLDER );
|
||||
|
@ -19,10 +19,11 @@
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
import org.apache.archiva.admin.model.managed.ManagedRepositoryAdmin;
|
||||
import org.apache.archiva.admin.repository.managed.DefaultManagedRepositoryAdmin;
|
||||
import org.apache.archiva.repository.events.RepositoryListener;
|
||||
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.repository.RepositoryContentFactory;
|
||||
import org.apache.maven.archiva.repository.metadata.MetadataTools;
|
||||
import org.custommonkey.xmlunit.XMLAssert;
|
||||
@ -67,7 +68,8 @@ public void setUp()
|
||||
super.setUp();
|
||||
|
||||
RepositoryContentFactory factory =
|
||||
applicationContext.getBean( "repositoryContentFactory#cleanup-released-snapshots", RepositoryContentFactory.class );
|
||||
applicationContext.getBean( "repositoryContentFactory#cleanup-released-snapshots",
|
||||
RepositoryContentFactory.class );
|
||||
|
||||
archivaConfiguration =
|
||||
applicationContext.getBean( "archivaConfiguration#cleanup-released-snapshots", ArchivaConfiguration.class );
|
||||
@ -76,18 +78,28 @@ public void setUp()
|
||||
|
||||
listener = (RepositoryListener) listenerControl.getMock();
|
||||
List<RepositoryListener> listeners = Collections.singletonList( listener );
|
||||
repoPurge =
|
||||
new CleanupReleasedSnapshotsRepositoryPurge( getRepository(), metadataTools, archivaConfiguration, factory,
|
||||
repositorySession, listeners );
|
||||
repoPurge = new CleanupReleasedSnapshotsRepositoryPurge( getRepository(), metadataTools,
|
||||
applicationContext.getBean(
|
||||
ManagedRepositoryAdmin.class ), factory,
|
||||
repositorySession, listeners );
|
||||
|
||||
( (DefaultManagedRepositoryAdmin) applicationContext.getBean(
|
||||
ManagedRepositoryAdmin.class ) ).setArchivaConfiguration( archivaConfiguration );
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testReleasedSnapshotsExistsInSameRepo()
|
||||
throws Exception
|
||||
{
|
||||
Configuration config = archivaConfiguration.getConfiguration();
|
||||
config.removeManagedRepository( config.findManagedRepositoryById( TEST_REPO_ID ) );
|
||||
config.addManagedRepository( getRepoConfiguration( TEST_REPO_ID, TEST_REPO_NAME ) );
|
||||
/**
|
||||
Configuration config = archivaConfiguration.getConfiguration();
|
||||
config.removeManagedRepository( config.findManagedRepositoryById( TEST_REPO_ID ) );
|
||||
config.addManagedRepository( getRepoConfiguration( TEST_REPO_ID, TEST_REPO_NAME ) );
|
||||
**/
|
||||
|
||||
applicationContext.getBean( ManagedRepositoryAdmin.class ).deleteManagedRepository( TEST_REPO_ID, null, false );
|
||||
applicationContext.getBean( ManagedRepositoryAdmin.class ).addManagedRepository(
|
||||
getRepoConfiguration( TEST_REPO_ID, TEST_REPO_NAME ), false, null );
|
||||
|
||||
String repoRoot = prepareTestRepos();
|
||||
|
||||
@ -142,9 +154,13 @@ public void testReleasedSnapshotsExistsInSameRepo()
|
||||
public void testNonArtifactFile()
|
||||
throws Exception
|
||||
{
|
||||
Configuration config = archivaConfiguration.getConfiguration();
|
||||
/*Configuration config = archivaConfiguration.getConfiguration();
|
||||
config.removeManagedRepository( config.findManagedRepositoryById( TEST_REPO_ID ) );
|
||||
config.addManagedRepository( getRepoConfiguration( TEST_REPO_ID, TEST_REPO_NAME ) );
|
||||
config.addManagedRepository( getRepoConfiguration( TEST_REPO_ID, TEST_REPO_NAME ) );*/
|
||||
|
||||
applicationContext.getBean( ManagedRepositoryAdmin.class ).deleteManagedRepository( TEST_REPO_ID, null, false );
|
||||
applicationContext.getBean( ManagedRepositoryAdmin.class ).addManagedRepository(
|
||||
getRepoConfiguration( TEST_REPO_ID, TEST_REPO_NAME ), false, null );
|
||||
|
||||
String repoRoot = prepareTestRepos();
|
||||
|
||||
@ -152,7 +168,7 @@ public void testNonArtifactFile()
|
||||
listenerControl.replay();
|
||||
|
||||
File file = new File( repoRoot, INDEX_PATH );
|
||||
if (!file.exists())
|
||||
if ( !file.exists() )
|
||||
{
|
||||
// help windauze to create directory with .
|
||||
file.getParentFile().mkdirs();
|
||||
@ -171,10 +187,18 @@ public void testNonArtifactFile()
|
||||
public void testReleasedSnapshotsExistsInDifferentRepo()
|
||||
throws Exception
|
||||
{
|
||||
/*
|
||||
Configuration config = archivaConfiguration.getConfiguration();
|
||||
config.removeManagedRepository( config.findManagedRepositoryById( TEST_REPO_ID ) );
|
||||
config.addManagedRepository( getRepoConfiguration( TEST_REPO_ID, TEST_REPO_NAME ) );
|
||||
config.addManagedRepository( getRepoConfiguration( RELEASES_TEST_REPO_ID, RELEASES_TEST_REPO_NAME ) );
|
||||
*/
|
||||
applicationContext.getBean( ManagedRepositoryAdmin.class ).deleteManagedRepository( TEST_REPO_ID, null, false );
|
||||
applicationContext.getBean( ManagedRepositoryAdmin.class ).addManagedRepository(
|
||||
getRepoConfiguration( TEST_REPO_ID, TEST_REPO_NAME ), false, null );
|
||||
|
||||
applicationContext.getBean( ManagedRepositoryAdmin.class ).addManagedRepository(
|
||||
getRepoConfiguration( RELEASES_TEST_REPO_ID, RELEASES_TEST_REPO_NAME ), false, null );
|
||||
|
||||
String repoRoot = prepareTestRepos();
|
||||
|
||||
@ -217,9 +241,14 @@ public void testReleasedSnapshotsExistsInDifferentRepo()
|
||||
public void testHigherSnapshotExistsInSameRepo()
|
||||
throws Exception
|
||||
{
|
||||
/*
|
||||
Configuration config = archivaConfiguration.getConfiguration();
|
||||
config.removeManagedRepository( config.findManagedRepositoryById( TEST_REPO_ID ) );
|
||||
config.addManagedRepository( getRepoConfiguration( TEST_REPO_ID, TEST_REPO_NAME ) );
|
||||
*/
|
||||
applicationContext.getBean( ManagedRepositoryAdmin.class ).deleteManagedRepository( TEST_REPO_ID, null, false );
|
||||
applicationContext.getBean( ManagedRepositoryAdmin.class ).addManagedRepository(
|
||||
getRepoConfiguration( TEST_REPO_ID, TEST_REPO_NAME ), false, null );
|
||||
|
||||
String repoRoot = prepareTestRepos();
|
||||
|
||||
|
@ -19,6 +19,7 @@
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
import org.apache.archiva.admin.model.managed.ManagedRepository;
|
||||
import org.apache.archiva.repository.events.RepositoryListener;
|
||||
import org.apache.commons.lang.time.DateUtils;
|
||||
import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
|
||||
@ -52,7 +53,7 @@ private void setLastModified( String dirPath, long lastModified )
|
||||
public void testByLastModified()
|
||||
throws Exception
|
||||
{
|
||||
ManagedRepositoryConfiguration repoConfiguration = getRepoConfiguration( TEST_REPO_ID, TEST_REPO_NAME );
|
||||
ManagedRepository repoConfiguration = getRepoConfiguration( TEST_REPO_ID, TEST_REPO_NAME );
|
||||
repoPurge = new DaysOldRepositoryPurge( getRepository(), repoConfiguration.getDaysOlder(),
|
||||
repoConfiguration.getRetentionCount(), repositorySession,
|
||||
Collections.singletonList( listener ) );
|
||||
@ -114,7 +115,7 @@ public void testByLastModified()
|
||||
public void testOrderOfDeletion()
|
||||
throws Exception
|
||||
{
|
||||
ManagedRepositoryConfiguration repoConfiguration = getRepoConfiguration( TEST_REPO_ID, TEST_REPO_NAME );
|
||||
ManagedRepository repoConfiguration = getRepoConfiguration( TEST_REPO_ID, TEST_REPO_NAME );
|
||||
List<RepositoryListener> listeners = Collections.singletonList( listener );
|
||||
repoPurge = new DaysOldRepositoryPurge( getRepository(), repoConfiguration.getDaysOlder(),
|
||||
repoConfiguration.getRetentionCount(), repositorySession, listeners );
|
||||
@ -165,7 +166,7 @@ public void testOrderOfDeletion()
|
||||
public void testMetadataDrivenSnapshots()
|
||||
throws Exception
|
||||
{
|
||||
ManagedRepositoryConfiguration repoConfiguration = getRepoConfiguration( TEST_REPO_ID, TEST_REPO_NAME );
|
||||
ManagedRepository repoConfiguration = getRepoConfiguration( TEST_REPO_ID, TEST_REPO_NAME );
|
||||
List<RepositoryListener> listeners = Collections.singletonList( listener );
|
||||
repoPurge = new DaysOldRepositoryPurge( getRepository(), repoConfiguration.getDaysOlder(),
|
||||
repoConfiguration.getRetentionCount(), repositorySession, listeners );
|
||||
|
@ -19,14 +19,15 @@
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
import org.apache.archiva.admin.model.managed.ManagedRepository;
|
||||
import org.apache.archiva.admin.model.managed.ManagedRepositoryAdmin;
|
||||
import org.apache.archiva.admin.repository.managed.DefaultManagedRepositoryAdmin;
|
||||
import org.apache.archiva.metadata.repository.TestRepositorySessionFactory;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.apache.maven.archiva.common.utils.BaseFile;
|
||||
import org.apache.maven.archiva.configuration.ArchivaConfiguration;
|
||||
import org.apache.maven.archiva.configuration.Configuration;
|
||||
import org.apache.maven.archiva.configuration.FileType;
|
||||
import org.apache.maven.archiva.configuration.FileTypes;
|
||||
import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
|
||||
import org.apache.maven.archiva.consumers.KnownRepositoryContentConsumer;
|
||||
import org.apache.maven.archiva.consumers.functors.ConsumerWantsFilePredicate;
|
||||
import org.custommonkey.xmlunit.XMLAssert;
|
||||
@ -43,6 +44,16 @@
|
||||
public class RepositoryPurgeConsumerTest
|
||||
extends AbstractRepositoryPurgeTest
|
||||
{
|
||||
@Before
|
||||
public void setUp()
|
||||
throws Exception
|
||||
{
|
||||
super.setUp();
|
||||
|
||||
TestRepositorySessionFactory factory = applicationContext.getBean( TestRepositorySessionFactory.class );
|
||||
factory.setRepository( metadataRepository );
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testConsumption()
|
||||
throws Exception
|
||||
@ -117,7 +128,7 @@ public void testConsumerByRetentionCount()
|
||||
applicationContext.getBean( "knownRepositoryContentConsumer#repo-purge-consumer-by-retention-count",
|
||||
KnownRepositoryContentConsumer.class );
|
||||
|
||||
ManagedRepositoryConfiguration repoConfiguration = getRepoConfiguration( TEST_REPO_ID, TEST_REPO_NAME );
|
||||
ManagedRepository repoConfiguration = getRepoConfiguration( TEST_REPO_ID, TEST_REPO_NAME );
|
||||
repoConfiguration.setDaysOlder( 0 ); // force days older off to allow retention count purge to execute.
|
||||
repoConfiguration.setRetentionCount( TEST_RETENTION_COUNT );
|
||||
addRepoToConfiguration( "retention-count", repoConfiguration );
|
||||
@ -163,32 +174,51 @@ public void testConsumerByRetentionCount()
|
||||
removeRepoFromConfiguration( "retention-count", repoConfiguration );
|
||||
}
|
||||
|
||||
private void addRepoToConfiguration( String configHint, ManagedRepositoryConfiguration repoConfiguration )
|
||||
private void addRepoToConfiguration( String configHint, ManagedRepository repoConfiguration )
|
||||
throws Exception
|
||||
{
|
||||
ArchivaConfiguration archivaConfiguration =
|
||||
applicationContext.getBean( "archivaConfiguration#" + configHint, ArchivaConfiguration.class );
|
||||
Configuration configuration = archivaConfiguration.getConfiguration();
|
||||
ManagedRepositoryConfiguration managedRepositoryConfiguration =
|
||||
configuration.findManagedRepositoryById( repoConfiguration.getId() );
|
||||
if ( managedRepositoryConfiguration != null )
|
||||
( (DefaultManagedRepositoryAdmin) applicationContext.getBean(
|
||||
ManagedRepositoryAdmin.class ) ).setArchivaConfiguration( archivaConfiguration );
|
||||
/**
|
||||
Configuration configuration = archivaConfiguration.getConfiguration();
|
||||
ManagedRepositoryConfiguration managedRepositoryConfiguration =
|
||||
configuration.findManagedRepositoryById( repoConfiguration.getId() );
|
||||
if ( managedRepositoryConfiguration != null )
|
||||
{
|
||||
configuration.removeManagedRepository( managedRepositoryConfiguration );
|
||||
}
|
||||
configuration.addManagedRepository( repoConfiguration );
|
||||
**/
|
||||
ManagedRepositoryAdmin managedRepositoryAdmin = applicationContext.getBean( ManagedRepositoryAdmin.class );
|
||||
if ( managedRepositoryAdmin.getManagedRepository( repoConfiguration.getId() ) != null )
|
||||
{
|
||||
configuration.removeManagedRepository( managedRepositoryConfiguration );
|
||||
managedRepositoryAdmin.deleteManagedRepository( repoConfiguration.getId(), null, false );
|
||||
}
|
||||
configuration.addManagedRepository( repoConfiguration );
|
||||
managedRepositoryAdmin.addManagedRepository( repoConfiguration, false, null );
|
||||
}
|
||||
|
||||
private void removeRepoFromConfiguration( String configHint, ManagedRepositoryConfiguration repoConfiguration )
|
||||
private void removeRepoFromConfiguration( String configHint, ManagedRepository repoConfiguration )
|
||||
throws Exception
|
||||
{
|
||||
ArchivaConfiguration archivaConfiguration =
|
||||
applicationContext.getBean( "archivaConfiguration#" + configHint, ArchivaConfiguration.class );
|
||||
Configuration configuration = archivaConfiguration.getConfiguration();
|
||||
ManagedRepositoryConfiguration managedRepositoryConfiguration =
|
||||
configuration.findManagedRepositoryById( repoConfiguration.getId() );
|
||||
if ( managedRepositoryConfiguration != null )
|
||||
|
||||
( (DefaultManagedRepositoryAdmin) applicationContext.getBean(
|
||||
ManagedRepositoryAdmin.class ) ).setArchivaConfiguration( archivaConfiguration );
|
||||
/**
|
||||
Configuration configuration = archivaConfiguration.getConfiguration();
|
||||
ManagedRepositoryConfiguration managedRepositoryConfiguration =
|
||||
configuration.findManagedRepositoryById( repoConfiguration.getId() );
|
||||
if ( managedRepositoryConfiguration != null )
|
||||
{
|
||||
configuration.removeManagedRepository( managedRepositoryConfiguration );
|
||||
}*/
|
||||
ManagedRepositoryAdmin managedRepositoryAdmin = applicationContext.getBean( ManagedRepositoryAdmin.class );
|
||||
if ( managedRepositoryAdmin.getManagedRepository( repoConfiguration.getId() ) != null )
|
||||
{
|
||||
configuration.removeManagedRepository( managedRepositoryConfiguration );
|
||||
managedRepositoryAdmin.deleteManagedRepository( repoConfiguration.getId(), null, true );
|
||||
}
|
||||
}
|
||||
|
||||
@ -200,7 +230,7 @@ public void testConsumerByDaysOld()
|
||||
applicationContext.getBean( "knownRepositoryContentConsumer#repo-purge-consumer-by-days-old",
|
||||
KnownRepositoryContentConsumer.class );
|
||||
|
||||
ManagedRepositoryConfiguration repoConfiguration = getRepoConfiguration( TEST_REPO_ID, TEST_REPO_NAME );
|
||||
ManagedRepository repoConfiguration = getRepoConfiguration( TEST_REPO_ID, TEST_REPO_NAME );
|
||||
repoConfiguration.setDaysOlder( TEST_DAYS_OLDER );
|
||||
addRepoToConfiguration( "days-old", repoConfiguration );
|
||||
|
||||
@ -258,7 +288,7 @@ public void testReleasedSnapshotsWereNotCleaned()
|
||||
applicationContext.getBean( "knownRepositoryContentConsumer#repo-purge-consumer-by-retention-count",
|
||||
KnownRepositoryContentConsumer.class );
|
||||
|
||||
ManagedRepositoryConfiguration repoConfiguration = getRepoConfiguration( TEST_REPO_ID, TEST_REPO_NAME );
|
||||
ManagedRepository repoConfiguration = getRepoConfiguration( TEST_REPO_ID, TEST_REPO_NAME );
|
||||
repoConfiguration.setDeleteReleasedSnapshots( false ); // Set to NOT delete released snapshots.
|
||||
addRepoToConfiguration( "retention-count", repoConfiguration );
|
||||
|
||||
@ -303,7 +333,7 @@ public void testReleasedSnapshotsWereCleaned()
|
||||
applicationContext.getBean( "knownRepositoryContentConsumer#repo-purge-consumer-by-days-old",
|
||||
KnownRepositoryContentConsumer.class );
|
||||
|
||||
ManagedRepositoryConfiguration repoConfiguration = getRepoConfiguration( TEST_REPO_ID, TEST_REPO_NAME );
|
||||
ManagedRepository repoConfiguration = getRepoConfiguration( TEST_REPO_ID, TEST_REPO_NAME );
|
||||
repoConfiguration.setDeleteReleasedSnapshots( true );
|
||||
addRepoToConfiguration( "days-old", repoConfiguration );
|
||||
|
||||
@ -340,14 +370,4 @@ public void testReleasedSnapshotsWereCleaned()
|
||||
|
||||
removeRepoFromConfiguration( "days-old", repoConfiguration );
|
||||
}
|
||||
|
||||
@Before
|
||||
public void setUp()
|
||||
throws Exception
|
||||
{
|
||||
super.setUp();
|
||||
|
||||
TestRepositorySessionFactory factory = applicationContext.getBean( TestRepositorySessionFactory.class );
|
||||
factory.setRepository( metadataRepository );
|
||||
}
|
||||
}
|
||||
|
@ -19,6 +19,7 @@
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
import org.apache.archiva.admin.model.managed.ManagedRepository;
|
||||
import org.apache.archiva.repository.events.RepositoryListener;
|
||||
import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
|
||||
import org.junit.Before;
|
||||
@ -39,7 +40,7 @@ public void setUp()
|
||||
{
|
||||
super.setUp();
|
||||
|
||||
ManagedRepositoryConfiguration repoConfiguration = getRepoConfiguration( TEST_REPO_ID, TEST_REPO_NAME );
|
||||
ManagedRepository repoConfiguration = getRepoConfiguration( TEST_REPO_ID, TEST_REPO_NAME );
|
||||
List<RepositoryListener> listeners = Collections.singletonList( listener );
|
||||
repoPurge = new RetentionCountRepositoryPurge( getRepository(), repoConfiguration.getRetentionCount(),
|
||||
repositorySession, listeners );
|
||||
|
@ -0,0 +1,41 @@
|
||||
<?xml version="1.0"?>
|
||||
|
||||
<!--
|
||||
~ 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.
|
||||
-->
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:context="http://www.springframework.org/schema/context"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans
|
||||
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
|
||||
http://www.springframework.org/schema/context
|
||||
http://www.springframework.org/schema/context/spring-context-3.0.xsd" default-lazy-init="true">
|
||||
|
||||
<bean name="scheduler" class="org.codehaus.redback.components.scheduler.DefaultScheduler">
|
||||
<property name="properties">
|
||||
<props>
|
||||
<prop key="org.quartz.scheduler.instanceName">scheduler1</prop>
|
||||
<prop key="org.quartz.threadPool.class">org.quartz.simpl.SimpleThreadPool</prop>
|
||||
<prop key="org.quartz.threadPool.threadCount">2</prop>
|
||||
<prop key="org.quartz.threadPool.threadPriority">4</prop>
|
||||
<prop key="org.quartz.jobStore.class">org.quartz.simpl.RAMJobStore</prop>
|
||||
</props>
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
</beans>
|
@ -19,6 +19,7 @@
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
import org.apache.archiva.admin.model.managed.ManagedRepository;
|
||||
import org.apache.archiva.common.plexusbridge.MavenIndexerUtils;
|
||||
import org.apache.archiva.common.plexusbridge.PlexusSisuBridge;
|
||||
import org.apache.archiva.common.plexusbridge.PlexusSisuBridgeException;
|
||||
@ -27,7 +28,6 @@
|
||||
import org.apache.maven.archiva.configuration.ArchivaConfiguration;
|
||||
import org.apache.maven.archiva.configuration.ConfigurationNames;
|
||||
import org.apache.maven.archiva.configuration.FileTypes;
|
||||
import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
|
||||
import org.apache.maven.archiva.consumers.AbstractMonitoredConsumer;
|
||||
import org.apache.maven.archiva.consumers.ConsumerException;
|
||||
import org.apache.maven.archiva.consumers.KnownRepositoryContentConsumer;
|
||||
@ -35,14 +35,13 @@
|
||||
import org.apache.maven.index.context.IndexCreator;
|
||||
import org.apache.maven.index.context.IndexingContext;
|
||||
import org.apache.maven.index.context.UnsupportedExistingLuceneIndexException;
|
||||
import org.codehaus.plexus.personality.plexus.lifecycle.phase.Initializable;
|
||||
import org.codehaus.plexus.personality.plexus.lifecycle.phase.InitializationException;
|
||||
import org.codehaus.plexus.registry.Registry;
|
||||
import org.codehaus.plexus.registry.RegistryListener;
|
||||
import org.codehaus.plexus.taskqueue.TaskQueueException;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
@ -55,7 +54,7 @@
|
||||
*/
|
||||
public class NexusIndexerConsumer
|
||||
extends AbstractMonitoredConsumer
|
||||
implements KnownRepositoryContentConsumer, RegistryListener, Initializable
|
||||
implements KnownRepositoryContentConsumer, RegistryListener
|
||||
{
|
||||
private Logger log = LoggerFactory.getLogger( NexusIndexerConsumer.class );
|
||||
|
||||
@ -73,7 +72,7 @@ public class NexusIndexerConsumer
|
||||
|
||||
private List<String> includes = new ArrayList<String>();
|
||||
|
||||
private ManagedRepositoryConfiguration repository;
|
||||
private ManagedRepository repository;
|
||||
|
||||
private List<? extends IndexCreator> allIndexCreators;
|
||||
|
||||
@ -104,7 +103,7 @@ public boolean isPermanent()
|
||||
return false;
|
||||
}
|
||||
|
||||
public void beginScan( ManagedRepositoryConfiguration repository, Date whenGathered )
|
||||
public void beginScan( ManagedRepository repository, Date whenGathered )
|
||||
throws ConsumerException
|
||||
{
|
||||
this.repository = repository;
|
||||
@ -125,7 +124,7 @@ public void beginScan( ManagedRepositoryConfiguration repository, Date whenGathe
|
||||
}
|
||||
}
|
||||
|
||||
public void beginScan( ManagedRepositoryConfiguration repository, Date whenGathered, boolean executeOnEntireRepo )
|
||||
public void beginScan( ManagedRepository repository, Date whenGathered, boolean executeOnEntireRepo )
|
||||
throws ConsumerException
|
||||
{
|
||||
if ( executeOnEntireRepo )
|
||||
@ -238,8 +237,8 @@ private void initIncludes()
|
||||
includes.addAll( filetypes.getFileTypePatterns( FileTypes.ARTIFACTS ) );
|
||||
}
|
||||
|
||||
@PostConstruct
|
||||
public void initialize()
|
||||
throws InitializationException
|
||||
{
|
||||
configuration.addChangeListener( this );
|
||||
|
||||
|
@ -20,6 +20,7 @@
|
||||
*/
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import org.apache.archiva.admin.model.managed.ManagedRepository;
|
||||
import org.apache.archiva.common.plexusbridge.MavenIndexerUtils;
|
||||
import org.apache.archiva.common.plexusbridge.PlexusSisuBridge;
|
||||
import org.apache.archiva.scheduler.ArchivaTaskScheduler;
|
||||
@ -88,7 +89,7 @@ public void queueTask( ArtifactIndexingTask task )
|
||||
|
||||
private KnownRepositoryContentConsumer nexusIndexerConsumer;
|
||||
|
||||
private ManagedRepositoryConfiguration repositoryConfig;
|
||||
private ManagedRepository repositoryConfig;
|
||||
|
||||
private ArchivaTaskSchedulerStub scheduler;
|
||||
|
||||
@ -119,9 +120,9 @@ public void setUp()
|
||||
new NexusIndexerConsumer( scheduler, configuration, filetypes, plexusSisuBridge, mavenIndexerUtils );
|
||||
|
||||
// initialize to set the file types to be processed
|
||||
( (Initializable) nexusIndexerConsumer ).initialize();
|
||||
( (NexusIndexerConsumer) nexusIndexerConsumer ).initialize();
|
||||
|
||||
repositoryConfig = new ManagedRepositoryConfiguration();
|
||||
repositoryConfig = new ManagedRepository();
|
||||
repositoryConfig.setId( "test-repo" );
|
||||
repositoryConfig.setLocation( "target/test-classes/test-repo" );
|
||||
repositoryConfig.setLayout( "default" );
|
||||
|
@ -19,6 +19,7 @@
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
import org.apache.archiva.admin.model.managed.ManagedRepository;
|
||||
import org.apache.archiva.metadata.model.ArtifactMetadata;
|
||||
import org.apache.archiva.metadata.model.ProjectMetadata;
|
||||
import org.apache.archiva.metadata.model.ProjectVersionMetadata;
|
||||
@ -33,7 +34,6 @@
|
||||
import org.apache.maven.archiva.configuration.ArchivaConfiguration;
|
||||
import org.apache.maven.archiva.configuration.ConfigurationNames;
|
||||
import org.apache.maven.archiva.configuration.FileTypes;
|
||||
import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
|
||||
import org.apache.maven.archiva.consumers.AbstractMonitoredConsumer;
|
||||
import org.apache.maven.archiva.consumers.ConsumerException;
|
||||
import org.apache.maven.archiva.consumers.KnownRepositoryContentConsumer;
|
||||
@ -131,14 +131,14 @@ public List<String> getIncludes()
|
||||
return this.includes;
|
||||
}
|
||||
|
||||
public void beginScan( ManagedRepositoryConfiguration repo, Date whenGathered )
|
||||
public void beginScan( ManagedRepository repo, Date whenGathered )
|
||||
throws ConsumerException
|
||||
{
|
||||
repoId = repo.getId();
|
||||
this.whenGathered = whenGathered;
|
||||
}
|
||||
|
||||
public void beginScan( ManagedRepositoryConfiguration repository, Date whenGathered, boolean executeOnEntireRepo )
|
||||
public void beginScan( ManagedRepository repository, Date whenGathered, boolean executeOnEntireRepo )
|
||||
throws ConsumerException
|
||||
{
|
||||
beginScan( repository, whenGathered );
|
||||
|
@ -19,6 +19,7 @@
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
import org.apache.archiva.admin.model.managed.ManagedRepository;
|
||||
import org.apache.archiva.common.plexusbridge.PlexusSisuBridge;
|
||||
import org.apache.archiva.common.plexusbridge.PlexusSisuBridgeException;
|
||||
import org.apache.archiva.repository.scanner.RepositoryScanner;
|
||||
@ -89,7 +90,7 @@ public void convertLegacyRepository( File legacyRepositoryDirectory, File reposi
|
||||
{
|
||||
String defaultRepositoryUrl = PathUtil.toUrl( repositoryDirectory );
|
||||
|
||||
ManagedRepositoryConfiguration legacyRepository = new ManagedRepositoryConfiguration();
|
||||
ManagedRepository legacyRepository = new ManagedRepository();
|
||||
legacyRepository.setId( "legacy" );
|
||||
legacyRepository.setName( "Legacy Repository" );
|
||||
legacyRepository.setLocation( legacyRepositoryDirectory.getAbsolutePath() );
|
||||
|
@ -19,9 +19,9 @@
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
import org.apache.archiva.admin.model.managed.ManagedRepository;
|
||||
import org.apache.archiva.common.plexusbridge.PlexusSisuBridge;
|
||||
import org.apache.archiva.common.plexusbridge.PlexusSisuBridgeException;
|
||||
import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
|
||||
import org.apache.maven.archiva.consumers.AbstractMonitoredConsumer;
|
||||
import org.apache.maven.archiva.consumers.ConsumerException;
|
||||
import org.apache.maven.archiva.consumers.KnownRepositoryContentConsumer;
|
||||
@ -88,14 +88,14 @@ public LegacyConverterArtifactConsumer( PlexusSisuBridge plexusSisuBridge )
|
||||
artifactFactory = plexusSisuBridge.lookup( ArtifactFactory.class );
|
||||
}
|
||||
|
||||
public void beginScan( ManagedRepositoryConfiguration repository, Date whenGathered )
|
||||
public void beginScan( ManagedRepository repository, Date whenGathered )
|
||||
throws ConsumerException
|
||||
{
|
||||
this.managedRepository = new ManagedDefaultRepositoryContent();
|
||||
this.managedRepository.setRepository( repository );
|
||||
}
|
||||
|
||||
public void beginScan( ManagedRepositoryConfiguration repository, Date whenGathered, boolean executeOnEntireRepo )
|
||||
public void beginScan( ManagedRepository repository, Date whenGathered, boolean executeOnEntireRepo )
|
||||
throws ConsumerException
|
||||
{
|
||||
beginScan( repository, whenGathered );
|
||||
|
@ -0,0 +1,148 @@
|
||||
package org.apache.maven.archiva.converter.mock;
|
||||
/*
|
||||
* 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.archiva.admin.model.AuditInformation;
|
||||
import org.apache.archiva.admin.model.RepositoryAdminException;
|
||||
import org.apache.archiva.admin.model.admin.ArchivaAdministration;
|
||||
import org.apache.archiva.admin.model.admin.FileType;
|
||||
import org.apache.archiva.admin.model.admin.LegacyArtifactPath;
|
||||
import org.apache.archiva.admin.model.admin.OrganisationInformation;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Olivier Lamy
|
||||
*/
|
||||
public class MockArchivaAdministration implements ArchivaAdministration
|
||||
{
|
||||
public List<LegacyArtifactPath> getLegacyArtifactPaths()
|
||||
throws RepositoryAdminException
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public void addLegacyArtifactPath( LegacyArtifactPath legacyArtifactPath, AuditInformation auditInformation )
|
||||
throws RepositoryAdminException
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void deleteLegacyArtifactPath( String path, AuditInformation auditInformation )
|
||||
throws RepositoryAdminException
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void addFileTypePattern( String fileTypeId, String pattern, AuditInformation auditInformation )
|
||||
throws RepositoryAdminException
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void removeFileTypePattern( String fileTypeId, String pattern, AuditInformation auditInformation )
|
||||
throws RepositoryAdminException
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public List<FileType> getFileTypes()
|
||||
throws RepositoryAdminException
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public FileType getFileType( String fileTypeId )
|
||||
throws RepositoryAdminException
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public void addFileType( FileType fileType, AuditInformation auditInformation )
|
||||
throws RepositoryAdminException
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void removeFileType( String fileTypeId, AuditInformation auditInformation )
|
||||
throws RepositoryAdminException
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void addKnownContentConsumer( String knownContentConsumer, AuditInformation auditInformation )
|
||||
throws RepositoryAdminException
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void setKnownContentConsumers( List<String> knownContentConsumers, AuditInformation auditInformation )
|
||||
throws RepositoryAdminException
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public List<String> getKnownContentConsumers()
|
||||
throws RepositoryAdminException
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public void removeKnownContentConsumer( String knownContentConsumer, AuditInformation auditInformation )
|
||||
throws RepositoryAdminException
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void addInvalidContentConsumer( String invalidContentConsumer, AuditInformation auditInformation )
|
||||
throws RepositoryAdminException
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void setInvalidContentConsumers( List<String> invalidContentConsumers, AuditInformation auditInformation )
|
||||
throws RepositoryAdminException
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public List<String> getInvalidContentConsumers()
|
||||
throws RepositoryAdminException
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public void removeInvalidContentConsumer( String invalidContentConsumer, AuditInformation auditInformation )
|
||||
throws RepositoryAdminException
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public OrganisationInformation getOrganisationInformation()
|
||||
throws RepositoryAdminException
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public void setOrganisationInformation( OrganisationInformation organisationInformation )
|
||||
throws RepositoryAdminException
|
||||
{
|
||||
|
||||
}
|
||||
}
|
@ -27,5 +27,6 @@
|
||||
http://www.springframework.org/schema/context/spring-context-3.0.xsd"
|
||||
default-lazy-init="true">
|
||||
|
||||
<bean name="mockArchivaAdministration" class="org.apache.maven.archiva.converter.mock.MockArchivaAdministration"/>
|
||||
|
||||
</beans>
|
@ -373,8 +373,8 @@ private SearchResults convertToSearchResults( FlatSearchResponse response, Searc
|
||||
hit = new SearchResultHit();
|
||||
hit.setArtifactId( artifactInfo.artifactId );
|
||||
hit.setGroupId( artifactInfo.groupId );
|
||||
// do we still need to set the repository id even though we're merging everything?
|
||||
//hit.setRepositoryId( artifactInfo.repository );
|
||||
hit.setRepositoryId( artifactInfo.repository );
|
||||
// FIXME archiva url ??
|
||||
hit.setUrl( artifactInfo.repository + "/" + artifactInfo.fname );
|
||||
hit.addVersion( artifactInfo.version );
|
||||
hit.setBundleExportPackage( artifactInfo.bundleExportPackage );
|
||||
|
@ -200,11 +200,23 @@ public void setBundleExportService( String bundleExportService )
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return "SearchResultHit{" + "context='" + context + '\'' + ", url='" + url + '\'' + ", groupId='" + groupId
|
||||
+ '\'' + ", artifactId='" + artifactId + '\'' + ", version='" + version + '\'' + ", repositoryId='"
|
||||
+ repositoryId + '\'' + ", versions=" + versions + ", bundleVersion='" + bundleVersion + '\''
|
||||
+ ", bundleSymbolicName='" + bundleSymbolicName + '\'' + ", bundleExportPackage='" + bundleExportPackage
|
||||
+ '\'' + ", bundleExportService='" + bundleExportService + '\'' + '}';
|
||||
final StringBuilder sb = new StringBuilder();
|
||||
sb.append( "SearchResultHit" );
|
||||
sb.append( "{context='" ).append( context ).append( '\'' );
|
||||
sb.append( ", url='" ).append( url ).append( '\'' );
|
||||
sb.append( ", groupId='" ).append( groupId ).append( '\'' );
|
||||
sb.append( ", artifactId='" ).append( artifactId ).append( '\'' );
|
||||
sb.append( ", version='" ).append( version ).append( '\'' );
|
||||
sb.append( ", repositoryId='" ).append( repositoryId ).append( '\'' );
|
||||
sb.append( ", versions=" ).append( versions );
|
||||
sb.append( ", bundleVersion='" ).append( bundleVersion ).append( '\'' );
|
||||
sb.append( ", bundleSymbolicName='" ).append( bundleSymbolicName ).append( '\'' );
|
||||
sb.append( ", bundleExportPackage='" ).append( bundleExportPackage ).append( '\'' );
|
||||
sb.append( ", bundleExportService='" ).append( bundleExportService ).append( '\'' );
|
||||
sb.append( '}' );
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@ -124,6 +124,25 @@
|
||||
<artifactId>slf4j-simple</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.archiva</groupId>
|
||||
<artifactId>archiva-repository-admin-default</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.codehaus.redback</groupId>
|
||||
<artifactId>redback-rbac-cached</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.derby</groupId>
|
||||
<artifactId>derby</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.archiva</groupId>
|
||||
<artifactId>archiva-security-common</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<build>
|
||||
<plugins>
|
||||
@ -132,6 +151,8 @@
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<configuration>
|
||||
<systemPropertyVariables>
|
||||
<appserver.base>${basedir}/target/appserver-base</appserver.base>
|
||||
<plexus.home>${project.build.outputDirectory}</plexus.home>
|
||||
<java.io.tmpdir>${project.build.outputDirectory}</java.io.tmpdir>
|
||||
</systemPropertyVariables>
|
||||
</configuration>
|
||||
|
@ -1073,7 +1073,7 @@ private boolean connectToRepository( ProxyConnector connector, Wagon wagon,
|
||||
}
|
||||
|
||||
AuthenticationInfo authInfo = null;
|
||||
String username = remoteRepository.getRepository().getUsername();
|
||||
String username = remoteRepository.getRepository().getUserName();
|
||||
String password = remoteRepository.getRepository().getPassword();
|
||||
|
||||
if ( StringUtils.isNotBlank( username ) && StringUtils.isNotBlank( password ) )
|
||||
|
@ -20,6 +20,9 @@
|
||||
*/
|
||||
|
||||
import net.sf.ehcache.CacheManager;
|
||||
import org.apache.archiva.admin.model.managed.ManagedRepository;
|
||||
import org.apache.archiva.admin.model.managed.ManagedRepositoryAdmin;
|
||||
import org.apache.archiva.admin.repository.managed.DefaultManagedRepositoryAdmin;
|
||||
import org.apache.archiva.common.plexusbridge.PlexusSisuBridge;
|
||||
import org.apache.commons.lang.ArrayUtils;
|
||||
import org.apache.maven.archiva.configuration.ArchivaConfiguration;
|
||||
@ -45,6 +48,7 @@
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
import java.io.FileReader;
|
||||
@ -56,7 +60,6 @@
|
||||
import java.util.Collection;
|
||||
import java.util.Date;
|
||||
import java.util.Locale;
|
||||
import javax.inject.Inject;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
@ -66,7 +69,7 @@
|
||||
* @version $Id$
|
||||
*/
|
||||
@RunWith( SpringJUnit4ClassRunner.class )
|
||||
@ContextConfiguration( locations = {"classpath*:/META-INF/spring-context.xml", "classpath:/spring-context.xml"} )
|
||||
@ContextConfiguration( locations = { "classpath*:/META-INF/spring-context.xml", "classpath:/spring-context.xml" } )
|
||||
public abstract class AbstractProxyTestCase
|
||||
{
|
||||
@Inject
|
||||
@ -125,6 +128,9 @@ public abstract class AbstractProxyTestCase
|
||||
|
||||
WagonDelegate delegate;
|
||||
|
||||
@Inject
|
||||
protected ManagedRepositoryAdmin managedRepositoryAdmin;
|
||||
|
||||
@Inject
|
||||
PlexusSisuBridge plexusSisuBridge;
|
||||
|
||||
@ -132,8 +138,8 @@ public abstract class AbstractProxyTestCase
|
||||
public void setUp()
|
||||
throws Exception
|
||||
{
|
||||
config = (MockConfiguration) applicationContext.getBean( "archivaConfiguration#mock",
|
||||
ArchivaConfiguration.class );
|
||||
config =
|
||||
(MockConfiguration) applicationContext.getBean( "archivaConfiguration#mock", ArchivaConfiguration.class );
|
||||
|
||||
config.getConfiguration().setManagedRepositories( new ArrayList<ManagedRepositoryConfiguration>() );
|
||||
config.getConfiguration().setRemoteRepositories( new ArrayList<RemoteRepositoryConfiguration>() );
|
||||
@ -144,14 +150,18 @@ public void setUp()
|
||||
String repoPath = "target/test-repository/managed/" + name;
|
||||
File repoLocation = new File( repoPath );
|
||||
|
||||
managedDefaultRepository = createRepository( ID_DEFAULT_MANAGED, "Default Managed Repository", repoPath,
|
||||
"default" );
|
||||
managedDefaultRepository =
|
||||
createRepository( ID_DEFAULT_MANAGED, "Default Managed Repository", repoPath, "default" );
|
||||
|
||||
managedDefaultDir = new File( managedDefaultRepository.getRepoRoot() );
|
||||
|
||||
ManagedRepositoryConfiguration repoConfig = managedDefaultRepository.getRepository();
|
||||
ManagedRepository repoConfig = managedDefaultRepository.getRepository();
|
||||
|
||||
config.getConfiguration().addManagedRepository( repoConfig );
|
||||
( (DefaultManagedRepositoryAdmin) applicationContext.getBean(
|
||||
ManagedRepositoryAdmin.class ) ).setArchivaConfiguration( config );
|
||||
|
||||
applicationContext.getBean( ManagedRepositoryAdmin.class ).addManagedRepository( repoConfig, false, null );
|
||||
//config.getConfiguration().addManagedRepository( repoConfig );
|
||||
|
||||
// Setup source repository (using legacy layout)
|
||||
repoLocation = new File( REPOPATH_LEGACY_MANAGED_TARGET );
|
||||
@ -161,26 +171,28 @@ public void setUp()
|
||||
}
|
||||
copyDirectoryStructure( new File( REPOPATH_LEGACY_MANAGED ), repoLocation );
|
||||
|
||||
managedLegacyRepository = createRepository( ID_LEGACY_MANAGED, "Legacy Managed Repository",
|
||||
REPOPATH_LEGACY_MANAGED_TARGET, "legacy" );
|
||||
managedLegacyRepository =
|
||||
createRepository( ID_LEGACY_MANAGED, "Legacy Managed Repository", REPOPATH_LEGACY_MANAGED_TARGET,
|
||||
"legacy" );
|
||||
|
||||
managedLegacyDir = new File( managedLegacyRepository.getRepoRoot() );
|
||||
|
||||
repoConfig = managedLegacyRepository.getRepository();
|
||||
|
||||
config.getConfiguration().addManagedRepository( repoConfig );
|
||||
//config.getConfiguration().addManagedRepository( repoConfig );
|
||||
applicationContext.getBean( ManagedRepositoryAdmin.class ).addManagedRepository( repoConfig, false, null );
|
||||
|
||||
// Setup target (proxied to) repository.
|
||||
saveRemoteRepositoryConfig( ID_PROXIED1, "Proxied Repository 1", new File(
|
||||
REPOPATH_PROXIED1 ).toURL().toExternalForm(), "default" );
|
||||
saveRemoteRepositoryConfig( ID_PROXIED1, "Proxied Repository 1",
|
||||
new File( REPOPATH_PROXIED1 ).toURL().toExternalForm(), "default" );
|
||||
|
||||
// Setup target (proxied to) repository.
|
||||
saveRemoteRepositoryConfig( ID_PROXIED2, "Proxied Repository 2", new File(
|
||||
REPOPATH_PROXIED2 ).toURL().toExternalForm(), "default" );
|
||||
saveRemoteRepositoryConfig( ID_PROXIED2, "Proxied Repository 2",
|
||||
new File( REPOPATH_PROXIED2 ).toURL().toExternalForm(), "default" );
|
||||
|
||||
// Setup target (proxied to) repository using legacy layout.
|
||||
saveRemoteRepositoryConfig( ID_LEGACY_PROXIED, "Proxied Legacy Repository", new File(
|
||||
REPOPATH_PROXIED_LEGACY ).toURL().toExternalForm(), "legacy" );
|
||||
saveRemoteRepositoryConfig( ID_LEGACY_PROXIED, "Proxied Legacy Repository",
|
||||
new File( REPOPATH_PROXIED_LEGACY ).toURL().toExternalForm(), "legacy" );
|
||||
|
||||
// Setup the proxy handler.
|
||||
//proxyHandler = applicationContext.getBean (RepositoryProxyConnectors) lookup( RepositoryProxyConnectors.class.getName() );
|
||||
@ -209,8 +221,8 @@ public boolean matches( Object[] expected, Object[] actual )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return MockControl.ARRAY_MATCHER.matches( ArrayUtils.remove( expected, 1 ), ArrayUtils.remove( actual,
|
||||
1 ) );
|
||||
return MockControl.ARRAY_MATCHER.matches( ArrayUtils.remove( expected, 1 ),
|
||||
ArrayUtils.remove( actual, 1 ) );
|
||||
}
|
||||
|
||||
public String toString( Object[] arguments )
|
||||
@ -312,7 +324,8 @@ protected void assertNoTempFiles( File expectedFile )
|
||||
return;
|
||||
}
|
||||
|
||||
Collection<File> tmpFiles = org.apache.commons.io.FileUtils.listFiles( workingDir, new String[]{"tmp"}, false );
|
||||
Collection<File> tmpFiles =
|
||||
org.apache.commons.io.FileUtils.listFiles( workingDir, new String[]{ "tmp" }, false );
|
||||
if ( !tmpFiles.isEmpty() )
|
||||
{
|
||||
StringBuffer emsg = new StringBuffer();
|
||||
@ -400,14 +413,14 @@ protected ManagedRepositoryContent createProxiedLegacyRepository()
|
||||
protected ManagedRepositoryContent createRepository( String id, String name, String path, String layout )
|
||||
throws Exception
|
||||
{
|
||||
ManagedRepositoryConfiguration repo = new ManagedRepositoryConfiguration();
|
||||
ManagedRepository repo = new ManagedRepository();
|
||||
repo.setId( id );
|
||||
repo.setName( name );
|
||||
repo.setLocation( path );
|
||||
repo.setLayout( layout );
|
||||
|
||||
ManagedRepositoryContent repoContent = applicationContext.getBean( "managedRepositoryContent#" + layout,
|
||||
ManagedRepositoryContent.class );
|
||||
ManagedRepositoryContent repoContent =
|
||||
applicationContext.getBean( "managedRepositoryContent#" + layout, ManagedRepositoryContent.class );
|
||||
repoContent.setRepository( repo );
|
||||
return repoContent;
|
||||
}
|
||||
@ -489,10 +502,10 @@ protected void saveConnector( String sourceRepoId, String targetRepoId, String c
|
||||
config.triggerChange( prefix + ".policies.checksum", connectorConfig.getPolicy( "checksum", "" ) );
|
||||
config.triggerChange( prefix + ".policies.snapshots", connectorConfig.getPolicy( "snapshots", "" ) );
|
||||
config.triggerChange( prefix + ".policies.cache-failures", connectorConfig.getPolicy( "cache-failures", "" ) );
|
||||
config.triggerChange( prefix + ".policies.propagate-errors", connectorConfig.getPolicy( "propagate-errors",
|
||||
"" ) );
|
||||
config.triggerChange( prefix + ".policies.propagate-errors-on-update", connectorConfig.getPolicy(
|
||||
"propagate-errors-on-update", "" ) );
|
||||
config.triggerChange( prefix + ".policies.propagate-errors",
|
||||
connectorConfig.getPolicy( "propagate-errors", "" ) );
|
||||
config.triggerChange( prefix + ".policies.propagate-errors-on-update",
|
||||
connectorConfig.getPolicy( "propagate-errors-on-update", "" ) );
|
||||
}
|
||||
|
||||
protected void saveManagedRepositoryConfig( String id, String name, String path, String layout )
|
||||
@ -644,9 +657,9 @@ protected void assertNotExistsInManagedLegacyRepo( File file )
|
||||
String managedLegacyPath = managedLegacyDir.getCanonicalPath();
|
||||
String testFile = file.getCanonicalPath();
|
||||
|
||||
assertTrue( "Unit Test Failure: File <" + testFile +
|
||||
"> should be have been defined within the legacy managed path of <" + managedLegacyPath + ">",
|
||||
testFile.startsWith( managedLegacyPath ) );
|
||||
assertTrue(
|
||||
"Unit Test Failure: File <" + testFile + "> should be have been defined within the legacy managed path of <"
|
||||
+ managedLegacyPath + ">", testFile.startsWith( managedLegacyPath ) );
|
||||
|
||||
assertFalse( "File < " + testFile + "> should not exist in managed legacy repository.", file.exists() );
|
||||
}
|
||||
@ -657,9 +670,9 @@ protected void assertNotExistsInManagedDefaultRepo( File file )
|
||||
String managedDefaultPath = managedDefaultDir.getCanonicalPath();
|
||||
String testFile = file.getCanonicalPath();
|
||||
|
||||
assertTrue( "Unit Test Failure: File <" + testFile +
|
||||
"> should be have been defined within the managed default path of <" + managedDefaultPath + ">",
|
||||
testFile.startsWith( managedDefaultPath ) );
|
||||
assertTrue( "Unit Test Failure: File <" + testFile
|
||||
+ "> should be have been defined within the managed default path of <" + managedDefaultPath
|
||||
+ ">", testFile.startsWith( managedDefaultPath ) );
|
||||
|
||||
assertFalse( "File < " + testFile + "> should not exist in managed default repository.", file.exists() );
|
||||
}
|
||||
|
@ -19,9 +19,11 @@
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
import org.apache.archiva.admin.model.managed.ManagedRepository;
|
||||
import org.apache.archiva.admin.model.managed.ManagedRepositoryAdmin;
|
||||
import org.apache.archiva.admin.repository.managed.DefaultManagedRepositoryAdmin;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.apache.maven.archiva.configuration.ArchivaConfiguration;
|
||||
import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
|
||||
import org.apache.maven.archiva.configuration.NetworkProxyConfiguration;
|
||||
import org.apache.maven.archiva.configuration.ProxyConnectorConfiguration;
|
||||
import org.apache.maven.archiva.configuration.RemoteRepositoryConfiguration;
|
||||
@ -45,12 +47,12 @@
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import javax.inject.Inject;
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
@ -60,7 +62,7 @@
|
||||
* @version $Id: ManagedDefaultTransferTest.java 677852 2008-07-18 08:16:24Z brett $
|
||||
*/
|
||||
@RunWith( SpringJUnit4ClassRunner.class )
|
||||
@ContextConfiguration( locations = {"classpath*:/META-INF/spring-context.xml", "classpath:/spring-context.xml"} )
|
||||
@ContextConfiguration( locations = { "classpath*:/META-INF/spring-context.xml", "classpath:/spring-context.xml" } )
|
||||
public class HttpProxyTransferTest
|
||||
{
|
||||
private static final String PROXY_ID = "proxy";
|
||||
@ -108,19 +110,28 @@ public void setUp()
|
||||
// Make the destination dir.
|
||||
destRepoDir.mkdirs();
|
||||
|
||||
ManagedRepositoryConfiguration repo = new ManagedRepositoryConfiguration();
|
||||
ManagedRepository repo = new ManagedRepository();
|
||||
repo.setId( MANAGED_ID );
|
||||
repo.setName( "Default Managed Repository" );
|
||||
repo.setLocation( repoPath );
|
||||
repo.setLayout( "default" );
|
||||
|
||||
ManagedRepositoryContent repoContent = applicationContext.getBean( "managedRepositoryContent#default",
|
||||
ManagedRepositoryContent.class );
|
||||
ManagedRepositoryContent repoContent =
|
||||
applicationContext.getBean( "managedRepositoryContent#default", ManagedRepositoryContent.class );
|
||||
|
||||
repoContent.setRepository( repo );
|
||||
managedDefaultRepository = repoContent;
|
||||
|
||||
config.getConfiguration().addManagedRepository( repo );
|
||||
( (DefaultManagedRepositoryAdmin) applicationContext.getBean(
|
||||
ManagedRepositoryAdmin.class ) ).setArchivaConfiguration( config );
|
||||
|
||||
ManagedRepositoryAdmin managedRepositoryAdmin = applicationContext.getBean( ManagedRepositoryAdmin.class );
|
||||
if ( managedRepositoryAdmin.getManagedRepository( repo.getId() ) == null )
|
||||
{
|
||||
managedRepositoryAdmin.addManagedRepository( repo, false, null );
|
||||
}
|
||||
|
||||
//config.getConfiguration().addManagedRepository( repo );
|
||||
|
||||
Handler handler = new AbstractHandler()
|
||||
{
|
||||
|
@ -0,0 +1,213 @@
|
||||
<redback-role-model>
|
||||
<modelVersion>1.0.0</modelVersion>
|
||||
<applications>
|
||||
<application>
|
||||
<id>System</id>
|
||||
<description>Roles that apply system-wide, across all of the applications</description>
|
||||
<version>1.0.0</version>
|
||||
<resources>
|
||||
<resource>
|
||||
<id>global</id>
|
||||
<name>*</name>
|
||||
<permanent>true</permanent>
|
||||
<description>global resource implies full access for authorization</description>
|
||||
</resource>
|
||||
<resource>
|
||||
<id>username</id>
|
||||
<name>${username}</name>
|
||||
<permanent>true</permanent>
|
||||
<description>replaced with the username of the principal at authorization check time</description>
|
||||
</resource>
|
||||
</resources>
|
||||
<operations>
|
||||
<operation>
|
||||
<id>configuration-edit</id>
|
||||
<name>configuration-edit</name>
|
||||
<description>edit configuration</description>
|
||||
<permanent>true</permanent>
|
||||
</operation>
|
||||
<operation>
|
||||
<id>user-management-user-create</id>
|
||||
<name>user-management-user-create</name>
|
||||
<description>create user</description>
|
||||
<permanent>true</permanent>
|
||||
</operation>
|
||||
<operation>
|
||||
<id>user-management-user-edit</id>
|
||||
<name>user-management-user-edit</name>
|
||||
<description>edit user</description>
|
||||
<permanent>true</permanent>
|
||||
</operation>
|
||||
<operation>
|
||||
<id>user-management-user-role</id>
|
||||
<name>user-management-user-role</name>
|
||||
<description>user roles</description>
|
||||
<permanent>true</permanent>
|
||||
</operation>
|
||||
<operation>
|
||||
<id>user-management-user-delete</id>
|
||||
<name>user-management-user-delete</name>
|
||||
<description>delete user</description>
|
||||
<permanent>true</permanent>
|
||||
</operation>
|
||||
<operation>
|
||||
<id>user-management-user-list</id>
|
||||
<name>user-management-user-list</name>
|
||||
<description>list users</description>
|
||||
<permanent>true</permanent>
|
||||
</operation>
|
||||
<operation>
|
||||
<id>user-management-role-grant</id>
|
||||
<name>user-management-role-grant</name>
|
||||
<description>grant role</description>
|
||||
<permanent>true</permanent>
|
||||
</operation>
|
||||
<operation>
|
||||
<id>user-management-role-drop</id>
|
||||
<name>user-management-role-drop</name>
|
||||
<description>drop role</description>
|
||||
<permanent>true</permanent>
|
||||
</operation>
|
||||
<operation>
|
||||
<id>user-management-rbac-admin</id>
|
||||
<name>user-management-rbac-admin</name>
|
||||
<description>administer rbac</description>
|
||||
<permanent>true</permanent>
|
||||
</operation>
|
||||
<operation>
|
||||
<id>guest-access</id>
|
||||
<name>guest-access</name>
|
||||
<description>access guest</description>
|
||||
<permanent>true</permanent>
|
||||
</operation>
|
||||
<operation>
|
||||
<id>user-management-manage-data</id>
|
||||
<name>user-management-manage-data</name>
|
||||
<description>manage data</description>
|
||||
<permanent>true</permanent>
|
||||
</operation>
|
||||
</operations>
|
||||
<roles>
|
||||
<role>
|
||||
<id>system-administrator</id>
|
||||
<name>System Administrator</name>
|
||||
<permanent>true</permanent>
|
||||
<assignable>true</assignable>
|
||||
<permissions>
|
||||
<permission>
|
||||
<id>edit-redback-configuration</id>
|
||||
<name>Edit Redback Configuration</name>
|
||||
<operation>configuration-edit</operation>
|
||||
<resource>global</resource>
|
||||
<permanent>true</permanent>
|
||||
</permission>
|
||||
<permission>
|
||||
<id>manage-rbac-setup</id>
|
||||
<name>User RBAC Management</name>
|
||||
<operation>user-management-rbac-admin</operation>
|
||||
<resource>global</resource>
|
||||
<permanent>true</permanent>
|
||||
</permission>
|
||||
<permission>
|
||||
<id>manage-rbac-data</id>
|
||||
<name>RBAC Manage Data</name>
|
||||
<operation>user-management-manage-data</operation>
|
||||
<resource>global</resource>
|
||||
<permanent>true</permanent>
|
||||
</permission>
|
||||
</permissions>
|
||||
<childRoles>
|
||||
<childRole>user-administrator</childRole>
|
||||
</childRoles>
|
||||
</role>
|
||||
<role>
|
||||
<id>user-administrator</id>
|
||||
<name>User Administrator</name>
|
||||
<permanent>true</permanent>
|
||||
<assignable>true</assignable>
|
||||
<permissions>
|
||||
<permission>
|
||||
<id>drop-roles-for-anyone</id>
|
||||
<name>Drop Roles for Anyone</name>
|
||||
<operation>user-management-role-drop</operation>
|
||||
<resource>global</resource>
|
||||
<permanent>true</permanent>
|
||||
</permission>
|
||||
<permission>
|
||||
<id>grant-roles-for-anyone</id>
|
||||
<name>Grant Roles for Anyone</name>
|
||||
<operation>user-management-role-grant</operation>
|
||||
<resource>global</resource>
|
||||
<permanent>true</permanent>
|
||||
</permission>
|
||||
<permission>
|
||||
<id>user-create</id>
|
||||
<name>Create Users</name>
|
||||
<operation>user-management-user-create</operation>
|
||||
<resource>global</resource>
|
||||
<permanent>true</permanent>
|
||||
</permission>
|
||||
<permission>
|
||||
<id>user-delete</id>
|
||||
<name>Delete Users</name>
|
||||
<operation>user-management-user-delete</operation>
|
||||
<resource>global</resource>
|
||||
<permanent>true</permanent>
|
||||
</permission>
|
||||
<permission>
|
||||
<id>user-edit</id>
|
||||
<name>Edit Users</name>
|
||||
<operation>user-management-user-edit</operation>
|
||||
<resource>global</resource>
|
||||
<permanent>true</permanent>
|
||||
</permission>
|
||||
<permission>
|
||||
<id>access-users-roles</id>
|
||||
<name>Access Users Roles</name>
|
||||
<operation>user-management-user-role</operation>
|
||||
<resource>global</resource>
|
||||
<permanent>true</permanent>
|
||||
</permission>
|
||||
<permission>
|
||||
<id>access-user-list</id>
|
||||
<name>Access User List</name>
|
||||
<operation>user-management-user-list</operation>
|
||||
<resource>global</resource>
|
||||
<permanent>true</permanent>
|
||||
</permission>
|
||||
</permissions>
|
||||
</role>
|
||||
<role>
|
||||
<id>registered-user</id>
|
||||
<name>Registered User</name>
|
||||
<permanent>true</permanent>
|
||||
<assignable>true</assignable>
|
||||
<permissions>
|
||||
<permission>
|
||||
<id>edit-user-by-username</id>
|
||||
<name>Edit User Data by Username</name>
|
||||
<operation>user-management-user-edit</operation>
|
||||
<resource>username</resource>
|
||||
<permanent>true</permanent>
|
||||
</permission>
|
||||
</permissions>
|
||||
</role>
|
||||
<role>
|
||||
<id>guest</id>
|
||||
<name>Guest</name>
|
||||
<permanent>true</permanent>
|
||||
<assignable>true</assignable>
|
||||
<permissions>
|
||||
<permission>
|
||||
<id>guest-permission</id>
|
||||
<name>Guest Permission</name>
|
||||
<operation>guest-access</operation>
|
||||
<resource>global</resource>
|
||||
<permanent>true</permanent>
|
||||
</permission>
|
||||
</permissions>
|
||||
</role>
|
||||
</roles>
|
||||
</application>
|
||||
</applications>
|
||||
</redback-role-model>
|
@ -0,0 +1,45 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
~ 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.
|
||||
-->
|
||||
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>org.apache.archiva</groupId>
|
||||
<artifactId>archiva-repository-admin</artifactId>
|
||||
<version>1.4-SNAPSHOT</version>
|
||||
</parent>
|
||||
<artifactId>archiva-repository-admin-api</artifactId>
|
||||
<name>Archiva Base :: Repository Admin Api</name>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>commons-collections</groupId>
|
||||
<artifactId>commons-collections</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>commons-lang</groupId>
|
||||
<artifactId>commons-lang</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.codehaus.redback</groupId>
|
||||
<artifactId>redback-users-api</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
@ -1,4 +1,4 @@
|
||||
package org.apache.archiva.admin.repository;
|
||||
package org.apache.archiva.admin.model;
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
@ -1,4 +1,4 @@
|
||||
package org.apache.archiva.admin.repository;
|
||||
package org.apache.archiva.admin.model;
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
@ -1,4 +1,4 @@
|
||||
package org.apache.archiva.admin;
|
||||
package org.apache.archiva.admin.model;
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
@ -1,4 +1,4 @@
|
||||
package org.apache.archiva.admin.repository;
|
||||
package org.apache.archiva.admin.model;
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
@ -1,4 +1,4 @@
|
||||
package org.apache.archiva.admin.repository.admin;
|
||||
package org.apache.archiva.admin.model.admin;
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
@ -18,8 +18,8 @@
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
import org.apache.archiva.admin.AuditInformation;
|
||||
import org.apache.archiva.admin.repository.RepositoryAdminException;
|
||||
import org.apache.archiva.admin.model.AuditInformation;
|
||||
import org.apache.archiva.admin.model.RepositoryAdminException;
|
||||
|
||||
import java.util.List;
|
||||
|
@ -1,4 +1,4 @@
|
||||
package org.apache.archiva.admin.repository.admin;
|
||||
package org.apache.archiva.admin.model.admin;
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
@ -1,4 +1,4 @@
|
||||
package org.apache.archiva.admin.repository.admin;
|
||||
package org.apache.archiva.admin.model.admin;
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
@ -1,4 +1,4 @@
|
||||
package org.apache.archiva.admin.repository.admin;
|
||||
package org.apache.archiva.admin.model.admin;
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
@ -1,4 +1,4 @@
|
||||
package org.apache.archiva.admin.repository.group;
|
||||
package org.apache.archiva.admin.model.group;
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
@ -1,4 +1,4 @@
|
||||
package org.apache.archiva.admin.repository.group;
|
||||
package org.apache.archiva.admin.model.group;
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
@ -18,8 +18,8 @@
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
import org.apache.archiva.admin.AuditInformation;
|
||||
import org.apache.archiva.admin.repository.RepositoryAdminException;
|
||||
import org.apache.archiva.admin.model.AuditInformation;
|
||||
import org.apache.archiva.admin.model.RepositoryAdminException;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
@ -1,4 +1,4 @@
|
||||
package org.apache.archiva.admin.repository.managed;
|
||||
package org.apache.archiva.admin.model.managed;
|
||||
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
@ -19,7 +19,7 @@
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
import org.apache.archiva.admin.repository.AbstractRepository;
|
||||
import org.apache.archiva.admin.model.AbstractRepository;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@ -51,7 +51,7 @@ public class ManagedRepository
|
||||
*/
|
||||
private ManagedRepository stagingRepository;
|
||||
|
||||
private boolean scanned = true;
|
||||
private boolean scanned = false;
|
||||
|
||||
private String indexDirectory;
|
||||
|
@ -1,4 +1,4 @@
|
||||
package org.apache.archiva.admin.repository.managed;
|
||||
package org.apache.archiva.admin.model.managed;
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
@ -19,8 +19,8 @@
|
||||
*/
|
||||
|
||||
|
||||
import org.apache.archiva.admin.AuditInformation;
|
||||
import org.apache.archiva.admin.repository.RepositoryAdminException;
|
||||
import org.apache.archiva.admin.model.AuditInformation;
|
||||
import org.apache.archiva.admin.model.RepositoryAdminException;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
@ -1,4 +1,4 @@
|
||||
package org.apache.archiva.admin.repository.networkproxy;
|
||||
package org.apache.archiva.admin.model.networkproxy;
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
@ -1,4 +1,4 @@
|
||||
package org.apache.archiva.admin.repository.networkproxy;
|
||||
package org.apache.archiva.admin.model.networkproxy;
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
@ -18,8 +18,8 @@
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
import org.apache.archiva.admin.AuditInformation;
|
||||
import org.apache.archiva.admin.repository.RepositoryAdminException;
|
||||
import org.apache.archiva.admin.model.AuditInformation;
|
||||
import org.apache.archiva.admin.model.RepositoryAdminException;
|
||||
|
||||
import java.util.List;
|
||||
|
@ -1,4 +1,4 @@
|
||||
package org.apache.archiva.admin.repository.proxyconnector;
|
||||
package org.apache.archiva.admin.model.proxyconnector;
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
@ -18,7 +18,7 @@
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
import org.apache.archiva.admin.repository.AbstractRepositoryConnector;
|
||||
import org.apache.archiva.admin.model.AbstractRepositoryConnector;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
@ -1,4 +1,4 @@
|
||||
package org.apache.archiva.admin.repository.proxyconnector;
|
||||
package org.apache.archiva.admin.model.proxyconnector;
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
@ -18,8 +18,8 @@
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
import org.apache.archiva.admin.AuditInformation;
|
||||
import org.apache.archiva.admin.repository.RepositoryAdminException;
|
||||
import org.apache.archiva.admin.model.AuditInformation;
|
||||
import org.apache.archiva.admin.model.RepositoryAdminException;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
@ -1,4 +1,4 @@
|
||||
package org.apache.archiva.admin.repository.proxyconnector;
|
||||
package org.apache.archiva.admin.model.proxyconnector;
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
@ -1,4 +1,4 @@
|
||||
package org.apache.archiva.admin.repository.proxyconnector;
|
||||
package org.apache.archiva.admin.model.proxyconnector;
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
@ -1,4 +1,4 @@
|
||||
package org.apache.archiva.admin.repository.remote;
|
||||
package org.apache.archiva.admin.model.remote;
|
||||
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
@ -19,7 +19,7 @@
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
import org.apache.archiva.admin.repository.AbstractRepository;
|
||||
import org.apache.archiva.admin.model.AbstractRepository;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
@ -1,4 +1,4 @@
|
||||
package org.apache.archiva.admin.repository.remote;
|
||||
package org.apache.archiva.admin.model.remote;
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
@ -19,8 +19,8 @@
|
||||
*/
|
||||
|
||||
|
||||
import org.apache.archiva.admin.AuditInformation;
|
||||
import org.apache.archiva.admin.repository.RepositoryAdminException;
|
||||
import org.apache.archiva.admin.model.AuditInformation;
|
||||
import org.apache.archiva.admin.model.RepositoryAdminException;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
@ -0,0 +1,200 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
~ 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.
|
||||
-->
|
||||
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>org.apache.archiva</groupId>
|
||||
<artifactId>archiva-repository-admin</artifactId>
|
||||
<version>1.4-SNAPSHOT</version>
|
||||
</parent>
|
||||
<artifactId>archiva-repository-admin-default</artifactId>
|
||||
<name>Archiva Base :: Repository Admin Default</name>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.apache.archiva</groupId>
|
||||
<artifactId>archiva-configuration</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.archiva</groupId>
|
||||
<artifactId>archiva-security-common</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.archiva</groupId>
|
||||
<artifactId>archiva-scheduler-repository</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.archiva</groupId>
|
||||
<artifactId>archiva-repository-admin-api</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.archiva</groupId>
|
||||
<artifactId>audit</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>javax.inject</groupId>
|
||||
<artifactId>javax.inject</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.sf.beanlib</groupId>
|
||||
<artifactId>beanlib</artifactId>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>cglib</groupId>
|
||||
<artifactId>cglib</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>aopalliance</groupId>
|
||||
<artifactId>aopalliance</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-context-support</artifactId>
|
||||
<version>${spring.version}</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>commons-logging</groupId>
|
||||
<artifactId>commons-logging</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-context</artifactId>
|
||||
<version>${spring.version}</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>commons-logging</groupId>
|
||||
<artifactId>commons-logging</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-api</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>commons-validator</groupId>
|
||||
<artifactId>commons-validator</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>oro</groupId>
|
||||
<artifactId>oro</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.codehaus.redback.components</groupId>
|
||||
<artifactId>spring-quartz</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.codehaus.redback</groupId>
|
||||
<artifactId>redback-rbac-role-manager</artifactId>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>commons-logging</groupId>
|
||||
<artifactId>commons-logging</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.codehaus.redback</groupId>
|
||||
<artifactId>redback-authentication-api</artifactId>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>commons-logging</groupId>
|
||||
<artifactId>commons-logging</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-log4j12</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.codehaus.redback</groupId>
|
||||
<artifactId>redback-users-memory</artifactId>
|
||||
<scope>test</scope>
|
||||
<version>${redback.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.codehaus.redback</groupId>
|
||||
<artifactId>redback-keys-memory</artifactId>
|
||||
<scope>test</scope>
|
||||
<version>${redback.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.codehaus.redback</groupId>
|
||||
<artifactId>redback-rbac-cached</artifactId>
|
||||
<version>${redback.version}</version>
|
||||
<scope>test</scope>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>commons-logging</groupId>
|
||||
<artifactId>commons-logging</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.derby</groupId>
|
||||
<artifactId>derby</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>jcl-over-slf4j</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.archiva</groupId>
|
||||
<artifactId>metadata-store-file</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<configuration>
|
||||
<systemPropertyVariables>
|
||||
<appserver.base>${project.build.outputDirectory}</appserver.base>
|
||||
<plexus.home>${project.build.outputDirectory}</plexus.home>
|
||||
</systemPropertyVariables>
|
||||
</configuration>
|
||||
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
@ -18,7 +18,8 @@
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
import org.apache.archiva.admin.AuditInformation;
|
||||
import org.apache.archiva.admin.model.AuditInformation;
|
||||
import org.apache.archiva.admin.model.RepositoryAdminException;
|
||||
import org.apache.archiva.audit.AuditEvent;
|
||||
import org.apache.archiva.audit.AuditListener;
|
||||
import org.apache.maven.archiva.configuration.ArchivaConfiguration;
|
@ -18,6 +18,8 @@
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
import org.apache.archiva.admin.model.AbstractRepository;
|
||||
import org.apache.archiva.admin.model.RepositoryAdminException;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.commons.validator.GenericValidator;
|
||||
import org.apache.maven.archiva.configuration.ArchivaConfiguration;
|
@ -19,9 +19,13 @@
|
||||
*/
|
||||
|
||||
import net.sf.beanlib.provider.replicator.BeanReplicator;
|
||||
import org.apache.archiva.admin.AuditInformation;
|
||||
import org.apache.archiva.admin.model.AuditInformation;
|
||||
import org.apache.archiva.admin.model.RepositoryAdminException;
|
||||
import org.apache.archiva.admin.model.admin.ArchivaAdministration;
|
||||
import org.apache.archiva.admin.model.admin.FileType;
|
||||
import org.apache.archiva.admin.model.admin.LegacyArtifactPath;
|
||||
import org.apache.archiva.admin.model.admin.OrganisationInformation;
|
||||
import org.apache.archiva.admin.repository.AbstractRepositoryAdmin;
|
||||
import org.apache.archiva.admin.repository.RepositoryAdminException;
|
||||
import org.apache.archiva.audit.AuditEvent;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.maven.archiva.configuration.Configuration;
|
@ -19,6 +19,7 @@
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
import org.apache.archiva.admin.model.admin.FileType;
|
||||
import org.apache.commons.collections.Closure;
|
||||
|
||||
import java.util.HashMap;
|
@ -18,11 +18,13 @@
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
import org.apache.archiva.admin.AuditInformation;
|
||||
import org.apache.archiva.admin.model.AuditInformation;
|
||||
import org.apache.archiva.admin.model.RepositoryAdminException;
|
||||
import org.apache.archiva.admin.model.group.RepositoryGroup;
|
||||
import org.apache.archiva.admin.model.group.RepositoryGroupAdmin;
|
||||
import org.apache.archiva.admin.model.managed.ManagedRepository;
|
||||
import org.apache.archiva.admin.model.managed.ManagedRepositoryAdmin;
|
||||
import org.apache.archiva.admin.repository.AbstractRepositoryAdmin;
|
||||
import org.apache.archiva.admin.repository.RepositoryAdminException;
|
||||
import org.apache.archiva.admin.repository.managed.ManagedRepository;
|
||||
import org.apache.archiva.admin.repository.managed.ManagedRepositoryAdmin;
|
||||
import org.apache.archiva.audit.AuditEvent;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.maven.archiva.configuration.Configuration;
|
@ -18,9 +18,11 @@
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
import org.apache.archiva.admin.AuditInformation;
|
||||
import org.apache.archiva.admin.model.AuditInformation;
|
||||
import org.apache.archiva.admin.model.RepositoryAdminException;
|
||||
import org.apache.archiva.admin.model.managed.ManagedRepository;
|
||||
import org.apache.archiva.admin.model.managed.ManagedRepositoryAdmin;
|
||||
import org.apache.archiva.admin.repository.AbstractRepositoryAdmin;
|
||||
import org.apache.archiva.admin.repository.RepositoryAdminException;
|
||||
import org.apache.archiva.audit.AuditEvent;
|
||||
import org.apache.archiva.metadata.repository.MetadataRepository;
|
||||
import org.apache.archiva.metadata.repository.MetadataRepositoryException;
|
||||
@ -206,6 +208,8 @@ private ManagedRepositoryConfiguration addManagedRepository( String repoId, Stri
|
||||
repository.setDaysOlder( daysOlder );
|
||||
repository.setRetentionCount( retentionCount );
|
||||
repository.setDeleteReleasedSnapshots( deteleReleasedSnapshots );
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
addRepository( repository, config );
|
@ -19,9 +19,11 @@
|
||||
*/
|
||||
|
||||
import net.sf.beanlib.provider.replicator.BeanReplicator;
|
||||
import org.apache.archiva.admin.AuditInformation;
|
||||
import org.apache.archiva.admin.model.AuditInformation;
|
||||
import org.apache.archiva.admin.model.RepositoryAdminException;
|
||||
import org.apache.archiva.admin.model.networkproxy.NetworkProxy;
|
||||
import org.apache.archiva.admin.model.networkproxy.NetworkProxyAdmin;
|
||||
import org.apache.archiva.admin.repository.AbstractRepositoryAdmin;
|
||||
import org.apache.archiva.admin.repository.RepositoryAdminException;
|
||||
import org.apache.archiva.audit.AuditEvent;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.maven.archiva.configuration.Configuration;
|
@ -19,11 +19,14 @@
|
||||
*/
|
||||
|
||||
import net.sf.beanlib.provider.replicator.BeanReplicator;
|
||||
import org.apache.archiva.admin.AuditInformation;
|
||||
import org.apache.archiva.admin.model.AuditInformation;
|
||||
import org.apache.archiva.admin.model.RepositoryAdminException;
|
||||
import org.apache.archiva.admin.model.managed.ManagedRepositoryAdmin;
|
||||
import org.apache.archiva.admin.model.proxyconnector.ProxyConnector;
|
||||
import org.apache.archiva.admin.model.proxyconnector.ProxyConnectorAdmin;
|
||||
import org.apache.archiva.admin.model.proxyconnector.ProxyConnectorOrderComparator;
|
||||
import org.apache.archiva.admin.model.remote.RemoteRepositoryAdmin;
|
||||
import org.apache.archiva.admin.repository.AbstractRepositoryAdmin;
|
||||
import org.apache.archiva.admin.repository.RepositoryAdminException;
|
||||
import org.apache.archiva.admin.repository.managed.ManagedRepositoryAdmin;
|
||||
import org.apache.archiva.admin.repository.remote.RemoteRepositoryAdmin;
|
||||
import org.apache.archiva.audit.AuditEvent;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.apache.commons.lang.StringUtils;
|
@ -18,9 +18,11 @@
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
import org.apache.archiva.admin.AuditInformation;
|
||||
import org.apache.archiva.admin.model.AuditInformation;
|
||||
import org.apache.archiva.admin.model.RepositoryAdminException;
|
||||
import org.apache.archiva.admin.model.remote.RemoteRepository;
|
||||
import org.apache.archiva.admin.model.remote.RemoteRepositoryAdmin;
|
||||
import org.apache.archiva.admin.repository.AbstractRepositoryAdmin;
|
||||
import org.apache.archiva.admin.repository.RepositoryAdminException;
|
||||
import org.apache.archiva.audit.AuditEvent;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.maven.archiva.configuration.Configuration;
|
@ -18,7 +18,7 @@
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
import org.apache.archiva.admin.repository.AbstractRepository;
|
||||
import org.apache.archiva.admin.model.AbstractRepository;
|
||||
|
||||
import java.util.Comparator;
|
||||
|
@ -19,13 +19,13 @@
|
||||
*/
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import org.apache.archiva.admin.AuditInformation;
|
||||
import org.apache.archiva.admin.mock.MockAuditListener;
|
||||
import org.apache.archiva.admin.repository.managed.ManagedRepository;
|
||||
import org.apache.archiva.admin.repository.managed.ManagedRepositoryAdmin;
|
||||
import org.apache.archiva.admin.repository.proxyconnector.ProxyConnectorAdmin;
|
||||
import org.apache.archiva.admin.repository.remote.RemoteRepository;
|
||||
import org.apache.archiva.admin.repository.remote.RemoteRepositoryAdmin;
|
||||
import org.apache.archiva.admin.model.AuditInformation;
|
||||
import org.apache.archiva.admin.model.managed.ManagedRepository;
|
||||
import org.apache.archiva.admin.model.managed.ManagedRepositoryAdmin;
|
||||
import org.apache.archiva.admin.model.proxyconnector.ProxyConnectorAdmin;
|
||||
import org.apache.archiva.admin.model.remote.RemoteRepository;
|
||||
import org.apache.archiva.admin.model.remote.RemoteRepositoryAdmin;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.codehaus.plexus.redback.role.RoleManager;
|
@ -18,8 +18,12 @@
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
import org.apache.archiva.admin.model.RepositoryAdminException;
|
||||
import org.apache.archiva.admin.model.admin.ArchivaAdministration;
|
||||
import org.apache.archiva.admin.model.admin.FileType;
|
||||
import org.apache.archiva.admin.model.admin.LegacyArtifactPath;
|
||||
import org.apache.archiva.admin.model.admin.OrganisationInformation;
|
||||
import org.apache.archiva.admin.repository.AbstractRepositoryAdminTest;
|
||||
import org.apache.archiva.admin.repository.RepositoryAdminException;
|
||||
import org.apache.archiva.audit.AuditEvent;
|
||||
import org.junit.Test;
|
||||
|
@ -18,8 +18,10 @@
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
import org.apache.archiva.admin.model.group.RepositoryGroup;
|
||||
import org.apache.archiva.admin.model.group.RepositoryGroupAdmin;
|
||||
import org.apache.archiva.admin.model.managed.ManagedRepository;
|
||||
import org.apache.archiva.admin.repository.AbstractRepositoryAdminTest;
|
||||
import org.apache.archiva.admin.repository.managed.ManagedRepository;
|
||||
import org.apache.archiva.audit.AuditEvent;
|
||||
import org.junit.Test;
|
||||
|
@ -18,11 +18,10 @@
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
import org.apache.archiva.admin.model.managed.ManagedRepository;
|
||||
import org.apache.archiva.admin.repository.AbstractRepositoryAdminTest;
|
||||
import org.apache.archiva.audit.AuditEvent;
|
||||
import org.apache.archiva.security.common.ArchivaRoleConstants;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.io.File;
|
@ -18,6 +18,8 @@
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
import org.apache.archiva.admin.model.networkproxy.NetworkProxy;
|
||||
import org.apache.archiva.admin.model.networkproxy.NetworkProxyAdmin;
|
||||
import org.apache.archiva.admin.repository.AbstractRepositoryAdminTest;
|
||||
import org.apache.archiva.audit.AuditEvent;
|
||||
import org.junit.Test;
|
@ -18,8 +18,9 @@
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
import org.apache.archiva.admin.model.proxyconnector.ProxyConnector;
|
||||
import org.apache.archiva.admin.model.remote.RemoteRepository;
|
||||
import org.apache.archiva.admin.repository.AbstractRepositoryAdminTest;
|
||||
import org.apache.archiva.admin.repository.remote.RemoteRepository;
|
||||
import org.apache.archiva.audit.AuditEvent;
|
||||
import org.junit.Test;
|
||||
|
@ -18,6 +18,7 @@
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
import org.apache.archiva.admin.model.remote.RemoteRepository;
|
||||
import org.apache.archiva.admin.repository.AbstractRepositoryAdminTest;
|
||||
import org.apache.archiva.audit.AuditEvent;
|
||||
import org.junit.Test;
|
@ -0,0 +1,213 @@
|
||||
<redback-role-model>
|
||||
<modelVersion>1.0.0</modelVersion>
|
||||
<applications>
|
||||
<application>
|
||||
<id>System</id>
|
||||
<description>Roles that apply system-wide, across all of the applications</description>
|
||||
<version>1.0.0</version>
|
||||
<resources>
|
||||
<resource>
|
||||
<id>global</id>
|
||||
<name>*</name>
|
||||
<permanent>true</permanent>
|
||||
<description>global resource implies full access for authorization</description>
|
||||
</resource>
|
||||
<resource>
|
||||
<id>username</id>
|
||||
<name>${username}</name>
|
||||
<permanent>true</permanent>
|
||||
<description>replaced with the username of the principal at authorization check time</description>
|
||||
</resource>
|
||||
</resources>
|
||||
<operations>
|
||||
<operation>
|
||||
<id>configuration-edit</id>
|
||||
<name>configuration-edit</name>
|
||||
<description>edit configuration</description>
|
||||
<permanent>true</permanent>
|
||||
</operation>
|
||||
<operation>
|
||||
<id>user-management-user-create</id>
|
||||
<name>user-management-user-create</name>
|
||||
<description>create user</description>
|
||||
<permanent>true</permanent>
|
||||
</operation>
|
||||
<operation>
|
||||
<id>user-management-user-edit</id>
|
||||
<name>user-management-user-edit</name>
|
||||
<description>edit user</description>
|
||||
<permanent>true</permanent>
|
||||
</operation>
|
||||
<operation>
|
||||
<id>user-management-user-role</id>
|
||||
<name>user-management-user-role</name>
|
||||
<description>user roles</description>
|
||||
<permanent>true</permanent>
|
||||
</operation>
|
||||
<operation>
|
||||
<id>user-management-user-delete</id>
|
||||
<name>user-management-user-delete</name>
|
||||
<description>delete user</description>
|
||||
<permanent>true</permanent>
|
||||
</operation>
|
||||
<operation>
|
||||
<id>user-management-user-list</id>
|
||||
<name>user-management-user-list</name>
|
||||
<description>list users</description>
|
||||
<permanent>true</permanent>
|
||||
</operation>
|
||||
<operation>
|
||||
<id>user-management-role-grant</id>
|
||||
<name>user-management-role-grant</name>
|
||||
<description>grant role</description>
|
||||
<permanent>true</permanent>
|
||||
</operation>
|
||||
<operation>
|
||||
<id>user-management-role-drop</id>
|
||||
<name>user-management-role-drop</name>
|
||||
<description>drop role</description>
|
||||
<permanent>true</permanent>
|
||||
</operation>
|
||||
<operation>
|
||||
<id>user-management-rbac-admin</id>
|
||||
<name>user-management-rbac-admin</name>
|
||||
<description>administer rbac</description>
|
||||
<permanent>true</permanent>
|
||||
</operation>
|
||||
<operation>
|
||||
<id>guest-access</id>
|
||||
<name>guest-access</name>
|
||||
<description>access guest</description>
|
||||
<permanent>true</permanent>
|
||||
</operation>
|
||||
<operation>
|
||||
<id>user-management-manage-data</id>
|
||||
<name>user-management-manage-data</name>
|
||||
<description>manage data</description>
|
||||
<permanent>true</permanent>
|
||||
</operation>
|
||||
</operations>
|
||||
<roles>
|
||||
<role>
|
||||
<id>system-administrator</id>
|
||||
<name>System Administrator</name>
|
||||
<permanent>true</permanent>
|
||||
<assignable>true</assignable>
|
||||
<permissions>
|
||||
<permission>
|
||||
<id>edit-redback-configuration</id>
|
||||
<name>Edit Redback Configuration</name>
|
||||
<operation>configuration-edit</operation>
|
||||
<resource>global</resource>
|
||||
<permanent>true</permanent>
|
||||
</permission>
|
||||
<permission>
|
||||
<id>manage-rbac-setup</id>
|
||||
<name>User RBAC Management</name>
|
||||
<operation>user-management-rbac-admin</operation>
|
||||
<resource>global</resource>
|
||||
<permanent>true</permanent>
|
||||
</permission>
|
||||
<permission>
|
||||
<id>manage-rbac-data</id>
|
||||
<name>RBAC Manage Data</name>
|
||||
<operation>user-management-manage-data</operation>
|
||||
<resource>global</resource>
|
||||
<permanent>true</permanent>
|
||||
</permission>
|
||||
</permissions>
|
||||
<childRoles>
|
||||
<childRole>user-administrator</childRole>
|
||||
</childRoles>
|
||||
</role>
|
||||
<role>
|
||||
<id>user-administrator</id>
|
||||
<name>User Administrator</name>
|
||||
<permanent>true</permanent>
|
||||
<assignable>true</assignable>
|
||||
<permissions>
|
||||
<permission>
|
||||
<id>drop-roles-for-anyone</id>
|
||||
<name>Drop Roles for Anyone</name>
|
||||
<operation>user-management-role-drop</operation>
|
||||
<resource>global</resource>
|
||||
<permanent>true</permanent>
|
||||
</permission>
|
||||
<permission>
|
||||
<id>grant-roles-for-anyone</id>
|
||||
<name>Grant Roles for Anyone</name>
|
||||
<operation>user-management-role-grant</operation>
|
||||
<resource>global</resource>
|
||||
<permanent>true</permanent>
|
||||
</permission>
|
||||
<permission>
|
||||
<id>user-create</id>
|
||||
<name>Create Users</name>
|
||||
<operation>user-management-user-create</operation>
|
||||
<resource>global</resource>
|
||||
<permanent>true</permanent>
|
||||
</permission>
|
||||
<permission>
|
||||
<id>user-delete</id>
|
||||
<name>Delete Users</name>
|
||||
<operation>user-management-user-delete</operation>
|
||||
<resource>global</resource>
|
||||
<permanent>true</permanent>
|
||||
</permission>
|
||||
<permission>
|
||||
<id>user-edit</id>
|
||||
<name>Edit Users</name>
|
||||
<operation>user-management-user-edit</operation>
|
||||
<resource>global</resource>
|
||||
<permanent>true</permanent>
|
||||
</permission>
|
||||
<permission>
|
||||
<id>access-users-roles</id>
|
||||
<name>Access Users Roles</name>
|
||||
<operation>user-management-user-role</operation>
|
||||
<resource>global</resource>
|
||||
<permanent>true</permanent>
|
||||
</permission>
|
||||
<permission>
|
||||
<id>access-user-list</id>
|
||||
<name>Access User List</name>
|
||||
<operation>user-management-user-list</operation>
|
||||
<resource>global</resource>
|
||||
<permanent>true</permanent>
|
||||
</permission>
|
||||
</permissions>
|
||||
</role>
|
||||
<role>
|
||||
<id>registered-user</id>
|
||||
<name>Registered User</name>
|
||||
<permanent>true</permanent>
|
||||
<assignable>true</assignable>
|
||||
<permissions>
|
||||
<permission>
|
||||
<id>edit-user-by-username</id>
|
||||
<name>Edit User Data by Username</name>
|
||||
<operation>user-management-user-edit</operation>
|
||||
<resource>username</resource>
|
||||
<permanent>true</permanent>
|
||||
</permission>
|
||||
</permissions>
|
||||
</role>
|
||||
<role>
|
||||
<id>guest</id>
|
||||
<name>Guest</name>
|
||||
<permanent>true</permanent>
|
||||
<assignable>true</assignable>
|
||||
<permissions>
|
||||
<permission>
|
||||
<id>guest-permission</id>
|
||||
<name>Guest Permission</name>
|
||||
<operation>guest-access</operation>
|
||||
<resource>global</resource>
|
||||
<permanent>true</permanent>
|
||||
</permission>
|
||||
</permissions>
|
||||
</role>
|
||||
</roles>
|
||||
</application>
|
||||
</applications>
|
||||
</redback-role-model>
|
@ -27,170 +27,9 @@
|
||||
</parent>
|
||||
<artifactId>archiva-repository-admin</artifactId>
|
||||
<name>Archiva Base :: Repository Admin</name>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.apache.archiva</groupId>
|
||||
<artifactId>archiva-configuration</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.archiva</groupId>
|
||||
<artifactId>archiva-security-common</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.archiva</groupId>
|
||||
<artifactId>archiva-scheduler-repository</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.archiva</groupId>
|
||||
<artifactId>audit</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>javax.inject</groupId>
|
||||
<artifactId>javax.inject</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.sf.beanlib</groupId>
|
||||
<artifactId>beanlib</artifactId>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>cglib</groupId>
|
||||
<artifactId>cglib</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>aopalliance</groupId>
|
||||
<artifactId>aopalliance</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-context-support</artifactId>
|
||||
<version>${spring.version}</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>commons-logging</groupId>
|
||||
<artifactId>commons-logging</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-context</artifactId>
|
||||
<version>${spring.version}</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>commons-logging</groupId>
|
||||
<artifactId>commons-logging</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-api</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>commons-validator</groupId>
|
||||
<artifactId>commons-validator</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>oro</groupId>
|
||||
<artifactId>oro</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.codehaus.redback.components</groupId>
|
||||
<artifactId>spring-quartz</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.codehaus.redback</groupId>
|
||||
<artifactId>redback-rbac-role-manager</artifactId>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>commons-logging</groupId>
|
||||
<artifactId>commons-logging</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.codehaus.redback</groupId>
|
||||
<artifactId>redback-authentication-api</artifactId>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>commons-logging</groupId>
|
||||
<artifactId>commons-logging</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-log4j12</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.codehaus.redback</groupId>
|
||||
<artifactId>redback-users-memory</artifactId>
|
||||
<scope>test</scope>
|
||||
<version>${redback.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.codehaus.redback</groupId>
|
||||
<artifactId>redback-keys-memory</artifactId>
|
||||
<scope>test</scope>
|
||||
<version>${redback.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.codehaus.redback</groupId>
|
||||
<artifactId>redback-rbac-cached</artifactId>
|
||||
<version>${redback.version}</version>
|
||||
<scope>test</scope>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>commons-logging</groupId>
|
||||
<artifactId>commons-logging</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.derby</groupId>
|
||||
<artifactId>derby</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>jcl-over-slf4j</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.archiva</groupId>
|
||||
<artifactId>metadata-store-file</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<configuration>
|
||||
<systemPropertyVariables>
|
||||
<appserver.base>${project.build.outputDirectory}</appserver.base>
|
||||
<plexus.home>${project.build.outputDirectory}</plexus.home>
|
||||
</systemPropertyVariables>
|
||||
</configuration>
|
||||
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
<packaging>pom</packaging>
|
||||
<modules>
|
||||
<module>archiva-repository-admin-api</module>
|
||||
<module>archiva-repository-admin-default</module>
|
||||
</modules>
|
||||
</project>
|
||||
|
@ -19,7 +19,7 @@
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
|
||||
import org.apache.archiva.admin.model.managed.ManagedRepository;
|
||||
import org.apache.maven.archiva.model.ArchivaArtifact;
|
||||
import org.apache.maven.archiva.model.ArtifactReference;
|
||||
import org.apache.maven.archiva.model.ProjectReference;
|
||||
@ -30,7 +30,7 @@
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* ManagedRepositoryContent interface for interacting with a managed repository in an abstract way,
|
||||
* ManagedRepositoryContent interface for interacting with a managed repository in an abstract way,
|
||||
* without the need for processing based on filesystem paths, or working with the database.
|
||||
*
|
||||
* @version $Id$
|
||||
@ -40,9 +40,9 @@ public interface ManagedRepositoryContent
|
||||
/**
|
||||
* Delete from the managed repository all files / directories associated with the
|
||||
* provided version reference.
|
||||
*
|
||||
*
|
||||
* @param reference the version reference to delete.
|
||||
* @throws ContentNotFoundException
|
||||
* @throws ContentNotFoundException
|
||||
*/
|
||||
void deleteVersion( VersionedReference reference )
|
||||
throws ContentNotFoundException;
|
||||
@ -51,11 +51,11 @@ void deleteVersion( VersionedReference reference )
|
||||
* <p>
|
||||
* Convenience method to get the repository id.
|
||||
* </p>
|
||||
*
|
||||
* <p/>
|
||||
* <p>
|
||||
* Equivalent to calling <code>.getRepository().getId()</code>
|
||||
* </p>
|
||||
*
|
||||
*
|
||||
* @return the repository id.
|
||||
*/
|
||||
String getId();
|
||||
@ -63,18 +63,18 @@ void deleteVersion( VersionedReference reference )
|
||||
/**
|
||||
* <p>
|
||||
* Gather up the list of related artifacts to the ArtifactReference provided.
|
||||
* This typically inclues the pom files, and those things with
|
||||
* This typically inclues the pom files, and those things with
|
||||
* classifiers (such as doc, source code, test libs, etc...)
|
||||
* </p>
|
||||
*
|
||||
* <p/>
|
||||
* <p>
|
||||
* <strong>NOTE:</strong> Some layouts (such as maven 1 "legacy") are not compatible with this query.
|
||||
* </p>
|
||||
*
|
||||
* </p>
|
||||
*
|
||||
* @param reference the reference to work off of.
|
||||
* @return the set of ArtifactReferences for related artifacts.
|
||||
* @throws ContentNotFoundException if the initial artifact reference does not exist within the repository.
|
||||
* @throws LayoutException
|
||||
* @throws LayoutException
|
||||
*/
|
||||
Set<ArtifactReference> getRelatedArtifacts( ArtifactReference reference )
|
||||
throws ContentNotFoundException;
|
||||
@ -83,11 +83,11 @@ Set<ArtifactReference> getRelatedArtifacts( ArtifactReference reference )
|
||||
* <p>
|
||||
* Convenience method to get the repository (on disk) root directory.
|
||||
* </p>
|
||||
*
|
||||
* <p/>
|
||||
* <p>
|
||||
* Equivalent to calling <code>.getRepository().getLocation()</code>
|
||||
* </p>
|
||||
*
|
||||
*
|
||||
* @return the repository (on disk) root directory.
|
||||
*/
|
||||
String getRepoRoot();
|
||||
@ -95,19 +95,19 @@ Set<ArtifactReference> getRelatedArtifacts( ArtifactReference reference )
|
||||
/**
|
||||
* Get the repository configuration associated with this
|
||||
* repository content.
|
||||
*
|
||||
*
|
||||
* @return the repository that is associated with this repository content.
|
||||
*/
|
||||
ManagedRepositoryConfiguration getRepository();
|
||||
ManagedRepository getRepository();
|
||||
|
||||
/**
|
||||
* Given a specific {@link ProjectReference}, return the list of available versions for
|
||||
* that project reference.
|
||||
*
|
||||
*
|
||||
* @param reference the project reference to work off of.
|
||||
* @return the list of versions found for that project reference.
|
||||
* @throws ContentNotFoundException if the project reference does nto exist within the repository.
|
||||
* @throws LayoutException
|
||||
* @throws LayoutException
|
||||
*/
|
||||
Set<String> getVersions( ProjectReference reference )
|
||||
throws ContentNotFoundException, LayoutException;
|
||||
@ -117,50 +117,50 @@ Set<String> getVersions( ProjectReference reference )
|
||||
* Given a specific {@link VersionedReference}, return the list of available versions for that
|
||||
* versioned reference.
|
||||
* </p>
|
||||
*
|
||||
* <p/>
|
||||
* <p>
|
||||
* <strong>NOTE:</strong> This is really only useful when working with SNAPSHOTs.
|
||||
* </p>
|
||||
*
|
||||
*
|
||||
* @param reference the versioned reference to work off of.
|
||||
* @return the set of versions found.
|
||||
* @throws ContentNotFoundException if the versioned reference does not exist within the repository.
|
||||
* @throws LayoutException
|
||||
* @throws LayoutException
|
||||
*/
|
||||
public Set<String> getVersions( VersionedReference reference )
|
||||
Set<String> getVersions( VersionedReference reference )
|
||||
throws ContentNotFoundException;
|
||||
|
||||
/**
|
||||
* Determines if the artifact referenced exists in the repository.
|
||||
*
|
||||
*
|
||||
* @param reference the artifact reference to check for.
|
||||
* @return true if the artifact referenced exists.
|
||||
*/
|
||||
public boolean hasContent( ArtifactReference reference );
|
||||
boolean hasContent( ArtifactReference reference );
|
||||
|
||||
/**
|
||||
* Determines if the project referenced exists in the repository.
|
||||
*
|
||||
*
|
||||
* @param reference the project reference to check for.
|
||||
* @return true it the project referenced exists.
|
||||
*/
|
||||
public boolean hasContent( ProjectReference reference );
|
||||
boolean hasContent( ProjectReference reference );
|
||||
|
||||
/**
|
||||
* Determines if the version reference exists in the repository.
|
||||
*
|
||||
*
|
||||
* @param reference the version reference to check for.
|
||||
* @return true if the version referenced exists.
|
||||
*/
|
||||
public boolean hasContent( VersionedReference reference );
|
||||
boolean hasContent( VersionedReference reference );
|
||||
|
||||
/**
|
||||
* Set the repository configuration to associate with this
|
||||
* repository content.
|
||||
*
|
||||
*
|
||||
* @param repo the repository to associate with this repository content.
|
||||
*/
|
||||
public void setRepository( ManagedRepositoryConfiguration repo );
|
||||
void setRepository( ManagedRepository repo );
|
||||
|
||||
/**
|
||||
* Given a repository relative path to a filename, return the {@link VersionedReference} object suitable for the path.
|
||||
@ -170,7 +170,7 @@ public Set<String> getVersions( VersionedReference reference )
|
||||
* a {@link ArtifactReference})
|
||||
* @throws LayoutException if there was a problem converting the path to an artifact.
|
||||
*/
|
||||
public ArtifactReference toArtifactReference( String path )
|
||||
ArtifactReference toArtifactReference( String path )
|
||||
throws LayoutException;
|
||||
|
||||
/**
|
||||
@ -179,33 +179,33 @@ public ArtifactReference toArtifactReference( String path )
|
||||
* @param reference the artifact reference to use.
|
||||
* @return the relative path to the artifact.
|
||||
*/
|
||||
public File toFile( ArtifactReference reference );
|
||||
|
||||
File toFile( ArtifactReference reference );
|
||||
|
||||
/**
|
||||
* Given an {@link ArchivaArtifact}, return the file reference to the artifact.
|
||||
*
|
||||
* @param reference the archiva artifact to use.
|
||||
* @return the relative path to the artifact.
|
||||
*/
|
||||
public File toFile( ArchivaArtifact reference );
|
||||
File toFile( ArchivaArtifact reference );
|
||||
|
||||
/**
|
||||
* Given a {@link ProjectReference}, return the path to the metadata for
|
||||
* the project.
|
||||
*
|
||||
* the project.
|
||||
*
|
||||
* @param reference the reference to use.
|
||||
* @return the path to the metadata file, or null if no metadata is appropriate.
|
||||
*/
|
||||
public String toMetadataPath( ProjectReference reference );
|
||||
String toMetadataPath( ProjectReference reference );
|
||||
|
||||
/**
|
||||
* Given a {@link VersionedReference}, return the path to the metadata for
|
||||
* the specific version of the project.
|
||||
*
|
||||
* the specific version of the project.
|
||||
*
|
||||
* @param reference the reference to use.
|
||||
* @return the path to the metadata file, or null if no metadata is appropriate.
|
||||
*/
|
||||
public String toMetadataPath( VersionedReference reference );
|
||||
String toMetadataPath( VersionedReference reference );
|
||||
|
||||
/**
|
||||
* Given an {@link ArtifactReference}, return the relative path to the artifact.
|
||||
@ -213,13 +213,13 @@ public ArtifactReference toArtifactReference( String path )
|
||||
* @param reference the artifact reference to use.
|
||||
* @return the relative path to the artifact.
|
||||
*/
|
||||
public String toPath( ArtifactReference reference );
|
||||
|
||||
String toPath( ArtifactReference reference );
|
||||
|
||||
/**
|
||||
* Given an {@link ArchivaArtifact}, return the relative path to the artifact.
|
||||
*
|
||||
* @param reference the archiva artifact to use.
|
||||
* @return the relative path to the artifact.
|
||||
*/
|
||||
public String toPath( ArchivaArtifact reference );
|
||||
String toPath( ArchivaArtifact reference );
|
||||
}
|
||||
|
@ -19,6 +19,7 @@
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
import org.apache.archiva.admin.model.remote.RemoteRepository;
|
||||
import org.apache.maven.archiva.configuration.RemoteRepositoryConfiguration;
|
||||
import org.apache.maven.archiva.model.ArtifactReference;
|
||||
import org.apache.maven.archiva.model.RepositoryURL;
|
||||
@ -51,7 +52,7 @@ public interface RemoteRepositoryContent
|
||||
*
|
||||
* @return the repository that is associated with this repository content.
|
||||
*/
|
||||
RemoteRepositoryConfiguration getRepository();
|
||||
RemoteRepository getRepository();
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@ -72,7 +73,7 @@ public interface RemoteRepositoryContent
|
||||
*
|
||||
* @param repo the repository to associate with this repository content.
|
||||
*/
|
||||
void setRepository( RemoteRepositoryConfiguration repo );
|
||||
void setRepository( RemoteRepository repo );
|
||||
|
||||
/**
|
||||
* Given a repository relative path to a filename, return the {@link VersionedReference} object suitable for the path.
|
||||
|
@ -19,10 +19,13 @@
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
import org.apache.archiva.admin.model.RepositoryAdminException;
|
||||
import org.apache.archiva.admin.model.managed.ManagedRepository;
|
||||
import org.apache.archiva.admin.model.managed.ManagedRepositoryAdmin;
|
||||
import org.apache.archiva.admin.model.remote.RemoteRepository;
|
||||
import org.apache.archiva.admin.model.remote.RemoteRepositoryAdmin;
|
||||
import org.apache.maven.archiva.configuration.ArchivaConfiguration;
|
||||
import org.apache.maven.archiva.configuration.ConfigurationNames;
|
||||
import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
|
||||
import org.apache.maven.archiva.configuration.RemoteRepositoryConfiguration;
|
||||
import org.codehaus.plexus.registry.Registry;
|
||||
import org.codehaus.plexus.registry.RegistryListener;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
@ -48,6 +51,12 @@ public class RepositoryContentFactory
|
||||
@Inject
|
||||
private ArchivaConfiguration archivaConfiguration;
|
||||
|
||||
@Inject
|
||||
private ManagedRepositoryAdmin managedRepositoryAdmin;
|
||||
|
||||
@Inject
|
||||
private RemoteRepositoryAdmin remoteRepositoryAdmin;
|
||||
|
||||
@Inject
|
||||
private ApplicationContext applicationContext;
|
||||
|
||||
@ -73,51 +82,65 @@ public RepositoryContentFactory()
|
||||
public ManagedRepositoryContent getManagedRepositoryContent( String repoId )
|
||||
throws RepositoryNotFoundException, RepositoryException
|
||||
{
|
||||
ManagedRepositoryContent repo = managedContentMap.get( repoId );
|
||||
|
||||
if ( repo != null )
|
||||
try
|
||||
{
|
||||
ManagedRepositoryContent repo = managedContentMap.get( repoId );
|
||||
|
||||
if ( repo != null )
|
||||
{
|
||||
return repo;
|
||||
}
|
||||
|
||||
ManagedRepository repoConfig = managedRepositoryAdmin.getManagedRepository( repoId );
|
||||
if ( repoConfig == null )
|
||||
{
|
||||
throw new RepositoryNotFoundException(
|
||||
"Unable to find managed repository configuration for id:" + repoId );
|
||||
}
|
||||
|
||||
repo = applicationContext.getBean( "managedRepositoryContent#" + repoConfig.getLayout(),
|
||||
ManagedRepositoryContent.class );
|
||||
repo.setRepository( repoConfig );
|
||||
managedContentMap.put( repoId, repo );
|
||||
|
||||
return repo;
|
||||
}
|
||||
|
||||
ManagedRepositoryConfiguration repoConfig =
|
||||
archivaConfiguration.getConfiguration().findManagedRepositoryById( repoId );
|
||||
if ( repoConfig == null )
|
||||
catch ( RepositoryAdminException e )
|
||||
{
|
||||
throw new RepositoryNotFoundException( "Unable to find managed repository configuration for id:" + repoId );
|
||||
throw new RepositoryException( e.getMessage(), e );
|
||||
}
|
||||
|
||||
repo = applicationContext.getBean( "managedRepositoryContent#" + repoConfig.getLayout(),
|
||||
ManagedRepositoryContent.class );
|
||||
repo.setRepository( repoConfig );
|
||||
managedContentMap.put( repoId, repo );
|
||||
|
||||
return repo;
|
||||
}
|
||||
|
||||
public RemoteRepositoryContent getRemoteRepositoryContent( String repoId )
|
||||
throws RepositoryNotFoundException, RepositoryException
|
||||
{
|
||||
RemoteRepositoryContent repo = remoteContentMap.get( repoId );
|
||||
|
||||
if ( repo != null )
|
||||
try
|
||||
{
|
||||
RemoteRepositoryContent repo = remoteContentMap.get( repoId );
|
||||
|
||||
if ( repo != null )
|
||||
{
|
||||
return repo;
|
||||
}
|
||||
|
||||
RemoteRepository repoConfig = remoteRepositoryAdmin.getRemoteRepository( repoId );
|
||||
if ( repoConfig == null )
|
||||
{
|
||||
throw new RepositoryNotFoundException(
|
||||
"Unable to find remote repository configuration for id:" + repoId );
|
||||
}
|
||||
|
||||
repo = applicationContext.getBean( "remoteRepositoryContent#" + repoConfig.getLayout(),
|
||||
RemoteRepositoryContent.class );
|
||||
repo.setRepository( repoConfig );
|
||||
remoteContentMap.put( repoId, repo );
|
||||
|
||||
return repo;
|
||||
}
|
||||
|
||||
RemoteRepositoryConfiguration repoConfig =
|
||||
archivaConfiguration.getConfiguration().findRemoteRepositoryById( repoId );
|
||||
if ( repoConfig == null )
|
||||
catch ( RepositoryAdminException e )
|
||||
{
|
||||
throw new RepositoryNotFoundException( "Unable to find remote repository configuration for id:" + repoId );
|
||||
throw new RepositoryException( e.getMessage(), e );
|
||||
}
|
||||
|
||||
repo = applicationContext.getBean( "remoteRepositoryContent#" + repoConfig.getLayout(),
|
||||
RemoteRepositoryContent.class );
|
||||
repo.setRepository( repoConfig );
|
||||
remoteContentMap.put( repoId, repo );
|
||||
|
||||
return repo;
|
||||
}
|
||||
|
||||
|
||||
|
@ -19,6 +19,7 @@
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
import org.apache.archiva.admin.model.managed.ManagedRepository;
|
||||
import org.apache.archiva.metadata.repository.storage.maven2.DefaultArtifactMappingProvider;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.apache.maven.archiva.common.utils.PathUtil;
|
||||
@ -57,7 +58,7 @@ public class ManagedDefaultRepositoryContent
|
||||
@Named(value = "fileTypes" )
|
||||
private FileTypes filetypes;
|
||||
|
||||
private ManagedRepositoryConfiguration repository;
|
||||
private ManagedRepository repository;
|
||||
|
||||
public ManagedDefaultRepositoryContent()
|
||||
{
|
||||
@ -148,7 +149,7 @@ public String getRepoRoot()
|
||||
return repository.getLocation();
|
||||
}
|
||||
|
||||
public ManagedRepositoryConfiguration getRepository()
|
||||
public ManagedRepository getRepository()
|
||||
{
|
||||
return repository;
|
||||
}
|
||||
@ -316,7 +317,7 @@ public boolean hasContent( VersionedReference reference )
|
||||
}
|
||||
}
|
||||
|
||||
public void setRepository( ManagedRepositoryConfiguration repository )
|
||||
public void setRepository( ManagedRepository repository )
|
||||
{
|
||||
this.repository = repository;
|
||||
}
|
||||
|
@ -19,6 +19,7 @@
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
import org.apache.archiva.admin.model.managed.ManagedRepository;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.maven.archiva.common.utils.PathUtil;
|
||||
@ -58,7 +59,7 @@ public class ManagedLegacyRepositoryContent
|
||||
@Inject
|
||||
private FileTypes filetypes;
|
||||
|
||||
private ManagedRepositoryConfiguration repository;
|
||||
private ManagedRepository repository;
|
||||
|
||||
public void deleteVersion( VersionedReference reference )
|
||||
throws ContentNotFoundException
|
||||
@ -198,7 +199,7 @@ public String getRepoRoot()
|
||||
return repository.getLocation();
|
||||
}
|
||||
|
||||
public ManagedRepositoryConfiguration getRepository()
|
||||
public ManagedRepository getRepository()
|
||||
{
|
||||
return repository;
|
||||
}
|
||||
@ -315,7 +316,7 @@ public boolean hasContent( VersionedReference reference )
|
||||
}
|
||||
}
|
||||
|
||||
public void setRepository( ManagedRepositoryConfiguration repository )
|
||||
public void setRepository( ManagedRepository repository )
|
||||
{
|
||||
this.repository = repository;
|
||||
}
|
||||
|
@ -19,6 +19,7 @@
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
import org.apache.archiva.admin.model.remote.RemoteRepository;
|
||||
import org.apache.maven.archiva.configuration.RemoteRepositoryConfiguration;
|
||||
import org.apache.maven.archiva.model.ArtifactReference;
|
||||
import org.apache.maven.archiva.model.RepositoryURL;
|
||||
@ -38,14 +39,14 @@ public class RemoteDefaultRepositoryContent
|
||||
extends AbstractDefaultRepositoryContent
|
||||
implements RemoteRepositoryContent
|
||||
{
|
||||
private RemoteRepositoryConfiguration repository;
|
||||
private RemoteRepository repository;
|
||||
|
||||
public String getId()
|
||||
{
|
||||
return repository.getId();
|
||||
}
|
||||
|
||||
public RemoteRepositoryConfiguration getRepository()
|
||||
public RemoteRepository getRepository()
|
||||
{
|
||||
return repository;
|
||||
}
|
||||
@ -55,7 +56,7 @@ public RepositoryURL getURL()
|
||||
return new RepositoryURL( repository.getUrl() );
|
||||
}
|
||||
|
||||
public void setRepository( RemoteRepositoryConfiguration repository )
|
||||
public void setRepository( RemoteRepository repository )
|
||||
{
|
||||
this.repository = repository;
|
||||
}
|
||||
|
@ -19,6 +19,7 @@
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
import org.apache.archiva.admin.model.remote.RemoteRepository;
|
||||
import org.apache.maven.archiva.configuration.RemoteRepositoryConfiguration;
|
||||
import org.apache.maven.archiva.model.ArtifactReference;
|
||||
import org.apache.maven.archiva.model.RepositoryURL;
|
||||
@ -39,14 +40,14 @@ public class RemoteLegacyRepositoryContent
|
||||
extends AbstractLegacyRepositoryContent
|
||||
implements RemoteRepositoryContent
|
||||
{
|
||||
private RemoteRepositoryConfiguration repository;
|
||||
private RemoteRepository repository;
|
||||
|
||||
public String getId()
|
||||
{
|
||||
return repository.getId();
|
||||
}
|
||||
|
||||
public RemoteRepositoryConfiguration getRepository()
|
||||
public RemoteRepository getRepository()
|
||||
{
|
||||
return repository;
|
||||
}
|
||||
@ -56,7 +57,7 @@ public RepositoryURL getURL()
|
||||
return new RepositoryURL( repository.getUrl() );
|
||||
}
|
||||
|
||||
public void setRepository( RemoteRepositoryConfiguration repository )
|
||||
public void setRepository( RemoteRepository repository )
|
||||
{
|
||||
this.repository = repository;
|
||||
}
|
||||
|
@ -19,6 +19,8 @@
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
import org.apache.archiva.admin.model.managed.ManagedRepository;
|
||||
import org.apache.archiva.admin.model.remote.RemoteRepository;
|
||||
import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
|
||||
import org.apache.maven.archiva.configuration.RemoteRepositoryConfiguration;
|
||||
import org.junit.Rule;
|
||||
@ -46,18 +48,18 @@ public abstract class AbstractRepositoryLayerTestCase
|
||||
@Inject
|
||||
protected ApplicationContext applicationContext;
|
||||
|
||||
protected ManagedRepositoryConfiguration createRepository( String id, String name, File location )
|
||||
protected ManagedRepository createRepository( String id, String name, File location )
|
||||
{
|
||||
ManagedRepositoryConfiguration repo = new ManagedRepositoryConfiguration();
|
||||
ManagedRepository repo = new ManagedRepository();
|
||||
repo.setId( id );
|
||||
repo.setName( name );
|
||||
repo.setLocation( location.getAbsolutePath() );
|
||||
return repo;
|
||||
}
|
||||
|
||||
protected RemoteRepositoryConfiguration createRemoteRepository( String id, String name, String url )
|
||||
protected RemoteRepository createRemoteRepository( String id, String name, String url )
|
||||
{
|
||||
RemoteRepositoryConfiguration repo = new RemoteRepositoryConfiguration();
|
||||
RemoteRepository repo = new RemoteRepository();
|
||||
repo.setId( id );
|
||||
repo.setName( name );
|
||||
repo.setUrl( url );
|
||||
@ -68,7 +70,7 @@ protected ManagedRepositoryContent createManagedRepositoryContent( String id, St
|
||||
String layout )
|
||||
throws Exception
|
||||
{
|
||||
ManagedRepositoryConfiguration repo = new ManagedRepositoryConfiguration();
|
||||
ManagedRepository repo = new ManagedRepository();
|
||||
repo.setId( id );
|
||||
repo.setName( name );
|
||||
repo.setLocation( location.getAbsolutePath() );
|
||||
@ -84,7 +86,7 @@ protected ManagedRepositoryContent createManagedRepositoryContent( String id, St
|
||||
protected RemoteRepositoryContent createRemoteRepositoryContent( String id, String name, String url, String layout )
|
||||
throws Exception
|
||||
{
|
||||
RemoteRepositoryConfiguration repo = new RemoteRepositoryConfiguration();
|
||||
RemoteRepository repo = new RemoteRepository();
|
||||
repo.setId( id );
|
||||
repo.setName( name );
|
||||
repo.setUrl( url );
|
||||
|
@ -19,6 +19,7 @@
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
import org.apache.archiva.admin.model.managed.ManagedRepository;
|
||||
import org.apache.maven.archiva.common.utils.VersionComparator;
|
||||
import org.apache.maven.archiva.configuration.ArchivaConfiguration;
|
||||
import org.apache.maven.archiva.configuration.FileType;
|
||||
@ -67,7 +68,7 @@ public void setUp()
|
||||
{
|
||||
File repoDir = new File( "src/test/repositories/default-repository" );
|
||||
|
||||
ManagedRepositoryConfiguration repository = createRepository( "testRepo", "Unit Test Repo", repoDir );
|
||||
ManagedRepository repository = createRepository( "testRepo", "Unit Test Repo", repoDir );
|
||||
|
||||
|
||||
FileType fileType =
|
||||
|
@ -19,6 +19,7 @@
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
import org.apache.archiva.admin.model.managed.ManagedRepository;
|
||||
import org.apache.maven.archiva.common.utils.VersionComparator;
|
||||
import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
|
||||
import org.apache.maven.archiva.model.ArtifactReference;
|
||||
@ -57,7 +58,7 @@ public void setUp()
|
||||
{
|
||||
File repoDir = new File( "src/test/repositories/legacy-repository" );
|
||||
|
||||
ManagedRepositoryConfiguration repository = createRepository( "testRepo", "Unit Test Repo", repoDir );
|
||||
ManagedRepository repository = createRepository( "testRepo", "Unit Test Repo", repoDir );
|
||||
repository.setLayout( "legacy" );
|
||||
|
||||
//repoContent = (ManagedRepositoryContent) lookup( ManagedRepositoryContent.class, "legacy" );
|
||||
|
@ -19,6 +19,7 @@
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
import org.apache.archiva.admin.model.remote.RemoteRepository;
|
||||
import org.apache.maven.archiva.configuration.RemoteRepositoryConfiguration;
|
||||
import org.apache.maven.archiva.model.ArtifactReference;
|
||||
import org.apache.maven.archiva.repository.RemoteRepositoryContent;
|
||||
@ -43,7 +44,7 @@ public class RemoteDefaultRepositoryContentTest
|
||||
public void setUp()
|
||||
throws Exception
|
||||
{
|
||||
RemoteRepositoryConfiguration repository = createRemoteRepository( "testRemoteRepo", "Unit Test Remote Repo",
|
||||
RemoteRepository repository = createRemoteRepository( "testRemoteRepo", "Unit Test Remote Repo",
|
||||
"http://repo1.maven.org/maven2/" );
|
||||
|
||||
//repoContent = (RemoteRepositoryContent) lookup( RemoteRepositoryContent.class, "default" );
|
||||
|
@ -19,6 +19,7 @@
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
import org.apache.archiva.admin.model.remote.RemoteRepository;
|
||||
import org.apache.maven.archiva.configuration.RemoteRepositoryConfiguration;
|
||||
import org.apache.maven.archiva.model.ArtifactReference;
|
||||
import org.apache.maven.archiva.repository.RemoteRepositoryContent;
|
||||
@ -44,7 +45,7 @@ public class RemoteLegacyRepositoryContentTest
|
||||
public void setUp()
|
||||
throws Exception
|
||||
{
|
||||
RemoteRepositoryConfiguration repository =
|
||||
RemoteRepository repository =
|
||||
createRemoteRepository( "testRemoteLegacyRepo", "Unit Test Remote Legacy Repo",
|
||||
"http://repo1.maven.org/maven/" );
|
||||
repository.setLayout( "legacy" );
|
||||
|
@ -19,6 +19,7 @@
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
import org.apache.archiva.admin.model.managed.ManagedRepository;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.maven.archiva.common.utils.VersionComparator;
|
||||
@ -355,7 +356,7 @@ private void assertSnapshotVersions( String artifactId, String version, String[]
|
||||
reference.setArtifactId( artifactId );
|
||||
reference.setVersion( version );
|
||||
|
||||
ManagedRepositoryConfiguration repo =
|
||||
ManagedRepository repo =
|
||||
createRepository( "test-repo", "Test Repository: " + name.getMethodName(), repoRootDir );
|
||||
ManagedRepositoryContent repoContent =
|
||||
applicationContext.getBean( "managedRepositoryContent#default", ManagedRepositoryContent.class );
|
||||
@ -583,7 +584,7 @@ private ManagedRepositoryContent createTestRepoContent()
|
||||
|
||||
repoRoot.mkdirs();
|
||||
|
||||
ManagedRepositoryConfiguration repoConfig =
|
||||
ManagedRepository repoConfig =
|
||||
createRepository( "test-repo", "Test Repository: " + name.getMethodName(), repoRoot );
|
||||
|
||||
ManagedRepositoryContent repoContent =
|
||||
|
@ -34,7 +34,7 @@
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.archiva</groupId>
|
||||
<artifactId>archiva-configuration</artifactId>
|
||||
<artifactId>archiva-repository-admin-api</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
@ -45,6 +45,13 @@
|
||||
<artifactId>slf4j-simple</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.archiva</groupId>
|
||||
<artifactId>archiva-configuration</artifactId>
|
||||
<!-- FIXME olamy : should be scope test but it depends on FileTypes
|
||||
<scope>test</scope>
|
||||
-->
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-test</artifactId>
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user