com.ibm.broker.config.appdev

Class MessageFlow

  • java.lang.Object
    • com.ibm.broker.config.appdev.MessageFlow
  • All Implemented Interfaces:
    java.io.Serializable


    public class MessageFlow
    extends java.lang.Object
    implements java.io.Serializable

    Each MessageFlow instance is the logical representation of an IBM App Connect Enterprise message flow.

    The class provides methods that allow the traversal and modification of message flows under development, but not the management of deployed instances.

    Once a message flow is deployed to a execution group, the object is managed using the com.ibm.broker.config.proxy.MessageFlowProxy class.

    Here is an example implementation that demonstrates how to use the Message Flow class to connect two existing nodes together:

                File msgFlow1 = new File("Test.msgflow");
                MessageFlow mf1 = FlowRendererMSGFLOW.read(msgFlow1);
                Node inputNode = mf1.getNodeByName("input from queue");
                Node outputNode = mf1.getNodeByName("output from queue");
                mf1.connect(inputNode.getOutputTerminal("out"),
                            outputNode.getInputTerminal("in"));
     

    The MessageFlow class does not have a physical rendering. To save the logical MessageFlow to a file, use the FlowRenderer classes.

     Change Activity:
     -------- ----------- -------------   ------------------------------------
     Reason:  Date:       Originator:     Comments:
     -------- ----------- -------------   ------------------------------------
     xxxxx.x  2010-07-27  HDMPL           creation
     xxxxx.x  2010-08-10  dstorey         v7.0.0.2 Release
     xxxxx.x  2011-07-06  dstorey         v8.0.0.0 Release
     
    See Also:
    Serialized Form
    • Constructor Detail

      • MessageFlow

        public MessageFlow(java.lang.String msgFlowName)
        Instantiates an MessageFlow object of the supplied name, which contains no nodes. The name is used to when serializing the message flow to a file or for deployment, and should include the file extension such as .msgflow.
        Parameters:
        msgFlowName - Name of the message flow, for example "mf1". Cannot be null.
    • Method Detail

      • getFileName

        public java.lang.String getFileName()
        Get the file name for this message flow, with native path separators.
        Returns:
        the file name for this message flow.
      • getFileName

        public java.lang.String getFileName(boolean forwardSlashes)
        Get the file name for this message flow.
        Parameters:
        forwardSlashes - force use of forward path separators.
        Returns:
        the file name for this message flow.
      • getName

        public java.lang.String getName()
        Returns the name of the message flow.
        Returns:
        String name
      • isSubflow

        public boolean isSubflow()
        Returns whether the message flow is a subflow (*.subflow)
        Returns:
        boolean true if this message flow is a *.subflow
      • setSubflow

        public MessageFlow setSubflow(boolean subflow)
        If set to true this will render this message flow as a subflow (*.subflow) otherwise render as a message flow (*.msgflow)
        Parameters:
        subflow - boolean
      • getBrokerSchema

        public java.lang.String getBrokerSchema()
        Returns the broker schema location of the messageflow
        Returns:
        String broker schema
      • getLongDescription

        public java.lang.String getLongDescription()
        Returns the long description associated with the message flow.
        Returns:
        String long description
      • getShortDescription

        public java.lang.String getShortDescription()
        Returns the short description associated with the message flow.
        Returns:
        String short description
      • setShortDescription

        public MessageFlow setShortDescription(java.lang.String shortDescription)
        Sets the short description associated with the message flow. The field is used for information only.
        Parameters:
        shortDescription - New short description text
      • setLongDescription

        public MessageFlow setLongDescription(java.lang.String longDescription)
        Sets the long description associated with the message flow. The field is used for information only.
        Parameters:
        longDescription - New long description text
      • getVersion

        public java.lang.String getVersion()
        Returns the version information associated with the message flow.
        Returns:
        String version
      • setVersion

        public MessageFlow setVersion(java.lang.String version)
        Sets the version text associated with the message flow. The field is used for information only.
        Parameters:
        version - New version text
      • setName

        public MessageFlow setName(java.lang.String msgFlowName)
        Sets the name of the message flow.
        Parameters:
        msgFlowName - New message flow name, for example, "mf1". Cannot be null.
      • connect

        public Connection connect(OutputTerminal outputTerminal,
                                  InputTerminal inputTerminal)
        Connects the output terminal of one node into the input terminal of another node, and stores the association inside the message flow. If the affected nodes are not already part of the message flow, they will be automatically added to the message flow as part of this call. If a connection already exists between the same terminal instances, this method does not modify the message flow and the existing Connection is returned.
        Parameters:
        outputTerminal - Output terminal of the source node
        inputTerminal - Input terminal of the target node
        Returns:
        Connection The new Connection that was formed, or the existing Connection if one already existed between the supplied terminals.
      • disconnect

        public MessageFlow disconnect(OutputTerminal outputTerminal,
                                      InputTerminal inputTerminal)
        Removes from the message flow a connection from the output terminal of one node to the input terminal of another node. If the supplied terminals were not connected, this method does nothing.
        Parameters:
        outputTerminal - Output terminal of the source node
        inputTerminal - Input terminal of the target node
      • getConnections

        public java.util.Vector<Connection> getConnections()
        Returns a Vector of all the connections between nodes that form part of this message flow.

        Elements in the returned Vector can be added or removed without affecting the message flow, although the Connection instances themselves are live, meaning that any changes to them will be reflected in the message flow.

        Returns:
        Vector All connections in the message flow
      • getNodes

        public java.util.Vector<Node> getNodes()
        Returns a Vector of all nodes in the message flow. If there are no nodes associated with the message flow, the Vector will contain zero elements.

        Elements in the returned Vector can be added or removed without affecting the message flow, although the Node instances themselves are live, meaning that any changes to them will be reflected in the message flow.

        Returns:
        Vector One element per node in the message flow.
      • getNodeByName

        public Node getNodeByName(java.lang.String nodeName)
        Returns the node that has supplied name (label). The node name must exactly match, and is case sensitive. If a node of the supplied name cannot be found, null is returned.
        Parameters:
        nodeName - Name of the node to search for
        Returns:
        Node The matching Node, or null
      • addNode

        public MessageFlow addNode(Node node)
        Adds an unconnected node to the message flow. If the node is already present in the message flow, this method does nothing. It is not generally necessary to use this method, as when a connection is formed inside the message flow, the two nodes being connected are automatically added to the message flow if they are not already present.
        Parameters:
        node - Node to add to the message flow.
      • removeNode

        public MessageFlow removeNode(Node node)
        Removes a node from the message flow. If the node has any connections, they will also be removed as part of this call. If the node is not associated with this message flow, this method does nothing.
          Node inputMQNode = mf1.getNodeByName("My Input Node");
          mf1.removeNode(inputMQNode);
         
        Parameters:
        node - The Node to remove
      • getFlowProperties

        public java.util.Vector<FlowProperty> getFlowProperties()
        Returns a Vector of all the user defined and promoted properties defined on the message flow. If there are no UDPs or promoted properties associated with the message flow, the Vector will contain zero elements.

        Elements in the returned Vector can be added or removed without affecting the message flow, although the UserDefinedProperty instances themselves are live, meaning that any changes to them will be reflected in the message flow.

        Returns:
        Vector One element per UDP
      • addFlowProperty

        public MessageFlow addFlowProperty(FlowProperty flowProperty)
        Adds a flow property to the message flow.
        Parameters:
        flowProperty - FlowProperty to add to the message flow
      • removeFlowProperty

        public MessageFlow removeFlowProperty(FlowProperty flowProperty)
        Removes a message flow property If the flow property is not associated with this message flow, this method does nothing.
        Parameters:
        flowProperty - The flowProperty to remove
      • getStickyNotes

        public java.util.Vector<StickyNote> getStickyNotes()
        Returns a Vector of all the sticky notes defined on the message flow. If there are no sticky notes associated with the message flow, the Vector will contain zero elements.

        Elements in the returned Vector can be added or removed without affecting the message flow, although the StickyNote instances themselves are live, meaning that any changes to them will be reflected in the message flow.

        Returns:
        Vector One element per sticky note
      • addStickyNote

        public MessageFlow addStickyNote(StickyNote stickyNote)
        Adds a sticky note to the message flow
        Parameters:
        stickyNote - StickyNote to add to the message flow
      • removeStickyNote

        public MessageFlow removeStickyNote(StickyNote stickyNote)
        Removes a sticky note from the message flow. If the sticky note is not associated with this message flow, this method does nothing.
        Parameters:
        stickyNote - The StickyNote to remove
      • getTargetProperties

        public java.util.Vector<TargetProperty> getTargetProperties()
        Returns a Vector of all the target properties defined on the message flow. If there are no target properties associated with the message flow, the Vector will contain zero elements.

        Elements in the returned Vector can be added or removed without affecting the message flow, although the TargetProperty instances themselves are live, meaning that any changes to them will be reflected in the message flow.

        Returns:
        Vector all target properties in the message flow
      • setTargetProperties

        public MessageFlow setTargetProperties(java.util.Vector<TargetProperty> targetProperties)
        Replaces the set of target properties associated with the message flow with the supplied set.
        Parameters:
        targetProperties - New set of target properties.
      • addTargetProperty

        public MessageFlow addTargetProperty(TargetProperty targetProperty)
        Adds a target property to the message flow
        Parameters:
        targetProperty - TargetProperty to add to the message flow
      • removeTargetProperty

        public MessageFlow removeTargetProperty(TargetProperty targetProperty)
        Removes a target property from the message flow. If the pattern annotation is not associated with this message flow, this method does nothing.
        Parameters:
        targetProperty - TargetProperty pattern annotation to remove
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object