This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

View | Details | Raw Unified | Return to bug 199806
Collapse All | Expand All

(-)a/dlight.nativeexecution/nbproject/project.xml (+1 lines)
Lines 270-275 Link Here
270
                <friend>org.netbeans.modules.dlight.uncover</friend>
270
                <friend>org.netbeans.modules.dlight.uncover</friend>
271
                <friend>org.netbeans.modules.dlight.util</friend>
271
                <friend>org.netbeans.modules.dlight.util</friend>
272
                <friend>org.netbeans.modules.dlight.webstack</friend>
272
                <friend>org.netbeans.modules.dlight.webstack</friend>
273
                <friend>org.netbeans.modules.remotefs.bridge</friend>
273
                <friend>org.netbeans.nativeexecution.terminal</friend>
274
                <friend>org.netbeans.nativeexecution.terminal</friend>
274
                <package>org.netbeans.modules.nativeexecution.api</package>
275
                <package>org.netbeans.modules.nativeexecution.api</package>
275
                <package>org.netbeans.modules.nativeexecution.api.execution</package>
276
                <package>org.netbeans.modules.nativeexecution.api.execution</package>
(-)a/dlight.remote.impl/nbproject/project.xml (+17 lines)
Lines 57-62 Link Here
57
                    </run-dependency>
57
                    </run-dependency>
58
                </dependency>
58
                </dependency>
59
                <dependency>
59
                <dependency>
60
                    <code-name-base>org.netbeans.modules.remotefs.bridge</code-name-base>
61
                    <build-prerequisite/>
62
                    <compile-dependency/>
63
                    <run-dependency>
64
                        <specification-version>1.0</specification-version>
65
                    </run-dependency>
66
                </dependency>
67
                <dependency>
68
                    <code-name-base>org.netbeans.modules.masterfs</code-name-base>
69
                    <build-prerequisite/>
70
                    <compile-dependency/>
71
                    <run-dependency>
72
                        <release-version>2</release-version>
73
                        <specification-version>2.32.1</specification-version>
74
                    </run-dependency>
75
                </dependency>
76
                <dependency>
60
                    <code-name-base>org.openide.awt</code-name-base>
77
                    <code-name-base>org.openide.awt</code-name-base>
61
                    <build-prerequisite/>
78
                    <build-prerequisite/>
62
                    <compile-dependency/>
79
                    <compile-dependency/>
(-)a/masterfs/nbproject/project.xml (+2 lines)
Lines 135-140 Link Here
135
                </test-type>
135
                </test-type>
136
            </test-dependencies>
136
            </test-dependencies>
137
            <friend-packages>
137
            <friend-packages>
138
                <friend>org.netbeans.modules.dlight.remote.impl</friend>
139
                <friend>org.netbeans.modules.remotefs.bridge</friend>
138
                <friend>org.netbeans.modules.javafx.source</friend>
140
                <friend>org.netbeans.modules.javafx.source</friend>
139
                <friend>org.netbeans.modules.parsing.api</friend>
141
                <friend>org.netbeans.modules.parsing.api</friend>
140
                <friend>org.netbeans.modules.parsing.lucene</friend>
142
                <friend>org.netbeans.modules.parsing.lucene</friend>
(-)a/nbbuild/cluster.properties (+1 lines)
Lines 340-345 Link Here
340
        properties,\
340
        properties,\
341
        properties.syntax,\
341
        properties.syntax,\
342
        refactoring.api,\
342
        refactoring.api,\
343
        remotefs.bridge,\
343
        schema2beans,\
344
        schema2beans,\
344
        server,\
345
        server,\
345
        servletapi,\
346
        servletapi,\
(-)a/remotefs.bridge/build.xml (+5 lines)
Line 0 Link Here
1
<?xml version="1.0" encoding="UTF-8"?>
2
<project basedir="." default="netbeans" name="remotefs.bridge">
3
    <description>Builds, tests, and runs the project org.netbeans.modules.remotefs.bridge</description>
4
    <import file="../nbbuild/templates/projectized.xml"/>
