Package edu.indiana.extreme.xbaya.monitor

Examples of edu.indiana.extreme.xbaya.monitor.MonitorConfiguration


            // this.engine.getMyLead(), engine.getMonitor()
            // .getConfiguration(), foreachWSNode
            // .getID(), null);

            if (this.mode == GUI_MODE) {
              leadCtxHeader = WSDLUtil.buildLeadContextHeader(this.workflow, this.configuration, this.engine.getMyLead(), new MonitorConfiguration(this.configuration.getBrokerURL(), this.topic, true, this.configuration.getMessageBoxURL()), foreachWSNode.getID(), null);
            } else {
              leadCtxHeader = WSDLUtil.buildLeadContextHeader(this.workflow, this.configuration,
              // //////////Set the userdn in
              // the right proxy if necessary
                  new MyLead(new MyLeadConfiguration(), proxy), new MonitorConfiguration(this.configuration.getBrokerURL(), this.topic, true, this.configuration.getMessageBoxURL()), foreachWSNode.getID(), null);
            }

          } catch (URISyntaxException e) {
            raiseException(e);
          }
View Full Code Here


            }
        }

        this.workflow = this.engine.getWorkflow();

        MonitorConfiguration notifConfig = this.engine.getMonitor()
                .getConfiguration();
        if (notifConfig.getBrokerURL() == null) {
            this.engine.getErrorWindow().error(
                    ErrorMessages.BROKER_URL_NOT_SET_ERROR);
            return;
        }

        if (compile) {
            // Check if the workflow is valid before the user types in input
            // values.
            BPELScript bpel = new BPELScript(this.workflow);

            // Check if there is any errors in the workflow first.
            ArrayList<String> warnings = new ArrayList<String>();
            if (!bpel.validate(warnings)) {
                StringBuilder buf = new StringBuilder();
                for (String warning : warnings) {
                    buf.append("- ");
                    buf.append(warning);
                    buf.append("\n");
                }
                this.engine.getErrorWindow().warning(buf.toString());
                return;
            }

            try {
                // Generate a BPEL process.
                bpel.create(BPELScriptType.GPEL);
                this.workflow.setGpelProcess(bpel.getGpelProcess());
                this.workflow.setWorkflowWSDL(bpel.getWorkflowWSDL()
                        .getWsdlDefinitions());
            } catch (GraphException e) {
                this.engine.getErrorWindow().error(
                        ErrorMessages.GRAPH_NOT_READY_ERROR, e);
                return;
            }
        } else {
            if (this.workflow.getWorkflowWSDL() == null) {
                this.engine.getErrorWindow().error(
                        ErrorMessages.WORKFLOW_WSDL_NOT_EXIST);
                return;
            }
        }

        // Enable/Disable redeploy button
        boolean enable = this.workflow.getGPELTemplateID() != null;
        this.redeployAndInvokeButton.setEnabled(enable);

        // Create a GUI without depending on the graph.
        List<WSComponentPort> inputs;
        try {
            inputs = this.workflow.getInputs();
        } catch (ComponentException e) {
            // This should not happen when we create WSDL here, but if we use
            // precompiled workflow, it might happen.
            this.engine.getErrorWindow().error(
                    ErrorMessages.WORKFLOW_WSDL_ERROR, e);
            return;
        }
        List<Double> columnWeights = new ArrayList<Double>();
        for (WSComponentPort input : inputs) {
            String id = input.getName();
            QName type = input.getType();
            JLabel paramLabel = new JLabel(id, SwingConstants.TRAILING);
            JLabel typeLabel = new JLabel(type.getLocalPart());
            XBayaTextComponent paramField;
            if (LEADTypes.isKnownType(type)) {
                paramField = new XBayaTextField();
                columnWeights.add(new Double(0));
            } else {
                paramField = new XBayaTextArea();
                columnWeights.add(new Double(1.0));
            }
            paramLabel.setLabelFor(paramField.getSwingComponent());

            // default value
            Object value = input.getDefaultValue();
            String valueString = null;
            if (value != null) {
                if (value instanceof XmlElement) {
                    XmlElement valueElement = (XmlElement) value;
                    valueString = XMLUtil.xmlElementToString(valueElement);
                } else {
                    // Only string comes here for now.
                    valueString = value.toString();
                }
            }

            if (valueString == null) {
                // show some sample URI to ease inputs.
                final String sampleURI = "gsiftp://rainier.extreme.indiana.edu//tmp/foo.txt";
                if (LEADTypes.isURIType(type)) {
                    valueString = sampleURI;
                } else if (LEADTypes.isURIArrayType(type)) {
                    StringBuffer buf = new StringBuffer();
                    for (int i = 0; i < 4; i++) {
                        buf.append(sampleURI).append(" ");
                    }
                    valueString = buf.toString();
                }
            }
            paramField.setText(valueString);

            this.parameterPanel.add(paramLabel);
            this.parameterPanel.add(typeLabel);
            this.parameterPanel.add(paramField);
            this.parameterTextFields.add(paramField);
        }
        List<Double> rowWeights = new ArrayList<Double>();
        rowWeights.add(new Double(0));
        rowWeights.add(new Double(0));
        rowWeights.add(new Double(1));
        this.parameterPanel.layout(columnWeights, rowWeights);

        XBayaConfiguration configuration = this.engine.getConfiguration();
        MonitorConfiguration monitorConfiguration = this.engine.getMonitor()
                .getConfiguration();

        // Topic
        String topic = monitorConfiguration.getTopic();
        this.topicTextField.setText(topic);

        // DSC URL
        this.dscTextField.setText(configuration.getDSCURL());
