In this tutorial will see:
I've used Talend Integration Suite 2.3.3 with a Java project.
We are going to create a job to be exported later with the commandline. We can create a job containing only a tMessageBox. The job should not be complicated. We only want to test that the export with the commandline and that the manual import in the TIS client allows us to recover the same job.
The commandline is an application that is installed on the same computer than the webapplication in order to generate JAVA code from the XML files stored in the database repository. In fact, this application allows the user to access the same commands as the TIS Client using a command window interface. You can with the commandline:
The commandline's application can be started as:
I'll call <CommandlineDir> the directory containing the commandline program. I remind you that this directory is a copy of the directory of the TIS Studio directory. You can launch the commandline as a server executing the following files:
I'll define some variables:
If you want to launch the commandline as a shell application you can modify the commandline files like this:
If you want to launch the commandline as a standlone application and if you want to execute the command COMMAND, you can modify the commandline files like this:
Now you can learn by yourself how you can use the commandline. To do so, the very important commands to know are:
Launch these commands using the standalone commandline application to access to all the commands of the commandline.
We are now going to export and execute the job we have implemented below using the commandline. Create a file called for example CommandlineScript and put in it the following script:
initRemote http://localhost:8180/org.talend.administrator302
logonProject -pn svn_project -ul nfrancisco@talend.com -up Talend executeJob TouchfileNuno -i /usr/lib/jvm/java-6-sun-1.6.0.10/bin/java -jv 4.1 -jc Default
initRemote http://localhost:8080/org.talend.administrator302 logonProject -pn WORK -ul nfrancisco@talend.com -up Talend executeJob TouchFile -i /usr/lib/jvm/java-6-sun-1.6.0.06/bin/java -jv 0.1 -jc Default exportJob TouchFile -dd /home/nuno/Bureau -jv 0.1 -jc Default -af ExportTouchFile
We are going to explain each line of the file. We need to understand that each line of the file represents a command:
initRemote is a command used to connect to the webapplication.
logonProject is a command used to connect to connect a user to a project. Here are the explanation of the filters:
-pn: specifies the project name in which is the job we want to execute or manipulate -ul: specifies the talend user's login (the same used in the web application) -up: specifies the talend user's password (the same used in the web application)
executeJob is a command used to execute a specified job. TouchFile is the name of the job we want to execute. Here are the explanation of the filters:
-i: specifies the path to the java jvm -jv: specifies the job version of the job we want to execute -jc: specifies the context we want to use for the execution of the job
exportJob TouchFile -dd /home/nuno/Bureau -jv 0.1 -jc Default -af ExportTouchFile
exportJob is a command used to export a specified job. TouchFile is the name of the job we want to export. Here are the explanation of the filters:
-i: specifies the destination directory in which we want to export the job -jv and -jc: the same as below -af: specifies the of the file exported. In the code, the export file will be called ExportTouchFile.zip. It is not necessary to add the *.zip to the file extension here