com.ibm.broker.config.appdev

Class GenericNode

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Cloneable


    public class GenericNode
    extends Node
    implements java.lang.Cloneable

    This node provides the ability to model any user-defined node.

    User-defined nodes are supported by instances of the GenericNode class. To add a user-defined node to a message flow, create an instance of GenericNode and add it to the MessageFlow instance.

    To retrieve an existing instance of a user-defined node from a MessageFlow instance, call getNodeByName and cast the returned object to a GenericNode.

    New instances of a GenericNode class do not have any input or output terminals. Calls to getInputTerminals and getOutputTerminals return empty lists.

    To get an input terminal for a GenericNode, call getInputTerminal and pass the terminal name which you know exists on the user-defined node. This will return an InputTerminal and also make it known to the MessageFlow instance that contains this GenericNode.

    To get an output terminal for a GenericNode, call getOutputTerminal and pass the terminal name which you know exists on the user-defined node. This will return an OutputTerminal and also make it known to the MessageFlow instance that contains this GenericNode.

    Here is an example code snippet that connects an MQInput node to a user-defined node:

                    MQInputNode inputNode = new MQInputNode();
                    inputNode.setNodeName("MQ Input");
                    inputNode.setQueueName("IN");
     
                    mf1.addNode(inputNode);
       
                    // Creates the user-defined node
                    GenericNode myNode = new GenericNode("MyUserDefinedNode");
                    myNode.setNodeName("MyNode");
     
                    mf1.addNode(myNode);
     
                    // Gets the static output terminal from the MQInput node
                    OutputTerminal outputTerminal = inputNode.OUTPUT_TERMINAL_OUT;
     
                    // Gets the terminal from the user-defined node
                    InputTerminal inputTerminal = myNode.getInputTerminal("In");
     
                    // Connects the nodes together
                    mf.connect(outputTerminal, inputTerminal);
     
                    // The input terminal is now known to the message flow
                    InputTerminal[] inputTerminals = myNode.getInputTerminals();
                    System.out.println("Input terminals on my node:");
                    for (int i = 0; i < inputTerminals.length; i++) {
                            InputTerminal inputTerminal = inputTerminals[i];
                            System.out.println(inputTerminal.getName());
                    } 
     
     Change Activity:
     -------- ----------- -------------   ------------------------------------
     Reason:  Date:       Originator:     Comments:
     -------- ----------- -------------   ------------------------------------
     xxxxx.x  2010-08-10  dstorey           initial creation
     xxxxx.x  2011-07-06  dstorey           v8.0.0.0 Release
     
    See Also:
    Serialized Form
    • Constructor Detail

      • GenericNode

        public GenericNode(java.lang.String internalNodeName)
        Creates a generic node of a given type
        Parameters:
        internalNodeName - String; any msgnode extension is removed to give the internal node name
    • Method Detail

      • getInputTerminals

        public InputTerminal[] getInputTerminals()
        Description copied from class: Node
        Gets the full list of available InputTerminals for this Node
        Specified by:
        getInputTerminals in class Node
        Returns:
        InputTerminal[]
      • getOutputTerminals

        public OutputTerminal[] getOutputTerminals()
        Description copied from class: Node
        Gets the full list of available OutputTerminals for this Node
        Specified by:
        getOutputTerminals in class Node
        Returns:
        OutputTerminal[]
      • getOutputTerminal

        public OutputTerminal getOutputTerminal(java.lang.String terminalName)
        Description copied from class: Node
        Gets the output terminal for the node. If the terminal is a dynamic terminal this will create the terminal and return it.
        Overrides:
        getOutputTerminal in class Node
        Parameters:
        terminalName - String; the internal terminal name
        Returns:
        an OutputTerminal
      • getInputTerminal

        public InputTerminal getInputTerminal(java.lang.String terminalName)
        Description copied from class: Node
        Gets the input terminal for the node. If the terminal is a dynamic terminal this will create the terminal and return it.
        Overrides:
        getInputTerminal in class Node
        Parameters:
        terminalName - String; the internal terminal name
        Returns:
        InputTerminal
      • setNodeType

        public GenericNode setNodeType(java.lang.String nodeType)
        Allows you to change this nodes type
        Parameters:
        nodeType - String; the node type of this node
      • getTypeName

        public java.lang.String getTypeName()
        Description copied from class: Node
        Gets the node type of this node
        Specified by:
        getTypeName in class Node
        Returns:
        String; the node type
      • getNodeName

        public java.lang.String getNodeName()
        Description copied from class: Node
        Gets the label name of this node
          MessageFlow mf1 = patternInstanceManager.getMessageFlow("MyFlowProject", "mf1.msgflow");
          Node inputMQNode = mf1.getNodeByName("My Input Node");
          inputMQNode.setNodeName("Renamed Input Node");
         
        Overrides:
        getNodeName in class Node
        Returns:
        String; the node name
      • setNodeName

        public GenericNode setNodeName(java.lang.String nodeName)
        Description copied from class: Node
        Sets the label name of this node. This allows you to rename a node.
        Overrides:
        setNodeName in class Node
        Parameters:
        nodeName - String; the given node name
        Returns:
        Node
      • addNodeProperty

        public GenericNode addNodeProperty(NodeProperty nodeProperty)
        Adds newly discovered properties either during parse or a customer can add their own properties.
        Parameters:
        nodeProperty - NodeProperty NodeProperty a node property.
      • getInstanceNodeProperties

        public NodeProperty[] getInstanceNodeProperties()
        Description copied from class: Node
        Returns the list of the simple properties which are defined on this node instance The actual node instance values are set for these node properties.
        Overrides:
        getInstanceNodeProperties in class Node
        Returns:
        NodeProperty[] An array of simple NodeProperty
      • getNodeProperties

        public NodeProperty[] getNodeProperties()
        Description copied from class: Node
        Returns the list of simple properties which are available to set on this node No instance values are set here.
        Returns:
        NodeProperty[] An array of simple NodeProperty
      • setProperty

        public GenericNode setProperty(java.lang.String propertyName,
                                       java.lang.String propertyValue)
        Description copied from class: Node
        Allows the setting a node property directly by name and value
        Overrides:
        setProperty in class Node
        Parameters:
        propertyName - String; A given node property
        propertyValue - String; A given node value
      • setProperty

        public GenericNode setProperty(java.lang.String propertyName,
                                       java.lang.String propertyValue,
                                       boolean configurable)
      • findPropertyByName

        public NodeProperty findPropertyByName(java.lang.String propertyName)
        Description copied from class: Node
        Finds the NodeProperty on the node of the given node property name
        Overrides:
        findPropertyByName in class Node
        Parameters:
        propertyName - String; the property name
        Returns:
        NodeProperty; returns the node property of the given property name. null is returned if the property has not been found.
      • addNodePropertyTable

        public GenericNode addNodePropertyTable(NodePropertyTable newTable)
        Add a new NodePropertyTable to this Generic Node
        Parameters:
        newTable - NodePropertyTable; The given NodePropertyTable to add.