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.resolver.internal.ant.types.model;
20  
21  import org.apache.tools.ant.types.DataType;
22  
23  /**
24   * The SCM (Software Configuration Management) section is required if you
25   * aim to publish the POM to Maven Central.
26   */
27  public class Scm extends DataType {
28      private Connection connection;
29      private DeveloperConnection developerConnection;
30      private Url url;
31  
32      /**
33       * Default constructor.
34       */
35      public Scm() {}
36  
37      /**
38       * Allows Ant to add a <code>Connection</code> to the Scm.
39       *
40       * @param connection the connection to add
41       */
42      public void addConnection(Connection connection) {
43          this.connection = connection;
44      }
45  
46      /**
47       * Get the <code>Connection</code> of this Scm.
48       *
49       * @return the <code>Connection</code>, may be null if not specified.
50       */
51      public Connection getConnection() {
52          return connection;
53      }
54  
55      /**
56       * Get the <code>Connection</code> text value or null if not set.
57       * This corresponds to the text content of the connection element.
58       *
59       * @return the text value of the Connection
60       */
61      public String getConnectionText() {
62          return getConnection() == null ? null : getConnection().getText();
63      }
64  
65      /**
66       * Allows Ant to add a <code>DeveloperConnection</code> to the Scm.
67       *
68       * @param developerConnection the developerConnection to add
69       */
70      public void addDeveloperConnection(DeveloperConnection developerConnection) {
71          this.developerConnection = developerConnection;
72      }
73  
74      /**
75       * Get the DeveloperConnection of this Scm.
76       *
77       * @return the <code>DeveloperConnection</code>, may be null if not specified.
78       */
79      public DeveloperConnection getDeveloperConnection() {
80          return developerConnection;
81      }
82  
83      /**
84       * Get the <code>DeveloperConnection</code> text value or null if not set.
85       * This corresponds to the text content of the developerConnection element.
86       *
87       * @return the text value of the <code>DeveloperConnection</code>
88       */
89      public String getDeveloperConnectionText() {
90          return getDeveloperConnection() == null
91                  ? null
92                  : getDeveloperConnection().getText();
93      }
94  
95      /**
96       * Allows Ant to add a <code>Url</code> to the Scm.
97       *
98       * @param url the <code>Url</code> to add
99       */
100     public void addUrl(Url url) {
101         this.url = url;
102     }
103 
104     /**
105      * Get the <code>Url</code> of this Scm.
106      *
107      * @return the <code>Url</code>, may be null if not specified.
108      */
109     public Url getUrl() {
110         return url;
111     }
112 
113     /**
114      * Get the <code>Url</code> text value or null if not set.
115      * This corresponds to the text content of the url element.
116      *
117      * @return the text value of the <code>Url</code>
118      */
119     public String getUrlText() {
120         return getUrl() == null ? null : getUrl().getText();
121     }
122 }