Search in sources :

Example 11 with DataType

use of org.apache.airavata.model.appcatalog.appinterface.DataType in project airavata by apache.

the class ForEachNode method edgeWasAdded.

/**
 * @param edge
 * @throws GraphException
 */
@Override
protected void edgeWasAdded(Edge edge) throws GraphException {
    // XXX cannot detect if the type is array or not from WSDL at this
    // point. so no check here.
    // super.edgeWasAdded(edge);
    Port fromPort = edge.getFromPort();
    Port toPort = edge.getToPort();
    if (edge instanceof DataEdge) {
        if (fromPort instanceof EPRPort) {
            // TODO
            return;
        }
        DataPort fromDataPort = (DataPort) fromPort;
        DataPort toDataPort = (DataPort) toPort;
        DataType fromType = fromDataPort.getType();
        DataType toType = toDataPort.getType();
        if (fromDataPort.getNode() == this) {
            if (!(toType == null || toType.equals(WSConstants.XSD_ANY_TYPE))) {
                fromDataPort.copyType(toDataPort);
            }
        } else if (toDataPort.getNode() == this) {
            if (!(fromType == null || fromType.equals(WSConstants.XSD_ANY_TYPE))) {
                toDataPort.copyType(fromDataPort);
            }
        } else {
            throw new WorkflowRuntimeException();
        }
    }
}
Also used : DataPort(org.apache.airavata.workflow.model.graph.DataPort) ComponentDataPort(org.apache.airavata.workflow.model.component.ComponentDataPort) DataEdge(org.apache.airavata.workflow.model.graph.DataEdge) EPRPort(org.apache.airavata.workflow.model.graph.EPRPort) DataPort(org.apache.airavata.workflow.model.graph.DataPort) ComponentDataPort(org.apache.airavata.workflow.model.component.ComponentDataPort) EPRPort(org.apache.airavata.workflow.model.graph.EPRPort) Port(org.apache.airavata.workflow.model.graph.Port) DataType(org.apache.airavata.model.appcatalog.appinterface.DataType) WorkflowRuntimeException(org.apache.airavata.workflow.model.exceptions.WorkflowRuntimeException)

Example 12 with DataType

use of org.apache.airavata.model.appcatalog.appinterface.DataType in project airavata by apache.

the class LaunchApplicationWindow method show.

/**
 * Shows the dialog.
 */
public void show() {
    this.workflow = this.engine.getGUI().getWorkflow();
    // 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);
    List<NodeImpl> nodes = workflow.getGraph().getNodes();
    NodeImpl node = null;
    for (int i = 0; i < nodes.size(); i++) {
        node = nodes.get(i);
        String html = node.getComponent().toHTML();
        String nodeType = html.substring(html.indexOf("<h1>") + 4, html.indexOf(":")).trim();
        if (nodeType.equals("Application")) {
            break;
        }
    }
    List<DataPort> inputPorts = node.getInputPorts();
    for (DataPort port : inputPorts) {
        String id = port.getName();
        DataType parameterType = port.getType();
        JLabel nameLabel = new JLabel(id);
        JLabel typeField = new JLabel(parameterType.toString());
        XBayaTextField paramField = new XBayaTextField();
        paramField.setText("");
        this.parameterPanel.add(nameLabel);
        this.parameterPanel.add(typeField);
        this.parameterPanel.add(paramField);
        this.parameterTextFields.add(paramField);
    }
    Map<String, String> hosts = null;
    try {
        hosts = airavataClient.getAllComputeResourceNames();
    } catch (InvalidRequestException e) {
        logger.error(e.getMessage(), e);
    } catch (AiravataClientException e) {
        logger.error(e.getMessage(), e);
    } catch (AiravataSystemException e) {
        logger.error(e.getMessage(), e);
    } catch (TException e) {
        logger.error(e.getMessage(), e);
    }
    hostNames = new HashMap<String, String>();
    Iterator it = hosts.entrySet().iterator();
    while (it.hasNext()) {
        Map.Entry pairs = (Map.Entry) it.next();
        String key = (String) pairs.getKey();
        String value = (String) pairs.getValue();
        if (!hostNames.containsKey(value)) {
            hostNames.put(value, key);
        }
    }
    host = new JComboBox();
    it = hostNames.entrySet().iterator();
    while (it.hasNext()) {
        Map.Entry pairs = (Map.Entry) it.next();
        String key = (String) pairs.getKey();
        host.addItem(key);
    }
    host.setSelectedIndex(1);
    XBayaLabel hostLabel = new XBayaLabel("Host", this.host);
    this.parameterPanel.add(hostLabel);
    this.parameterPanel.add(host);
    // this.parameterPanel.layout(inputNodes.size()+1, 2, GridPanel.WEIGHT_NONE, 2);
    this.dialog.show();
}
Also used : TException(org.apache.thrift.TException) NodeImpl(org.apache.airavata.workflow.model.graph.impl.NodeImpl) JComboBox(javax.swing.JComboBox) JLabel(javax.swing.JLabel) DataPort(org.apache.airavata.workflow.model.graph.DataPort) AiravataSystemException(org.apache.airavata.model.error.AiravataSystemException) Iterator(java.util.Iterator) DataType(org.apache.airavata.model.appcatalog.appinterface.DataType) InvalidRequestException(org.apache.airavata.model.error.InvalidRequestException) XBayaTextField(org.apache.airavata.xbaya.ui.widgets.XBayaTextField) AiravataClientException(org.apache.airavata.model.error.AiravataClientException) HashMap(java.util.HashMap) Map(java.util.Map) XBayaLabel(org.apache.airavata.xbaya.ui.widgets.XBayaLabel)

Example 13 with DataType

