aboutsummaryrefslogtreecommitdiffstats
path: root/archiva-modules/archiva-base
diff options
context:
space:
mode:
authorMartin Stockhammer <martin_s@apache.org>2020-03-01 20:25:59 +0100
committerMartin Stockhammer <martin_s@apache.org>2020-03-01 20:25:59 +0100
commit939d127869e6eb3854adbd1cd9a0e54ec03e4f56 (patch)
tree56e42b427499b6c1e5d7e7d8fe1cc8c0b61acd44 /archiva-modules/archiva-base
parentadeb46cce9199fd1d89a2dca68f677ea101df7ab (diff)
downloadarchiva-939d127869e6eb3854adbd1cd9a0e54ec03e4f56.tar.gz
archiva-939d127869e6eb3854adbd1cd9a0e54ec03e4f56.zip
Additional methods for repository content
Diffstat (limited to 'archiva-modules/archiva-base')
-rw-r--r--archiva-modules/archiva-base/archiva-repository-api/src/main/java/org/apache/archiva/repository/ManagedRepositoryContent.java26
-rw-r--r--archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/content/base/builder/ProjectOptBuilder.java2
-rw-r--r--archiva-modules/archiva-base/archiva-repository-layer/src/test/java/org/apache/archiva/repository/mock/ManagedRepositoryContentMock.java16
-rw-r--r--archiva-modules/archiva-base/archiva-repository-scanner/src/test/java/org/apache/archiva/repository/scanner/mock/ManagedRepositoryContentMock.java16
-rw-r--r--archiva-modules/archiva-base/archiva-storage-fs/src/main/java/org/apache/archiva/repository/storage/fs/FilesystemAsset.java20
5 files changed, 52 insertions, 28 deletions
diff --git a/archiva-modules/archiva-base/archiva-repository-api/src/main/java/org/apache/archiva/repository/ManagedRepositoryContent.java b/archiva-modules/archiva-base/archiva-repository-api/src/main/java/org/apache/archiva/repository/ManagedRepositoryContent.java
index 3c0dc1d55..7eb8da4ce 100644
--- a/archiva-modules/archiva-base/archiva-repository-api/src/main/java/org/apache/archiva/repository/ManagedRepositoryContent.java
+++ b/archiva-modules/archiva-base/archiva-repository-api/src/main/java/org/apache/archiva/repository/ManagedRepositoryContent.java
@@ -150,7 +150,7 @@ public interface ManagedRepositoryContent extends RepositoryContent
Version getVersion(ItemSelector versionCoordinates) throws ContentAccessException, IllegalArgumentException;
/**
- * Returns the artifact for the given coordinates.
+ * Returns the artifact object for the given coordinates.
*
* Normally the following coordinates should be set at the given selector:
* <ul>
@@ -170,8 +170,14 @@ public interface ManagedRepositoryContent extends RepositoryContent
* <li>extension</li>
* </ul>
*
+ * The method always returns a artifact object, if the coordinates are valid. It does not guarantee that the artifact
+ * exists. To check if there is really a physical representation of the artifact, use the <code>{@link Artifact#exists()}</code>
+ * method of the artifact.
+ * For upload and data retrieval use the methods of the {@link StorageAsset} reference returned in the artifact.
+ *
+ *
* @param selector the selector with the artifact coordinates
- * @return a artifact
+ * @return a artifact object
* @throws ItemNotFoundException if the selector coordinates do not specify a artifact
* @throws ContentAccessException if the access to the underlying storage failed
*/
@@ -187,7 +193,7 @@ public interface ManagedRepositoryContent extends RepositoryContent
* @throws ItemNotFoundException if the specified coordinates cannot be found in the repository
* @throws ContentAccessException if the access to the underlying storage failed
*/
- List<Artifact> getAllArtifacts( ItemSelector selector) throws ContentAccessException;
+ List<? extends Artifact> getAllArtifacts( ItemSelector selector) throws ContentAccessException;
/**
* Returns the artifacts that match the given selector. It is up to the repository implementation
@@ -202,7 +208,7 @@ public interface ManagedRepositoryContent extends RepositoryContent
* @throws ItemNotFoundException if the specified coordinates cannot be found in the repository
* @throws ContentAccessException if the access to the underlying storage failed
*/
- Stream<Artifact> getAllArtifactStream( ItemSelector selector) throws ContentAccessException;
+ Stream<? extends Artifact> getAllArtifactStream( ItemSelector selector) throws ContentAccessException;
/**
@@ -211,7 +217,7 @@ public interface ManagedRepositoryContent extends RepositoryContent
* @param namespace the namespace
* @return the list of projects or a empty list, if there are no projects for the given namespace.
*/
- List<Project> getProjects(Namespace namespace) throws ContentAccessException;
+ List<? extends Project> getProjects( Namespace namespace) throws ContentAccessException;
/**
* Return the existing versions of the given project.
@@ -219,7 +225,7 @@ public interface ManagedRepositoryContent extends RepositoryContent
* @param project the project
* @return a list of versions or a empty list, if not versions are available for the specified project
*/
- List<Version> getVersions(Project project) throws ContentAccessException;
+ List<? extends Version> getVersions( Project project) throws ContentAccessException;
/**
* Return all the artifacts of a given content item (namespace, project, version)
@@ -227,7 +233,7 @@ public interface ManagedRepositoryContent extends RepositoryContent
* @param item the item
* @return a list of artifacts or a empty list, if no artifacts are available for the specified item
*/
- List<Artifact> getArtifacts( ContentItem item) throws ContentAccessException;
+ List<? extends Artifact> getArtifacts( ContentItem item) throws ContentAccessException;
/**
* Return all the artifacts of a given namespace and all sub namespaces that are defined under the
@@ -236,7 +242,7 @@ public interface ManagedRepositoryContent extends RepositoryContent
* @param namespace the namespace, which is the parent namespace
* @return a list of artifacts or a empty list, if no artifacts are available for the specified namespace
*/
- List<Artifact> getArtifactsStartingWith( Namespace namespace ) throws ContentAccessException;
+ List<? extends Artifact> getArtifactsStartingWith( Namespace namespace ) throws ContentAccessException;
/**
@@ -250,7 +256,7 @@ public interface ManagedRepositoryContent extends RepositoryContent
* @return a stream of artifacts. The stream is auto closable. You should always make sure, that the stream
* is closed after use.
*/
- Stream<Artifact> getArtifactStream( ContentItem item ) throws ContentAccessException;
+ Stream<? extends Artifact> getArtifactStream( ContentItem item ) throws ContentAccessException;
/**
@@ -264,7 +270,7 @@ public interface ManagedRepositoryContent extends RepositoryContent
* @return a stream of artifacts. The stream is auto closable. You should always make sure, that the stream
* is closed after use.
*/
- Stream<Artifact> getArtifactStreamStartingWith( Namespace namespace ) throws ContentAccessException;
+ Stream<? extends Artifact> getArtifactStreamStartingWith( Namespace namespace ) throws ContentAccessException;
/**
diff --git a/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/content/base/builder/ProjectOptBuilder.java b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/content/base/builder/ProjectOptBuilder.java
index 4964e130b..f2ebebeeb 100644
--- a/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/content/base/builder/ProjectOptBuilder.java
+++ b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/content/base/builder/ProjectOptBuilder.java
@@ -30,8 +30,6 @@ public interface ProjectOptBuilder
extends OptBuilder<ArchivaProject, ProjectOptBuilder>
{
- ProjectOptBuilder withId( String id );
-
ArchivaProject build( );
}
diff --git a/archiva-modules/archiva-base/archiva-repository-layer/src/test/java/org/apache/archiva/repository/mock/ManagedRepositoryContentMock.java b/archiva-modules/archiva-base/archiva-repository-layer/src/test/java/org/apache/archiva/repository/mock/ManagedRepositoryContentMock.java
index 9e56da046..b5adf5ca5 100644
--- a/archiva-modules/archiva-base/archiva-repository-layer/src/test/java/org/apache/archiva/repository/mock/ManagedRepositoryContentMock.java
+++ b/archiva-modules/archiva-base/archiva-repository-layer/src/test/java/org/apache/archiva/repository/mock/ManagedRepositoryContentMock.java
@@ -121,49 +121,49 @@ public class ManagedRepositoryContentMock implements ManagedRepositoryContent
}
@Override
- public List<Artifact> getAllArtifacts( ItemSelector selector ) throws ContentAccessException
+ public List<? extends Artifact> getAllArtifacts( ItemSelector selector ) throws ContentAccessException
{
return null;
}
@Override
- public Stream<Artifact> getAllArtifactStream( ItemSelector selector ) throws ContentAccessException
+ public Stream<? extends Artifact> getAllArtifactStream( ItemSelector selector ) throws ContentAccessException
{
return null;
}
@Override
- public List<Project> getProjects( Namespace namespace ) throws ContentAccessException
+ public List<? extends Project> getProjects( Namespace namespace ) throws ContentAccessException
{
return null;
}
@Override
- public List<Version> getVersions( Project project ) throws ContentAccessException
+ public List<? extends Version> getVersions( Project project ) throws ContentAccessException
{
return null;
}
@Override
- public List<Artifact> getArtifacts( ContentItem item ) throws ContentAccessException
+ public List<? extends Artifact> getArtifacts( ContentItem item ) throws ContentAccessException
{
return null;
}
@Override
- public List<Artifact> getArtifactsStartingWith( Namespace namespace ) throws ContentAccessException
+ public List<? extends Artifact> getArtifactsStartingWith( Namespace namespace ) throws ContentAccessException
{
return null;
}
@Override
- public Stream<Artifact> getArtifactStream( ContentItem item ) throws ContentAccessException
+ public Stream<? extends Artifact> getArtifactStream( ContentItem item ) throws ContentAccessException
{
return null;
}
@Override
- public Stream<Artifact> getArtifactStreamStartingWith( Namespace namespace ) throws ContentAccessException
+ public Stream<? extends Artifact> getArtifactStreamStartingWith( Namespace namespace ) throws ContentAccessException
{
return null;
}
diff --git a/archiva-modules/archiva-base/archiva-repository-scanner/src/test/java/org/apache/archiva/repository/scanner/mock/ManagedRepositoryContentMock.java b/archiva-modules/archiva-base/archiva-repository-scanner/src/test/java/org/apache/archiva/repository/scanner/mock/ManagedRepositoryContentMock.java
index b19dd5b73..5d2520ff6 100644
--- a/archiva-modules/archiva-base/archiva-repository-scanner/src/test/java/org/apache/archiva/repository/scanner/mock/ManagedRepositoryContentMock.java
+++ b/archiva-modules/archiva-base/archiva-repository-scanner/src/test/java/org/apache/archiva/repository/scanner/mock/ManagedRepositoryContentMock.java
@@ -122,49 +122,49 @@ public class ManagedRepositoryContentMock implements ManagedRepositoryContent
}
@Override
- public List<Artifact> getAllArtifacts( ItemSelector selector ) throws ContentAccessException
+ public List<? extends Artifact> getAllArtifacts( ItemSelector selector ) throws ContentAccessException
{
return null;
}
@Override
- public Stream<Artifact> getAllArtifactStream( ItemSelector selector ) throws ContentAccessException
+ public Stream<? extends Artifact> getAllArtifactStream( ItemSelector selector ) throws ContentAccessException
{
return null;
}
@Override
- public List<Project> getProjects( Namespace namespace ) throws ContentAccessException
+ public List<? extends Project> getProjects( Namespace namespace ) throws ContentAccessException
{
return null;
}
@Override
- public List<Version> getVersions( Project project ) throws ContentAccessException
+ public List<? extends Version> getVersions( Project project ) throws ContentAccessException
{
return null;
}
@Override
- public List<Artifact> getArtifacts( ContentItem item ) throws ContentAccessException
+ public List<? extends Artifact> getArtifacts( ContentItem item ) throws ContentAccessException
{
return null;
}
@Override
- public List<Artifact> getArtifactsStartingWith( Namespace namespace ) throws ContentAccessException
+ public List<? extends Artifact> getArtifactsStartingWith( Namespace namespace ) throws ContentAccessException
{
return null;
}
@Override
- public Stream<Artifact> getArtifactStream( ContentItem item ) throws ContentAccessException
+ public Stream<? extends Artifact> getArtifactStream( ContentItem item ) throws ContentAccessException
{
return null;
}
@Override
- public Stream<Artifact> getArtifactStreamStartingWith( Namespace namespace ) throws ContentAccessException
+ public Stream<? extends Artifact> getArtifactStreamStartingWith( Namespace namespace ) throws ContentAccessException
{
return null;
}
diff --git a/archiva-modules/archiva-base/archiva-storage-fs/src/main/java/org/apache/archiva/repository/storage/fs/FilesystemAsset.java b/archiva-modules/archiva-base/archiva-storage-fs/src/main/java/org/apache/archiva/repository/storage/fs/FilesystemAsset.java
index 551729a0f..bbcf38a70 100644
--- a/archiva-modules/archiva-base/archiva-storage-fs/src/main/java/org/apache/archiva/repository/storage/fs/FilesystemAsset.java
+++ b/archiva-modules/archiva-base/archiva-storage-fs/src/main/java/org/apache/archiva/repository/storage/fs/FilesystemAsset.java
@@ -521,4 +521,24 @@ public class FilesystemAsset implements StorageAsset, Comparable {
}
return 0;
}
+
+ @Override
+ public boolean equals( Object o )
+ {
+ if ( this == o ) return true;
+ if ( o == null || getClass( ) != o.getClass( ) ) return false;
+
+ FilesystemAsset that = (FilesystemAsset) o;
+
+ if ( !assetPath.equals( that.assetPath ) ) return false;
+ return storage.equals( that.storage );
+ }
+
+ @Override
+ public int hashCode( )
+ {
+ int result = assetPath.hashCode( );
+ result = 31 * result + storage.hashCode( );
+ return result;
+ }
}