5
</project>
(-)a/remotefs.bridge/manifest.mf (+5 lines)
Line 0 Link Here
1
Manifest-Version: 1.0
2
OpenIDE-Module: org.netbeans.modules.remotefs.bridge
3
OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/remotefs/bridge/Bundle.properties
4
OpenIDE-Module-Specification-Version: 1.0
5
(-)a/remotefs.bridge/nbproject/project.properties (+2 lines)
Line 0 Link Here
1
javac.source=1.6
2
javac.compilerargs=-Xlint -Xlint:-serial
(-)a/remotefs.bridge/nbproject/project.xml (+41 lines)
Line 0 Link Here
1
<?xml version="1.0" encoding="UTF-8"?>
2
<project xmlns="http://www.netbeans.org/ns/project/1">
3
    <type>org.netbeans.modules.apisupport.project</type>
4
    <configuration>
5
        <data xmlns="http://www.netbeans.org/ns/nb-module-project/3">
6
            <code-name-base>org.netbeans.modules.remotefs.bridge</code-name-base>
7
            <module-dependencies>
8
                <dependency>
9
                    <code-name-base>org.netbeans.modules.dlight.nativeexecution</code-name-base>
10
                    <build-prerequisite/>
11
                    <compile-dependency/>
12
                    <run-dependency>
13
                        <specification-version>1.10.3</specification-version>
14
                    </run-dependency>
15
                </dependency>
16
                <dependency>
17
                    <code-name-base>org.netbeans.modules.masterfs</code-name-base>
18
                    <build-prerequisite/>
19
                    <compile-dependency/>
20
                    <run-dependency>
21
                        <release-version>2</release-version>
22
                        <specification-version>2.32.1</specification-version>
23
                    </run-dependency>
24
                </dependency>
25
                <dependency>
26
                    <code-name-base>org.openide.filesystems</code-name-base>
27
                    <build-prerequisite/>
28
                    <compile-dependency/>
29
                    <run-dependency>
30
                        <specification-version>7.47.1</specification-version>
31
                    </run-dependency>
32
                </dependency>
33
            </module-dependencies>
34
            <friend-packages>
35
                <friend>org.netbeans.modules.dlight.remote.impl</friend>
36
                <friend>org.netbeans.modules.versioning</friend>
37
                <package>org.netbeans.modules.remotefs.bridge.spi</package>
38
            </friend-packages>
39
        </data>
40
    </configuration>
41
</project>
(-)a/remotefs.bridge/src/org/netbeans/modules/remotefs/bridge/Bundle.properties (+12 lines)
Line 0 Link Here
1
OpenIDE-Module-Display-Category=Infrastructure
2
OpenIDE-Module-Long-Description=\
3
    The module extends master file system providers SPI.\n\
4
    Master file system providers SPI has java.io.file in the interface ProvidedExtensions.\n\
5
    It prevents using VCS for remote file system.\n\
6
    The module provides:\n1. \
7
    Interface ProvidedExtensions2. \
8
    It extends interface ProvidedExtensions and replaces java.io.File by java.net.URL.\n2. \
9
    Bridge that can get execution environment by URL.\n3. \
10
    FileProxy helper class that provides restricted set of java.io.File methods needed by VCS.
11
OpenIDE-Module-Name=Remote File System Bridge
12
OpenIDE-Module-Short-Description=Remote File System Bridge
(-)a/remotefs.bridge/src/org/netbeans/modules/remotefs/bridge/spi/Bridge.java (+159 lines)
Line 0 Link Here
1
/*
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
 *
4
 * Copyright 2011 Oracle and/or its affiliates. All rights reserved.
5
 *
6
 * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
7
 * Other names may be trademarks of their respective owners.
8
 *
9
 * The contents of this file are subject to the terms of either the GNU
10
 * General Public License Version 2 only ("GPL") or the Common
11
 * Development and Distribution License("CDDL") (collectively, the
12
 * "License"). You may not use this file except in compliance with the
13
 * License. You can obtain a copy of the License at
14
 * http://www.netbeans.org/cddl-gplv2.html
15
 * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
16
 * specific language governing permissions and limitations under the
17
 * License.  When distributing the software, include this License Header
18
 * Notice in each file and include the License file at
19
 * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
20
 * particular file as subject to the "Classpath" exception as provided
21
 * by Oracle in the GPL Version 2 section of the License file that
22
 * accompanied this code. If applicable, add the following below the
23
 * License Header, with the fields enclosed by brackets [] replaced by
24
 * your own identifying information:
25
 * "Portions Copyrighted [year] [name of copyright owner]"
26
 *
27
 * If you wish your version of this file to be governed by only the CDDL
28
 * or only the GPL Version 2, indicate your decision by adding
29
 * "[Contributor] elects to include this software in this distribution
30
 * under the [CDDL or GPL Version 2] license." If you do not indicate a
31
 * single choice of license, a recipient has the option to distribute
32
 * your version of this file under either the CDDL, the GPL Version 2 or
33
 * to extend the choice of license to its licensees as provided above.
34
 * However, if you add GPL Version 2 code and therefore, elected the GPL
35
 * Version 2 license, then the option applies only if the new code is
36
 * made subject to such option by the copyright holder.
37
 *
38
 * Contributor(s):
39
 *
40
 * Portions Copyrighted 2011 Sun Microsystems, Inc.
41
 */
