Used user provide gateway id instead of default gateway Id
Project: http://git-wip-us.apache.org/repos/asf/airavata/repo Commit: http://git-wip-us.apache.org/repos/asf/airavata/commit/d3f67fd8 Tree: http://git-wip-us.apache.org/repos/asf/airavata/tree/d3f67fd8 Diff: http://git-wip-us.apache.org/repos/asf/airavata/diff/d3f67fd8 Branch: refs/heads/master Commit: d3f67fd85197078e4cd13f70ff184fa38f53ea58 Parents: 29a0e4b Author: shamrath <[email protected]> Authored: Thu Mar 19 15:59:03 2015 -0400 Committer: shamrath <[email protected]> Committed: Thu Mar 19 15:59:03 2015 -0400 ---------------------------------------------------------------------- .../airavata-orchestrator-service/pom.xml | 11 ++++++--- .../registry/JCRComponentRegistry.java | 7 +++--- .../airavata/xbaya/XBayaConfiguration.java | 2 +- .../ui/dialogs/registry/RegistryWindow.java | 26 ++++++++++---------- .../dialogs/workflow/WorkflowImportWindow.java | 2 +- .../ui/experiment/LaunchApplicationWindow.java | 7 +++--- .../RegistryWorkflowPublisherWindow.java | 3 +-- .../WorkflowInterpreterLaunchWindow.java | 23 ++++------------- 8 files changed, 36 insertions(+), 45 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/airavata/blob/d3f67fd8/modules/orchestrator/airavata-orchestrator-service/pom.xml ---------------------------------------------------------------------- diff --git a/modules/orchestrator/airavata-orchestrator-service/pom.xml b/modules/orchestrator/airavata-orchestrator-service/pom.xml index 3817852..b441023 100644 --- a/modules/orchestrator/airavata-orchestrator-service/pom.xml +++ b/modules/orchestrator/airavata-orchestrator-service/pom.xml @@ -26,6 +26,11 @@ <dependencies> <dependency> + <groupId>org.apache.airavata</groupId> + <artifactId>airavata-credential-store</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> <groupId>org.apache.thrift</groupId> <artifactId>libthrift</artifactId> <version>${thrift.version}</version> @@ -45,7 +50,7 @@ <artifactId>airavata-orchestrator-stubs</artifactId> <version>${project.version}</version> </dependency> - <dependency> + <dependency> <groupId>org.apache.airavata</groupId> <artifactId>airavata-workflow-engine</artifactId> <version>${project.version}</version> @@ -65,12 +70,12 @@ <artifactId>app-catalog-cpi</artifactId> <version>${project.version}</version> </dependency> - <dependency> + <dependency> <groupId>org.apache.airavata</groupId> <artifactId>airavata-model-utils</artifactId> <version>${project.version}</version> </dependency> - <dependency> + <dependency> <groupId>org.apache.airavata</groupId> <artifactId>airavata-server-configuration</artifactId> <scope>test</scope> http://git-wip-us.apache.org/repos/asf/airavata/blob/d3f67fd8/modules/workflow-model/workflow-model-component/src/main/java/org/apache/airavata/workflow/model/component/registry/JCRComponentRegistry.java ---------------------------------------------------------------------- diff --git a/modules/workflow-model/workflow-model-component/src/main/java/org/apache/airavata/workflow/model/component/registry/JCRComponentRegistry.java b/modules/workflow-model/workflow-model-component/src/main/java/org/apache/airavata/workflow/model/component/registry/JCRComponentRegistry.java index ccaae5e..bf844bc 100644 --- a/modules/workflow-model/workflow-model-component/src/main/java/org/apache/airavata/workflow/model/component/registry/JCRComponentRegistry.java +++ b/modules/workflow-model/workflow-model-component/src/main/java/org/apache/airavata/workflow/model/component/registry/JCRComponentRegistry.java @@ -35,10 +35,12 @@ public class JCRComponentRegistry extends ComponentRegistry { private static final Logger log = LoggerFactory.getLogger(JCRComponentRegistry.class); private static final String NAME = "Applications"; + private final String gatewayId; private Airavata.Client client; - public JCRComponentRegistry(Airavata.Client client) { + public JCRComponentRegistry(String gatewayId, Airavata.Client client) { setClient(client); + this.gatewayId = gatewayId; } /** @@ -48,8 +50,7 @@ public class JCRComponentRegistry extends ComponentRegistry { public List<ComponentReference> getComponentReferenceList() { List<ComponentReference> tree = new ArrayList<ComponentReference>(); try { - //FIXME: Pass Gateway ID to the UI and use it to fetch the applications - List<ApplicationInterfaceDescription> allApplicationInterfaces = client.getAllApplicationInterfaces("default"); + List<ApplicationInterfaceDescription> allApplicationInterfaces = client.getAllApplicationInterfaces(gatewayId); for (ApplicationInterfaceDescription interfaceDescription : allApplicationInterfaces) { JCRComponentReference jcr = new JCRComponentReference(interfaceDescription.getApplicationName(),interfaceDescription); tree.add(jcr); http://git-wip-us.apache.org/repos/asf/airavata/blob/d3f67fd8/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/XBayaConfiguration.java ---------------------------------------------------------------------- diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/XBayaConfiguration.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/XBayaConfiguration.java index 77a0aa0..aab86a4 100644 --- a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/XBayaConfiguration.java +++ b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/XBayaConfiguration.java @@ -767,7 +767,7 @@ public class XBayaConfiguration extends Observable implements Observer { try { Client airavataClient = XBayaUtil.getAiravataClient(getThriftClientData(ThriftServiceType.API_SERVICE)); if (getJcrComponentRegistry() == null) { - setJcrComponentRegistry(new JCRComponentRegistry(airavataClient)); + setJcrComponentRegistry(new JCRComponentRegistry(getThriftClientData(ThriftServiceType.API_SERVICE).getGatewayId(),airavataClient)); } else { getJcrComponentRegistry().setClient(airavataClient); } http://git-wip-us.apache.org/repos/asf/airavata/blob/d3f67fd8/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/registry/RegistryWindow.java ---------------------------------------------------------------------- diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/registry/RegistryWindow.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/registry/RegistryWindow.java index 9275fe5..0b5f2c1 100644 --- a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/registry/RegistryWindow.java +++ b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/registry/RegistryWindow.java @@ -55,14 +55,14 @@ public class RegistryWindow { private XBayaTextField portTextField; - private XBayaTextField gatewayNameTextField; + private XBayaTextField gatewayIdTextField; private XBayaTextField usernameTextField; private XBayaComboBox serviceTypeCombo; - private String gatewayName; + private String gatewayId; private String username; @@ -100,14 +100,14 @@ public class RegistryWindow { private void ok() { setServerName(this.serverTextField.getText()); setPreviousServerName(this.serverTextField.getText()); - setGatewayName(this.gatewayNameTextField.getText()); + setGatewayId(this.gatewayIdTextField.getText()); setUsername(new String(this.usernameTextField.getText())); setServerPort(this.portTextField.getText()); setServiceType((ThriftServiceType)serviceTypeModel.getSelectedItem()); try { validateData(); XBayaConfiguration configuration = this.engine.getConfiguration(); - configuration.addThriftClientData(new ThriftClientData(getServiceType(),serverName, Integer.parseInt(serverPort),gatewayName, username)); + configuration.addThriftClientData(new ThriftClientData(getServiceType(),serverName, Integer.parseInt(serverPort), gatewayId, username)); hide(); } catch (Exception e) { this.engine.getGUI().getErrorWindow().error(e.getMessage()); @@ -120,16 +120,16 @@ public class RegistryWindow { private void initGUI() { this.serverTextField = new XBayaTextField(); this.portTextField = new XBayaTextField(); - this.gatewayNameTextField = new XBayaTextField(); + this.gatewayIdTextField = new XBayaTextField(); this.usernameTextField = new XBayaTextField(); this.serverTextField.setText("localhost"); this.portTextField.setText("8930"); - this.gatewayNameTextField.setText("airavata"); + this.gatewayIdTextField.setText("airavata"); this.usernameTextField.setText("airavata"); ThriftClientData thriftClientData = engine.getConfiguration().getThriftClientData(ThriftServiceType.API_SERVICE); if (thriftClientData!=null){ this.serverTextField.setText(thriftClientData.getServerAddress()); - this.gatewayNameTextField.setText(thriftClientData.getGatewayId()); + this.gatewayIdTextField.setText(thriftClientData.getGatewayId()); this.portTextField.setText(String.valueOf(thriftClientData.getServerPort())); this.usernameTextField.setText(thriftClientData.getUsername()); } @@ -142,7 +142,7 @@ public class RegistryWindow { XBayaLabel serverAddressLabel = new XBayaLabel("Server Address", this.serverTextField); XBayaLabel serverPortLabel = new XBayaLabel("Server Port", this.portTextField); - XBayaLabel gatewayNameLabel = new XBayaLabel("Gateway Name", this.gatewayNameTextField); + XBayaLabel gatewayNameLabel = new XBayaLabel("Gateway ID", this.gatewayIdTextField); XBayaLabel gatewayUserLabel = new XBayaLabel("Gateway User", this.usernameTextField); serviceTypeModel = new DefaultComboBoxModel(ThriftServiceType.values()); serviceTypeModel.setSelectedItem(getServiceType()); @@ -163,7 +163,7 @@ public class RegistryWindow { infoPanel.add(serverPortLabel); infoPanel.add(this.portTextField); infoPanel.add(gatewayNameLabel); - infoPanel.add(this.gatewayNameTextField); + infoPanel.add(this.gatewayIdTextField); infoPanel.add(gatewayUserLabel); infoPanel.add(this.usernameTextField); infoPanel.layout(5, 2, GridPanel.WEIGHT_NONE, 1); @@ -210,16 +210,16 @@ public class RegistryWindow { return serverName; } - public String getGatewayName() { - return gatewayName; + public String getGatewayId() { + return gatewayId; } public void setServerName(String serverName) { this.serverName = serverName; } - public void setGatewayName(String gateway) { - this.gatewayName = gateway; + public void setGatewayId(String gateway) { + this.gatewayId = gateway; } public void setUsername(String username) { http://git-wip-us.apache.org/repos/asf/airavata/blob/d3f67fd8/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/workflow/WorkflowImportWindow.java ---------------------------------------------------------------------- diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/workflow/WorkflowImportWindow.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/workflow/WorkflowImportWindow.java index 0931ebc..07d2f46 100644 --- a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/workflow/WorkflowImportWindow.java +++ b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/workflow/WorkflowImportWindow.java @@ -111,7 +111,7 @@ public class WorkflowImportWindow { public void run() { try { //FIXME: Update the gateway id fetched from UI - List<String> resultList = getClient().getAllWorkflows("default"); + List<String> resultList = getClient().getAllWorkflows(engine.getConfiguration().getThriftClientData(ThriftServiceType.API_SERVICE).getGatewayId()); if (resultList == null || resultList.size() == 0) { /* * OGCEXRegistryLoaderWindow.this.list.getList(). setListData( new http://git-wip-us.apache.org/repos/asf/airavata/blob/d3f67fd8/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/experiment/LaunchApplicationWindow.java ---------------------------------------------------------------------- diff --git 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 index adfa726..450dde5 100644 --- 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 @@ -264,6 +264,7 @@ public class LaunchApplicationWindow { private void execute() throws AiravataClientConnectException, InvalidRequestException, AiravataClientException, AiravataSystemException, TException { List<NodeImpl> nodes = workflow.getGraph().getNodes(); + String gatewayId = engine.getConfiguration().getThriftClientData(ThriftServiceType.API_SERVICE).getGatewayId(); String appId = null; NodeImpl node = null; for(int i=0; i<nodes.size(); i++){ @@ -298,8 +299,7 @@ public class LaunchApplicationWindow { String owner = this.thriftClientData.getUsername(); if(owner.equals(""))owner="NotKnown"; project.setOwner(owner); - //FIXME:: use gatewayId from UI - project.setProjectID(airavataClient.createProject("default", project)); + project.setProjectID(airavataClient.createProject(gatewayId, project)); // final List<InputNode> inputNodes = GraphUtil.getInputNodes(this.workflow.getGraph()); final List<DataPort> inputPorts = node.getInputPorts(); final Experiment experiment = new Experiment(); @@ -368,8 +368,7 @@ public class LaunchApplicationWindow { experiment.addToExperimentOutputs(elem ); } - //FIXME:: use gatewayId from UI - experiment.setExperimentID(airavataClient.createExperiment("default", experiment)); + experiment.setExperimentID(airavataClient.createExperiment(gatewayId, experiment)); airavataClient.launchExperiment(experiment.getExperimentID(), "testToken"); hide(); JOptionPane.showMessageDialog(null, "Experiment Launched. You will be alerted on completion."); http://git-wip-us.apache.org/repos/asf/airavata/blob/d3f67fd8/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/experiment/RegistryWorkflowPublisherWindow.java ---------------------------------------------------------------------- diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/experiment/RegistryWorkflowPublisherWindow.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/experiment/RegistryWorkflowPublisherWindow.java index e8ea5d8..1b4c383 100644 --- a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/experiment/RegistryWorkflowPublisherWindow.java +++ b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/experiment/RegistryWorkflowPublisherWindow.java @@ -102,8 +102,7 @@ public class RegistryWorkflowPublisherWindow { org.apache.airavata.model.Workflow workflowData = new org.apache.airavata.model.Workflow(); workflowData.setName(workflowTemplateName); workflowData.setGraph(workflowAsString); - //FIXME: Use the gatewayId from the UI - client.registerWorkflow("default", workflowData); + client.registerWorkflow(engine.getConfiguration().getThriftClientData(ThriftServiceType.API_SERVICE).getGatewayId(), workflowData); hide(); } } catch (Exception e) { http://git-wip-us.apache.org/repos/asf/airavata/blob/d3f67fd8/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/experiment/WorkflowInterpreterLaunchWindow.java ---------------------------------------------------------------------- diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/experiment/WorkflowInterpreterLaunchWindow.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/experiment/WorkflowInterpreterLaunchWindow.java index 2eece65..df27269 100644 --- a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/experiment/WorkflowInterpreterLaunchWindow.java +++ b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/experiment/WorkflowInterpreterLaunchWindow.java @@ -265,20 +265,17 @@ public class WorkflowInterpreterLaunchWindow { this.dialog.setDefaultButton(okButton); } - private void execute() throws AiravataClientConnectException, InvalidRequestException, AiravataClientException, AiravataSystemException, TException { - - + private void execute() throws AiravataClientConnectException, TException { ThriftClientData thriftClientData = engine.getConfiguration().getThriftClientData(ThriftServiceType.API_SERVICE); Client airavataClient = XBayaUtil.getAiravataClient(thriftClientData); + String gatewayId = engine.getConfiguration().getThriftClientData(ThriftServiceType.API_SERVICE).getGatewayId(); - Workflow workflowClone = workflow.clone(); workflowClone.setName(workflowClone.getName()+UUID.randomUUID().toString()); org.apache.airavata.model.Workflow w = new org.apache.airavata.model.Workflow(); w.setName(workflowClone.getName()); w.setGraph(JSONUtil.jsonElementToString(workflowClone.toJSON())); - //FIXME:: use gatewayId from UI - w.setTemplateId(airavataClient.registerWorkflow("default", w)); + w.setTemplateId(airavataClient.registerWorkflow(gatewayId, w)); String instanceName = this.instanceNameTextField.getText(); if (instanceName.trim().equals("")){ JOptionPane.showMessageDialog(engine.getGUI().getFrame(), @@ -287,20 +284,16 @@ public class WorkflowInterpreterLaunchWindow { JOptionPane.ERROR_MESSAGE); return; } - //previous instance name if (!instanceNameTextField.getText().equals("")){ this.instanceNameTextField.setText(""); } - // Use topic as a base of workflow instance ID so that the monitor can // find it. - Project project = new Project(); project.setName("project1"); project.setOwner(thriftClientData.getUsername()); - //FIXME:: use gatewayId from UI - project.setProjectID(airavataClient.createProject("default", project)); + project.setProjectID(airavataClient.createProject(gatewayId, project)); final List<InputNode> inputNodes = GraphUtil.getInputNodes(this.workflow.getGraph()); final Experiment experiment = new Experiment(); experiment.setApplicationId(w.getTemplateId()); @@ -322,7 +315,6 @@ public class WorkflowInterpreterLaunchWindow { experiment.addToExperimentInputs(elem ); } - final List<OutputNode> outputNodes = GraphUtil.getOutputNodes(this.workflow.getGraph()); OutputDataObjectType outputDataObjectType = null; for (OutputNode outputNode : outputNodes) { @@ -331,7 +323,6 @@ public class WorkflowInterpreterLaunchWindow { outputDataObjectType.setType(DataType.STRING); experiment.addToExperimentOutputs(outputDataObjectType); } - // Add scheduling configurations if (host != null && host.getSelectedIndex() >= 0) { String selectedHostName = host.getSelectedItem().toString(); @@ -378,10 +369,7 @@ public class WorkflowInterpreterLaunchWindow { airavataClient.launchExperiment(experiment.getExperimentID(), "testToken"); }*/ - - //FIXME:: use gatewayId from UI - experiment.setExperimentID(airavataClient.createExperiment("default", experiment)); - + experiment.setExperimentID(airavataClient.createExperiment(gatewayId, experiment)); try { this.engine.getMonitor().subscribe(experiment.getExperimentID()); this.engine.getMonitor().fireStartMonitoring(workflow.getName()); @@ -389,7 +377,6 @@ public class WorkflowInterpreterLaunchWindow { logger.error("Error while subscribing with experiment Id : " + experiment.getExperimentID(), e); } airavataClient.launchExperiment(experiment.getExperimentID(), "testToken"); - hide(); }
