KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > versioning > system > cvss > ui > selectors > VirtualAdminHandler


1 /*
2  * The contents of this file are subject to the terms of the Common Development
3  * and Distribution License (the License). You may not use this file except in
4  * compliance with the License.
5  *
6  * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
7  * or http://www.netbeans.org/cddl.txt.
8  *
9  * When distributing Covered Code, include this CDDL Header Notice in each file
10  * and include the License file at http://www.netbeans.org/cddl.txt.
11  * If applicable, add the following below the CDDL Header, with the fields
12  * enclosed by brackets [] replaced by your own identifying information:
13  * "Portions Copyrighted [year] [name of copyright owner]"
14  *
15  * The Original Software is NetBeans. The Initial Developer of the Original
16  * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

19
20 package org.netbeans.modules.versioning.system.cvss.ui.selectors;
21
22 import org.netbeans.lib.cvsclient.admin.AdminHandler;
23 import org.netbeans.lib.cvsclient.admin.Entry;
24 import org.netbeans.lib.cvsclient.command.GlobalOptions;
25 import org.netbeans.lib.cvsclient.CVSRoot;
26
27 import java.io.IOException JavaDoc;
28 import java.io.File JavaDoc;
29 import java.util.Iterator JavaDoc;
30 import java.util.Set JavaDoc;
31 import java.util.Collections JavaDoc;
32
33 /**
34  * This admin handler represents virtual reality, it
35  * does not touch any disk file. Instead it pretends
36  * that it represents empty local folder corresponding
37  * to given repository path.
38  *
39  * <p>It supports only non-recursive commands.
40  *
41  * @author Petr Kuzel
42  */

43 final class VirtualAdminHandler implements AdminHandler {
44
45     private final CVSRoot root;
46
47     private final String JavaDoc repositoryPath;
48
49     /**
50      * Creates AdminHandler for a non-existing local folder that represents
51      * root.getRepository() + "/" + repositoryPath repository folder.
52      *
53      * @param root repository
54      * @param repositoryPath local path representation in repository (always <tt>/</tt> separated)
55      */

56     public VirtualAdminHandler(CVSRoot root, String JavaDoc repositoryPath) {
57         this.root = root;
58         this.repositoryPath = repositoryPath;
59     }
60
61     public void updateAdminData(String JavaDoc localDirectory, String JavaDoc repositoryPath, Entry entry, GlobalOptions globalOptions) throws IOException JavaDoc {
62     }
63
64     public boolean exists(File JavaDoc file) {
65         return false;
66     }
67
68     public Entry getEntry(File JavaDoc file) throws IOException JavaDoc {
69         return null;
70     }
71
72     public Iterator JavaDoc getEntries(File JavaDoc directory) throws IOException JavaDoc {
73         return Collections.EMPTY_SET.iterator();
74     }
75
76     public void setEntry(File JavaDoc file, Entry entry) throws IOException JavaDoc {
77     }
78
79     public String JavaDoc getRepositoryForDirectory(String JavaDoc directory, String JavaDoc repository) throws IOException JavaDoc {
80         String JavaDoc repo = root.getRepository();
81         assert repo.equals(repository) : "Mismatch! Expected " + repo + " but got " + repository; // NOI18N
82
return repository + "/" + repositoryPath; // NOI18N
83
}
84
85     public void removeEntry(File JavaDoc file) throws IOException JavaDoc {
86     }
87
88     public Set JavaDoc getAllFiles(File JavaDoc directory) throws IOException JavaDoc {
89         return Collections.EMPTY_SET;
90     }
91
92     public String JavaDoc getStickyTagForDirectory(File JavaDoc directory) {
93         return null; // trunk
94
}
95 }
96
Popular Tags