42
package org.netbeans.modules.remotefs.bridge.spi;
43
44
import java.io.File;
45
import java.io.IOException;
46
import java.lang.reflect.InvocationTargetException;
47
import java.lang.reflect.Method;
48
import java.net.MalformedURLException;
49
import java.net.URL;
50
import java.util.logging.Level;
51
import java.util.logging.Logger;
52
import org.netbeans.modules.nativeexecution.api.ExecutionEnvironment;
53
import org.netbeans.modules.nativeexecution.api.ExecutionEnvironmentFactory;
54
import org.openide.filesystems.FileObject;
55
import org.openide.filesystems.FileSystem;
56
import org.openide.filesystems.FileUtil;
57
import org.openide.filesystems.URLMapper;
58
59
/**
60
 *
61
 * @author Alexander Simon
62
 */
63
public final class Bridge {
64
   static FileSystem rootFileSystem;
65
66
    static {
67
        File tmpFile = null;
68
        try {
69
            tmpFile = File.createTempFile("NetBeans", ".tmp"); //NOI18N
70
            tmpFile = FileUtil.normalizeFile(tmpFile);
71
            FileObject fo = FileUtil.toFileObject(tmpFile);
72
            rootFileSystem = fo.getFileSystem();
73
        } catch (IOException ex) {
74
            Logger.getLogger(Bridge.class.getName()).log(Level.SEVERE, null, ex);
75
        } finally {
76
            if (tmpFile != null) {
77
                tmpFile.delete();
78
            }
79
        }
80
    }
81
82
    private Bridge() {
83
    }
84
85
    public static FileProxy toFileProxy(URL path) {
86
        return new FileProxy(path);
87
    }
88
89
    public static ExecutionEnvironment getExecutionEnvironment(URL path) {
90
        if (isRemote(path)) {
91
            //TODO: provide SPI to get remote file system
92
            FileSystem fs = getRemoteFileSystem(path);
93
            Class<? extends FileSystem> aClass = fs.getClass();
94
            try {
95
                Method method = aClass.getMethod("getExecutionEnvironment"); //NOI18N
96
                return (ExecutionEnvironment) method.invoke(fs);
97
            } catch (IllegalArgumentException ex) {
98
                Logger.getLogger(Bridge.class.getName()).log(Level.SEVERE, null, ex);
99
            } catch (InvocationTargetException ex) {
100
                Logger.getLogger(Bridge.class.getName()).log(Level.SEVERE, null, ex);
101
            } catch (NoSuchMethodException ex) {
102
                Logger.getLogger(Bridge.class.getName()).log(Level.SEVERE, null, ex);
103
            } catch (SecurityException ex) {
104
                Logger.getLogger(Bridge.class.getName()).log(Level.SEVERE, null, ex);
105
            } catch (IllegalAccessException ex) {
106
                Logger.getLogger(Bridge.class.getName()).log(Level.SEVERE, null, ex);
107
            }
108
        }
109
        return ExecutionEnvironmentFactory.getLocal();
110
    }
111
112
    static URL toLocalFileURL(File file) {
113
        try {
114
            return file.toURI().toURL();
115
        } catch (MalformedURLException ex) {
116
            Logger.getLogger(Bridge.class.getName()).log(Level.SEVERE, null, ex);
117
            return null;
118
        }
119
    }
120
121
    //static URL toURL(FileObject file) {
122
    //    return URLMapper.findURL(file, URLMapper.EXTERNAL);
123
    //}
124
125
    static URL toURL(FileSystem fs, String path) {
126
        if (isRemote(fs)) {
127
            //TODO: provide SPI to create remote URL
128
        } else {
129
            try {
130
                return new File(path).toURI().toURL();
131
            } catch (MalformedURLException ex) {
132
                Logger.getLogger(Bridge.class.getName()).log(Level.SEVERE, null, ex);
133
            }
134
        }
135
        return null;
136
    }
137
138
    static FileObject toFileObject(URL path) {
139
        return URLMapper.findFileObject(path);
140
    }
141
    
142
    private static boolean isRemote(FileSystem fs) {
143
        //TODO: provide SPI
144
        Class<? extends FileSystem> aClass = fs.getClass();
145
        if ("org.netbeans.modules.remote.impl.fs.RemoteFileSystem".equals(aClass.getName())) { //NOI18N
146
            return true;
147
        }
148
        return false;
149
    }
150
151
    static boolean isRemote(URL path) {
152
        return "rfs".equals(path.getProtocol());
153
    }
154
155
    static FileSystem getRemoteFileSystem(URL path) {
156
        //TODO: provide SPI
157
        return null;
158
    }
159
}
(-)a/remotefs.bridge/src/org/netbeans/modules/remotefs/bridge/spi/FileProxy.java (+181 lines)
Line 0 Link Here
1
/*
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
 *
4
 * Copyright 2011 Oracle and/or its affiliates. All rights reserved.
5
 *
6
 * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
7
 * Other names may be trademarks of their respective owners.
8
 *
9
 * The contents of this file are subject to the terms of either the GNU
10
 * General Public License Version 2 only ("GPL") or the Common
11
 * Development and Distribution License("CDDL") (collectively, the
12
 * "License"). You may not use this file except in compliance with the
13
 * License. You can obtain a copy of the License at
14
 * http://www.netbeans.org/cddl-gplv2.html
15
 * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
16
 * specific language governing permissions and limitations under the
17
 * License.  When distributing the software, include this License Header
18
 * Notice in each file and include the License file at
19
 * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
20
 * particular file as subject to the "Classpath" exception as provided
21
 * by Oracle in the GPL Version 2 section of the License file that
22
 * accompanied this code. If applicable, add the following below the
23
 * License Header, with the fields enclosed by brackets [] replaced by
24
 * your own identifying information:
25
 * "Portions Copyrighted [year] [name of copyright owner]"
26
 *
27
 * If you wish your version of this file to be governed by only the CDDL
28
 * or only the GPL Version 2, indicate your decision by adding
29
 * "[Contributor] elects to include this software in this distribution
30
 * under the [CDDL or GPL Version 2] license." If you do not indicate a
31
 * single choice of license, a recipient has the option to distribute
32
 * your version of this file under either the CDDL, the GPL Version 2 or
33
 * to extend the choice of license to its licensees as provided above.
34
 * However, if you add GPL Version 2 code and therefore, elected the GPL
35
 * Version 2 license, then the option applies only if the new code is
36
 * made subject to such option by the copyright holder.
37
 *
38
 * Contributor(s):
39
 *
40
 * Portions Copyrighted 2011 Sun Microsystems, Inc.
41
 */
