1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26 package com.aragost.javahg;
27
28 import java.nio.charset.CodingErrorAction;
29 import java.util.Collection;
30 import java.util.HashMap;
31 import java.util.Map;
32
33 import com.google.common.base.Strings;
34 import com.google.common.collect.Sets;
35 import java.nio.charset.Charset;
36
37
38
39
40 public class RepositoryConfiguration {
41
42 static {
43 String hgBin = System.getProperty("com.aragost.javahg.hgbin");
44 if (Strings.isNullOrEmpty(hgBin)) {
45 hgBin = "hg";
46 }
47 DEFAULT_HG_BIN = hgBin;
48 }
49
50 private static final String DEFAULT_HG_BIN;
51
52
53
54
55 protected static final Charset DEFAULT_ENCODING = Charset.forName("UTF-8");
56
57
58
59
60 private Charset encoding = DEFAULT_ENCODING;
61
62
63
64
65
66 public static final RepositoryConfiguration DEFAULT = new RepositoryConfiguration();
67
68 public enum CachePolicy {
69 STRONG, SOFT, WEAK, NONE
70 };
71
72
73
74
75 private String hgBin = DEFAULT_HG_BIN;
76
77
78
79
80
81
82
83 private String hgrcPath = "";
84
85
86
87
88 private CachePolicy cachePolicy = CachePolicy.SOFT;
89
90
91
92
93
94 private CodingErrorAction codingErrorAction = CodingErrorAction.REPORT;
95
96
97
98
99
100
101
102 private int stderrBufferSize = 1024;
103
104
105
106
107 private Collection<Class<? extends MercurialExtension>> extensionClasses = Sets.newHashSet();
108
109
110
111
112 private int concurrency = 1;
113
114
115
116
117
118 private int commandWaitTimeoutSeconds = 120;
119
120
121
122
123
124 private int serverIdleTimeSeconds = Integer.MAX_VALUE;
125
126
127
128
129 private String sshBin;
130
131
132
133
134 private boolean enablePendingChangesets = false;
135
136
137
138
139 private final Map<String, String> environment = new HashMap<String, String>();
140
141 public boolean isEnablePendingChangesets(){
142 return enablePendingChangesets;
143 }
144
145 public void setEnablePendingChangesets(boolean enablePendingChangesets){
146 this.enablePendingChangesets = enablePendingChangesets;
147 }
148
149 public String getHgBin() {
150 return hgBin;
151 }
152
153 public void setHgBin(String hgBin) {
154 this.hgBin = hgBin;
155 }
156
157 public String getHgrcPath() {
158 return hgrcPath;
159 }
160
161 public void setHgrcPath(String hgrcPath) {
162 this.hgrcPath = hgrcPath;
163 }
164
165 public CachePolicy getCachePolicy() {
166 return cachePolicy;
167 }
168
169 public void setCachePolicy(CachePolicy cachePolicy) {
170 this.cachePolicy = cachePolicy;
171 }
172
173 public CodingErrorAction getCodingErrorAction() {
174 return codingErrorAction;
175 }
176
177 public void setCodingErrorAction(CodingErrorAction codingErrorAction) {
178 this.codingErrorAction = codingErrorAction;
179 }
180
181 public int getStderrBufferSize() {
182 return stderrBufferSize;
183 }
184
185 public void setStderrBufferSize(int stderrBufferSize) {
186 this.stderrBufferSize = stderrBufferSize;
187 }
188
189 public Collection<Class<? extends MercurialExtension>> getExtensionClasses() {
190 return extensionClasses;
191 }
192
193 public void setExtensionClasses(Collection<Class<? extends MercurialExtension>> extensionClasses) {
194 this.extensionClasses = extensionClasses;
195 }
196
197 public void addExtension(Class<? extends MercurialExtension> extClass) {
198 this.extensionClasses.add(extClass);
199 }
200
201 public void removeExtension(Class<? extends MercurialExtension> extClass) {
202 this.extensionClasses.remove(extClass);
203 }
204
205 public Charset getEncoding(){
206 return encoding;
207 }
208
209 public void setEncoding(Charset encoding){
210 this.encoding = encoding;
211 }
212
213
214
215
216 public int getConcurrency() {
217 return concurrency;
218 }
219
220
221
222
223
224
225
226 public void setConcurrency(int concurrency) {
227 this.concurrency = concurrency;
228 }
229
230
231
232
233
234 public int getCommandWaitTimeout() {
235 return commandWaitTimeoutSeconds;
236 }
237
238
239
240
241
242
243
244
245
246
247
248 public void setCommandWaitTimeout(int seconds) {
249 this.commandWaitTimeoutSeconds = seconds;
250 }
251
252
253
254
255
256
257
258 public int getServerIdleTime() {
259 return this.serverIdleTimeSeconds;
260 }
261
262
263
264
265
266
267
268 public void setServerIdleTime(int seconds) {
269 this.serverIdleTimeSeconds = seconds;
270 }
271
272
273
274
275
276
277 public String getSshBin() {
278 return sshBin;
279 }
280
281
282
283
284
285
286 public void setSshBin(String sshBin) {
287 this.sshBin = sshBin;
288 }
289
290
291
292
293
294 public Map<String, String> getEnvironment()
295 {
296 return this.environment;
297 }
298 }