Package org.apache.airavata.xbaya.invoker

Examples of org.apache.airavata.xbaya.invoker.Invoker


    /**
     * @throws WorkflowException
     */
    public void testService() throws WorkflowException {
        NotificationSender notifier = new NotificationSender(this.configuration.getBrokerURL(), "test-topic2");
        Invoker invoker = new GenericInvoker(QName.valueOf(TEST_SERVICE_QNAME), TEST_AWSDL, "test-node", null,
                this.configuration.getGFacURL().toString(), notifier);
        invoker.setup();
        invoker.setOperation("Run");
        invoker.setInput("inparam1", "test");
        invoker.invoke();
        Object output = invoker.getOutput("outparam1");
        logger.info("output: " + output);
    }
View Full Code Here


     * @return The invoker
     * @throws WorkflowException
     */
    public static Invoker createInvoker(QName portTypeQName, WsdlDefinitions definitions, String gfacURL,
            String messageBoxURL, LeadContextHeader leadContext) throws WorkflowException {
        Invoker invoker = null;

        if (definitions != null && definitions.getServices().iterator().hasNext()) {
            // check if this web service supports asynchronous invocation
            if (WSDLUtil.isAsynchronousSupported(WSDLUtil.wsdlDefinitions3ToWsdlDefintions5(definitions))) {
                invoker = new AsynchronousInvoker(definitions, messageBoxURL);
View Full Code Here

        return invoker;
    }

    public static Invoker createInvoker(QName portTypeQName, WsdlDefinitions definitions, String gfacURL,
            String messageBoxURL, WorkflowContextHeaderBuilder builder, boolean differ) throws WorkflowException {
        Invoker invoker = null;

        if (definitions != null && definitions.getServices().iterator().hasNext()) {
            // check if this web service supports asynchronous invocation
            if (WSDLUtil.isAsynchronousSupported(WSDLUtil.wsdlDefinitions3ToWsdlDefintions5(definitions))) {
                invoker = new AsynchronousInvoker(definitions, messageBoxURL);
View Full Code Here

                        new URI(this.dynamicFactoryWSDLLocation));
            }

            // Create Invoker
            // FIXME: Should pass the right leadcontext header for last argument
            Invoker invoker = InvokerFactory.createInvoker(new QName("http://extreme.indiana.edu",
                    "ServiceCreatorPortType"), definitions, null, null, null);

            invoker.setup();

            invoker.setOperation("deployServiceFromClass");
            invoker.setInput("classAsString", code);
            invoker.invoke();
            invoker.getOutput("return");
        } catch (Exception e) {
            throw new XBayaException(e);
        }

    }
View Full Code Here

        service.run();
        String adderWSDLLoc = service.getServiceWsdlLocation();

        WorkflowNotifiable notifier = new NotificationSender(XBayaConstants.DEFAULT_BROKER_URL.toString(), "test-topic");

        Invoker invoker = new GenericInvoker(null, adderWSDLLoc, "adder", null, null, notifier);
        invoker.setup();
        invoker.setOperation("add");
        invoker.setInput("x", 2);
        invoker.setInput("y", 3);
        invoker.invoke();

        Object output = invoker.getOutput("z");
        logger.info("z = " + output);

        service.shutdownServer();
    }
View Full Code Here

        multiplier.run();
        String multiplierWSDLLoc = multiplier.getServiceWsdlLocation();

        WorkflowNotifiable notifier = new NotificationSender(XBayaConstants.DEFAULT_BROKER_URL.toString(), "test-topic");

        Invoker adderInvoker1 = new GenericInvoker(null, adderWSDLLoc, "adder", null, null, notifier);
        adderInvoker1.setup();
        adderInvoker1.setOperation("add");
        adderInvoker1.setInput("x", 2);
        adderInvoker1.setInput("y", 3);
        adderInvoker1.invoke();

        Object output1 = adderInvoker1.getOutput("z");
        logger.info("output1 = " + output1);

        Invoker adderInvoker2 = new GenericInvoker(null, adderWSDLLoc, "adder", null, null, notifier);
        adderInvoker2.setup();
        adderInvoker2.setOperation("add");
        adderInvoker2.setInput("x", 4);
        adderInvoker2.setInput("y", 5);
        adderInvoker2.invoke();

        Object output2 = adderInvoker2.getOutput("z");
        logger.info("output2 = " + output2);

        Invoker multiplierInvoker = new GenericInvoker(null, multiplierWSDLLoc, "multiplier", null, null, notifier);
        multiplierInvoker.setup();
        multiplierInvoker.setOperation("multiply");
        multiplierInvoker.setInput("x", output1);
        multiplierInvoker.setInput("y", output2);
        multiplierInvoker.invoke();

        Object output3 = multiplierInvoker.getOutput("z");
        logger.info("output3 = " + output3);

        adder.shutdownServer();
        multiplier.shutdownServer();
    }
