You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Leszek Gawron <ou...@kompuart.pl> on 2002/11/26 17:55:55 UTC

Something really stupid

Let's say I have a Win32 executable file that generates xml file somewhere on
the local disk. Now I would like to serialize contents of that file to the
cocoon user, which I wanted to perform like this:

<map:match pattern="test">
    <map:act type="serverpages" src="scratchpad/file-create.xsp">
        <map:generate src="scratchpad/{filename}"/>
        <map:act type="serverpages" src="scratchpad/file-delete.xsp">
            <map:serialize/>
        </map:act>
    </map:act>
</map:match>

This all means:
1. perform file-create action calling Runtime.getRuntime().exec(). This
generates a file somewhere (let's assume I know the file name - I pass the
name as the exec parameter )
2. I generate the web content from the file that was generated 
3. I delete the file
4. I serialize the content 

What happens? Cocoon reports that the file no loner exists so it gets deleted
before the content get generated. Why is that ? I tried to move the
file-delete action after serialization but there nothing happens - the file
still remains on disk.  

I know that this is a crazy idea but that is the only way to have an access to
another application so there is nothing I can change.

__The only thing I need to know is how to delete a file right after its
cotents have been sent to the client.__`

	ouzo
-- 
            __
         | /  \ |        Leszek Gawron            //  \\
        \_\\  //_/      ouzo@vip.net.pl          _\\()//_
         .'/()\'.     Phone: +48(600)341118     / //  \\ \
          \\  //  recursive: adj; see recursive  | \__/ |


---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

To unsubscribe, e-mail:     <co...@xml.apache.org>
For additional commands, e-mail:   <co...@xml.apache.org>


RE: Something really stupid

Posted by ouzo <ou...@vip.net.pl>.
> From: Ilya A. Kriveshko [mailto:ilya@kaon.com]
> Sent: Tuesday, November 26, 2002 6:09 PM
> To: cocoon-users@xml.apache.org
> Subject: Re: Something really stupid
> 
> Actions are performed WHEN the pipeline is assembled. The generation
and
> serialization happens AFTER the pipeline is assembled. So, by the time
> your generator starts reading the file, both actions have already
fired
> and the file came and went.
> 
> Why not have your win32 process output a file to stdout and then
create
> a custom generator that executes it and parses its output into SAX
> events? Might be a nice reusable component that will useful for legacy
> systems integration...
I know this is not really a cocoon question but what is the best way to
capture this executables input stream and generate SAX events (I mean
use Avalon/Cocoon philosophy) ?
	ouzo
-- 
            __
         | /  \ |        Leszek Gawron            //  \\
        \_\\  //_/      ouzo@vip.net.pl          _\\()//_
         .'/()\'.     Phone: +48(600)341118     / //  \\ \
          \\  //  recursive: adj; see recursive  | \__/ | 



---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

To unsubscribe, e-mail:     <co...@xml.apache.org>
For additional commands, e-mail:   <co...@xml.apache.org>


Re: Something really stupid

Posted by "Ilya A. Kriveshko" <il...@kaon.com>.
Actions are performed WHEN the pipeline is assembled. The generation and 
serialization happens AFTER the pipeline is assembled. So, by the time 
your generator starts reading the file, both actions have already fired 
and the file came and went.

Why not have your win32 process output a file to stdout and then create 
a custom generator that executes it and parses its output into SAX 
events? Might be a nice reusable component that will useful for legacy 
systems integration...

+2c
--
Ilya

Leszek Gawron wrote:

>Let's say I have a Win32 executable file that generates xml file somewhere on
>the local disk. Now I would like to serialize contents of that file to the
>cocoon user, which I wanted to perform like this:
>
><map:match pattern="test">
>    <map:act type="serverpages" src="scratchpad/file-create.xsp">
>        <map:generate src="scratchpad/{filename}"/>
>        <map:act type="serverpages" src="scratchpad/file-delete.xsp">
>            <map:serialize/>
>        </map:act>
>    </map:act>
></map:match>
>
>This all means:
>1. perform file-create action calling Runtime.getRuntime().exec(). This
>generates a file somewhere (let's assume I know the file name - I pass the
>name as the exec parameter )
>2. I generate the web content from the file that was generated 
>3. I delete the file
>4. I serialize the content 
>
>What happens? Cocoon reports that the file no loner exists so it gets deleted
>before the content get generated. Why is that ? I tried to move the
>file-delete action after serialization but there nothing happens - the file
>still remains on disk.  
>
>I know that this is a crazy idea but that is the only way to have an access to
>another application so there is nothing I can change.
>
>__The only thing I need to know is how to delete a file right after its
>cotents have been sent to the client.__`
>
>	ouzo
>  
>



---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

To unsubscribe, e-mail:     <co...@xml.apache.org>
For additional commands, e-mail:   <co...@xml.apache.org>


Re: Something really stupid

Posted by Leszek Gawron <ou...@kompuart.pl>.
On Tue, Nov 26, 2002 at 07:15:30PM -0800, Steven Punte wrote:
> 
> A "cleaner" bridge, if possible, would be to have your existing application
> output it's contents over HTTP as either just text or preferrable XML.  If
> XML, then just a pipelien with the XML Generator and you got it all: no
> temporary files, etc..   If the output is a more primitive text format, then
> just write a custom XSP to digest it and begin your pipeline.

Yes that is nice but the problem is the application is not mine .. so if I
wanted to use it over HTTP I would have to write an apache module or kind of
simple HTTP server that runs the executable and sends applications output in
HTTP response
	ouzo
-- 
            __
         | /  \ |        Leszek Gawron            //  \\
        \_\\  //_/      ouzo@vip.net.pl          _\\()//_
         .'/()\'.     Phone: +48(600)341118     / //  \\ \
          \\  //  recursive: adj; see recursive  | \__/ |


---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

To unsubscribe, e-mail:     <co...@xml.apache.org>
For additional commands, e-mail:   <co...@xml.apache.org>


Re: Something really stupid

Posted by Steven Punte <st...@yahoo.com>.
A "cleaner" bridge, if possible, would be to have your existing application output it's contents over HTTP as either just text or preferrable XML.  If XML, then just a pipelien with the XML Generator and you got it all: no temporary files, etc..   If the output is a more primitive text format, then just write a custom XSP to digest it and begin your pipeline.

Steve Punte

Candlelight Software

 



---------------------------------
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now