Package org.apache.airavata.gfac.context

Examples of org.apache.airavata.gfac.context.MessageContext


            applicationContext.setServiceDescription(serviceDescription);

            jobExecutionContext.setApplicationContext(applicationContext);

            jobExecutionContext.setOutMessageContext(getOutParameters(serviceDescription));
            jobExecutionContext.setInMessageContext(new MessageContext(actualParameters));

            addSecurityContext(registeredHost, configurationProperties, jobExecutionContext,
                    configuration.getContextHeader());
            GFacImpl gfacAPI1 = new GFacImpl();
            gfacAPI1.submitJob(jobExecutionContext);

            OMFactory fac = OMAbstractFactory.getOMFactory();
            OMNamespace omNs = fac.createOMNamespace("http://ws.apache.org/axis2/xsd", "ns1");
            OMElement outputElement = fac.createOMElement("invokeResponse", omNs);
            MessageContext outMessageContext = jobExecutionContext.getOutMessageContext();
            Set<String> paramNames = outMessageContext.getParameters().keySet();
            for (String paramName : paramNames) {
                /*
                * Process Output
                */
                String outputString = ((ActualParameter) outMessageContext.getParameter(paramName)).toXML().replaceAll("GFacParameter", paramName);
                XMLStreamReader reader = XMLInputFactory.newInstance().createXMLStreamReader(new StringReader(outputString));
                StAXOMBuilder builder = new StAXOMBuilder(reader);
                outputElement.addChild(builder.getDocumentElement());
            }
            // Send notification
View Full Code Here


        }
        return invoke_inputParams;
    }

    private MessageContext getOutParameters(ServiceDescription serviceDescription) {
        MessageContext outContext = new MessageContext();
        for (OutputParameterType parameter : serviceDescription.getType().getOutputParametersArray()) {
            ActualParameter actualParameter = new ActualParameter();
            if ("String".equals(parameter.getParameterType().getName())) {
                actualParameter.getType().changeType(StringParameterType.type);
            } else if ("Double".equals(parameter.getParameterType().getName())) {
                actualParameter.getType().changeType(DoubleParameterType.type);
            } else if ("Integer".equals(parameter.getParameterType().getName())) {
                actualParameter.getType().changeType(IntegerParameterType.type);
            } else if ("Float".equals(parameter.getParameterType().getName())) {
                actualParameter.getType().changeType(FloatParameterType.type);
            } else if ("Boolean".equals(parameter.getParameterType().getName())) {
                actualParameter.getType().changeType(BooleanParameterType.type);
            } else if ("File".equals(parameter.getParameterType().getName())) {
                actualParameter.getType().changeType(FileParameterType.type);
            } else if ("URI".equals(parameter.getParameterType().getName())) {
                actualParameter.getType().changeType(URIParameterType.type);
            } else if ("StringArray".equals(parameter.getParameterType().getName())) {
                actualParameter.getType().changeType(StringArrayType.type);
            } else if ("DoubleArray".equals(parameter.getParameterType().getName())) {
                actualParameter.getType().changeType(DoubleArrayType.type);
            } else if ("IntegerArray".equals(parameter.getParameterType().getName())) {
                actualParameter.getType().changeType(IntegerArrayType.type);
            } else if ("FloatArray".equals(parameter.getParameterType().getName())) {
                actualParameter.getType().changeType(FloatArrayType.type);
            } else if ("BooleanArray".equals(parameter.getParameterType().getName())) {
                actualParameter.getType().changeType(BooleanArrayType.type);
            } else if ("FileArray".equals(parameter.getParameterType().getName())) {
                actualParameter.getType().changeType(FileArrayType.type);
            } else if ("URIArray".equals(parameter.getParameterType().getName())) {
                actualParameter.getType().changeType(URIArrayType.type);
            } else if ("StdOut".equals(parameter.getParameterType().getName())) {
                actualParameter.getType().changeType(StdOutParameterType.type);
            } else if ("StdErr".equals(parameter.getParameterType().getName())) {
                actualParameter.getType().changeType(StdErrParameterType.type);
            }
            outContext.addParameter(parameter.getParameterName(), actualParameter);
        }
        return outContext;
    }
View Full Code Here

        jobExecutionContext.setApplicationContext(applicationContext);
        applicationContext.setServiceDescription(serv);
        applicationContext.setApplicationDeploymentDescription(appDesc);
        applicationContext.setHostDescription(host);

        MessageContext inMessage = new MessageContext();
        ActualParameter echo_input = new ActualParameter();
        ((StringParameterType) echo_input.getType()).setValue("echo_output=hello");
        inMessage.addParameter("echo_input", echo_input);


        jobExecutionContext.setInMessageContext(inMessage);

        MessageContext outMessage = new MessageContext();
        ActualParameter echo_out = new ActualParameter();
//    ((StringParameterType)echo_input.getType()).setValue("echo_output=hello");
        outMessage.addParameter("echo_output", echo_out);

        jobExecutionContext.setOutMessageContext(outMessage);

    }
