KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > masterfs > InvalidDummy


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.masterfs;
21
22 import org.openide.filesystems.*;
23
24 import java.io.FileNotFoundException JavaDoc;
25 import java.io.IOException JavaDoc;
26 import java.io.InputStream JavaDoc;
27 import java.io.OutputStream JavaDoc;
28 import java.util.Date JavaDoc;
29 import java.util.Enumeration JavaDoc;
30
31 /**
32  * Implements FileObject methods as simple as possible.
33  * @author Radek Matous
34  */

35 class InvalidDummy extends BasedOnResourcePath {
36     /** generated Serialized Version UID */
37     static final long serialVersionUID = -1244651321997356809L;
38
39     protected InvalidDummy(ResourcePath resourcePath) {
40         super (resourcePath);
41     }
42     
43     public FileSystem getFileSystem() throws FileStateInvalidException {
44         throw new FileStateInvalidException(getPath());
45     }
46
47     public void rename(FileLock lock, String JavaDoc name, String JavaDoc ext) throws IOException JavaDoc {
48         throw new IOException JavaDoc(getPath());
49     }
50
51
52     public void delete(FileLock lock) throws IOException JavaDoc {
53         throw new IOException JavaDoc(getPath());
54     }
55
56     public InputStream JavaDoc getInputStream() throws FileNotFoundException JavaDoc {
57         throw new FileNotFoundException JavaDoc(getPath());
58     }
59
60     public OutputStream JavaDoc getOutputStream(FileLock lock) throws IOException JavaDoc {
61         throw new IOException JavaDoc(getPath());
62     }
63
64     public FileLock lock() throws IOException JavaDoc {
65         throw new IOException JavaDoc(getPath());
66     }
67
68     public FileObject createFolder(String JavaDoc name) throws IOException JavaDoc {
69         throw new IOException JavaDoc(getPath());
70     }
71
72     public FileObject createData(String JavaDoc name, String JavaDoc ext) throws IOException JavaDoc {
73         throw new IOException JavaDoc(getPath());
74     }
75
76
77     public Object JavaDoc getAttribute(String JavaDoc attrName) {
78         return null;
79     }
80
81     public void setAttribute(String JavaDoc attrName, Object JavaDoc value) throws IOException JavaDoc {
82         throw new IOException JavaDoc(getPath());
83     }
84
85     public Enumeration JavaDoc getAttributes() {
86         return org.openide.util.Enumerations.empty();
87     }
88
89     public void addFileChangeListener(FileChangeListener fcl) {
90     }
91
92     public void removeFileChangeListener(FileChangeListener fcl) {
93     }
94
95     public long getSize() {
96         return 0;
97     }
98
99     public void setImportant(boolean b) {
100     }
101
102     public FileObject[] getChildren() {
103         return new FileObject[]{};
104     }
105
106     public FileObject getFileObject(String JavaDoc name, String JavaDoc ext) {
107         return null;
108     }
109
110
111     public boolean isReadOnly() {
112         return true;
113     }
114
115     public FileObject getParent() {
116         return null;
117     }
118
119     public boolean isFolder() {
120         return false;
121     }
122
123     public Date JavaDoc lastModified() {
124         if (isRoot())
125             return new Date JavaDoc(0);
126         return new java.util.Date JavaDoc();
127     }
128
129     public boolean isData() {
130         return true;
131     }
132
133     public boolean isValid() {
134         return false;
135     }
136
137     public String JavaDoc getMIMEType() {
138         return "content/unknown"; // NOI18N
139
}
140
141 }
142
Popular Tags