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 207659
Collapse All | Expand All

(-)a/dlight.remote.impl/nbproject/project.xml (-1 / +1 lines)
Lines 85-91 Link Here
85
                    <build-prerequisite/>
85
                    <build-prerequisite/>
86
                    <compile-dependency/>
86
                    <compile-dependency/>
87
                    <run-dependency>
87
                    <run-dependency>
88
                        <specification-version>7.56</specification-version>
88
                        <specification-version>7.59</specification-version>
89
                    </run-dependency>
89
                    </run-dependency>
90
                </dependency>
90
                </dependency>
91
                <dependency>
91
                <dependency>
(-)a/dlight.remote.impl/src/org/netbeans/modules/remote/impl/fs/RemoteFileSystem.java (+42 lines)
Lines 64-71 Link Here
64
import javax.swing.SwingUtilities;
64
import javax.swing.SwingUtilities;
65
import org.netbeans.modules.dlight.libs.common.PathUtilities;
65
import org.netbeans.modules.dlight.libs.common.PathUtilities;
66
import org.netbeans.modules.nativeexecution.api.ExecutionEnvironment;
66
import org.netbeans.modules.nativeexecution.api.ExecutionEnvironment;
67
import org.netbeans.modules.nativeexecution.api.util.CommonTasksSupport;
67
import org.netbeans.modules.nativeexecution.api.util.ConnectionListener;
68
import org.netbeans.modules.nativeexecution.api.util.ConnectionListener;
68
import org.netbeans.modules.nativeexecution.api.util.ConnectionManager;
69
import org.netbeans.modules.nativeexecution.api.util.ConnectionManager;
70
import org.netbeans.modules.nativeexecution.api.util.ConnectionManager.CancellationException;
71
import org.netbeans.modules.nativeexecution.api.util.HostInfoUtils;
69
import org.netbeans.modules.remote.api.ui.ConnectionNotifier;
72
import org.netbeans.modules.remote.api.ui.ConnectionNotifier;
70
import org.netbeans.modules.remote.spi.FileSystemCacheProvider;
73
import org.netbeans.modules.remote.spi.FileSystemCacheProvider;
71
import org.netbeans.modules.remote.impl.RemoteLogger;
74
import org.netbeans.modules.remote.impl.RemoteLogger;
Lines 261-266 Link Here
261
            return getRoot().getFileObject(name);
264
            return getRoot().getFileObject(name);
262
        }
265
        }
263
    }
266
    }
267
268
    @Override
269
    public FileObject getTempFolder() throws IOException {
270
        try {
271
            String tmpName = HostInfoUtils.getHostInfo(execEnv).getTempDir();
272
            RemoteFileObjectBase tmpDir = findResource(tmpName);
273
            if (tmpDir != null && tmpDir.isFolder() && tmpDir.isValid()) {
274
                return tmpDir;
275
            }
276
        } catch (CancellationException ex) {
277
            //
278
        }
279
        throw new IOException("Cannot find temporary folder"); // NOI18N
280
    }
281
    
282
    @Override
283
    public FileObject createTempFile(FileObject parent, String prefix, String suffix) throws IOException {
284
        if (parent.isFolder() && parent.isValid()) {
285
            while(true) {
286
                File tmpFile = File.createTempFile(prefix, suffix);
287
                String tmpName = tmpFile.getName();
288
                tmpFile.delete();
289
                try {
290
                    FileObject fo = parent.createData(tmpName);
291
                    if (fo != null && fo.isData() && fo.isValid()) {
292
                        return fo;
293
                    }
294
                    break;   
295
                } catch (IOException ex) {
296
                    FileObject test = parent.getFileObject(tmpName);
297
                    if (test != null) {
298
                        continue;
299
                    }
300
                    throw ex;
301
                }
302
            }
303
        }
304
        throw new IOException("Cannot create temporary file"); // NOI18N
305
    }
264
    
306
    
265
    /*package*/ RemoteFileObjectBase findResource(String name, Set<String> antiloop) {
307
    /*package*/ RemoteFileObjectBase findResource(String name, Set<String> antiloop) {
266
        if (name.isEmpty() || name.equals("/")) {  // NOI18N
308
        if (name.isEmpty() || name.equals("/")) {  // NOI18N
(-)a/masterfs/nbproject/project.xml (-1 / +1 lines)
Lines 63-69 Link Here
63
                    <build-prerequisite/>
63
                    <build-prerequisite/>
64
                    <compile-dependency/>
64
                    <compile-dependency/>
65
                    <run-dependency>
65
                    <run-dependency>
66
                        <specification-version>7.54</specification-version>
66
                        <specification-version>7.59</specification-version>
67
                    </run-dependency>
67
                    </run-dependency>
68
                </dependency>
68
                </dependency>
69
                <dependency>
69
                <dependency>
(-)a/masterfs/src/org/netbeans/modules/masterfs/filebasedfs/FileBasedFileSystem.java (+23 lines)
Lines 48-53 Link Here
48
import java.io.IOException;
48
import java.io.IOException;
49
import java.io.ObjectStreamException;
49
import java.io.ObjectStreamException;
50
import java.io.Serializable;
50
import java.io.Serializable;
51
import java.security.SecureRandom;
51
import java.util.Collection;
52
import java.util.Collection;
52
import java.util.Collections;
53
import java.util.Collections;
53
import java.util.HashSet;
54
import java.util.HashSet;
Lines 211-216 Link Here
211
        }
212
        }
212
        return getFileObject(f);
213
        return getFileObject(f);
213
    }
214
    }
