Expert Consultancy from Yellow Pelican

Component Analysis

A site about Talend

Talend Component Analysis

You're achingly close to building your first component; however, we'll first analyse an existing component. This will provide you with an overview of the component files.

As discussed in previous articles, component design is poorly documented and the purpose of many features and parameters are often based on a little bit of guess-work. Once you have established the basics and you're at the level of being able to create a useful component, you'll be ready for the remaining articles that attempt to provide an in-depth analysis of all of the features and parameters.

Analysis of the tJava Component Source Code

We'll now take a look at the source code of the tJava component. This is a powerful component; but has relatively simple source code, so it's a great starting point. The code shown here is from Talend Open Studio 5.5.0. You may see variations with other product versions.

Minimum File Set

As previously discussed, there is a minimum set of files that make up a component's source code. These files were summarised in the Minimum File Set table shown in the Design Introduction article.


This file is described as the XML configuration file for JAVA Component. It is the starting point for creating a component and is where you specify connectors, inputs, outputs and numerous other parameters. This is an XML file that may be edited using the Component Designer, a text editor, or an XML editor of your choice.

For full documentation on all of the available elements and attributes, as defined by the file Component.xsd, read the Component.xsd Reference.

XML Version and Encoding

You would usually expect the first line of an XML file to specify the XML version and the encoding. The source code for tJava (as with most of the standard components) does not have this line. When you create a new component using Component Designer, the line shown below will be added. Although it would appear that this line is not mandatory, it would seem sensible to add it to all of your own components.

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

Elements and Attributes

In this section, we will analyse the interesting elements and attributes that are specified in this file. You may find it helpful to read the Component.xsd Reference which provides an in-depth analysis of all of the elements and attibutes that are available.

The following shows the entire code the the tJava component, as supplied with Talend Open Studio version 5.5.0. We will look at CONNECTORS, PARAMETER and ADVANCED_PARAMETERS. If you are not familiar with the other elments and attributes, read the Component.xsd Reference.



                <CONNECTOR CTYPE="FLOW" MAX_INPUT="1" MAX_OUTPUT="1"/>
                <CONNECTOR CTYPE="SUBJOB_OK" MAX_INPUT="1" />
                <CONNECTOR CTYPE="RUN_IF"/>
                <PARAMETER NAME="CODE"
                           <DEFAULT>String foo = "bar";</DEFAULT>
                <PARAMETER NAME="IMPORT"

                           <DEFAULT>//import java.util.List;</DEFAULT>





The tJava component supports 7 of the most commonly used connectors (as defined by the attribute CTYPE). These connectors are FLOW, ITERATE, SUBJOB_OK, SUBJOB_ERROR, COMPONENT_OK, COMPONENT_ERROR, RUN_IF. You will find all of these described in the Component.xsd Reference. The most interesting part of these connectors are the settings for MAX_INPUT and MAX_OUTPUT, as these help to describes how the component interacts with the other components in your Job (MIN_INPUT and MIN_OUTPUT are also available).

If these are not specified with a value, then there is no limit to the number of connections of this type, that may be made with the other components within your job.


The tJava component has a single basic parameter, and a single advanced parameter. The significant difference between the placement of these parameters (basic or advanced), is the Component Settings tab that they will appear on, within the Job Designer (either Basic settings or Advanced settings). for more information on parameters, refer to the Component.xsd Reference.


The CODE parameter is a Java-styled memo field (MEMO_JAVA), that will specify the Java code that should be executed. This is provided with a DEFAULT value of String foo = "bar";. When the component is used, the Job Designer will replace this line with their own code. Talend provides styled memo fields, to provide features such as syntax-highlighting and auto-completion, if available.


The IMPORT parameter is am import-styled MEMO field, that will specify any Java libraries that are required by the code was specified by the Job Designer for the CODE parameter. This is provided with a DEFAULT value of import java.util.List;. When nthe component is used, the Job Designer will replace this commented line with their own imports, as required by their custom code. This parameter is placed on Advanced settings as it is used less frequently that the CODE parameter.


The CODEGENERATION parameter is not implemented by the tJava component. It should be included in all component definitions, even when it has not been implemented. This element will be discussed in a future article; however, for further information on this and other elements and attributes, please read the Component.xsd Reference.


The RETURNS parameter is not implemented by the tJava component. It should be included in all component definitions, even when it has not been implemented. This element will be discussed in a future article; however, for further information on this and other elements and attributes, please read the Component.xsd Reference.

This is the default Java Property File and provides language specific support for attributes such as Field Labels, for the tJava component. There are a number of other Java Property Files, for example, that provide support for different languages; however, is the only mandatory Java Property File.

This file provides textural information for the component, including field labels for the parameters.

The following shows the content of this file for the tJava component. The attributes of this file are in no particular order; however, I would encourage you to group and order these, to make this file more readable.

#Created by JInto -
#Mon Feb 25 13:37:58 CST 2008
LONG_NAME=Allows to enter manually the start Java-code part of a component


The first two lines of the file provide comments, indicating the creator of the file and when it was created.


LONG_NAME specifies the description for your component and is ths shown when the mose hovers over the component, when displayed in the Component Palette.

Parameter Labels

The values CODE.NAME and IMPORT.NAME provide labels for the two parameters that are defined in the file tJava_java.xml.


A simple but important file is the icon that will represent your component within Talend Studio. This is a 32x32 pixel image file in the PNG format. In the case of the component tJava component, this file is named tJava_icon32.png. Without an icon file, you will not be able to push your own components to the Component Palette.


As discussed in other articles, each component requires between one and three JET template files. In the case of the tJava component, there is a single begin file named tJava_begin.javajet. The other files are main and end.

The following code shows the JET template for this component.

<%@ jet

        CodeGeneratorArgument codeGenArgument = (CodeGeneratorArgument) argument;
        INode node = (INode)codeGenArgument.getArgument();

<%=ElementParameterParser.getValue(node, "__CODE__") %>

As can be seen from the code, this is pretty simple stuff. We'll discuss the majority of this code in a later article and it is standard code that you should find in all components. The important part, for our analysis of tJava is the line <%=ElementParameterParser.getValue(node, "__CODE__") %>. This is a directive to JET, to emmit the code that was entered in the PARAMETER that is named NAME="CODE", as described in the section CODE, shown above.

Expert Consultancy from Yellow Pelican
comments powered by Disqus