summaryrefslogtreecommitdiffstats
path: root/archiva-modules/archiva-scheduler/archiva-scheduler-repository-api
diff options
context:
space:
mode:
authorOlivier Lamy <olamy@apache.org>2012-10-29 20:59:42 +0000
committerOlivier Lamy <olamy@apache.org>2012-10-29 20:59:42 +0000
commitc7b2d0af209c5515125571b715a7ca1190425e11 (patch)
tree4b4f950808887fb8bbe1e3fce6ad46e08873c306 /archiva-modules/archiva-scheduler/archiva-scheduler-repository-api
parent9074bfb0f42034b5f1248d9d022594e4f4556599 (diff)
downloadarchiva-c7b2d0af209c5515125571b715a7ca1190425e11.tar.gz
archiva-c7b2d0af209c5515125571b715a7ca1190425e11.zip
[MRM-1704] Refactor to remove maven specific part from various repository/metadata apis
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1403505 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'archiva-modules/archiva-scheduler/archiva-scheduler-repository-api')
-rw-r--r--archiva-modules/archiva-scheduler/archiva-scheduler-repository-api/pom.xml122
-rw-r--r--archiva-modules/archiva-scheduler/archiva-scheduler-repository-api/src/main/java/org/apache/archiva/scheduler/repository/RepositoryArchivaTaskScheduler.java45
-rw-r--r--archiva-modules/archiva-scheduler/archiva-scheduler-repository-api/src/main/java/org/apache/archiva/scheduler/repository/RepositoryTask.java145
3 files changed, 312 insertions, 0 deletions
diff --git a/archiva-modules/archiva-scheduler/archiva-scheduler-repository-api/pom.xml b/archiva-modules/archiva-scheduler/archiva-scheduler-repository-api/pom.xml
new file mode 100644
index 000000000..989c4d180
--- /dev/null
+++ b/archiva-modules/archiva-scheduler/archiva-scheduler-repository-api/pom.xml
@@ -0,0 +1,122 @@
+<?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/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <artifactId>archiva-scheduler</artifactId>
+ <groupId>org.apache.archiva</groupId>
+ <version>1.4-M4-SNAPSHOT</version>
+ </parent>
+ <artifactId>archiva-scheduler-repository-api</artifactId>
+ <packaging>bundle</packaging>
+ <name>Archiva Scheduler :: Repository Scanning Api</name>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.archiva</groupId>
+ <artifactId>archiva-scheduler-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>commons-io</groupId>
+ <artifactId>commons-io</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.archiva.redback.components</groupId>
+ <artifactId>spring-quartz</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.quartz-scheduler</groupId>
+ <artifactId>quartz</artifactId>
+ <exclusions>
+ <exclusion>
+ <groupId>c3p0</groupId>
+ <artifactId>c3p0</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>javax.transaction</groupId>
+ <artifactId>jta</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.archiva</groupId>
+ <artifactId>repository-statistics</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.archiva</groupId>
+ <artifactId>archiva-configuration</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ </dependency>
+
+ </dependencies>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <configuration>
+ <instructions>
+ <Bundle-SymbolicName>org.apache.archiva.scheduler.repository</Bundle-SymbolicName>
+ <Bundle-Version>${project.version}</Bundle-Version>
+ <Export-Package>
+ org.apache.archiva.scheduler.repository;version=${project.version}
+ </Export-Package>
+ <Import-Package>
+ javax.annotation,
+ javax.inject,
+ org.apache.archiva.admin.model;version=${project.version},
+ org.apache.archiva.admin.model.beans;version=${project.version},
+ org.apache.archiva.admin.model.managed;version=${project.version},
+ org.apache.archiva.common;version=${project.version},
+ org.apache.archiva.configuration;version=${project.version},
+ org.apache.archiva.metadata.repository*;version=${project.version},
+ org.apache.archiva.repository.scanner;version=${project.version},
+ org.apache.archiva.scheduler;version=${project.version},
+ org.apache.commons.lang;version="[2.4,3)",
+ org.codehaus.plexus.personality.plexus.lifecycle.phase,
+ org.apache.archiva.redback.components.taskqueue*,
+ org.apache.archiva.redback.components.scheduler,
+ org.quartz*;version="[2,3)",
+ org.springframework*;version="[3,4)",
+ org.slf4j;resolution:=optional
+ </Import-Package>
+ </instructions>
+ </configuration>
+ </plugin>
+ </plugins>
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.rat</groupId>
+ <artifactId>apache-rat-plugin</artifactId>
+ <configuration>
+ <excludes>
+ <exclude>src/test/resources/test-repo/**</exclude>
+ <exclude>src/test/repositories/**</exclude>
+ </excludes>
+ </configuration>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+ </build>
+</project>
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
new file mode 100644
index 000000000..b83835a0c
--- /dev/null
+++ b/archiva-modules/archiva-scheduler/archiva-scheduler-repository-api/src/main/java/org/apache/archiva/scheduler/repository/RepositoryArchivaTaskScheduler.java
@@ -0,0 +1,45 @@
+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<RepositoryTask>
+{
+
+
+ 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
new file mode 100644
index 000000000..b023cdd2f
--- /dev/null
+++ b/archiva-modules/archiva-scheduler/archiva-scheduler-repository-api/src/main/java/org/apache/archiva/scheduler/repository/RepositoryTask.java
@@ -0,0 +1,145 @@
+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;
+ }
+}