View Full Code Here

            if (app.getQueue().getQueueName() != null) {
                jobDescriptor.setQueueName(app.getQueue().getQueueName());
            }
            jobDescriptor.setOwner(((PBSCluster) cluster).getServerInfo().getUserName());
            List<String> inputValues = new ArrayList<String>();
            MessageContext input = jobExecutionContext.getInMessageContext();
            Map<String, Object> inputs = input.getParameters();
            Set<String> keys = inputs.keySet();
            for (String paramName : keys) {
                ActualParameter actualParameter = (ActualParameter) inputs.get(paramName);
                if ("URIArray".equals(actualParameter.getType().getType().toString()) || "StringArray".equals(actualParameter.getType().getType().toString())
                        || "FileArray".equals(actualParameter.getType().getType().toString())) {
View Full Code Here

    appDepType.setStandardError(appDepType.getOutputDataDirectory()+"/stderr");

    return appDesc;
  }
  protected MessageContext getInMessageContext() {
    MessageContext inMessage = new MessageContext();
   
      ActualParameter a1 = new ActualParameter();
      a1.getType().changeType(StringParameterType.type);
      ((StringParameterType)a1.getType()).setValue("hpcinput-uslims3.uthscsa.edu-uslims3_cauma3-01594.tar");
      inMessage.addParameter("arg1", a1);
         
        ActualParameter i1 = new ActualParameter();
        i1.getType().changeType(URIParameterType.type);
        ((URIParameterType)i1.getType()).setValue("file:///"+System.getProperty("user.home")+"/juelich-us3/hpcinput-uslims3.uthscsa.edu-uslims3_cauma3-01594.tar");
        inMessage.addParameter("i1", i1);

        return inMessage;
  }
View Full Code Here

        return inMessage;
  }

  protected MessageContext getOutMessageContext() {
    MessageContext outMessage = new MessageContext();
   
    ActualParameter a1 = new ActualParameter();
    a1.getType().changeType(StringParameterType.type);
    ((StringParameterType)a1.getType()).setValue("output/analysis-results.tar");
    outMessage.addParameter("o1", a1);

    return outMessage;
  }
View Full Code Here

      tmpFilePath = tmpFile.getAbsolutePath();
    } catch (Exception e) {
      assertTrue(false);
    }
   
    MessageContext inMessage = new MessageContext();
       
    ActualParameter copy_input = new ActualParameter();
        copy_input.getType().changeType(URIParameterType.type);
        ((URIParameterType)copy_input.getType()).setValue("file:///"+tmpFile.getAbsolutePath());
        inMessage.addParameter("f1", copy_input);
   
      ActualParameter f2 = new ActualParameter();
        f2.getType().changeType(URIParameterType.type);
        ((URIParameterType)f2.getType()).setValue("http://unicore-dev.zam.kfa-juelich.de/maven/cog-globus/cog-jglobus/1.4/cog-jglobus-1.4.jar");
        inMessage.addParameter("f2", f2);
       
       
        ActualParameter a1 = new ActualParameter();
        a1.getType().changeType(StringParameterType.type);
        ((StringParameterType)a1.getType()).setValue(tmpFile.getName());
        inMessage.addParameter("arg1", a1);

        return inMessage;
  }
View Full Code Here

        return inMessage;
  }

  protected MessageContext getOutMessageContext() {
   
    MessageContext outMessage = new MessageContext();
    ActualParameter a1 = new ActualParameter();
    a1.getType().changeType(StringParameterType.type);
    ((StringParameterType)a1.getType()).setValue(new File(tmpFilePath).getName());
    outMessage.addParameter("echo_output", a1);
   
    ActualParameter o1 = new ActualParameter();
    o1.getType().changeType(URIParameterType.type);
    // this may be any gridftp / ftp directory
    ((URIParameterType)o1.getType()).setValue(gridftpAddress+"/"+remoteTempDir + "/" + "outputData"+"/"+"cog-jglobus-1.4.jar");
    outMessage.addParameter("o1", o1);
   
    return outMessage;
  }
View Full Code Here

        jobExecutionContext.setApplicationContext(applicationContext);
        applicationContext.setServiceDescription(serv);
        applicationContext.setApplicationDeploymentDescription(appDesc);
        applicationContext.setHostDescription(host);

        MessageContext inMessage = new MessageContext();
        ActualParameter echo_input = new ActualParameter();
        ((StringParameterType) echo_input.getType()).setValue("echo_output=hello");
        inMessage.addParameter("echo_input", echo_input);


        jobExecutionContext.setInMessageContext(inMessage);

        MessageContext outMessage = new MessageContext();
        ActualParameter echo_out = new ActualParameter();
//    ((StringParameterType)echo_input.getType()).setValue("echo_output=hello");
        outMessage.addParameter("echo_output", echo_out);

        jobExecutionContext.setOutMessageContext(   outMessage);

    }
View Full Code Here

        final String SPACE = " ";
        StringBuffer cmd = new StringBuffer();
        cmd.append(app.getExecutableLocation());
        cmd.append(SPACE);

        MessageContext input = context.getInMessageContext();
        ;
        Map<String, Object> inputs = input.getParameters();
        Set<String> keys = inputs.keySet();
        for (String paramName : keys) {
            ActualParameter actualParameter = (ActualParameter) inputs.get(paramName);
            if ("URIArray".equals(actualParameter.getType().getType().toString())) {
                String[] values = ((URIArrayType) actualParameter.getType()).getValueArray();
View Full Code Here

TOP

Related Classes of org.apache.airavata.gfac.context.MessageContext

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.