First steps to use the commandline application

In this tutorial will see:

  • the different ways to launch the commandline
  • how to access to the help in order to know which command is available
  • we will use a concrete example to export an existing job in the database repository to a local directory

I've used Talend Integration Suite 2.3.3 with a Java project.

First glimpse

Create a simple job to export later

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.

:doc:firststepscommandline_tmessageboxjob.png

Presentation of the commandline's application

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:

  • export/import metadatas
  • launch jobs stored in the database repository
  • export/import metadatas
  • create projects
  • change the status/version of the jobs
  • and moreā€¦

The commandline's application can be started as:

  • a server: the application is waiting for commands to execute on a remote machine.
  • a shell: a window command allows the user to execute several sequential commands
  • a standalone application: the commandline can execute one command. It is very interesting for example to store on a file a list of commands and launch these commands with the standalone application.

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:

  • commandline.sh if you are using an operating system based on a linux kernel
  • commandline.bat if you are using a windows operating system

I'll define some variables:

  • <CommandLineLinux>= ./TISEE-linux-gtk-x86 -nosplash -application org.talend.commandline.CommandLine -consoleLog -data commandline-workspace
  • <CommandLineWindows>= TISEE-win32-x86.exe -nosplash -application org.talend.commandline.CommandLine -consoleLog -data commandline-workspace

If you want to launch the commandline as a shell application you can modify the commandline files like this:

  • <CommandLineLinux> shell if you are using a linux' s kernel OS
  • <CommandLineWindows> shell if you are using a windows OS

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:

  • <CommandLineLinux> COMMAND if you are using a linux' s kernel OS
  • <CommandLineWindows> COMMAND if you are using a windows OS

Now you can learn by yourself how you can use the commandline. To do so, the very important commands to know are:

  • help
  • helpFilter

Launch these commands using the standalone commandline application to access to all the commands of the commandline.

Use case

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:

  • The first line creates a connection to the webapplication
  • The second line logs the TIS user to the project here called WORK
  • The third line executes the job we created called TouchFile
  • The fourth line exports the same job

first line

initRemote is a command used to connect to the webapplication.

second line

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)

third line

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

fourth line

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

 
doc/first_steps_with_commandline.txt · Last modified: 2011/12/17 03:52 (external edit)
 
 
Recent changes RSS feed Driven by DokuWiki