Examples of AAVSODatabaseConnector


Examples of org.aavso.tools.vstar.input.database.AAVSODatabaseConnector

      // Connect to the observation database if we haven't already
      // done so.
      Mediator.getUI().getStatusPane().setMessage(
          LocaleProps.get("STATUS_PANE_CONNECTING_TO_DATABASE"));

      AAVSODatabaseConnector vsxConnector = AAVSODatabaseConnector.vsxDBConnector;
      Connection vsxConnection = vsxConnector.createConnection();

      // TODO: this should always be populated by VSX methods below!!
      // (e.g. to get period, epoch, variable/spectral type, discoverer).
      StarInfo starInfo = new StarInfo(starName, auid);

      // Do we need to ask for the AUID from the database before
      // proceeding?
      if (auid == null) {
        starInfo = vsxConnector.getAUID(vsxConnection, starName);
        auid = starInfo.getAuid();
        if (auid == null) {
          throw new UnknownStarError(starName);
        }
      }

      // No, do we need instead to ask for the star name because
      // we have an AUID but no star name?
      if (starName == null) {
        starInfo = vsxConnector.getStarName(vsxConnection, auid);
        starName = starInfo.getDesignation();
        if (starName == null) {
          throw new UnknownAUIDError(auid);
        }
      }

      updateProgress(2);

      // Get a prepared statement to read a set of observations
      // from the database, setting the parameters for the star
      // we are targeting. We distinguish between the case where
      // no JD min/max is supplied, and when one is.

      // TODO:
      // - Hide all this statement stuff behind a get-observations
      // method.
      // - Obs stmt creation and param setting should be a single
      // operation to avoid possible mismatched calls! Either that
      // or remove stmt parameter from parameter setting method.

      AAVSODatabaseConnector obsConnector = AAVSODatabaseConnector.observationDBConnector;
      Connection obsConnection = obsConnector.createConnection();

      PreparedStatement obsStmt = null;

      if (minJD == 0 && maxJD == Double.MAX_VALUE) {
        obsStmt = obsConnector
            .createObservationWithNoJDRangeQuery(obsConnection);
      } else {
        obsStmt = obsConnector
            .createObservationWithJDRangeQuery(obsConnection);
      }
      updateProgress(2);

      // Execute the query, passing the result set to the
      // database observation retriever to give us the valid
      // and observation lists and categorised valid observation
      // map from which all else flows.
      if (minJD == 0 && maxJD == Double.MAX_VALUE) {
        obsConnector.setObservationWithNoJDRangeQueryParams(obsStmt,
            auid);
      } else {
        obsConnector.setObservationWithJDRangeQueryParams(obsStmt,
            auid, minJD, maxJD);
      }

      Mediator.getUI().getStatusPane().setMessage(
          LocaleProps.get("STATUS_PANE_RETRIEVING_OBS"));
View Full Code Here

Examples of org.aavso.tools.vstar.input.database.AAVSODatabaseConnector

    try {
      getParent().setCursor(
          Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));

      AAVSODatabaseConnector vsxConnector = AAVSODatabaseConnector.vsxDBConnector;
      Connection vsxConnection = vsxConnector.createConnection();

      StarInfo starInfo = vsxConnector.getAUID(vsxConnection, starName);
      auid = starInfo.getAuid();

      getParent().setCursor(null);
    } catch (Exception e) {
      MessageBox.showErrorDialog(this,
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.