Package org.apache.airavata.gfac.context

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


        /*
        * Host
        */
        applicationContext.setServiceDescription(serv);

        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


    @Test
    public void testLocalProvider() throws GFacException {
        GFacAPI gFacAPI = new GFacAPI();
        gFacAPI.submitJob(jobExecutionContext);
        MessageContext outMessageContext = jobExecutionContext.getOutMessageContext();
        Assert.assertEquals(MappingFactory.toString((ActualParameter)outMessageContext.getParameter("echo_output")), "hello");
    }
View Full Code Here

            }
        }
    }

    private void handleOutPath(JobExecutionContext jobExecutionContext){
        MessageContext inMessageContext = jobExecutionContext.getInMessageContext();
        if(((String)inMessageContext.getParameter("HADOOP_DEPLOYMENT_TYPE")).equals("WHIRR")){
            // TODO: Shutdown hadoop cluster.
            logger.info("Shutdown hadoop cluster.");
        }
    }
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);

        // added extra
        ActualParameter copy_input = new ActualParameter();
        copy_input.getType().changeType(URIParameterType.type);
        ((URIParameterType)copy_input.getType()).setValue("file:///tmp/tmpstrace");

        ActualParameter outlocation = new ActualParameter();
        ((StringParameterType)outlocation.getType()).setValue("./outputData/.");
        inMessage.addParameter("copy_input", copy_input);
        inMessage.addParameter("outputlocation", outlocation);

        // added extra



        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.getStandardInput() != null && !"".equals(app.getStandardInput())) {
            jobAttr.setStdin(app.getStandardInput());
        } else {
            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

    @Test
    public void testGramProvider() throws GFacException {
        GFacAPI gFacAPI = new GFacAPI();
        gFacAPI.submitJob(jobExecutionContext);
        MessageContext outMessageContext = jobExecutionContext.getOutMessageContext();
        Assert.assertEquals(MappingFactory.toString((ActualParameter)outMessageContext.getParameter("echo_output")), "hello");
    }
View Full Code Here

           else {
             //TODO
           }


        MessageContext outputNew = new MessageContext();
        MessageContext output = jobExecutionContext.getOutMessageContext();
        Map<String, Object> parameters = output.getParameters();
        for (String paramName : parameters.keySet()) {
            ActualParameter actualParameter = (ActualParameter) parameters
                    .get(paramName);

            GridFtp ftp = new GridFtp();
View Full Code Here

    public static Map<String, ActualParameter> fillOutputFromStdout(JobExecutionContext context, String stdout, String stderr) throws Exception {

        Map<String, ActualParameter> result = new HashMap<String, ActualParameter>();
        OutputParameterType[] outputParametersArray = context.getApplicationContext().
                getServiceDescription().getType().getOutputParametersArray();
        MessageContext outMessageContext = context.getOutMessageContext();
        for (OutputParameterType outparamType : outputParametersArray) {
            String parameterName = outparamType.getParameterName();
            ActualParameter actual = (ActualParameter)outMessageContext.getParameter(outparamType.getParameterName());
            // if parameter value is not already set, we let it go
            if (actual == null) {
                continue;
            }
            if ("StdOut".equals(actual.getType().getType().toString())) {
View Full Code Here

   
    return serv;
  }

  protected MessageContext getInMessageContext() {
    MessageContext inMessage = new MessageContext();
   
        ActualParameter i1 = new ActualParameter();
        i1.getType().changeType(URIParameterType.type);
        ((URIParameterType)i1.getType()).setValue("file:///tmp/ifile1");
        inMessage.addParameter("i1", i1);
       
        ActualParameter i2 = new ActualParameter();
        i2.getType().changeType(URIParameterType.type);
        ((URIParameterType)i2.getType()).setValue("file:///tmp/ifile2");
        inMessage.addParameter("i2", i2);
       
        ActualParameter i3 = new ActualParameter();
        i2.getType().changeType(URIParameterType.type);
        ((URIParameterType)i2.getType()).setValue("///tmp/ifile2");
        inMessage.addParameter("i3", i2);

        ActualParameter simpleArg = new ActualParameter();
        simpleArg.getType().changeType(StringParameterType.type);
        ((StringParameterType)simpleArg.getType()).setValue("argument1");
        inMessage.addParameter("a1", simpleArg);
       
        ActualParameter nameValueArg = new ActualParameter();
        nameValueArg.getType().changeType(StringParameterType.type);
        ((StringParameterType)nameValueArg.getType()).setValue("name1=value1");
        inMessage.addParameter("nameValueArg", nameValueArg);
       
    ActualParameter echo_input = new ActualParameter();
    ((StringParameterType) echo_input.getType())
        .setValue("echo_output=hello");
    inMessage.addParameter("echo_input", echo_input);
       
    return inMessage;
  }
View Full Code Here

       
    return inMessage;
  }

  protected MessageContext getOutMessageContext() {
    MessageContext om1 = new MessageContext();
   
    // TODO: Aint the output parameters are only the name of the files staged out to the gridftp endpoint?
    ActualParameter o1 = new ActualParameter();
    ((StringParameterType) o1.getType())
    .setValue("tempfile");
    om1.addParameter("o1", o1);

    ActualParameter o2 = new ActualParameter();
    o2.getType().changeType(URIParameterType.type);
   
    ((URIParameterType)o2.getType()).setValue("http://path/to/upload");
    om1.addParameter("o2", o2);

   
   
    return om1;
  }
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.