Package edu.indiana.extreme.xbaya.wf

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


    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.
              int index = XBayaGUI.this.graphTabbedPane
                  .indexOfComponent(graphCanvas
                      .getSwingComponent());
              XBayaGUI.this.graphTabbedPane.setTitleAt(index,
                  workflow.getName());

              // Change the name of the frame.
              setFrameName(name);
            }
          });
View Full Code Here


     * @throws ComponentRegistryException
     */
    public void testSaveAndLoad() throws ComponentException, GraphException,
            IOException, ComponentRegistryException {

        Workflow workflow = this.workflowCreator.createComplexMathWorkflow();

        XmlElement workflowElement = workflow.toXML();
        File file = new File(this.temporalDirectory, "complex-math.xwf");
        XMLUtil.saveXML(workflowElement, file);

        XmlElement loadedWorkflowElement = XMLUtil.loadXML(file);
        Workflow loadedWorkflow = new Workflow(loadedWorkflowElement);

        Graph loadedGraph = loadedWorkflow.getGraph();
        Collection<WSNode> loadedWSNodes = GraphUtil.getWSNodes(loadedGraph);
        assertTrue(loadedWSNodes.size() != 0);

        for (WSNode loadedWSNode : loadedWSNodes) {
            assertNotNull(loadedWSNode.getComponent());
View Full Code Here

  public WsdlDefinitions getWorkflowWSDL(URI xRegistryURI,
      GSSCredential gssCredential, QName qname,
      String odeEprEndingWithPort) {
    try {
      XRegistryAccesser xregistryAccesser = new XRegistryAccesser(gssCredential, xRegistryURI);
      Workflow workflow = xregistryAccesser.getWorkflow(qname);
      // The REsulting WSDL is not affected by the DSCURL this is
      // necessary to create the other scripts
      // So send in some dummy URI for DSC
      URI dscUrl = XBayaConstants.DEFAULT_DSC_URL;
      return workflow.getOdeInvokableWSDL(dscUrl, odeEprEndingWithPort);
    } catch (Exception e) {
      throw new XBayaRuntimeException(e);
    }
  }
View Full Code Here

    /**
     * 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

        if (!isConnected()) {
            throw new IllegalStateException(
                    "The BPEL Engine has not configured.");
        }

        Workflow workflow = new Workflow();
        switch (workflowType) {
            case TEMPLATE:
                workflow.setGPELTemplateID(id);
                break;
            case INSTANCE:
                workflow.setGPELInstanceID(id);
                break;
        }

        // This is either a workflow template or a workflow instance.
        GcTemplate workflowTemplate;
        GcInstance workflowInstance = null;
        try {
            switch (workflowType) {
                case TEMPLATE:
                    workflowTemplate = this.client.retrieveTemplate(id);
                    break;
                case INSTANCE:
                    // TODO change this when we start modifying the instance.
                    workflowInstance = this.client.retrieveInstance(id);
                    GcWebResource templateResource = workflowInstance
                            .getLinkWithRel(GpelConstants.REL_TEMPLATE);
                    URI templateID = templateResource.getId();
                    workflow.setGPELTemplateID(templateID);
                    workflowTemplate = this.client.retrieveTemplate(templateID);
                    break;
                default:
                    // This doesn't happen
                    throw new XBayaRuntimeException();
            }
        } catch (GcResourceNotFoundException e) {
            // The workflow was not found in the engine.
            throw new WorkflowEngineException(
                    ErrorMessages.GPEL_WORKFLOW_NOT_FOUND_ERROR, e);
        } catch (RuntimeException e) {
            throw new WorkflowEngineException(ErrorMessages.GPEL_ERROR, e);
        }

        GcProcessResource processResource = null;
        if (workflowInstance != null) {
            processResource = (GcProcessResource) workflowInstance
                    .getLinkWithRel(GpelConstants.REL_PROCESS);
        }
        if (processResource == null) {
            processResource = (GcProcessResource) workflowTemplate
                    .getLinkWithRel(GpelConstants.REL_PROCESS);
        }

        GcXmlWebResource graphResource = null;
        if (workflowInstance != null) {
            graphResource = (GcXmlWebResource) workflowInstance
                    .getLinkWithRel(GPELLinksFilter.REL_XWF);
        }
        if (graphResource == null) {
            graphResource = (GcXmlWebResource) workflowTemplate
                    .getLinkWithRel(GPELLinksFilter.REL_XWF);
        }

        GcBinaryWebResource imageResource = null;
        if (workflowInstance != null) {
            imageResource = (GcBinaryWebResource) workflowInstance
                    .getLinkWithRel(GPELLinksFilter.REL_IMAGE);
        }
        if (imageResource == null) {
            imageResource = (GcBinaryWebResource) workflowTemplate
                    .getLinkWithRel(GPELLinksFilter.REL_IMAGE);
        }

        // Look for wsdl resource.
        GcWsdlResource workflowWSDLresource = null;
        Map<String, GcWsdlResource> wsdlResourceMap = new HashMap<String, GcWsdlResource>();
        List<GcWebResource> links = workflowTemplate.getLinks();
        for (GcWebResource link : links) {
            String rel = link.getRel();
            logger.finest("rel: " + rel);
            if (GpelConstants.REL_WSDL.equals(rel)) {
                GcWsdlResource wsdlResouece = (GcWsdlResource) link;
                String wsdlTitle = wsdlResouece.getTitle();
                logger.finest("wsdlTitle: " + wsdlTitle);
                // Use use title to do matching
                wsdlResourceMap.put(wsdlTitle, wsdlResouece);
            }
        }

        // BPEL process
        GpelProcess process = new GpelProcess(processResource.getXmlContent());
        workflow.setGpelProcess(process);

        // WSDL for the process
        workflowWSDLresource = wsdlResourceMap.remove(PROCESS_WSDL_TYTLE);
        WsdlDefinitions workflowWSDL = new WsdlDefinitions(workflowWSDLresource
                .getXmlContent());
        workflow.setWorkflowWSDL(workflowWSDL);

        // WSDLs for services.
        for (String wsdlID : wsdlResourceMap.keySet()) {
            GcWsdlResource wsdlResource = wsdlResourceMap.get(wsdlID);
            WsdlDefinitions definition = new WsdlDefinitions(wsdlResource
                    .getXmlContent());
            workflow.addWSDL(wsdlID, definition);
        }

        // Graph
        WSGraph graph = WSGraphFactory.createGraph(graphResource
                .getXmlContent());
        workflow.setGraph(graph);

        workflow.bindComponents();

        // Set the name of the workflow.
        // This has to be after parsing the graph so that workflow instance name
        // overwrites the name in the graph.
        String name = null;
        if (workflowInstance != null) {
            name = workflowInstance.getTitle();
            logger.finest("name from the instance: " + name);
        }
        if (name == null) {
            name = workflowTemplate.getTitle();
            logger.finest("name from the template: " + name);
        }
        workflow.setName(name);

        // Image
        if (imageResource != null) {
            byte[] imageBytes = imageResource.getBinaryContent();
            try {
                BufferedImage image = ImageIO.read(new ByteArrayInputStream(
                        imageBytes));
                workflow.setImage(image);
            } catch (IOException e) {
                // Not crucial
                logger.caught(e);
            }
        }
View Full Code Here

                                dscURL);
                    } else {
                        // It's a workflow WSDL.
                        logger.finest("workflow");
                        // recursively instantiate and start sub-workflows.
                        Workflow subWorkflow = load(subWorkflowTemplateID,
                                WorkflowType.TEMPLATE);
                        GcInstance subInstance = instantiate(subWorkflow,
                                dscURL, name);
                        // XXX Need to start to get a sub-workflow CWSDL.
                        // (Not so clean)
View Full Code Here

   
    List<GraphCanvas> graphCanvases = this.engine.getGUI()
        .getGraphCanvases();
    boolean found = false;
    for (GraphCanvas graphCanvas : graphCanvases) {
      Workflow workflow = graphCanvas.getWorkflow();
      URI instanceID = workflow.getGPELInstanceID();
      if (instanceID == null) {
        // If the workflow doesn't have an instance ID, it's a template.
        // We handle it so that users can use a workflow template to
        // monitor a workflow too.
        // This is also needed in the case of jython workflow.
        handleEvent(event, forward, workflow.getGraph());
      } else if (instanceID.equals(workflowID)) {
        // This is the regular case.
        found = true;
        handleEvent(event, forward, workflow.getGraph());
      } else if (null != workflowID
          && -1 != WSDLUtil.findWorkflowName(workflowID).indexOf(
              WSDLUtil.findWorkflowName(instanceID))) {
        handleEvent(event, WSDLUtil.findWorkflowName(workflowID),
            workflow.getGraph());
      }
    }

    // Load a sub-workflow.
    if (type == MonitorUtil.EventType.WORKFLOW_INITIALIZED) {
      if (forward) {
        // Check if the workflow instance is already open.
        for (GraphCanvas graphCanvas : graphCanvases) {
          Workflow workflow = graphCanvas.getWorkflow();
          URI instanceID = workflow.getGPELInstanceID();
          if (workflowID.equals(instanceID)) {
            // The workflow instance is already loaded.
            return;
          }
        }
View Full Code Here

      if (this.incorrectWorkflowIDs.contains(workflowInstanceID)) {
        // Do not try to load a workflow that failed before.
        return;
      }
      WorkflowClient client = this.engine.getWorkflowClient();
      Workflow loadedWorkflow = client.load(workflowInstanceID,
          WorkflowType.INSTANCE);
      GraphCanvas canvas = this.engine.getGUI().newGraphCanvas(true);
      canvas.setWorkflow(loadedWorkflow);
    } catch (GraphException e) {
      this.incorrectWorkflowIDs.add(workflowInstanceID);
View Full Code Here

  public static final String BROKER = "broker";
 
  public static void main(String[] args) throws AxisFault, RemoteException, GraphException, ComponentException {
   
    String workflowAsString = getWorkflow();
    Workflow workflow = new Workflow(workflowAsString);
   
    NameValue[] configurations = new NameValue[2];
    configurations[0] = new NameValue();
    configurations[0].setName(Main.GFAC);
    configurations[0].setValue(XBayaConstants.DEFAULT_GFAC_URL.toString());
View Full Code Here

    String localWorkflow = this.configuration.getWorkflow();
    if (null != localWorkflow && !"".equals(localWorkflow)) {
      XRegistryAccesser xregistryAccesser = new XRegistryAccesser(this.configuration.getMyProxyUsername(),
          this.configuration.getMyProxyPassphrase(), this.configuration.getMyProxyServer(),
          this.configuration.getXRegistryURL());
      Workflow workflow = xregistryAccesser.getWorkflow(localWorkflow);
      this.setWorkflow(workflow);
    }

  }
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.