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 public abstract class ScmProviderRepository {
27 private String user;
28
29 private String password;
30
31 @Deprecated
32 private boolean persistCheckout = false;
33
34 /**
35 * @since 1.4
36 */
37 private boolean pushChanges = true;
38
39 /**
40 * Some SCMs have the concept of a work item (or task) which may need to be
41 * specified to allow changes to be pushed or delivered to a target.
42 * This allows you to answer the question: For this workItem, what changed?
43 * Auditors have been known to love this... :)
44 * SCMs known to implement this are:
45 * <ul>
46 * <li>IBM Rational Team Concert (workItem)
47 * <li>Microsoft Team Foundation Server (workItem)
48 * <li>IBM Rational ClearQuest Enabled UCM ClearCase (task)
49 * </ul>
50 * There may be others that support this feature.
51 * <P>
52 * These SCMs can be configured to reject a push/deliver unless additional
53 * information (by way of a workItem/task) is supplied.
54 * <P>
55 * This field is only relevant when pushChanges = true.
56 * <P>
57 * It should be noted however, when pushChanges = true, a workItem does not
58 * need to be set, as the need for a workItem may be optional.
59 *
60 * @since 1.9.5
61 */
62 @Deprecated
63 private String workItem;
64
65 /**
66 * @return the user
67 */
68 public String getUser() {
69 return user;
70 }
71
72 /**
73 * Set the user.
74 *
75 * @param user the user
76 */
77 public void setUser(String user) {
78 this.user = user;
79 }
80
81 /**
82 * @return the password
83 */
84 public String getPassword() {
85 return password;
86 }
87
88 /**
89 * Set the password.
90 *
91 * @param password the user password
92 */
93 public void setPassword(String password) {
94 this.password = password;
95 }
96
97 /**
98 * Should distributed changes be pushed to the central repository?
99 * For many distributed SCMs like Git, a change like a commit
100 * is only stored in your local copy of the repository. Pushing
101 * the change allows your to more easily share it with other users.
102 *
103 * @return TODO
104 * @since 1.4
105 */
106 public boolean isPushChanges() {
107 return pushChanges;
108 }
109
110 /**
111 * @param pushChanges TODO
112 * @since 1.4
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 *
151 * @return TODO
152 */
153 @Deprecated
154 public boolean isPersistCheckout() {
155 String persist = System.getProperty("maven.scm.persistcheckout");
156 if (persist != null) {
157 return Boolean.valueOf(persist).booleanValue();
158 }
159 return persistCheckout;
160 }
161
162 @Deprecated
163 public void setPersistCheckout(boolean persistCheckout) {
164 this.persistCheckout = persistCheckout;
165 }
166
167 /**
168 * Get a {@link ScmProviderRepository} that represents the parent folder in the repository.
169 * Useful when the repository does not exist yet, and we need to create it from the parent.
170 *
171 * @return the parent repository
172 * @throws UnsupportedOperationException unless overridden by subclass
173 */
174 public ScmProviderRepository getParent() {
175 throw new UnsupportedOperationException();
176 }
177
178 /**
179 * Get the relative path between the repository provided as argument and the current repository.
180 *
181 * @param ancestor another repository that should be ancestor of this one
182 * @return the relative path or <code>null</code> if it can't be resolved
183 * @throws UnsupportedOperationException unless overridden by subclass
184 */
185 public String getRelativePath(ScmProviderRepository ancestor) {
186 throw new UnsupportedOperationException();
187 }
188 }