Using Beans - 6.5

Talend Data Fabric Studio User Guide

EnrichVersion
6.5
EnrichProdName
Talend Data Fabric
task
Data Quality and Preparation
Design and Development
EnrichPlatform
Talend Studio

Talend Studio offers you the possibility to create Java Beans that can easily be called by the Mediation components in Routes. This way, you will be able to easily reuse libraries, components, applets, or other classes.

Beans are stored under the Code node in the Repository.

Note

You can also define beans in the Spring tab and use them in the Route. For more information about the Spring tab, see Using Spring configuration.

How to create a Bean

To create a new bean:

  1. In the Repository of the Integration perspective, expand the Code folder.

  2. Right-click the Beans node.

  3. Select Create Bean from the contextual menu.

    The [New Bean] wizard opens to help you define the main properties of the new Bean.

  4. Enter the Bean properties as the following:

    Field

    Description

    Name

    the name of the new Bean. A message comes up if you enter prohibited characters.

    Purpose

    the purpose of the Bean or any useful information regarding the Bean use.

    Description

    Bean description.

    Author

    a read-only field that shows by default the current user login.

    Locker

    a read-only field that shows by default the login of the user who owns the lock on the current Bean. This field is empty when you are creating a Bean and has data only when you are editing the properties of an existing Bean.

    Version

    a read-only field. You can manually increment the version using the M and m buttons. For more information, see Managing Job and Route versions.

    Status

    a list to select from the status of the Bean you are creating.

    Path

    a list to select from the folder in which the Bean will be created.

  5. Click Finish to create the Bean. An example bean opens in the editor on the design workspace.

  6. Type in the code of your Bean.

How to use a Bean

Once created, you can use the Beans in the Mediation components. To do so, go to the Component view of the relevant component to define its properties:

For some components (for example cBean, cDynamicRouter, etc.), you can directly call Beans:

  1. In the Beans class field of those components, type in beans.BEAN_NAME.class and the corresponding bean will be called.

  2. If the Bean called has more than one method, you can specify which method you want to call by selecting the Specify the method check box and typing its name in the field displaying.

For some components (for example cAggregate, cMulticast, etc.), you can call Beans as an aggregation strategy:

  1. Select the Use aggregation strategy check box.

  2. In the Strategy field, type in the name of the Bean without any prefix or extension.

For more information on how to create Routes, see Creating a Route .

For more information on the properties and usage of the Mediation components, see Talend ESB Mediation Components documentation in Talend Help Center.