Four Stars

extracting context parameters for specific tasks programmatically

Hi all,


I wonder if there's some way to access the task-specific context parameters defined in Job Conductor, for auditing reasons.


Apparently, the values are stored encrypted in the TAC DB, and I couldn't figure out how to decrypt them. Also, direct access to the TAC DB might not be available. However, those parameters are accessible in a non-encrypted manner from the GUI, so I should be able to somehow access them programmatically. Unfortunately, the metaServlet JSON API doesn't provide an action to get those parameters, I can only set them using createTask or updateTask.


So, any suggestions?


Re: extracting context parameters for specific tasks programmatically


Thanks for posting your issue here.

We have redirected your issue to our TAC experts and will keep you posted.

Best regards


Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.

Re: extracting context parameters for specific tasks programmatically



now we have no metaservlet operation to do this call. I think we can extend listTasks operation for this. Please create TMC new feature in Talend jira.




Four Stars

Re: extracting context parameters for specific tasks programmatically

OK, will do so, thanks.

Any other workarounds? Like, is there a way to e.g. export the tasks in some parseable form?
One Star

Re: extracting context parameters for specific tasks programmatically

If you have access to the database behind tac then you can use the following Java code to decrypt the values.

The column that holds the actual values:



The Java Code:

String paramString = context.prompt;

// This was working with 5.4 and 5.6 I had to decrypt the org.talend.utils package, and under that there was this security.AES.class  which contains this code

byte[] KeyValues = { -87, -101, -56, 50, 86, 53, -29, 3 };
Cipher ecipher;
Cipher dcipher;

String str = System.getProperty("");
boolean bool = false;
if (str != null) {
	bool = str.contains("SunOS");
Provider localProvider = null;
if (bool) {
 localProvider = Security.getProvider("SunJCE");

KeyGenerator localKeyGenerator = null;
SecureRandom localSecureRandom = null;
if (bool) {
	localKeyGenerator = KeyGenerator.getInstance("AES", localProvider);
} else {
	localKeyGenerator = KeyGenerator.getInstance("AES");
localSecureRandom = SecureRandom.getInstance("SHA1PRNG");
localKeyGenerator.init(128, localSecureRandom);
SecretKey localSecretKey = localKeyGenerator.generateKey();
if (bool) {
	ecipher = Cipher.getInstance("AES", localProvider);
    dcipher = Cipher.getInstance("AES", localProvider);
} else {
	ecipher = Cipher.getInstance("AES");
    dcipher = Cipher.getInstance("AES");
ecipher.init(1, localSecretKey);
dcipher.init(2, localSecretKey);
//This is where we have the magic happening:
byte[] arrayOfByte = Base64.decodeBase64(paramString.getBytes("UTF8"));
arrayOfByte = dcipher.doFinal(arrayOfByte);
String retStr = new String(arrayOfByte, "UTF8");

I also needed a library to make this work (commons-codec-1.7)