• Index
  •  » Talend Open Studio for Data Integration » Usage, Operation
  •  » Pass filename to tFileInputDelimited from java

#1 2008-06-04 15:13:37

mortena
New member
Registered: 2008-04-07
Posts: 5

Pass filename to tFileInputDelimited from java

Tags: [context, file, java]

I call a Job from java, that must open a .csv file and do something with the content...

I need to be able to configure the name and path of the file to read.

How do I do that?

I would prefer to be able to set a parameter in a .properties file or to call runJob(...) from java with the filename as a parameter.

Regards

Morten

Offline

#2 2008-06-04 17:39:14

Theo
Member
Registered: 2008-03-26
Posts: 71

Re: Pass filename to tFileInputDelimited from java

You can use context variables for nearly every setting. This contexts and their variables can be accessed and changed in a ContextName.properties file in your exported job.

To set and use context variables, just press F5 in a Talend settings field or set them directly via contexts tab in the lower part of the Talend window.


Regards
Theo

Offline

#3 2008-06-06 12:02:55

mortena
New member
Registered: 2008-04-07
Posts: 5

Re: Pass filename to tFileInputDelimited from java

Thanks, that clarified quite a bit.

Now I can create the context variable and use it from Talend.
I can export the job script to a zip file containing libraries, the job in a .jar file.

Now I want to be able to change the properties, in the job, that is started from an existing application. This means that I need to be able to edit the properties file and use that.

The .properties file is a part of the .jar file, so editing that and using the .jar file afterwards would require that i unzip the jar, edit it and jar it again.

I would like to be able to control it from java, like setting the context by passing the context to the runJob method:

runJob("--context=Production");

and refer to a Production.properties file somewhere in the classpath.

Where should I put the Production.properties file if the described way of using the job works?

Offline

#4 2008-06-10 00:53:40

mhirt
Talend team
Registered: 2006-09-19
Posts: 1641

Re: Pass filename to tFileInputDelimited from java

.properties file have to be stored in the classpath of YOUR java classes at runtime.

HTH,

Offline

  • Index
  •  » Talend Open Studio for Data Integration » Usage, Operation
  •  » Pass filename to tFileInputDelimited from java

Board footer

Powered by FluxBB