net.aerith.misao.database
Class MagnitudeDBManager

java.lang.Object
  |
  +--net.aerith.misao.util.OperationObservable
        |
        +--net.aerith.misao.database.CatalogTreeManager
              |
              +--net.aerith.misao.database.MagnitudeDBManager

public class MagnitudeDBManager
extends CatalogTreeManager

The MagnitudeDBManager represents a database manager of the magnitude data.

The database is classified by the star name.


Field Summary
protected  FileManager file_manager
          The file manager.
protected  FileSystem file_system
          The file system of the database.
 
Fields inherited from class net.aerith.misao.database.CatalogTreeManager
EXCLUDE_SUBFOLDERS, INCLUDE_SUBFOLDERS
 
Fields inherited from class net.aerith.misao.util.OperationObservable
observer_list
 
Constructor Summary
MagnitudeDBManager(FileSystem file_system, FileManager file_manager)
          Constructs a MagnitudeDBManager in the specified file system.
 
Method Summary
 void addElement(CatalogStar star, XmlMagRecord record)
          Adds the magnitude record.
protected  Folder createDBFolder(CatalogStar star)
          Creates the database folder.
 XmlMagRecord deleteElement(CatalogStar star, XmlMagRecord record)
          Deletes the magnitude record.
protected  java.util.Vector getCatalogSubfolders(java.util.Vector folder_list)
          Gets the sub folders in the specified path.
 java.lang.String getDBFolder()
          Gets the top folder of the database.
 XmlMagRecord[] getElements(CatalogStar star)
          Gets the magnitude records of the specified star.
protected  XmlMagRecord[] getElements(Folder db_folder)
          Gets the magnitude records in the specified folder.
protected  java.util.Hashtable getHierarchy(int method)
          Gets the folder hierarchy of the database.
protected  java.util.Vector getStars(java.util.Vector folder_list)
          Gets the stars in the specified path.
 java.util.Vector seekVariable(Folder folder, VariabilityChecker checker)
          Browses the specified folder in the magnitude database recurrsively and seeks the variable stars.
 java.util.Vector seekVariable(VariabilityChecker checker)
          Browses whole of the magnitude database and seeks the variable stars.
 void setFileManager(FileManager file_manager)
          Sets a file manager.
private  void setHierarchy(java.util.Hashtable hash, Folder folder, int level)
          Sets the folder hierarchy of the magnitude database recurrsively.
 
Methods inherited from class net.aerith.misao.database.CatalogTreeManager
getCatalogHierarchy, getCatalogSubfolders, getStars
 
Methods inherited from class net.aerith.misao.util.OperationObservable
addObserver, deleteObserver, notifyEnd, notifyFailed, notifyStart, notifySucceeded, notifyWarned
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

file_system

protected FileSystem file_system
The file system of the database.

file_manager

protected FileManager file_manager
The file manager.
Constructor Detail

MagnitudeDBManager

public MagnitudeDBManager(FileSystem file_system,
                          FileManager file_manager)
Constructs a MagnitudeDBManager in the specified file system.
Parameters:
file_system - the file system to create the database.
file_manager - the file manager.
Method Detail

setFileManager

public void setFileManager(FileManager file_manager)
Sets a file manager.
Parameters:
file_manager - the file manager.

getDBFolder

public java.lang.String getDBFolder()
Gets the top folder of the database.
Returns:
the top folder of the database.

addElement

public void addElement(CatalogStar star,
                       XmlMagRecord record)
                throws java.io.IOException
Adds the magnitude record.
Parameters:
star - the catalog star.
record - the magnitude record.
Throws:
java.io.IOException - if I/O error occurs.

deleteElement

public XmlMagRecord deleteElement(CatalogStar star,
                                  XmlMagRecord record)
                           throws java.io.IOException
Deletes the magnitude record.
Parameters:
star - the catalog star.
record - the magnitude record.
Returns:
the deleted magnitude record, or null if the record does not exist.
Throws:
java.io.IOException - if I/O error occurs.

getElements

public XmlMagRecord[] getElements(CatalogStar star)
                           throws java.io.IOException
Gets the magnitude records of the specified star.
Parameters:
star - the catalog star.
Throws:
java.io.IOException - if I/O error occurs.

getElements

protected XmlMagRecord[] getElements(Folder db_folder)
                              throws java.io.IOException
Gets the magnitude records in the specified folder.
Parameters:
db_folder - the database folder.
Throws:
java.io.IOException - if I/O error occurs.

createDBFolder

protected Folder createDBFolder(CatalogStar star)
                         throws java.io.IOException
Creates the database folder.
Parameters:
star - the catalog star.
Returns:
the database folder.
Throws:
java.io.IOException - if I/O error occurs.

seekVariable

public java.util.Vector seekVariable(VariabilityChecker checker)
                              throws java.io.IOException
Browses whole of the magnitude database and seeks the variable stars.
Parameters:
checker - the checker of the variability.
Returns:
the list of variable stars and the variability information.
Throws:
java.io.IOException - if I/O error occurs.

seekVariable

public java.util.Vector seekVariable(Folder folder,
                                     VariabilityChecker checker)
                              throws java.io.IOException
Browses the specified folder in the magnitude database recurrsively and seeks the variable stars.
Parameters:
folder - the folder to seek.
checker - the checker of the variability.
Returns:
the list of variable stars and the variability information.
Throws:
java.io.IOException - if I/O error occurs.

getHierarchy

protected java.util.Hashtable getHierarchy(int method)
                                    throws java.io.IOException
Gets the folder hierarchy of the database.
Overrides:
getHierarchy in class CatalogTreeManager
Parameters:
method - the method.
Returns:
the hash table which contains the folder hierarchy.
Throws:
java.io.IOException - if I/O error occurs.

setHierarchy

private void setHierarchy(java.util.Hashtable hash,
                          Folder folder,
                          int level)
Sets the folder hierarchy of the magnitude database recurrsively.
Parameters:
hash - the hash table to set the hierarchy.
folder - the folder.
level - the acceptable nest level.

getCatalogSubfolders

protected java.util.Vector getCatalogSubfolders(java.util.Vector folder_list)
                                         throws java.io.IOException
Gets the sub folders in the specified path.
Overrides:
getCatalogSubfolders in class CatalogTreeManager
Parameters:
folder_list - the list of folders.
Returns:
the list of sub folders.
Throws:
java.io.IOException - if I/O error occurs.

getStars

protected java.util.Vector getStars(java.util.Vector folder_list)
                             throws java.io.IOException,
                                    java.lang.ClassNotFoundException,
                                    java.lang.IllegalAccessException,
                                    java.lang.InstantiationException
Gets the stars in the specified path.
Overrides:
getStars in class CatalogTreeManager
Parameters:
folder_list - the list of folders.
Returns:
the list of stars.
Throws:
java.io.IOException - if I/O error occurs.
java.lang.ClassNotFoundException - if the star class recorded in the XML document is not found.
java.lang.IllegalAccessException - if the class or initializer is not accessible.
java.lang.InstantiationException - if an application tries to instantiate an abstract class or an interface, or if the instantiation fails for some other reason.