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;
24 import org.apache.archiva.configuration.RepositoryGroupConfiguration;
25 import org.apache.archiva.repository.events.EventHandler;
27 import java.io.IOException;
32 * This interface must be implemented by the repository implementations. The repository provider knows all
33 * about the repositories and should be the only part that uses the repository specific classes and libraries
34 * (e.g. the maven libraries).
36 * Newly created instances should always be filled with default values that make sense. null values should
39 * References like staging repositories must not be set.
43 public interface RepositoryProvider extends EventHandler
47 * Returns the types of repositories this provider can handle.
49 * @return the set of supported repository types
51 Set<RepositoryType> provides();
54 * Creates a editable managed repository instance. The provider must not check the uniqueness of the
55 * id parameter and must not track the already created instances. Each call to this method will create
58 * @param id the repository identifier
59 * @param name the repository name
60 * @return a new created managed repository instance
62 EditableManagedRepository createManagedInstance(String id, String name) throws IOException;
65 * Creates a editable remote repository instance. The provider must not check the uniqueness of the
66 * id parameter and must not track the already created instances. Each call to this method will create
69 * @param id the repository identifier
70 * @param name the repository name
71 * @return a new created remote repository instance
73 EditableRemoteRepository createRemoteInstance(String id, String name);
76 * Creates a editable repository group. . The provider must not check the uniqueness of the
77 * id parameter and must not track the already created instances. Each call to this method will create
80 * @param id the repository identifier
81 * @param name the repository name
82 * @return A new instance of the repository group implementation
84 EditableRepositoryGroup createRepositoryGroup(String id, String name);
87 * Creates a new managed repository instance from the given configuration. All attributes are filled from the
88 * provided configuration object.
90 * @param configuration the repository configuration that contains the repository data
91 * @return a new created managed repository instance
92 * @throws RepositoryException if some of the configuration values are not valid
94 ManagedRepository createManagedInstance( ManagedRepositoryConfiguration configuration) throws RepositoryException;
97 * Updates the given managed repository instance from the given configuration. All attributes are filled from the
98 * provided configuration object.
100 * @param repo the repository instance that should be updated
101 * @param configuration the repository configuration that contains the repository data
102 * @throws RepositoryException if some of the configuration values are not valid
104 void updateManagedInstance( EditableManagedRepository repo, ManagedRepositoryConfiguration configuration) throws RepositoryException;
107 * Creates a new managed staging repository instance from the given configuration. All attributes are filled from the
108 * provided configuration object.
110 * @param baseConfiguration the repository configuration of the base repository that references the staging repository
111 * @return a new created managed staging repository instance
112 * @throws RepositoryException if some of the configuration values are not valid
114 ManagedRepository createStagingInstance(ManagedRepositoryConfiguration baseConfiguration) throws RepositoryException;
117 * Creates a new remote repository instance from the given configuration. All attributes are filled from the
118 * provided configuration object.
120 * @param configuration the repository configuration that contains the repository data
121 * @return a new created remote repository instance
122 * @throws RepositoryException if some of the configuration values are not valid
124 RemoteRepository createRemoteInstance( RemoteRepositoryConfiguration configuration) throws RepositoryException;
127 * Updates the given remote repository instance from the given configuration. All attributes are filled from the
128 * provided configuration object.
130 * @param repo the repository instance that should be updated
131 * @param configuration the repository configuration that contains the repository data
132 * @throws RepositoryException if some of the configuration values are not valid
134 void updateRemoteInstance(EditableRemoteRepository repo, RemoteRepositoryConfiguration configuration) throws RepositoryException;
138 * Creates a new repository group instance from the given configuration. All attributes are filled from the
139 * provided configuration object.
141 * @param configuration the repository group configuration
142 * @return a new created repository group instance
143 * @throws RepositoryException if some of the configuration values are not valid
145 RepositoryGroup createRepositoryGroup(RepositoryGroupConfiguration configuration) throws RepositoryException;
148 * Updates the given remote repository instance from the given configuration. All attributes are filled from the
149 * provided configuration object.
151 * @param repositoryGroup the repository group instance that should be updated
152 * @param configuration the repository group configuration that contains the group data
153 * @throws RepositoryException if some of the configuration values are not valid
155 void updateRepositoryGroupInstance(EditableRepositoryGroup repositoryGroup, RepositoryGroupConfiguration configuration) throws RepositoryException;
158 * Returns a configuration object from the given remote repository instance.
160 * @param remoteRepository the remote repository instance
161 * @return the repository configuration with all the data that is stored in the repository instance
162 * @throws RepositoryException if the data cannot be converted
164 RemoteRepositoryConfiguration getRemoteConfiguration(RemoteRepository remoteRepository) throws RepositoryException;
167 * Returns a configuration object from the given managed repository instance.
169 * @param managedRepository the managed repository instance
170 * @return the repository configuration with all the data that is stored in the repository instance
171 * @throws RepositoryException if the data cannot be converted
173 ManagedRepositoryConfiguration getManagedConfiguration(ManagedRepository managedRepository) throws RepositoryException;
176 * Returns a configuration object from the given repository group instance.
178 * @param repositoryGroup the repository group
179 * @return the repository group configuration with all the data that is stored in the repository instance
180 * @throws RepositoryException if the data cannot be converted
182 RepositoryGroupConfiguration getRepositoryGroupConfiguration(RepositoryGroup repositoryGroup) throws RepositoryException;