You are not logged in.
Announcement
Unanswered posts
|
Pages: 1
hi,
I've to keep trace of some informations during job running.
Until now I was made out.println to test the output string infos.
(also test a log file to write any data infos )
Now we're tying to get back those infos via context.
We choice context because we have access on each of them from our "bean j2ee framework".(more efficient than read the log file each time)
So in a tjavaflex I create new context type Object and name buffer.
and add code :
String sBuffer = new StringBuffer()
sBuffer.append("some data infos');
context.buffer = sBuffer;read string in the same tJavaflex :
System.out.println(context.buffer.toString()); // some data infos
But it's a sub-job , so try to pass object buffer context to his parent with tBufferOut .
but cannot retrieve values in the parent job; stay null !
first it's possible to use context like that ?(use type objetct for stringBuffer value) ... seems working
Is it a ggod way to use context like that ?
thanks for your help and suggestion
Offline

Hi,
it is not possible to return a context value back from the subjob. I would suggest to use a public static variable in a function to do this. But this not a good design decision...
If I understand you right you tried to do the following:
mainJob: tRunJob (with context) - - - - - - - - - - - ->tContextLoad
| ^
`´ |
subJob: do your job -> tFixedFlowInput -> tBufferOut
I didn't test it, but think it would work....
Bye
Volker
Offline
hi Volker,
I've tried several 'solution' to manage context variable ...
I thought that StringBuffer could be a solution , but I think i lost the advantage of it .(like a String, but can be modified) ..
from sub and father job , instances 're copied!
I'm trying now with a context group var but still work with object and have problem with cast ...
I spent "a lot of" time with manage context an perhaps I don't use them in a right way.
the goal of my "work" is to keep a single context var during all job, subjob , parent job and cousin
...
Still thinking that the best way in this case is wrinting in a flat file and read it at the end ...
....
++
Offline

Hi,
so you are searching for an overall solution? What about a custom static class which could be used in all your jobs? But the information will be stored in the JVM session. After starting a new one the information will be lost.
Bye
Volker
Offline
hi,
What about a custom static class which could be used in all your jobs?
.. looks great !
But the information will be stored in the JVM session. After starting a new one the information will be lost.
never mind ... user have to know some data during excecution (control data) ! until now standard output (system out) was sufficient , but with an web interface I have to "redirect" those data in a html format , and just for the session !
Can you give me more explanation about how to this class "workaround" ?
thanks ![]()
laurent
Offline

Hi laurent,
go to Repository -> Code -> Routines and create a new one.
Now you could write a java class to store a value: The value and any method should be defined as static. So you could access them from every point where you know the classname.
Bye
Volker
Offline
.....
so simple ...!
I have to read again definition about static in java . ![]()
thanks a lot Volker ;
++
Last edited by kzone (2009-03-13 12:52:32)
Offline
Pages: 1