diff options
author | Martin Stockhammer <martin_s@apache.org> | 2019-05-19 17:35:34 +0200 |
---|---|---|
committer | Martin Stockhammer <martin_s@apache.org> | 2019-05-19 17:35:34 +0200 |
commit | 4c5e00e833f5ddafb68ccd44b02db7df00c5eeba (patch) | |
tree | 1ec8b126e3333837856196f04ad4e96f94738a67 /archiva-modules/archiva-base/archiva-repository-api | |
parent | 17c3bb60da9fa76d69f53fc6c42e9b49c959e644 (diff) | |
download | archiva-4c5e00e833f5ddafb68ccd44b02db7df00c5eeba.tar.gz archiva-4c5e00e833f5ddafb68ccd44b02db7df00c5eeba.zip |
Adding repository group
Diffstat (limited to 'archiva-modules/archiva-base/archiva-repository-api')
3 files changed, 161 insertions, 0 deletions
diff --git a/archiva-modules/archiva-base/archiva-repository-api/src/main/java/org/apache/archiva/repository/EditableRepositoryGroup.java b/archiva-modules/archiva-base/archiva-repository-api/src/main/java/org/apache/archiva/repository/EditableRepositoryGroup.java new file mode 100644 index 000000000..dff3dc85d --- /dev/null +++ b/archiva-modules/archiva-base/archiva-repository-api/src/main/java/org/apache/archiva/repository/EditableRepositoryGroup.java @@ -0,0 +1,41 @@ +package org.apache.archiva.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 java.util.List; + +public interface EditableRepositoryGroup extends EditableRepository,RepositoryGroup { + + void clearRepositories(); + + void setRepositories(List<ManagedRepository> repositories); + + void addRepository(ManagedRepository repository); + + void addRepository(int index, ManagedRepository repository); + + boolean removeRepository(ManagedRepository repository); + + ManagedRepository removeRepository(String repoId); + + void setMergedIndexPath(String path); + + void setMergedIndexTTL(int timeInSeconds); +} diff --git a/archiva-modules/archiva-base/archiva-repository-api/src/main/java/org/apache/archiva/repository/RepositoryGroup.java b/archiva-modules/archiva-base/archiva-repository-api/src/main/java/org/apache/archiva/repository/RepositoryGroup.java new file mode 100644 index 000000000..93b368c1d --- /dev/null +++ b/archiva-modules/archiva-base/archiva-repository-api/src/main/java/org/apache/archiva/repository/RepositoryGroup.java @@ -0,0 +1,78 @@ +package org.apache.archiva.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.repository.content.RepositoryStorage; +import org.apache.archiva.repository.content.StorageAsset; + +import java.util.List; + +/** + * Interface for repository groups. + * + * Repository groups are a combined view over a list of repositories. + * All repositories of this group must be of the same type. + * + * Repository groups are read only. You cannot store artifacts into a repository group. + * + * This interface extends <code>{@link RepositoryStorage}</code> to provide access to the merged + * index data files and other metadata. + * + */ +public interface RepositoryGroup extends Repository, RepositoryStorage { + + /** + * Returns the list of repositories. The order of the elements represents + * the order of getting artifacts (first one wins). + * + * + * @return + */ + List<ManagedRepository> getRepositories(); + + /** + * Returns true, if the given repository is part of this group. + * + * @param repository The repository to check. + * @return True, if it is part, otherwise false. + */ + boolean contains(ManagedRepository repository); + + /** + * Returns true, if the repository with the given id is part of this group. + * + * @param id The repository id to check + * @return True, if it is part, otherwise false + */ + boolean contains(String id); + + /** + * Returns the path to the merged index + * @return + */ + StorageAsset getMergedIndexPath(); + + /** + * Returns the time to live in seconds for the merged index. + * + * @return + */ + int getMergedIndexTTL(); +} diff --git a/archiva-modules/archiva-base/archiva-repository-api/src/main/java/org/apache/archiva/repository/RepositoryProvider.java b/archiva-modules/archiva-base/archiva-repository-api/src/main/java/org/apache/archiva/repository/RepositoryProvider.java index 4492b01cb..abbb8c46c 100644 --- a/archiva-modules/archiva-base/archiva-repository-api/src/main/java/org/apache/archiva/repository/RepositoryProvider.java +++ b/archiva-modules/archiva-base/archiva-repository-api/src/main/java/org/apache/archiva/repository/RepositoryProvider.java @@ -21,6 +21,7 @@ package org.apache.archiva.repository; import org.apache.archiva.configuration.ManagedRepositoryConfiguration; import org.apache.archiva.configuration.RemoteRepositoryConfiguration; +import org.apache.archiva.configuration.RepositoryGroupConfiguration; import java.util.Set; @@ -70,6 +71,17 @@ public interface RepositoryProvider extends RepositoryEventListener EditableRemoteRepository createRemoteInstance(String id, String name); /** + * Creates a editable repository group. . The provider must not check the uniqueness of the + * id parameter and must not track the already created instances. Each call to this method will create + * a new instance. + * + * @param id the repository identifier + * @param name the repository name + * @return A new instance of the repository group implementation + */ + EditableRepositoryGroup createRepositoryGroup(String id, String name); + + /** * Creates a new managed repository instance from the given configuration. All attributes are filled from the * provided configuration object. * @@ -119,6 +131,27 @@ public interface RepositoryProvider extends RepositoryEventListener */ void updateRemoteInstance(EditableRemoteRepository repo, RemoteRepositoryConfiguration configuration) throws RepositoryException; + + /** + * Creates a new repository group instance from the given configuration. All attributes are filled from the + * provided configuration object. + * + * @param configuration the repository group configuration + * @return a new created repository group instance + * @throws RepositoryException if some of the configuration values are not valid + */ + RepositoryGroup createRepositoryGroup(RepositoryGroupConfiguration configuration) throws RepositoryException; + + /** + * Updates the given remote repository instance from the given configuration. All attributes are filled from the + * provided configuration object. + * + * @param repositoryGroup the repository group instance that should be updated + * @param configuration the repository group configuration that contains the group data + * @throws RepositoryException if some of the configuration values are not valid + */ + void updateRepositoryGroupInstance(EditableRepositoryGroup repositoryGroup, RepositoryGroupConfiguration configuration) throws RepositoryException; + /** * Returns a configuration object from the given remote repository instance. * @@ -136,4 +169,13 @@ public interface RepositoryProvider extends RepositoryEventListener * @throws RepositoryException if the data cannot be converted */ ManagedRepositoryConfiguration getManagedConfiguration(ManagedRepository managedRepository) throws RepositoryException; + + /** + * Returns a configuration object from the given repository group instance. + * + * @param repositoryGroup the repository group + * @return the repository group configuration with all the data that is stored in the repository instance + * @throws RepositoryException if the data cannot be converted + */ + RepositoryGroupConfiguration getRepositoryGroupConfiguration(RepositoryGroup repositoryGroup) throws RepositoryException; } |