Package org.apache.airavata.workflow.model.component.ws

Examples of org.apache.airavata.workflow.model.component.ws.WSComponent


    if (inputNumber.length > 1) {
      List<String> inputValues = createInputValues(listOfValues, inputNumber);
      for (final Iterator<String> iterator = inputValues.iterator(); iterator.hasNext();) {
        final String gfacURLString = this.getConfig().getConfiguration().getGFacURL().toString();
        final String input = iterator.next();
        WSComponent wsComponent = (WSComponent) middleNode.getComponent();
        final Invoker invoker2 = createInvokerForEachSingleWSNode(middleNode, gfacURLString, wsComponent);
        invokerList.add(invoker2);

        new Thread() {
          @Override
          public void run() {
            try {
              getInvoker(middleNode, invoker2);
              invokeGFacService(listOfValues, middleNode, inputNumber, input, invoker2);

            } catch (WorkflowException e) {
              WorkflowInterpreter.this.config.getGUI().getErrorWindow().error(e);
            }
          }

        }.start();

        try {
          Thread.sleep(3000);
        } catch (InterruptedException e) {
          WorkflowInterpreter.this.config.getGUI().getErrorWindow().error(e);
        }
      }
    } else {
      Invoker invoker = null;
      for (Iterator<String> iterator = listOfValues.iterator(); iterator.hasNext();) {
        String input = iterator.next();
        final String gfacURLString = this.getConfig().getConfiguration().getGFacURL().toString();
        WSComponent wsComponent = (WSComponent) middleNode.getComponent();
        invoker = createInvokerForEachSingleWSNode(middleNode, gfacURLString, wsComponent);
        invokerList.add(invoker);
        getInvoker(middleNode, invoker);

        // find inputs
View Full Code Here


  }

  private Invoker getInvoker(Node middleNode, Invoker invoker) throws WorkflowException {
    if (middleNode instanceof WSNode) {
      WSComponent wsComponent = (WSComponent) middleNode.getComponent();
      invoker.setup();
      invoker.setOperation(wsComponent.getOperationName());
    } else if (middleNode instanceof SubWorkflowNode) {
      // ((SubWorkflowNode) middleNode).getWorkflow();
      // this.config.getConfiguration();
      // TODO : Need to create a invoker!
      // new WorkflowInterpreter()
View Full Code Here

      throw new WorkflowException(e);
    }
  }

  protected void handleWSComponent(Node node) throws WorkflowException {
    WSComponent wsComponent = ((WSComponent) node.getComponent());
    QName portTypeQName = wsComponent.getPortTypeQName();
        Invoker invoker = this.invokerMap.get(node);

        // 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.getConfig().getConfiguration().getGFacURL().toString();
        if (null == wsdlLocation) {

            /* 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) {
                    AmazonSecurityContext amazonSecurityContext;
                    final String awsAccessKeyId = config.getAwsAccessKey();
                    final String awsSecretKey = config.getAwsSecretKey();
                    final String username = ((InstanceNode) n).getUsername();

                    if (((InstanceNode) n).isStartNewInstance()) {
                        final String amiId = ((InstanceNode) n).getIdAsValue();
                        final String instanceType = ((InstanceNode) n).getInstanceType();

                        amazonSecurityContext =
                                new AmazonSecurityContext(username, awsAccessKeyId, awsSecretKey, amiId, instanceType);
                    } else {
                        final String instanceId = ((InstanceNode) n).getIdAsValue();
                        amazonSecurityContext =
                                new AmazonSecurityContext(username, awsAccessKeyId, awsSecretKey, instanceId);
                    }

                    this.config.getConfiguration().setAmazonSecurityContext(amazonSecurityContext);
                }
            }

            if ((this.config.isGfacEmbeddedMode()) || (config.getAwsAccessKey() != null)) {
                invoker = new EmbeddedGFacInvoker(portTypeQName, WSDLUtil.wsdlDefinitions5ToWsdlDefintions3(wsNode.getComponent().getWSDL()), node.getID(),
                        this.config.getMessageBoxURL().toASCIIString(), this.config.getMessageBrokerURL().toASCIIString(), this.config.getNotifier(),
                        this.config.getTopic(), this.config.getAiravataAPI(), portTypeQName.getLocalPart(), this.config.getConfiguration());
            } else {
                invoker = new GenericInvoker(portTypeQName, WSDLUtil.wsdlDefinitions5ToWsdlDefintions3(wsNode.getComponent().getWSDL()), node.getID(),
                        this.config.getMessageBoxURL().toASCIIString(), gfacURLString, this.config.getNotifier());
            }

        } else {
      if (wsdlLocation.endsWith("/")) {
        wsdlLocation = wsdlLocation.substring(0, wsdlLocation.length() - 1);
      }
      if (!wsdlLocation.endsWith("?wsdl")) {
        wsdlLocation += "?wsdl";
      }
      invoker = new GenericInvoker(portTypeQName, wsdlLocation, node.getID(), this.getConfig().getConfiguration().getMessageBoxURL().toString(),
          gfacURLString, this.config.getNotifier());
    }
    invoker.setup();
    this.invokerMap.put(node, invoker);
    invoker.setOperation(wsComponent.getOperationName());

    // find inputs
    List<DataPort> inputPorts = node.getInputPorts();
    ODEClient odeClient = new ODEClient();
    for (DataPort port : inputPorts) {
View Full Code Here

    if (inputNumber.length > 1) {
      List<String> inputValues = createInputValues(listOfValues, inputNumber);
      for (final Iterator<String> iterator = inputValues.iterator(); iterator.hasNext();) {
        final String gfacURLString = this.getConfig().getConfiguration().getGFacURL().toString();
        final String input = iterator.next();
        WSComponent wsComponent = (WSComponent) middleNode.getComponent();
        final Invoker invoker2 = createInvokerForEachSingleWSNode(middleNode, gfacURLString, wsComponent);
        invokerList.add(invoker2);

        new Thread() {
          @Override
          public void run() {
            try {
              getInvoker(middleNode, invoker2);
              invokeGFacService(listOfValues, middleNode, inputNumber, input, invoker2);

            } catch (WorkflowException e) {
              WorkflowInterpreter.this.config.getGUI().getErrorWindow().error(e);
            }
          }

        }.start();

        try {
          Thread.sleep(3000);
        } catch (InterruptedException e) {
          WorkflowInterpreter.this.config.getGUI().getErrorWindow().error(e);
        }
      }
    } else {
      Invoker invoker = null;
      for (Iterator<String> iterator = listOfValues.iterator(); iterator.hasNext();) {
        String input = iterator.next();
        final String gfacURLString = this.getConfig().getConfiguration().getGFacURL().toString();
        WSComponent wsComponent = (WSComponent) middleNode.getComponent();
        invoker = createInvokerForEachSingleWSNode(middleNode, gfacURLString, wsComponent);
        invokerList.add(invoker);
        getInvoker(middleNode, invoker);

        // find inputs
View Full Code Here

  }

  private Invoker getInvoker(Node middleNode, Invoker invoker) throws WorkflowException {
    if (middleNode instanceof WSNode) {
      WSComponent wsComponent = (WSComponent) middleNode.getComponent();
      invoker.setup();
      invoker.setOperation(wsComponent.getOperationName());
    } else if (middleNode instanceof SubWorkflowNode) {
      // ((SubWorkflowNode) middleNode).getWorkflow();
      // this.config.getConfiguration();
      // TODO : Need to create a invoker!
      // new WorkflowInterpreter()
View Full Code Here

      throw new WorkflowException(e);
    }
  }

  protected void handleWSComponent(Node node) throws WorkflowException {
    WSComponent wsComponent = ((WSComponent) node.getComponent());
    QName portTypeQName = wsComponent.getPortTypeQName();
        Invoker invoker = this.invokerMap.get(node);

        // 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.getConfig().getConfiguration().getGFacURL().toString();
        if (null == wsdlLocation) {

            /* 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) {
                    AmazonSecurityContext amazonSecurityContext;
                    final String awsAccessKeyId = config.getAwsAccessKey();
                    final String awsSecretKey = config.getAwsSecretKey();
                    final String username = ((InstanceNode) n).getUsername();

                    if (((InstanceNode) n).isStartNewInstance()) {
                        final String amiId = ((InstanceNode) n).getIdAsValue();
                        final String instanceType = ((InstanceNode) n).getInstanceType();

                        amazonSecurityContext =
                                new AmazonSecurityContext(username, awsAccessKeyId, awsSecretKey, amiId, instanceType);
                    } else {
                        final String instanceId = ((InstanceNode) n).getIdAsValue();
                        amazonSecurityContext =
                                new AmazonSecurityContext(username, awsAccessKeyId, awsSecretKey, instanceId);
                    }

                    this.config.getConfiguration().setAmazonSecurityContext(amazonSecurityContext);
                }
            }

            if ((this.config.isGfacEmbeddedMode()) || (config.getAwsAccessKey() != null)) {
                invoker = new EmbeddedGFacInvoker(portTypeQName, WSDLUtil.wsdlDefinitions5ToWsdlDefintions3(wsNode.getComponent().getWSDL()), node.getID(),
                        this.config.getMessageBoxURL().toASCIIString(), this.config.getMessageBrokerURL().toASCIIString(), this.config.getNotifier(),
                        this.config.getTopic(), this.config.getAiravataAPI(), portTypeQName.getLocalPart(), this.config.getConfiguration());
            } else {
                invoker = new GenericInvoker(portTypeQName, WSDLUtil.wsdlDefinitions5ToWsdlDefintions3(wsNode.getComponent().getWSDL()), node.getID(),
                        this.config.getMessageBoxURL().toASCIIString(), gfacURLString, this.config.getNotifier());
            }

        } else {
      if (wsdlLocation.endsWith("/")) {
        wsdlLocation = wsdlLocation.substring(0, wsdlLocation.length() - 1);
      }
      if (!wsdlLocation.endsWith("?wsdl")) {
        wsdlLocation += "?wsdl";
      }
      invoker = new GenericInvoker(portTypeQName, wsdlLocation, node.getID(), this.getConfig().getConfiguration().getMessageBoxURL().toString(),
          gfacURLString, this.config.getNotifier());
    }
    invoker.setup();
    this.invokerMap.put(node, invoker);
    invoker.setOperation(wsComponent.getOperationName());

    // find inputs
    List<DataPort> inputPorts = node.getInputPorts();
    ODEClient odeClient = new ODEClient();
    for (DataPort port : inputPorts) {
View Full Code Here

    if (inputNumber.length > 1) {
      List<String> inputValues = createInputValues(listOfValues, inputNumber);
      for (final Iterator<String> iterator = inputValues.iterator(); iterator.hasNext();) {
        final String gfacURLString = this.getConfig().getConfiguration().getGFacURL().toString();
        final String input = iterator.next();
        WSComponent wsComponent = (WSComponent) middleNode.getComponent();
        final Invoker invoker2 = createInvokerForEachSingleWSNode(middleNode, gfacURLString, wsComponent);
        invokerList.add(invoker2);

        new Thread() {
          @Override
          public void run() {
            try {
              getInvoker(middleNode, invoker2);
              invokeGFacService(listOfValues, middleNode, inputNumber, input, invoker2);

            } catch (WorkflowException e) {
              WorkflowInterpreter.this.config.getGUI().getErrorWindow().error(e);
            }
          }

        }.start();

        try {
          Thread.sleep(3000);
        } catch (InterruptedException e) {
          WorkflowInterpreter.this.config.getGUI().getErrorWindow().error(e);
        }
      }
    } else {
      Invoker invoker = null;
      for (Iterator<String> iterator = listOfValues.iterator(); iterator.hasNext();) {
        String input = iterator.next();
        final String gfacURLString = this.getConfig().getConfiguration().getGFacURL().toString();
        WSComponent wsComponent = (WSComponent) middleNode.getComponent();
        invoker = createInvokerForEachSingleWSNode(middleNode, gfacURLString, wsComponent);
        invokerList.add(invoker);
        getInvoker(middleNode, invoker);

        // find inputs
View Full Code Here

  }

  private Invoker getInvoker(Node middleNode, Invoker invoker) throws WorkflowException {
    if (middleNode instanceof WSNode) {
      WSComponent wsComponent = (WSComponent) middleNode.getComponent();
      invoker.setup();
      invoker.setOperation(wsComponent.getOperationName());
    } else if (middleNode instanceof SubWorkflowNode) {
      // ((SubWorkflowNode) middleNode).getWorkflow();
      // this.config.getConfiguration();
      // TODO : Need to create a invoker!
      // new WorkflowInterpreter()
View Full Code Here

            if (originalFromNode instanceof InputNode) {
                // notification that includes the input of the workflow.
                output = getWorkflowInput(fromNodeID);
            } else if (originalFromNode instanceof WSNode) {
                // Retrieve input value from notification.
                WSComponent component = ((WSNode) originalFromNode).getComponent();
                String messageName = component.getOutputTypeName();
                String parameterName = originalFromPort.getComponentPort().getName();
                output = getOutput(fromNodeID, messageName, parameterName);
            } else {
                // This should not happen.
                throw new WorkflowRuntimeException(originalFromNode.getClass().getName());
View Full Code Here

    // .scheduleDynamically();
    // }
  }

  protected void handleWSComponent(Node node) throws WorkflowException {
    WSComponent wsComponent = ((WSComponent) node.getComponent());
    QName portTypeQName = wsComponent.getPortTypeQName();
    Invoker invoker = this.invokerMap.get(node);
    // 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.getConfig().getConfiguration().getGFacURL().toString();
    if (null == wsdlLocation) {
      if (gfacURLString.startsWith("https")) {
        LeadContextHeader leadCtxHeader = null;
        // try {
        // leadCtxHeader =
        // (LeadContextHeader)getInputViaInteractor(WorkflowExecutionMessage.INPUT_LEAD_CONTEXT_HEADER,
        // wsNode);
        // } catch (Exception e1) {
        // throw new WorkflowException(e1);
        // }
        try {
          leadCtxHeader = XBayaUtil.buildLeadContextHeader(this.getWorkflow(), this.getConfig().getConfiguration(), new MonitorConfiguration(this
              .getConfig().getConfiguration().getBrokerURL(), this.config.getTopic(), true, this.getConfig().getConfiguration()
              .getMessageBoxURL()), wsNode.getID(), null);
          // if (this.config.getMode() ==
          // WorkflowInterpreterConfiguration.GUI_MODE) {
          // leadCtxHeader = XBayaUtil.buildLeadContextHeader(
          // this.getWorkflow(),
          // this.getConfig().getConfiguration(),
          // new
          // MonitorConfiguration(this.getConfig().getConfiguration()
          // .getBrokerURL(), this.config.getTopic(), true,
          // this.getConfig().getConfiguration().getMessageBoxURL()),
          // wsNode.getID(), null);
          // } else {
          // leadCtxHeader = XBayaUtil.buildLeadContextHeader(
          // this.getWorkflow(),
          // this.getConfig().getConfiguration(),
          // new
          // MonitorConfiguration(this.getConfig().getConfiguration()
          // .getBrokerURL(), this.config.getTopic(), true,
          // this.getConfig().getConfiguration().getMessageBoxURL()),
          // wsNode.getID(), null);
          // }
        } catch (URISyntaxException e) {
          throw new WorkflowException(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 WorkflowRuntimeException(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.config.getMonitor().getConfiguration().getMessageBoxURL()
            .toString(), leadCtxHeader, this.config.getNotifier().createServiceNotificationSender(node.getID()));

      } else {
        // invoker=(Invoker)getInputViaInteractor(WorkflowExecutionMessage.INPUT_GFAC_INVOKER,
        // new GFacInvokerData(gfacEmbeddedMode,portTypeQName,
        // WSDLUtil.wsdlDefinitions5ToWsdlDefintions3(wsNode
        // .getComponent().getWSDL()), node.getID(),
        // this.engine.getMonitor().getConfiguration()
        // .getMessageBoxURL().toASCIIString(),
        // this.engine.getMonitor().getConfiguration().getBrokerURL().toASCIIString(),
        // this.config.getNotifier(), this.config.getTopic(),
        // this.engine.getConfiguration().getJcrComponentRegistry().getRegistry(),
        // portTypeQName.getLocalPart(),this.engine.getConfiguration()));
        if (this.config.isGfacEmbeddedMode()) {
          invoker = new EmbeddedGFacInvoker(portTypeQName, WSDLUtil.wsdlDefinitions5ToWsdlDefintions3(wsNode.getComponent().getWSDL()), node.getID(),
              this.config.getMessageBoxURL().toASCIIString(), this.config.getMessageBrokerURL().toASCIIString(), this.config.getNotifier(),
              this.config.getTopic(), this.config.getRegistry(), portTypeQName.getLocalPart(), this.config.getConfiguration());
        } else {
          invoker = new GenericInvoker(portTypeQName, WSDLUtil.wsdlDefinitions5ToWsdlDefintions3(wsNode.getComponent().getWSDL()), node.getID(),
              this.config.getMessageBoxURL().toASCIIString(), gfacURLString, this.config.getNotifier());
        }

      }

    } else {
      if (wsdlLocation.endsWith("/")) {
        wsdlLocation = wsdlLocation.substring(0, wsdlLocation.length() - 1);
      }
      if (!wsdlLocation.endsWith("?wsdl")) {
        wsdlLocation += "?wsdl";
      }
      invoker = new GenericInvoker(portTypeQName, wsdlLocation, node.getID(), this.getConfig().getConfiguration().getMessageBoxURL().toString(),
          gfacURLString, this.config.getNotifier());
    }
    invoker.setup();
    this.invokerMap.put(node, invoker);
    invoker.setOperation(wsComponent.getOperationName());

    // find inputs
    List<DataPort> inputPorts = node.getInputPorts();
    ODEClient odeClient = new ODEClient();
    for (DataPort port : inputPorts) {
View Full Code Here

TOP

Related Classes of org.apache.airavata.workflow.model.component.ws.WSComponent

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.