Package org.apache.airavata.workflow.model.graph

Examples of org.apache.airavata.workflow.model.graph.Node$NodeObserver


      Port inputPort = graphPanel.getSelectedInputPort();
      Port outputPort = graphPanel.getSelectedOutputPort();
      this.portViewer.setInputPort(inputPort);
      this.portViewer.setOutputPort(outputPort);
      // Reset component viewer.
      Node node = graphPanel.getSelectedNode();
      Component component;
      if (node != null) {
        component = node.getComponent();
      } else {
        component = this.componentSelector.getSelectedComponent();
      }
      this.componentViewer.setComponent(component);
      String name = graphPanel.getWorkflow().getName();
View Full Code Here


         * message and instanceID do not equal, so we have to handle it explicitly
         */
        if (type == EventType.RESOURCE_MAPPING && event.getMessage().contains("i-")) {
            String nodeID = event.getNodeID();
            for (GraphCanvas graphCanvas : graphCanvases) {
                Node node = graphCanvas.getWorkflow().getGraph().getNode(nodeID);
                if (node != null) {
                    ControlPort control = node.getControlInPort();
                    if (control != null) {
                        Node fromNode = control.getFromNode();
                        if (fromNode instanceof InstanceNode) {
                            InstanceNode ec2Node = (InstanceNode) fromNode;

                            /*
                             * parse message and set output to InstanceNode
View Full Code Here

     * @param graph
     */
    private void handleEvent(EventData event, boolean forward, Graph graph) {
        EventType type = event.getType();
        String nodeID = event.getNodeID();
        Node node = graph.getNode(nodeID);
        System.out.println(type);;
        // logger.info("type: " + type);
        if (type == MonitorUtil.EventType.WORKFLOW_INVOKED) {
            workflowStarted(graph, forward);
//            workflowStatusUpdater.workflowStarted(event.getExperimentID());
View Full Code Here

    private void finishPredecessorNodes(Node node) {
        for (Port inputPort : node.getInputPorts()) {
            for (Edge edge : inputPort.getEdges()) {
                Port fromPort = edge.getFromPort();
                if (!(fromPort instanceof EPRPort)) {
                    Node fromNode = fromPort.getNode();
                    finishNode(fromNode);
                    finishPredecessorNodes(fromNode);
                }
            }
        }
View Full Code Here

                    continue;
                }
            }
            Collection<Port> fromPorts = inputPort.getFromPorts();
            if (fromPorts.size() == 0) {
                Node node = inputPort.getNode();
                String message = node.getID() + " has an unconnected input " + inputPort.getName();
                warnings.add(message);
            }
        }

        // Input nodes need to be connected.
View Full Code Here

     */
    private GpelAssignCopyFrom createAssignCopyFrom(Port port) throws GraphException {
        GpelAssignCopyFrom from = new GpelAssignCopyFrom(this.bpelNS);

        Port fromPort = port.getFromPort();
        Node fromNode = fromPort.getNode();
        if (fromNode instanceof InputNode) {
            from.setVariable(WORKFLOW_INPUT_NAME);
            from.setPart(WorkflowWSDL.INPUT_PART_NAME);
            from.setQuery("/" + this.typesNamespace.getPrefix() + ":"
                    + this.workflowWSDL.getWorkflowInputMessageElelmentName() + "/" + fromNode.getID());
        } else if (fromNode instanceof ConstantNode) {
            ConstantNode constNode = (ConstantNode) fromNode;
            Object value = constNode.getValue();
            // The namaspace and name of the literal element will be set
            // correctly in from.setLiteral().
            XmlElement literalElement = XMLUtil.BUILDER.newFragment(GpelAssignCopyFrom.LITERAL_EL);
            literalElement.addChild(value);
            from.setLiteral(literalElement);
        } else if (fromNode instanceof WSNode) {
            String fromID = fromNode.getID();
            WSComponent fromWsdlComponent = (WSComponent) fromNode.getComponent();

            WSComponentPort fromWsdlPort = (WSComponentPort) fromPort.getComponentPort();

            from.setVariable(fromID + OUTPUT_SUFFIX);
            from.setPart(fromWsdlComponent.getOutputPartName());

            if (fromWsdlPort.isSchemaUsed()) {
                String typesTargetNamespace = fromWsdlPort.getTargetNamespace();
                XmlNamespace namespace = XMLUtil.declareNamespaceIfNecessary(fromID.toLowerCase() + TYPENS_SUFFIX,
                        typesTargetNamespace, false, this.process.xml());

                from.setQuery("/" + namespace.getPrefix() + ":" + fromWsdlComponent.getOutputTypeName() + "/"
                        + fromWsdlPort.getName());
            } else {
                // No query needed?
            }
        } else if (fromNode instanceof ForEachNode) {
            from.setVariable(fromNode.getID() + FOREACH_VALUE_SUFFIX);
        } else if (fromNode instanceof EndForEachNode) {
            from.setVariable(fromNode.getID() + ARRAY_SUFIX);
        } else if (fromNode instanceof EndifNode) {
            // endif has multiple outputs, so we use port ID here.
            from.setVariable(fromPort.getID() + OUTPUT_SUFFIX);
        } else if (fromNode instanceof ReceiveNode) {
            if (fromPort instanceof EPRPort) {
                from.setPartnerLink(fromNode.getID() + PARTNER_LINK_NAME_SUFFIX);
                from.setEndpointReference("myRole");
            } else {
                from.setVariable(fromNode.getID() + INPUT_SUFFIX);
            }
        } else if (fromNode instanceof InstanceNode) {
            // no op
        } else {
            throw new GraphException("Unexpected node," + fromNode.getClass().getName() + " is connected");
        }
        return from;
    }
View Full Code Here

     * @return The GpelAssignCopyTo created
     */
    private GpelAssignCopyTo createAssignCopyTo(Port toPort, boolean input) {
        GpelAssignCopyTo to = new GpelAssignCopyTo(this.bpelNS);

        Node toNode = toPort.getNode();
        if (toNode instanceof OutputNode) {
            to.setVariable(WORKFLOW_OUTPUT_NAME);
            to.setPart(WorkflowWSDL.OUTPUT_PART_NAME);
            to.setQuery("/" + this.typesNamespace.getPrefix() + ":"
                    + this.workflowWSDL.getWorkflowOutputMessageElementName() + "/" + toNode.getID());
        } else {
            WSComponentPort toComponentPort = (WSComponentPort) toPort.getComponentPort();

            String toID = toNode.getID();
            WSComponent toWSComponent = (WSComponent) toNode.getComponent();
            to.setVariable(toID + INPUT_SUFFIX);
            to.setPart(toWSComponent.getInputPartName());

            if (toComponentPort.isSchemaUsed()) {
                // Normal case.
View Full Code Here

            Collection<Port> fromPorts = port.getFromPorts();
            for (Port fromPort : fromPorts) {
                if (fromPort instanceof EPRPort) {
                    continue;
                }
                Node fromNode = fromPort.getNode();
                if (nodes.contains(fromNode)) {
                    // There is a node that should be executed before this
                    // node.
                    return false;
                }
View Full Code Here

        subSequence.addActivity(valueAssign);

        addBlock(forEachBlock, subSequence);

        Node mergeNode = getMergeNode(splitNode);
        String outputName = mergeNode.getID() + ARRAY_SUFIX;
        // TODO This should be type instead of messageType
        this.process.addMessageVariable(outputName, WSConstants.XSD_NS, WSConstants.XSD_ANY_TYPE.getLocalPart());
        GpelAssignCopyFrom outputFrom = createAssignCopyFrom(mergeNode.getInputPort(0).getFromPort());
        GpelAssignCopyTo outputTo = new GpelAssignCopyTo(this.bpelNS);
        outputTo.setVariable(outputName);
        outputTo.setQuery("/value[$i]");
        GpelAssignCopy outputCopy = new GpelAssignCopy(this.bpelNS, outputFrom, outputTo);
        GpelAssign outputAssign = new GpelAssign(this.bpelNS, outputCopy);
View Full Code Here

    protected void edgeWasAdded(Edge edge) throws GraphException {
        super.edgeWasAdded(edge);

        if (edge instanceof DataEdge) {
            Port toPort = edge.getToPort();
            Node toNode = toPort.getNode();
            Port fromPort = edge.getFromPort();
            Node fromNode = fromPort.getNode();

            if (!(toNode instanceof ResourceNode && fromNode instanceof ResourceNode)) {
                throw new GraphException("Cannot connect Resource Node to other type of nodes");
            }
        }
View Full Code Here

TOP

Related Classes of org.apache.airavata.workflow.model.graph.Node$NodeObserver

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.