diff --git a/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/project/readers/ProjectModel400Reader.java b/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/project/readers/ProjectModel400Reader.java index 09fa47318..72ba8d18b 100644 --- a/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/project/readers/ProjectModel400Reader.java +++ b/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/project/readers/ProjectModel400Reader.java @@ -71,8 +71,8 @@ public class ProjectModel400Reader if ( !"http://maven.apache.org/POM/4.0.0".equals( xml.getDefaultNamespaceURI() ) ) { + // No namespace defined // TODO: Output to monitor the problem with the Namespace. - System.out.println( "No namespace defined: " + pomFile ); } xml.removeNamespaces(); @@ -220,16 +220,11 @@ public class ProjectModel400Reader if ( dependencyList.contains( dependency ) ) { // TODO: throw into monitor as issue. - System.err.println( "Duplicate non-unique dependency detected [" + StringUtils.join( parts, ":" ) - + "]: " + toDependencyKey( dependency ) ); } dependencyList.add( dependency ); - System.out.println( "Added (list.size:" + dependencyList.size() + ") dependency: " - + toDependencyKey( dependency ) ); } - System.out.println( "## Returning dependency list: size=" + dependencyList.size() ); return dependencyList; } @@ -559,11 +554,4 @@ public class ProjectModel400Reader return defaultValue; } } - - private String toDependencyKey( Dependency dep ) - { - return "[" + dep.getGroupId() + ":" + dep.getArtifactId() + ":" + dep.getVersion() + ":" + dep.getClassifier() - + ":" + dep.getType() + "]"; - } - } diff --git a/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/database/DatabaseAction.java b/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/database/DatabaseAction.java index ebb42023c..3b276d7f4 100644 --- a/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/database/DatabaseAction.java +++ b/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/database/DatabaseAction.java @@ -19,15 +19,12 @@ package org.apache.maven.archiva.web.action.admin.database; * under the License. */ -import java.io.IOException; -import java.util.Collections; -import java.util.List; +import com.opensymphony.xwork.Preparable; import org.apache.commons.collections.CollectionUtils; import org.apache.maven.archiva.configuration.ArchivaConfiguration; import org.apache.maven.archiva.configuration.Configuration; import org.apache.maven.archiva.configuration.DatabaseScanningConfiguration; -import org.apache.maven.archiva.configuration.InvalidConfigurationException; import org.apache.maven.archiva.database.updater.DatabaseConsumers; import org.apache.maven.archiva.security.ArchivaRoleConstants; import org.apache.maven.archiva.web.action.admin.scanning.AdminRepositoryConsumerComparator; @@ -35,10 +32,10 @@ import org.codehaus.plexus.redback.rbac.Resource; import org.codehaus.plexus.redback.xwork.interceptor.SecureAction; import org.codehaus.plexus.redback.xwork.interceptor.SecureActionBundle; import org.codehaus.plexus.redback.xwork.interceptor.SecureActionException; -import org.codehaus.plexus.registry.RegistryException; import org.codehaus.plexus.xwork.action.PlexusActionSupport; -import com.opensymphony.xwork.Preparable; +import java.util.Collections; +import java.util.List; /** * DatabaseAction @@ -94,9 +91,6 @@ public class DatabaseAction AddAdminDatabaseConsumerClosure addAdminDbConsumer; - getLogger().info( "Total Available Unprocessed Consumers: " + databaseConsumers.getAvailableUnprocessedConsumers().size() ); - getLogger().info( "Total Available Cleanup Consumers: " + databaseConsumers.getAvailableCleanupConsumers().size() ); - addAdminDbConsumer = new AddAdminDatabaseConsumerClosure( dbscanning.getUnprocessedConsumers() ); CollectionUtils.forAllDo( databaseConsumers.getAvailableUnprocessedConsumers(), addAdminDbConsumer ); this.unprocessedConsumers = addAdminDbConsumer.getList(); @@ -110,8 +104,6 @@ public class DatabaseAction public String updateUnprocessedConsumers() { - getLogger().info( "updateUnprocesedConsumers()" ); - archivaConfiguration.getConfiguration().getDatabaseScanning().setUnprocessedConsumers( enabledUnprocessedConsumers ); return saveConfiguration(); @@ -119,8 +111,6 @@ public class DatabaseAction public String updateCleanupConsumers() { - getLogger().info( "updateCleanupConsumers()" ); - archivaConfiguration.getConfiguration().getDatabaseScanning().setCleanupConsumers( enabledCleanupConsumers ); return saveConfiguration(); @@ -128,8 +118,6 @@ public class DatabaseAction public String updateSchedule() { - getLogger().info( "updateSchedule()" ); - archivaConfiguration.getConfiguration().getDatabaseScanning().setCronExpression( cron ); return saveConfiguration(); @@ -137,8 +125,6 @@ public class DatabaseAction private String saveConfiguration() { - getLogger().info( ".saveConfiguration()" ); - try { archivaConfiguration.save( archivaConfiguration.getConfiguration() ); diff --git a/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/repository/RepositoryServlet.java b/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/repository/RepositoryServlet.java index a223cc065..be41f0f8d 100644 --- a/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/repository/RepositoryServlet.java +++ b/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/repository/RepositoryServlet.java @@ -101,7 +101,7 @@ public class RepositoryServlet configuration = (ArchivaConfiguration) lookup( ArchivaConfiguration.class.getName() ); configuration.addChangeListener( this ); - + updateRepositoryMap(); } @@ -140,7 +140,10 @@ public class RepositoryServlet public RepositoryConfiguration getRepository( DavServerRequest request ) { - return (RepositoryConfiguration) repositoryMap.get( request.getPrefix() ); + synchronized ( this.repositoryMap ) + { + return (RepositoryConfiguration) repositoryMap.get( request.getPrefix() ); + } } public String getRepositoryName( DavServerRequest request ) @@ -159,9 +162,12 @@ public class RepositoryServlet RepositoryConfigurationToMapClosure repoMapClosure = new RepositoryConfigurationToMapClosure(); Closure localRepoMap = IfClosure.getInstance( LocalRepositoryPredicate.getInstance(), repoMapClosure ); CollectionUtils.forAllDo( configuration.getConfiguration().getRepositories(), localRepoMap ); - - this.repositoryMap.clear(); - this.repositoryMap.putAll( repoMapClosure.getMap() ); + + synchronized ( this.repositoryMap ) + { + this.repositoryMap.clear(); + this.repositoryMap.putAll( repoMapClosure.getMap() ); + } } public boolean isAuthenticated( DavServerRequest davRequest, HttpServletResponse response ) @@ -227,7 +233,8 @@ public class RepositoryServlet if ( authzResult.getException() != null ) { log( "Authorization Denied [ip=" + request.getRemoteAddr() + ",isWriteRequest=" + isWriteRequest - + ",permission=" + permission + ",repo=" + davRequest.getPrefix() + "] : " + authzResult.getException().getMessage() ); + + ",permission=" + permission + ",repo=" + davRequest.getPrefix() + "] : " + + authzResult.getException().getMessage() ); } // Issue HTTP Challenge. @@ -253,18 +260,25 @@ public class RepositoryServlet { if ( ConfigurationNames.isRepositories( propertyName ) ) { - updateRepositoryMap(); - - getDavManager().removeAllServers(); - - try + // Attempt to reduce the number of times we refresh the repository map. + if ( propertyName.endsWith( ".id" ) || propertyName.endsWith( ".url" ) ) { - initServers( getServletConfig() ); - } - catch ( DavServerException e ) - { - log( "Error restarting WebDAV server after configuration change - service disabled: " + e.getMessage(), - e ); + synchronized ( this.repositoryMap ) + { + updateRepositoryMap(); + + getDavManager().removeAllServers(); + + try + { + initServers( getServletConfig() ); + } + catch ( DavServerException e ) + { + log( "Error restarting WebDAV server after configuration change - service disabled: " + + e.getMessage(), e ); + } + } } } }