Package eu.admire.dispel.graph

Examples of eu.admire.dispel.graph.Connection


     * @param graph  DISPEL graph
     */
    private void removeDataExchangeNode(RequestNode node, Graph graph)
    {
        Map<String, Map<Integer, Connection>> allInputs = node.getAllInputs();
        Connection in = allInputs.get(DATA_EXCHANGE_INPUT_NAME).get(0);
        Map<String, Map<Integer, Connection>> allOutputs = node.getAllOutputs();
        Connection out = allOutputs.get(DATA_EXCHANGE_OUTPUT_NAME).get(0);
       
        graph.getNodes().remove(node);
       
        RequestNode sourceNode = in.getSource();
        sourceNode.replaceOutput(
View Full Code Here


        String name = "results";
        Map<Integer, Connection> nameInputs =
            node.getAllInputs().get(ResultNode.PE_INPUT_NAME);
        if (nameInputs != null)
        {
            Connection input = nameInputs.get(0);
            if (input != null)
            {
                RequestNode source = input.getSource();
                remove.add(source);
                if (source instanceof LiteralValuesNode)
                {
                    name = (String)((LiteralValuesNode) source).getValues().get(0);
                }
View Full Code Here

    }
   
    private void connectNewResultNode(RequestNode oldResult, ResultNode newResult)
    {
        Connection connection = oldResult.getInput(ResultNode.INPUT_NAME, 0);
        int index = -1;
        for (int i=0; i<connection.getTargets().size(); i++)
        {
            RequestNodeInput target = connection.getTargets().get(i);
            if (target.getRequestNode() == oldResult)
            {
                index = i;
            }
        }
        if (index >= 0)
        {
            connection.getTargets().remove(index);
            RequestNodeInput input =
                new SingleRequestNodeInput(newResult, ResultNode.INPUT_NAME, 0);
            connection.getTargets().add(index, input);
        }
    }
View Full Code Here

      Map<String, Map<Integer, Connection>> outputs = node
          .getAllOutputs();

      for (String keyName : outputs.keySet()) {
        for (Integer keyIndex : outputs.get(keyName).keySet()) {
          Connection conn = outputs.get(keyName).get(keyIndex);

              int targetCount = 0;
              for(RequestNodeInput target : conn.getTargets()) {
         
                       
                        RequestNode observerNode = new ProcessingElementNode("eu.admire.Observer");
                       
                        Connection output = observerNode.getOutput("out", 0);
                        target.getRequestNode().replaceInput(target.getName(), target.getIndex(), output);
                       
                        Connection input = observerNode.getInput("in", 0);
                       
                        if (targetCount == 0)
                        {
                            node.replaceOutput(keyName, keyIndex, input);
                        }
                        else
                        {
                            observerNode.connectInput("in", 0, node.getOutput(keyName, keyIndex));
                        }
                        targetCount++;

                        Connection gathConn = observerNode.getOutput("observed", 0);
                        gathererNode.connectInput("input", i++, gathConn);


                       
                        list.add(observerNode);
View Full Code Here

        {
            for (Entry<String, Map<Integer, Connection>> entry : node.getAllInputs().entrySet())
            {
                for (Entry<Integer, Connection> input : entry.getValue().entrySet())
                {
                    Connection connection = input.getValue();
                    if (connection.getSource() == null)
                    {
                        throw new TransformationException(
                                new UnconnectedInputException(
                                        node, entry.getKey(), input.getKey()));
                    }
                       
                }
            }
           
            for (Entry<String, Map<Integer, Connection>> entry : node.getAllOutputs().entrySet())
            {
                for (Entry<Integer, Connection> output : entry.getValue().entrySet())
                {
                    Connection connection = output.getValue();
                    if (connection.getTargets().isEmpty())
                    {
                        throw new TransformationException(
                                new UnconnectedOutputException(
                                            node, entry.getKey(), output.getKey()));
                    }
View Full Code Here

                        throw new TransformationException(
                                "No input " + ExternalOutputNode.INPUT_NAME
                                + " defined for processing element "
                                + ExternalOutputNode.NAME);
                    }
                    Connection data =
                        node.getInput(ExternalOutputNode.INPUT_NAME, 0);
                    ExternalOutputNode output = new ExternalOutputNode(name, gateway);
                    output.copyAnnotations(node);
                    GraphUtilities.replaceTarget(
                            data,
                            node,
                            new SingleRequestNodeInput(output, ExternalOutputNode.INPUT_NAME, 0));
                    output.setInput(data);
                    add.add(output);
                    LOG.debug("Created new external output node, name: " + name);
                }
                else if (ExternalInputNode.NAME.equals(node.getName()))
                {
                    remove.add(node);
                    String name = getValue(node, ExternalInputNode.INPUT_RESULT, remove);
                    String gateway = getValue(node, ExternalInputNode.INPUT_GATEWAY, remove);
                    if (node.getAllOutputs().get(ExternalInputNode.OUTPUT_NAME) == null)
                    {
                        throw new TransformationException(
                                "No output " + ExternalInputNode.OUTPUT_NAME
                                + " defined for processing element "
                                + ExternalInputNode.NAME);
                    }
                    Connection data =
                        node.getOutput(ExternalInputNode.OUTPUT_NAME, 0);
                    ExternalInputNode result = new ExternalInputNode(name, gateway);
                    result.copyAnnotations(node);
                    result.connectOutput(
                            data.getSource().getOutput(
                                    data.getSourceOutputName(),
                                    data.getSourceOutputIndex()));
                    add.add(result);
                    LOG.debug("Created new external output node, name: " + name);
                }
            }
        }
View Full Code Here

    {
        String result = null;
        Map<Integer, Connection> nameInputs = node.getAllInputs().get(inputName);
        if (nameInputs != null)
        {
            Connection input = nameInputs.get(0);
            if (input != null)
            {
                RequestNode source = input.getSource();
                remove.add(source);
                if (source instanceof LiteralValuesNode)
                {
                    result = (String)((LiteralValuesNode) source).getValues().get(0);
                }
View Full Code Here

                    if (inputDesc.getIsDataSourceInput())
                    {
                        // We have an anchor (that keeps the soul)
                       
                        // It is connected to a literal?
                        Connection conn =
                            peNode.getInput(inputDesc.getName(), 0);
                       
                        RequestNode source = conn.getSource();
                        if (source instanceof LiteralValuesNode)
                        {
                            List<Object> values =
                                ((LiteralValuesNode) source).getValues();
                            if (!values.isEmpty())
View Full Code Here

        Graph graph = new Graph();
        ProcessingElementNode nodeA = new ProcessingElementNode("uk.org.ogsadai.SQLQuery");
        graph.add(nodeA);
        ProcessingElementNode nodeB = new ProcessingElementNode("uk.org.ogsadai.DeliverToRequestStatus");
        graph.add(nodeB);
        Connection connection = new TeeConnection();
        nodeA.connectOutput("out1", 0, connection);
        nodeB.connectInput("in1", 0, connection);
        Connection connection2 = new TeeConnection();
        nodeA.connectOutput("out2", 0, connection2);
        nodeB.connectInput("in2", 0, connection2);
        String dot = DotGenerator.generate(graph);
//        writeFile(dot);
        System.out.println(dot);
View Full Code Here

        Graph graph = new Graph();
        ProcessingElementNode nodeA = new ProcessingElementNode("uk.org.ogsadai.SQLQuery");
        graph.add(nodeA);
        ProcessingElementNode nodeB = new ProcessingElementNode("eu.admire.Results");
        graph.add(nodeB);
        Connection connection = new TeeConnection();
        nodeA.connectOutput("out1", 0, connection);
        nodeB.connectInput("in1", 0, connection);
        Connection connection2 = new TeeConnection();
        nodeA.connectOutput("out2", 0, connection2);
        nodeB.connectInput("in2", 0, connection2);
        Map<String, Variable> variables = new HashMap<String, Variable>();
        variables.put("query", new Variable(new ProcessingElementType("uk.org.ogsadai.SQLQuery"), nodeA));
        variables.put("results", new Variable(new ProcessingElementType("eu.admire.Results"), nodeB));
View Full Code Here

TOP

Related Classes of eu.admire.dispel.graph.Connection

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.