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

(-)startup/src/org/netbeans/core/startup/layers/SystemFileSystem.java (+14 lines)
Lines 279-286 Link Here
279
            user = l;
279
            user = l;
280
        } else {
280
        } else {
281
            // use some replacement
281
            // use some replacement
282
            String customFSClass = System.getProperty("org.netbeans.core.systemfilesystem.custom"); // NOI18N
283
            if (customFSClass != null) {
284
                try {
285
                    Class clazz = Class.forName(customFSClass);
286
                    Object instance = clazz.newInstance();
287
                    user = (FileSystem)instance;
288
                } catch (Exception x) {
289
                    ModuleLayeredFileSystem.err.log(
290
                        Level.WARNING,
291
                        "Custom system file system writable layer init failed ", x); // NOI18N
282
            user = FileUtil.createMemoryFileSystem ();
292
            user = FileUtil.createMemoryFileSystem ();
283
        }
293
        }
294
            } else {
295
                user = FileUtil.createMemoryFileSystem ();
296
            }
297
        }
284
298
285
        if (homeDir == null) {
299
        if (homeDir == null) {
286
            home = null;
300
            home = null;
(-)startup/test/unit/src/org/netbeans/core/startup/layers/CustomWritableSystemFileSystemTest.java (+75 lines)
Line 0 Link Here
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
 * Portions Copyrighted 2007 Nokia Siemens Networks Oy
16
 */
17
package org.netbeans.core.startup.layers;
18
19
import org.netbeans.junit.NbTestCase;
20
import org.openide.filesystems.FileObject;
21
import org.openide.filesystems.FileSystem;
22
import org.openide.filesystems.Repository;
23
import org.openide.util.actions.SystemAction;
24
25
/**
26
 * Tests whether the system property 
27
 * <code>org.netbeans.core.systemfilesystem.custom</code> correctly
28
 * installs a custom filesystem.
29
 * 
30
 * @author David Strupl
31
 */
32
public class CustomWritableSystemFileSystemTest extends NbTestCase {
33
34
    private SystemFileSystem sfs;
35
36
    public CustomWritableSystemFileSystemTest(String testName) {
37
        super(testName);
38
    }
39
40
    protected void setUp() throws Exception {
41
        System.setProperty("netbeans.user", "memory");
42
        System.setProperty("org.netbeans.core.systemfilesystem.custom", PoohFileSystem.class.getName());
43
        sfs = (SystemFileSystem) Repository.getDefault().getDefaultFileSystem();
44
    }
45
46
    public void testCustomSFSWritableLayerPresent() throws Exception {
47
        FileSystem writable = sfs.createWritableOn(null);
48
        assertTrue(writable instanceof ModuleLayeredFileSystem);
49
        ModuleLayeredFileSystem mlf = (ModuleLayeredFileSystem) writable;
50
        assertTrue(mlf.getWritableLayer() instanceof PoohFileSystem);
51
    }
52
53
    public static class PoohFileSystem extends FileSystem {
54
55
        public String getDisplayName() {
56
            return "Pooh";
57
        }
58
59
        public boolean isReadOnly() {
60
            return false;
61
        }
62
63
        public FileObject getRoot() {
64
            throw new UnsupportedOperationException("Not supported yet.");
65
        }
66
67
        public FileObject findResource(String name) {
68
            throw new UnsupportedOperationException("Not supported yet.");
69
        }
70
71
        public SystemAction[] getActions() {
72
            throw new UnsupportedOperationException("Not supported yet.");
73
        }
74
    }
75
}
(-)arch/arch-core-launcher.xml (+10 lines)
Lines 567-572 Link Here
567
                    </p>
567
                    </p>
568
                </api>
568
                </api>
569
            </li>
569
            </li>
570
            <li>
571
                <api type="export" group="property" name="org.netbeans.core.systemfilesystem.custom" category="friend">
572
                    <p>
573
                        Contains class name of a class that can serve as provider of the writable layer of the
574
                        system file system. The class must be a subclass of 
575
                        <code>org.openide.filesystems.FileSystem</code> and have public default constructor.
576
                        Morevoer the class denoted by the property must be on the classpath.
577
                    </p>
578
                </api>
579
            </li>
570
        </ul>
580
        </ul>
571
        <p>
581
        <p>
572
            There are also some options passed to the launcher (interpreted
582
            There are also some options passed to the launcher (interpreted

Return to bug 109847