Join

 

The Join component can be used to join two input XML structures using the Fiorano Mapper into one output XML. This component has two input ports and three output ports. The two input ports, IN_PORT1 and IN_PORT2 are used to input the two XML structures that have to be joined.  After the join operation is performed messages are sent on each of the output ports.

Message received on input IN_PORT1 is sent on output port OUT_PORT_IN1.

Message received on input IN_PORT2 is sent on output port OUT_PORT_IN2.

The result of the join operation is sent on OUT_PORT_RESULT.

When the component receives a message on one of the input ports, it checks if there are messages that are received on the other port which are not already used in join operation.

Configuration and Testing

The Join component can be configured using its Custom Property Sheet as shown in figure 1.

Figure 1: Join configuration Property Sheet

Attributes

Mappings

The mappings between input and output structures can be defined by clicking on the ellipsis button against this property. Fiorano Mapper gets launched upon clicking the ellipsis as shown in figure 2.

Figure 2: Sample Join configuration

XSLT engine

XSLT engine for the join operation can be specified by this parameter. Join operation is performed using a XSLT. The component can be configured to use a specific XSLT engine to perform XSLT. Xalan (2.7.0) and Saxon (8.4) transformer implementations are bundled with Fiorano environment for performing transformations. By default, the component uses Xalan

Transformer factory class Name

XSLT engine for the join operation can be specified by this parameter. Join operation is performed using a XSLT. The component can be configured to use a specific XSLT engine to perform XSLT. Xalan (2.7.0) and Saxon (8.4) transformer implementations are bundled with Fiorano environment for performing transformations. By default, the component uses Xalan

Resources (jar files) containing the java class specified against this property should be added as resources to Join component.

Use context value from

This property determines the input port from which the value of the application context has to be picked. This value is set on the joined message coming out of OUT_PORT_RESULT port. One of IN_PORT1 or IN_PORT2 can be chosen.

Use properties and headers from

This property determines the input port from which the headers / properties have to be picked up and set on the joined message coming out of OUT_PORT_RESULT port. If either IN_PORT1 or IN_PORT2 is chosen, properties are fetched form the chosen port and properties from the other port are discarded. If BOTH is chosen, properties from both the ports are set on the joined message.

Note: When BOTH is selected, the property Prefer Properties and Headers from will be enabled and if both input ports have any properties with same name, the values of such properties are picked based on that property.

Prefer Properties and Headers from

When the property Use properties and headers from is set as BOTH and if there are headers / properties with same name on both IN_PORT1and IN_PORT2 with different values, the port from which the values of such headers / properties have to be picked up and set on the joined message is determined by this property.

Note: This property is enabled when the property Use properties and headers from is set as BOTH.

Testing

Join component is configured as shown in Figure2 and the transformation can be tested using the Test XSL button in Fiorano Mapper launched on clicking ellipsis against property Mapping.

Sample schema for input XML message 1

<?xml version="1.0" encoding="ISO-8859-1" ?>

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" >

                            <xs:element name="shiporder">

                                <xs:complexType>

                                <xs:sequence>

                                <xs:element name="orderperson" type="xs:string"/>

                                <xs:element name="shipto">

                                    <xs:complexType>

                                    <xs:sequence>

                                        <xs:element name="name" type="xs:string"/>

                                        <xs:element name="address" type="xs:string"/>

                                        <xs:element name="city" type="xs:string"/>

                                        <xs:element name="country" type="xs:string"/>

                                    </xs:sequence>

                                    </xs:complexType>

                                </xs:element>

                                <xs:element name="item" maxOccurs="unbounded">

                                    <xs:complexType>

                                    <xs:sequence>

                                        <xs:element name="title" type="xs:string"/>

                                        <xs:element name="note" type="xs:string" minOccurs="0"/>

                                        <xs:element name="quantity" type="xs:positiveInteger"/>

                                        <xs:element name="price" type="xs:decimal"/>

                                    </xs:sequence>

                                    </xs:complexType>

                                </xs:element>

                                </xs:sequence>

                                <xs:attribute name="orderid" type="xs:string" use="required"/>

                                </xs:complexType>

                            </xs:element>

</xs:schema>

Figure 3: Sample Join input 1 message

Sample schema for input XML message 2

<?xml version="1.0" encoding="UTF-8"?>

<xsd:schema targetNamespace="http://www.fiorano.com/fesb/activity/FileWriter1" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://www.fiorano.com/fesb/activity/FileWriter1">

                            <xsd:complexType name="Result">

                            <xsd:sequence>

                                <xsd:element ref="FileInfo" minOccurs="0"/>

                            </xsd:sequence>

                            </xsd:complexType>

                            <xsd:element name="Result" type="Result"/>

                            <xsd:element name="FileInfo">

                                <xsd:complexType>

                                <xsd:sequence>

                                    <xsd:element name="FullName" type="xsd:string"/>

                                    <xsd:element name="FileName" type="xsd:string"/>

                                    <xsd:element name="FilePath" type="xsd:string"/>

                                    <xsd:element name="Type" type="xsd:string"/>

                                    <xsd:element name="ReadAccess" type="xsd:string"/>

                                    <xsd:element name="WriteAccess" type="xsd:string"/>

                                    <xsd:element name="Size" type="xsd:integer"/>

                                </xsd:sequence>

                                </xsd:complexType>

                            </xsd:element>

</xsd:schema>

Figure 4: Sample Join input 2 message

Figure 5: Sample Join output message

Functional Demonstration

Scenario 1

Send two different messages for which mapping is configured in the Join component and displaying the response message.

Configure the Join as described in Configuration and Testing section and use feeder and display components to send sample input and check the response.

Figure 6: Demonstrating Scenario 1 with sample input and output

Sample Input

Input 1

<shiporder orderid="orderid">

   <orderperson>orderperson</orderperson>

   <shipto>

      <name>Fiorano</name>

      <address>address</address>

      <city>city</city>

      <country>country</country>

   </shipto>

   <item>

      <title>title</title>

      <note>note</note>

      <quantity>60</quantity>

      <price>-162</price>

   </item>

</shiporder>

Input 2

<ns1:FileInfo xmlns:ns1="http://www.fiorano.com/fesb/activity/FileWriter1">

   <FullName>Software</FullName>

   <FileName>FileName</FileName>

   <FilePath>FilePath</FilePath>

   <Type>Type</Type>

   <ReadAccess>ReadAccess</ReadAccess>

   <WriteAccess>WriteAccess</WriteAccess>

   <Size>-84</Size>

</ns1:FileInfo>

Sample Output

<?xml version="1.0" encoding="UTF-8"?>

<shiporder xmlns:ns2="http://www.fiorano.com/fesb/activity/FileWriter1" xmlns:ns1="http://www.w3.org/2001/XMLSchema">

  <shipto>

    <name>Fiorano Software</name>

  </shipto>

</shiporder>

Useful Tips

 


Copyright © 2008-2010, Fiorano Software Pte. Ltd. and affiliates.

All rights reserved.

This software is the confidential and proprietary information of Fiorano Software ("Confidential Information"). You shall not disclose such Confidential Information and shall use it only in accordance with the terms of the license agreement enclosed with this product or entered into with Fiorano.