Search in sources :

Example 6 with Repository

use of org.vcell.workflow.Repository in project vcell by virtualcell.

the class KenworthyTest method main.

public static void main(String[] args) {
    if (args.length != 2) {
        System.out.println("expecting 2 arguments");
        System.out.println("usage: java " + Workflow.class.getSimpleName() + " workingdir workflowInputFile");
        System.out.println("workingdir example: " + "D:\\developer\\eclipse\\workspace\\VCell_5.4_vmicro\\datadir");
        System.out.println("workflowInputFile example: " + "D:\\developer\\eclipse\\workspace\\VCell_5.4_vmicro\\workflow1.txt");
        System.exit(1);
    }
    try {
        // PropertyLoader.loadProperties();
        // workflowInputFile "C:\\developer\\eclipse\\workspace\\VCell_5.3_vmicro\\workflow1.txt"
        File workingDirectory = new File(args[0]);
        LocalWorkspace localWorkspace = new LocalWorkspace(workingDirectory);
        Repository repository = new MemoryRepository();
        // String workflowLanguageText = BeanUtils.readBytesFromFile(new File(args[1]), null);
        // Workflow workflow = Workflow.parse(localWorkspace, workflowLanguageText);
        System.err.println(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> using hard-coded example instead <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<");
        File vfrapFile = new File("D:\\Developer\\eclipse\\workspace_refactor\\VCell_5.4_vmicro\\3D_FRAP_2_ZProjection_Simulation1.vfrap");
        // Workflow workflow = getVFrapSimpleExample(workingDirectory, vfrapFile);
        // Workflow workflow = getFakeDataExample(workingDirectory);
        Workflow workflow = getInteractiveModelWorkflow(repository, workingDirectory);
        TaskContext taskContext = new TaskContext(workflow, repository, localWorkspace);
        ArrayList<Issue> issues = new ArrayList<Issue>();
        IssueContext issueContext = new IssueContext();
        workflow.gatherIssues(issueContext, issues);
        // WorkflowJGraphProxy workflowJGraphProxy = new WorkflowJGraphProxy(workflow);
        // displayWorkflowGraphJGraphX(workflowJGraphProxy);
        WorkflowUtilities.displayWorkflowGraph(workflow);
        WorkflowUtilities.displayWorkflowTable(taskContext);
        workflow.reportIssues(issues, Issue.SEVERITY_INFO, true);
        // 
        // execute the workflow
        // 
        workflow.compute(taskContext, new WorkflowUtilities.Progress());
    } catch (Exception e) {
        e.printStackTrace(System.out);
    }
}
Also used : LocalWorkspace(org.vcell.vmicro.workflow.data.LocalWorkspace) TaskContext(org.vcell.workflow.TaskContext) Issue(org.vcell.util.Issue) ArrayList(java.util.ArrayList) Workflow(org.vcell.workflow.Workflow) Repository(org.vcell.workflow.Repository) MemoryRepository(org.vcell.workflow.MemoryRepository) MemoryRepository(org.vcell.workflow.MemoryRepository) IssueContext(org.vcell.util.IssueContext) File(java.io.File)

Example 7 with Repository

use of org.vcell.workflow.Repository in project vcell by virtualcell.

the class WorkflowObjectsTableModel method setValueAt.

public void setValueAt(Object value, int row, int col) {
    if (value == null) {
        return;
    }
    try {
        String inputValue = (String) value;
        inputValue = inputValue.trim();
        WorkflowObject workflowObject = getValueAt(row);
        switch(col) {
            case COLUMN_VALUE:
                {
                    if (inputValue.length() == 0) {
                        return;
                    }
                    if (workflowObject instanceof WorkflowParameter) {
                        WorkflowParameter dataHolder = (WorkflowParameter) workflowObject;
                        Class dataClass = dataHolder.getType();
                        Repository repository = taskContext.getRepository();
                        Workflow workflow = taskContext.getWorkflow();
                        if (dataClass.equals(Double.class)) {
                            repository.setData(dataHolder, Double.valueOf(inputValue));
                            workflow.refreshStatus();
                        } else if (dataClass.equals(Float.class)) {
                            repository.setData(dataHolder, Float.valueOf(inputValue));
                            workflow.refreshStatus();
                        } else if (dataClass.equals(Integer.class)) {
                            repository.setData(dataHolder, Integer.valueOf(inputValue));
                            workflow.refreshStatus();
                        } else if (dataClass.equals(Boolean.class)) {
                            repository.setData(dataHolder, Boolean.valueOf(inputValue));
                            workflow.refreshStatus();
                        } else if (dataClass.equals(String.class)) {
                            repository.setData(dataHolder, inputValue);
                            workflow.refreshStatus();
                        } else {
                            System.out.println("type " + dataClass.getSimpleName() + " not supported");
                        }
                    }
                    break;
                }
        }
    } catch (Exception e) {
        e.printStackTrace(System.out);
    }
}
Also used : Repository(org.vcell.workflow.Repository) Workflow(org.vcell.workflow.Workflow) WorkflowParameter(org.vcell.workflow.WorkflowParameter) WorkflowObject(org.vcell.workflow.WorkflowObject)

Aggregations

Repository (org.vcell.workflow.Repository)7 MemoryRepository (org.vcell.workflow.MemoryRepository)6 Workflow (org.vcell.workflow.Workflow)6 File (java.io.File)5 LocalWorkspace (org.vcell.vmicro.workflow.data.LocalWorkspace)5 TaskContext (org.vcell.workflow.TaskContext)5 ArrayList (java.util.ArrayList)3 Issue (org.vcell.util.Issue)3 IssueContext (org.vcell.util.IssueContext)2 DisplayProfileLikelihoodPlots (org.vcell.vmicro.workflow.task.DisplayProfileLikelihoodPlots)2 AsynchClientTask (cbit.vcell.client.task.AsynchClientTask)1 Hashtable (java.util.Hashtable)1 ClientTaskStatusSupport (org.vcell.util.ClientTaskStatusSupport)1 ProgressDialogListener (org.vcell.util.ProgressDialogListener)1 OptContext (org.vcell.vmicro.workflow.data.OptContext)1 WorkflowJGraphProxy (org.vcell.vmicro.workflow.jgraphx.WorkflowJGraphProxy)1 DisplayDependentROIs (org.vcell.vmicro.workflow.task.DisplayDependentROIs)1 DisplayTimeSeries (org.vcell.vmicro.workflow.task.DisplayTimeSeries)1 ImportRawTimeSeriesFromVFrap (org.vcell.vmicro.workflow.task.ImportRawTimeSeriesFromVFrap)1 RunProfileLikelihoodGeneral (org.vcell.vmicro.workflow.task.RunProfileLikelihoodGeneral)1