42
package org.netbeans.modules.remotefs.bridge.spi;
43
44
import java.io.File;
45
import java.net.URL;
46
import org.openide.filesystems.FileObject;
47
import org.openide.filesystems.FileSystem;
48
49
/**
50
 * Represents file on remote or local file system.
51
 *
52
 * @author Alexander Simon
53
 */
54
public final class FileProxy {
55
56
    private final URL url;
57
    private final FileSystem fs;
58
    private final boolean isLocal;
59
60
    FileProxy(URL path) {
61
        this.url = path;
62
        if (Bridge.isRemote(path)) {
63
            this.fs = Bridge.getRemoteFileSystem(path);
64
            this.isLocal = false;
65
        } else {
66
            this.isLocal = true;
67
            this.fs = Bridge.rootFileSystem;
68
        }
69
    }
70
71
    /**
72
     *
73
     * @return Absolute path to file in file system.
74
     */
75
    public String getAbsolutePath() {
76
        return url.getPath();
77
    }
78
79
    public String getName() {
80
        if (isLocal) {
81
            return new File(url.getPath()).getName();
82
        }
83
        int index = url.getPath().lastIndexOf('/');
84
        if (index >= 0) {
85
            return url.getPath().substring(index + 1);
86
        } else {
87
            return ""; //NOI18N
88
        }
89
    }
90
91
    public boolean isDirectory() {
92
        if (isLocal) {
93
            return new File(url.getPath()).isDirectory();
94
        }
95
        FileObject fo = Bridge.toFileObject(url);
96
        return fo == null ? false : fo.isFolder();
97
    }
98
99
    public boolean isFile() {
100
        if (isLocal) {
101
            return new File(url.getPath()).isFile();
102
        } else {
103
            FileObject fo = Bridge.toFileObject(url);
104
            return fo == null ? false : fo.isData();
105
        }
106
    }
107
108
    public boolean canWrite() {
109
        if (isLocal) {
110
            return new File(url.getPath()).canWrite();
111
        } else {
112
            FileObject fo = Bridge.toFileObject(url);
113
            return fo == null ? false : fo.canWrite();
114
        }
115
    }
116
117
    public FileProxy getParentFile() {
118
        if (isLocal) {
119
            File parent = new File(url.getPath()).getParentFile();
120
            if (parent != null) {
121
                return new FileProxy(Bridge.toLocalFileURL(parent));
122
            }
123
        } else {
124
            int index = url.getPath().lastIndexOf('/');
125
            if (index >= 0) {
126
                String parent = url.getPath().substring(0, index);
127
                Bridge.toURL(fs, parent);
128
                return new FileProxy(Bridge.toURL(fs, parent));
129
            }
130
        }
131
        return null;
132
    }
133
    
134
    public boolean exists() {
135
        if (isLocal) {
136
            return new File(url.getPath()).exists();
137
        } else {
138
            FileObject fo = Bridge.toFileObject(url);
139
            return fo == null ? false : fo.isValid();
140
        }
141
    }
142
143
    public FileProxy newFileProxy(String name) {
144
        if (isLocal) {
145
            return new FileProxy(Bridge.toLocalFileURL(new File(url.getPath(),name)));
146
        } else {
147
            return new FileProxy(Bridge.toURL(fs, url.getPath()+'/'+name));
148
        }
149
    }
150
    
151
    @Override
152
    public String toString() {
153
        return fs + " " + url.getPath(); //NOI18N
154
    }
155
156
    @Override
157
    public int hashCode() {
158
        int hash = 3;
159
        hash = 59 * hash + (this.url.getPath() != null ? this.url.getPath().hashCode() : 0);
160
        hash = 59 * hash + (this.fs != null ? this.fs.hashCode() : 0);
161
        return hash;
162
    }
163
164
    @Override
165
    public boolean equals(Object obj) {
166
        if (obj == null) {
167
            return false;
168
        }
169
        if (getClass() != obj.getClass()) {
170
            return false;
171
        }
172
        final FileProxy other = (FileProxy) obj;
173
        if (this.fs != other.fs && (this.fs == null || !this.fs.equals(other.fs))) {
174
            return false;
175
        }
176
        if ((this.url == null) ? (other.url.getPath() != null) : !this.url.getPath().equals(other.url.getPath())) {
177
            return false;
178
        }
179
        return true;
180
    }
181
}
(-)a/remotefs.bridge/src/org/netbeans/modules/remotefs/bridge/spi/ProvidedExtensions2.java (+208 lines)
Line 0 Link Here
1
/*
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
 *
4
 * Copyright 2011 Oracle and/or its affiliates. All rights reserved.
5
 *
6
 * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
7
 * Other names may be trademarks of their respective owners.
8
 *
9
 * The contents of this file are subject to the terms of either the GNU
10
 * General Public License Version 2 only ("GPL") or the Common
11
 * Development and Distribution License("CDDL") (collectively, the
12
 * "License"). You may not use this file except in compliance with the
13
 * License. You can obtain a copy of the License at
14
 * http://www.netbeans.org/cddl-gplv2.html
15
 * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
16
 * specific language governing permissions and limitations under the
17
 * License.  When distributing the software, include this License Header
18
 * Notice in each file and include the License file at
19
 * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
20
 * particular file as subject to the "Classpath" exception as provided
21
 * by Oracle in the GPL Version 2 section of the License file that
22
 * accompanied this code. If applicable, add the following below the
23
 * License Header, with the fields enclosed by brackets [] replaced by
24
 * your own identifying information:
25
 * "Portions Copyrighted [year] [name of copyright owner]"
26
 *
27
 * If you wish your version of this file to be governed by only the CDDL
28
 * or only the GPL Version 2, indicate your decision by adding
29
 * "[Contributor] elects to include this software in this distribution
30
 * under the [CDDL or GPL Version 2] license." If you do not indicate a
31
 * single choice of license, a recipient has the option to distribute
32
 * your version of this file under either the CDDL, the GPL Version 2 or
33
 * to extend the choice of license to its licensees as provided above.
34
 * However, if you add GPL Version 2 code and therefore, elected the GPL
35
 * Version 2 license, then the option applies only if the new code is
36
 * made subject to such option by the copyright holder.
37
 *
38
 * Contributor(s):
39
 *
40
 * Portions Copyrighted 2011 Sun Microsystems, Inc.
41
 */
42
package org.netbeans.modules.remotefs.bridge.spi;
43
44
import java.net.URL;
45
import java.util.List;
46
import org.netbeans.modules.masterfs.providers.ProvidedExtensions;
47
import org.openide.filesystems.FileObject;
48
49
/**
50
 * Extension of {@link ProvidedExtensions} to process remote file operations.
51
 * 
52
 * The interface is intended to be implemented in remote file system and VCS
53
 * when modules extend class ProvidedExtensions.
54
 * 
55
 * @author Alexander Simon
56
 */
57
public interface ProvidedExtensions2 {
58
    /**
59
     * Return instance of {@link ProvidedExtensions.IOHandler}
60
     * that is responsible for copying the file or null.
61
     *
62
     * Just the first non null instance of <code>IOHandler</code> is used by
63
     *  <code>RemoteFileSystem</code>
64
     *
65
     * @param from file to be copied
66
     * @param to target to copy this file to
67
     * @return instance of {@link ProvidedExtensions.IOHandler}
68
     * that is responsible for copying the file or null
69
     */
70
    ProvidedExtensions.IOHandler getCopyHandler(URL from, URL to);
71
72
    /**
73
     * Return instance of {@link ProvidedExtensions.IOHandler}
74
     * that is responsible for moving the file or null.
75
     *
76
     * Just the first non null instance of <code>IOHandler</code> is used by
77
     *  <code>RemoteFileSystem</code>
78
     *
79
     * @param from file to be moved
80
     * @param to target to move this file to
81
     * @return instance of {@link ProvidedExtensions.IOHandler} 
82
     * that is responsible for moving the file or null
83
     */
84
    ProvidedExtensions.IOHandler getMoveHandler(URL from, URL to);
85
    
86
    /*
87
     * Return instance of {@link ProvidedExtensions.IOHandler}
88
     * that is responsible for renaming the file or null.
89
     *
90
     * Just the first non null instance of <code>IOHandler</code> is used by
91
     *  <code>RemoteFileSystem</code>
92
     *
93
     * @param from file to be renamed
94
     * @param newName new name of file
95
     * @return instance of {@link ProvidedExtensions.IOHandler} 
96
     * that is responsible for renaming the file or null
97
     */
98
    ProvidedExtensions.IOHandler getRenameHandler(URL from, String newName);
99
100
    /*
101
     * Return instance of {@link ProvidedExtensions.DeleteHandler}
102
     * that is responsible for deleting the file or null.
103
     *
104
     * Just the first non null instance of <code>DeleteHandler</code> is used by
105
     *  <code>RemoteFileSystem</code>
106
     *
107
     * @param f file or folder to be deleted
108
     * @return instance of {@link ProvidedExtensions2.DeleteHandler2} 
109
     * that is responsible for deleting the file or null
110
     */    
111
    ProvidedExtensions2.DeleteHandler2 getDeleteHandler(URL f);
112
    
113
    public interface DeleteHandler2 {
114
        /**
115
         * Deletes the file or directory denoted by this abstract pathname.  If
116
         * this pathname denotes a directory, then the directory must be empty in
117
         * order to be deleted.
118
         *
119
         * @return  <code>true</code> if and only if the file or directory is
120
         *          successfully deleted; <code>false</code> otherwise
121
         */
122
        boolean delete(URL file);
123
    }
124
    
125
    /**
126
     * Called by <code>RemoteFileSystem</code> before <code>FileObject</code>
127
     * is copied
128
     * @param from FileObject to be moved
129
     * @param to URL target to move this file to
130
     */
131
    void beforeCopy(FileObject from, URL to);
132
133
    /**
134
     * Called by <code>RemoteFileSystem</code> after <code>FileObject</code>
135
     * was successfully copied
136
     * @param from FileObject to be moved
137
     * @param to URL target to move this file to
138
     */
139
    void copySuccess(FileObject from, URL to);
140
141
    /**
142
     * Called by <code>RemoteFileSystem</code> after a <code>FileObject</code>
143
     * copy failed
144
     * @param from FileObject to be moved
145
     * @param to URL target to move this file to
146
     */
147
    void copyFailure(FileObject from, URL to);
148
149
    /**
150
     * Called by <code>RemoteFileSystem</code> before <code>FileObject</code>
151
     * is moved
152
     * @param from FileObject to be moved
153
     * @param to URL target to move this file to
154
     */
155
    void beforeMove(FileObject from, URL to);
156
157
    /**
158
     * Called by <code>RemoteFileSystem</code> after <code>FileObject</code>
159
     * was successfully
160
     * @param from FileObject to be moved
161
     * @param to URL target to move this file to
162
     */
163
    void moveSuccess(FileObject from, URL to);
164
165
    /**
166
     * Called by <code>RemoteFileSystem</code> after a <code>FileObject</code>
167
     * move failed
168
     * @param from FileObject to be moved
169
     * @param to URL target to move this file to
170
     */
171
    void moveFailure(FileObject from, URL to);
172
173
    /**
174
     * Called by <code>RemoteFileSystem</code> when <code>FileObject</code> is queried for writability with the
175
     * canWrite() method.
176
     * 
177
     * @param f a URL to query
178
     * @return true if the file can be written to, deleted or moved, false otherwise
179
     */
180
    boolean canWrite(URL f);
181
182
    /**
183
     * Called by {@code RemoteFileSystem} when {@code FileObject} is
184
     * queried for attribute and attribute's name starts with {@code ProvidedExtensions}
185
     * prefix.
186
     * @param attrName name of attribute
187
     * @return value of attribute
188
     */
189
    Object getAttribute(URL file, String attrName);
190
191
    /** Allows versioning system to exclude some children from recursive
192
     * listening check. Also notifies the versioning whenever a refresh
193
     * is required and allows the versiniong to provide special timestamp
194
     * for a directory.
195
     * <p>
196
     * Default implementation of this method returns -1.
197
     *
198
     * @param dir the directory to check timestamp for
199
     * @param lastTimeStamp the previously known timestamp or -1
200
     * @param children add subfiles that shall be interated into this array
201
     * @return the timestamp that shall represent this directory, it will
202
     *   be compared with timestamps of all children and the newest
203
     *   one will be kept and next time passed as lastTimeStamp. Return
204
     *   0 if the directory does not have any special timestamp. Return
205
     *   -1 if you are not providing any special implementation
206
     */
207
    long refreshRecursively(URL dir, long lastTimeStamp, List<URL> children);
208
}
(-)a/versioning/nbproject/project.xml (+8 lines)
Lines 85-90 Link Here
85
                    </run-dependency>
85
                    </run-dependency>
86
                </dependency>
86
                </dependency>
87
                <dependency>
87
                <dependency>
88
                    <code-name-base>org.netbeans.modules.remotefs.bridge</code-name-base>
89
                    <build-prerequisite/>
90
                    <compile-dependency/>
91
                    <run-dependency>
92
                        <specification-version>1.0</specification-version>
93
                    </run-dependency>
94
                </dependency>
95
                <dependency>
88
                    <code-name-base>org.netbeans.modules.masterfs</code-name-base>
96
                    <code-name-base>org.netbeans.modules.masterfs</code-name-base>
89
                    <build-prerequisite/>
97
                    <build-prerequisite/>
90
                    <compile-dependency/>
98
                    <compile-dependency/>

Return to bug 199806