You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Dev at weitling <de...@weitling.net> on 2006/10/10 17:49:55 UTC

Pipeline result in a flowscript?

Hi!

What's the best way to get the result of a pipeline for further
processing in a flowscript?
Something like

    String s = cocoonmagic.getPipelineResult("mypipe");

cocoon.processPipelineTo looks a little bit like overkill with its bean
and stream parameters.

Or: Effectively I just want to get one value from a JDBC connection.
Just one lonely integer...

Thx,
Florian

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: Pipeline result in a flowscript?

Posted by Joerg Heinicke <jo...@gmx.de>.
On 11.10.2006 09:41, Dev at weitling wrote:
> It seems we HAVE to break a fly on the wheel*.

That's why we recommended to use a Java class in the "service layer" 
instead of processing a pipeline. That would remove the pipeline 
processing overhead.

Jörg

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: Pipeline result in a flowscript?

Posted by Dev at weitling <de...@weitling.net>.
It seems we HAVE to break a fly on the wheel*. I solved it now this way
(good for a tiny amount of data):

    var baos = new Packages.java.io.ByteArrayOutputStream();
    cocoon.processPipelineTo("getMyTinyData",null,baos);
    form.getChild("id").setValue(baos.toString());

In the sitemap:

    <map:match pattern="getMyTinyData">
        <map:generate src="getMyTinyData.xml"/>
        <map:transform type="sql">
            <map:parameter name="use-connection" value="test"/>
        </map:transform>
        <map:serialize type="text"/>
    </map:match>

with getMyTinyData.xml containing the SQL query.

Big disadvantage of this solution: There's the risk of corrupting
non-Latin1-coded text ! Any ideas to that?

Ciao,
Florian

____
* In German it's "shooting with canons on sparrows". Poor sparrows...


Tony Edwards wrote:
> Two flowscript calls should do it:
>
>     var pipelineUtil =
> cocoon.createObject(Packages.org.apache.cocoon.components.flow.util.PipelineUtil);
>
>     var document = pipelineUtil.processToDOM("webHierarchyLink", null);
>
> First line sets up the magic, the second line gets the result of the
> "webHierarchyLink" matcher in the sitemap as a dom document which can
> be further processed etc.
>
> Hope this helps.
>
> Regards,
> Tony (Edwards)
>
> Joerg Heinicke wrote:
>> On 10.10.2006 17:49, Dev at weitling wrote:
>>
>>> What's the best way to get the result of a pipeline for further
>>> processing in a flowscript?
>>
>>> cocoon.processPipelineTo looks a little bit like overkill with its bean
>>> and stream parameters.
>>
>> There is a class called PipelineUtil. Sample code should also be
>> available "somewhere" (wiki etc.).
>>
>>> Or: Effectively I just want to get one value from a JDBC connection.
>>> Just one lonely integer...
>>
>> As Tony said (hey, Tony, you are back to Cocoon? :) ), put it in
>> a "service layer". If you do not have structured your application
>> into different layers you can just extract the code into a Java
>> class. You simply access any Java class in flowscript.
>>
>> At least using a different pipeline looks like complete overkill (not
>> only cocoon.processPipelineTo).
>>
>> Jörg
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
>> For additional commands, e-mail: users-help@cocoon.apache.org
>>
>>
>
> -- 
>
> This email is from Civica Pty Limited and it, together with any
> attachments, is confidential to the intended recipient(s) and the
> contents may be legally privileged or contain proprietary and private
> information. It is intended solely for the person to whom it is
> addressed. If you are not an intended recipient, you may not review,
> copy or distribute this email. If received in error, please notify the
> sender and delete the message from your system immediately. Any views
> or opinions expressed in this email and any files transmitted with it
> are those of the author only and may not necessarily reflect the views
> of Civica and do not create any legally binding rights or obligations
> whatsoever. Unless otherwise pre-agreed by exchange of hard copy
> documents signed by duly authorised representatives, contracts may not
> be concluded on behalf of Civica by email. Please note that neither
> Civica nor the sender accepts any responsibility for any viruses and
> it is your responsibility to scan the email and the attachments (if
> any). All email received and sent by Civica may be monitored to
> protect the business interests of Civica.
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: Pipeline result in a flowscript?

Posted by Tony Edwards <te...@civica.com.au>.
Two flowscript calls should do it:

	var pipelineUtil = cocoon.createObject(Packages.org.apache.cocoon.components.flow.util.PipelineUtil);
	var document = pipelineUtil.processToDOM("webHierarchyLink", null);

