Package edu.indiana.extreme.xbaya.graph

Examples of edu.indiana.extreme.xbaya.graph.Graph


     */
    public void testRemoveNode() throws ComponentException, GraphException,
            ComponentRegistryException {
        WorkflowCreator creator = new WorkflowCreator();
        Workflow workflow = creator.createSimpleMathWorkflow();
        Graph graph = workflow.getGraph();

        Node node = graph.getNode("Adder_add");
        assertNotNull(node);
        int originalSize = graph.getPorts().size();
        int portNum = node.getAllPorts().size();
        graph.removeNode(node);

        assertEquals(originalSize - portNum, graph.getPorts().size());
    }
View Full Code Here


        // Name, description
        workflow.setName("Hierarchical workflow");
        workflow.setDescription("Hierarchical workflow");

        Graph graph = workflow.getGraph();

        // Input 1
        InputComponent inputComponent = new InputComponent();
        InputNode input1 = (InputNode) workflow.addNode(inputComponent);
        input1.setPosition(new Point(50, 50));

        // Input 2
        InputNode input2 = (InputNode) workflow.addNode(inputComponent);
        input2.setPosition(new Point(50, 150));

        InputNode input3 = (InputNode) workflow.addNode(inputComponent);
        input3.setPosition(new Point(50, 250));

        // Adder node
        Component adderComp = this.componentRegistry
                .getComponent(Adder.WSDL_PATH);
        Node adder = workflow.addNode(adderComp);
        adder.setPosition(new Point(200, 100));

        // Sub workflow
        WorkflowComponent subWorkflowComponent = this.gpelComponentRegistry
                .getComponent(subWorkflowID);
        Node subWorkflow = workflow.addNode(subWorkflowComponent);
        subWorkflow.setPosition(new Point(350, 150));

        // Output
        OutputComponent outputComponent = new OutputComponent();
        OutputNode outParamNode = (OutputNode) workflow
                .addNode(outputComponent);
        outParamNode.setPosition(new Point(800, 150));

        // Connect ports
        graph.addEdge(input1.getOutputPort(0), adder.getInputPort(0));
        graph.addEdge(input2.getOutputPort(0), adder.getInputPort(1));
        graph.addEdge(adder.getOutputPort(0), subWorkflow.getInputPort(0));
        graph.addEdge(input3.getOutputPort(0), subWorkflow.getInputPort(1));
        graph.addEdge(subWorkflow.getOutputPort(0), outParamNode
                .getInputPort(0));

        // Set the default values
        // This needs to be after connection.
        input1.setDefaultValue("2");
View Full Code Here

        // Name, description
        workflow.setName("Simple math workflow");
        workflow.setDescription("Simple math workflow");

        Graph graph = workflow.getGraph();

        // Adder node
        Component adderComp = this.componentRegistry
                .getComponent(Adder.WSDL_PATH);
        Node adderNode = workflow.addNode(adderComp);
        adderNode.setPosition(new Point(250, 100));

        // Input parameter node 1
        InputNode paramNode1 = (InputNode) workflow
                .addNode(this.inputComponent);
        paramNode1.setPosition(new Point(50, 50));

        // Input parameter node 2
        InputNode paramNode2 = (InputNode) workflow
                .addNode(this.inputComponent);
        paramNode2.setPosition(new Point(50, 120));

        // Output parameter
        OutputNode outParamNode = (OutputNode) workflow
                .addNode(this.outputComponent);
        outParamNode.setPosition(new Point(300, 220));

        // Connect ports
        graph.addEdge(paramNode1.getOutputPort(0), adderNode.getInputPort(0));
        graph.addEdge(paramNode2.getOutputPort(0), adderNode.getInputPort(1));
        graph.addEdge(adderNode.getOutputPort(0), outParamNode.getInputPort(0));

        // Set the default values
        // This needs to be after connection.
        String paramValue1 = "2";
        paramNode1.setDefaultValue(paramValue1);
View Full Code Here

        // Name, description
        workflow.setName("Math workflow");
        workflow.setDescription("A workflow that calculates (a + b) * c.");

        Graph graph = workflow.getGraph();

        // Adder node
        Component adderComp = this.componentRegistry
                .getComponent(Adder.WSDL_PATH);

        Node adderNode1 = workflow.addNode(adderComp);
        adderNode1.setPosition(new Point(170, 50));

        // Multiplier node
        Component multiComp = this.componentRegistry
                .getComponent(Multiplier.WSDL_PATH);

        Node multiNode = workflow.addNode(multiComp);
        multiNode.setPosition(new Point(320, 130));

        // Input node 1
        InputNode inputNode1 = (InputNode) workflow
                .addNode(this.inputComponent);
        inputNode1.setPosition(new Point(20, 30));

        // Input node 2
        InputNode inputNode2 = (InputNode) workflow
                .addNode(this.inputComponent);
        inputNode2.setPosition(new Point(20, 100));

        // Input node 3
        InputNode inputNode3 = (InputNode) workflow
                .addNode(this.inputComponent);
        inputNode3.setPosition(new Point(20, 170));

        // Output
        OutputNode outputNode = (OutputNode) workflow
                .addNode(this.outputComponent);
        outputNode.setPosition(new Point(500, 130));

        // Connect ports
        graph.addEdge(inputNode1.getOutputPort(0), adderNode1.getInputPort(0));
        graph.addEdge(inputNode2.getOutputPort(0), adderNode1.getInputPort(1));
        graph.addEdge(adderNode1.getOutputPort(0), multiNode.getInputPort(0));
        graph.addEdge(inputNode3.getOutputPort(0), multiNode.getInputPort(1));
        graph.addEdge(multiNode.getOutputPort(0), outputNode.getInputPort(0));

        // Set the default values
        // This needs to be after connection.
        inputNode1.setConfiguredName("a");
        inputNode2.setConfiguredName("b");
