|
From: <fd...@us...> - 2008-01-19 22:48:50
|
Revision: 3718
http://jnode.svn.sourceforge.net/jnode/?rev=3718&view=rev
Author: fduminy
Date: 2008-01-19 14:48:47 -0800 (Sat, 19 Jan 2008)
Log Message:
-----------
- added generics to FileSystem
- replaced key of type String by a key of type Class<FileSystemType> for registered file system types (method getFileSystemTypeForNameSystemTypes)
- moved supports(...) method from FileSystemType to a subclass named BlockDeviceFileSystemType
- fixed some warnings related to type safety
Modified Paths:
--------------
trunk/fs/src/fs/org/jnode/fs/FileSystem.java
trunk/fs/src/fs/org/jnode/fs/FileSystemType.java
trunk/fs/src/fs/org/jnode/fs/Formatter.java
trunk/fs/src/fs/org/jnode/fs/command/AbstractFormatCommand.java
trunk/fs/src/fs/org/jnode/fs/ext2/Ext2FileSystem.java
trunk/fs/src/fs/org/jnode/fs/ext2/Ext2FileSystemType.java
trunk/fs/src/fs/org/jnode/fs/fat/FatFileSystem.java
trunk/fs/src/fs/org/jnode/fs/fat/FatFileSystemType.java
trunk/fs/src/fs/org/jnode/fs/ftpfs/FTPFileSystem.java
trunk/fs/src/fs/org/jnode/fs/ftpfs/FTPFileSystemType.java
trunk/fs/src/fs/org/jnode/fs/ftpfs/command/FTPMountCommand.java
trunk/fs/src/fs/org/jnode/fs/iso9660/ISO9660FileSystem.java
trunk/fs/src/fs/org/jnode/fs/iso9660/ISO9660FileSystemType.java
trunk/fs/src/fs/org/jnode/fs/jarfs/JarFileSystem.java
trunk/fs/src/fs/org/jnode/fs/jarfs/JarFileSystemType.java
trunk/fs/src/fs/org/jnode/fs/jfat/FatFileSystem.java
trunk/fs/src/fs/org/jnode/fs/jfat/FatFileSystemType.java
trunk/fs/src/fs/org/jnode/fs/jifs/JIFileSystem.java
trunk/fs/src/fs/org/jnode/fs/jifs/JIFileSystemType.java
trunk/fs/src/fs/org/jnode/fs/jifs/def/JIFSPlugin.java
trunk/fs/src/fs/org/jnode/fs/nfs/command/NFSMountCommand.java
trunk/fs/src/fs/org/jnode/fs/nfs/nfs2/NFS2FileSystem.java
trunk/fs/src/fs/org/jnode/fs/nfs/nfs2/NFS2FileSystemType.java
trunk/fs/src/fs/org/jnode/fs/ntfs/NTFSFileSystem.java
trunk/fs/src/fs/org/jnode/fs/ntfs/NTFSFileSystemType.java
trunk/fs/src/fs/org/jnode/fs/ramfs/RAMFileSystem.java
trunk/fs/src/fs/org/jnode/fs/ramfs/RAMFileSystemType.java
trunk/fs/src/fs/org/jnode/fs/ramfs/def/RAMFSPlugin.java
trunk/fs/src/fs/org/jnode/fs/service/FileSystemService.java
trunk/fs/src/fs/org/jnode/fs/service/def/FileSystemMounter.java
trunk/fs/src/fs/org/jnode/fs/service/def/FileSystemPlugin.java
trunk/fs/src/fs/org/jnode/fs/service/def/FileSystemTypeManager.java
trunk/fs/src/fs/org/jnode/fs/service/def/VirtualFS.java
trunk/fs/src/fs/org/jnode/fs/smbfs/SMBFileSystem.java
trunk/fs/src/fs/org/jnode/fs/smbfs/SMBFileSystemType.java
trunk/fs/src/fs/org/jnode/fs/smbfs/command/SMBMountCommand.java
trunk/fs/src/fs/org/jnode/fs/spi/AbstractFileSystem.java
Added Paths:
-----------
trunk/fs/src/fs/org/jnode/fs/BlockDeviceFileSystemType.java
Added: trunk/fs/src/fs/org/jnode/fs/BlockDeviceFileSystemType.java
===================================================================
--- trunk/fs/src/fs/org/jnode/fs/BlockDeviceFileSystemType.java (rev 0)
+++ trunk/fs/src/fs/org/jnode/fs/BlockDeviceFileSystemType.java 2008-01-19 22:48:47 UTC (rev 3718)
@@ -0,0 +1,43 @@
+/*
+ * $Id: FileSystemType.java 3668 2007-12-30 22:20:07Z fduminy $
+ *
+ * JNode.org
+ * Copyright (C) 2003-2006 JNode.org
+ *
+ * This library is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation; either version 2.1 of the License, or
+ * (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; If not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+package org.jnode.fs;
+
+import org.jnode.driver.block.FSBlockDeviceAPI;
+import org.jnode.partitions.PartitionTableEntry;
+
+/**
+ * Specific kind of FileSystemType for block devices
+ *
+ * @author epr
+ */
+public interface BlockDeviceFileSystemType<T extends FileSystem<?>> extends FileSystemType<T> {
+ /**
+ * Can this file system type be used on the given first sector of a
+ * blockdevice?
+ *
+ * @param pte
+ * The partition table entry, if any. If null, there is no
+ * partition table entry.
+ * @param firstSector
+ */
+ public boolean supports(PartitionTableEntry pte, byte[] firstSector, FSBlockDeviceAPI devApi);
+}
Modified: trunk/fs/src/fs/org/jnode/fs/FileSystem.java
===================================================================
--- trunk/fs/src/fs/org/jnode/fs/FileSystem.java 2008-01-19 22:38:34 UTC (rev 3717)
+++ trunk/fs/src/fs/org/jnode/fs/FileSystem.java 2008-01-19 22:48:47 UTC (rev 3718)
@@ -9,16 +9,16 @@
* by the Free Software Foundation; either version 2.1 of the License, or
* (at your option) any later version.
*
- * This library is distributed in the hope that it will be useful, but
+ * This library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
* License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
- * along with this library; If not, write to the Free Software Foundation, Inc.,
+ * along with this library; If not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-
+
package org.jnode.fs;
import java.io.IOException;
@@ -28,7 +28,7 @@
/**
* @author epr
*/
-public interface FileSystem {
+public interface FileSystem<T extends FSEntry> {
/**
* Gets the device this FS driver operates on.
@@ -39,7 +39,7 @@
* Gets the root entry of this filesystem. This is usually a directory, but
* this is not required.
*/
- public FSEntry getRootEntry() throws IOException;
+ public T getRootEntry() throws IOException;
/**
* Is the filesystem mounted in readonly mode ?
@@ -50,7 +50,7 @@
* Close this filesystem. After a close, all invocations of method of this
* filesystem or objects created by this filesystem will throw an
* IOException.
- *
+ *
* @throws IOException
*/
public void close() throws IOException;
Modified: trunk/fs/src/fs/org/jnode/fs/FileSystemType.java
===================================================================
--- trunk/fs/src/fs/org/jnode/fs/FileSystemType.java 2008-01-19 22:38:34 UTC (rev 3717)
+++ trunk/fs/src/fs/org/jnode/fs/FileSystemType.java 2008-01-19 22:48:47 UTC (rev 3718)
@@ -22,16 +22,13 @@
package org.jnode.fs;
import org.jnode.driver.Device;
-import org.jnode.driver.block.FSBlockDeviceAPI;
-import org.jnode.partitions.PartitionTableEntry;
/**
- * Descriptor and entry point for a class of filesystems. Samples of
- * FileSystemType's are FAT16, EXT3.
+ * Descriptor and entry point for a class of filesystems.
*
* @author epr
*/
-public interface FileSystemType<T extends FileSystem> {
+public interface FileSystemType<T extends FileSystem<?>> {
/**
* Gets the unique name of this file system type.
@@ -39,17 +36,6 @@
public String getName();
/**
- * Can this file system type be used on the given first sector of a
- * blockdevice?
- *
- * @param pte
- * The partition table entry, if any. If null, there is no
- * partition table entry.
- * @param firstSector
- */
- public boolean supports(PartitionTableEntry pte, byte[] firstSector, FSBlockDeviceAPI devApi);
-
- /**
* Create a filesystem from a given device.
*
* @param device
Modified: trunk/fs/src/fs/org/jnode/fs/Formatter.java
===================================================================
--- trunk/fs/src/fs/org/jnode/fs/Formatter.java 2008-01-19 22:38:34 UTC (rev 3717)
+++ trunk/fs/src/fs/org/jnode/fs/Formatter.java 2008-01-19 22:48:47 UTC (rev 3718)
@@ -9,7 +9,7 @@
*
* @param <T>
*/
-abstract public class Formatter<T extends FileSystem> implements Cloneable {
+abstract public class Formatter<T extends FileSystem<?>> implements Cloneable {
private final FileSystemType<T> type;
protected Formatter(FileSystemType<T> type)
Modified: trunk/fs/src/fs/org/jnode/fs/command/AbstractFormatCommand.java
===================================================================
--- trunk/fs/src/fs/org/jnode/fs/command/AbstractFormatCommand.java 2008-01-19 22:38:34 UTC (rev 3717)
+++ trunk/fs/src/fs/org/jnode/fs/command/AbstractFormatCommand.java 2008-01-19 22:48:47 UTC (rev 3718)
@@ -46,7 +46,7 @@
* @author Fabien DUMINY (fduminy at jnode.org)
*
*/
-abstract public class AbstractFormatCommand<T extends FileSystem> extends AbstractCommand {
+abstract public class AbstractFormatCommand<T extends FileSystem<?>> extends AbstractCommand {
private static final DeviceArgument ARG_DEVICE = new DeviceArgument("device-id",
"the device to format");
Modified: trunk/fs/src/fs/org/jnode/fs/ext2/Ext2FileSystem.java
===================================================================
--- trunk/fs/src/fs/org/jnode/fs/ext2/Ext2FileSystem.java 2008-01-19 22:38:34 UTC (rev 3717)
+++ trunk/fs/src/fs/org/jnode/fs/ext2/Ext2FileSystem.java 2008-01-19 22:48:47 UTC (rev 3718)
@@ -43,7 +43,7 @@
* @author Andras Nagy
*
*/
-public class Ext2FileSystem extends AbstractFileSystem {
+public class Ext2FileSystem extends AbstractFileSystem<Ext2Entry> {
private Superblock superblock;
private GroupDescriptor groupDescriptors[];
@@ -175,8 +175,8 @@
+ " #MaxMount: " + superblock.getMaxMntCount() + "\n"
+ " Last mount time: " + sdf.format(Ext2Utils.decodeDate(superblock.getMTime()).getTime()) + "\n"
+ " Last write time: " + sdf.format(Ext2Utils.decodeDate(superblock.getWTime()).getTime()) + "\n"
- + " #blocks: " + superblock.getBlocksCount() + "\n"
- + " #blocks/group: " + superblock.getBlocksPerGroup() + "\n"
+ + " #blocks: " + superblock.getBlocksCount() + "\n"
+ + " #blocks/group: " + superblock.getBlocksPerGroup() + "\n"
+ " #block groups: " + groupCount + "\n"
+ " block size: " + superblock.getBlockSize() + "\n"
+ " #inodes: " + superblock.getINodesCount() + "\n"
@@ -310,7 +310,7 @@
/**
* @see org.jnode.fs.spi.AbstractFileSystem#createRootEntry()
*/
- public FSEntry createRootEntry() throws IOException {
+ public Ext2Entry createRootEntry() throws IOException {
try {
return new Ext2Entry(getINode(Ext2Constants.EXT2_ROOT_INO), "/",
Ext2Constants.EXT2_FT_DIR, this, null);
Modified: trunk/fs/src/fs/org/jnode/fs/ext2/Ext2FileSystemType.java
===================================================================
--- trunk/fs/src/fs/org/jnode/fs/ext2/Ext2FileSystemType.java 2008-01-19 22:38:34 UTC (rev 3717)
+++ trunk/fs/src/fs/org/jnode/fs/ext2/Ext2FileSystemType.java 2008-01-19 22:48:47 UTC (rev 3718)
@@ -29,6 +29,7 @@
import org.jnode.fs.FileSystem;
import org.jnode.fs.FileSystemException;
import org.jnode.fs.FileSystemType;
+import org.jnode.fs.BlockDeviceFileSystemType;
import org.jnode.partitions.PartitionTableEntry;
import org.jnode.partitions.ibm.IBMPartitionTableEntry;
import org.jnode.partitions.ibm.IBMPartitionTypes;
@@ -36,9 +37,9 @@
/**
* @author Andras Nagy
*/
-public class Ext2FileSystemType implements FileSystemType<Ext2FileSystem> {
+public class Ext2FileSystemType implements BlockDeviceFileSystemType<Ext2FileSystem> {
- public static final String NAME = "EXT2";
+ public static final Class<Ext2FileSystemType> NAME = Ext2FileSystemType.class;
/**
* @see org.jnode.fs.FileSystemType#create(Device, boolean)
@@ -53,7 +54,7 @@
* @see org.jnode.fs.FileSystemType#getName()
*/
public String getName() {
- return NAME;
+ return "EXT2";
}
/**
Modified: trunk/fs/src/fs/org/jnode/fs/fat/FatFileSystem.java
===================================================================
--- trunk/fs/src/fs/org/jnode/fs/fat/FatFileSystem.java 2008-01-19 22:38:34 UTC (rev 3717)
+++ trunk/fs/src/fs/org/jnode/fs/fat/FatFileSystem.java 2008-01-19 22:48:47 UTC (rev 3718)
@@ -35,7 +35,7 @@
/**
* @author epr
*/
-public class FatFileSystem extends AbstractFileSystem {
+public class FatFileSystem extends AbstractFileSystem<FatRootEntry> {
private BootSector bs;
private Fat fat;
@@ -123,7 +123,7 @@
* Gets the root entry of this filesystem. This is usually a director, but
* this is not required.
*/
- public FSEntry getRootEntry() {
+ public FatRootEntry getRootEntry() {
return rootEntry;
}
@@ -192,7 +192,7 @@
/**
*
*/
- protected FSEntry createRootEntry() throws IOException {
+ protected FatRootEntry createRootEntry() throws IOException {
// TODO Auto-generated method stub
return null;
}
Modified: trunk/fs/src/fs/org/jnode/fs/fat/FatFileSystemType.java
===================================================================
--- trunk/fs/src/fs/org/jnode/fs/fat/FatFileSystemType.java 2008-01-19 22:38:34 UTC (rev 3717)
+++ trunk/fs/src/fs/org/jnode/fs/fat/FatFileSystemType.java 2008-01-19 22:48:47 UTC (rev 3718)
@@ -25,6 +25,7 @@
import org.jnode.driver.block.FSBlockDeviceAPI;
import org.jnode.fs.FileSystemException;
import org.jnode.fs.FileSystemType;
+import org.jnode.fs.BlockDeviceFileSystemType;
import org.jnode.partitions.PartitionTableEntry;
import org.jnode.partitions.ibm.IBMPartitionTableEntry;
import org.jnode.partitions.ibm.IBMPartitionTypes;
@@ -32,16 +33,16 @@
/**
* @author epr
*/
-public class FatFileSystemType implements FileSystemType<FatFileSystem> {
+public class FatFileSystemType implements BlockDeviceFileSystemType<FatFileSystem> {
/** Name of this filesystem type */
- public static final String NAME = "FAT";
+ public static final Class<FatFileSystemType> NAME = FatFileSystemType.class;
/**
* Gets the unique name of this file system type.
*/
public String getName() {
- return NAME;
+ return "FAT";
}
/**
Modified: trunk/fs/src/fs/org/jnode/fs/ftpfs/FTPFileSystem.java
===================================================================
--- trunk/fs/src/fs/org/jnode/fs/ftpfs/FTPFileSystem.java 2008-01-19 22:38:34 UTC (rev 3717)
+++ trunk/fs/src/fs/org/jnode/fs/ftpfs/FTPFileSystem.java 2008-01-19 22:48:47 UTC (rev 3718)
@@ -9,16 +9,16 @@
* by the Free Software Foundation; either version 2.1 of the License, or
* (at your option) any later version.
*
- * This library is distributed in the hope that it will be useful, but
+ * This library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
* License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
- * along with this library; If not, write to the Free Software Foundation, Inc.,
+ * along with this library; If not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-
+
package org.jnode.fs.ftpfs;
import org.jnode.fs.FileSystem;
@@ -37,7 +37,7 @@
/**
* @author Levente S\u00e1ntha
*/
-public class FTPFileSystem extends FTPClient implements FileSystem {
+public class FTPFileSystem extends FTPClient implements FileSystem<FTPFSDirectory> {
private FTPFSDevice device;
private FTPFSDirectory root;
private boolean closed;
@@ -153,20 +153,20 @@
public boolean isReadOnly() {
return true;
}
-
+
public long getFreeSpace() {
// TODO implement me
return 0;
}
public long getTotalSpace() {
- // TODO implement me
+ // TODO implement me
return 0;
}
public long getUsableSpace() {
- // TODO implement me
+ // TODO implement me
return 0;
- }
+ }
}
Modified: trunk/fs/src/fs/org/jnode/fs/ftpfs/FTPFileSystemType.java
===================================================================
--- trunk/fs/src/fs/org/jnode/fs/ftpfs/FTPFileSystemType.java 2008-01-19 22:38:34 UTC (rev 3717)
+++ trunk/fs/src/fs/org/jnode/fs/ftpfs/FTPFileSystemType.java 2008-01-19 22:48:47 UTC (rev 3718)
@@ -32,7 +32,7 @@
* @author Levente S\u00e1ntha
*/
public class FTPFileSystemType implements FileSystemType<FTPFileSystem> {
- public static final String NAME = "FTPFS";
+ public static final Class<FTPFileSystemType> NAME = FTPFileSystemType.class;
/**
* Create a filesystem from a given device.
*
@@ -47,19 +47,6 @@
* Gets the unique name of this file system type.
*/
public String getName() {
- return NAME;
+ return "FTPFS";
}
-
- /**
- * Can this file system type be used on the given first sector of a
- * blockdevice?
- *
- * @param pte The partition table entry, if any. If null, there is no
- * partition table entry.
- * @param firstSector
- */
- public boolean supports(PartitionTableEntry pte, byte[] firstSector, FSBlockDeviceAPI devApi) {
- return false;
- }
-
}
\ No newline at end of file
Modified: trunk/fs/src/fs/org/jnode/fs/ftpfs/command/FTPMountCommand.java
===================================================================
--- trunk/fs/src/fs/org/jnode/fs/ftpfs/command/FTPMountCommand.java 2008-01-19 22:38:34 UTC (rev 3717)
+++ trunk/fs/src/fs/org/jnode/fs/ftpfs/command/FTPMountCommand.java 2008-01-19 22:48:47 UTC (rev 3718)
@@ -9,16 +9,16 @@
* by the Free Software Foundation; either version 2.1 of the License, or
* (at your option) any later version.
*
- * This library is distributed in the hope that it will be useful, but
+ * This library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
* License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
- * along with this library; If not, write to the Free Software Foundation, Inc.,
+ * along with this library; If not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-
+
package org.jnode.fs.ftpfs.command;
import org.jnode.driver.DeviceManager;
@@ -27,6 +27,7 @@
import org.jnode.fs.FileSystemType;
import org.jnode.fs.ftpfs.FTPFSDevice;
import org.jnode.fs.ftpfs.FTPFSDriver;
+import org.jnode.fs.ftpfs.FTPFileSystem;
import org.jnode.fs.ftpfs.FTPFileSystemType;
import org.jnode.fs.service.FileSystemService;
import org.jnode.naming.InitialNaming;
@@ -72,8 +73,8 @@
final DeviceManager dm = DeviceUtils.getDeviceManager();
dm.register(dev);
final FileSystemService fss = InitialNaming.lookup(FileSystemService.NAME);
- FileSystemType type = fss.getFileSystemTypeForNameSystemTypes(FTPFileSystemType.NAME);
- final FileSystem fs = type.create(dev, true);
+ FTPFileSystemType type = fss.getFileSystemTypeForNameSystemTypes(FTPFileSystemType.NAME);
+ final FTPFileSystem fs = type.create(dev, true);
fss.registerFileSystem(fs);
fss.mount(mount_point, fs, null);
}
Modified: trunk/fs/src/fs/org/jnode/fs/iso9660/ISO9660FileSystem.java
===================================================================
--- trunk/fs/src/fs/org/jnode/fs/iso9660/ISO9660FileSystem.java 2008-01-19 22:38:34 UTC (rev 3717)
+++ trunk/fs/src/fs/org/jnode/fs/iso9660/ISO9660FileSystem.java 2008-01-19 22:48:47 UTC (rev 3718)
@@ -9,16 +9,16 @@
* by the Free Software Foundation; either version 2.1 of the License, or
* (at your option) any later version.
*
- * This library is distributed in the hope that it will be useful, but
+ * This library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
* License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
- * along with this library; If not, write to the Free Software Foundation, Inc.,
+ * along with this library; If not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-
+
package org.jnode.fs.iso9660;
import java.io.IOException;
@@ -35,7 +35,7 @@
* @author Chira
* @author Ewout Prangsma (ep...@us...)
*/
-public class ISO9660FileSystem extends AbstractFileSystem {
+public class ISO9660FileSystem extends AbstractFileSystem<ISO9660Entry> {
private final ISO9660Volume volume;
private ISO9660Entry rootEntry;
@@ -59,7 +59,7 @@
/**
* @see org.jnode.fs.FileSystem#getRootEntry()
*/
- public FSEntry getRootEntry() throws IOException {
+ public ISO9660Entry getRootEntry() throws IOException {
if (rootEntry == null) {
rootEntry = new ISO9660Entry(this, volume.getRootDirectoryEntry());
}
@@ -85,7 +85,7 @@
}
/**
- *
+ *
*/
protected FSFile createFile(FSEntry entry) throws IOException {
// TODO Auto-generated method stub
@@ -93,7 +93,7 @@
}
/**
- *
+ *
*/
protected FSDirectory createDirectory(FSEntry entry) throws IOException {
// TODO Auto-generated method stub
@@ -101,9 +101,9 @@
}
/**
- *
+ *
*/
- protected FSEntry createRootEntry() throws IOException {
+ protected ISO9660Entry createRootEntry() throws IOException {
// TODO Auto-generated method stub
return null;
}
@@ -115,12 +115,12 @@
}
public long getTotalSpace() {
- // TODO implement me
+ // TODO implement me
return 0;
}
public long getUsableSpace() {
- // TODO implement me
+ // TODO implement me
return 0;
}
}
Modified: trunk/fs/src/fs/org/jnode/fs/iso9660/ISO9660FileSystemType.java
===================================================================
--- trunk/fs/src/fs/org/jnode/fs/iso9660/ISO9660FileSystemType.java 2008-01-19 22:38:34 UTC (rev 3717)
+++ trunk/fs/src/fs/org/jnode/fs/iso9660/ISO9660FileSystemType.java 2008-01-19 22:48:47 UTC (rev 3718)
@@ -29,17 +29,18 @@
import org.jnode.fs.FileSystem;
import org.jnode.fs.FileSystemException;
import org.jnode.fs.FileSystemType;
+import org.jnode.fs.BlockDeviceFileSystemType;
import org.jnode.partitions.PartitionTableEntry;
/**
* @author Chira
*/
-public class ISO9660FileSystemType implements FileSystemType<ISO9660FileSystem> {
+public class ISO9660FileSystemType implements BlockDeviceFileSystemType<ISO9660FileSystem> {
- public static final String NAME = "ISO9660";
+ public static final Class<ISO9660FileSystemType> NAME = ISO9660FileSystemType.class;
public final String getName() {
- return NAME;
+ return "ISO9660";
}
/**
Modified: trunk/fs/src/fs/org/jnode/fs/jarfs/JarFileSystem.java
===================================================================
--- trunk/fs/src/fs/org/jnode/fs/jarfs/JarFileSystem.java 2008-01-19 22:38:34 UTC (rev 3717)
+++ trunk/fs/src/fs/org/jnode/fs/jarfs/JarFileSystem.java 2008-01-19 22:48:47 UTC (rev 3718)
@@ -9,16 +9,16 @@
* by the Free Software Foundation; either version 2.1 of the License, or
* (at your option) any later version.
*
- * This library is distributed in the hope that it will be useful, but
+ * This library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
* License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
- * along with this library; If not, write to the Free Software Foundation, Inc.,
+ * along with this library; If not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-
+
package org.jnode.fs.jarfs;
import java.util.Map;
@@ -32,11 +32,11 @@
import org.jnode.fs.spi.AbstractFileSystem;
/**
- *
+ *
* @author Fabien DUMINY (fduminy at users.sourceforge.net)
*
*/
-public class JarFileSystem extends AbstractFileSystem {
+public class JarFileSystem extends AbstractFileSystem<JarFSEntry> {
private JarFile jarFile;
private JarFSCache cache;
@@ -48,7 +48,7 @@
public JarFileSystem(JarFileDevice device)
throws FileSystemException {
super(device, true); // jar file systems are always readOnly
-
+
jarFile = device.getJarFile();
cache = new JarFSCache();
rootEntry = FSTreeBuilder.build(this, jarFile, cache);
@@ -58,42 +58,42 @@
{
return jarFile;
}
-
+
/**
- *
+ *
*/
protected FSFile createFile(FSEntry entry) {
return new JarFSFile((JarFSEntry) entry);
}
/**
- *
+ *
*/
protected FSDirectory createDirectory(FSEntry entry) {
Map<String, JarFSEntry> entries = cache.getChildEntries((JarFSEntry) entry);
return new JarFSDirectory((JarFSEntry) entry, entries);
}
-
+
/**
- *
+ *
*/
- protected FSEntry createRootEntry() {
+ protected JarFSEntry createRootEntry() {
return rootEntry;
}
-
+
public long getFreeSpace() {
// TODO implement me
return 0;
}
public long getTotalSpace() {
- // TODO implement me
+ // TODO implement me
return 0;
}
public long getUsableSpace() {
- // TODO implement me
+ // TODO implement me
return 0;
- }
+ }
}
Modified: trunk/fs/src/fs/org/jnode/fs/jarfs/JarFileSystemType.java
===================================================================
--- trunk/fs/src/fs/org/jnode/fs/jarfs/JarFileSystemType.java 2008-01-19 22:38:34 UTC (rev 3717)
+++ trunk/fs/src/fs/org/jnode/fs/jarfs/JarFileSystemType.java 2008-01-19 22:48:47 UTC (rev 3718)
@@ -36,22 +36,13 @@
*/
public class JarFileSystemType implements FileSystemType<JarFileSystem> {
- public static final String NAME = "jar";
+ public static final Class<JarFileSystemType> NAME = JarFileSystemType.class;
public final String getName() {
- return NAME;
+ return "jar";
}
/**
- * @see org.jnode.fs.FileSystemType#supports(PartitionTableEntry, byte[],
- * FSBlockDeviceAPI)
- */
- public boolean supports(PartitionTableEntry pte, byte[] firstSector,
- FSBlockDeviceAPI devApi) {
- return false;
- }
-
- /**
* @see org.jnode.fs.FileSystemType#create(Device, boolean)
*/
public JarFileSystem create(Device device, boolean readOnly) throws FileSystemException {
Modified: trunk/fs/src/fs/org/jnode/fs/jfat/FatFileSystem.java
===================================================================
--- trunk/fs/src/fs/org/jnode/fs/jfat/FatFileSystem.java 2008-01-19 22:38:34 UTC (rev 3717)
+++ trunk/fs/src/fs/org/jnode/fs/jfat/FatFileSystem.java 2008-01-19 22:48:47 UTC (rev 3718)
@@ -25,18 +25,18 @@
/**
* @author gvt
*/
-public class FatFileSystem extends AbstractFileSystem {
+public class FatFileSystem extends AbstractFileSystem<FatRootDirectory> {
private static final Logger log =
Logger.getLogger ( FatFileSystem.class );
private Fat fat;
private final CodePage cp;
-
+
public FatFileSystem ( Device device, String codePageName, boolean readOnly )
throws FileSystemException {
super ( device, readOnly );
-
+
try {
fat = Fat.create ( getApi() );
}
@@ -59,8 +59,8 @@
public int getClusterSize() {
return fat.getClusterSize();
}
-
+
public Fat getFat() {
return fat;
}
@@ -81,16 +81,16 @@
return
entry.getFile();
}
-
-
+
+
protected FSDirectory createDirectory ( FSEntry entry )
throws IOException {
return
entry.getDirectory();
}
-
- protected FSEntry createRootEntry()
+
+ protected FatRootDirectory createRootEntry()
throws IOException {
return
new FatRootDirectory ( this );
@@ -103,8 +103,8 @@
fat.flush();
log.debug ( getFat().getCacheStat() );
}
-
+
public String toString() {
StrWriter out = new StrWriter();
@@ -121,12 +121,12 @@
}
public long getTotalSpace() {
- // TODO implement me
+ // TODO implement me
return 0;
}
public long getUsableSpace() {
- // TODO implement me
+ // TODO implement me
return 0;
}
}
Modified: trunk/fs/src/fs/org/jnode/fs/jfat/FatFileSystemType.java
===================================================================
--- trunk/fs/src/fs/org/jnode/fs/jfat/FatFileSystemType.java 2008-01-19 22:38:34 UTC (rev 3717)
+++ trunk/fs/src/fs/org/jnode/fs/jfat/FatFileSystemType.java 2008-01-19 22:48:47 UTC (rev 3718)
@@ -26,6 +26,7 @@
import org.jnode.driver.block.FSBlockDeviceAPI;
import org.jnode.fs.FileSystemException;
import org.jnode.fs.FileSystemType;
+import org.jnode.fs.BlockDeviceFileSystemType;
import org.jnode.partitions.PartitionTableEntry;
import org.jnode.partitions.ibm.IBMPartitionTableEntry;
import org.jnode.partitions.ibm.IBMPartitionTypes;
@@ -35,12 +36,12 @@
* @author gvt
* @author Tango
*/
-public class FatFileSystemType implements FileSystemType<FatFileSystem> {
- public static final String NAME="JFAT";
+public class FatFileSystemType implements BlockDeviceFileSystemType<FatFileSystem> {
+ public static final Class<FatFileSystemType> NAME=FatFileSystemType.class;
public String getName() {
- return NAME;
+ return "JFAT";
}
Modified: trunk/fs/src/fs/org/jnode/fs/jifs/JIFileSystem.java
===================================================================
--- trunk/fs/src/fs/org/jnode/fs/jifs/JIFileSystem.java 2008-01-19 22:38:34 UTC (rev 3717)
+++ trunk/fs/src/fs/org/jnode/fs/jifs/JIFileSystem.java 2008-01-19 22:48:47 UTC (rev 3718)
@@ -9,16 +9,16 @@
* by the Free Software Foundation; either version 2.1 of the License, or
* (at your option) any later version.
*
- * This library is distributed in the hope that it will be useful, but
+ * This library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
* License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
- * along with this library; If not, write to the Free Software Foundation, Inc.,
+ * along with this library; If not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-
+
package org.jnode.fs.jifs;
import java.io.IOException;
@@ -34,11 +34,11 @@
/**
* @author Andreas H\u00e4nel
*/
-public class JIFileSystem implements FileSystem {
-
+public class JIFileSystem implements FileSystem<JIFSDirectory> {
+
private JIFSDirectory rootDir = null;
private Device device;
-
+
/**
* Constructor for JIFileSystem in specified readOnly mode
*/
@@ -54,7 +54,7 @@
// e.printStackTrace();
//}
}
-
+
/**
* Is the filesystem mounted in readonly mode ?
*/
@@ -62,23 +62,23 @@
{
return true; // always readOnly
}
-
-
+
+
public void close(){
return;
}
-
+
public boolean isClosed() {
return false;
}
-
+
public Device getDevice(){
return device;
}
/**
* Flush all changed structures to the device. Since JIFS is readonly, this method does nothing.
- *
+ *
* @throws IOException
*/
public void flush() throws IOException {
@@ -88,21 +88,21 @@
/**
* Gets the root entry of this filesystem. This is usually a director, but
* this is not required.
- *
+ *
* @return rootDir
*/
- public FSEntry getRootEntry() {
+ public JIFSDirectory getRootEntry() {
return rootDir;
}
/**
* Gets the file for the given entry.
- *
+ *
* @return null
* @param entry
*/
public synchronized JIFSFile getFile(FSEntry entry) {
- return null;
+ return null;
}
@@ -117,21 +117,21 @@
protected FSEntry createRootEntry() throws IOException {
return null;
}
-
+
public long getFreeSpace() {
// TODO implement me
return 0;
}
public long getTotalSpace() {
- // TODO implement me
+ // TODO implement me
return 0;
}
public long getUsableSpace() {
- // TODO implement me
+ // TODO implement me
return 0;
}
-
+
}
Modified: trunk/fs/src/fs/org/jnode/fs/jifs/JIFileSystemType.java
===================================================================
--- trunk/fs/src/fs/org/jnode/fs/jifs/JIFileSystemType.java 2008-01-19 22:38:34 UTC (rev 3717)
+++ trunk/fs/src/fs/org/jnode/fs/jifs/JIFileSystemType.java 2008-01-19 22:48:47 UTC (rev 3718)
@@ -35,7 +35,7 @@
public class JIFileSystemType implements FileSystemType<JIFileSystem> {
/** Name of this filesystem type */
- public static final String NAME = "JIFS";
+ public static final Class<JIFileSystemType> NAME = JIFileSystemType.class;
public static final String VIRTUAL_DEVICE_NAME = "jifs";
/** Logger*/
@@ -45,25 +45,10 @@
* Gets the unique name of this file system type.
*/
public String getName() {
- return NAME;
+ return "JIFS";
}
/**
- * Can this FileSystemType be used on the given first sector of a
- * BlockDevice? Since this FileSystemType is for a virtual filesystem, it does not support any of the given ones.
- *
- * @param pte
- * The partition table entry, if any. If null, there is no
- * partition table entry.
- * @param firstSector
- * First sector of a BlockDevice.
- * @return false
- */
- public boolean supports(PartitionTableEntry pte, byte[] firstSector, FSBlockDeviceAPI devApi) {
- return false;
- }
-
- /**
* Create a filesystem for a given device.
*
* @param device
Modified: trunk/fs/src/fs/org/jnode/fs/jifs/def/JIFSPlugin.java
===================================================================
--- trunk/fs/src/fs/org/jnode/fs/jifs/def/JIFSPlugin.java 2008-01-19 22:38:34 UTC (rev 3717)
+++ trunk/fs/src/fs/org/jnode/fs/jifs/def/JIFSPlugin.java 2008-01-19 22:48:47 UTC (rev 3718)
@@ -9,13 +9,13 @@
* by the Free Software Foundation; either version 2.1 of the License, or
* (at your option) any later version.
*
- * This library is distributed in the hope that it will be useful, but
+ * This library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
* License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
- * along with this library; If not, write to the Free Software Foundation, Inc.,
+ * along with this library; If not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
@@ -33,6 +33,7 @@
import org.jnode.fs.FileSystem;
import org.jnode.fs.FileSystemException;
import org.jnode.fs.FileSystemType;
+import org.jnode.fs.jifs.JIFileSystem;
import org.jnode.fs.jifs.JIFileSystemType;
import org.jnode.fs.service.FileSystemService;
import org.jnode.naming.InitialNaming;
@@ -70,11 +71,11 @@
log.info("start jifs");
try {
FileSystemService fSS = InitialNaming.lookup(FileSystemService.NAME);
- FileSystemType type = fSS.getFileSystemTypeForNameSystemTypes(JIFileSystemType.NAME);
+ JIFileSystemType type = fSS.getFileSystemTypeForNameSystemTypes(JIFileSystemType.NAME);
try {
VirtualDevice dev = VirtualDeviceFactory.createDevice(JIFileSystemType.VIRTUAL_DEVICE_NAME);
log.info(dev.getId() + " registered");
- final FileSystem fs = type.create(dev, true);
+ final JIFileSystem fs = type.create(dev, true);
fSS.registerFileSystem(fs);
final String mountPath = "jifs";
@@ -125,5 +126,5 @@
log.error(ex);
}
}
-
+
}
Modified: trunk/fs/src/fs/org/jnode/fs/nfs/command/NFSMountCommand.java
===================================================================
--- trunk/fs/src/fs/org/jnode/fs/nfs/command/NFSMountCommand.java 2008-01-19 22:38:34 UTC (rev 3717)
+++ trunk/fs/src/fs/org/jnode/fs/nfs/command/NFSMountCommand.java 2008-01-19 22:48:47 UTC (rev 3718)
@@ -9,13 +9,13 @@
* by the Free Software Foundation; either version 2.1 of the License, or
* (at your option) any later version.
*
- * This library is distributed in the hope that it will be useful, but
+ * This library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
* License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
- * along with this library; If not, write to the Free Software Foundation, Inc.,
+ * along with this library; If not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
@@ -31,6 +31,7 @@
import org.jnode.fs.FileSystemType;
import org.jnode.fs.nfs.nfs2.NFS2Device;
import org.jnode.fs.nfs.nfs2.NFS2Driver;
+import org.jnode.fs.nfs.nfs2.NFS2FileSystem;
import org.jnode.fs.nfs.nfs2.NFS2FileSystemType;
import org.jnode.fs.service.FileSystemService;
import org.jnode.naming.InitialNaming;
@@ -140,9 +141,9 @@
dm.register(dev);
final FileSystemService fss = InitialNaming
.lookup(FileSystemService.NAME);
- FileSystemType type = fss
+ NFS2FileSystemType type = fss
.getFileSystemTypeForNameSystemTypes(NFS2FileSystemType.NAME);
- final FileSystem fs = type.create(dev, readOnly);
+ final NFS2FileSystem fs = type.create(dev, readOnly);
fss.registerFileSystem(fs);
fss.mount(mount_point, fs, null);
Modified: trunk/fs/src/fs/org/jnode/fs/nfs/nfs2/NFS2FileSystem.java
===================================================================
--- trunk/fs/src/fs/org/jnode/fs/nfs/nfs2/NFS2FileSystem.java 2008-01-19 22:38:34 UTC (rev 3717)
+++ trunk/fs/src/fs/org/jnode/fs/nfs/nfs2/NFS2FileSystem.java 2008-01-19 22:48:47 UTC (rev 3718)
@@ -9,13 +9,13 @@
* by the Free Software Foundation; either version 2.1 of the License, or
* (at your option) any later version.
*
- * This library is distributed in the hope that it will be useful, but
+ * This library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
* License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
- * along with this library; If not, write to the Free Software Foundation, Inc.,
+ * along with this library; If not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
@@ -38,7 +38,7 @@
/**
* @author Andrei Dore
*/
-public class NFS2FileSystem implements FileSystem {
+public class NFS2FileSystem implements FileSystem<NFS2RootEntry> {
private NFS2Device device;
@@ -120,7 +120,7 @@
* Close this filesystem. After a close, all invocations of method of this
* filesystem or objects created by this filesystem will throw an
* IOException.
- *
+ *
* @throws java.io.IOException
*/
public void close() throws IOException {
@@ -164,7 +164,7 @@
* Gets the root entry of this filesystem. This is usually a directory, but
* this is not required.
*/
- public FSEntry getRootEntry() throws IOException {
+ public NFS2RootEntry getRootEntry() throws IOException {
return root;
}
Modified: trunk/fs/src/fs/org/jnode/fs/nfs/nfs2/NFS2FileSystemType.java
===================================================================
--- trunk/fs/src/fs/org/jnode/fs/nfs/nfs2/NFS2FileSystemType.java 2008-01-19 22:38:34 UTC (rev 3717)
+++ trunk/fs/src/fs/org/jnode/fs/nfs/nfs2/NFS2FileSystemType.java 2008-01-19 22:48:47 UTC (rev 3718)
@@ -31,7 +31,7 @@
* @author Andrei Dore
*/
public class NFS2FileSystemType implements FileSystemType<NFS2FileSystem> {
- public static final String NAME = "NFS2";
+ public static final Class<NFS2FileSystemType> NAME = NFS2FileSystemType.class;
/**
* Create a filesystem from a given device.
@@ -48,20 +48,6 @@
* Gets the unique name of this file system type.
*/
public String getName() {
- return NAME;
+ return "NFS2";
}
-
- /**
- * Can this file system type be used on the given first sector of a
- * blockdevice?
- *
- * @param pte
- * The partition table entry, if any. If null, there is no
- * partition table entry.
- * @param firstSector
- */
- public boolean supports(PartitionTableEntry pte, byte[] firstSector,
- FSBlockDeviceAPI devApi) {
- return false;
- }
}
\ No newline at end of file
Modified: trunk/fs/src/fs/org/jnode/fs/ntfs/NTFSFileSystem.java
===================================================================
--- trunk/fs/src/fs/org/jnode/fs/ntfs/NTFSFileSystem.java 2008-01-19 22:38:34 UTC (rev 3717)
+++ trunk/fs/src/fs/org/jnode/fs/ntfs/NTFSFileSystem.java 2008-01-19 22:48:47 UTC (rev 3718)
@@ -9,16 +9,16 @@
* by the Free Software Foundation; either version 2.1 of the License, or
* (at your option) any later version.
*
- * This library is distributed in the hope that it will be useful, but
+ * This library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
* License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
- * along with this library; If not, write to the Free Software Foundation, Inc.,
+ * along with this library; If not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-
+
package org.jnode.fs.ntfs;
import java.io.IOException;
@@ -32,11 +32,11 @@
/**
* NTFS filesystem implementation.
- *
+ *
* @author Chira
* @author Ewout Prangsma (ep...@us...)
*/
-public class NTFSFileSystem extends AbstractFileSystem {
+public class NTFSFileSystem extends AbstractFileSystem<FSEntry> {
private final NTFSVolume volume;
private FSEntry root;
@@ -62,7 +62,7 @@
public FSEntry getRootEntry() throws IOException {
if (root == null) {
root = new NTFSDirectory(this, volume.getRootDirectory()).getEntry(".");
- }
+ }
return root;
}
@@ -81,7 +81,7 @@
}
/**
- *
+ *
*/
protected FSFile createFile(FSEntry entry) throws IOException {
// TODO Auto-generated method stub
@@ -89,7 +89,7 @@
}
/**
- *
+ *
*/
protected FSDirectory createDirectory(FSEntry entry) throws IOException {
// TODO Auto-generated method stub
@@ -97,26 +97,26 @@
}
/**
- *
+ *
*/
- protected FSEntry createRootEntry() throws IOException {
+ protected NTFSEntry createRootEntry() throws IOException {
// TODO Auto-generated method stub
return null;
}
-
+
public long getFreeSpace() {
// TODO implement me
return 0;
}
public long getTotalSpace() {
- // TODO implement me
+ // TODO implement me
return 0;
}
public long getUsableSpace() {
- // TODO implement me
+ // TODO implement me
return 0;
- }
+ }
}
Modified: trunk/fs/src/fs/org/jnode/fs/ntfs/NTFSFileSystemType.java
===================================================================
--- trunk/fs/src/fs/org/jnode/fs/ntfs/NTFSFileSystemType.java 2008-01-19 22:38:34 UTC (rev 3717)
+++ trunk/fs/src/fs/org/jnode/fs/ntfs/NTFSFileSystemType.java 2008-01-19 22:48:47 UTC (rev 3718)
@@ -26,6 +26,7 @@
import org.jnode.fs.FileSystem;
import org.jnode.fs.FileSystemException;
import org.jnode.fs.FileSystemType;
+import org.jnode.fs.BlockDeviceFileSystemType;
import org.jnode.partitions.PartitionTableEntry;
import org.jnode.partitions.ibm.IBMPartitionTableEntry;
import org.jnode.partitions.ibm.IBMPartitionTypes;
@@ -34,14 +35,14 @@
* @author Chira
* @author Ewout Prangsma (ep...@us...)
*/
-public class NTFSFileSystemType implements FileSystemType<NTFSFileSystem> {
+public class NTFSFileSystemType implements BlockDeviceFileSystemType<NTFSFileSystem> {
- public static final String NAME = "NTFS";
+ public static final Class<NTFSFileSystemType> NAME = NTFSFileSystemType.class;
public static final String TAG = "NTFS";
public String getName() {
- return NAME;
+ return "NTFS";
}
/**
Modified: trunk/fs/src/fs/org/jnode/fs/ramfs/RAMFileSystem.java
===================================================================
--- trunk/fs/src/fs/org/jnode/fs/ramfs/RAMFileSystem.java 2008-01-19 22:38:34 UTC (rev 3717)
+++ trunk/fs/src/fs/org/jnode/fs/ramfs/RAMFileSystem.java 2008-01-19 22:48:47 UTC (rev 3718)
@@ -12,7 +12,7 @@
*
* @author peda
*/
-public class RAMFileSystem implements FileSystem {
+public class RAMFileSystem implements FileSystem<RAMDirectory> {
private Device device;
private boolean readOnly;
@@ -53,7 +53,7 @@
* (non-Javadoc)
* @see org.jnode.fs.FileSystem#getRootEntry()
*/
- public FSEntry getRootEntry() throws IOException {
+ public RAMDirectory getRootEntry() throws IOException {
if (isClosed())
throw new IOException("Filesystem closed");
return root;
Modified: trunk/fs/src/fs/org/jnode/fs/ramfs/RAMFileSystemType.java
===================================================================
--- trunk/fs/src/fs/org/jnode/fs/ramfs/RAMFileSystemType.java 2008-01-19 22:38:34 UTC (rev 3717)
+++ trunk/fs/src/fs/org/jnode/fs/ramfs/RAMFileSystemType.java 2008-01-19 22:48:47 UTC (rev 3718)
@@ -8,44 +8,35 @@
/**
* FileSystemType for RAMFS, a filesystem implementation in system RAM
- *
+ *
* @author peda
*/
public class RAMFileSystemType implements FileSystemType<RAMFileSystem> {
private static final int DEFAULT_SIZE = 104857600;
-
+
/** the name of this filesystem */
- public static final String NAME = "RAMFS";
+ public static final Class<RAMFileSystemType> NAME = RAMFileSystemType.class;
- /** Virtual Device name for this filesystem */
+ /** Virtual Device name for this filesystem */
public static final String VIRTUAL_DEVICE_NAME = "ramfsdevice";
-
+
/**
* (non-Javadoc)
* @see org.jnode.fs.FileSystemType#getName()
*/
public String getName() {
- return NAME;
+ return "RAMFS";
}
/**
* (non-Javadoc)
- * @see org.jnode.fs.FileSystemType#supports(org.jnode.partitions.PartitionTableEntry, byte[], org.jnode.driver.block.FSBlockDeviceAPI)
- */
- public boolean supports(PartitionTableEntry pte, byte[] firstSector,
- FSBlockDeviceAPI devApi) {
- return false;
- }
-
- /**
- * (non-Javadoc)
* @see org.jnode.fs.FileSystemType#create(org.jnode.driver.Device, boolean)
*/
public RAMFileSystem create(Device device, boolean readOnly)
throws FileSystemException {
-
+
return new RAMFileSystem(device, readOnly, DEFAULT_SIZE);
}
}
Modified: trunk/fs/src/fs/org/jnode/fs/ramfs/def/RAMFSPlugin.java
===================================================================
--- trunk/fs/src/fs/org/jnode/fs/ramfs/def/RAMFSPlugin.java 2008-01-19 22:38:34 UTC (rev 3717)
+++ trunk/fs/src/fs/org/jnode/fs/ramfs/def/RAMFSPlugin.java 2008-01-19 22:48:47 UTC (rev 3718)
@@ -18,6 +18,7 @@
import org.jnode.fs.FileSystemType;
import org.jnode.fs.FSDirectory;
import org.jnode.fs.service.FileSystemService;
+import org.jnode.fs.ramfs.RAMFileSystem;
import org.jnode.fs.ramfs.RAMFileSystemType;
import org.jnode.naming.InitialNaming;
import org.jnode.plugin.Plugin;
@@ -26,7 +27,7 @@
/**
* This plugin creates a new Ram filesystem and mounts it to /jnode/
- *
+ *
* @author peda
*/
public class RAMFSPlugin extends Plugin {
@@ -46,31 +47,31 @@
protected void startPlugin() throws PluginException {
log.info("start ramfs");
-
+
try {
FileSystemService fSS = InitialNaming.lookup(FileSystemService.NAME);
- FileSystemType type = fSS.getFileSystemTypeForNameSystemTypes(RAMFileSystemType.NAME);
+ RAMFileSystemType type = fSS.getFileSystemTypeForNameSystemTypes(RAMFileSystemType.NAME);
try {
VirtualDevice dev = VirtualDeviceFactory.createDevice(RAMFileSystemType.VIRTUAL_DEVICE_NAME);
log.info(dev.getId() + " registered");
-
- final FileSystem fs = type.create(dev, true);
+
+ final RAMFileSystem fs = type.create(dev, true);
fSS.registerFileSystem(fs);
final String mountPath = "jnode";
fSS.mount(mountPath, fs, null);
-
+
log.info("Mounted " + type.getName() + " on " + mountPath);
FSDirectory root_dir = fs.getRootEntry().getDirectory();
root_dir.addDirectory("home");
root_dir.addDirectory("tmp");
-
+
} catch (DeviceAlreadyRegisteredException ex){
log.error("RAMFS is allready running.");
} catch (FileSystemException ex) {
@@ -79,7 +80,7 @@
log.debug("DeviceExeption.", ex);
} catch (IOException ex) {
log.error("Cannot mount RAMFS", ex);
- }
+ }
} catch (NameNotFoundException e){
log.error("filsystemservice / filesystemtype not found");
} catch (FileSystemException e){
@@ -89,22 +90,22 @@
@Override
protected void stopPlugin() throws PluginException {
-
+
log.info("stop RAMFS");
-
+
try {
-
+
FileSystemService fSS = InitialNaming.lookup(FileSystemService.NAME);
-
+
final DeviceManager dm = DeviceUtils.getDeviceManager();
-
+
VirtualDevice dev = (VirtualDevice) dm.getDevice(RAMFileSystemType.VIRTUAL_DEVICE_NAME);
fSS.unregisterFileSystem(dev);
log.info("RAMFS unmounted");
-
+
dm.unregister(dev);
-
+
log.info("RAMFS unregistered");
} catch (NameNotFoundException e){
Modified: trunk/fs/src/fs/org/jnode/fs/service/FileSystemService.java
===================================================================
--- trunk/fs/src/fs/org/jnode/fs/service/FileSystemService.java 2008-01-19 22:38:34 UTC (rev 3717)
+++ trunk/fs/src/fs/org/jnode/fs/service/FileSystemService.java 2008-01-19 22:48:47 UTC (rev 3718)
@@ -9,21 +9,23 @@
* by the Free Software Foundation; either version 2.1 of the License, or
* (at your option) any later version.
*
- * This library is distributed in the hope that it will be useful, but
+ * This library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
* License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
- * along with this library; If not, write to the Free Software Foundation, Inc.,
+ * along with this library; If not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-
+
package org.jnode.fs.service;
import java.io.*;
import java.util.Collection;
+import javax.naming.NameNotFoundException;
+
import org.jnode.driver.Device;
import org.jnode.fs.FileSystem;
import org.jnode.fs.FileSystemException;
@@ -43,26 +45,26 @@
* Gets all registered file system types. All instances of the returned
* collection are instanceof FileSystemType.
*/
- public Collection<FileSystemType> fileSystemTypes();
+ public Collection<FileSystemType<?>> fileSystemTypes();
/**
* Gets registered file system types with the gicen name.
- *
+ *
* @param name the name of the FSType you want
* @return the fileSystemType
*/
- public FileSystemType getFileSystemTypeForNameSystemTypes(String name) throws FileSystemException;
+ public <T extends FileSystemType<?>> T getFileSystemTypeForNameSystemTypes(Class<T> name) throws FileSystemException;
/**
* Register a mounted filesystem
- *
+ *
* @param fs
*/
public void registerFileSystem(FileSystem fs) throws FileSystemException;
/**
* Unregister a mounted filesystem
- *
+ *
* @param device
* @return The filesystem that was registered for the device, or null if not found.
*/
@@ -70,7 +72,7 @@
/**
* Gets the filesystem registered on the given device.
- *
+ *
* @param device
* @return null if no filesystem was found.
*/
@@ -85,21 +87,21 @@
/**
* Mount the given filesystem at the fullPath, using the fsPath as root of
* the to be mounted filesystem.
- *
+ *
* @param fullPath
* @param fs
* @param fsPath Null or empty to use the root of the filesystem.
*/
public void mount(String fullPath, FileSystem fs, String fsPath)
throws IOException;
-
+
/**
* Is the given directory a mount.
* @param fullPath
* @return
*/
public boolean isMount(String fullPath);
-
+
/**
* Gets the filesystem API.
*/
Modified: trunk/fs/src/fs/org/jnode/fs/service/def/FileSystemMounter.java
===================================================================
--- trunk/fs/src/fs/org/jnode/fs/service/def/FileSystemMounter.java 2008-01-19 22:38:34 UTC (rev 3717)
+++ trunk/fs/src/fs/org/jnode/fs/service/def/FileSystemMounter.java 2008-01-19 22:48:47 UTC (rev 3718)
@@ -9,16 +9,16 @@
* by the Free Software Foundation; either version 2.1 of the License, or
* (at your option) any later version.
*
- * This library is distributed in the hope that it will be useful, but
+ * This library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
* License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
- * along with this library; If not, write to the Free Software Foundation, Inc.,
+ * along with this library; If not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-
+
package org.jnode.fs.service.def;
import java.io.File;
@@ -37,6 +37,7 @@
import org.jnode.fs.FileSystem;
import org.jnode.fs.FileSystemException;
import org.jnode.fs.FileSystemType;
+import org.jnode.fs.BlockDeviceFileSystemType;
import org.jnode.fs.service.FileSystemService;
import org.jnode.naming.InitialNaming;
import org.jnode.partitions.PartitionTableEntry;
@@ -48,7 +49,7 @@
* A FileSystemMounter listens to the DeviceManager and once a Device that
* implements the BlockDeviceAPI is started, it tries to mount a FileSystem on
* that device.
- *
+ *
* @author epr
*/
final class FileSystemMounter implements DeviceListener {
@@ -57,27 +58,27 @@
private static final Logger log = Logger.getLogger(FileSystemMounter.class);
private static final String MOUNT_ROOT = "devices";
-
+
/** The DeviceManager i'm listening to */
private DeviceManager devMan;
/** The FileSystemService i'm using */
private final FileSystemService fileSystemService;
-
+
public FileSystemMounter(FileSystemService fileSystemService) {
this.fileSystemService = fileSystemService;
}
/**
* Start the FS mounter.
- *
+ *
* @throws PluginException
*/
public void start() throws PluginException {
try {
// Create the /devices
fileSystemService.getApi().mkDir(MOUNT_ROOT);
-
+
devMan = InitialNaming.lookup(DeviceManager.NAME);
devMan.addListener(this);
} catch (NameNotFoundException ex) {
@@ -130,7 +131,7 @@
/**
* Try to mount a filesystem on the given device.
- *
+ *
* @param device
* @param api
*/
@@ -154,29 +155,32 @@
final PartitionTableEntry ptEntry = api.getPartitionTableEntry();
final ByteBuffer bs = ByteBuffer.allocate(api.getSectorSize());
final String mountPath = File.separatorChar + MOUNT_ROOT + File.separatorChar;
-
+
api.read(0, bs);
for (FileSystemType fst : fileSystemService.fileSystemTypes()) {
- if (fst.supports(ptEntry, bs.array(), api)) {
- try {
- final FileSystem fs = fst.create(device, readOnly);
- fileSystemService.registerFileSystem(fs);
-
- final String fullPath = mountPath + device.getId();
- log.debug("Mounting " + device.getId() + " on " + fullPath);
- fileSystemService.mount(fullPath, fs, null);
-
- log.info("Mounted " + fst.getName() + " on "
- + fullPath);
- return;
- } catch (FileSystemException ex) {
- log.error("Cannot mount " + fst.getName()
- + " filesystem on " + device.getId(), ex);
- } catch (IOException ex) {
- log.error("Cannot mount " + fst.getName()
- + " filesystem on " + device.getId(), ex);
- }
- }
+ if(fst instanceof BlockDeviceFileSystemType)
+ {
+ if (((BlockDeviceFileSystemType)fst).supports(ptEntry, bs.array(), api)) {
+ try {
+ final FileSystem fs = fst.create(device, readOnly);
+ fileSystemService.registerFileSystem(fs);
+
+ final String fullPath = mountPath + device.getId();
+ log.debug("Mounting " + device.getId() + " on " + fullPath);
+ fileSystemService.mount(fullPath, fs, null);
+
+ log.info("Mounted " + fst.getName() + " on "
+ + fullPath);
+ return;
+ } catch (FileSystemException ex) {
+ log.error("Cannot mount " + fst.getName()
+ + " filesystem on " + device.getId(), ex);
+ } catch (IOException ex) {
+ log.error("Cannot mount " + fst.getName()
+ + " filesystem on " + device.getId(), ex...
[truncated message content] |