Package edu.indiana.extreme.xbaya.wf

Examples of edu.indiana.extreme.xbaya.wf.Workflow


    /**
     * @throws XBayaException
     */
    public void testLoadInstance() throws XBayaException {
        WorkflowCreator creator = new WorkflowCreator();
        Workflow workflow0 = creator.createComplexMathWorkflow();

        WorkflowClient client = WorkflowEngineManager.getWorkflowClient();
        client.setEngineURL(XBayaConstants.DEFAULT_GPEL_ENGINE_URL);

        // Deploy
        URI templateID = client.createScriptAndDeploy(workflow0, false);

        // Load a workflow template from the GPEL Engine.
        Workflow workflowTemplate = client.load(templateID);

        // Instantiate the workflow template.
        GcInstance instance = client.instantiate(workflowTemplate,
                this.configuration.getDSCURL());
        // ID to retrieve the workflow instance
        URI instanceID = instance.getInstanceId();
        logger.info("instanceID: " + instanceID);

        // Start the workflow instance.
        // WsdlDefinitions wsdl = client.start(instance);

        Workflow workflowInstance = client.load(instanceID,
                WorkflowType.INSTANCE);
        assertNotNull(workflowInstance);
    }
View Full Code Here


     * @throws XBayaException
     */
    public void XtestInvoke() throws XBayaException {

        WorkflowCreator creator = new WorkflowCreator();
        Workflow workflow0 = creator.createGFacWorkflow();

        WorkflowClient client = WorkflowEngineManager.getWorkflowClient();
        client.setEngineURL(XBayaConstants.DEFAULT_GPEL_ENGINE_URL);

        URI templateID = client.createScriptAndDeploy(workflow0, false);

        // Load a workflow template from the GPEL Engine.
        Workflow workflow = client.load(templateID);

        // Get the metadata for input.
        XmlElement inputAppinfo = workflow.getInputMetadata();
        logger
                .info("inputAppinfo: "
                        + XMLUtil.xmlElementToString(inputAppinfo));

        // Get the input information
        List<WSComponentPort> inputs = workflow.getInputs();

        for (WSComponentPort input : inputs) {
            // Show the information of each input.

            // Name
View Full Code Here

  /**
   *
   */
  public void save() {
    Workflow wf = this.engine.getWorkflow();
    if (0 == wf.getGraph().getNodes().size()) {
      this.engine.getErrorWindow().warning("Workflow is Empty");
      return;
    }
    new ODEDeploymentWindow(this.engine, true).show();
    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);

        process = wf.getOdeProcess(WSDLUtil.appendWSDLQuary(this.engine
            .getConfiguration().getXRegistryURL()), 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();
View Full Code Here

   
    /**
     * Exports a Scufl script to the local file
     */
    public void exportScuflScript() {
      Workflow workflow = this.engine.getWorkflow();
      ScuflScript script = new ScuflScript(workflow, this.engine
                .getConfiguration());

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

    /**
     * Exports a Jython script to the local file
     */
    public void exportJythonScript() {
        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>();
View Full Code Here

            File file = new File(XBayaPathConstants.WORKFLOW_DIRECTORY,
                    "complex-math.xwf");
            org.xmlpull.infoset.XmlElement workflowXML = XMLUtil.loadXML(file);

            // Parse the workflow
            Workflow workflow = new Workflow(workflowXML);
            workflow.setName("some-number-will-come-here");
            WorkflowProxyClient.createScript(workflow);

            WorkflowProxyClient workflowProxyClient = new WorkflowProxyClient();
            workflowProxyClient.setEngineURL(new URI(wsdlLoc));
View Full Code Here

    }

    public void testXBayaProxyClientCreateInstance() {
        try {

            Workflow workflow = new Workflow();
            workflow.setName("uuid:some-number-will-come-here");
            WorkflowProxyClient workflowProxyClient = new WorkflowProxyClient();
            workflowProxyClient.setEngineURL(new URI(wsdlLoc));

            workflowProxyClient.instantiate(workflow, new URI(wsdlLoc));
View Full Code Here

 
 
  public String launchWorkflow(String workflowAsString, String topic, String password, String username,
      NameValue[] inputs, NameValue[] configurations){
   
    Workflow workflow = null;
    try {
      workflow = new Workflow(workflowAsString);
    } catch (GraphException e1) {
      // TODO Auto-generated catch block
      e1.printStackTrace();
    } catch (ComponentException e1) {
      // TODO Auto-generated catch block
View Full Code Here

    System.out.println(workflowTemplateId);
    String workflowString = this.xregistryClient.getOGCEResource(workflowTemplateId, XRegClientConstants.ResourceType.WorkflowTemplate.toString(), null);
    System.out.println(workflowString);

    XmlElement xwf = XMLUtil.stringToXmlElement(workflowString);
    Workflow workflow = new Workflow(xwf);
    return workflow;
  }
View Full Code Here

    try {
      if (this.xregistryClient == null) {
        connectToXRegistry();
      }
      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;
      }
      OGCEXRegistryWorkflowPublisherWindow registryPublishingWindow = new OGCEXRegistryWorkflowPublisherWindow(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.getMyProxyClient().getProxy().getName().toString();

      this.xregistryClient.registerOGCEResource(workflowQName, workflow.getName(), XBayaConstants.XR_Resource_Types.WorkflowTemplate.toString(), workflow.getDescription(), workflowAsString, null, owner);

      makePublic = registryPublishingWindow.isMakePublic();
      if (makePublic) {
        this.xregistryClient.addCapability(workflowQName.toString(), PUBLIC_ACTOR, false, XRegClientConstants.Action.Read.toString());
      }
View Full Code Here

TOP

Related Classes of edu.indiana.extreme.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.