215
    
216
    @Override
217
    public FileObject getTempFolder() throws IOException {
218
        FileObject tmpDir = FileUtil.toFileObject(File.createTempFile("tmp", null).getParentFile()); // NOI18N
219
        if (tmpDir != null && tmpDir.isFolder() && tmpDir.isValid()) {
220
            return tmpDir;
221
        }
222
        throw new IOException("Cannot find temporary folder"); // NOI18N
223
    }
224
    
225
    @Override
226
    public FileObject createTempFile(FileObject parent, String prefix, String suffix) throws IOException {
227
        if (parent.isFolder() && parent.isValid()) {
228
            File tmpFile = File.createTempFile(prefix, suffix, FileUtil.toFile(parent));
229
            FileObject fo = FileUtil.toFileObject(tmpFile);
230
            if (fo != null && fo.isData() && fo.isValid()) {
231
                return fo;
232
            }
233
            tmpFile.delete();
234
        }
235
        throw new IOException("Cannot create temporary file"); // NOI18N
236
    }
214
237
215
    @Override
238
    @Override
216
    public SystemAction[] getActions() {
239
    public SystemAction[] getActions() {
(-)a/openide.filesystems/apichanges.xml (+16 lines)
Lines 49-54 Link Here
49
        <apidef name="filesystems">Filesystems API</apidef>
49
        <apidef name="filesystems">Filesystems API</apidef>
50
    </apidefs>
50
    </apidefs>
51
    <changes>
51
    <changes>
52
        <change id="FileSystem.createTemporaryFO">
53
            <api name="filesystems"/>
54
            <summary>File System can create temporary file</summary>
55
            <version major="7" minor="59"/>
56
            <date year="2012" month="2" day="13"/>
57
            <author login="alexvsimon"/>
58
            <compatibility addition="yes" deprecation="no"/>
59
            <description>
60
                <p>
61
                    Added methods to create temporary file objects:
62
                    <code>FileSystem.getTempFolder</code>, <code>FileSystem.createTempFile</code>.
63
                </p>
64
            </description>
65
            <class package="org.openide.filesystems" name="FileSystem"/>
66
            <issue number="207659"/>
67
        </change>
52
        <change id="MIMEResolver.Registrations">
68
        <change id="MIMEResolver.Registrations">
53
            <api name="filesystems"/>
69
            <api name="filesystems"/>
54
            <summary>Annotations to declare MIME type</summary>
70
            <summary>Annotations to declare MIME type</summary>
(-)a/openide.filesystems/manifest.mf (-1 / +1 lines)
Lines 2-6 Link Here
2
OpenIDE-Module: org.openide.filesystems
2
OpenIDE-Module: org.openide.filesystems
3
OpenIDE-Module-Localizing-Bundle: org/openide/filesystems/Bundle.properties
3
OpenIDE-Module-Localizing-Bundle: org/openide/filesystems/Bundle.properties
4
OpenIDE-Module-Layer: org/openide/filesystems/resources/layer.xml
4
OpenIDE-Module-Layer: org/openide/filesystems/resources/layer.xml
5
OpenIDE-Module-Specification-Version: 7.58
5
OpenIDE-Module-Specification-Version: 7.59
6
6
(-)a/openide.filesystems/src/org/openide/filesystems/FileSystem.java (+20 lines)
Lines 425-430 Link Here
425
    */
425
    */
426
    public abstract FileObject findResource(String name);
426
    public abstract FileObject findResource(String name);
427
427
428
    /** Returns temporary folder if it is avaliable on this file system.
429
     * Method never returns null. IOException is thrown instead.
430
     * @return a file object for temporary folder
431
     */
432
    public FileObject getTempFolder() throws IOException {
433
        throw new IOException("Unsupported operation"); // NOI18N
434
    }
435
    
436
    /** Creates temporary file in the given parent folder.
437
     * Method never returns null. IOException is thrown instead.
438
     * @param parent the parent folder where temporary file will be created
439
     * @param prefix prefix of the name of created file
440
     * @param suffix suffix of the name of created file
441
     * @return new temporary file
442
     * @throws IOException 
443
     */
444
    public FileObject createTempFile(FileObject parent, String prefix, String suffix) throws IOException {
445
        throw new IOException("Unsupported operation"); // NOI18N
446
    }
447
        
428
    /** Returns an array of actions that can be invoked on any file in
448
    /** Returns an array of actions that can be invoked on any file in
429
    * this filesystem.
449
    * this filesystem.
430
    * These actions should preferably
450
    * These actions should preferably

Return to bug 207659