View Javadoc

1   /*
2   Karma core - Core of the Karma application
3   Copyright (C) 2004  Toolforge <www.toolforge.nl>
4   
5   This library is free software; you can redistribute it and/or
6   modify it under the terms of the GNU Lesser General Public
7   License as published by the Free Software Foundation; either
8   version 2.1 of the License, or (at your option) any later version.
9   
10  This library is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  Lesser General Public License for more details.
14  
15  You should have received a copy of the GNU Lesser General Public
16  License along with this library; if not, write to the Free Software
17  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18  */
19  package nl.toolforge.karma.core.vc;
20  
21  import nl.toolforge.karma.core.Version;
22  import nl.toolforge.karma.core.cmd.CommandResponse;
23  import nl.toolforge.karma.core.module.Module;
24  import nl.toolforge.karma.core.vc.cvsimpl.CVSException;
25  
26  import java.io.File;
27  
28  /***
29   * Runner classes are adapters to native commands on a version control system.
30   *
31   * @author D.A. Smedes
32   * @version $Id: Runner.java,v 1.41 2004/11/10 23:53:09 asmedes Exp $
33   */
34  public interface Runner {
35  
36    public void setCommandResponse(CommandResponse response);
37  
38    /***
39     * Commits <code>file</code> in the version control system. If <code>file</code> is not yet under version control it
40     * will be added.
41     *
42     * @throws VersionControlException Exceptions related to version control operations.
43     */
44    public void commit(File file) throws VersionControlException;
45  
46  	/***
47  	 * Adds a set of files and/or a set of directories (recursively) to the version control system. Files and directories
48     * will be created when they don't exist.
49  	 *
50  	 * @param module The module to which the files apply.
51  	 * @param files The filenames that should be added to the version control system repository.
52  	 * @param dirs The directory-paths that should be added to the version control system repository.
53     *
54     * @throws VersionControlException Exceptions related to version control operations.
55  	 */
56    public void add(Module module, File[] files, File[] dirs) throws VersionControlException;
57  
58    /***
59     * See {@link #add(Module, File[], File[])}. This method converts the <code>String</code> items to <code>File</code>
60     * items.
61     *
62     * @param module The context module to which the files should be added.
63     * @param files Files to be added (each <code>String</code> will be added relative to the module base directory).
64     * @param dirs Directories to be added (each <code>String</code> will be added relative to the module base directory).
65     *
66     * @throws VersionControlException Exceptions related to version control operations.
67     */
68    public void add(Module module, String[] files, String[] dirs) throws VersionControlException;
69  
70    /***
71  	 * Checks out a module from a version control system.
72  	 *
73  	 * @param module The module that should be checked out of the version control repository.
74     *
75     * @throws VersionControlException Exceptions related to version control operations.
76  	 */
77  	public void checkout(Module module) throws VersionControlException;
78  
79  	/***
80  	 * Checks out a module from a version control system with the specified <code>version</code>. The module is checked
81     * out relative to {@link nl.toolforge.karma.core.manifest.Manifest#getModuleBaseDirectory()}.
82  	 *
83  	 * @param module The module that should be checked out from the version control system.
84  	 * @param version The version of the module that should be checked out.
85     *
86     * @throws VersionControlException Exceptions related to version control operations.
87  	 */
88  	public void checkout(Module module, Version version) throws VersionControlException;
89  
90  	/***
91  	 * Checks out a module from a version control system with the specified <code>version</code> and from a development
92     * line. The module is checked out relative to
93     * {@link nl.toolforge.karma.core.manifest.Manifest#getModuleBaseDirectory()}.
94  	 *
95  	 * @param module The module that should be checked out from the version control system.
96     * @param developmentLine The development line for the module.
97  	 * @param version The version of the module that should be checked out.
98     *
99     * @throws VersionControlException Exceptions related to version control operations.
100 	 */
101   public void checkout(Module module, DevelopmentLine developmentLine, Version version) throws VersionControlException;
102 
103 	/***
104 	 * Updates an already checked out module.
105 	 *
106 	 * @param module The module that should be updated.
107    *
108    * @throws VersionControlException Exceptions related to version control operations.
109 	 */
110 	public void update(Module module) throws VersionControlException;
111 
112 	/***
113 	 * Updates an already checked out module to a specified <code>version</code>.
114 	 *
115 	 * @param module The module that should be updated.
116 	 * @param version The version to which the the module should be updated,
117    *
118    * @throws VersionControlException Exceptions related to version control operations.
119 	 */
120 	public void update(Module module, Version version) throws VersionControlException;
121 
122   /***
123    *
124    * @param module
125    * @param comment  Comment of the developer
126    * @param version
127    * @throws VersionControlException
128    */
129 	public void promote(Module module, String comment, Version version) throws VersionControlException;
130 
131   /***
132    * Checks if a module exists in the repository. The module should contain the <code>module.info</code> file.
133    * @param module
134    * @return <code>true</code> if the module exists, <code>false</code> otherwise.
135    */
136   // todo some of the methods could be moved to a helper class that performs checks like existsInRepository. Much clearer and nicer.
137   public boolean existsInRepository(Module module);
138 
139   /***
140    * Checks if the module has a <code>PatchLine</code> in the version control system.
141    * @param module
142    * @return
143    */
144   public boolean hasPatchLine(Module module);
145 
146   /***
147    * Creates a <code>PatchLine<code> for the module.
148    */
149   public void createPatchLine(Module module) throws VersionControlException ;
150 
151   public void addModule(Module module, String comment) throws VersionControlException;
152 
153   void update(Module module, DevelopmentLine developmentLine, Version version) throws CVSException;
154 }