Package org.apache.airavata.gfac.context

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


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

    return appDesc;
  }
  protected MessageContext getInMessageContext() {
    MessageContext inMessage = new MessageContext();
        return inMessage;
  }
View Full Code Here


  }

 
 
  protected MessageContext getOutMessageContext() {
    MessageContext outMessage = new MessageContext();
    return outMessage;
  }
View Full Code Here

public class ProviderUtils {

    public static List<String> getInputParameters(JobExecutionContext jobExecutionContext) throws GFacProviderException {
        List<String> parameters = new ArrayList<String>();
        MessageContext inMessageContext = jobExecutionContext.getInMessageContext();
        InputParameterType[] inputParamDefinitionArray = jobExecutionContext.getApplicationContext().
                getServiceDescription().getType().getInputParametersArray();
        for (InputParameterType inputParam : inputParamDefinitionArray) {
            String parameterName = inputParam.getParameterName();
            ActualParameter parameter = (ActualParameter)inMessageContext.getParameter(parameterName);
            if(parameter == null){
                throw new GFacProviderException("Cannot find required input parameter " + parameterName + ".");
            }

            parameters.add(MappingFactory.toString(parameter));
View Full Code Here

        /*
        * 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

        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

    @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

public class HadoopUtils {
    public static Configuration createHadoopConfiguration(
            JobExecutionContext jobExecutionContext,
            boolean isWhirrBasedDeployment,
            File hadoopConfigDir) throws FileNotFoundException {
        MessageContext inMessageContext = jobExecutionContext.getInMessageContext();
        Configuration hadoopConf = new Configuration();

        if(isWhirrBasedDeployment){
            hadoopConf.addResource(new FileInputStream(
                    new File((String)inMessageContext.getParameter("HADOOP_SITE_XML"))));
        } else {
            readHadoopClusterConfigurationFromDirectory(hadoopConfigDir, hadoopConf);
        }

        return hadoopConf;
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.