net.aerith.misao.io
Class DiskFileSystem

java.lang.Object
  |
  +--net.aerith.misao.io.DiskFileSystem

public class DiskFileSystem
extends java.lang.Object
implements FileSystem

The DiskFileSystem represents a directory on the real file system on the disk drive.


Field Summary
protected  java.io.File db_folder
          The directory.
 
Constructor Summary
DiskFileSystem(java.io.File db_folder)
          Constructs a DiskFileSystem.
 
Method Summary
 Folder createHierarchicalFolder(java.util.Vector folder_list)
          Creates the folder hierarchy and returns the folder.
 void discard()
          Discards the file system.
private  boolean discard(java.io.File file)
          Discards the specified folder.
 Folder getFolder(java.lang.String name)
          Gets the top folder.
 Folder getHierarchicalFolder(java.util.Vector folder_list)
          Gets the folder represented by the specified hierarchy.
 PrimitiveManager getPrimitiveManager(Folder folder, XmlDBHolder holder_class, XmlDBRecord record_class)
          Gets the new PrimitiveManager of the specified folder.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

db_folder

protected java.io.File db_folder
The directory.
Constructor Detail

DiskFileSystem

public DiskFileSystem(java.io.File db_folder)
               throws java.io.IOException
Constructs a DiskFileSystem.
Parameters:
db_folder - the directory.
Throws:
java.io.IOException - if I/O error occurs.
Method Detail

getFolder

public Folder getFolder(java.lang.String name)
Gets the top folder.
Specified by:
getFolder in interface FileSystem
Parameters:
name - the folder name.
Returns:
the folder.

getHierarchicalFolder

public Folder getHierarchicalFolder(java.util.Vector folder_list)
Gets the folder represented by the specified hierarchy.
Specified by:
getHierarchicalFolder in interface FileSystem
Parameters:
folder_list - the list of hierarchical folders.
Returns:
the terminal folder.

createHierarchicalFolder

public Folder createHierarchicalFolder(java.util.Vector folder_list)
                                throws java.io.IOException
Creates the folder hierarchy and returns the folder.
Specified by:
createHierarchicalFolder in interface FileSystem
Parameters:
folder_list - the list of hierarchical folders.
Returns:
the terminal folder.
Throws:
java.io.IOException - if I/O error occurs.

getPrimitiveManager

public PrimitiveManager getPrimitiveManager(Folder folder,
                                            XmlDBHolder holder_class,
                                            XmlDBRecord record_class)
                                     throws java.io.IOException
Gets the new PrimitiveManager of the specified folder.
Specified by:
getPrimitiveManager in interface FileSystem
Parameters:
folder - the folder.
holder_class - the holder class object of the XML records.
record_class - the class object of the XML records.
Throws:
java.io.IOException - if I/O error occurs.

discard

public void discard()
             throws java.io.IOException
Discards the file system. All files and directories in the file system removed.
Specified by:
discard in interface FileSystem
Throws:
java.io.IOException - if I/O error occurs.

discard

private boolean discard(java.io.File file)
Discards the specified folder. All files and directories in the specified folder are removed.
Parameters:
file - the file or directory.
Returns:
true if all files and directories are successfully deleted.