View Javadoc
1   package org.apache.maven.shared.release.scm;
2   
3   /*
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
11   *
12   *   http://www.apache.org/licenses/LICENSE-2.0
13   *
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
19   * under the License.
20   */
21  
22  import org.apache.maven.scm.manager.NoSuchScmProviderException;
23  import org.apache.maven.scm.provider.ScmProvider;
24  import org.apache.maven.scm.repository.ScmRepository;
25  import org.apache.maven.scm.repository.ScmRepositoryException;
26  import org.apache.maven.settings.Settings;
27  import org.apache.maven.shared.release.config.ReleaseDescriptor;
28  
29  /**
30   * Configure an SCM repository using release configuration.
31   *
32   * @author <a href="mailto:brett@apache.org">Brett Porter</a>
33   */
34  public interface ScmRepositoryConfigurator
35  {
36      /**
37       * The Plexus role.
38       */
39      String ROLE = ScmRepositoryConfigurator.class.getName();
40  
41      /**
42       * Construct a configured SCM repository from a release configuration.
43       *
44       * @param releaseDescriptor the configuration to insert into the repository
45       * @param settings          the settings.xml configuraiton
46       * @return the repository created
47       * @throws ScmRepositoryException     if it is not possible to create a suitable SCM repository
48       * @throws NoSuchScmProviderException if the requested SCM provider is not available
49       */
50      ScmRepository getConfiguredRepository( ReleaseDescriptor releaseDescriptor, Settings settings )
51          throws ScmRepositoryException, NoSuchScmProviderException;
52  
53      /**
54       * Get the SCM provider used for the given SCM repository.
55       *
56       * @param repository the SCM repository
57       * @return the SCM provider
58       * @throws NoSuchScmProviderException if the requested SCM provider is not available
59       */
60      ScmProvider getRepositoryProvider( ScmRepository repository )
61          throws NoSuchScmProviderException;
62  
63      /**
64       * Construct a configured SCM repository from a release configuration with an overridden base SCM URL.
65       *
66       * @param url               the SCM URL to use instead of the one from the release descriptor
67       * @param releaseDescriptor the configuration to insert into the repository
68       * @param settings          the settings.xml configuraiton
69       * @return the repository created
70       * @throws ScmRepositoryException     if it is not possible to create a suitable SCM repository
71       * @throws NoSuchScmProviderException if the requested SCM provider is not available
72       */
73      ScmRepository getConfiguredRepository( String url, ReleaseDescriptor releaseDescriptor, Settings settings )
74          throws ScmRepositoryException, NoSuchScmProviderException;
75  }