Package org.apache.airavata.xbaya.component.ws

Examples of org.apache.airavata.xbaya.component.ws.WSComponent


            XmlElement literalElement = XMLUtil.BUILDER.newFragment(GpelAssignCopyFrom.LITERAL_EL);
            literalElement.addChild(value);
            from.setLiteral(literalElement);
        } else if (fromNode instanceof WSNode) {
            String fromID = fromNode.getID();
            WSComponent fromWsdlComponent = (WSComponent) fromNode.getComponent();

            WSComponentPort fromWsdlPort = (WSComponentPort) fromPort.getComponentPort();

            from.setVariable(fromID + OUTPUT_SUFFIX);
            from.setPart(fromWsdlComponent.getOutputPartName());

            if (fromWsdlPort.isSchemaUsed()) {
                String typesTargetNamespace = fromWsdlPort.getTargetNamespace();
                XmlNamespace namespace = XMLUtil.declareNamespaceIfNecessary(fromID.toLowerCase() + TYPENS_SUFFIX,
                        typesTargetNamespace, false, this.process.xml());

                from.setQuery("/" + namespace.getPrefix() + ":" + fromWsdlComponent.getOutputTypeName() + "/"
                        + fromWsdlPort.getName());
            } else {
                // No query needed?
            }
        } else if (fromNode instanceof ForEachNode) {
View Full Code Here


                    + this.workflowWSDL.getWorkflowOutputMessageElementName() + "/" + toNode.getID());
        } else {
            WSComponentPort toComponentPort = (WSComponentPort) toPort.getComponentPort();

            String toID = toNode.getID();
            WSComponent toWSComponent = (WSComponent) toNode.getComponent();
            to.setVariable(toID + INPUT_SUFFIX);
            to.setPart(toWSComponent.getInputPartName());

            if (toComponentPort.isSchemaUsed()) {
                // Normal case.
                // e.g. <part name="name" type="typens:fooType">
                String typesTargetNamespace = toComponentPort.getTargetNamespace();
                XmlNamespace namespace = XMLUtil.declareNamespaceIfNecessary(toID.toLowerCase() + TYPENS_SUFFIX,
                        typesTargetNamespace, false, this.process.xml());

                String typeName = input ? toWSComponent.getInputTypeName() : toWSComponent.getOutputTypeName();
                to.setQuery("/" + namespace.getPrefix() + ":" + typeName + "/" + toComponentPort.getName());
            } else {
                // e.g. <part name="name" type="xsd:string">
                // No query is needed?
            }
View Full Code Here

          .scheduleDynamically();
    }
  }

  private void handleWSComponent(Node node) throws XBayaException {
    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.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);

                    }
        }
      }

    } 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.configuration.getMessageBoxURL()
              .toString(), gfacURLString, this.notifier);
    }
    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

      for (final Iterator<String> iterator = inputValues.iterator(); iterator
          .hasNext();) {
        final String gfacURLString = this.configuration.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 (XBayaException e) {
              WorkflowInterpreter.this.engine.getErrorWindow()
                  .error(e);
            }
          }

        }.start();

        try {
          Thread.sleep(3000);
        } catch (InterruptedException e) {
          WorkflowInterpreter.this.engine.getErrorWindow().error(e);
        }
      }
    } else {
      Invoker invoker = null;
      for (Iterator<String> iterator = listOfValues.iterator(); iterator
          .hasNext();) {
        String input = iterator.next();
        final String gfacURLString = this.configuration.getGFacURL()
            .toString();

        WSComponent wsComponent = (WSComponent) middleNode
            .getComponent();
        invoker = createInvokerForEachSingleWSNode(middleNode,
            gfacURLString, wsComponent);
        invokerList.add(invoker);
        getInvoker(middleNode, invoker);
View Full Code Here

     */
    public List<WSComponentPort> getInputs() throws ComponentException {
        if (this.workflowWSDL == null) {
            throw new IllegalStateException();
        }
        WSComponent component = WSComponentFactory.createComponent(this.workflowWSDL);
        return component.getInputPorts();
    }
View Full Code Here

     */
    public List<WSComponentPort> getOutputs() throws ComponentException {
        if (this.workflowWSDL == null) {
            throw new IllegalStateException();
        }
        WSComponent component = WSComponentFactory.createComponent(this.workflowWSDL);
        return component.getOutputPorts();
    }
View Full Code Here

                    // 2.2.6_1 or below.
                    operation = WSDLUtil.getFirstOperationName(wsdl, portType);
                }
                WSComponentKey key = new WSComponentKey(id, portType, operation);

                WSComponent component;
                if (components.containsKey(key)) {
                    component = components.get(key);
                } else {
                    component = WSComponentFactory.createComponent(wsdl, portType, operation);
                    components.put(key, component);
View Full Code Here

  }

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

            arguments.add(notifConfig.getMessageBoxURL().toString());
        }

        try {
            for (WSNode node : GraphUtil.getWSNodes(this.workflow.getGraph())) {
                WSComponent component = node.getComponent();
                QName portTypeQName = component.getPortTypeQName();
                WsdlDefinitions wsdl = component.getWSDL();

                File file = File.createTempFile(".xbaya-" + portTypeQName.getLocalPart(), XBayaConstants.WSDL_SUFFIX);
                this.tmpWSDLFiles.add(file);
                XMLUtil.saveXML(wsdl.xml(), file);
View Full Code Here

TOP

Related Classes of org.apache.airavata.xbaya.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.