Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
ScmProviderRepository |
|
| 1.4;1,4 |
1 | package org.apache.maven.scm.provider; | |
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 | /** | |
23 | * @author <a href="mailto:trygvis@inamo.no">Trygve Laugstøl</a> | |
24 | * @author <a href="mailto:evenisse@apache.org">Emmanuel Venisse</a> | |
25 | * @version $Id: ScmProviderRepository.java 922043 2010-03-11 22:30:56Z olamy $ | |
26 | */ | |
27 | 0 | public abstract class ScmProviderRepository |
28 | { | |
29 | private String user; | |
30 | ||
31 | private String password; | |
32 | ||
33 | 0 | private boolean persistCheckout = false; |
34 | ||
35 | /** | |
36 | * @since 1.4 | |
37 | */ | |
38 | 0 | private boolean pushChanges = true; |
39 | ||
40 | /** | |
41 | * @return The user. | |
42 | */ | |
43 | public String getUser() | |
44 | { | |
45 | 0 | return user; |
46 | } | |
47 | ||
48 | /** | |
49 | * Set the user. | |
50 | * | |
51 | * @param user The user | |
52 | */ | |
53 | public void setUser( String user ) | |
54 | { | |
55 | 0 | this.user = user; |
56 | 0 | } |
57 | ||
58 | /** | |
59 | * @return The password. | |
60 | */ | |
61 | public String getPassword() | |
62 | { | |
63 | 0 | return password; |
64 | } | |
65 | ||
66 | /** | |
67 | * Set the password. | |
68 | * | |
69 | * @param password The user password | |
70 | */ | |
71 | public void setPassword( String password ) | |
72 | { | |
73 | 0 | this.password = password; |
74 | 0 | } |
75 | ||
76 | /** | |
77 | * Should distributed changes be pushed to the central repository? | |
78 | * For many distributed SCMs like Git, a change like a commit | |
79 | * is only stored in your local copy of the repository. Pushing | |
80 | * the change allows your to more easily share it with other users. | |
81 | * @since 1.4 | |
82 | */ | |
83 | public boolean isPushChanges() | |
84 | { | |
85 | 0 | return pushChanges; |
86 | } | |
87 | ||
88 | /** | |
89 | * @since 1.4 | |
90 | * @param pushChanges | |
91 | */ | |
92 | public void setPushChanges(boolean pushChanges) | |
93 | { | |
94 | 0 | this.pushChanges = pushChanges; |
95 | 0 | } |
96 | ||
97 | /** | |
98 | * Will checkouts using this repository be persisted so they can | |
99 | * be refreshed in the future? This property is of concern to SCMs | |
100 | * like Perforce and Clearcase where the server must track where a | |
101 | * user checks out to. If false, the server entry (clientspec in Perforce | |
102 | * terminology) will be deleted after the checkout is complete so the | |
103 | * files will not be able to be updated. | |
104 | * <p/> | |
105 | * This setting can be overriden by using the system property | |
106 | * "maven.scm.persistcheckout" to true. | |
107 | * <p/> | |
108 | * The default is false. See SCM-113 for more detail. | |
109 | */ | |
110 | public boolean isPersistCheckout() | |
111 | { | |
112 | 0 | String persist = System.getProperty( "maven.scm.persistcheckout" ); |
113 | 0 | if ( persist != null ) |
114 | { | |
115 | 0 | return Boolean.valueOf( persist ).booleanValue(); |
116 | } | |
117 | 0 | return persistCheckout; |
118 | } | |
119 | ||
120 | public void setPersistCheckout( boolean persistCheckout ) | |
121 | { | |
122 | 0 | this.persistCheckout = persistCheckout; |
123 | 0 | } |
124 | ||
125 | /** | |
126 | * Get a {@link ScmProviderRepository} that represents the parent folder in the repository. | |
127 | * Useful when the repository does not exist yet and we need to create it from the parent. | |
128 | * | |
129 | * @return the parent repository | |
130 | * @throws UnsupportedOperationException unless overridden by subclass | |
131 | */ | |
132 | public ScmProviderRepository getParent() | |
133 | { | |
134 | 0 | throw new UnsupportedOperationException(); |
135 | } | |
136 | ||
137 | /** | |
138 | * Get the relative path between the repository provided as argument and the current repository. | |
139 | * | |
140 | * @param ancestor another repository that should be ancestor of this one | |
141 | * @return the relative path or <code>null</code> if it can't be resolved | |
142 | * @throws UnsupportedOperationException unless overridden by subclass | |
143 | */ | |
144 | public String getRelativePath( ScmProviderRepository ancestor ) | |
145 | { | |
146 | 0 | throw new UnsupportedOperationException(); |
147 | } | |
148 | } |