|
From: <fd...@us...> - 2007-04-15 21:46:07
|
Revision: 3169
http://jnode.svn.sourceforge.net/jnode/?rev=3169&view=rev
Author: fduminy
Date: 2007-04-15 14:46:06 -0700 (Sun, 15 Apr 2007)
Log Message:
-----------
update of JPartition : refactor around stamps-mvc for better separation
of model, view and controller
Modified Paths:
--------------
trunk/fs/src/driver/org/jnode/driver/block/PartitionableBlockDeviceAPI.java
trunk/fs/src/fs/org/jnode/partitions/command/FdiskCommand.java
trunk/fs/src/fs/org/jnode/partitions/command/PartitionHelper.java
Modified: trunk/fs/src/driver/org/jnode/driver/block/PartitionableBlockDeviceAPI.java
===================================================================
--- trunk/fs/src/driver/org/jnode/driver/block/PartitionableBlockDeviceAPI.java 2007-04-15 21:43:33 UTC (rev 3168)
+++ trunk/fs/src/driver/org/jnode/driver/block/PartitionableBlockDeviceAPI.java 2007-04-15 21:46:06 UTC (rev 3169)
@@ -49,4 +49,6 @@
* @throws IOException
*/
public PartitionTable<PTE> getPartitionTable() throws IOException;
+
+ public String toString();
}
Modified: trunk/fs/src/fs/org/jnode/partitions/command/FdiskCommand.java
===================================================================
--- trunk/fs/src/fs/org/jnode/partitions/command/FdiskCommand.java 2007-04-15 21:43:33 UTC (rev 3168)
+++ trunk/fs/src/fs/org/jnode/partitions/command/FdiskCommand.java 2007-04-15 21:46:06 UTC (rev 3169)
@@ -146,7 +146,7 @@
}
final String deviceId = ARG_DEVICE.getValue(cmdLine);
- final PartitionHelper helper = new PartitionHelper(deviceId, dm);
+ final PartitionHelper helper = new PartitionHelper(deviceId);
// initMBR
if (isInitMBR) {
Modified: trunk/fs/src/fs/org/jnode/partitions/command/PartitionHelper.java
===================================================================
--- trunk/fs/src/fs/org/jnode/partitions/command/PartitionHelper.java 2007-04-15 21:43:33 UTC (rev 3168)
+++ trunk/fs/src/fs/org/jnode/partitions/command/PartitionHelper.java 2007-04-15 21:46:06 UTC (rev 3169)
@@ -3,9 +3,13 @@
import java.io.IOException;
import java.nio.ByteBuffer;
+import javax.naming.NameNotFoundException;
+
import org.jnode.driver.ApiNotFoundException;
+import org.jnode.driver.Device;
import org.jnode.driver.DeviceManager;
import org.jnode.driver.DeviceNotFoundException;
+import org.jnode.driver.DeviceUtils;
import org.jnode.driver.DriverException;
import org.jnode.driver.block.BlockDeviceAPI;
import org.jnode.driver.bus.ide.IDEConstants;
@@ -27,21 +31,26 @@
public static final boolean SECTORS = false;
private final IDEDevice current;
- private final DeviceManager dm;
private final BlockDeviceAPI api;
private ByteBuffer MBR;
private BootSector bs;
-
- public PartitionHelper(String deviceId, DeviceManager dm)
+
+ public PartitionHelper(String deviceId)
+ throws DeviceNotFoundException, ApiNotFoundException, IOException, NameNotFoundException
+ {
+ this((IDEDevice)DeviceUtils.getDeviceManager().getDevice(deviceId));
+ }
+
+ public PartitionHelper(IDEDevice device)
throws DeviceNotFoundException, ApiNotFoundException, IOException
{
- this.current = (IDEDevice)dm.getDevice(deviceId);
- this.dm = dm;
+ this.current = device;
this.api = current.getAPI(BlockDeviceAPI.class);
reloadMBR();
}
+
public void initMbr() throws DeviceNotFoundException, ApiNotFoundException,
IOException
@@ -78,15 +87,23 @@
// restart the device
try {
- dm.stop(current);
- dm.start(current);
+ DeviceManager devMan = DeviceUtils.getDeviceManager();
+ devMan.stop(current);
+ devMan.start(current);
} catch (DeviceNotFoundException e) {
e.printStackTrace();
} catch (DriverException e) {
e.printStackTrace();
+ } catch (NameNotFoundException e) {
+ e.printStackTrace();
}
}
+ public boolean hasValidMBR()
+ {
+ return IBMPartitionTable.containsPartitionTable(MBR.array());
+ }
+
private void reloadMBR() throws IOException
{
this.MBR = ByteBuffer.allocate(IDEConstants.SECTOR_SIZE);
@@ -96,7 +113,7 @@
private void checkMBR() throws IOException
{
- if (!IBMPartitionTable.containsPartitionTable(MBR.array()))
+ if (!hasValidMBR())
throw new IOException("This device doesn't contain a valid MBR, use --initmbr.");
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <fd...@us...> - 2008-01-20 11:46:11
|
Revision: 3720
http://jnode.svn.sourceforge.net/jnode/?rev=3720&view=rev
Author: fduminy
Date: 2008-01-20 03:46:08 -0800 (Sun, 20 Jan 2008)
Log Message:
-----------
- in FileSystemService, renamed method getFileSystemTypeForNameSystemTypes to getFileSystemType
- in FileSystemType implementations, renamed NAME to ID
Modified Paths:
--------------
trunk/fs/src/fs/org/jnode/fs/ext2/Ext2FileSystemType.java
trunk/fs/src/fs/org/jnode/fs/fat/FatFileSystemType.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/ISO9660FileSystemType.java
trunk/fs/src/fs/org/jnode/fs/jarfs/JarFileSystemType.java
trunk/fs/src/fs/org/jnode/fs/jfat/FatFileSystemType.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/NFS2FileSystemType.java
trunk/fs/src/fs/org/jnode/fs/ntfs/NTFSFileSystemType.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/FileSystemPlugin.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/test/org/jnode/test/support/TestUtils.java
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:51:32 UTC (rev 3719)
+++ trunk/fs/src/fs/org/jnode/fs/ext2/Ext2FileSystemType.java 2008-01-20 11:46:08 UTC (rev 3720)
@@ -39,7 +39,7 @@
*/
public class Ext2FileSystemType implements BlockDeviceFileSystemType<Ext2FileSystem> {
- public static final Class<Ext2FileSystemType> NAME = Ext2FileSystemType.class;
+ public static final Class<Ext2FileSystemType> ID = Ext2FileSystemType.class;
/**
* @see org.jnode.fs.FileSystemType#create(Device, boolean)
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:51:32 UTC (rev 3719)
+++ trunk/fs/src/fs/org/jnode/fs/fat/FatFileSystemType.java 2008-01-20 11:46:08 UTC (rev 3720)
@@ -36,7 +36,7 @@
public class FatFileSystemType implements BlockDeviceFileSystemType<FatFileSystem> {
/** Name of this filesystem type */
- public static final Class<FatFileSystemType> NAME = FatFileSystemType.class;
+ public static final Class<FatFileSystemType> ID = FatFileSystemType.class;
/**
* Gets the unique name of this file system type.
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:51:32 UTC (rev 3719)
+++ trunk/fs/src/fs/org/jnode/fs/ftpfs/FTPFileSystemType.java 2008-01-20 11:46:08 UTC (rev 3720)
@@ -32,7 +32,7 @@
* @author Levente S\u00e1ntha
*/
public class FTPFileSystemType implements FileSystemType<FTPFileSystem> {
- public static final Class<FTPFileSystemType> NAME = FTPFileSystemType.class;
+ public static final Class<FTPFileSystemType> ID = FTPFileSystemType.class;
/**
* Create a filesystem from a given device.
*
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:51:32 UTC (rev 3719)
+++ trunk/fs/src/fs/org/jnode/fs/ftpfs/command/FTPMountCommand.java 2008-01-20 11:46:08 UTC (rev 3720)
@@ -73,7 +73,7 @@
final DeviceManager dm = DeviceUtils.getDeviceManager();
dm.register(dev);
final FileSystemService fss = InitialNaming.lookup(FileSystemService.NAME);
- FTPFileSystemType type = fss.getFileSystemTypeForNameSystemTypes(FTPFileSystemType.NAME);
+ FTPFileSystemType type = fss.getFileSystemType(FTPFileSystemType.ID);
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/ISO9660FileSystemType.java
===================================================================
--- trunk/fs/src/fs/org/jnode/fs/iso9660/ISO9660FileSystemType.java 2008-01-19 22:51:32 UTC (rev 3719)
+++ trunk/fs/src/fs/org/jnode/fs/iso9660/ISO9660FileSystemType.java 2008-01-20 11:46:08 UTC (rev 3720)
@@ -37,7 +37,7 @@
*/
public class ISO9660FileSystemType implements BlockDeviceFileSystemType<ISO9660FileSystem> {
- public static final Class<ISO9660FileSystemType> NAME = ISO9660FileSystemType.class;
+ public static final Class<ISO9660FileSystemType> ID = ISO9660FileSystemType.class;
public final String getName() {
return "ISO9660";
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:51:32 UTC (rev 3719)
+++ trunk/fs/src/fs/org/jnode/fs/jarfs/JarFileSystemType.java 2008-01-20 11:46:08 UTC (rev 3720)
@@ -36,7 +36,7 @@
*/
public class JarFileSystemType implements FileSystemType<JarFileSystem> {
- public static final Class<JarFileSystemType> NAME = JarFileSystemType.class;
+ public static final Class<JarFileSystemType> ID = JarFileSystemType.class;
public final String getName() {
return "jar";
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:51:32 UTC (rev 3719)
+++ trunk/fs/src/fs/org/jnode/fs/jfat/FatFileSystemType.java 2008-01-20 11:46:08 UTC (rev 3720)
@@ -37,7 +37,7 @@
* @author Tango
*/
public class FatFileSystemType implements BlockDeviceFileSystemType<FatFileSystem> {
- public static final Class<FatFileSystemType> NAME=FatFileSystemType.class;
+ public static final Class<FatFileSystemType> ID=FatFileSystemType.class;
public String getName() {
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:51:32 UTC (rev 3719)
+++ trunk/fs/src/fs/org/jnode/fs/jifs/JIFileSystemType.java 2008-01-20 11:46:08 UTC (rev 3720)
@@ -35,7 +35,7 @@
public class JIFileSystemType implements FileSystemType<JIFileSystem> {
/** Name of this filesystem type */
- public static final Class<JIFileSystemType> NAME = JIFileSystemType.class;
+ public static final Class<JIFileSystemType> ID = JIFileSystemType.class;
public static final String VIRTUAL_DEVICE_NAME = "jifs";
/** Logger*/
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:51:32 UTC (rev 3719)
+++ trunk/fs/src/fs/org/jnode/fs/jifs/def/JIFSPlugin.java 2008-01-20 11:46:08 UTC (rev 3720)
@@ -71,7 +71,7 @@
log.info("start jifs");
try {
FileSystemService fSS = InitialNaming.lookup(FileSystemService.NAME);
- JIFileSystemType type = fSS.getFileSystemTypeForNameSystemTypes(JIFileSystemType.NAME);
+ JIFileSystemType type = fSS.getFileSystemType(JIFileSystemType.ID);
try {
VirtualDevice dev = VirtualDeviceFactory.createDevice(JIFileSystemType.VIRTUAL_DEVICE_NAME);
log.info(dev.getId() + " registered");
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:51:32 UTC (rev 3719)
+++ trunk/fs/src/fs/org/jnode/fs/nfs/command/NFSMountCommand.java 2008-01-20 11:46:08 UTC (rev 3720)
@@ -142,7 +142,7 @@
final FileSystemService fss = InitialNaming
.lookup(FileSystemService.NAME);
NFS2FileSystemType type = fss
- .getFileSystemTypeForNameSystemTypes(NFS2FileSystemType.NAME);
+ .getFileSystemType(NFS2FileSystemType.ID);
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/NFS2FileSystemType.java
===================================================================
--- trunk/fs/src/fs/org/jnode/fs/nfs/nfs2/NFS2FileSystemType.java 2008-01-19 22:51:32 UTC (rev 3719)
+++ trunk/fs/src/fs/org/jnode/fs/nfs/nfs2/NFS2FileSystemType.java 2008-01-20 11:46:08 UTC (rev 3720)
@@ -31,7 +31,7 @@
* @author Andrei Dore
*/
public class NFS2FileSystemType implements FileSystemType<NFS2FileSystem> {
- public static final Class<NFS2FileSystemType> NAME = NFS2FileSystemType.class;
+ public static final Class<NFS2FileSystemType> ID = NFS2FileSystemType.class;
/**
* Create a filesystem from a given device.
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:51:32 UTC (rev 3719)
+++ trunk/fs/src/fs/org/jnode/fs/ntfs/NTFSFileSystemType.java 2008-01-20 11:46:08 UTC (rev 3720)
@@ -37,7 +37,7 @@
*/
public class NTFSFileSystemType implements BlockDeviceFileSystemType<NTFSFileSystem> {
- public static final Class<NTFSFileSystemType> NAME = NTFSFileSystemType.class;
+ public static final Class<NTFSFileSystemType> ID = NTFSFileSystemType.class;
public static final String TAG = "NTFS";
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:51:32 UTC (rev 3719)
+++ trunk/fs/src/fs/org/jnode/fs/ramfs/RAMFileSystemType.java 2008-01-20 11:46:08 UTC (rev 3720)
@@ -16,7 +16,7 @@
private static final int DEFAULT_SIZE = 104857600;
/** the name of this filesystem */
- public static final Class<RAMFileSystemType> NAME = RAMFileSystemType.class;
+ public static final Class<RAMFileSystemType> ID = RAMFileSystemType.class;
/** Virtual Device name for this filesystem */
public static final String VIRTUAL_DEVICE_NAME = "ramfsdevice";
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:51:32 UTC (rev 3719)
+++ trunk/fs/src/fs/org/jnode/fs/ramfs/def/RAMFSPlugin.java 2008-01-20 11:46:08 UTC (rev 3720)
@@ -51,7 +51,7 @@
try {
FileSystemService fSS = InitialNaming.lookup(FileSystemService.NAME);
- RAMFileSystemType type = fSS.getFileSystemTypeForNameSystemTypes(RAMFileSystemType.NAME);
+ RAMFileSystemType type = fSS.getFileSystemType(RAMFileSystemType.ID);
try {
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:51:32 UTC (rev 3719)
+++ trunk/fs/src/fs/org/jnode/fs/service/FileSystemService.java 2008-01-20 11:46:08 UTC (rev 3720)
@@ -53,7 +53,7 @@
* @param name the name of the FSType you want
* @return the fileSystemType
*/
- public <T extends FileSystemType<?>> T getFileSystemTypeForNameSystemTypes(Class<T> name) throws FileSystemException;
+ public <T extends FileSystemType<?>> T getFileSystemType(Class<T> name) throws FileSystemException;
/**
* Register a mounted filesystem
Modified: trunk/fs/src/fs/org/jnode/fs/service/def/FileSystemPlugin.java
===================================================================
--- trunk/fs/src/fs/org/jnode/fs/service/def/FileSystemPlugin.java 2008-01-19 22:51:32 UTC (rev 3719)
+++ trunk/fs/src/fs/org/jnode/fs/service/def/FileSystemPlugin.java 2008-01-20 11:46:08 UTC (rev 3720)
@@ -207,9 +207,9 @@
}
/**
- * @see org.jnode.fs.service.FileSystemService#getFileSystemTypeForNameSystemTypes(java.lang.String)
+ * @see org.jnode.fs.service.FileSystemService#getFileSystemType(java.lang.String)
*/
- public <T extends FileSystemType<?>> T getFileSystemTypeForNameSystemTypes(Class<T> name) throws FileSystemException
+ public <T extends FileSystemType<?>> T getFileSystemType(Class<T> name) throws FileSystemException
{
T result = fsTypeManager.getSystemType(name);
if (result == null)
Modified: trunk/fs/src/fs/org/jnode/fs/smbfs/SMBFileSystemType.java
===================================================================
--- trunk/fs/src/fs/org/jnode/fs/smbfs/SMBFileSystemType.java 2008-01-19 22:51:32 UTC (rev 3719)
+++ trunk/fs/src/fs/org/jnode/fs/smbfs/SMBFileSystemType.java 2008-01-20 11:46:08 UTC (rev 3720)
@@ -31,7 +31,7 @@
* @author Levente S\u00e1ntha
*/
public class SMBFileSystemType implements FileSystemType<SMBFileSystem> {
- public static final Class<SMBFileSystemType> NAME = SMBFileSystemType.class;
+ public static final Class<SMBFileSystemType> ID = SMBFileSystemType.class;
/**
* Create a filesystem from a given device.
Modified: trunk/fs/src/fs/org/jnode/fs/smbfs/command/SMBMountCommand.java
===================================================================
--- trunk/fs/src/fs/org/jnode/fs/smbfs/command/SMBMountCommand.java 2008-01-19 22:51:32 UTC (rev 3719)
+++ trunk/fs/src/fs/org/jnode/fs/smbfs/command/SMBMountCommand.java 2008-01-20 11:46:08 UTC (rev 3720)
@@ -76,7 +76,7 @@
final DeviceManager dm = DeviceUtils.getDeviceManager();
dm.register(dev);
final FileSystemService fss = InitialNaming.lookup(FileSystemService.NAME);
- SMBFileSystemType type = fss.getFileSystemTypeForNameSystemTypes(SMBFileSystemType.NAME);
+ SMBFileSystemType type = fss.getFileSystemType(SMBFileSystemType.ID);
final SMBFileSystem fs = type.create(dev, true);
fss.registerFileSystem(fs);
fss.mount(mount_point, fs, null);
Modified: trunk/fs/src/test/org/jnode/test/support/TestUtils.java
===================================================================
--- trunk/fs/src/test/org/jnode/test/support/TestUtils.java 2008-01-19 22:51:32 UTC (rev 3719)
+++ trunk/fs/src/test/org/jnode/test/support/TestUtils.java 2008-01-20 11:46:08 UTC (rev 3720)
@@ -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.test.support;
import java.io.File;
@@ -394,7 +394,7 @@
* FileSystemService fileSystemService = (FileSystemService)
* InitialNaming .lookup(FileSystemService.NAME); FileSystemType type =
* fileSystemService
- * .getFileSystemTypeForNameSystemTypes(FatFileSystemType.NAME);
+ * .getFileSystemType(FatFileSystemType.NAME);
* type.format(dev, new Integer(Fat.FAT16)); // restart the device
* log.info("Restart initrd ramdisk"); dm.stop(dev); dm.start(dev);
*/
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|