View Full Code Here

     * @return The invoker
     * @throws XBayaException
     */
    public static Invoker createInvoker(QName portTypeQName, WsdlDefinitions definitions, String gfacURL,
            String messageBoxURL, LeadContextHeader leadContext) throws XBayaException {
        Invoker invoker = null;

        if (definitions != null && definitions.getServices().iterator().hasNext()) {
            // check if this web service supports asynchronous invocation
            if (WSDLUtil.isAsynchronousSupported(WSDLUtil.wsdlDefinitions3ToWsdlDefintions5(definitions))) {
                invoker = new AsynchronousInvoker(definitions, messageBoxURL);
View Full Code Here

        return invoker;
    }

    public static Invoker createInvoker(QName portTypeQName, WsdlDefinitions definitions, String gfacURL,
            String messageBoxURL, WorkflowContextHeaderBuilder builder, boolean differ) throws XBayaException {
        Invoker invoker = null;

        if (definitions != null && definitions.getServices().iterator().hasNext()) {
            // check if this web service supports asynchronous invocation
            if (WSDLUtil.isAsynchronousSupported(WSDLUtil.wsdlDefinitions3ToWsdlDefintions5(definitions))) {
                invoker = new AsynchronousInvoker(definitions, messageBoxURL);
View Full Code Here

        }
        String[] vals = returnValForProvenance.toString().split(",");
        listOfValues.addAll(Arrays.asList(vals));
      }
    } else {
      Invoker workflowInvoker = invokerMap
          .get(forEachInputNode);
      if (workflowInvoker != null) {
        if (workflowInvoker instanceof GenericInvoker) {

          returnValForProvenance = ((GenericInvoker) workflowInvoker)
              .getOutputs();
          String message = returnValForProvenance.toString();

          XmlElement msgElmt = XmlConstants.BUILDER
              .parseFragmentFromString(message);
          Iterator children = msgElmt.children().iterator();
          while (children.hasNext()) {
            Object object = children.next();
            // foreachWSNode.getInputPort(0).getType()
            if (object instanceof XmlElement) {
              listOfValues.add(XmlConstants.BUILDER
                  .serializeToString(object));
              // TODO fix for simple type - Done
            }
          }
        } else if (workflowInvoker instanceof WorkflowInvokerWrapperForGFacInvoker) {
          String outputName = forEachInputNode.getOutputPort(0)
              .getName();
          returnValForProvenance = workflowInvoker
              .getOutput(outputName);
          org.xmlpull.v1.builder.XmlElement msgElmt = (org.xmlpull.v1.builder.XmlElement) returnValForProvenance;
          Iterator children = msgElmt.children();
          while (children.hasNext()) {
            Object object = children.next();
            if (object instanceof org.xmlpull.v1.builder.XmlElement) {
              org.xmlpull.v1.builder.XmlElement child = (org.xmlpull.v1.builder.XmlElement) object;
              Iterator valItr = child.children();
              if (valItr.hasNext()) {
                Object object2 = valItr.next();
                if (object2 instanceof String) {
                  listOfValues.add(object2.toString());
                }
              }
            }
          }
        } else if (workflowInvoker instanceof SystemComponentInvoker) {
                    int index = forEachInputNode.getOutputPorts().indexOf(inputPort.getEdge(0).getFromPort());
                    String outputName = "";
                    if(forEachInputNode.getInputPort(index) instanceof SystemDataPort){
                       outputName = ((SystemDataPort)forEachInputNode.getInputPort(index)).getWSComponentPort().getName();
                    }else if(forEachInputNode.getInputPort(index) instanceof WSPort){
                         outputName = ((SystemDataPort)forEachInputNode.getInputPort(
                        forEachInputNode.getOutputPorts().indexOf(inputPort.getEdge(0).getFromPort()))).getWSComponentPort().getName();
                    }
          returnValForProvenance = workflowInvoker
              .getOutput(outputName);
          XmlElement msgElmt = XmlConstants.BUILDER
              .parseFragmentFromString("<temp>"
                  + returnValForProvenance + "</temp>");
          Iterator valItr = msgElmt.children().iterator();
View Full Code Here

    } else if (fromNode instanceof ConstantNode) {
      outputVal = ((ConstantNode) fromNode).getValue();
    } else if (fromNode instanceof DifferedInputNode && ((DifferedInputNode) fromNode).isConfigured()) {
      outputVal = ((DifferedInputNode) fromNode).getDefaultValue();
    } else if (fromNode instanceof EndifNode) {
      Invoker fromInvoker = invokerMap.get(fromNode);
      outputVal = fromInvoker.getOutput(inputPort.getFromPort().getID());
    } else if (fromNode instanceof InstanceNode) {
      return ((InstanceNode) fromNode).getOutputInstanceId();
    } else if (fromNode instanceof EndForEachNode) {
      outputVal = "";
      Invoker workflowInvoker = invokerMap.get(fromNode);
      String outputName = "";
            if (inputPort instanceof SystemDataPort) {
                outputName = ((SystemDataPort) inputPort).getWSComponentPort().getName();

            } else if (inputPort instanceof WSPort) {
                outputName = ((SystemDataPort)fromNode.getInputPort(
                        fromNode.getOutputPorts().indexOf(inputPort.getEdge(0).getFromPort()))).getWSComponentPort().getName();
            }
      XmlElement msgElmt = XmlConstants.BUILDER
          .parseFragmentFromString("<temp>"
              + workflowInvoker.getOutput(outputName) + "</temp>");
      Iterator valItr = msgElmt.children().iterator();
      while (valItr.hasNext()) {
        Object object2 = valItr.next();
        if (object2 instanceof XmlElement) {

                    if(((XmlElement) object2).children().iterator().hasNext()){
          outputVal = outputVal
              + ","
              + ((XmlElement) object2).children().iterator()
                  .next().toString();
                    }
        }
      }

            if (((String) outputVal).length() == 0) {
                throw new XBayaException("Empty Output Generated");
            }
            outputVal = ((String) outputVal).substring(1,
                    ((String) outputVal).length());
    } else {
      Invoker fromInvoker = invokerMap.get(fromNode);
      try {
        if (fromInvoker != null)
          outputVal = fromInvoker.getOutput(inputPort.getFromPort()
              .getName());



      } catch (Exception e) {
        // if the value is still null look it up from the inputport name
        // because the value is set to the input port name at some point
        // there is no harm in doing this
        if (null == outputVal) {
          outputVal = fromInvoker.getOutput(inputPort.getName());
        }
      }

    }
    return outputVal;
View Full Code Here

TOP

Related Classes of org.apache.airavata.xbaya.invoker.Invoker

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.