Return-Path: X-Original-To: apmail-incubator-airavata-commits-archive@minotaur.apache.org Delivered-To: apmail-incubator-airavata-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 755597EFC for ; Tue, 18 Oct 2011 04:28:52 +0000 (UTC) Received: (qmail 36621 invoked by uid 500); 18 Oct 2011 04:28:51 -0000 Delivered-To: apmail-incubator-airavata-commits-archive@incubator.apache.org Received: (qmail 36574 invoked by uid 500); 18 Oct 2011 04:28:51 -0000 Mailing-List: contact airavata-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: airavata-dev@incubator.apache.org Delivered-To: mailing list airavata-commits@incubator.apache.org Received: (qmail 36567 invoked by uid 99); 18 Oct 2011 04:28:50 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 18 Oct 2011 04:28:50 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED,WEIRD_PORT X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 18 Oct 2011 04:28:47 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id BAD8323889EA; Tue, 18 Oct 2011 04:28:27 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1185473 - /incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ode/gui/ODEDeploymentClient.java Date: Tue, 18 Oct 2011 04:28:27 -0000 To: airavata-commits@incubator.apache.org From: chathura@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20111018042827.BAD8323889EA@eris.apache.org> Author: chathura Date: Tue Oct 18 04:28:27 2011 New Revision: 1185473 URL: http://svn.apache.org/viewvc?rev=1185473&view=rev Log: Removing unused streaming Modified: incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ode/gui/ODEDeploymentClient.java Modified: incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ode/gui/ODEDeploymentClient.java URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ode/gui/ODEDeploymentClient.java?rev=1185473&r1=1185472&r2=1185473&view=diff ============================================================================== --- incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ode/gui/ODEDeploymentClient.java (original) +++ incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ode/gui/ODEDeploymentClient.java Tue Oct 18 04:28:27 2011 @@ -21,30 +21,13 @@ package org.apache.airavata.xbaya.ode.gui; -import java.awt.Point; -import java.net.URI; -import java.net.URISyntaxException; import java.util.Iterator; import java.util.LinkedList; import java.util.List; import org.apache.airavata.common.utils.XMLUtil; -import org.apache.airavata.xbaya.XBayaConstants; import org.apache.airavata.xbaya.XBayaEngine; -import org.apache.airavata.xbaya.component.ComponentException; -import org.apache.airavata.xbaya.component.gui.ComponentTreeNode; -import org.apache.airavata.xbaya.component.registry.ComponentRegistryException; -import org.apache.airavata.xbaya.component.registry.ComponentRegistryLoader; -import org.apache.airavata.xbaya.component.registry.URLComponentRegistry; -import org.apache.airavata.xbaya.component.system.InputComponent; -import org.apache.airavata.xbaya.component.system.OutputComponent; -import org.apache.airavata.xbaya.component.ws.WSComponent; -import org.apache.airavata.xbaya.graph.DataPort; -import org.apache.airavata.xbaya.graph.Graph; -import org.apache.airavata.xbaya.graph.GraphException; import org.apache.airavata.xbaya.graph.Node; -import org.apache.airavata.xbaya.graph.Port; -import org.apache.airavata.xbaya.graph.gui.GraphCanvas; import org.apache.airavata.xbaya.graph.impl.NodeImpl; import org.apache.airavata.xbaya.graph.system.InputNode; import org.apache.airavata.xbaya.graph.system.gui.StreamSourceNode; @@ -52,261 +35,88 @@ import org.apache.airavata.xbaya.gui.Wai import org.apache.airavata.xbaya.myproxy.MyProxyClient; import org.apache.airavata.xbaya.security.UserX509Credential; import org.apache.airavata.xbaya.security.XBayaSecurity; -import org.apache.airavata.xbaya.streaming.StreamReceiveComponent; -import org.apache.airavata.xbaya.streaming.StreamReceiveNode; import org.apache.airavata.xbaya.wf.Workflow; import org.apache.airavata.xbaya.workflow.proxy.WorkflowProxyClient; import org.ietf.jgss.GSSCredential; public class ODEDeploymentClient { - private XBayaEngine engine; + private XBayaEngine engine; - private WaitDialog invokingDialog; + private WaitDialog invokingDialog; - public ODEDeploymentClient(XBayaEngine engine) { - this.engine = engine; - } - - public ODEDeploymentClient(XBayaEngine engine, WaitDialog invokingDialog) { - this(engine); - this.invokingDialog = invokingDialog; - } - - /** - * Deploy to ODE and XRegistry - * - * @param wfClient - * @param workflow - * @param gssCredential - * @param makePublic - */ - public void deploy(WorkflowProxyClient wfClient, Workflow workflow, GSSCredential gssCredential, - boolean makePublic) { - try { - - org.xmlpull.infoset.XmlElement workflowXml = workflow.toXML(); - XMLUtil.xmlElementToString(workflowXml); -// URI xRegistryURL = this.engine.getConfiguration().getXRegistryURL(); -// if (xRegistryURL == null) { -// xRegistryURL = XBayaConstants.DEFAULT_XREGISTRY_URL; -// } - wfClient.deploy(workflow, false); - hideUI(); - String oldWorkflowName = workflow.getName(); - - boolean needDeployment = false; - List nodes = this.engine.getWorkflow().getGraph().getNodes(); - for (Iterator iterator = nodes.iterator(); iterator.hasNext();) { - Node node = (Node) iterator.next(); - if (node instanceof StreamSourceNode) { - needDeployment = true; - break; - } - } - if (needDeployment) { - deployStreamControlWorkflowIfNecessary(this.engine.getWorkflow()); - - WorkflowProxyClient wpClient = new WorkflowProxyClient(); -// wpClient.setXRegistryUrl(this.engine.getConfiguration().getXRegistryURL()); - wpClient.setEngineURL(this.engine.getConfiguration().getProxyURI()); - wpClient.setXBayaEngine(this.engine); - GSSCredential proxy = null; - if (wpClient.isSecure()) { - MyProxyClient myProxyClient = this.engine.getMyProxyClient(); - proxy = myProxyClient.getProxy(); - UserX509Credential credential = new UserX509Credential(proxy, - XBayaSecurity.getTrustedCertificates()); - wpClient.setUserX509Credential(credential); - } - this.engine.getGUI().getGraphCanvas() - .setNameAndDescription("Control_" + oldWorkflowName, "Control_" + oldWorkflowName); - engine.getWorkflow().setName("Control_" + oldWorkflowName); - engine.getWorkflow().getGraph().setID("Control_" + oldWorkflowName); - - deploy(wfClient, engine.getWorkflow(), gssCredential, makePublic); - - - } - - } catch (Throwable e) { - hideUI(); - - // The swing components get confused when there is html in the error - // message - if (e.getMessage() != null && e.getMessage().indexOf("") != -1) { - this.engine.getErrorWindow().error(e.getMessage().substring(0, e.getMessage().indexOf(""))); - } else { - this.engine.getErrorWindow().error(e); - } - } - } - - /** - * @param workflowWsdlUri - * @throws URISyntaxException - * @throws ComponentException - * @throws ComponentRegistryException - * @throws GraphException - * - */ - // private void deployStreamControlWorkflowIfNecessary(Workflow oldWorkflow) - // throws URISyntaxException, ComponentRegistryException, - // ComponentException, GraphException { - // - // // create a new tab - // GraphCanvas canvas = this.engine.getGUI().newGraphCanvas(true); - // - // // we can call with null because WSDL is already accessed at this point - // WSComponent workflowComponent = new StreamReceiveComponent(oldWorkflow.getOdeInvokableWSDL(null, null)); - // Node workflowNode = canvas.addNode(workflowComponent, new Point(600, - // 100)); - // // this.engine.getWorkflow().getWSDLs().put(((StreamReceiveNode)workflowNode).getWSDLID(), - // oldWorkflow.getOdeWorkflowWSDL(null, null)); - // - // URLComponentRegistry serviceRegistry = new URLComponentRegistry( - // new URI( - // "https://pagodatree.cs.indiana.edu:17443/axis2/services/Sleep?wsdl")); - // - // new ComponentRegistryLoader(engine).load(serviceRegistry); - // ComponentTreeNode cepComponent = (ComponentTreeNode) serviceRegistry - // .getComponentTree().getChildAt(0); - // - // InputComponent inputComponent = new InputComponent(); - // InputNode newNode = (InputNode) canvas.addNode(inputComponent, - // new Point(50,50)); - // Node cepNode = canvas.addNode(cepComponent.getComponentReference() - // .getComponent(), new Point(100, 100)); - // Port outputPort = cepNode.getOutputPort(0); - // Graph graph = this.engine.getGUI().getGraphCanvas().getGraph(); - // graph.addEdge(newNode.getOutputPort(0), cepNode.getInputPort(0)); - // - // for (int i = 0; i < XBaya.preservice; i++) { - // - // cepNode = canvas.addNode(cepComponent.getComponentReference() - // .getComponent(), new Point(100+50*i, 100+50*i)); - // graph.addEdge(outputPort, cepNode.getInputPort(0)); - // outputPort = cepNode.getOutputPort(0); - // } - // - // graph.addEdge(outputPort, workflowNode.getInputPort(0)); - // - // OutputComponent outputComponent = new OutputComponent(); - // List outputPorts = workflowNode.getOutputPorts(); - // - // for (DataPort dataPort : outputPorts) { - // Node outNode = canvas.addNode(outputComponent, new Point( - // 500, 100)); - // graph.addEdge(dataPort, outNode.getInputPort(0)); - // } - // - // } - - /** - * @param workflowWsdlUri - * @throws URISyntaxException - * @throws ComponentException - * @throws ComponentRegistryException - * @throws GraphException - * - */ - private void deployStreamControlWorkflowIfNecessary(Workflow oldWorkflow) throws URISyntaxException, - ComponentRegistryException, ComponentException, GraphException { - - // create a new tab - GraphCanvas canvas = this.engine.getGUI().newGraphCanvas(true); - - // we can call with null because WSDL is already accessed at this point - WSComponent workflowComponent = new StreamReceiveComponent(oldWorkflow.getOdeInvokableWSDL(null, null)); - Node workflowNode = canvas.addNode(workflowComponent, new Point(600, 100)); - // - this.engine.getWorkflow().getWSDLs() - .put(((StreamReceiveNode) workflowNode).getWSDLID(), oldWorkflow.getOdeWorkflowWSDL(null, null)); - - URLComponentRegistry serviceRegistry = new URLComponentRegistry(new URI( - "https://pagodatree.cs.indiana.edu:17443/axis2/services/CEPService?wsdl")); - - new ComponentRegistryLoader(engine).load(serviceRegistry); - ComponentTreeNode cepComponent = (ComponentTreeNode) serviceRegistry.getComponentTree().getChildAt(0); - - Node cepNode = canvas.addNode(cepComponent.getComponentReference().getComponent(), new Point(300, 50)); - - Graph graph = this.engine.getGUI().getGraphCanvas().getGraph(); - List cepOutPorts = cepNode.getOutputPorts(); - int count = 0; - InputComponent inputComponent = new InputComponent(); - LinkedList inputNodes = getStaticInputNodes(oldWorkflow); - List workflowInPorts = workflowNode.getInputPorts(); - - for (InputNode inputNode : inputNodes) { - - List streamedInputOutPorts = inputNode.getOutputPort(0).getToPorts(); - for (Port streamedInputOutPort : streamedInputOutPorts) { - for (DataPort dataPort : workflowInPorts) { - if (dataPort.getName().equals(((DataPort) streamedInputOutPort).getName())) { - InputNode newNode = (InputNode) canvas.addNode(inputComponent, new Point(250 + 5 * count, - 200 + count * 50)); - graph.addEdge(newNode.getOutputPort(0), dataPort); - newNode.setDefaultValue(inputNode.getDefaultValue()); - break; - } - } - - } - ++count; - } - for (DataPort dataPort : workflowInPorts) { - if (dataPort.getFromNode() == null) { - graph.addEdge(cepOutPorts.get(0), dataPort); - } - } - - List inputs = cepNode.getInputPorts(); - count = 0; - for (DataPort dataPort : inputs) { - Node inputNode = canvas.addNode(inputComponent, new Point(5 + 5 * count, 5 + count * 50)); - graph.addEdge(inputNode.getOutputPort(0), dataPort); - ++count; - } - OutputComponent outputComponent = new OutputComponent(); - List outputPorts = workflowNode.getOutputPorts(); - - count = 0; - for (DataPort dataPort : outputPorts) { - Node outNode = canvas.addNode(outputComponent, new Point(900 + count * 5, 100 + count * 50)); - graph.addEdge(dataPort, outNode.getInputPort(0)); - ++count; - } - - } - - /** - * @param oldWorkflow - * @return static inputs - */ - private LinkedList getStaticInputNodes(Workflow workflow) { - - List nodes = workflow.getGraph().getNodes(); - LinkedList streamNodes = new LinkedList(); - LinkedList ret = new LinkedList(); - for (NodeImpl nodeImpl : nodes) { - if (nodeImpl instanceof StreamSourceNode) { - streamNodes.addAll(((StreamSourceNode) nodeImpl).getInputNodes()); - } - } - - for (NodeImpl nodeImpl : nodes) { - if (nodeImpl instanceof InputNode && !streamNodes.contains(nodeImpl)) { - ret.add((InputNode) nodeImpl); - } - } - return ret; - } - - private void hideUI() { - if (this.invokingDialog != null) { - this.invokingDialog.hide(); - } - } + public ODEDeploymentClient(XBayaEngine engine) { + this.engine = engine; + } + + public ODEDeploymentClient(XBayaEngine engine, WaitDialog invokingDialog) { + this(engine); + this.invokingDialog = invokingDialog; + } + + /** + * Deploy to ODE and XRegistry + * + * @param wfClient + * @param workflow + * @param gssCredential + * @param makePublic + */ + public void deploy(WorkflowProxyClient wfClient, Workflow workflow, + GSSCredential gssCredential, boolean makePublic) { + try { + + org.xmlpull.infoset.XmlElement workflowXml = workflow.toXML(); + XMLUtil.xmlElementToString(workflowXml); + wfClient.deploy(workflow, false); + hideUI(); + String oldWorkflowName = workflow.getName(); + + } catch (Throwable e) { + hideUI(); + + // The swing components get confused when there is html in the error + // message + if (e.getMessage() != null + && e.getMessage().indexOf("") != -1) { + this.engine.getErrorWindow().error( + e.getMessage().substring(0, + e.getMessage().indexOf(""))); + } else { + this.engine.getErrorWindow().error(e); + } + } + } + + /** + * @param oldWorkflow + * @return static inputs + */ + private LinkedList getStaticInputNodes(Workflow workflow) { + + List nodes = workflow.getGraph().getNodes(); + LinkedList streamNodes = new LinkedList(); + LinkedList ret = new LinkedList(); + for (NodeImpl nodeImpl : nodes) { + if (nodeImpl instanceof StreamSourceNode) { + streamNodes.addAll(((StreamSourceNode) nodeImpl) + .getInputNodes()); + } + } + + for (NodeImpl nodeImpl : nodes) { + if (nodeImpl instanceof InputNode + && !streamNodes.contains(nodeImpl)) { + ret.add((InputNode) nodeImpl); + } + } + return ret; + } + + private void hideUI() { + if (this.invokingDialog != null) { + this.invokingDialog.hide(); + } + } } \ No newline at end of file