View Javadoc
1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one
3    * or more contributor license agreements.  See the NOTICE file
4    * distributed with this work for additional information
5    * regarding copyright ownership.  The ASF licenses this file
6    * to you under the Apache License, Version 2.0 (the
7    * "License"); you may not use this file except in compliance
8    * with the License.  You may obtain a copy of the License at
9    *
10   *   http://www.apache.org/licenses/LICENSE-2.0
11   *
12   * Unless required by applicable law or agreed to in writing,
13   * software distributed under the License is distributed on an
14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15   * KIND, either express or implied.  See the License for the
16   * specific language governing permissions and limitations
17   * under the License.
18   */
19  package org.apache.maven.shared.release.scm;
20  
21  import org.apache.maven.scm.manager.NoSuchScmProviderException;
22  import org.apache.maven.scm.provider.ScmProvider;
23  import org.apache.maven.scm.repository.ScmRepository;
24  import org.apache.maven.scm.repository.ScmRepositoryException;
25  import org.apache.maven.settings.Settings;
26  import org.apache.maven.shared.release.config.ReleaseDescriptor;
27  
28  /**
29   * Configure an SCM repository using release configuration.
30   *
31   * @author <a href="mailto:brett@apache.org">Brett Porter</a>
32   */
33  public interface ScmRepositoryConfigurator {
34      /**
35       * Construct a configured SCM repository from a release configuration.
36       *
37       * @param releaseDescriptor the configuration to insert into the repository
38       * @param settings          the settings.xml configuraiton
39       * @return the repository created
40       * @throws org.apache.maven.scm.repository.ScmRepositoryException     if it is not possible to create a suitable
41       *         SCM repository
42       * @throws org.apache.maven.scm.manager.NoSuchScmProviderException if the requested SCM provider is not available
43       */
44      ScmRepository getConfiguredRepository(ReleaseDescriptor releaseDescriptor, Settings settings)
45              throws ScmRepositoryException, NoSuchScmProviderException;
46  
47      /**
48       * Get the SCM provider used for the given SCM repository.
49       *
50       * @param repository the SCM repository
51       * @return the SCM provider
52       * @throws org.apache.maven.scm.manager.NoSuchScmProviderException if the requested SCM provider is not available
53       */
54      ScmProvider getRepositoryProvider(ScmRepository repository) throws NoSuchScmProviderException;
55  
56      /**
57       * Construct a configured SCM repository from a release configuration with an overridden base SCM URL.
58       *
59       * @param url               the SCM URL to use instead of the one from the release descriptor
60       * @param releaseDescriptor the configuration to insert into the repository
61       * @param settings          the settings.xml configuraiton
62       * @return the repository created
63       * @throws org.apache.maven.scm.repository.ScmRepositoryException     if it is not possible to create a suitable
64       *         SCM repository
65       * @throws org.apache.maven.scm.manager.NoSuchScmProviderException if the requested SCM provider is not available
66       */
67      ScmRepository getConfiguredRepository(String url, ReleaseDescriptor releaseDescriptor, Settings settings)
68              throws ScmRepositoryException, NoSuchScmProviderException;
69  }