start some jobs git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1162369 13f79535-47bb-0310-9956-ffa450edef68tags/archiva-1.4-M1
@@ -193,7 +193,8 @@ public class DefaultArchivaConfiguration | |||
} | |||
Configuration config = new ConfigurationRegistryReader().read( subset ); | |||
config.getRepositoryGroups(); | |||
config.getRepositoryGroupsAsMap(); | |||
if ( !config.getRepositories().isEmpty() ) | |||
{ | |||
for ( Iterator<V1RepositoryConfiguration> i = config.getRepositories().iterator(); i.hasNext(); ) |
@@ -28,11 +28,30 @@ | |||
<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-scheduler-repository</artifactId> | |||
</dependency> | |||
<dependency> | |||
<groupId>javax.inject</groupId> | |||
<artifactId>javax.inject</artifactId> | |||
<version>1</version> | |||
</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> | |||
@@ -44,10 +63,43 @@ | |||
</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>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.apache.derby</groupId> | |||
<artifactId>derby</artifactId> | |||
<scope>test</scope> | |||
</dependency> | |||
<dependency> | |||
<groupId>org.slf4j</groupId> | |||
<artifactId>jcl-over-slf4j</artifactId> | |||
<scope>test</scope> | |||
</dependency> | |||
</dependencies> | |||
</project> |
@@ -26,6 +26,11 @@ package org.apache.archiva.admin.repository; | |||
public class RepositoryAdminException | |||
extends Exception | |||
{ | |||
public RepositoryAdminException( String s ) | |||
{ | |||
super( s ); | |||
} | |||
public RepositoryAdminException( String message, Throwable cause ) | |||
{ | |||
super( message, cause ); |
@@ -0,0 +1,325 @@ | |||
package org.apache.archiva.admin.repository.managed; | |||
/* | |||
* 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.repository.RepositoryAdminException; | |||
import org.apache.archiva.scheduler.repository.RepositoryArchivaTaskScheduler; | |||
import org.apache.archiva.scheduler.repository.RepositoryTask; | |||
import org.apache.commons.lang.StringUtils; | |||
import org.apache.commons.validator.GenericValidator; | |||
import org.apache.maven.archiva.configuration.ArchivaConfiguration; | |||
import org.apache.maven.archiva.configuration.Configuration; | |||
import org.apache.maven.archiva.configuration.IndeterminateConfigurationException; | |||
import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration; | |||
import org.codehaus.plexus.registry.Registry; | |||
import org.codehaus.plexus.registry.RegistryException; | |||
import org.codehaus.plexus.taskqueue.TaskQueueException; | |||
import org.codehaus.redback.components.scheduler.CronExpressionValidator; | |||
import org.slf4j.Logger; | |||
import org.slf4j.LoggerFactory; | |||
import org.springframework.stereotype.Service; | |||
import javax.inject.Inject; | |||
import javax.inject.Named; | |||
import java.io.File; | |||
import java.io.IOException; | |||
import java.util.ArrayList; | |||
import java.util.List; | |||
/** | |||
* FIXME remove all generic Exception to have usefull ones | |||
* FIXME review the staging mechanism to have a per user session one | |||
* | |||
* @author Olivier Lamy | |||
*/ | |||
@Service( "managedRepositoryAdmin#default" ) | |||
public class DefaultManagedRepositoryAdmin | |||
implements ManagedRepositoryAdmin | |||
{ | |||
public static final String REPOSITORY_ID_VALID_EXPRESSION = "^[a-zA-Z0-9._-]+$"; | |||
public static final String REPOSITORY_NAME_VALID_EXPRESSION = "^([a-zA-Z0-9.)/_(-]|\\s)+$"; | |||
public static final String REPOSITORY_LOCATION_VALID_EXPRESSION = "^[-a-zA-Z0-9._/~:?!&=\\\\]+$"; | |||
private Logger log = LoggerFactory.getLogger( getClass() ); | |||
@Inject | |||
private ArchivaConfiguration archivaConfiguration; | |||
@Inject | |||
@Named( value = "commons-configuration" ) | |||
private Registry registry; | |||
@Inject | |||
@Named( value = "archivaTaskScheduler#repository" ) | |||
private RepositoryArchivaTaskScheduler repositoryTaskScheduler; | |||
public List<ManagedRepository> getManagedRepositories() | |||
throws RepositoryAdminException | |||
{ | |||
List<ManagedRepositoryConfiguration> managedRepoConfigs = | |||
archivaConfiguration.getConfiguration().getManagedRepositories(); | |||
List<ManagedRepository> managedRepos = new ArrayList<ManagedRepository>( managedRepoConfigs.size() ); | |||
for ( ManagedRepositoryConfiguration repoConfig : managedRepoConfigs ) | |||
{ | |||
// TODO staging repo too | |||
ManagedRepository repo = | |||
new ManagedRepository( repoConfig.getId(), repoConfig.getName(), repoConfig.getLocation(), | |||
repoConfig.getLayout(), repoConfig.isSnapshots(), repoConfig.isReleases(), | |||
repoConfig.isBlockRedeployments(), repoConfig.getRefreshCronExpression() ); | |||
managedRepos.add( repo ); | |||
} | |||
return managedRepos; | |||
} | |||
public ManagedRepository getManagedRepository( String repositoryId ) | |||
throws RepositoryAdminException | |||
{ | |||
List<ManagedRepository> repos = getManagedRepositories(); | |||
for ( ManagedRepository repo : repos ) | |||
{ | |||
if ( StringUtils.equals( repo.getId(), repositoryId ) ) | |||
{ | |||
return repo; | |||
} | |||
} | |||
return null; | |||
} | |||
public Boolean deleteManagedRepository( String repositoryId ) | |||
throws RepositoryAdminException | |||
{ | |||
return null; //To change body of implemented methods use File | Settings | File Templates. | |||
} | |||
public Boolean addManagedRepository( ManagedRepository managedRepository, boolean needStageRepo ) | |||
throws RepositoryAdminException | |||
{ | |||
return | |||
addManagedRepository( managedRepository.getId(), managedRepository.getLayout(), managedRepository.getName(), | |||
managedRepository.getUrl(), managedRepository.isBlockRedeployments(), | |||
managedRepository.isReleases(), managedRepository.isSnapshots(), needStageRepo, | |||
managedRepository.getCronExpression() ) != null; | |||
} | |||
private ManagedRepositoryConfiguration addManagedRepository( String repoId, String layout, String name, | |||
String location, boolean blockRedeployments, | |||
boolean releasesIncluded, boolean snapshotsIncluded, | |||
boolean stageRepoNeeded, String cronExpression ) | |||
throws RepositoryAdminException | |||
{ | |||
Configuration config = archivaConfiguration.getConfiguration(); | |||
CronExpressionValidator validator = new CronExpressionValidator(); | |||
if ( config.getManagedRepositoriesAsMap().containsKey( repoId ) ) | |||
{ | |||
throw new RepositoryAdminException( "Unable to add new repository with id [" + repoId | |||
+ "], that id already exists as a managed repository." ); | |||
} | |||
else if ( config.getRemoteRepositoriesAsMap().containsKey( repoId ) ) | |||
{ | |||
throw new RepositoryAdminException( "Unable to add new repository with id [" + repoId | |||
+ "], that id already exists as a remote repository." ); | |||
} | |||
else if ( config.getRepositoryGroupsAsMap().containsKey( repoId ) ) | |||
{ | |||
throw new RepositoryAdminException( "Unable to add new repository with id [" + repoId | |||
+ "], that id already exists as a repository group." ); | |||
} | |||
if ( !validator.validate( cronExpression ) ) | |||
{ | |||
throw new RepositoryAdminException( "Invalid cron expression." ); | |||
} | |||
if ( !GenericValidator.matchRegexp( repoId, REPOSITORY_ID_VALID_EXPRESSION ) ) | |||
{ | |||
throw new RepositoryAdminException( | |||
"Invalid repository ID. Identifier must only contain alphanumeric characters, underscores(_), dots(.), and dashes(-)." ); | |||
} | |||
if ( !GenericValidator.matchRegexp( name, REPOSITORY_NAME_VALID_EXPRESSION ) ) | |||
{ | |||
throw new RepositoryAdminException( | |||
"Invalid repository name. Repository Name must only contain alphanumeric characters, white-spaces(' '), " | |||
+ "forward-slashes(/), open-parenthesis('('), close-parenthesis(')'), underscores(_), dots(.), and dashes(-)." ); | |||
} | |||
String repoLocation = removeExpressions( location ); | |||
if ( !GenericValidator.matchRegexp( repoLocation, REPOSITORY_LOCATION_VALID_EXPRESSION ) ) | |||
{ | |||
throw new RepositoryAdminException( | |||
"Invalid repository location. Directory must only contain alphanumeric characters, equals(=), question-marks(?), " | |||
+ "exclamation-points(!), ampersands(&), forward-slashes(/), back-slashes(\\), underscores(_), dots(.), colons(:), tildes(~), and dashes(-)." ); | |||
} | |||
ManagedRepositoryConfiguration repository = new ManagedRepositoryConfiguration(); | |||
repository.setId( repoId ); | |||
repository.setBlockRedeployments( blockRedeployments ); | |||
repository.setReleases( releasesIncluded ); | |||
repository.setSnapshots( snapshotsIncluded ); | |||
repository.setName( name ); | |||
repository.setLocation( repoLocation ); | |||
repository.setLayout( layout ); | |||
repository.setRefreshCronExpression( cronExpression ); | |||
try | |||
{ | |||
addRepository( repository, config ); | |||
if ( stageRepoNeeded ) | |||
{ | |||
ManagedRepositoryConfiguration stagingRepository = getStageRepoConfig( repository ); | |||
addRepository( stagingRepository, config ); | |||
} | |||
} | |||
catch ( IOException e ) | |||
{ | |||
throw new RepositoryAdminException( "failed to add repository " + e.getMessage(), e ); | |||
} | |||
saveConfiguration( config ); | |||
//MRM-1342 Repository statistics report doesn't appear to be working correctly | |||
//scan repository when adding of repository is successful | |||
try | |||
{ | |||
scanRepository( repoId, true ); | |||
if ( stageRepoNeeded ) | |||
{ | |||
ManagedRepositoryConfiguration stagingRepository = getStageRepoConfig( repository ); | |||
scanRepository( stagingRepository.getId(), true ); | |||
} | |||
} | |||
catch ( Exception e ) | |||
{ | |||
log.warn( new StringBuilder( "Unable to scan repository [" ).append( repoId ).append( "]: " ).append( | |||
e.getMessage() ).toString(), e ); | |||
} | |||
return repository; | |||
} | |||
public Boolean updateManagedRepository( ManagedRepository managedRepository, boolean needStageRepo ) | |||
throws RepositoryAdminException | |||
{ | |||
return null; //To change body of implemented methods use File | Settings | File Templates. | |||
} | |||
//-------------------------- | |||
// utils methods | |||
//-------------------------- | |||
private String removeExpressions( String directory ) | |||
{ | |||
String value = StringUtils.replace( directory, "${appserver.base}", | |||
registry.getString( "appserver.base", "${appserver.base}" ) ); | |||
value = StringUtils.replace( value, "${appserver.home}", | |||
registry.getString( "appserver.home", "${appserver.home}" ) ); | |||
return value; | |||
} | |||
private void saveConfiguration( Configuration config ) | |||
throws RepositoryAdminException | |||
{ | |||
try | |||
{ | |||
archivaConfiguration.save( config ); | |||
} | |||
catch ( RegistryException e ) | |||
{ | |||
throw new RepositoryAdminException( "Error occurred in the registry.", e ); | |||
} | |||
catch ( IndeterminateConfigurationException e ) | |||
{ | |||
throw new RepositoryAdminException( "Error occurred while saving the configuration.", e ); | |||
} | |||
} | |||
protected void addRepository( ManagedRepositoryConfiguration repository, Configuration configuration ) | |||
throws RepositoryAdminException, IOException | |||
{ | |||
// Normalize the path | |||
File file = new File( repository.getLocation() ); | |||
repository.setLocation( file.getCanonicalPath() ); | |||
if ( !file.exists() ) | |||
{ | |||
file.mkdirs(); | |||
} | |||
if ( !file.exists() || !file.isDirectory() ) | |||
{ | |||
throw new RepositoryAdminException( | |||
"Unable to add repository - no write access, can not create the root directory: " + file ); | |||
} | |||
configuration.addManagedRepository( repository ); | |||
} | |||
private ManagedRepositoryConfiguration getStageRepoConfig( ManagedRepositoryConfiguration repository ) | |||
{ | |||
ManagedRepositoryConfiguration stagingRepository = new ManagedRepositoryConfiguration(); | |||
stagingRepository.setId( repository.getId() + "-stage" ); | |||
stagingRepository.setLayout( repository.getLayout() ); | |||
stagingRepository.setName( repository.getName() + "-stage" ); | |||
stagingRepository.setBlockRedeployments( repository.isBlockRedeployments() ); | |||
stagingRepository.setDaysOlder( repository.getDaysOlder() ); | |||
stagingRepository.setDeleteReleasedSnapshots( repository.isDeleteReleasedSnapshots() ); | |||
stagingRepository.setIndexDir( repository.getIndexDir() ); | |||
String path = repository.getLocation(); | |||
int lastIndex = path.lastIndexOf( '/' ); | |||
stagingRepository.setLocation( path.substring( 0, lastIndex ) + "/" + stagingRepository.getId() ); | |||
stagingRepository.setRefreshCronExpression( repository.getRefreshCronExpression() ); | |||
stagingRepository.setReleases( repository.isReleases() ); | |||
stagingRepository.setRetentionCount( repository.getRetentionCount() ); | |||
stagingRepository.setScanned( repository.isScanned() ); | |||
stagingRepository.setSnapshots( repository.isSnapshots() ); | |||
return stagingRepository; | |||
} | |||
public Boolean scanRepository( String repositoryId, boolean fullScan ) | |||
{ | |||
if ( repositoryTaskScheduler.isProcessingRepositoryTask( repositoryId ) ) | |||
{ | |||
log.info( "scanning of repository with id {} already scheduled" ); | |||
} | |||
RepositoryTask task = new RepositoryTask(); | |||
task.setRepositoryId( repositoryId ); | |||
task.setScanAll( fullScan ); | |||
try | |||
{ | |||
repositoryTaskScheduler.queueTask( task ); | |||
} | |||
catch ( TaskQueueException e ) | |||
{ | |||
log.error( "failed to schedule scanning of repo with id {}", repositoryId, e ); | |||
return false; | |||
} | |||
return true; | |||
} | |||
} |
@@ -43,6 +43,8 @@ public class ManagedRepository | |||
private String cronExpression; | |||
private boolean stageRepoNeeded; | |||
/** | |||
* not need when creating the repo : only available when reading | |||
*/ | |||
@@ -63,7 +65,6 @@ public class ManagedRepository | |||
this.snapshots = snapshots; | |||
this.releases = releases; | |||
this.blockRedeployments = blockRedeployments; | |||
this.cronExpression = cronExpression; | |||
} | |||
public String getId() | |||
@@ -189,8 +190,21 @@ public class ManagedRepository | |||
@Override | |||
public String toString() | |||
{ | |||
return "ManagedRepository{" + "id='" + id + '\'' + ", name='" + name + '\'' + ", url='" + url + '\'' | |||
+ ", layout='" + layout + '\'' + ", snapshots=" + snapshots + ", releases=" + releases | |||
+ ", blockRedeployments=" + blockRedeployments + ", cronExpression='" + cronExpression + '\'' + '}'; | |||
final StringBuilder sb = new StringBuilder(); | |||
sb.append( "ManagedRepository" ); | |||
sb.append( "{id='" ).append( id ).append( '\'' ); | |||
sb.append( ", name='" ).append( name ).append( '\'' ); | |||
sb.append( ", url='" ).append( url ).append( '\'' ); | |||
sb.append( ", layout='" ).append( layout ).append( '\'' ); | |||
sb.append( ", snapshots=" ).append( snapshots ); | |||
sb.append( ", releases=" ).append( releases ); | |||
sb.append( ", blockRedeployments=" ).append( blockRedeployments ); | |||
sb.append( ", cronExpression='" ).append( cronExpression ).append( '\'' ); | |||
sb.append( ", stageRepoNeeded=" ).append( stageRepoNeeded ); | |||
sb.append( ", stagingRepository=" ).append( stagingRepository ); | |||
sb.append( '}' ); | |||
return sb.toString(); | |||
} | |||
} |
@@ -0,0 +1,36 @@ | |||
<?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"> | |||
<context:annotation-config /> | |||
<context:component-scan | |||
base-package="org.apache.archiva.admin.repository"/> | |||
</beans> |
@@ -0,0 +1,35 @@ | |||
package org.apache.archiva.admin.repository.managed; | |||
/* | |||
* 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 junit.framework.TestCase; | |||
import org.junit.runner.RunWith; | |||
import org.springframework.test.context.ContextConfiguration; | |||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; | |||
/** | |||
* @author Olivier Lamy | |||
*/ | |||
@RunWith( SpringJUnit4ClassRunner.class ) | |||
@ContextConfiguration( locations = { "classpath*:/META-INF/spring-context.xml", "classpath:/spring-context.xml" } ) | |||
public abstract class AbstractRepositoryAdminTest | |||
extends TestCase | |||
{ | |||
// no op | |||
} |
@@ -0,0 +1,53 @@ | |||
package org.apache.archiva.admin.repository.managed; | |||
/* | |||
* 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.junit.Test; | |||
import javax.inject.Inject; | |||
import java.util.List; | |||
/** | |||
* @author Olivier Lamy | |||
*/ | |||
public class ManagedRepositoryAdminTest | |||
extends AbstractRepositoryAdminTest | |||
{ | |||
@Inject | |||
private ManagedRepositoryAdmin managedRepositoryAdmin; | |||
@Test | |||
public void getAllManagedRepos() | |||
throws Exception | |||
{ | |||
List<ManagedRepository> repos = managedRepositoryAdmin.getManagedRepositories(); | |||
assertNotNull( repos ); | |||
assertTrue( repos.size() > 0 ); | |||
} | |||
@Test | |||
public void getById() | |||
throws Exception | |||
{ | |||
ManagedRepository repo = managedRepositoryAdmin.getManagedRepository( "internal" ); | |||
assertNotNull( repo ); | |||
} | |||
} |
@@ -0,0 +1,49 @@ | |||
<?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. | |||
--> | |||
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd"> | |||
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/"> | |||
<appender name="console" class="org.apache.log4j.ConsoleAppender"> | |||
<layout class="org.apache.log4j.PatternLayout"> | |||
<param name="ConversionPattern" value="%d [%t] %-5p %c %x - %m%n"/> | |||
</layout> | |||
</appender> | |||
<logger name="org.codehaus.redback.rest.services" > | |||
<level value="debug"/> | |||
</logger> | |||
<logger name="JPOX"> | |||
<level value="ERROR"/> | |||
</logger> | |||
<logger name="org.springframework"> | |||
<level value="info"/> | |||
</logger> | |||
<root> | |||
<priority value ="info" /> | |||
<appender-ref ref="console" /> | |||
</root> | |||
</log4j:configuration> |
@@ -0,0 +1,29 @@ | |||
<?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"> | |||
</beans> |
@@ -44,7 +44,7 @@ public interface ManagedRepositoryContent | |||
* @param reference the version reference to delete. | |||
* @throws ContentNotFoundException | |||
*/ | |||
public void deleteVersion( VersionedReference reference ) | |||
void deleteVersion( VersionedReference reference ) | |||
throws ContentNotFoundException; | |||
/** | |||
@@ -58,7 +58,7 @@ public interface ManagedRepositoryContent | |||
* | |||
* @return the repository id. | |||
*/ | |||
public String getId(); | |||
String getId(); | |||
/** | |||
* <p> | |||
@@ -76,7 +76,7 @@ public interface ManagedRepositoryContent | |||
* @throws ContentNotFoundException if the initial artifact reference does not exist within the repository. | |||
* @throws LayoutException | |||
*/ | |||
public Set<ArtifactReference> getRelatedArtifacts( ArtifactReference reference ) | |||
Set<ArtifactReference> getRelatedArtifacts( ArtifactReference reference ) | |||
throws ContentNotFoundException; | |||
/** | |||
@@ -90,7 +90,7 @@ public interface ManagedRepositoryContent | |||
* | |||
* @return the repository (on disk) root directory. | |||
*/ | |||
public String getRepoRoot(); | |||
String getRepoRoot(); | |||
/** | |||
* Get the repository configuration associated with this | |||
@@ -98,7 +98,7 @@ public interface ManagedRepositoryContent | |||
* | |||
* @return the repository that is associated with this repository content. | |||
*/ | |||
public ManagedRepositoryConfiguration getRepository(); | |||
ManagedRepositoryConfiguration getRepository(); | |||
/** | |||
* Given a specific {@link ProjectReference}, return the list of available versions for | |||
@@ -109,7 +109,7 @@ public interface ManagedRepositoryContent | |||
* @throws ContentNotFoundException if the project reference does nto exist within the repository. | |||
* @throws LayoutException | |||
*/ | |||
public Set<String> getVersions( ProjectReference reference ) | |||
Set<String> getVersions( ProjectReference reference ) | |||
throws ContentNotFoundException, LayoutException; | |||
/** |
@@ -43,7 +43,7 @@ public interface RemoteRepositoryContent | |||
* | |||
* @return the repository id. | |||
*/ | |||
public String getId(); | |||
String getId(); | |||
/** | |||
* Get the repository configuration associated with this | |||
@@ -51,7 +51,7 @@ public interface RemoteRepositoryContent | |||
* | |||
* @return the repository that is associated with this repository content. | |||
*/ | |||
public RemoteRepositoryConfiguration getRepository(); | |||
RemoteRepositoryConfiguration getRepository(); | |||
/** | |||
* <p> | |||
@@ -64,7 +64,7 @@ public interface RemoteRepositoryContent | |||
* | |||
* @return the repository url. | |||
*/ | |||
public RepositoryURL getURL(); | |||
RepositoryURL getURL(); | |||
/** | |||
* Set the repository configuration to associate with this | |||
@@ -72,7 +72,7 @@ public interface RemoteRepositoryContent | |||
* | |||
* @param repo the repository to associate with this repository content. | |||
*/ | |||
public void setRepository( RemoteRepositoryConfiguration repo ); | |||
void setRepository( RemoteRepositoryConfiguration repo ); | |||
/** | |||
* Given a repository relative path to a filename, return the {@link VersionedReference} object suitable for the path. | |||
@@ -82,7 +82,7 @@ public interface RemoteRepositoryContent | |||
* 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; | |||
/** | |||
@@ -91,7 +91,7 @@ public interface RemoteRepositoryContent | |||
* @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 ArtifactReference, return the url to the artifact. | |||
@@ -99,5 +99,5 @@ public interface RemoteRepositoryContent | |||
* @param reference the artifact reference to use. | |||
* @return the relative path to the artifact. | |||
*/ | |||
public RepositoryURL toURL( ArtifactReference reference ); | |||
RepositoryURL toURL( ArtifactReference reference ); | |||
} |
@@ -23,7 +23,6 @@ import org.codehaus.redback.rest.services.AbstractRestServicesTest; | |||
/** | |||
* @author Olivier Lamy | |||
* @since TODO | |||
*/ | |||
public abstract class AbstractArchivaRestTest | |||
extends AbstractRestServicesTest |
@@ -246,7 +246,7 @@ public class ArchivaDavResourceFactory | |||
// make a copy to avoid potential concurrent modifications (eg. by configuration) | |||
// TODO: ultimately, locking might be more efficient than copying in this fashion since updates are | |||
// infrequent | |||
ArrayList<String> repositories = new ArrayList<String>( repoGroupConfig.getRepositories() ); | |||
List<String> repositories = new ArrayList<String>( repoGroupConfig.getRepositories() ); | |||
resource = processRepositoryGroup( request, archivaLocator, repositories, activePrincipal, | |||
resourcesInAbsolutePath ); | |||
} |