First line sets up the magic, the second line gets the result of the "webHierarchyLink" matcher in the sitemap as a dom 
document which can be further processed etc.

Hope this helps.

Regards,
Tony (Edwards)

Joerg Heinicke wrote:
> On 10.10.2006 17:49, Dev at weitling wrote:
> 
>> What's the best way to get the result of a pipeline for further
>> processing in a flowscript?
> 
>> cocoon.processPipelineTo looks a little bit like overkill with its bean
>> and stream parameters.
> 
> There is a class called PipelineUtil. Sample code should also be 
> available "somewhere" (wiki etc.).
> 
>> Or: Effectively I just want to get one value from a JDBC connection.
>> Just one lonely integer...
> 
> As Tony said (hey, Tony, you are back to Cocoon? :) ), put it in
> a "service layer". If you do not have structured your application into 
> different layers you can just extract the code into a Java class. You 
> simply access any Java class in flowscript.
> 
> At least using a different pipeline looks like complete overkill (not 
> only cocoon.processPipelineTo).
> 
> Jörg
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
> 
> 

--

This email is from Civica Pty Limited and it, together with 
any attachments, is confidential to the intended recipient(s) 
and the contents may be legally privileged or contain 
proprietary and private information. It is intended solely 
for the person to whom it is addressed. If you are not an 
intended recipient, you may not review, copy or distribute 
this email. If received in error, please notify the sender 
and delete the message from your system immediately. Any 
views or opinions expressed in this email and any files 
transmitted with it are those of the author only and may 
not necessarily reflect the views of Civica and do not create 
any legally binding rights or obligations whatsoever. Unless 
otherwise pre-agreed by exchange of hard copy documents 
signed by duly authorised representatives, contracts may not 
be concluded on behalf of Civica by email. Please note that 
neither Civica nor the sender accepts any responsibility for 
any viruses and it is your responsibility to scan the email 
and the attachments (if any). All email received and sent by 
Civica may be monitored to protect the business interests of 
Civica. 

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: Pipeline result in a flowscript?

Posted by Joerg Heinicke <jo...@gmx.de>.
On 10.10.2006 17:49, Dev at weitling wrote:

> What's the best way to get the result of a pipeline for further
> processing in a flowscript?

> cocoon.processPipelineTo looks a little bit like overkill with its bean
> and stream parameters.

There is a class called PipelineUtil. Sample code should also be 
available "somewhere" (wiki etc.).

> Or: Effectively I just want to get one value from a JDBC connection.
> Just one lonely integer...

As Tony said (hey, Tony, you are back to Cocoon? :) ), put it in
a "service layer". If you do not have structured your application into 
different layers you can just extract the code into a Java class. You 
simply access any Java class in flowscript.

At least using a different pipeline looks like complete overkill (not 
only cocoon.processPipelineTo).

Jörg

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: Pipeline result in a flowscript?

Posted by Dev at weitling <de...@weitling.net>.
Hi Tony,

thanks for the quick answer, but: Huh?!
Service layer API call?

Florian

Tony Collen wrote:
> Florian,
>
> Encapsulate the JDBC call in a service layer API call, and just call
> the service from flowscript.
>
> Tony
>
> On 10/10/06, Dev at weitling <de...@weitling.net> wrote:
>> Hi!
>>
>> What's the best way to get the result of a pipeline for further
>> processing in a flowscript?
>> Something like
>>
>>     String s = cocoonmagic.getPipelineResult("mypipe");
>>
>> cocoon.processPipelineTo looks a little bit like overkill with its bean
>> and stream parameters.
>>
>> Or: Effectively I just want to get one value from a JDBC connection.
>> Just one lonely integer...
>>
>> Thx,
>> Florian
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
>> For additional commands, e-mail: users-help@cocoon.apache.org
>>
>>
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: Pipeline result in a flowscript?

Posted by Tony Collen <tc...@gmail.com>.
Florian,

Encapsulate the JDBC call in a service layer API call, and just call
the service from flowscript.

Tony

On 10/10/06, Dev at weitling <de...@weitling.net> wrote:
> Hi!
>
> What's the best way to get the result of a pipeline for further
> processing in a flowscript?
> Something like
>
>     String s = cocoonmagic.getPipelineResult("mypipe");
>
> cocoon.processPipelineTo looks a little bit like overkill with its bean
> and stream parameters.
>
> Or: Effectively I just want to get one value from a JDBC connection.
> Just one lonely integer...
>
> Thx,
> Florian
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
>
>


-- 
Tony Collen
weblog: http://weblog.halogenlabs.com/

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org