Java processor with multiple inputs and outputs.

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Java processor with multiple inputs and outputs.

ncrofts
Any thoughts on the following issue would be much appreciated:

I'm writing a Java Processor that takes two inputs and generates two outputs. I need to perform all the processing of the inputs before I can generate the outputs. The reason for this is the outputs are dependent on the sequence that the inputs are processed.

Unless I've misunderstood the processing model, it doesn't seem quite right to be dependent on the order that the outputs are generated, so I was trying to find a way to call my input processing routine prior to the generateXXXX methods being called.
 
I read in section 6.3 of the Processor API documentation that the reset() method could be used to perform such pre-processing tasks and then use the setState() method to make an object containing any common state data available to the respective generateXXXX() methods. I took this to mean that the reset() method would be called before any of the generateXXXX methods. Therefore I thought I would be able to process the inputs in the reset method, store the results via the state mechanism and then just pull out the right data for each output when the relevant generateXXXX method was called.
 
However I tried implementing the reset method in my processor class, but it didn't get called at the outset, instead the first generateXXXX method was called. Actually, I'm not certain under which circumstances the reset() method does get called or if I am trying to use it for its intended purpose.
 
Does anyone have experience of doing this sort of task, or is there another preferred way of doing what I am trying to achieve?

Thanks,
Neil Crofts



--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Java processor with multiple inputs and outputs.

Alessandro  Vernet
Administrator
Hi Neil,

This is a fairly frequent case, and you can look at the code of the
TeeProcessor for inspiration. The TeeProcessor does not extend the
SimpleProcessor class, so it does not have getFoo() methods. The code
you will have in your getFoo() methods is the one which is in the
implementation of readImpl() in the TeeProcessor.

Let us know if there is anything in that code which is not clear.

Alex

On 3/7/06, Neil Crofts <[hidden email]> wrote:

>
> Any thoughts on the following issue would be much appreciated:
>
>
> I'm writing a Java Processor that takes two inputs and generates two
> outputs. I need to perform all the processing of the inputs before I can
> generate the outputs. The reason for this is the outputs are dependent on
> the sequence that the inputs are processed.
>
> Unless I've misunderstood the processing model, it doesn't seem quite right
> to be dependent on the order that the outputs are generated, so I was trying
> to find a way to call my input processing routine prior to the generateXXXX
> methods being called.
>
>
> I read in section 6.3 of the Processor API documentation that the reset()
> method could be used to perform such pre-processing tasks and then use the
> setState() method to make an object containing any common state data
> available to the respective generateXXXX() methods. I took this to mean that
> the reset() method would be called before any of the generateXXXX methods.
> Therefore I thought I would be able to process the inputs in the reset
> method, store the results via the state mechanism and then just pull out the
> right data for each output when the relevant generateXXXX method was called.
>
>
> However I tried implementing the reset method in my processor class, but it
> didn't get called at the outset, instead the first generateXXXX method was
> called. Actually, I'm not certain under which circumstances the reset()
> method does get called or if I am trying to use it for its intended purpose.
>
>
> Does anyone have experience of doing this sort of task, or is there another
> preferred way of doing what I am trying to achieve?
>
> Thanks,
> Neil Crofts
>
>
>
> --
> You receive this message as a subscriber of the [hidden email]
> mailing list.
> To unsubscribe: mailto:[hidden email]
> For general help: mailto:[hidden email]?subject=help
> ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
>
>
>

--
Blog (XML, Web apps, Open Source):
http://www.orbeon.com/blog/



--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet