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.
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.
To create a new bean:
In the Repository of the Integration perspective, expand the Code folder.
Right-click the Beans node.
Select Create Bean from the contextual menu.
The [New Bean] wizard opens to help you define the main properties of the new Bean.
Enter the Bean properties as the following:
the name of the new Bean. A message comes up if you enter prohibited characters.
the purpose of the Bean or any useful information regarding the Bean use.
a read-only field that shows by default the current user login.
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.
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.
a list to select from the status of the Bean you are creating.
a list to select from the folder in which the Bean will be created.
Click Finish to create the Bean. An example bean opens in the editor on the design workspace.
Type in the code of your 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:
In the Beans class field of those components, type in beans.BEAN_NAME.class and the corresponding bean will be called.
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:
Select the Use aggregation strategy check box.
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.