mirror of https://github.com/apache/archiva.git
[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
This commit is contained in:
parent
9074bfb0f4
commit
c7b2d0af20
|
@ -0,0 +1,54 @@
|
|||
package org.apache.archiva.metadata.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.repository.RepositoryArchivaTaskScheduler;
|
||||
import org.apache.archiva.scheduler.repository.RepositoryTask;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* @author Olivier Lamy
|
||||
*/
|
||||
@Service ("archivaTaskScheduler#repository")
|
||||
public class MockRepositoryArchivaTaskScheduler
|
||||
implements RepositoryArchivaTaskScheduler
|
||||
{
|
||||
public boolean isProcessingRepositoryTask( String repositoryId )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isProcessingRepositoryTask( RepositoryTask task )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public void queueTask( RepositoryTask task )
|
||||
throws TaskQueueException
|
||||
{
|
||||
// no op
|
||||
}
|
||||
|
||||
public boolean unQueueTask( RepositoryTask task )
|
||||
throws TaskQueueException
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,54 @@
|
|||
package org.apache.archiva.admin.mock;
|
||||
/*
|
||||
* 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.repository.RepositoryArchivaTaskScheduler;
|
||||
import org.apache.archiva.scheduler.repository.RepositoryTask;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* @author Olivier Lamy
|
||||
*/
|
||||
@Service("archivaTaskScheduler#repository")
|
||||
public class MockRepositoryArchivaTaskScheduler
|
||||
implements RepositoryArchivaTaskScheduler
|
||||
{
|
||||
public boolean isProcessingRepositoryTask( String repositoryId )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isProcessingRepositoryTask( RepositoryTask task )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public void queueTask( RepositoryTask task )
|
||||
throws TaskQueueException
|
||||
{
|
||||
// no op
|
||||
}
|
||||
|
||||
public boolean unQueueTask( RepositoryTask task )
|
||||
throws TaskQueueException
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
|
@ -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>
|
|
@ -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;
|
||||
|
||||
|
||||
}
|
|
@ -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;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue