Package org.apache.airavata.xbaya.graph.ws

Examples of org.apache.airavata.xbaya.graph.ws.WSNode


    /**
     * @see org.apache.airavata.xbaya.component.Component#createNode(org.apache.airavata.xbaya.graph.Graph)
     */
    @Override
    public Node createNode(Graph graph) {
        return createNode(graph, new WSNode(graph));
    }
View Full Code Here


            // If there are more than one nodes to invoke, they can run
            // concurrently using threads.
            boolean thread = (nextNodes.size() > 1);
            for (Node node : nextNodes) {
                if (node instanceof WSNode) {
                    WSNode wsNode = (WSNode) node;
                    writeInvocation(wsNode, thread, pw);

                } else {
                    // TODO conditions, loops might come here.
                }
View Full Code Here

        Collection<Node> nextNodes = getNextNodes();
        while (nextNodes.size() > 0) {
            for (Node node : nextNodes) {

                if (node instanceof WSNode) {
                    WSNode wsNode = (WSNode) node;
                    node.getInputPorts();
                    writeSplitorPerService(scufl, wsNode);

                } else {
                    // TODO conditions, loops might come here.
View Full Code Here

    private void writeServices(XmlElement scufl) throws GraphException {

        Collection<NodeImpl> nextNodes = this.graph.getNodes();
        for (NodeImpl node : nextNodes) {
            if (node instanceof WSNode) {
                WSNode wsNode = (WSNode) node;
                createWSProcess(wsNode, scufl);
            }
        }
    }
View Full Code Here

        List<DataPort> inputPorts = node.getInputPorts();
        for (DataPort inPort : inputPorts) {
            Port fromPort = inPort.getFromPort();
            Node fromNode = inPort.getFromNode();
            if (fromNode instanceof WSNode) {
                WSNode fromWsNode = (WSNode) fromNode;
                if (null != fromPort && fromPort instanceof DataPort) {
                    DataPort fromDataPort = (DataPort) fromPort;
                    WsdlDefinitions wsdl = engine.getWorkflow().getWSDLs().get(fromWsNode.getWSDLID());
                    Iterator<XmlNamespace> itr = wsdl.xml().namespaces().iterator();
                    try {
                        XmlElement schema = wsdl.getTypes().element("schema").clone();
                        // do not change the following ordering of setting
                        // namespaces.
View Full Code Here

     */
    public Collection<XmlElement> getWSDLs() {
        Collection<XmlElement> wsdls = new ArrayList<XmlElement>();
        for (Node node : this.graph.getNodes()) {
            if (node instanceof WSNode) {
                WSNode wsNode = (WSNode) node;
                WSComponent component = wsNode.getComponent();
                wsdls.add(component.toXML());
            }
        }
        return wsdls;
    }
View Full Code Here

    // We do this because invokers cannot be cached because the puretls
    // expires
    if (invoker != null) {
      this.invokerMap.remove(invoker);
    }
    final WSNode wsNode = (WSNode) node;
    String wsdlLocation = InterpreterUtil.getEPR(wsNode);
    final String gfacURLString = this.configuration.getGFacURL().toString();
    if (null == wsdlLocation) {
      if (gfacURLString.startsWith("https")) {
        GSSCredential proxy = null;
        if (this.mode == GUI_MODE) {
          this.myProxyChecker.loadIfNecessary();
          MyProxyClient myProxyClient = this.engine
              .getMyProxyClient();
          proxy = myProxyClient.getProxy();
        } else {
          proxy = SecurityUtil.getGSSCredential(this.username,
              this.password,
              this.configuration.getMyProxyServer());
        }

        LeadContextHeader leadCtxHeader = null;
        try {
          if (this.mode == GUI_MODE) {
            leadCtxHeader = XBayaUtil.buildLeadContextHeader(
                this.getWorkflow(),
                this.configuration,
                new MonitorConfiguration(this.configuration
                    .getBrokerURL(), this.topic, true,
                    this.configuration.getMessageBoxURL()),
                wsNode.getID(), null);
          } else {
            leadCtxHeader = XBayaUtil.buildLeadContextHeader(
                this.getWorkflow(),
                this.configuration,
                new MonitorConfiguration(this.configuration
                    .getBrokerURL(), this.topic, true,
                    this.configuration.getMessageBoxURL()),
                wsNode.getID(), null);
          }
        } catch (URISyntaxException e) {
          throw new XBayaException(e);
        }

        leadCtxHeader.setServiceId(node.getID());
        try {
          leadCtxHeader.setWorkflowId(new URI(this.getWorkflow()
              .getName()));

          // We do this so that the wsdl resolver can is setup
          // wsdlresolver.getInstance is static so once this is
          // done
          // rest of the loading should work.

          XBayaSecurity.init();

        } catch (URISyntaxException e) {
          throw new XBayaRuntimeException(e);
        }

        /*
         * Resource Mapping Header
         */
        if (this.resourceMapping != null) {
          leadCtxHeader.setResourceMapping(this.resourceMapping);
        }

        /*
         * If there is a instance control component connects to this
         * component send information in soap header
         */
        for (Node n : wsNode.getControlInPort().getFromNodes()) {
          if (n instanceof InstanceNode) {
            // TODO make it as constant
            LeadResourceMapping x = new LeadResourceMapping(
                "AMAZON");

            x.addAttribute("ACCESS_KEY", AmazonCredential
                .getInstance().getAwsAccessKeyId());
            x.addAttribute("SECRET_KEY", AmazonCredential
                .getInstance().getAwsSecretAccessKey());

            if (((InstanceNode) n).isStartNewInstance()) {
              x.addAttribute("AMI_ID",
                  ((InstanceNode) n).getIdAsValue());
              x.addAttribute("INS_TYPE",
                  ((InstanceNode) n).getInstanceType());
            } else {
              x.addAttribute("INS_ID",
                  ((InstanceNode) n).getIdAsValue());
            }

            x.addAttribute("USERNAME",
                ((InstanceNode) n).getUsername());

            // set to leadHeader
            leadCtxHeader.setResourceMapping(x);
          }
        }

        invoker = new WorkflowInvokerWrapperForGFacInvoker(
            portTypeQName, gfacURLString, this.engine.getMonitor()
                .getConfiguration().getMessageBoxURL()
                .toString(), leadCtxHeader,
            this.notifier.createServiceNotificationSender(node
                .getID()));

      } else {
        if (this.mode == GUI_MODE) {
          // if user configure the msgBox url using the UI we have to
          // pick the latest one which
          // set by the UI
                    if (this.gfacEmbeddedMode) {
                        invoker = new EmbeddedGFacInvoker(portTypeQName,
                                WSDLUtil.wsdlDefinitions5ToWsdlDefintions3(wsNode
                                        .getComponent().getWSDL()), node.getID(),
                                this.engine.getMonitor().getConfiguration()
                                        .getMessageBoxURL().toASCIIString(),
                                this.engine.getMonitor().getConfiguration().getBrokerURL().toASCIIString(), this.notifier, this.topic,
                                this.engine.getConfiguration().getJcrComponentRegistry().getRegistry(),
                                portTypeQName.getLocalPart(),this.engine.getConfiguration());
                    } else {
                        invoker = new GenericInvoker(portTypeQName,
                                WSDLUtil.wsdlDefinitions5ToWsdlDefintions3(wsNode
                                        .getComponent().getWSDL()), node.getID(),
                                this.engine.getMonitor().getConfiguration()
                                        .getMessageBoxURL().toASCIIString(),
                                gfacURLString, this.notifier);
                    }
        } else {
                    if(this.gfacEmbeddedMode){
                        invoker = new EmbeddedGFacInvoker(portTypeQName,
                                WSDLUtil.wsdlDefinitions5ToWsdlDefintions3(wsNode
                                        .getComponent().getWSDL()), node.getID(),
                                this.configuration.getMessageBoxURL()
                                        .toASCIIString(),
                                this.configuration.getBrokerURL().toASCIIString(), this.notifier, this.topic, configuration.getJcrComponentRegistry().getRegistry(),
                                portTypeQName.getLocalPart(),this.configuration);
                    }else{
                        invoker = new GenericInvoker(portTypeQName,
                                WSDLUtil.wsdlDefinitions5ToWsdlDefintions3(wsNode
                                        .getComponent().getWSDL()), node.getID(),
                                this.configuration.getMessageBoxURL()
                                        .toASCIIString(), gfacURLString,
                                this.notifier);

View Full Code Here

            wsNodes.add(subWorkflowNode);
          }
        }

        for (int i = 0; i < wsNodes.size(); i++) {
          final WSNode node1 = (WSNode) wsNodes.get(i);
          SystemComponentInvoker systemInvoker = null;
          List<DataPort> outputPorts1 = node1.getOutputPorts();
          List<Node> endForEachNodes = new ArrayList<Node>();
          for (DataPort port : outputPorts1) {
            Iterator<Node> endForEachNodeItr1 = port.getToNodes()
                .iterator();
            while (endForEachNodeItr1.hasNext()) {
              Node node2 = endForEachNodeItr1.next();
              if (node2 instanceof EndForEachNode) {
                endForEachNodes.add(node2);
              } else if (node2 instanceof OutputNode) {
                // intentionally left noop
              } else {
                throw new WorkFlowInterpreterException(
                    "Found More than one node inside foreach");
              }

            }
          }
          final List<Node> finalEndForEachNodes = endForEachNodes;

          Iterator<Node> endForEachNodeItr1 = node1.getOutputPort(0)
              .getToNodes().iterator();
          while (endForEachNodeItr1.hasNext()) {
            Node node2 = endForEachNodeItr1.next();
            // Start reading input came for foreach node
            int parallelRuns = listOfValues.size()
                * node1.getOutputPorts().size();
            if (listOfValues.size() > 0) {
              forEachNode.getGUI().setBodyColor(
                  NodeState.EXECUTING.color);
              node1.getGUI().setBodyColor(
                  NodeState.EXECUTING.color);
              List<DataPort> outputPorts = node1.getOutputPorts();
              final AtomicInteger counter = new AtomicInteger();
              for (Node endFor : endForEachNodes) {
                systemInvoker = new SystemComponentInvoker();
                this.invokerMap.put(endFor, systemInvoker);
              }
              final Map<Node, Invoker> finalMap = this.invokerMap;
              new Thread() {
                @Override
                public void run() {
                  try {
                    runInThread(listOfValues, forEachNode,
                        node1, finalEndForEachNodes,
                        finalMap, counter, inputNumbers);
                  } catch (XBayaException e) {

                    WorkflowInterpreter.this.engine
                        .getErrorWindow().error(e);
                  }
                }

              }.start();

              while (counter.intValue() < parallelRuns) {
                try {
                  Thread.sleep(100);
                } catch (InterruptedException e) {
                  Thread.currentThread().interrupt();
                }

              }
              if (!(node2 instanceof OutputNode)) {
                listOfValues.removeAll(listOfValues);
                String output = (String) systemInvoker
                    .getOutput(node1.getOutputPort(0)
                        .getName());
                XmlElement xmlElement = XMLUtil
                    .stringToXmlElement("<result>" + output
                        + "</result>");
                Iterator iterator1 = xmlElement.children()
View Full Code Here

TOP

Related Classes of org.apache.airavata.xbaya.graph.ws.WSNode

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.