August 17, 2023

tLibraryLoad – Docs for ESB 5.x

tLibraryLoad

tLibraryLoad_icon32_white.png

tLibraryLoad properties

Component Family

Custom Code

 

Function

tLibraryLoad allows you to import
a library.

Purpose

tLibraryLoad allows you to load
useable Java libraries in a Job.

Basic settings

Library

Select the library you want to import from the list, or click on
the […] button to browse to the
library in your directory.

Advanced settings

Dynamic Libs

Lib Paths: Enter the access path
to your library, between double quotation marks.

 

Import

Enter the Java code required to import, if required, the external
library used in the code editing field of the Basic settings tab of the components such as
tJava, tJavaFlex or tJavaMR in a Map/Reduce Job.

Global Variables

ERROR_MESSAGE: the error message generated by the
component when an error occurs. This is an After variable and it returns a string. This
variable functions only if the Die on error check box is
cleared, if the component has this check box.

A Flow variable functions during the execution of a component while an After variable
functions after the execution of the component.

To fill up a field or expression with a variable, press Ctrl +
Space
to access the variable list and choose the variable to use from it.

For further information about variables, see Talend Studio
User Guide.

Usage

This component may be used alone, although it is more logical to
use it as part of a Job.

Warning

The library is loaded locally.

Usage in Map/Reduce Jobs

If you have subscribed to one of the Talend solutions with Big Data, you can also
use this component as a Map/Reduce component. In a Talend Map/Reduce Job, this
component is used standalone. It generates native Map/Reduce code that can be executed
directly in Hadoop.

You need to use the Hadoop Configuration tab in the
Run view to define the connection to a given Hadoop
distribution for the whole Job.

This connection is effective on a per-Job basis.

For further information about a Talend Map/Reduce Job, see the sections
describing how to create, convert and configure a Talend Map/Reduce Job of the
Talend Big Data Getting Started Guide.

Note that in this documentation, unless otherwise explicitly stated, a scenario presents
only Standard Jobs, that is to say traditional Talend data
integration Jobs, and non Map/Reduce Jobs.

Log4j

The activity of this component can be logged using the log4j feature. For more information on this feature, see Talend Studio User
Guide
.

For more information on the log4j logging levels, see the Apache documentation at http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/Level.html.

Limitation

n/a

Scenario: Checking the format of an e-mail addressl

This scenario uses two components, a tLibraryLoad and
a tJava. The goal of this scenario is to check the
format of an e-mail address and verify whether the format is valid or not.

Use_Case_tLibraryLoad1.png

Setting up the Job

  1. In the Palette, open the Custom_Code folder, and slide a tLibraryLoad and tJava
    component onto the workspace.

  2. Connect tLibraryLoad to tJava using a Trigger > OnSubjobOk
    link.

Configuring the tLibraryLoad component

  1. Double-click on tLibraryLoad to display
    its Basic settings. From the Library list, select
    jakarta-oro-2.0.8.jar.

  2. In the Import field of the Advanced settings tab, type import
    org.apache.oro.text.regex.*;

    Use_Case_tLibraryLoad2.png

Configuring the tJava component

  1. Double-click on tJava to display its
    Component view.

  2. In the Basic settings tab, enter your
    code, as in the screenshot below. The code allows you to check whether the
    character string pertains to an e-mail address, based on the regular
    expression: "^[\w_.-]+@[\w_.-]+\.[\w]+$".

    Use_Case_tLibraryLoad3.png

Job execution

Press F6 to save and run the Job.

Use_Case_tLibraryLoad4.png

The Console displays the boolean
false. Hence, the e-mail address is not valid as the format
is incorrect.


Document get from Talend https://help.talend.com
Thank you for watching.
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x