View Full Code Here

                return;
            }
        }

        // Set to the config so that they will be reused.
        MonitorConfiguration monitorConfig = this.engine.getMonitor()
                .getConfiguration();
        monitorConfig.setTopic(topic);
        XBayaConfiguration config = this.engine.getConfiguration();
        config.setDSCURL(dscURL);
        config.setXRegistryURL(xRegistryURL);
        config.setGFacURL(gfacURL);
View Full Code Here

        return;
      }
    }

    // Set to the config so that they will be reused.
    MonitorConfiguration monitorConfig = this.engine.getMonitor()
        .getConfiguration();
    monitorConfig.setTopic(topic);
    XBayaConfiguration config = this.engine.getConfiguration();
    config.setXRegistryURL(xRegistryURL);
    config.setGFacURL(gfacURL);

    // Deal with the Lead resource mapping
View Full Code Here

      }
    }

    this.workflow = this.engine.getWorkflow();

    MonitorConfiguration notifConfig = this.engine.getMonitor()
        .getConfiguration();
    if (notifConfig.getBrokerURL() == null) {
      this.engine.getErrorWindow().error(
          ErrorMessages.BROKER_URL_NOT_SET_ERROR);
      return;
    }

    BPELScript bpel = new BPELScript(this.workflow);

    // Check if there is any errors in the workflow first.
    ArrayList<String> warnings = new ArrayList<String>();
    if (!bpel.validate(warnings)) {
      StringBuilder buf = new StringBuilder();
      for (String warning : warnings) {
        buf.append("- ");
        buf.append(warning);
        buf.append("\n");
      }
      this.engine.getErrorWindow().warning(buf.toString());
      return;
    }

    try {
      // Generate a BPEL process.
      bpel.create(BPELScriptType.BPEL2);
      this.workflow.setGpelProcess(bpel.getGpelProcess());
      this.workflow.setWorkflowWSDL(bpel.getWorkflowWSDL()
          .getWsdlDefinitions());
    } catch (GraphException e) {
      this.engine.getErrorWindow().error(
          ErrorMessages.GRAPH_NOT_READY_ERROR, e);
      return;
    }

    // Create a GUI without depending on the graph.
    List<WSComponentPort> inputs;
    try {

      inputs = this.workflow.getInputs();
    } catch (ComponentException e) {
      // This should not happen when we create WSDL here, but if we use
      // precompiled workflow, it might happen.
      this.engine.getErrorWindow().error(
          ErrorMessages.WORKFLOW_WSDL_ERROR, e);
      return;
    }
    List<Double> columnWeights = new ArrayList<Double>();
    long timeNow = System.currentTimeMillis();
    SimpleDateFormat format = new SimpleDateFormat(
        "yyyy.MM.dd G 'at' HH:mm:ss z");
    for (WSComponentPort input : inputs) {

      // Somethign special for the control workflow
      if (-1 != engine.getWorkflow().getName().indexOf("Control_")) {
        if ("epr".equals(input.getName())) {
          input
              .setDefaultValue("https://pagodatree.cs.indiana.edu:17443/ode/processes/"
                  + engine.getWorkflow().getName() + "?wsdl");
        } else if ("operation".equals(input.getName())) {
          input.setDefaultValue("Run");
        } else if ("startTime".equals(input.getName())) {
          Date now = new Date(timeNow);
          input.setDefaultValue(format.format(now));
        } else if ("endTime".equals(input.getName())) {
          input.setDefaultValue(format.format(new Date(timeNow + 2
              * 60 * 60 * 1000)));
        } else if ("eql".equals(input.getName())) {
          input
              .setDefaultValue("select * from java.lang.String.win:length_batch(1)");
        }
      }

      String id = input.getName();
      QName type = input.getType();
      JLabel paramLabel = new JLabel(id, SwingConstants.TRAILING);
      JLabel typeLabel = new JLabel(type.getLocalPart());
      XBayaTextComponent paramField;
      if (LEADTypes.isKnownType(type)) {
        paramField = new XBayaTextField();
        columnWeights.add(new Double(0));
      } else {
        paramField = new XBayaTextArea();
        columnWeights.add(new Double(1.0));
      }
      paramLabel.setLabelFor(paramField.getSwingComponent());

      // default value
      Object value = input.getDefaultValue();
      String valueString = null;
      if (value != null) {
        if (value instanceof XmlElement) {
          XmlElement valueElement = (XmlElement) value;
          valueString = XMLUtil.xmlElementToString(valueElement);
        } else {
          // Only string comes here for now.
          valueString = value.toString();
        }
      }

      if (valueString == null) {
        // show some sample URI to ease inputs.
        final String sampleURI = "gsiftp://rainier.extreme.indiana.edu//tmp/foo.txt";
        if (LEADTypes.isURIType(type)) {
          valueString = sampleURI;
        } else if (LEADTypes.isURIArrayType(type)) {
          StringBuffer buf = new StringBuffer();
          for (int i = 0; i < 4; i++) {
            buf.append(sampleURI).append(" ");
          }
          valueString = buf.toString();
        }
      }
      paramField.setText(valueString);

      this.parameterPanel.add(paramLabel);
      this.parameterPanel.add(typeLabel);
      this.parameterPanel.add(paramField);
      this.parameterTextFields.add(paramField);
    }
    List<Double> rowWeights = new ArrayList<Double>();
    rowWeights.add(new Double(0));
    rowWeights.add(new Double(0));
    rowWeights.add(new Double(1));
    this.parameterPanel.layout(columnWeights, rowWeights);

    XBayaConfiguration configuration = this.engine.getConfiguration();
    MonitorConfiguration monitorConfiguration = this.engine.getMonitor()
        .getConfiguration();

    // Topic
    String topic = monitorConfiguration.getTopic();
    if (topic != null) {
      this.topicTextField.setText(topic);
    } else {
      this.topicTextField.setText(UUID.randomUUID().toString());
    }
