Package org.apache.airavata.xbaya.wf

Examples of org.apache.airavata.xbaya.wf.Workflow


    /**
     * Exports a BPEL process to the local file
     */
    public void exportBPEL() {
        Workflow workflow = this.engine.getWorkflow();
        BPELScript bpel = new BPELScript(workflow);

        // Check if there is any errors in the workflow first.
        ArrayList<String> warnings = new ArrayList<String>();
        if (!bpel.validate(warnings)) {
View Full Code Here


            /**
             * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
             */
            public void actionPerformed(ActionEvent e1) {
                try {
                    Workflow workflow = engine.getWorkflow();
                    XBayaExecutionState executionState = workflow.getExecutionState();
                    if (executionState == XBayaExecutionState.RUNNING || executionState == XBayaExecutionState.STEP) {
                        workflow.setExecutionState(XBayaExecutionState.PAUSED);
                        play.setIcon(PLAY_ICON);
                    } else if (executionState == XBayaExecutionState.PAUSED) {
                        workflow.setExecutionState(XBayaExecutionState.RUNNING);
                        play.setIcon(PAUSE_ICON);
                    } else {
                        throw new IllegalStateException("Unknown state :" + executionState);
                    }
                } catch (RuntimeException e) {
View Full Code Here

     */
    public void test() throws IOException, ComponentException, GraphException, ComponentRegistryException,
            MonitorException {

        WorkflowCreator creator = new WorkflowCreator();
        Workflow workflow = creator.createComplexMathWorkflow();
        WorkflowClient.createScript(workflow);

        Monitor monitor;
        if (this.gui) {
            this.engine = new XBayaEngine(this.configuration);
            this.graphCanvas = this.engine.getGUI().getGraphCanvas();
            this.graphCanvas.setWorkflow(workflow);
            monitor = this.engine.getMonitor();
            this.engine.getGUI().eventReceived(new Event(Type.MONITOR_STARTED));
            repaintAndWait(2);
        } else {
            MonitorConfiguration monitorConfiguration = new MonitorConfiguration(this.configuration.getBrokerURL(),
                    this.configuration.getTopic(), this.configuration.isPullMode(),
                    this.configuration.getMessageBoxURL());
            monitor = new Monitor(monitorConfiguration);
        }

        MonitorEventData eventData = monitor.getEventData();
        MonitorCallback callback = new MonitorCallback(eventData);
        LoopbackPublisher publisher = new LoopbackPublisher(callback, this.configuration.getTopic());
        MonitorNotifier notifier = new MonitorNotifier(publisher);

        executeToMiddle(workflow, notifier);

        modifyWorkflow(workflow);

        File modifiedWorkflowFile = new File(this.temporalDirectory, "complex-math-modified.xwf");
        XMLUtil.saveXML(workflow.toXML(), modifiedWorkflowFile);

        // Create a diff workflow
        WorkflowModifier modifier = new WorkflowModifier(workflow, eventData);
        Workflow diffWorkflow = modifier.createDifference();

        if (this.gui) {
            GraphCanvas canvas = this.engine.getGUI().newGraphCanvas(true);
            canvas.setWorkflow(diffWorkflow);
            repaintAndWait(5);
        }

        File diffWorkflowFile = new File(this.temporalDirectory, "complex-math-diff.xwf");
        XMLUtil.saveXML(diffWorkflow.toXML(), diffWorkflowFile);

    }
View Full Code Here

public class TestWorkflowInterpreter {

    public static void main(String[] args) throws XBayaException, URISyntaxException, GSSException, IOException {
        String workflowAsString = getWorkflow();

        Workflow workflow = new Workflow(workflowAsString);
        WsdlDefinitions wsdl = workflow.getTridentWorkflowWSDL(XBayaConstants.DEFAULT_DSC_URL,
                XBayaConstants.DEFAULT_ODE_URL.toString());

        ODEClient client = new ODEClient();
        Pair<String, String>[] in = new Pair[3];
View Full Code Here

    public Workflow getOGCEWorkflow(QName workflowTemplateId) throws RepositoryException, GraphException,
            ComponentException, Exception {
        AiravataRegistry registry = connectToRegistry();
        Node node = registry.getWorkflow(workflowTemplateId, this.engine.getConfiguration().getRegistryUserName());
        XmlElement xwf = XMLUtil.stringToXmlElement(node.getProperty("workflow").getString());
        Workflow workflow = new Workflow(xwf);
        return workflow;
    }
View Full Code Here

     */
    public boolean saveWorkflow() {
        if (XBayaUtil.acquireJCRRegistry(this.engine)) {
            try {

                Workflow workflow = this.engine.getWorkflow();
                JythonScript script = new JythonScript(workflow, this.engine.getConfiguration());

                // Check if there is any errors in the workflow first.
                ArrayList<String> warnings = new ArrayList<String>();
                if (!script.validate(warnings)) {
                    StringBuilder buf = new StringBuilder();
                    for (String warning : warnings) {
                        buf.append("- ");
                        buf.append(warning);
                        buf.append("\n");
                    }
                    this.engine.getErrorWindow().warning(buf.toString());
                    return false;
                }
                RegistryWorkflowPublisherWindow registryPublishingWindow = new RegistryWorkflowPublisherWindow(
                        this.engine);
                registryPublishingWindow.show();

                String workflowId = workflow.getName();

                workflowId = StringUtil.convertToJavaIdentifier(workflowId);

                // FIXME::Commenting the workflow UUID. It is debatable if the
                // workflow template id should be unique or not.
                // workflowId = workflowId + UUID.randomUUID();

                QName workflowQName = new QName(XBayaConstants.OGCE_WORKFLOW_NS, workflowId);

                // first find whether this resource is already in xregistry
                // TODO: Add the check back
                // DocData[] resource =
                // client.findOGCEResource(workflowQName.toString(), "Workflow",
                // null);
                // if (resource != null && !"".equals(resource)) {
                // // if already there then remove
                //
                // int result =
                // JOptionPane.showConfirmDialog(this.engine.getGUI().getGraphCanvas().getSwingComponent(),
                // "Workflow Already Exist in Xregistry. Do you want to overwrite",
                // "Workflow already exist", JOptionPane.YES_NO_OPTION);
                // if(result != JOptionPane.YES_OPTION){
                // return;
                // }
                // client.removeResource(workflowQName);
                // }
                String workflowAsString = XMLUtil.xmlElementToString(workflow.toXML());
                String owner = this.engine.getConfiguration().getRegistryUserName();

                AiravataRegistry registry = this.connectToRegistry();
                boolean result = registry.saveWorkflow(workflowQName, workflow.getName(), workflow.getDescription(), workflowAsString,
                        owner, registryPublishingWindow.isMakePublic());
                registryPublishingWindow.hide();
                return result;
            } catch (Exception e) {
                this.engine.getErrorWindow().error(e.getMessage(), e);
View Full Code Here

     * @return
     */
    public Workflow getWorkflow(QName qname) throws RegistryException {
        AiravataRegistry registry = connectToRegistry();
        Node node = registry.getWorkflow(qname, this.engine.getConfiguration().getRegistryUserName());
        Workflow workflow = null;
        try {
            XmlElement xwf = XMLUtil.stringToXmlElement(node.getProperty("workflow").getString());
            workflow = new Workflow(xwf);
        } catch (GraphException e) {
            e.printStackTrace(); // To change body of catch statement use File | Settings | File Templates.
        } catch (ComponentException e) {
            e.printStackTrace(); // To change body of catch statement use File | Settings | File Templates.
        } catch (RepositoryException e) {
View Full Code Here

    private void ok() {
        RegistrySearchResult result = this.list.getSelectedValue();
        hide();

        try {
            Workflow workflow = new RegistryAccesser(this.engine).getWorkflow(result.getResourceName());
            GraphCanvas newGraphCanvas = engine.getGUI().newGraphCanvas(true);
            newGraphCanvas.setWorkflow(workflow);
            //this.engine.setWorkflow(workflow);
            engine.getGUI().getGraphCanvas().setWorkflowFile(null);
//            RegistryLoaderWindow.this.engine.setWorkflow(workflow);
View Full Code Here

        newGraphCanvas.addGraphCanvasListener(new GraphCanvasListener() {

            public void graphCanvasChanged(GraphCanvasEvent event) {
                GraphCanvasEventType type = event.getType();
                final GraphCanvas graphCanvas = event.getGraphCanvas();
                final Workflow workflow = event.getWorkflow();
                switch (type) {
                case GRAPH_LOADED:
                case NAME_CHANGED:
                    SwingUtilities.invokeLater(new Runnable() {
                        public void run() {
                            String name = workflow.getName();

                            // Change the name of the tab.
                            updateTabTitle(graphCanvas, workflow);

                            // Change the name of the frame.
                            setFrameName(name);
                        }

           
                    });
                    break;
                case NODE_SELECTED:
                case INPUT_PORT_SELECTED:
                case OUTPUT_PORT_SELECTED:
                    // Do nothing
                case WORKFLOW_CHANGED:
                  updateTabTitle(graphCanvas,graphCanvas.getWorkflow());
                  setFrameName(workflow.getName());
                  for (ChangeListener listener:tabChangeListeners){
                    try{
                      listener.stateChanged(null);
                    }catch(Exception e){
                      e.printStackTrace();
                    }
                  }
                }
            }
            private void updateTabTitle(
          final GraphCanvas graphCanvas,
          final Workflow workflow) {
        int index = XBayaGUI.this.graphTabbedPane.indexOfComponent(graphCanvas.getSwingComponent());
                String newTitle = workflow.getName();
                if (graphCanvas.isWorkflowChanged()){
                  newTitle="*"+newTitle;
                }
        XBayaGUI.this.graphTabbedPane.setTitleAt(index, newTitle);
      }
View Full Code Here

    }

    public void openWorkflowTab(XBayaEngine engine) {
        WorkflowClient workflowClient = engine.getWorkflowClient();
        try {
            Workflow workflow = this.node.getComponent().getWorkflow(workflowClient);
            engine.getGUI().selectOrCreateGraphCanvas(workflow);
        } catch (GraphException e) {
            engine.getErrorWindow().error(ErrorMessages.GRAPH_FORMAT_ERROR, e);
        } catch (WorkflowEngineException e) {
            engine.getErrorWindow().error(ErrorMessages.GPEL_ERROR, e);
View Full Code Here

TOP

Related Classes of org.apache.airavata.xbaya.wf.Workflow

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.