KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > antmod > scm > ScmSystem


1 package org.antmod.scm;
2
3 import java.io.File JavaDoc;
4
5 /**
6  * Interface to be implemented by repository providers for access to
7  * a Source Configuration Management system such as CVS or Subversion.
8  *
9  * @author Klaas Waslander
10  */

11 public interface ScmSystem {
12
13     public String JavaDoc getStandardOutput();
14     public String JavaDoc getErrorOutput();
15
16     /**
17      * Get the URL of the repository which this ScmSystem instance
18      * is communicating with.
19      * @return The ScmUrl of the repository which this ScmSystem instance is communicating with.
20      */

21     public ScmUrl getUrl();
22     
23     /**
24      * Set the URL this ScmSystem instance should be talking with;
25      * is only invoked from within this package.
26      * @param providerUrl The URL this ScmSystem instance should be connecting with
27      */

28     void setUrl(ScmUrl providerUrl);
29
30     /**
31      * Add the given directory or file to this scm system.
32      * If it is not a file within an already added directory structure, the file/directory
33      * will be added to the root of this scm system.
34      * @param file The file/directory to be added
35      * @param recursive Whether to add any files under the directory recursively
36      */

37     public void doAdd(File JavaDoc file, boolean recursive);
38
39     /**
40      * Checkout a module from this SCM repository into the given destination directory;
41      * the destDir contains the module contents afterwards.
42      * @param moduleName The top-level module to be checked out from the SCM repository
43      * @param destDir The destination directory for the locally checked out module contents, usually you set this to a directory with the name equal to the moduleName
44      * @param version The module version you want to checkout.
45      * @param reallyQuiet Whether console output should be suppressed
46      */

47     public void doCheckout(String JavaDoc moduleName, File JavaDoc destDir, ScmVersion version, boolean reallyQuiet);
48
49     public void doExport(String JavaDoc moduleName, File JavaDoc destDir, ScmVersion version, boolean reallyQuiet);
50
51     /**
52      * Returns true if the given directory contains a checkout
53      * of content from this ScmSystem.
54      * @param directory The directory which does or does not contain a checkout
55      * @return Whether the given directory contains a checkout
56      */

57     public boolean isCheckoutDir(File JavaDoc directory);
58
59     /**
60      * Merge in changes made between current version of local module directory
61      * and given version.
62      * @param moduleDir The module directory which should receive the changes compared to the given version
63      * @param version The version containing the changes to be merged into the locally checked module directory
64      */

65     public void doMerge(File JavaDoc moduleDir, ScmVersion version);
66     
67     /**
68      * Update existing checkout locally to the given revision, or keep the same revision if null.
69      * @param file The directory or file to be updated
70      * @param version If null, revision of checkout is not changed
71      */

72     public void doUpdate(File JavaDoc file, ScmVersion version);
73     
74     /**
75      * Convenience method for doing a checkout only if needed, and otherwise
76      * updating the existing checkout.
77      * @param packageName
78      * @param revision
79      * @param destDir
80      * @param reallyQuiet
81      */

82     public void doCheckoutOrUpdate(String JavaDoc moduleName, File JavaDoc destDir, ScmVersion version, boolean reallyQuiet);
83
84     /**
85      * Commit the given file or a whole directory to CVS.
86      * @param file
87      */

88     public void doCommit(File JavaDoc file, String JavaDoc message);
89     
90     /**
91      * Get the current revision number of the given file in SCM.
92      */

93     public String JavaDoc getRevisionNumber(File JavaDoc file);
94
95     /**
96      * Get the latest version of a locally checked out module directory.
97      * Note that if the local version is a tag, this does not work.
98      * @return null If no latest version is found
99      */

100     public ScmVersion getLatestVersion(File JavaDoc moduleDir);
101     
102     public ScmVersion getLocalVersion(File JavaDoc moduleDir);
103
104     public ScmVersion[] getVersionsInBranch(File JavaDoc file, ScmVersion branch);
105
106     public String JavaDoc createBranchInTrunk(ScmVersion newBranchForModule);
107
108     public String JavaDoc createTagInBranch(ScmVersion existingBranch, ScmVersion newTag);
109
110     /**
111      * Check whether the given checkout directory is up-to-date
112      * when comparing it to the repository contents.
113      * @param checkoutDir The directory with locally checked out contents
114      * @return Whether the checkoutDir is up-to-date
115      */

116     public boolean isUpToDate(File JavaDoc checkoutDir);
117
118     /**
119      * Get the changes between two versions of the same module.
120      * @param version1 The 'old' version to use as base
121      * @param version2 The 'new' version, which should be compared against the 'old' version
122      * @return The changes between the given versions.
123      */

124     public ScmDifference[] getDifferences(ScmVersion version1, ScmVersion version2);
125 }
126
Popular Tags