001: /*
002: * ====================================================================
003: * Copyright (c) 2004-2008 TMate Software Ltd. All rights reserved.
004: *
005: * This software is licensed as described in the file COPYING, which
006: * you should have received as part of this distribution. The terms
007: * are also available at http://svnkit.com/license.html
008: * If newer versions of this license are posted there, you may use a
009: * newer version instead, at your option.
010: * ====================================================================
011: */
012: package org.tmatesoft.svn.core.wc;
013:
014: import java.io.File;
015: import java.text.DateFormat;
016: import java.util.Map;
017:
018: import org.tmatesoft.svn.core.io.ISVNTunnelProvider;
019:
020: /**
021: * The <b>ISVNOptions</b> interface should be implemented to manage
022: * global run-time configuration options.
023: *
024: * <p>
025: * Like the Subversion client library SVNKit uses configuration options
026: * during runtime. <b>ISVNOptions</b> is intended for managing those
027: * options which are similar to ones you can meet in the <i>config</i> file
028: * located in the default Subversion configuration area - on <i>Windows</i> platforms
029: * it's usually located in the <i>'Documents and Settings\UserName\Subversion'</i>
030: * (or simply <i>'%APPDATA%\Subversion'</i>) directory, on <i>Unix</i>-like platforms - in
031: * <i>'~/.subversion'</i>. <b>ISVNOptions</b> is not intended for managing those
032: * options that can be met in the <i>servers</i> file (located in the same directory
033: * as <i>config</i>) - options for network layers are managed by interfaces and classes
034: * of the <B><A HREF="../auth/package-summary.html">org.tmatesoft.svn.core.auth</A></B> package.
035: *
036: * <p>
037: * Every <b>SVN</b>*<b>Client</b>'s public constructor receives an <b>ISVNOptions</b>
038: * as a driver of the run-time configuration options. <b>SVNClientManager</b> also has
039: * got several <b>newInstance()</b> methods that receive an options driver. Thus it's simpe
040: * to implement a specific options driver to <b>ISVNOptions</b> and use it instead of a default one.
041: * However if you are not interested in customizing the run-time configuration area
042: * you can use a default driver which uses config info from the default SVN configuration area (see
043: * above).
044: *
045: * <p>
046: * Use {@link SVNWCUtil} to get a default options driver, like this:
047: * <pre class="javacode">
048: * <span class="javakeyword">import</span> org.tmatesoft.svn.core.wc.ISVNOptions;
049: * <span class="javakeyword">import</span> org.tmatesoft.svn.core.wc.SVNClientManager;
050: * ...
051: * <span class="javacomment">//here the only one boolean parameter - <i>readonly</i> - enables</span>
052: * <span class="javacomment">//or disables writing to the config file: if true (like in this snippet) -</span>
053: * <span class="javacomment">//SVNKit can only read options from the config file but not write</span>
054: * ISVNOptions options = SVNWCUtil.createDefaultOptions(<span class="javakeyword">true</span>);
055: * SVNClientManager clientManager = SVNClientManager.newInstance(options, <span class="javastring">"name"</span>, <span class="javastring">"password"</span>);
056: * ...</pre>
057: * <p>
058: * If you would like to have the default configuration area in a place different
059: * from the SVN default one, you should provide a preferred path to the config
060: * directory like this:
061: * <pre class="javacode">
062: * <span class="javakeyword">import</span> org.tmatesoft.svn.core.wc.ISVNOptions;
063: * <span class="javakeyword">import</span> org.tmatesoft.svn.core.wc.SVNClientManager;
064: * ...
065: * File defaultConfigDir = <span class="javakeyword">new</span> File(<span class="javastring">"way/to/your/config/dir"</span>);
066: * ISVNOptions options = SVNWCUtil.createDefaultOptions(defaultConfigDir, <span class="javakeyword">true</span>);
067: * SVNClientManager clientManager = SVNClientManager.newInstance(options, <span class="javastring">"name"</span>, <span class="javastring">"password"</span>);
068: * ...</pre><br />
069: * In this case in the specified directory SVNKit will create necessary configuration files (in particular <i>config</i> and <i>servers</i>) which
070: * are absolutely identical to those <u>default</u> ones (without any user's edits) located in the SVN config area.
071: *
072: * <p>
073: * Read also this <a href="http://svnbook.red-bean.com/nightly/en/svn-book.html#svn.advanced">Subversion book chapter</a> on runtime configuration area.
074: *
075: * @version 1.1.1
076: * @author TMate Software Ltd.
077: * @see SVNWCUtil
078: * @see <a target="_top" href="http://svnkit.com/kb/examples/">Examples</a>
079: *
080: */
081: public interface ISVNOptions extends ISVNTunnelProvider {
082:
083: /**
084: * Determines if the commit-times option is enabled.
085: *
086: * <p>
087: * The commit-times option makes checkout/update/switch/revert operations put
088: * last-committed timestamps on every file they touch.
089: *
090: * <p>
091: * This option corresponds to
092: * the <i>'use-commit-times'</i> option that can be found in the
093: * SVN's <i>config</i> file under the <i>[miscellany]</i> section.
094: *
095: * @return <span class="javakeyword">true</span> if commit-times
096: * are enabled, otherwise <span class="javakeyword">false</span>
097: * @see #setUseCommitTimes(boolean)
098: */
099: public boolean isUseCommitTimes();
100:
101: /**
102: * Enables or disables the commit-times option.
103: *
104: * <p>
105: * The commit-times option makes checkout/update/switch/revert operations put
106: * last-committed timestamps on every file they touch.
107: *
108: * <p>
109: * This option corresponds to
110: * the <i>'use-commit-times'</i> option that can be found in the
111: * SVN's <i>config</i> file under the <i>[miscellany]</i> section.
112: *
113: * @param useCommitTimes <span class="javakeyword">true</span> to
114: * enable commit-times, <span class="javakeyword">false</span>
115: * to disable
116: * @see #isUseCommitTimes()
117: */
118: public void setUseCommitTimes(boolean useCommitTimes);
119:
120: /**
121: * Determines if the autoproperties option is enabled.
122: *
123: * <p>
124: * Autoproperties are the properties that are automatically set
125: * on files when they are added or imported.
126: *
127: * <p>
128: * This option corresponds to the <i>'enable-auto-props'</i> option
129: * that can be found in the SVN's <i>config</i> file under the
130: * <i>[miscellany]</i> section.
131: *
132: * @return <span class="javakeyword">true</span> if autoproperties
133: * are enabled, otherwise <span class="javakeyword">false</span>
134: * @see #setUseAutoProperties(boolean)
135: */
136: public boolean isUseAutoProperties();
137:
138: /**
139: * Enables or disables the autoproperties option.
140: *
141: * <p>
142: * Autoproperties are the properties that are automatically set
143: * on files when they are added or imported.
144: *
145: * <p>
146: * This option corresponds to the <i>'enable-auto-props'</i> option
147: * that can be found in the SVN's <i>config</i> file under the
148: * <i>[miscellany]</i> section.
149: *
150: * @param useAutoProperties <span class="javakeyword">true</span> to
151: * enable autoproperties, <span class="javakeyword">false</span>
152: * to disable
153: * @see #isUseAutoProperties()
154: */
155: public void setUseAutoProperties(boolean useAutoProperties);
156:
157: /**
158: * Determines if the authentication storage is enabled.
159: *
160: * <p>
161: * The auth storage is used for disk-caching of all
162: * authentication information: usernames, passwords, server certificates,
163: * and any other types of cacheable credentials.
164: *
165: * <p>
166: * This option corresponds to the
167: * <i>'store-auth-creds'</i> option that can be found
168: * in the SVN's <i>config</i> file under the <i>[auth]</i> section.
169: *
170: * @return <span class="javakeyword">true</span> if auth storage
171: * is enabled, otherwise <span class="javakeyword">false</span>
172: * @see #setAuthStorageEnabled(boolean)
173: */
174: public boolean isAuthStorageEnabled();
175:
176: /**
177: * Enables or disables the authentication storage.
178: *
179: * <p>
180: * The auth storage is used for disk-caching of all
181: * authentication information: usernames, passwords, server certificates,
182: * and any other types of cacheable credentials.
183: *
184: * <p>
185: * This option corresponds to the
186: * <i>'store-auth-creds'</i> option that can be found
187: * in the SVN's <i>config</i> file under the <i>[auth]</i> section.
188: *
189: * @param storeAuth <span class="javakeyword">true</span> to
190: * enable the auth storage, <span class="javakeyword">false</span>
191: * to disable
192: * @see #isAuthStorageEnabled()
193: */
194: public void setAuthStorageEnabled(boolean storeAuth);
195:
196: /**
197: * Determines if a file is ignored according to the
198: * global ignore patterns.
199: *
200: * <p>
201: * The global ignore patterns describe the names of
202: * files and directories that SVNKit should ignore during status, add and
203: * import operations. Similar to the
204: * <i>'global-ignores'</i> option that can be found in the SVN's <i>config</i>
205: * file under the <i>[miscellany]</i> section.
206: *
207: * @param name a file name
208: * @return <span class="javakeyword">true</span> if the file
209: * is ignored, otherwise <span class="javakeyword">false</span>
210: * @deprecated
211: */
212: public boolean isIgnored(String name);
213:
214: /**
215: * Determines if a file is ignored according to the
216: * global ignore patterns.
217: *
218: * <p>
219: * The global ignore patterns describe the names of
220: * files and directories that SVNKit should ignore during status, add and
221: * import operations. Similar to the
222: * <i>'global-ignores'</i> option that can be found in the SVN's <i>config</i>
223: * file under the <i>[miscellany]</i> section.
224: *
225: * @param file a file
226: * @return <span class="javakeyword">true</span> if the file
227: * is ignored, otherwise <span class="javakeyword">false</span>
228: */
229: public boolean isIgnored(File file);
230:
231: /**
232: * Returns all the global ignore patterns.
233: *
234: * <p>
235: * The global ignore patterns describe the names of
236: * files and directories that SVNKit should ignore during status, add and
237: * import operations. Similar to the
238: * <i>'global-ignores'</i> option that can be found in the SVN's <i>config</i>
239: * file under the <i>[miscellany]</i> section.
240: *
241: * @return an array of patterns (that usually contain wildcards)
242: * that specify file and directory names to be ignored until
243: * they are versioned
244: * @see #setIgnorePatterns(String[])
245: */
246: public String[] getIgnorePatterns();
247:
248: /**
249: * Sets global ignore patterns.
250: *
251: * <p>
252: * The global ignore patterns describe the names of
253: * files and directories that SVNKit should ignore during status, add and
254: * import operations. Similar to the
255: * <i>'global-ignores'</i> option that can be found in the SVN's <i>config</i>
256: * file under the <i>[miscellany]</i> section.
257: *
258: * <p>
259: * For example, to set all <code>.exe</code> files to be ignored include
260: * <code>"*.exe"</code> pattern into <code>patterns</code>.
261: *
262: * <p>
263: * If <code>patterns</code> is <span class="javakeyword">null</span> or
264: * empty then all the patterns will be removed.
265: *
266: * @param patterns an array of patterns (that usually contain wildcards)
267: * that specify file and directory names to be ignored until
268: * they are versioned
269: * @see #getIgnorePatterns()
270: */
271: public void setIgnorePatterns(String[] patterns);
272:
273: /**
274: * Removes a particular global ignore pattern.
275: *
276: * @param pattern a patterna to be removed
277: * @see #addIgnorePattern(String)
278: */
279: public void deleteIgnorePattern(String pattern);
280:
281: /**
282: * Adds a new particular ignore pattern to global
283: * ignore patterns.
284: *
285: * @param pattern an ignore pattern to be added
286: * @see #deleteIgnorePattern(String)
287: */
288: public void addIgnorePattern(String pattern);
289:
290: /**
291: * Returns autoproperties as a {@link java.util.Map}
292: * where each key is a file name pattern and the corresponding
293: * value is a string in the form of <code>"propName=propValue"</code>.
294: *
295: * @return a {@link java.util.Map} containing autoproperties
296: * @see #setAutoProperties(Map)
297: */
298: public Map getAutoProperties();
299:
300: /**
301: * Sets autoproperties that will be automatically put on all files
302: * that will be added or imported.
303: *
304: * <p>
305: * There can be several properties specified for one file pattern -
306: * they should be delimited by ";".
307: *
308: * @param autoProperties a {@link java.util.Map} which keys are file
309: * name patterns and their values are strings
310: * in the form of <code>"propName=propValue"</code>
311: * @see #getAutoProperties()
312: */
313: public void setAutoProperties(Map autoProperties);
314:
315: /**
316: * Removes a particular autoproperty by specifying a file name
317: * pattern.
318: *
319: * @param pattern a file name pattern
320: * @see #setAutoProperty(String, String)
321: *
322: */
323: public void deleteAutoProperty(String pattern);
324:
325: /**
326: * Sets an autoproperty - binds a file name pattern with a
327: * string in the form of <code>"propName=propValue"</code>.
328: *
329: * @param pattern a file name pattern (usually containing
330: * wildcards)
331: * @param properties a property for <code>pattern</code>
332: * @see #deleteAutoProperty(String)
333: */
334: public void setAutoProperty(String pattern, String properties);
335:
336: /**
337: * Collects and puts into a {@link java.util.Map} all
338: * autoproperties specified for the file name pattern matched by the
339: * target file name.
340: *
341: * <p>
342: * If <code>fileName</code> matches any known file name pattern then
343: * all properties set for that pattern will be collected and
344: * placed into <code>target</code>.
345: *
346: * <p>
347: * For one file name pattern there can be several autoproperties set,
348: * delimited by ";".
349: *
350: * @param file a target file
351: * @param target a {@link java.util.Map} that will receive
352: * autoproperties
353: * @return <code>target</code> itself
354: */
355: public Map applyAutoProperties(File file, Map target);
356:
357: /**
358: * Returns a factory object which is responsible for creating
359: * merger drivers.
360: *
361: * @return a factory that produces merger drivers
362: * for merge operations
363: * @see #setMergerFactory(ISVNMergerFactory)
364: */
365: public ISVNMergerFactory getMergerFactory();
366:
367: /**
368: * Sets a factory object which is responsible for creating
369: * merger drivers.
370: *
371: * @param merger a factory that produces merger drivers
372: * for merge operations
373: * @see #getMergerFactory()
374: */
375: public void setMergerFactory(ISVNMergerFactory merger);
376:
377: /**
378: * Returns the value of a property from the <i>[svnkit]</i> section
379: * of the <i>config</i> file. Currently not used.
380: *
381: * @param propertyName a SVNKit specific config property name
382: * @return the value of the property
383: */
384: public String getPropertyValue(String propertyName);
385:
386: /**
387: * Sets the value of a property from the <i>[svnkit]</i> section
388: * of the <i>config</i> file. Currently not used.
389: *
390: * @param propertyName a SVNKit specific config property name
391: * @param propertyValue a new value for the property; if
392: * <span class="javakeyword">null</span> the
393: * property is removed
394: */
395: public void setPropertyValue(String propertyName,
396: String propertyValue);
397:
398: public DateFormat getKeywordDateFormat();
399: }
|