net.aerith.misao.database
Class GlobalDBManager

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

public class GlobalDBManager
extends OperationObservable

The GlobalDBManager represents a manager of all the databases of the PIXY System. The database consists of the image information database, the catalog database and the magnitude database.


Field Summary
protected  CatalogDBManager catalog_manager
          The catalog database.
protected  FileManager file_manager
          The file manager.
protected  FileSystem file_system
          The file system of the database.
protected  InformationDBManager info_manager
          The image information database.
protected  MagnitudeDBManager mag_manager
          The magnitude database.
protected  MonitorSet monitor_set
          The set of monitors.
protected  boolean raw_database
          True in the case of raw database of detected stars.
protected  boolean update_reported_mag
          True when to update already reported magnitude.
 
Fields inherited from class net.aerith.misao.util.OperationObservable
observer_list
 
Constructor Summary
GlobalDBManager()
          Constructs a GlobalDBManager in the system default folder.
GlobalDBManager(FileSystem file_system)
          Constructs a GlobalDBManager in the specified file system.
 
Method Summary
 void addInformation(java.io.File xml_file, XmlInformation info)
          Adds only the information element in the XML report document into the database.
 void addMagnitude(XmlReport report, java.util.Vector catalog_list)
          Adds the magnitude data in the specified XML report document into the magnitude database.
 void addMonitor(Monitor monitor)
          Adds a monitor.
 void addReport(java.io.File xml_file, XmlReport report)
          Adds the XML report document.
 void deleteMagnitude(XmlReport report, java.util.Vector catalog_list)
          Deletes the magnitude data in the specified XML report document from the magnitude database.
 void discard()
          Discards the database.
 void enableReportedMagnitudeUpdate(boolean flag)
          Enables/disables to update already reported magnitude.
 CatalogDBManager getCatalogDBManager()
          Gets the catalog database manager.
 InformationDBManager getInformationDBManager()
          Gets the image information database manager.
 MagnitudeDBManager getMagnitudeDBManager()
          Gets the magnitude database manager.
 void setFileManager(FileManager file_manager)
          Sets a file manager.
 void setRawDatabase(boolean flag)
          Sets the flag to indicate whether to be a raw database of detected stars.
private  void updateMagnitude(XmlReport report, java.util.Vector catalog_list, boolean add_flag)
          Updates the magnitude data in the specified XML report document in the magnitude database.
 
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.

info_manager

protected InformationDBManager info_manager
The image information database.

catalog_manager

protected CatalogDBManager catalog_manager
The catalog database.

mag_manager

protected MagnitudeDBManager mag_manager
The magnitude database.

file_manager

protected FileManager file_manager
The file manager.

monitor_set

protected MonitorSet monitor_set
The set of monitors.

update_reported_mag

protected boolean update_reported_mag
True when to update already reported magnitude.

raw_database

protected boolean raw_database
True in the case of raw database of detected stars.
Constructor Detail

GlobalDBManager

public GlobalDBManager()
                throws java.io.IOException
Constructs a GlobalDBManager in the system default folder.
Throws:
java.io.IOException - if I/O error occurs.

GlobalDBManager

public GlobalDBManager(FileSystem file_system)
                throws java.io.IOException
Constructs a GlobalDBManager in the specified file system.
Parameters:
file_system - the file system to create the database.
Throws:
java.io.IOException - if I/O error occurs.
Method Detail

setFileManager

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

addMonitor

public void addMonitor(Monitor monitor)
Adds a monitor.
Parameters:
monitor - the monitor.

enableReportedMagnitudeUpdate

public void enableReportedMagnitudeUpdate(boolean flag)
Enables/disables to update already reported magnitude.
Parameters:
flag - true when to update already reported magnitude.

setRawDatabase

public void setRawDatabase(boolean flag)
Sets the flag to indicate whether to be a raw database of detected stars.
Parameters:
flag - true in the case of raw database of detected stars.

discard

public void discard()
             throws java.io.IOException
Discards the database. All files and directories in the database folder are removed.
Throws:
java.io.IOException - if I/O error occurs.

getInformationDBManager

public InformationDBManager getInformationDBManager()
Gets the image information database manager.
Returns:
the image information database manager.

getCatalogDBManager

public CatalogDBManager getCatalogDBManager()
Gets the catalog database manager.
Returns:
the catalog database manager.

getMagnitudeDBManager

public MagnitudeDBManager getMagnitudeDBManager()
Gets the magnitude database manager.
Returns:
the magnitude database manager.

addReport

public void addReport(java.io.File xml_file,
                      XmlReport report)
               throws java.io.IOException,
                      DocumentIncompleteException,
                      DuplicatedException
Adds the XML report document.
Parameters:
xml_file - the XML file of the specified report document.
report - the XML document.
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.

addInformation

public void addInformation(java.io.File xml_file,
                           XmlInformation info)
                    throws java.io.IOException,
                           DocumentIncompleteException,
                           DuplicatedException
Adds only the information element in the XML report document into the database. This method is only for the special use. In general, use the addReport method.
Parameters:
xml_file - the XML file of the specified report document.
info - the XML information element.
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.

addMagnitude

public void addMagnitude(XmlReport report,
                         java.util.Vector catalog_list)
                  throws java.io.IOException,
                         DocumentIncompleteException
Adds the magnitude data in the specified XML report document into the magnitude database.
Parameters:
report - the XML document.
catalog_list - the list of catalog names to add the magnitude into the database.
Throws:
java.io.IOException - if I/O error occurs.
DocumentIncompleteException - if some required data in the specified image information is not recorded.

deleteMagnitude

public void deleteMagnitude(XmlReport report,
                            java.util.Vector catalog_list)
                     throws java.io.IOException,
                            DocumentIncompleteException
Deletes the magnitude data in the specified XML report document from the magnitude database.
Parameters:
report - the XML document.
catalog_list - the list of catalog names to delete the magnitude from the database.
Throws:
java.io.IOException - if I/O error occurs.
DocumentIncompleteException - if some required data in the specified image information is not recorded.

updateMagnitude

private void updateMagnitude(XmlReport report,
                             java.util.Vector catalog_list,
                             boolean add_flag)
                      throws java.io.IOException,
                             DocumentIncompleteException
Updates the magnitude data in the specified XML report document in the magnitude database.
Parameters:
report - the XML document.
catalog_list - the list of catalog names to update the magnitude in the database.
add_flag - true when to add the magnitude data.
Throws:
java.io.IOException - if I/O error occurs.
DocumentIncompleteException - if some required data in the specified image information is not recorded.