net.aerith.misao.database
Class InformationDBManager

java.lang.Object
  |
  +--net.aerith.misao.database.InformationDBManager

public class InformationDBManager
extends java.lang.Object

The InformationDBManager represents a database manager of the image information.

The database consists of three parts with different classification policies. One is classified by XML file path. Another one is by image date. And the other one is by the limiting magnitude, the field of view, and the R.A. and Decl. of the image center.


Field Summary
protected  FileManager file_manager
          The file manager.
protected  FileSystem file_system
          The file system of the database.
 
Constructor Summary
InformationDBManager(FileSystem file_system, FileManager file_manager)
          Constructs an InformationDBManager in the specified file system.
 
Method Summary
 void addElement(java.io.File xml_file, XmlInformation info)
          Adds the image information.
protected  Folder createDateOrientedDBFolder(JulianDay jd)
          Creates the database folder classified by the image date.
protected  Folder createFieldOrientedDBFolder(double limit_mag, double field_radius, Coor center_coor)
          Creates the database folder classified by the field.
protected  Folder createPathOrientedDBFolder(java.lang.String xml_path)
          Creates the database folder classified by the XML file path.
 XmlInformation deleteElement(java.lang.String xml_path)
          Deletes the image information.
 InformationDBAccessor getAccessor()
          Gets the sequential accessor to all the XML image information element in the database.
 InformationDBAccessor getAccessor(CelestialDivisionMap map, double brightest_limiting_mag, double faintest_limiting_mag)
          Gets the sequential accessor to the XML image information element which overlaps the specified map.
 InformationDBAccessor getAccessor(Coor coor, double brightest_limiting_mag, double faintest_limiting_mag)
          Gets the sequential accessor to the XML image information element which covers the specified R.A.
protected  XmlDBAccessor getAccessor(java.lang.String base_folder, java.util.Vector folder_list)
          Gets the sequential accessor to the XML image information elements in the specified folder hierarchy.
 InformationDBAccessor getAccessor(java.util.Vector info_list, double brightest_limiting_mag, double faintest_limiting_mag)
          Gets the sequential accessor to the XML image information element which overlaps on any images in the specified list.
 XmlDBAccessor getDateOrientedAccessor(java.util.Vector folder_list)
          Gets the sequential accessor to the XML image information elements in the specified folder hierarchy in the date oriented database.
protected  java.lang.String getDateOrientedDBFolder()
          Gets the top folder of the database classified by the image date.
 java.util.Vector getDateOrientedFolders(java.util.Vector folder_list)
          Gets the sub folders under the specified folder hierarchy in the date oriented database.
 XmlInformation getElement(java.lang.String xml_path)
          Gets the image information of the specified XML file path.
protected  java.lang.String getFieldOrientedDBFolder()
          Gets the top folder of the database classified by the field.
protected  java.util.Vector getFolders(java.lang.String base_folder, java.util.Vector folder_list)
          Gets the sub folders under the specified folder hierarchy.
 java.lang.String getPath(java.io.File file)
          Gets the relative path of the XML file.
 XmlDBAccessor getPathOrientedAccessor(java.util.Vector folder_list)
          Gets the sequential accessor to the XML image information elements in the specified folder hierarchy in the path oriented database.
protected  java.lang.String getPathOrientedDBFolder()
          Gets the top folder of the database classified by the XML file path.
 java.util.Vector getPathOrientedFolders(java.util.Vector folder_list)
          Gets the sub folders under the specified folder hierarchy in the path oriented database.
 void setFileManager(FileManager file_manager)
          Sets a file manager.
 
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

InformationDBManager

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

getPathOrientedDBFolder

protected java.lang.String getPathOrientedDBFolder()
Gets the top folder of the database classified by the XML file path.
Returns:
the top folder of the database classified by the XML file path.

getDateOrientedDBFolder

protected java.lang.String getDateOrientedDBFolder()
Gets the top folder of the database classified by the image date.
Returns:
the top folder of the database classified by the image date

getFieldOrientedDBFolder

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

getPath

public java.lang.String getPath(java.io.File file)
Gets the relative path of the XML file.
Parameters:
file - the XML file.
Returns:
the relative path of the XML file.

addElement

public void addElement(java.io.File xml_file,
                       XmlInformation info)
                throws java.io.IOException,
                       DocumentIncompleteException,
                       DuplicatedException
Adds the image information.
Parameters:
xml_file - the XML file which contains the specified information.
info - the image information to add to the database.
Throws:
java.io.IOException - if I/O error occurs.
DocumentIncompleteException - if some required data in the specified image information is not recorded.
DuplicatedException - if the specified data is already in the database.

deleteElement

public XmlInformation deleteElement(java.lang.String xml_path)
                             throws java.io.IOException
Deletes the image information.
Parameters:
xml_path - the XML file path.
Returns:
the deleted image information, or null if the image information represented by the specified file does not exist.
Throws:
java.io.IOException - if I/O error occurs.

getElement

public XmlInformation getElement(java.lang.String xml_path)
                          throws java.io.IOException
