Merged pull request send by Nadeem for fix AIRAVATA-1389
Project: http://git-wip-us.apache.org/repos/asf/airavata/repo Commit: http://git-wip-us.apache.org/repos/asf/airavata/commit/39798cb5 Tree: http://git-wip-us.apache.org/repos/asf/airavata/tree/39798cb5 Diff: http://git-wip-us.apache.org/repos/asf/airavata/diff/39798cb5 Branch: refs/heads/master Commit: 39798cb51f5d9c4c0a1d5ace69b8ce6d1501990e Parents: 93e37db 4056bb9 Author: shamrath <[email protected]> Authored: Tue Sep 9 16:37:09 2014 -0400 Committer: shamrath <[email protected]> Committed: Tue Sep 9 16:37:09 2014 -0400 ---------------------------------------------------------------------- .../ui/experiment/LaunchApplicationWindow.java | 177 +++++++++++++------ .../xbaya/ui/menues/ApplicationMenuItem.java | 59 +++++++ .../airavata/xbaya/ui/menues/XBayaMenu.java | 5 +- 3 files changed, 188 insertions(+), 53 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/airavata/blob/39798cb5/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/experiment/LaunchApplicationWindow.java ---------------------------------------------------------------------- diff --cc modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/experiment/LaunchApplicationWindow.java index 18daea0,e99a6f3..0e3127f --- a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/experiment/LaunchApplicationWindow.java +++ b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/experiment/LaunchApplicationWindow.java @@@ -127,33 -128,30 +128,51 @@@ public class LaunchApplicationWindow } // 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); ++// 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(); + QName parameterType = port.getType(); + 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); + 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; @@@ -301,7 -300,7 +321,8 @@@ if(owner.equals(""))owner="NotKnown"; project.setOwner(owner); project.setProjectID(airavataClient.createProject(project)); - final List<InputNode> inputNodes = GraphUtil.getInputNodes(this.workflow.getGraph()); ++// final List<InputNode> inputNodes = GraphUtil.getInputNodes(this.workflow.getGraph()); + final List<DataPort> inputPorts = node.getInputPorts(); final Experiment experiment = new Experiment(); experiment.setApplicationId(appId); ComputationalResourceScheduling scheduling = new ComputationalResourceScheduling(); @@@ -325,14 -324,30 +346,50 @@@ experiment.setName(instanceName); experiment.setProjectID(project.getProjectID()); experiment.setUserName(thriftClientData.getUsername()); - for (int i = 0; i < inputNodes.size(); i++) { - InputNode inputNode = inputNodes.get(i); - XBayaTextField parameterTextField = this.parameterTextFields.get(i); - inputNode.getID(); ++ ++// for (int i = 0; i < inputNodes.size(); i++) { ++// InputNode inputNode = inputNodes.get(i); ++// XBayaTextField parameterTextField = this.parameterTextFields.get(i); ++// inputNode.getID(); ++// String value = parameterTextField.getText(); ++// DataObjectType elem = new DataObjectType(); ++// elem.setKey(inputNode.getID()); ++// elem.setType(DataType.STRING); ++// elem.setValue(value); ++// experiment.addToExperimentInputs(elem ); ++// } ++// final List<OutputNode> outputNodes = GraphUtil.getOutputNodes(this.workflow.getGraph()); ++// ++// for (int i = 0; i < outputNodes.size(); i++) { ++// OutputNode outputNode = outputNodes.get(i); ++// DataObjectType elem = new DataObjectType(); ++// elem.setKey(outputNode.getID()); ++// elem.setType(DataType.STRING); ++ + for (int i = 0; i < inputPorts.size(); i++) { + DataPort inputPort = inputPorts.get(i); + XBayaTextField parameterTextField = this.parameterTextFields.get(i); String value = parameterTextField.getText(); DataObjectType elem = new DataObjectType(); - elem.setKey(inputNode.getID()); - elem.setType(DataType.STRING); + elem.setKey(inputPort.getName()); + String type = inputPort.getType().getLocalPart().trim(); + DataType inpType = DataType.STRING; + if(type.equalsIgnoreCase("string")){ + inpType=DataType.STRING; + } + else if(type.equalsIgnoreCase("integer")){ + inpType=DataType.INTEGER; + } + else if(type.equalsIgnoreCase("uri")){ + inpType=DataType.URI; + } + else if(type.equalsIgnoreCase("stdour")){ + inpType=DataType.STDOUT; + } + else if(type.equalsIgnoreCase("stderr")){ + inpType=DataType.STDERR; + } + elem.setType(inpType); elem.setValue(value); experiment.addToExperimentInputs(elem ); } @@@ -376,17 -411,15 +453,14 @@@ for(int i1=0; i1<outputs.size(); i1++){ output = outputs.get(i1).getValue(); fullOutput+= outputs.get(i1).getKey()+": "+output+"\n"; -- - } - JOptionPane.showMessageDialog(null, fullOutput); - } - else{ - JOptionPane.showMessageDialog(null, "Experiment Failed"); - return; - } + } + } + JOptionPane.showMessageDialog(null, fullOutput); + } + else{ + JOptionPane.showMessageDialog(null, "Experiment Failed"); + return; } - - new Thread() { @Override public void run() { @@@ -395,6 -428,5 +469,5 @@@ }.start(); hide(); - } - - } ++ } }
