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.scm.provider;
20
21 /**
22 * @author <a href="mailto:trygvis@inamo.no">Trygve Laugstøl</a>
23 * @author <a href="mailto:evenisse@apache.org">Emmanuel Venisse</a>
24 * @author <a href="mailto:ChrisGWarp@gmail.com">Chris Graham</a>
25 *
26 */
27 public abstract class ScmProviderRepository {
28 private String user;
29
30 private String password;
31
32 @Deprecated
33 private boolean persistCheckout = false;
34
35 /**
36 * @since 1.4
37 */
38 private boolean pushChanges = true;
39
40 /**
41 * Some SCMs have the concept of a work item (or task) which may need to be
42 * specified to allow changes to be pushed or delivered to a target.
43 * This allows you to answer the question: For this workItem, what changed?
44 * Auditors have been known to love this... :)
45 * SCMs known to implement this are:
46 * <ul>
47 * <li>IBM Rational Team Concert (workItem)
48 * <li>Microsoft Team Foundation Server (workItem)
49 * <li>IBM Rational ClearQuest Enabled UCM ClearCase (task)
50 * </ul>
51 * There may be others that support this feature.
52 * <P>
53 * These SCMs can be configured to reject a push/deliver unless additional
54 * information (by way of a workItem/task) is supplied.
55 * <P>
56 * This field is only relevant when pushChanges = true.
57 * <P>
58 * It should be noted however, when pushChanges = true, a workItem does not
59 * need to be set, as the need for a workItem may be optional.
60 *
61 * @since 1.9.5
62 */
63 @Deprecated
64 private String workItem;
65
66 /**
67 * @return The user.
68 */
69 public String getUser() {
70 return user;
71 }
72
73 /**
74 * Set the user.
75 *
76 * @param user The user
77 */
78 public void setUser(String user) {
79 this.user = user;
80 }
81
82 /**
83 * @return The password.
84 */
85 public String getPassword() {
86 return password;
87 }
88
89 /**
90 * Set the password.
91 *
92 * @param password The user password
93 */
94 public void setPassword(String password) {
95 this.password = password;
96 }
97
98 /**
99 * Should distributed changes be pushed to the central repository?
100 * For many distributed SCMs like Git, a change like a commit
101 * is only stored in your local copy of the repository. Pushing
102 * the change allows your to more easily share it with other users.
103 * @return TODO
104 * @since 1.4
105 */
106 public boolean isPushChanges() {
107 return pushChanges;
108 }
109
110 /**
111 * @since 1.4
112 * @param pushChanges TODO
113 */
114 public void setPushChanges(boolean pushChanges) {
115 this.pushChanges = pushChanges;
116 }
117
118 /**
119 * @return The workItem.
120 * @since 1.9.5
121 */
122 @Deprecated
123 public String getWorkItem() {
124 return workItem;
125 }
126
127 /**
128 * Set the workItem.
129 *
130 * @param workItem The workItem.
131 * @since 1.9.5
132 */
133 @Deprecated
134 public void setWorkItem(String workItem) {
135 this.workItem = workItem;
136 }
137
138 /**
139 * Will checkouts using this repository be persisted so they can
140 * be refreshed in the future? This property is of concern to SCMs
141 * like Perforce and Clearcase where the server must track where a
142 * user checks out to. If false, the server entry (clientspec in Perforce
143 * terminology) will be deleted after the checkout is complete so the
144 * files will not be able to be updated.
145 * <p>
146 * This setting can be overriden by using the system property
147 * "maven.scm.persistcheckout" to true.
148 * <p>
149 * The default is false. See SCM-113 for more detail.
150 * @return TODO
151 */
152 @Deprecated
153 public boolean isPersistCheckout() {
154 String persist = System.getProperty("maven.scm.persistcheckout");
155 if (persist != null) {
156 return Boolean.valueOf(persist).booleanValue();
157 }
158 return persistCheckout;
159 }
160
161 @Deprecated
162 public void setPersistCheckout(boolean persistCheckout) {
163 this.persistCheckout = persistCheckout;
164 }
165
166 /**
167 * Get a {@link ScmProviderRepository} that represents the parent folder in the repository.
168 * Useful when the repository does not exist yet and we need to create it from the parent.
169 *
170 * @return the parent repository
171 * @throws UnsupportedOperationException unless overridden by subclass
172 */
173 public ScmProviderRepository getParent() {
174 throw new UnsupportedOperationException();
175 }
176
177 /**
178 * Get the relative path between the repository provided as argument and the current repository.
179 *
180 * @param ancestor another repository that should be ancestor of this one
181 * @return the relative path or <code>null</code> if it can't be resolved
182 * @throws UnsupportedOperationException unless overridden by subclass
183 */
184 public String getRelativePath(ScmProviderRepository ancestor) {
185 throw new UnsupportedOperationException();
186 }
187 }