示例#1
0
  public void fire() throws IllegalActionException {
    super.fire();
    log.debug("\n\n\n--- fire");

    try {
      String ce = opendapCEParameter.getExpression();
      log.debug("Constraint Expression: " + ce);

      ce = createCEfromWiredPorts(ce);

      log.debug("Using CE: " + ce);

      DDS dds = dapConnection.getData(ce);
      // log.debug("fire(): dapConnection.getData(ce) returned DataDDS:");
      // dds.print(System.out);

      log.debug("Squeezing arrays.");
      squeezeArrays(dds);

      log.debug("Broadcasting DAP data arrays.");
      broadcastDapData(dds);

      // log.debug("fire(): After data broadcast:");
      // dds.print(System.out);

    } catch (Exception e) {
      log.error("fire() Failed: ", e);
    }
  }
示例#2
0
  /**
   * @param attribute The changed Attribute.
   * @throws ptolemy.kernel.util.IllegalActionException When bad things happen.
   */
  public void attributeChanged(ptolemy.kernel.util.Attribute attribute)
      throws ptolemy.kernel.util.IllegalActionException {

    log.debug("attributeChanged() start.");

    if (attribute == opendapURLParameter || attribute == opendapCEParameter) {

      String url = opendapURLParameter.getExpression();
      String ce = opendapCEParameter.getExpression();

      if (attribute == opendapURLParameter)
        log.debug("--- attributeChanged() url: " + url + " Current URL: " + opendapURL);
      if (attribute == opendapCEParameter)
        log.debug("--- attributeChanged()  ce: \"" + ce + "\" Current CE: \"" + opendapCE + "\"");

      boolean reload = false;
      if (!opendapURL.equals(url)) {
        opendapURL = url;

        // only reload if not empty.
        if (!url.equals("")) {
          reload = true;
        }
      }

      if (!opendapCE.equals(ce)) {
        opendapCE = ce;
        // *** I think this should test if url.equals(""). jhrg
        reload = true;
      }

      if (reload) {

        try {

          log.debug("OPeNDAP URL: " + opendapURL);
          dapConnection = new DConnect2(opendapURL);

          DDS dds = dapConnection.getDDS(opendapCE);

          log.debug("Got DDS.");
          // dds.print(System.out);

          log.debug("Squeezing arrays.");
          squeezeArrays(dds);

          // log.debug("Before ports configured.");
          // dds.print(System.out);

          log.debug("Configuring ports.");
          configureOutputPorts(dds);

          // log.debug("After ports configured.");
          // dds.print(System.out);

        } catch (Exception e) {
          e.printStackTrace();
          throw new IllegalActionException(
              "Problem accessing " + "OPeNDAP Data Source: " + e.getMessage());
        }
      }

    }
    // *** Remove the ODC option. jhrg
    else if (attribute == runODC) {
      BooleanToken token = (BooleanToken) runODC.getToken();
      if (token.booleanValue()) {
        // start ODC in separate thread
        ODCThread tr = new ODCThread();
        tr.start();
        runODC.setExpression("false");
      }
    }
  }