KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > net > sourceforge > cvsgrab > CVSGrabAdminHandler


1 /*
2  * CVSGrab
3  * Author: Ludovic Claude (ludovicc@users.sourceforge.net)
4  * Distributable under BSD license.
5  */

6
7 package net.sourceforge.cvsgrab;
8
9 import java.io.BufferedOutputStream JavaDoc;
10 import java.io.File JavaDoc;
11 import java.io.FileOutputStream JavaDoc;
12 import java.io.IOException JavaDoc;
13 import java.io.OutputStream JavaDoc;
14 import java.util.Properties JavaDoc;
15
16 import org.netbeans.lib.cvsclient.admin.Entry;
17 import org.netbeans.lib.cvsclient.admin.StandardAdminHandler;
18 import org.netbeans.lib.cvsclient.command.GlobalOptions;
19
20 /**
21  * Handles the CVS admin files.
22  *
23  * @author <a HREF="mailto:ludovicc@users.sourceforge.net">Ludovic Claude</a>
24  * @version $Revision: 1.2 $ $Date: 2004/10/06 09:47:22 $
25  * @created on 9 mars 2004
26  */

27 public class CVSGrabAdminHandler extends StandardAdminHandler {
28     
29     private CVSGrab _cvsGrab;
30
31     /**
32      * Constructor for CVSGrabAdminHandler
33      */

34     public CVSGrabAdminHandler(CVSGrab cvsGrab) {
35         super();
36         _cvsGrab = cvsGrab;
37     }
38     
39     /**
40      * {@inheritDoc}
41      * @param localDirectory
42      * @param repositoryPath
43      * @param entry
44      * @param globalOptions
45      * @throws java.io.IOException
46      */

47     public void updateAdminData(String JavaDoc localDirectory, String JavaDoc repositoryPath, Entry entry,
48             GlobalOptions globalOptions) throws IOException JavaDoc {
49         super.updateAdminData(localDirectory, repositoryPath, entry, globalOptions);
50         
51         final File JavaDoc CVSdir = new File JavaDoc(localDirectory, "CVS"); //NOI18N
52

53         // now ensure that the WebRepository files exist
54
File JavaDoc repositoryFile = new File JavaDoc(CVSdir, "WebRepository"); //NOI18N
55
if (!repositoryFile.exists()) {
56             final Properties JavaDoc properties = new Properties JavaDoc();
57             final OutputStream JavaDoc w = new BufferedOutputStream JavaDoc(new FileOutputStream JavaDoc(repositoryFile));
58             _cvsGrab.getWebOptions().writeProperties(properties);
59             properties.put(CVSGrab.PACKAGE_PATH_OPTION, repositoryPath + "/");
60             properties.store(w, "CVSGrab settings");
61             w.close();
62         }
63
64     }
65
66 }
67
Popular Tags