aboutsummaryrefslogtreecommitdiffstats
path: root/archiva-modules/archiva-base/archiva-repository-api
diff options
context:
space:
mode:
authorMartin Stockhammer <martin_s@apache.org>2020-02-13 22:20:35 +0100
committerMartin Stockhammer <martin_s@apache.org>2020-02-13 22:20:35 +0100
commit6823bb0371a3278cfb7bcb834792c21e623183b6 (patch)
tree98c10add81c294fb42e620da40ab7c5cb15ebbfe /archiva-modules/archiva-base/archiva-repository-api
parent84d9f5723fde9e72ab413d1ef739f1f728b84485 (diff)
downloadarchiva-6823bb0371a3278cfb7bcb834792c21e623183b6.tar.gz
archiva-6823bb0371a3278cfb7bcb834792c21e623183b6.zip
Adding selector interface for repository content
Diffstat (limited to 'archiva-modules/archiva-base/archiva-repository-api')
-rw-r--r--archiva-modules/archiva-base/archiva-repository-api/src/main/java/org/apache/archiva/repository/RepositoryContent.java9
-rw-r--r--archiva-modules/archiva-base/archiva-repository-api/src/main/java/org/apache/archiva/repository/content/Artifact.java3
-rw-r--r--archiva-modules/archiva-base/archiva-repository-api/src/main/java/org/apache/archiva/repository/content/ItemSelector.java79
-rw-r--r--archiva-modules/archiva-base/archiva-repository-api/src/main/java/org/apache/archiva/repository/content/Project.java4
4 files changed, 90 insertions, 5 deletions
diff --git a/archiva-modules/archiva-base/archiva-repository-api/src/main/java/org/apache/archiva/repository/RepositoryContent.java b/archiva-modules/archiva-base/archiva-repository-api/src/main/java/org/apache/archiva/repository/RepositoryContent.java
index d959a8629..0afe493e1 100644
--- a/archiva-modules/archiva-base/archiva-repository-api/src/main/java/org/apache/archiva/repository/RepositoryContent.java
+++ b/archiva-modules/archiva-base/archiva-repository-api/src/main/java/org/apache/archiva/repository/RepositoryContent.java
@@ -21,6 +21,7 @@ package org.apache.archiva.repository;
import org.apache.archiva.model.ArtifactReference;
import org.apache.archiva.model.VersionedReference;
+import org.apache.archiva.repository.content.ItemSelector;
/**
@@ -48,4 +49,12 @@ public interface RepositoryContent
* @return the relative path to the artifact.
*/
String toPath( ArtifactReference reference );
+
+
+ /**
+ * Return the path, that represents the item specified by the selector.
+ * @param selector the selector with the artifact coordinates
+ * @return the path to the content item
+ */
+ String toPath( ItemSelector selector );
}
diff --git a/archiva-modules/archiva-base/archiva-repository-api/src/main/java/org/apache/archiva/repository/content/Artifact.java b/archiva-modules/archiva-base/archiva-repository-api/src/main/java/org/apache/archiva/repository/content/Artifact.java
index 474f8241b..b4c6d6cdb 100644
--- a/archiva-modules/archiva-base/archiva-repository-api/src/main/java/org/apache/archiva/repository/content/Artifact.java
+++ b/archiva-modules/archiva-base/archiva-repository-api/src/main/java/org/apache/archiva/repository/content/Artifact.java
@@ -19,11 +19,8 @@ package org.apache.archiva.repository.content;
* under the License.
*/
-import org.apache.archiva.repository.UnsupportedRepositoryTypeException;
import org.apache.archiva.repository.storage.StorageAsset;
-import java.util.Map;
-
/**
*
* Represents a artifact of a repository. This object contains unique coordinates of the
diff --git a/archiva-modules/archiva-base/archiva-repository-api/src/main/java/org/apache/archiva/repository/content/ItemSelector.java b/archiva-modules/archiva-base/archiva-repository-api/src/main/java/org/apache/archiva/repository/content/ItemSelector.java
new file mode 100644
index 000000000..9e50c2488
--- /dev/null
+++ b/archiva-modules/archiva-base/archiva-repository-api/src/main/java/org/apache/archiva/repository/content/ItemSelector.java
@@ -0,0 +1,79 @@
+package org.apache.archiva.repository.content;
+
+/*
+ * 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.commons.lang3.StringUtils;
+
+import java.util.Map;
+
+/**
+ * The item selector is used to specify coordinates for retrieving ContentItem elements.
+ */
+public interface ItemSelector
+{
+
+ String getProjectId();
+
+ String getNamespace();
+
+ String getVersion( );
+
+ String getArtifactVersion();
+
+ String getArtifactId( );
+
+ String getType();
+
+ String getClassifier();
+
+ String getAttribute( String key );
+
+ Map<String, String> getAttributes( );
+
+ default boolean hasNamespace() {
+ return !StringUtils.isEmpty( getNamespace( ) );
+ }
+
+ default boolean hasProjectId() {
+ return !StringUtils.isEmpty( getProjectId( ) );
+ }
+
+ default boolean hasVersion() {
+ return !StringUtils.isEmpty(getVersion());
+ }
+
+ default boolean hasArtifactId() {
+ return !StringUtils.isEmpty( getArtifactId( ) );
+ }
+
+ default boolean hasArtifactVersion() {
+ return !StringUtils.isEmpty( getArtifactVersion( ) );
+ }
+
+ default boolean hasType() {
+ return !StringUtils.isEmpty( getType( ) );
+ }
+
+ default boolean hasClassifier() {
+ return !StringUtils.isEmpty( getClassifier( ) );
+ }
+
+ boolean hasAttributes();
+}
diff --git a/archiva-modules/archiva-base/archiva-repository-api/src/main/java/org/apache/archiva/repository/content/Project.java b/archiva-modules/archiva-base/archiva-repository-api/src/main/java/org/apache/archiva/repository/content/Project.java
index f7a840a7a..ef7249664 100644
--- a/archiva-modules/archiva-base/archiva-repository-api/src/main/java/org/apache/archiva/repository/content/Project.java
+++ b/archiva-modules/archiva-base/archiva-repository-api/src/main/java/org/apache/archiva/repository/content/Project.java
@@ -19,7 +19,7 @@ package org.apache.archiva.repository.content;
* under the License.
*/
-import org.apache.archiva.repository.ManagedRepositoryContent;
+import org.apache.archiva.repository.RepositoryContent;
import org.apache.archiva.repository.storage.StorageAsset;
/**
@@ -57,7 +57,7 @@ public interface Project extends ContentItem
* The repository this project is part of.
* @return the repository content
*/
- ManagedRepositoryContent getRepository();
+ RepositoryContent getRepository();
/**
* Returns the asset that corresponds to this project.