1 package org.apache.archiva.repository;
4 * Licensed to the Apache Software Foundation (ASF) under one
5 * or more contributor license agreements. See the NOTICE file
6 * distributed with this work for additional information
7 * regarding copyright ownership. The ASF licenses this file
8 * to you under the Apache License, Version 2.0 (the
9 * "License"); you may not use this file except in compliance
10 * with the License. You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing,
15 * software distributed under the License is distributed on an
16 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17 * KIND, either express or implied. See the License for the
18 * specific language governing permissions and limitations
22 import org.apache.archiva.configuration.ManagedRepositoryConfiguration;
23 import org.apache.archiva.configuration.RemoteRepositoryConfiguration;
29 * This interface must be implemented by the repository implementations. The repository provider knows all
30 * about the repositories and should be the only part that uses the repository specific classes and libraries
31 * (e.g. the maven libraries).
33 * Newly created instances should always be filled with default values that make sense. null values should
36 * References like staging repositories must not be set.
40 public interface RepositoryProvider
44 * Returns the types of repositories this provider can handle.
46 * @return the set of supported repository types
48 Set<RepositoryType> provides();
51 * Creates a editable managed repository instance. The provider must not check the uniqueness of the
52 * id parameter and must not track the already created instances. Each call to this method will create
55 * @param id the repository identifier
56 * @param name the repository name
57 * @return a new created managed repository instance
59 EditableManagedRepository createManagedInstance(String id, String name);
62 * Creates a editable remote repository instance. The provider must not check the uniqueness of the
63 * id parameter and must not track the already created instances. Each call to this method will create
66 * @param id the repository identifier
67 * @param name the repository name
68 * @return a new created remote repository instance
70 EditableRemoteRepository createRemoteInstance(String id, String name);
73 * Creates a new managed repository instance from the given configuration. All attributes are filled from the
74 * provided configuration object.
76 * @param configuration the repository configuration that contains the repository data
77 * @return a new created managed repository instance
78 * @throws RepositoryException if some of the configuration values are not valid
80 ManagedRepository createManagedInstance( ManagedRepositoryConfiguration configuration) throws RepositoryException;
83 * Updates the given managed repository instance from the given configuration. All attributes are filled from the
84 * provided configuration object.
86 * @param repo the repository instance that should be updated
87 * @param configuration the repository configuration that contains the repository data
88 * @throws RepositoryException if some of the configuration values are not valid
90 void updateManagedInstance( EditableManagedRepository repo, ManagedRepositoryConfiguration configuration) throws RepositoryException;
93 * Creates a new managed staging repository instance from the given configuration. All attributes are filled from the
94 * provided configuration object.
96 * @param baseConfiguration the repository configuration of the base repository that references the staging repository
97 * @return a new created managed staging repository instance
98 * @throws RepositoryException if some of the configuration values are not valid
100 ManagedRepository createStagingInstance(ManagedRepositoryConfiguration baseConfiguration) throws RepositoryException;
103 * Creates a new remote repository instance from the given configuration. All attributes are filled from the
104 * provided configuration object.
106 * @param configuration the repository configuration that contains the repository data
107 * @return a new created remote repository instance
108 * @throws RepositoryException if some of the configuration values are not valid
110 RemoteRepository createRemoteInstance( RemoteRepositoryConfiguration configuration) throws RepositoryException;
113 * Updates the given remote repository instance from the given configuration. All attributes are filled from the
114 * provided configuration object.
116 * @param repo the repository instance that should be updated
117 * @param configuration the repository configuration that contains the repository data
118 * @throws RepositoryException if some of the configuration values are not valid
120 void updateRemoteInstance(EditableRemoteRepository repo, RemoteRepositoryConfiguration configuration) throws RepositoryException;
123 * Returns a configuration object from the given remote repository instance.
125 * @param remoteRepository the remote repository instance
126 * @return the repository configuration with all the data that is stored in the repository instance
127 * @throws RepositoryException if the data cannot be converted
129 RemoteRepositoryConfiguration getRemoteConfiguration(RemoteRepository remoteRepository) throws RepositoryException;
132 * Returns a configuration object from the given managed repository instance.
134 * @param managedRepository the managed repository instance
135 * @return the repository configuration with all the data that is stored in the repository instance
136 * @throws RepositoryException if the data cannot be converted
138 ManagedRepositoryConfiguration getManagedConfiguration(ManagedRepository managedRepository) throws RepositoryException;