View Full Code Here

            this.graphCanvas.setWorkflow(workflow);
            monitor = this.engine.getMonitor();
            this.engine.getGUI().eventReceived(new Event(Type.MONITOR_STARTED));
            repaintAndWait(2);
        } else {
            MonitorConfiguration monitorConfiguration = new MonitorConfiguration(
                    this.configuration.getBrokerURL(), this.configuration
                            .getTopic(), this.configuration.isPullMode(),
                    this.configuration.getMessageBoxURL());
            monitor = new Monitor(monitorConfiguration);
        }
View Full Code Here

  public void show() {
    this.workflow = this.engine.getWorkflow();
    this.script = new JythonScript(this.workflow,
        this.engine.getConfiguration());

    MonitorConfiguration notifConfig = this.engine.getMonitor()
        .getConfiguration();
    if (notifConfig.getBrokerURL() == null) {
      this.engine.getErrorWindow().error(
          ErrorMessages.BROKER_URL_NOT_SET_ERROR);
      return;
    }

    // Check if the workflow is valid before the user types in input
    // values.
    ArrayList<String> warnings = new ArrayList<String>();
    if (!this.script.validate(warnings)) {
      StringBuilder buf = new StringBuilder();
      for (String warning : warnings) {
        buf.append("- ");
        buf.append(warning);
        buf.append("\n");
      }
      this.engine.getErrorWindow().warning(buf.toString());
      return;
    }

    // Create a script here. It might throw some exception because the
    // validation is not perfect.
    try {
      this.script.create();
    } catch (GraphException e) {
      this.engine.getErrorWindow().error(
          ErrorMessages.GRAPH_NOT_READY_ERROR, e);
      hide();
      return;
    } catch (RuntimeException e) {
      this.engine.getErrorWindow().error(ErrorMessages.UNEXPECTED_ERROR,
          e);
      hide();
      return;
    } catch (Error e) {
      this.engine.getErrorWindow().error(ErrorMessages.UNEXPECTED_ERROR,
          e);
      hide();
      return;
    }

    // Create input fields
    Collection<InputNode> inputNodes = GraphUtil
        .getInputNodes(this.workflow.getGraph());
    for (InputNode node : inputNodes) {
      String id = node.getID();
      QName parameterType = node.getParameterType();
      JLabel nameLabel = new JLabel(id);
      JLabel typeField = new JLabel(parameterType.getLocalPart());
      XBayaTextField paramField = new XBayaTextField();
      Object value = node.getDefaultValue();

      String valueString;
      if (value == null) {
        valueString = "";
      } else {
        if (value instanceof XmlElement) {
          XmlElement valueElement = (XmlElement) value;
          valueString = XMLUtil.xmlElementToString(valueElement);
        } else {
          // Only string comes here for now.
          valueString = value.toString();
        }
      }
      paramField.setText(valueString);
      this.parameterPanel.add(nameLabel);
      this.parameterPanel.add(typeField);
      this.parameterPanel.add(paramField);
      this.parameterTextFields.add(paramField);
    }
    this.parameterPanel.layout(inputNodes.size(), 3, GridPanel.WEIGHT_NONE,
        2);

    if(notifConfig.getTopic() == null){
      this.topicTextField.setText(UUID.randomUUID().toString());
    }else{
      this.topicTextField.setText(notifConfig.getTopic());
    }

    XBayaConfiguration config = this.engine.getConfiguration();

    URI gfacURL = config.getGFacURL();
View Full Code Here

    // find it.
    URI workfowInstanceID = URI.create(StringUtil
        .convertToJavaIdentifier(topic));
    this.workflow.setGPELInstanceID(workfowInstanceID);

    MonitorConfiguration notifConfig = this.engine.getMonitor()
        .getConfiguration();
    notifConfig.setTopic(topic);
    arguments.add("-" + JythonScript.TOPIC_VARIABLE);
    arguments.add(topic);

    // TODO error check for user inputs

    List<InputNode> inputNodes = GraphUtil.getInputNodes(this.workflow
        .getGraph());
    for (int i = 0; i < inputNodes.size(); i++) {
      InputNode inputNode = inputNodes.get(i);
      XBayaTextField parameterTextField = this.parameterTextFields.get(i);
      String id = inputNode.getID();
      String value = parameterTextField.getText();
      arguments.add("-" + id);
      arguments.add(value);
    }

    XBayaConfiguration config = this.engine.getConfiguration();

    String gfacString = this.gfacTextField.getText();
    if (gfacString.length() != 0) {
      try {
        URI uri = new URI(gfacString).parseServerAuthority();
        config.setGFacURL(uri);
      } catch (URISyntaxException e) {
        this.engine.getErrorWindow().error(
            ErrorMessages.GFAC_URL_WRONG, e);
        return;
      }
      arguments.add("-" + JythonScript.GFAC_VARIABLE);
      arguments.add(gfacString);
    }

    arguments.add("-" + JythonScript.BROKER_URL_VARIABLE);
    arguments.add(notifConfig.getBrokerURL().toString());

    if (notifConfig.isPullMode()) {
      arguments.add("-" + JythonScript.MESSAGE_BOX_URL_VARIABLE);
      arguments.add(notifConfig.getMessageBoxURL().toString());
    }

    try {
      for (WSNode node : GraphUtil.getWSNodes(this.workflow.getGraph())) {
        WSComponent component = node.getComponent();
View Full Code Here

     */
    public void eventReceived(Event event) {
        logger.entering();
        Type type = event.getType();
        if (type.equals(Event.Type.MONITOR_CONFIGURATION_CHANGED)) {
            MonitorConfiguration configuration = this.engine.getMonitor()
                    .getConfiguration();
            boolean valid = configuration.isValid();
            this.startMenuItem.setEnabled(valid);
        } else if (type.equals(Event.Type.MONITOR_STARTED)) {
            this.startMenuItem.setEnabled(false);
            this.stopMenuItem.setEnabled(true);
            this.resetMenuItem.setEnabled(true);
View Full Code Here

        .setMyLeadAgentURL(XBayaConstants.DEFAULT_MYLEAD_AGENT_URL);
    leadContextHelper.setWorkflowInstanceID(instanceID);
    leadContextHelper.setWorkflowTemplateID(workflow
        .getUniqueWorkflowName());

    MonitorConfiguration monitorConfiguration = new MonitorConfiguration(
        XBayaConstants.DEFAULT_BROKER_URL, topic, true,
        XBayaConstants.DEFAULT_MESSAGE_BOX_URL);
    leadContextHelper.setMonitorConfiguration(monitorConfiguration);

    LeadContextHeader leadContext = leadContextHelper
View Full Code Here

TOP

Related Classes of edu.indiana.extreme.xbaya.monitor.MonitorConfiguration

Copyright © 2018 www.massapicom. 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.