use of org.apache.airavata.model.appcatalog.appinterface.DataType in project airavata by apache.

the class ConstantConfigurationDialog method setInput.

private void setInput() {
    String name = this.nameTextField.getText();
    DataType type = this.node.getType();
    String valueString;
    valueString = this.valueTextField.getText();
    if (name.length() == 0) {
        String warning = "The name cannot be empty.";
        this.xbayaGUI.getErrorWindow().error(warning);
        return;
    }
    Object value = null;
    if (valueString.length() > 0) {
        if (!this.node.isInputValid(valueString)) {
            String warning = "The defalut value is not valid for " + this.node.getType() + ".";
            this.xbayaGUI.getErrorWindow().error(warning);
        }
        value = valueString;
    }
    this.node.setName(name);
    this.node.setValue(value);
    hide();
    this.xbayaGUI.getGraphCanvas().repaint();
}
Also used : DataType(org.apache.airavata.model.appcatalog.appinterface.DataType)

Example 14 with DataType

use of org.apache.airavata.model.appcatalog.appinterface.DataType in project airavata by apache.

the class ConstantConfigurationDialog method show.

/**
 * Shows the dialog.
 */
public void show() {
    DataType type = this.node.getType();
    XBayaTextComponent textComponent;
    textComponent = this.valueTextField;
    this.valueLabel.setText("Default value");
    this.valueLabel.setLabelFor(textComponent);
    final int index = 7;
    this.gridPanel.remove(index);
    this.gridPanel.add(textComponent, index);
    this.gridPanel.layout(4, 2, 3, 1);
    String name = this.node.getName();
    this.nameTextField.setText(name);
    this.idTextField.setText(this.node.getID());
    this.typeTextField.setText(type.toString());
    Object value = this.node.getValue();
    String valueString;
    if (value == null) {
        valueString = "";
    } else if (value instanceof XmlElement) {
        valueString = XMLUtil.xmlElementToString((XmlElement) value);
    } else {
        valueString = value.toString();
    }
    textComponent.setText(valueString);
    this.dialog.show();
}
Also used : XBayaTextComponent(org.apache.airavata.xbaya.ui.widgets.XBayaTextComponent) DataType(org.apache.airavata.model.appcatalog.appinterface.DataType) XmlElement(org.xmlpull.infoset.XmlElement)

Example 15 with DataType

use of org.apache.airavata.model.appcatalog.appinterface.DataType in project airavata by apache.

the class DifferedInputConfigurationDialog method show.

/**
 * Shows the dialog.
 */
public void show() {
    DataType type = this.node.getParameterType();
    XBayaTextComponent textComponent;
    // boolean knownType = LEADTypes.isKnownType(type);
    textComponent = this.valueTextField;
    this.valueLabel.setText("Default value");
    this.valueLabel.setLabelFor(textComponent);
    final int index = 5;
    this.gridPanel.remove(index);
    this.gridPanel.add(textComponent, index);
    this.gridPanel.layout(new double[] { 0, 1.0 / 2, 0, 1.0 / 2 }, new double[] { 0, 1 });
    // String name = this.node.getConfiguredName();
    // if (name == null) {
    // name = this.node.getName();
    // }
    // Show ID.
    String name = this.node.getID();
    this.nameTextField.setText(name);
    this.descriptionTextArea.setText(this.node.getDescription());
    Object value = this.node.getDefaultValue();
    String valueString;
    if (value == null) {
        valueString = "";
    } else if (value instanceof XmlElement) {
        valueString = XMLUtil.xmlElementToString((XmlElement) value);
    } else {
        valueString = value.toString();
    }
    textComponent.setText(valueString);
    XmlElement metadata = this.node.getMetadata();
    String metadataText;
    if (metadata == null) {
        metadataText = WSConstants.EMPTY_APPINFO;
    } else {
        metadataText = XMLUtil.xmlElementToString(metadata);
    }
    this.metadataTextArea.setText(metadataText);
    this.dialog.show();
}
Also used : XBayaTextComponent(org.apache.airavata.xbaya.ui.widgets.XBayaTextComponent) DataType(org.apache.airavata.model.appcatalog.appinterface.DataType) XmlElement(org.xmlpull.infoset.XmlElement)

Aggregations

DataType (org.apache.airavata.model.appcatalog.appinterface.DataType)15 DataPort (org.apache.airavata.workflow.model.graph.DataPort)10 DataEdge (org.apache.airavata.workflow.model.graph.DataEdge)8 WSPort (org.apache.airavata.workflow.model.graph.ws.WSPort)5 WorkflowRuntimeException (org.apache.airavata.workflow.model.exceptions.WorkflowRuntimeException)4 Port (org.apache.airavata.workflow.model.graph.Port)4 XmlElement (org.xmlpull.infoset.XmlElement)4 GraphException (org.apache.airavata.workflow.model.graph.GraphException)3 XBayaTextComponent (org.apache.airavata.xbaya.ui.widgets.XBayaTextComponent)3 HashMap (java.util.HashMap)2 Iterator (java.util.Iterator)2 Map (java.util.Map)2 JComboBox (javax.swing.JComboBox)2 JLabel (javax.swing.JLabel)2 AiravataClientException (org.apache.airavata.model.error.AiravataClientException)2 AiravataSystemException (org.apache.airavata.model.error.AiravataSystemException)2 InvalidRequestException (org.apache.airavata.model.error.InvalidRequestException)2 ComponentDataPort (org.apache.airavata.workflow.model.component.ComponentDataPort)2 WSComponentPort (org.apache.airavata.workflow.model.component.ws.WSComponentPort)2 EPRPort (org.apache.airavata.workflow.model.graph.EPRPort)2