View Full Code Here

        // Name, description
        workflow.setName("Complex math workflow");
        workflow.setDescription("Complex math workflow");

        Graph graph = workflow.getGraph();

        // Adder nodes
        Component adderComp = this.componentRegistry
                .getComponent(Adder.WSDL_PATH);

        Node adderNode1 = workflow.addNode(adderComp);
        adderNode1.setPosition(new Point(170, 50));

        Node adderNode2 = workflow.addNode(adderComp);
        adderNode2.setPosition(new Point(170, 210));

        // Multiplier node
        Component multiComp = this.componentRegistry
                .getComponent(Multiplier.WSDL_PATH);

        Node multiNode = workflow.addNode(multiComp);
        multiNode.setPosition(new Point(320, 130));

        // Input node 1
        InputNode inputNode1 = (InputNode) workflow
                .addNode(this.inputComponent);
        inputNode1.setPosition(new Point(20, 30));

        // Input node 2
        InputNode inputNode2 = (InputNode) workflow
                .addNode(this.inputComponent);
        inputNode2.setPosition(new Point(20, 100));

        // Input node 3
        InputNode inputNode3 = (InputNode) workflow
                .addNode(this.inputComponent);
        inputNode3.setPosition(new Point(20, 170));

        // Input node 4
        InputNode inputNode4 = (InputNode) workflow
                .addNode(this.inputComponent);
        inputNode4.setPosition(new Point(20, 240));

        // Output
        OutputNode outputNode = (OutputNode) workflow
                .addNode(this.outputComponent);
        outputNode.setPosition(new Point(500, 130));

        // Connect ports
        graph.addEdge(inputNode1.getOutputPort(0), adderNode1.getInputPort(0));
        graph.addEdge(inputNode2.getOutputPort(0), adderNode1.getInputPort(1));
        graph.addEdge(inputNode3.getOutputPort(0), adderNode2.getInputPort(0));
        graph.addEdge(inputNode4.getOutputPort(0), adderNode2.getInputPort(1));
        graph.addEdge(adderNode1.getOutputPort(0), multiNode.getInputPort(0));
        graph.addEdge(adderNode2.getOutputPort(0), multiNode.getInputPort(1));
        graph.addEdge(multiNode.getOutputPort(0), outputNode.getInputPort(0));

        // Set the default values
        // This needs to be after connection.
        inputNode1.setConfiguredName("a");
        inputNode2.setConfiguredName("b");
View Full Code Here

        // Parse the workflow
        Workflow workflow = new Workflow(workflowXML);

        // Take out the graph of the workflow.
        Graph graph = workflow.getGraph();

        // Extract inputs of the workflow.
        Collection<InputNode> inputNodes = GraphUtil.getInputNodes(graph);

        for (InputNode inputNode : inputNodes) {
View Full Code Here

        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

     * @return The Map<partnerLinkName, CWSDL>.
     */
    public static Map<String, WsdlDefinitions> createCWSDLs(Workflow workflow,
            URI dscURL) {
        Map<String, WsdlDefinitions> WSDLMap = new HashMap<String, WsdlDefinitions>();
        Graph graph = workflow.getGraph();
        for (WSNode node : GraphUtil.getWSNodes(graph)) {
            String partnerLinkName = BPELScript.createPartnerLinkName(node
                    .getID());
            WsdlDefinitions wsdl = node.getComponent().getWSDL();
            if (WSDLUtil.isAWSDL(wsdl)) {
View Full Code Here

        for (GcWsdlResource resource : wsdlResourceMap.values()) {
            links.remove(resource);
        }

        // Graph
        Graph graph = workflow.getGraph();
        if (graphResource == null) {
            logger.finest("Creating a new graphResource");
            graphResource = new GcXmlWebResource("process.xgr", graph.toXML(),
                    GRAPH_MIME_TYPE);
            graphResource.setRel(GPELLinksFilter.REL_XWF);
            links.add(graphResource);
        } else {
            logger.finest("Updating the graphResource");
            graphResource.setXmlContent(graph.toXML());
        }

        // Image
        try {
            BufferedImage image = workflow.getImage();
View Full Code Here

                title = title + " (" + name + ")";
                logger.finest("new title: " + title);
                instance.setTitle(title);
            }

            Graph graph = workflow.getGraph();
            for (WSNode node : GraphUtil.getNodes(graph, WSNode.class)) {
                String partnerLinkName = BPELScript.createPartnerLinkName(node
                        .getID());
                logger.finest("partnerLinkName: " + partnerLinkName);
                WsdlDefinitions wsdl = node.getComponent().getWSDL();
View Full Code Here

TOP

Related Classes of edu.indiana.extreme.xbaya.graph.Graph

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.