From 9074bfb0f42034b5f1248d9d022594e4f4556599 Mon Sep 17 00:00:00 2001 From: Olivier Lamy Date: Mon, 29 Oct 2012 20:58:54 +0000 Subject: [PATCH] [MRM-1704] Refactor to remove maven specific part from various repository/metadata apis git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1403504 13f79535-47bb-0310-9956-ffa450edef68 --- .../archiva-base/archiva-proxy/pom.xml | 10 +- .../archiva-repository-admin-default/pom.xml | 12 +- .../resources/META-INF/spring-context.xml | 6 - .../archiva-scheduler-repository/pom.xml | 5 + ...efaultRepositoryArchivaTaskScheduler.java} | 9 +- .../scheduler/repository/RepositoryTask.java | 145 ------------------ .../repository/RepositoryTaskJob.java | 4 +- archiva-modules/archiva-scheduler/pom.xml | 1 + .../rest/services/AbstractRestService.java | 4 +- .../archiva/web/startup/ArchivaStartup.java | 6 +- .../resources/META-INF/spring-context.xml | 7 + pom.xml | 5 + 12 files changed, 42 insertions(+), 172 deletions(-) rename archiva-modules/archiva-scheduler/archiva-scheduler-repository/src/main/java/org/apache/archiva/scheduler/repository/{RepositoryArchivaTaskScheduler.java => DefaultRepositoryArchivaTaskScheduler.java} (97%) delete mode 100644 archiva-modules/archiva-scheduler/archiva-scheduler-repository/src/main/java/org/apache/archiva/scheduler/repository/RepositoryTask.java diff --git a/archiva-modules/archiva-base/archiva-proxy/pom.xml b/archiva-modules/archiva-base/archiva-proxy/pom.xml index 16a9948a5..56714b70c 100644 --- a/archiva-modules/archiva-base/archiva-proxy/pom.xml +++ b/archiva-modules/archiva-base/archiva-proxy/pom.xml @@ -37,10 +37,6 @@ org.apache.archiva archiva-scheduler-api - - org.apache.archiva - archiva-scheduler-repository - org.apache.archiva archiva-repository-layer @@ -59,10 +55,10 @@ org.apache.archiva archiva-repository-scanner - + archiva-scheduler-repository-api + org.apache.archiva archiva-proxy-common diff --git a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/pom.xml b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/pom.xml index 4088371a5..2d72d1a14 100644 --- a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/pom.xml +++ b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/pom.xml @@ -37,14 +37,18 @@ org.apache.archiva archiva-security-common - + org.apache.archiva - archiva-scheduler-repository + archiva-scheduler-repository-api org.apache.archiva archiva-repository-admin-api + + org.apache.archiva + repository-statistics + org.apache.archiva archiva-plexus-bridge @@ -57,6 +61,10 @@ javax.inject javax.inject + + org.apache.archiva.redback.components + spring-taskqueue + net.sf.beanlib beanlib diff --git a/archiva-modules/archiva-base/archiva-repository-layer/src/main/resources/META-INF/spring-context.xml b/archiva-modules/archiva-base/archiva-repository-layer/src/main/resources/META-INF/spring-context.xml index c49f9edb4..ec802252d 100644 --- a/archiva-modules/archiva-base/archiva-repository-layer/src/main/resources/META-INF/spring-context.xml +++ b/archiva-modules/archiva-base/archiva-repository-layer/src/main/resources/META-INF/spring-context.xml @@ -30,10 +30,4 @@ - - - - - - \ No newline at end of file diff --git a/archiva-modules/archiva-scheduler/archiva-scheduler-repository/pom.xml b/archiva-modules/archiva-scheduler/archiva-scheduler-repository/pom.xml index fb3b73664..5bb2b77ef 100644 --- a/archiva-modules/archiva-scheduler/archiva-scheduler-repository/pom.xml +++ b/archiva-modules/archiva-scheduler/archiva-scheduler-repository/pom.xml @@ -32,6 +32,11 @@ org.apache.archiva archiva-scheduler-api + + org.apache.archiva + archiva-scheduler-repository-api + ${project.version} + commons-io commons-io diff --git a/archiva-modules/archiva-scheduler/archiva-scheduler-repository/src/main/java/org/apache/archiva/scheduler/repository/RepositoryArchivaTaskScheduler.java b/archiva-modules/archiva-scheduler/archiva-scheduler-repository/src/main/java/org/apache/archiva/scheduler/repository/DefaultRepositoryArchivaTaskScheduler.java similarity index 97% rename from archiva-modules/archiva-scheduler/archiva-scheduler-repository/src/main/java/org/apache/archiva/scheduler/repository/RepositoryArchivaTaskScheduler.java rename to archiva-modules/archiva-scheduler/archiva-scheduler-repository/src/main/java/org/apache/archiva/scheduler/repository/DefaultRepositoryArchivaTaskScheduler.java index 65894ac78..90a28a3fa 100644 --- a/archiva-modules/archiva-scheduler/archiva-scheduler-repository/src/main/java/org/apache/archiva/scheduler/repository/RepositoryArchivaTaskScheduler.java +++ b/archiva-modules/archiva-scheduler/archiva-scheduler-repository/src/main/java/org/apache/archiva/scheduler/repository/DefaultRepositoryArchivaTaskScheduler.java @@ -55,10 +55,10 @@ import java.util.Set; * Default implementation of a scheduling component for archiva. */ @Service ("archivaTaskScheduler#repository") -public class RepositoryArchivaTaskScheduler - implements ArchivaTaskScheduler, ConfigurationListener +public class DefaultRepositoryArchivaTaskScheduler + implements RepositoryArchivaTaskScheduler, ConfigurationListener { - private Logger log = LoggerFactory.getLogger( RepositoryArchivaTaskScheduler.class ); + private Logger log = LoggerFactory.getLogger( getClass() ); /** * @@ -200,8 +200,7 @@ public class RepositoryArchivaTaskScheduler } } - @SuppressWarnings ("unchecked") - private boolean isProcessingRepositoryTask( RepositoryTask task ) + public boolean isProcessingRepositoryTask( RepositoryTask task ) { synchronized ( repositoryScanningQueue ) { diff --git a/archiva-modules/archiva-scheduler/archiva-scheduler-repository/src/main/java/org/apache/archiva/scheduler/repository/RepositoryTask.java b/archiva-modules/archiva-scheduler/archiva-scheduler-repository/src/main/java/org/apache/archiva/scheduler/repository/RepositoryTask.java deleted file mode 100644 index b023cdd2f..000000000 --- a/archiva-modules/archiva-scheduler/archiva-scheduler-repository/src/main/java/org/apache/archiva/scheduler/repository/RepositoryTask.java +++ /dev/null @@ -1,145 +0,0 @@ -package org.apache.archiva.scheduler.repository; - -import org.apache.archiva.redback.components.taskqueue.Task; - -import java.io.File; - -/* - * 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. - */ - -/** - * DataRefreshTask - task for discovering changes in the repository - * and updating all associated data. - * - * - */ -public class RepositoryTask - implements Task -{ - private String repositoryId; - - private File resourceFile; - - private boolean updateRelatedArtifacts; - - private boolean scanAll; - - public boolean isScanAll() - { - return scanAll; - } - - public void setScanAll( boolean scanAll ) - { - this.scanAll = scanAll; - } - - public String getRepositoryId() - { - return repositoryId; - } - - public void setRepositoryId( String repositoryId ) - { - this.repositoryId = repositoryId; - } - - public long getMaxExecutionTime() - { - return 0; - } - - public File getResourceFile() - { - return resourceFile; - } - - public void setResourceFile( File resourceFile ) - { - this.resourceFile = resourceFile; - } - - public boolean isUpdateRelatedArtifacts() - { - return updateRelatedArtifacts; - } - - public void setUpdateRelatedArtifacts( boolean updateRelatedArtifacts ) - { - this.updateRelatedArtifacts = updateRelatedArtifacts; - } - - @Override - public String toString() - { - return "RepositoryTask [repositoryId=" + repositoryId + ", resourceFile=" + resourceFile + ", scanAll=" - + scanAll + ", updateRelatedArtifacts=" + updateRelatedArtifacts + "]"; - } - - @Override - public int hashCode() - { - final int prime = 31; - int result = 1; - result = prime * result + ( ( repositoryId == null ) ? 0 : repositoryId.hashCode() ); - result = prime * result + ( ( resourceFile == null ) ? 0 : resourceFile.hashCode() ); - return result; - } - - @Override - public boolean equals( Object obj ) - { - if ( this == obj ) - { - return true; - } - if ( obj == null ) - { - return false; - } - if ( getClass() != obj.getClass() ) - { - return false; - } - RepositoryTask other = (RepositoryTask) obj; - if ( repositoryId == null ) - { - if ( other.repositoryId != null ) - { - return false; - } - } - else if ( !repositoryId.equals( other.repositoryId ) ) - { - return false; - } - if ( resourceFile == null ) - { - if ( other.resourceFile != null ) - { - return false; - } - } - else if ( !resourceFile.equals( other.resourceFile ) ) - { - return false; - } - return true; - } -} diff --git a/archiva-modules/archiva-scheduler/archiva-scheduler-repository/src/main/java/org/apache/archiva/scheduler/repository/RepositoryTaskJob.java b/archiva-modules/archiva-scheduler/archiva-scheduler-repository/src/main/java/org/apache/archiva/scheduler/repository/RepositoryTaskJob.java index eea487d72..6789459b9 100644 --- a/archiva-modules/archiva-scheduler/archiva-scheduler-repository/src/main/java/org/apache/archiva/scheduler/repository/RepositoryTaskJob.java +++ b/archiva-modules/archiva-scheduler/archiva-scheduler-repository/src/main/java/org/apache/archiva/scheduler/repository/RepositoryTaskJob.java @@ -44,9 +44,9 @@ public class RepositoryTaskJob JobDataMap dataMap = context.getJobDetail().getJobDataMap(); setJobDataMap( dataMap ); - TaskQueue taskQueue = (TaskQueue) dataMap.get( RepositoryArchivaTaskScheduler.TASK_QUEUE ); + TaskQueue taskQueue = (TaskQueue) dataMap.get( DefaultRepositoryArchivaTaskScheduler.TASK_QUEUE ); - String repositoryId = (String) dataMap.get( RepositoryArchivaTaskScheduler.TASK_REPOSITORY ); + String repositoryId = (String) dataMap.get( DefaultRepositoryArchivaTaskScheduler.TASK_REPOSITORY ); RepositoryTask task = new RepositoryTask(); task.setRepositoryId( repositoryId ); diff --git a/archiva-modules/archiva-scheduler/pom.xml b/archiva-modules/archiva-scheduler/pom.xml index 4e215012a..df0fe7289 100644 --- a/archiva-modules/archiva-scheduler/pom.xml +++ b/archiva-modules/archiva-scheduler/pom.xml @@ -31,6 +31,7 @@ archiva-scheduler-api archiva-scheduler-indexing + archiva-scheduler-repository-api archiva-scheduler-repository diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/AbstractRestService.java b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/AbstractRestService.java index 9a7ce13e2..7d5273618 100644 --- a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/AbstractRestService.java +++ b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/AbstractRestService.java @@ -38,7 +38,7 @@ import org.apache.archiva.repository.RepositoryContentFactory; import org.apache.archiva.repository.RepositoryException; import org.apache.archiva.rest.api.services.ArchivaRestServiceException; import org.apache.archiva.rest.services.utils.ArtifactBuilder; -import org.apache.archiva.scheduler.repository.RepositoryArchivaTaskScheduler; +import org.apache.archiva.scheduler.repository.DefaultRepositoryArchivaTaskScheduler; import org.apache.archiva.scheduler.repository.RepositoryTask; import org.apache.archiva.security.AccessDeniedException; import org.apache.archiva.security.ArchivaSecurityException; @@ -93,7 +93,7 @@ public abstract class AbstractRestService @Inject @Named ( value = "archivaTaskScheduler#repository" ) - protected RepositoryArchivaTaskScheduler repositoryTaskScheduler; + protected DefaultRepositoryArchivaTaskScheduler repositoryTaskScheduler; @Context protected HttpServletRequest httpServletRequest; diff --git a/archiva-modules/archiva-web/archiva-web-common/src/main/java/org/apache/archiva/web/startup/ArchivaStartup.java b/archiva-modules/archiva-web/archiva-web-common/src/main/java/org/apache/archiva/web/startup/ArchivaStartup.java index f35e7b768..3d4a444ee 100644 --- a/archiva-modules/archiva-web/archiva-web-common/src/main/java/org/apache/archiva/web/startup/ArchivaStartup.java +++ b/archiva-modules/archiva-web/archiva-web-common/src/main/java/org/apache/archiva/web/startup/ArchivaStartup.java @@ -23,7 +23,7 @@ import org.apache.archiva.common.ArchivaException; import org.apache.archiva.common.plexusbridge.PlexusSisuBridge; import org.apache.archiva.common.plexusbridge.PlexusSisuBridgeException; import org.apache.archiva.redback.components.scheduler.DefaultScheduler; -import org.apache.archiva.scheduler.repository.RepositoryArchivaTaskScheduler; +import org.apache.archiva.scheduler.repository.DefaultRepositoryArchivaTaskScheduler; import org.apache.maven.index.NexusIndexer; import org.apache.maven.index.context.IndexingContext; import org.apache.archiva.redback.components.taskqueue.Task; @@ -52,7 +52,7 @@ public class ArchivaStartup private ThreadedTaskQueueExecutor tqeIndexing; - private RepositoryArchivaTaskScheduler repositoryTaskScheduler; + private DefaultRepositoryArchivaTaskScheduler repositoryTaskScheduler; private PlexusSisuBridge plexusSisuBridge; @@ -66,7 +66,7 @@ public class ArchivaStartup SecuritySynchronization securitySync = wac.getBean( SecuritySynchronization.class ); repositoryTaskScheduler = - wac.getBean( "archivaTaskScheduler#repository", RepositoryArchivaTaskScheduler.class ); + wac.getBean( "archivaTaskScheduler#repository", DefaultRepositoryArchivaTaskScheduler.class ); Properties archivaRuntimeProperties = wac.getBean( "archivaRuntimeProperties", Properties.class ); diff --git a/archiva-modules/plugins/maven2-repository/src/main/resources/META-INF/spring-context.xml b/archiva-modules/plugins/maven2-repository/src/main/resources/META-INF/spring-context.xml index 1eb4daf9d..47125c353 100644 --- a/archiva-modules/plugins/maven2-repository/src/main/resources/META-INF/spring-context.xml +++ b/archiva-modules/plugins/maven2-repository/src/main/resources/META-INF/spring-context.xml @@ -31,4 +31,11 @@ + + + + + + + \ No newline at end of file diff --git a/pom.xml b/pom.xml index 659d191d2..c129639ef 100644 --- a/pom.xml +++ b/pom.xml @@ -370,6 +370,11 @@ archiva-scheduler-api ${project.version} + + org.apache.archiva + archiva-scheduler-repository-api + ${project.version} + org.apache.archiva archiva-scheduler-repository -- 2.39.5