Search in sources :

Example 1 with GpelProcess

use of org.gpel.model.GpelProcess in project airavata by apache.

the class ODEScriptFiler method save.

/**
 */
public void save() {
    Workflow wf = this.engine.getGUI().getWorkflow();
    if (0 == wf.getGraph().getNodes().size()) {
        this.engine.getGUI().getErrorWindow().warning("Workflow is Empty");
        return;
    }
    GpelProcess process;
    try {
        int returnVal = this.bpelFileChooser.showSaveDialog(this.engine.getGUI().getFrame());
        if (returnVal == JFileChooser.APPROVE_OPTION) {
            File file = this.bpelFileChooser.getSelectedFile();
            String path = file.getPath();
            // Remove ".bpel" at the end if any
            if (path.endsWith(XBayaConstants.BPEL_SUFFIX)) {
                path = path.substring(0, path.length() - XBayaConstants.BPEL_SUFFIX.length());
            }
            // Add ".bpel" at the end of the file name
            File bpelFile = new File(path + XBayaConstants.BPEL_SUFFIX);
            // Add ".wsdl" at the end of the file name
            File wsdlFile = new File(path + XBayaConstants.WSDL_SUFFIX);
            // todo this has to fix, for compilation purpose passing dummy value instead of xregistry url
            URI temp = null;
            try {
                temp = new URI("temp");
            } catch (URISyntaxException e) {
                log.error(e.getMessage(), e);
            }
        // process = wf.getOdeProcess(WSDLUtil.appendWSDLQuary(temp), this.engine.getConfiguration().getODEURL());
        // String processString = process.xmlStringPretty();
        // FileWriter writer = new FileWriter(bpelFile);
        // writer.write(processString);
        // writer.close();
        // 
        // WsdlDefinitions workflowWSDL = wf.getOdeWorkflowWSDL(this.engine.getConfiguration().getDSCURL(),
        // this.engine.getConfiguration().getODEURL());
        // String workflowWsdlStr = XmlConstants.BUILDER.serializeToStringPretty(workflowWSDL.xml());
        // writer = new FileWriter(wsdlFile);
        // writer.write(workflowWsdlStr);
        // 
        // Map<String, WsdlDefinitions> wsdlMap = wf.getOdeServiceWSDLs(
        // this.engine.getConfiguration().getDSCURL(), this.engine.getConfiguration().getODEURL());
        // Set<String> keySet = wsdlMap.keySet();
        // for (String string : keySet) {
        // writer = new FileWriter(new File(wsdlFile.getParent(), QName.valueOf(string).getLocalPart()));
        // writer.write(XmlConstants.BUILDER.serializeToStringPretty(wsdlMap.get(string).xml()));
        // writer.close();
        // }
        // 
        // XmlElement deployDescriptor = wf.getODEDeploymentDescriptor(this.engine.getConfiguration().getDSCURL(),
        // this.engine.getConfiguration().getODEURL());
        // writer = new FileWriter(new File(wsdlFile.getParent(), "deploy.xml"));
        // writer.write(XmlConstants.BUILDER.serializeToString(deployDescriptor));
        // writer.close();
        // 
        }
    // 
    // } catch (IOException e) {
    // this.engine.getGUI().getErrorWindow().error(ErrorMessages.WRITE_FILE_ERROR, e);
    // } catch (GraphException e) {
    // this.engine.getGUI().getErrorWindow().error(ErrorMessages.GRAPH_FORMAT_ERROR, e);
    } catch (RuntimeException e) {
        this.engine.getGUI().getErrorWindow().error(ErrorMessages.UNEXPECTED_ERROR, e);
    } catch (Error e) {
        this.engine.getGUI().getErrorWindow().error(ErrorMessages.UNEXPECTED_ERROR, e);
    // } catch (ComponentException e) {
    // this.engine.getGUI().getErrorWindow().error(ErrorMessages.UNEXPECTED_ERROR, e);
    }
}
Also used : Workflow(org.apache.airavata.workflow.model.wf.Workflow) URISyntaxException(java.net.URISyntaxException) GpelProcess(org.gpel.model.GpelProcess) File(java.io.File) URI(java.net.URI)

Aggregations

File (java.io.File)1 URI (java.net.URI)1 URISyntaxException (java.net.URISyntaxException)1 Workflow (org.apache.airavata.workflow.model.wf.Workflow)1 GpelProcess (org.gpel.model.GpelProcess)1