From d9348b93af2d94112893bba79d321e33d635a1b0 Mon Sep 17 00:00:00 2001 From: Olivier Lamy Date: Mon, 29 Oct 2012 21:06:17 +0000 Subject: use a more appropriate package for this interface git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1403523 13f79535-47bb-0310-9956-ffa450edef68 --- .../repository/RepositoryArchivaTaskScheduler.java | 45 ------- .../scheduler/repository/RepositoryTask.java | 145 --------------------- .../model/RepositoryArchivaTaskScheduler.java | 45 +++++++ .../scheduler/repository/model/RepositoryTask.java | 145 +++++++++++++++++++++ .../ArchivaRepositoryScanningTaskExecutor.java | 1 + .../DefaultRepositoryArchivaTaskScheduler.java | 3 +- .../scheduler/repository/RepositoryTaskJob.java | 1 + ...vaRepositoryScanningTaskExecutorPhase1Test.java | 3 +- ...vaRepositoryScanningTaskExecutorPhase2Test.java | 3 +- 9 files changed, 196 insertions(+), 195 deletions(-) delete mode 100644 archiva-modules/archiva-scheduler/archiva-scheduler-repository-api/src/main/java/org/apache/archiva/scheduler/repository/RepositoryArchivaTaskScheduler.java delete mode 100644 archiva-modules/archiva-scheduler/archiva-scheduler-repository-api/src/main/java/org/apache/archiva/scheduler/repository/RepositoryTask.java create mode 100644 archiva-modules/archiva-scheduler/archiva-scheduler-repository-api/src/main/java/org/apache/archiva/scheduler/repository/model/RepositoryArchivaTaskScheduler.java create mode 100644 archiva-modules/archiva-scheduler/archiva-scheduler-repository-api/src/main/java/org/apache/archiva/scheduler/repository/model/RepositoryTask.java (limited to 'archiva-modules/archiva-scheduler') diff --git a/archiva-modules/archiva-scheduler/archiva-scheduler-repository-api/src/main/java/org/apache/archiva/scheduler/repository/RepositoryArchivaTaskScheduler.java b/archiva-modules/archiva-scheduler/archiva-scheduler-repository-api/src/main/java/org/apache/archiva/scheduler/repository/RepositoryArchivaTaskScheduler.java deleted file mode 100644 index b83835a0c..000000000 --- a/archiva-modules/archiva-scheduler/archiva-scheduler-repository-api/src/main/java/org/apache/archiva/scheduler/repository/RepositoryArchivaTaskScheduler.java +++ /dev/null @@ -1,45 +0,0 @@ -package org.apache.archiva.scheduler.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.redback.components.taskqueue.TaskQueueException; -import org.apache.archiva.scheduler.ArchivaTaskScheduler; - -/** - * Scheduling component for archiva repositories - */ -public interface RepositoryArchivaTaskScheduler - extends ArchivaTaskScheduler -{ - - - boolean isProcessingRepositoryTask( String repositoryId ); - - - boolean isProcessingRepositoryTask( RepositoryTask task ); - - void queueTask( RepositoryTask task ) - throws TaskQueueException; - - boolean unQueueTask( RepositoryTask task ) - throws TaskQueueException; - - -} diff --git a/archiva-modules/archiva-scheduler/archiva-scheduler-repository-api/src/main/java/org/apache/archiva/scheduler/repository/RepositoryTask.java b/archiva-modules/archiva-scheduler/archiva-scheduler-repository-api/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-api/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-api/src/main/java/org/apache/archiva/scheduler/repository/model/RepositoryArchivaTaskScheduler.java b/archiva-modules/archiva-scheduler/archiva-scheduler-repository-api/src/main/java/org/apache/archiva/scheduler/repository/model/RepositoryArchivaTaskScheduler.java new file mode 100644 index 000000000..157eee15f --- /dev/null +++ b/archiva-modules/archiva-scheduler/archiva-scheduler-repository-api/src/main/java/org/apache/archiva/scheduler/repository/model/RepositoryArchivaTaskScheduler.java @@ -0,0 +1,45 @@ +package org.apache.archiva.scheduler.repository.model; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import org.apache.archiva.redback.components.taskqueue.TaskQueueException; +import org.apache.archiva.scheduler.ArchivaTaskScheduler; + +/** + * Scheduling component for archiva repositories + */ +public interface RepositoryArchivaTaskScheduler + extends ArchivaTaskScheduler +{ + + + boolean isProcessingRepositoryTask( String repositoryId ); + + + boolean isProcessingRepositoryTask( RepositoryTask task ); + + void queueTask( RepositoryTask task ) + throws TaskQueueException; + + boolean unQueueTask( RepositoryTask task ) + throws TaskQueueException; + + +} diff --git a/archiva-modules/archiva-scheduler/archiva-scheduler-repository-api/src/main/java/org/apache/archiva/scheduler/repository/model/RepositoryTask.java b/archiva-modules/archiva-scheduler/archiva-scheduler-repository-api/src/main/java/org/apache/archiva/scheduler/repository/model/RepositoryTask.java new file mode 100644 index 000000000..894f65bc6 --- /dev/null +++ b/archiva-modules/archiva-scheduler/archiva-scheduler-repository-api/src/main/java/org/apache/archiva/scheduler/repository/model/RepositoryTask.java @@ -0,0 +1,145 @@ +package org.apache.archiva.scheduler.repository.model; + +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/ArchivaRepositoryScanningTaskExecutor.java b/archiva-modules/archiva-scheduler/archiva-scheduler-repository/src/main/java/org/apache/archiva/scheduler/repository/ArchivaRepositoryScanningTaskExecutor.java index 13bd136d3..6d1fa1c55 100644 --- a/archiva-modules/archiva-scheduler/archiva-scheduler-repository/src/main/java/org/apache/archiva/scheduler/repository/ArchivaRepositoryScanningTaskExecutor.java +++ b/archiva-modules/archiva-scheduler/archiva-scheduler-repository/src/main/java/org/apache/archiva/scheduler/repository/ArchivaRepositoryScanningTaskExecutor.java @@ -32,6 +32,7 @@ import org.apache.archiva.repository.scanner.RepositoryContentConsumers; import org.apache.archiva.repository.scanner.RepositoryScanStatistics; import org.apache.archiva.repository.scanner.RepositoryScanner; import org.apache.archiva.repository.scanner.RepositoryScannerException; +import org.apache.archiva.scheduler.repository.model.RepositoryTask; import org.apache.commons.lang.StringUtils; import org.codehaus.plexus.personality.plexus.lifecycle.phase.InitializationException; import org.apache.archiva.redback.components.taskqueue.Task; diff --git a/archiva-modules/archiva-scheduler/archiva-scheduler-repository/src/main/java/org/apache/archiva/scheduler/repository/DefaultRepositoryArchivaTaskScheduler.java b/archiva-modules/archiva-scheduler/archiva-scheduler-repository/src/main/java/org/apache/archiva/scheduler/repository/DefaultRepositoryArchivaTaskScheduler.java index 90a28a3fa..bb031cf3e 100644 --- a/archiva-modules/archiva-scheduler/archiva-scheduler-repository/src/main/java/org/apache/archiva/scheduler/repository/DefaultRepositoryArchivaTaskScheduler.java +++ b/archiva-modules/archiva-scheduler/archiva-scheduler-repository/src/main/java/org/apache/archiva/scheduler/repository/DefaultRepositoryArchivaTaskScheduler.java @@ -33,7 +33,8 @@ import org.apache.archiva.redback.components.scheduler.CronExpressionValidator; import org.apache.archiva.redback.components.scheduler.Scheduler; import org.apache.archiva.redback.components.taskqueue.TaskQueue; import org.apache.archiva.redback.components.taskqueue.TaskQueueException; -import org.apache.archiva.scheduler.ArchivaTaskScheduler; +import org.apache.archiva.scheduler.repository.model.RepositoryArchivaTaskScheduler; +import org.apache.archiva.scheduler.repository.model.RepositoryTask; import org.quartz.SchedulerException; import org.quartz.impl.JobDetailImpl; import org.quartz.impl.triggers.CronTriggerImpl; 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 6789459b9..8bd2b9a54 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 @@ -22,6 +22,7 @@ package org.apache.archiva.scheduler.repository; import org.apache.archiva.redback.components.scheduler.AbstractJob; import org.apache.archiva.redback.components.taskqueue.TaskQueue; import org.apache.archiva.redback.components.taskqueue.TaskQueueException; +import org.apache.archiva.scheduler.repository.model.RepositoryTask; import org.quartz.JobDataMap; import org.quartz.JobExecutionContext; import org.quartz.JobExecutionException; diff --git a/archiva-modules/archiva-scheduler/archiva-scheduler-repository/src/test/java/org/apache/archiva/scheduler/repository/ArchivaRepositoryScanningTaskExecutorPhase1Test.java b/archiva-modules/archiva-scheduler/archiva-scheduler-repository/src/test/java/org/apache/archiva/scheduler/repository/ArchivaRepositoryScanningTaskExecutorPhase1Test.java index 5fcc4b3f9..200ebde05 100644 --- a/archiva-modules/archiva-scheduler/archiva-scheduler-repository/src/test/java/org/apache/archiva/scheduler/repository/ArchivaRepositoryScanningTaskExecutorPhase1Test.java +++ b/archiva-modules/archiva-scheduler/archiva-scheduler-repository/src/test/java/org/apache/archiva/scheduler/repository/ArchivaRepositoryScanningTaskExecutorPhase1Test.java @@ -20,10 +20,9 @@ package org.apache.archiva.scheduler.repository; */ import org.apache.archiva.model.ArtifactReference; +import org.apache.archiva.scheduler.repository.model.RepositoryTask; import org.junit.Test; -import org.junit.runner.RunWith; import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import java.util.Collection; diff --git a/archiva-modules/archiva-scheduler/archiva-scheduler-repository/src/test/java/org/apache/archiva/scheduler/repository/ArchivaRepositoryScanningTaskExecutorPhase2Test.java b/archiva-modules/archiva-scheduler/archiva-scheduler-repository/src/test/java/org/apache/archiva/scheduler/repository/ArchivaRepositoryScanningTaskExecutorPhase2Test.java index 7c18e9d3a..e34694556 100644 --- a/archiva-modules/archiva-scheduler/archiva-scheduler-repository/src/test/java/org/apache/archiva/scheduler/repository/ArchivaRepositoryScanningTaskExecutorPhase2Test.java +++ b/archiva-modules/archiva-scheduler/archiva-scheduler-repository/src/test/java/org/apache/archiva/scheduler/repository/ArchivaRepositoryScanningTaskExecutorPhase2Test.java @@ -22,11 +22,10 @@ package org.apache.archiva.scheduler.repository; import org.apache.archiva.metadata.repository.MetadataRepositoryException; import org.apache.archiva.metadata.repository.stats.RepositoryStatistics; import org.apache.archiva.model.ArtifactReference; +import org.apache.archiva.scheduler.repository.model.RepositoryTask; import org.codehaus.plexus.util.FileUtils; import org.junit.Test; -import org.junit.runner.RunWith; import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import java.io.File; import java.util.Calendar; -- cgit v1.2.3