Package gri.tasks

Examples of gri.tasks.TaskDef


   
    /**
     * Creates a ParameterizedTaskDef for the given function
     */
    public TaskDef createTaskDef(Function function) {
        TaskDef def = new TaskDef();
       
        //inputs:
        List funcParams = function.getParameters();
        Parameter funcParam;
        for (int i=0; i<funcParams.size(); i++) {
            funcParam = (Parameter)funcParams.get(i);
           
            ParameterDef taskInput = convertFunctionParameter(funcParam);
            def.addInput(taskInput);
        }
       
        //outputs:
        List outputs = function.getOutputs();
        Output output;
        for (int i=0; i<outputs.size(); i++) {
            output = (Output)outputs.get(i);
           
            ParameterDef taskOutput = convertOutput(output);
            def.addOutput(taskOutput);
        }
       
        return def;
    }
View Full Code Here


        this.taskDef = createTaskDef(function);
    }
   
    public TaskDef createTaskDef(Function function) {
      //create TaskDef:
        TaskDef baseTaskDef = runScriptTask.getTaskDef().copy();
        baseTaskDef.removeInput(RunScriptTask.SCRIPT);
       
        baseTaskDef.insertPrefix("script:");
       
        TaskDefProvider provider = new BasicTaskDefProvider();
        TaskDef gridpTaskDef = provider.createTaskDef(function);
        //gridpTaskDef.insertPrefix("gridp:");
       
        gridpTaskDef.extend(baseTaskDef);
        return gridpTaskDef;
    }
View Full Code Here

       
        return new Document(elem);
    }
   
    public TaskDef readTaskDef(Element elem) throws IOException {
        TaskDef taskDef = new TaskDef();
       
        Element inputElem = elem.getChild("inputs");
        if (inputElem != null) {
            List inputs = parseParameterList(inputElem);
            taskDef.setInputs(inputs);
        }
       
        Element outputElem = elem.getChild("outputs");
        if (outputElem != null) {
            List outputs = parseParameterList(outputElem);
            taskDef.setOutputs(outputs);
        }
       
       return taskDef;
    }
View Full Code Here

      add(header);


      //outputs:
      TaskDef taskDef = job.getTaskDef();
      ParameterDef [] paramDefs = (ParameterDef [])taskDef.getOutputs().toArray(
          new ParameterDef[0]);
     
      ParameterPanel outPanel = new ParameterPanel(paramDefs, widgetFactory);
      outPanel.setValues(job.getController().getOutputs());
View Full Code Here

                   .write(description, elem);
        return xmlUtil.writeXML(elem);
    }
   
    public String getTaskDefinition(String taskId) throws IOException {
        TaskDef taskDef = getWorkflowManager().getTaskDefinition(taskId);
       
        Element elem = new Element("definition");
        serializers.getTaskDefinitionSerializer()
                   .write(taskDef, elem);
        return xmlUtil.writeXML(elem);
View Full Code Here

                   .write(description, elem);
        return xmlUtil.writeXML(elem);
    }
   
    public String getTaskDefinition(String taskId) throws IOException {
        TaskDef taskDef = taskManager.getTaskDefinition(taskId);
       
        Element elem = new Element("definition");
        serializers.getTaskDefinitionSerializer()
                   .write(taskDef, elem);
        return xmlUtil.writeXML(elem);
View Full Code Here

    public void actionPerformed(ActionEvent e) {

      //get/validate inputs:
      Map inputs = this.inputPanel.getValues();

      TaskDef taskDef = taskInfo.getTaskDefinition();
      ParameterDef [] inputDefs = taskDef.getInputsArray();
      for (int i=0; i<inputDefs.length; i++) {
        String paramName = inputDefs[i].getName();
        if (inputDefs[i].isRequired() && inputs.get(paramName) == null) {
          error("Required parameter not entered: " + paramName);
          return;
View Full Code Here

  //System.out.println(task.getId());
 
        //print outputs:
      Map outputs = job.getController().getOutputs();
     
      TaskDef taskDef = job.getTaskDef();
      ParameterDef [] params = (ParameterDef [])taskDef.getOutputs().toArray(
            new ParameterDef[0]);
     
        for (int i=0; i<params.length; i++) {
            ParameterDef paramDef = params[i];
            Object value = outputs.get(paramDef.getName());
View Full Code Here

   
    /**
     * Return true if the job has outputs we can view
     */
    protected boolean canView(JobEntry job) {
        TaskDef taskDef = job.getTaskDef();     
        return taskDef.hasOutputs();
    }
View Full Code Here

        List functions = parser.parseFunctionEntries(new java.io.File(fileName));
        FunctionEntry function = (FunctionEntry)functions.get(2);
        TaskEntry taskEntry = function.createTaskEntry();
       
        this.task = taskEntry.getTask();
        TaskDef taskDef = task.getTaskDef();
       
        this.pnlTask = new ParameterPanel(taskDef.getInputsArray(), new InputParameterWidgetFactory());
        this.add(pnlTask, BorderLayout.CENTER);
       
        JButton btnSubmit = new JButton("Run");
        btnSubmit.addActionListener(this);
        this.add(btnSubmit, BorderLayout.SOUTH);
View Full Code Here

TOP

Related Classes of gri.tasks.TaskDef

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.