net.aerith.misao.database
Class CatalogDBManager

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

public class CatalogDBManager
extends CatalogTreeManager

The CatalogDBManager represents a database manager of the catalog stars.

The database consists of two parts with different classification policies. One is classified by the star name. Another one is by the R.A. and Decl.


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
CatalogDBManager(FileSystem file_system, FileManager file_manager)
          Constructs a CatalogDBManager in the specified file system.
 
Method Summary
 void addElement(CatalogStar star)
          Adds the catalog star.
 void addElements(java.util.Vector list_stars)
          Adds the catalog stars.
protected  Folder createNameOrientedDBFolder(CatalogStar star)
          Creates the database folder classified by the star name.
protected  Folder createPositionOrientedDBFolder(Coor coor)
          Creates the database folder classified by the position.
 void deleteElement(CatalogStar star)
          Deletes the catalog star.
 void deleteElements(java.util.Hashtable hash_stars)
          Deletes the catalog stars.
 CatalogDBAccessor getAccessor(Coor coor, double radius)
          Gets the sequential accessor to the catalog star records within the specified circular area.
protected  java.util.Vector getCatalogSubfolders(java.util.Vector folder_list)
          Gets the sub folders in the specified path.
 CatalogStar getElement(CatalogStar star)
          Gets the catalog star in the database.
 CatalogStar getElement(java.util.Vector mag_folder_hierarchy)
          Gets the catalog star indicated by the specified path in the magnitude database.
 java.util.Vector getElements(java.util.Vector folder_list)
          Gets the elements in the specified path in the name oriented database.
protected  java.util.Hashtable getHierarchy(int method)
          Gets the folder hierarchy of the database.
protected  java.lang.String getNameOrientedDBFolder()
          Gets the top folder of the database classified by the star name.
protected  java.lang.String getPositionOrientedDBFolder()
          Gets the top folder of the database classified by the position.
protected  java.util.Vector getStars(java.util.Vector folder_list)
          Gets the stars in the specified path.
 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 catalog 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

CatalogDBManager

public CatalogDBManager(FileSystem file_system,
                        FileManager file_manager)
Constructs a CatalogDBManager 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.

getNameOrientedDBFolder

protected java.lang.String getNameOrientedDBFolder()
Gets the top folder of the database classified by the star name.
Returns:
the top folder of the database classified by the star name.

getPositionOrientedDBFolder

protected java.lang.String getPositionOrientedDBFolder()
Gets the top folder of the database classified by the position.
Returns:
the top folder of the database classified by the position.

addElement

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

addElements

public void addElements(java.util.Vector list_stars)
                 throws java.io.IOException
Adds the catalog stars.
Parameters:
list_stars - the list of catalog stars.
Throws:
java.io.IOException - if I/O error occurs.

deleteElement

public void deleteElement(CatalogStar star)
                   throws java.io.IOException
Deletes the catalog star.
Parameters:
star - the catalog star.
Throws:
java.io.IOException - if I/O error occurs.

deleteElements

public void deleteElements(java.util.Hashtable hash_stars)
                    throws java.io.IOException
Deletes the catalog stars.
Parameters:
hash_stars - the hash table of the catalog stars to delete.
Throws:
java.io.IOException - if I/O error occurs.

getElement

public CatalogStar getElement(CatalogStar star)
                       throws java.io.IOException,
                              java.lang.ClassNotFoundException,
                              java.lang.IllegalAccessException,
                              java.lang.InstantiationException
Gets the catalog star in the database.
Parameters:
star - the catalog star.
Returns:
the catalog star in the database.
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.

getElement

public CatalogStar getElement(java.util.Vector mag_folder_hierarchy)
                       throws java.io.IOException,
                              java.lang.ClassNotFoundException,
                              java.lang.IllegalAccessException,
                              java.lang.InstantiationException
Gets the catalog star indicated by the specified path in the magnitude database.
Parameters:
mag_folder_hierarchy - the folder hierarchy in the magnitude database.
Returns:
the catalog star object.
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.

getElements

public java.util.Vector getElements(java.util.Vector folder_list)
                             throws java.io.IOException,
                                    java.lang.ClassNotFoundException,
                                    java.lang.IllegalAccessException,
                                    java.lang.InstantiationException
Gets the elements in the specified path in the name oriented database.
Parameters:
folder_list - the folder hierarchy.
Returns:
the list of elements.
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.

createNameOrientedDBFolder

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

createPositionOrientedDBFolder

protected Folder createPositionOrientedDBFolder(Coor coor)
                                         throws java.io.IOException
Creates the database folder classified by the position.
Parameters:
coor - the R.A. and Decl.
Returns:
the database folder.
Throws:
java.io.IOException - if I/O error occurs.

getAccessor

public CatalogDBAccessor getAccessor(Coor coor,
                                     double radius)
Gets the sequential accessor to the catalog star records within the specified circular area.
Parameters:
coor - the R.A. and Decl. of the center.
radius - the radius in degree.
Returns:
the sequential accessor.

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 catalog 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.