# This patch file was generated by NetBeans IDE # Following Index: paths are relative to: /home/work/trunk-work/nb_all/core # This patch can be applied using context Tools: Patch action on respective folder. # It uses platform neutral UTF-8 encoding and \n newlines. # Above lines and this line are ignored by the patching process. Index: startup/src/org/netbeans/core/startup/layers/SystemFileSystem.java --- /home/work/trunk-work/nb_all/core/startup/src/org/netbeans/core/startup/layers/SystemFileSystem.java Base (1.10) +++ /home/work/trunk-work/nb_all/core/startup/src/org/netbeans/core/startup/layers/SystemFileSystem.java Locally Modified (Based On 1.10) @@ -279,8 +279,22 @@ user = l; } else { // use some replacement + String customFSClass = System.getProperty("org.netbeans.core.systemfilesystem.custom"); // NOI18N + if (customFSClass != null) { + try { + Class clazz = Class.forName(customFSClass); + Object instance = clazz.newInstance(); + user = (FileSystem)instance; + } catch (Exception x) { + ModuleLayeredFileSystem.err.log( + Level.WARNING, + "Custom system file system writable layer init failed ", x); // NOI18N user = FileUtil.createMemoryFileSystem (); } + } else { + user = FileUtil.createMemoryFileSystem (); + } + } if (homeDir == null) { home = null; Index: startup/test/unit/src/org/netbeans/core/startup/layers/CustomWritableSystemFileSystemTest.java --- /home/work/trunk-work/nb_all/core/startup/test/unit/src/org/netbeans/core/startup/layers/CustomWritableSystemFileSystemTest.java No Base Revision +++ /home/work/trunk-work/nb_all/core/startup/test/unit/src/org/netbeans/core/startup/layers/CustomWritableSystemFileSystemTest.java Locally New @@ -0,0 +1,75 @@ +/* + * The contents of this file are subject to the terms of the Common Development + * and Distribution License (the License). You may not use this file except in + * compliance with the License. + * + * You can obtain a copy of the License at http://www.netbeans.org/cddl.html + * or http://www.netbeans.org/cddl.txt. + * + * When distributing Covered Code, include this CDDL Header Notice in each file + * and include the License file at http://www.netbeans.org/cddl.txt. + * If applicable, add the following below the CDDL Header, with the fields + * enclosed by brackets [] replaced by your own identifying information: + * "Portions Copyrighted [year] [name of copyright owner]" + * + * Portions Copyrighted 2007 Nokia Siemens Networks Oy + */ +package org.netbeans.core.startup.layers; + +import org.netbeans.junit.NbTestCase; +import org.openide.filesystems.FileObject; +import org.openide.filesystems.FileSystem; +import org.openide.filesystems.Repository; +import org.openide.util.actions.SystemAction; + +/** + * Tests whether the system property + * org.netbeans.core.systemfilesystem.custom correctly + * installs a custom filesystem. + * + * @author David Strupl + */ +public class CustomWritableSystemFileSystemTest extends NbTestCase { + + private SystemFileSystem sfs; + + public CustomWritableSystemFileSystemTest(String testName) { + super(testName); + } + + protected void setUp() throws Exception { + System.setProperty("netbeans.user", "memory"); + System.setProperty("org.netbeans.core.systemfilesystem.custom", PoohFileSystem.class.getName()); + sfs = (SystemFileSystem) Repository.getDefault().getDefaultFileSystem(); + } + + public void testCustomSFSWritableLayerPresent() throws Exception { + FileSystem writable = sfs.createWritableOn(null); + assertTrue(writable instanceof ModuleLayeredFileSystem); + ModuleLayeredFileSystem mlf = (ModuleLayeredFileSystem) writable; + assertTrue(mlf.getWritableLayer() instanceof PoohFileSystem); + } + + public static class PoohFileSystem extends FileSystem { + + public String getDisplayName() { + return "Pooh"; + } + + public boolean isReadOnly() { + return false; + } + + public FileObject getRoot() { + throw new UnsupportedOperationException("Not supported yet."); + } + + public FileObject findResource(String name) { + throw new UnsupportedOperationException("Not supported yet."); + } + + public SystemAction[] getActions() { + throw new UnsupportedOperationException("Not supported yet."); + } + } +} Index: arch/arch-core-launcher.xml --- /home/work/trunk-work/nb_all/core/arch/arch-core-launcher.xml Base (1.52) +++ /home/work/trunk-work/nb_all/core/arch/arch-core-launcher.xml Locally Modified (Based On 1.52) @@ -567,6 +567,16 @@

+
  • + +

    + Contains class name of a class that can serve as provider of the writable layer of the + system file system. The class must be a subclass of + org.openide.filesystems.FileSystem and have public default constructor. + Morevoer the class denoted by the property must be on the classpath. +

    +
    +
  • There are also some options passed to the launcher (interpreted