Gets the image information of the specified XML file path.
Parameters:
xml_path - the XML file path.
Returns:
the image information.
Throws:
java.io.IOException - if I/O error occurs.

createPathOrientedDBFolder

protected Folder createPathOrientedDBFolder(java.lang.String xml_path)
                                     throws java.io.IOException
Creates the database folder classified by the XML file path.
Parameters:
xml_path - the path of the XML file.
Returns:
the database folder.
Throws:
java.io.IOException - if I/O error occurs.

createDateOrientedDBFolder

protected Folder createDateOrientedDBFolder(JulianDay jd)
                                     throws java.io.IOException
Creates the database folder classified by the image date.
Parameters:
jd - the image data.
Returns:
the database folder.
Throws:
java.io.IOException - if I/O error occurs.

createFieldOrientedDBFolder

protected Folder createFieldOrientedDBFolder(double limit_mag,
                                             double field_radius,
                                             Coor center_coor)
                                      throws java.io.IOException
Creates the database folder classified by the field.
Parameters:
limit_mag - the limiting magnitude.
field_radius - the field radius in degree.
center_coor - the R.A. and Decl. of the center.
Returns:
the database folder.
Throws:
java.io.IOException - if I/O error occurs.

getDateOrientedFolders

public java.util.Vector getDateOrientedFolders(java.util.Vector folder_list)
                                        throws java.io.IOException
Gets the sub folders under the specified folder hierarchy in the date oriented database.
Parameters:
folder_list - the folder hierarchy.
Returns:
the list of sub folders.
Throws:
java.io.IOException - if I/O error occurs.

getPathOrientedFolders

public java.util.Vector getPathOrientedFolders(java.util.Vector folder_list)
                                        throws java.io.IOException
Gets the sub folders under the specified folder hierarchy in the path oriented database.
Parameters:
folder_list - the folder hierarchy.
Returns:
the list of sub folders.
Throws:
java.io.IOException - if I/O error occurs.

getFolders

protected java.util.Vector getFolders(java.lang.String base_folder,
                                      java.util.Vector folder_list)
                               throws java.io.IOException
Gets the sub folders under the specified folder hierarchy.
Parameters:
folder_list - the folder hierarchy.
Returns:
the list of sub folders.
Throws:
java.io.IOException - if I/O error occurs.

getDateOrientedAccessor

public XmlDBAccessor getDateOrientedAccessor(java.util.Vector folder_list)
                                      throws java.io.IOException
Gets the sequential accessor to the XML image information elements in the specified folder hierarchy in the date oriented database.
Parameters:
folder_list - the folder hierarchy.
Returns:
the sequential accessor.
Throws:
java.io.IOException - if I/O error occurs.

getPathOrientedAccessor

public XmlDBAccessor getPathOrientedAccessor(java.util.Vector folder_list)
                                      throws java.io.IOException
Gets the sequential accessor to the XML image information elements in the specified folder hierarchy in the path oriented database.
Parameters:
folder_list - the folder hierarchy.
Returns:
the sequential accessor.
Throws:
java.io.IOException - if I/O error occurs.

getAccessor

protected XmlDBAccessor getAccessor(java.lang.String base_folder,
                                    java.util.Vector folder_list)
                             throws java.io.IOException
Gets the sequential accessor to the XML image information elements in the specified folder hierarchy.
Parameters:
folder_list - the folder hierarchy.
Returns:
the sequential accessor.
Throws:
java.io.IOException - if I/O error occurs.

getAccessor

public InformationDBAccessor getAccessor()
Gets the sequential accessor to all the XML image information element in the database.
Returns:
the sequential accessor.

getAccessor

public InformationDBAccessor getAccessor(Coor coor,
                                         double brightest_limiting_mag,
                                         double faintest_limiting_mag)
Gets the sequential accessor to the XML image information element which covers the specified R.A. and Decl.
Parameters:
coor - the R.A. and Decl.
brightest_limiting_mag - the brighter limit of the limiting magnitude.
faintest_limiting_mag - the fainter limit of the limiting magnitude.
Returns:
the sequential accessor.

getAccessor

public InformationDBAccessor getAccessor(java.util.Vector info_list,
                                         double brightest_limiting_mag,
                                         double faintest_limiting_mag)
Gets the sequential accessor to the XML image information element which overlaps on any images in the specified list.
Parameters:
info_list - the list of image information elements.
brightest_limiting_mag - the brighter limit of the limiting magnitude.
faintest_limiting_mag - the fainter limit of the limiting magnitude.
Returns:
the sequential accessor.

getAccessor

public InformationDBAccessor getAccessor(CelestialDivisionMap map,
                                         double brightest_limiting_mag,
                                         double faintest_limiting_mag)
Gets the sequential accessor to the XML image information element which overlaps the specified map.
Parameters:
map - the celestial map. elements.
brightest_limiting_mag - the brighter limit of the limiting magnitude.
faintest_limiting_mag - the fainter limit of the limiting magnitude.
Returns:
the sequential accessor.