Mailing List Archive

write a file in forrest via sitemap
Hello,
How can one use forrest (when running in say run), to write data into a
file?
thanks
Praveen
RE: write a file in forrest via sitemap [ In reply to ]
> -----Original Message-----
> From: Dr. Bhatia Praveen [mailto:praveen.bhatia@sumpurn.com]
> Sent: Monday, 2 March 2009 11:46 PM
> To: user@forrest.apache.org
> Subject: write a file in forrest via sitemap
>
> Hello,
> How can one use forrest (when running in say run), to write data into a
> file?
> thanks
> Praveen

Hi Praveen,

Can you elaborate, what is it you are trying to do exactly ?

Thanks

Gav...
Re: write a file in forrest via sitemap [ In reply to ]
2009/3/2 Dr. Bhatia Praveen <praveen.bhatia@sumpurn.com>:
> Hello,
>  How can one use forrest (when running in say run), to write data into a
> file?

It's hard to answer such a general question, as Gavin says can you
provide more details.

In the meantime you can look at the note taking pluging in the
whiteboard. This enables a dispatcher contract that allows the user to
add a note field to a forrest page. In particular you should be
looking at org.apache.cocoon.transformation.SourceWritingTransformer
(see cocoon docs):


For example in the above plugin see input.xmap:

<map:match pattern="noteTaking/do/addNote.xml">
<map:generate type="request"/>
<map:transform
src="{lm:noteTaking.transform.postedNotes.sourceWriterNotes}">
<map:parameter name="notesFile"
value="{properties:noteTaking.repository.URL}{properties:noteTaking.filename}"/>
</map:transform>
<map:transform type="write-source"/>
<map:transform
src="{lm:noteTaking.transform.writeResult.acknowledgement}">
<map:parameter name="use-request-parameters" value="true"/>
</map:transform>
<map:serialize type="xml-document"/>
</map:match>



--
--
Ross Gardler

OSS Watch - awareness and understanding of open source software
development and use in education
http://www.oss-watch.ac.uk
Re: write a file in forrest via sitemap [ In reply to ]
2009/3/3 Gavin <gavin@16degrees.com.au>:
>> -----Original Message-----
>> From: Dr. Bhatia Praveen [mailto:praveen.bhatia@sumpurn.com]
>> Sent: Monday, 2 March 2009 11:46 PM
>> To: user@forrest.apache.org
>> Subject: write a file in forrest via sitemap
>>
>> Hello,
>>    How can one use forrest (when running in say run), to write data into a
>> file?
>> thanks
>> Praveen
>
> Hi Praveen,
>
> Can you elaborate, what is it you are trying to do exactly ?

I would add a word of caution that this is not what Forrest is
designed to do. It is a publishing framework, not a content management
framework. For very simple and specific use cases it is possible to
make Forrest behave as a CMS framework (see my other reply). However,
if you find youself needing this I would encourage you to ask yourself
if you are using the right tool.

Forrest excels at translating formats. If you need to manage content
you should us a CMS and run Forrest as a service to tranlsate formats
for your CMS layer.

Ross
Re: write a file in forrest via sitemap [ In reply to ]
Hi Ross,Gavin
I will explain the need more clearly.
When transformations take place by the sitemap pipeline, lot of useful
information also gets generated in the process by transformations like xslt
transformations.
I would like to store these useful informations for record or later use
in another pipeline.
Hence, I would like to know how in a sequence of transformation pipeline
I could:
1) Open a file to write
2) Write "intermediate useful information" as some xml data into the file
3) close the file
4) continue with the transformation in the pipeline and display in html/pdf
as forrest does.

On a similar note:
In "forrest run" can we have a copy of the displayed xml/html as a file
by transformations (without using "forrest site")

The example given by Ross, perhaps can solve this type of need, but if it
is simplified I could try to experiment with it.
best wishes
Praveen


----- Original Message -----
From: "Ross Gardler" <rgardler@apache.org>
To: <user@forrest.apache.org>; "Dr. Bhatia Praveen"
<praveen.bhatia@sumpurn.com>
Sent: Tuesday, March 03, 2009 10:55 PM
Subject: Re: write a file in forrest via sitemap


2009/3/2 Dr. Bhatia Praveen <praveen.bhatia@sumpurn.com>:
> Hello,
> How can one use forrest (when running in say run), to write data into a
> file?

It's hard to answer such a general question, as Gavin says can you
provide more details.

In the meantime you can look at the note taking pluging in the
whiteboard. This enables a dispatcher contract that allows the user to
add a note field to a forrest page. In particular you should be
looking at org.apache.cocoon.transformation.SourceWritingTransformer
(see cocoon docs):


For example in the above plugin see input.xmap:

<map:match pattern="noteTaking/do/addNote.xml">
<map:generate type="request"/>
<map:transform
src="{lm:noteTaking.transform.postedNotes.sourceWriterNotes}">
<map:parameter name="notesFile"
value="{properties:noteTaking.repository.URL}{properties:noteTaking.filename}"/>
</map:transform>
<map:transform type="write-source"/>
<map:transform
src="{lm:noteTaking.transform.writeResult.acknowledgement}">
<map:parameter name="use-request-parameters" value="true"/>
</map:transform>
<map:serialize type="xml-document"/>
</map:match>



--
--
Ross Gardler

OSS Watch - awareness and understanding of open source software
development and use in education
http://www.oss-watch.ac.uk



--------------------------------------------------------------------------------



No virus found in this incoming message.
Checked by AVG - www.avg.com
Version: 8.0.233 / Virus Database: 270.11.5/1977 - Release Date: 02/18/09
20:55:00
Re: write a file in forrest via sitemap [ In reply to ]
2009/3/4 Dr. Bhatia Praveen <praveen.bhatia@sumpurn.com>:
>  The example given by Ross, perhaps can solve this type of need, but if it
> is simplified I could try to experiment with it.

It is hard to simplify it any further without knwoing what parts you
don't currently understand. What you want to do is pretty simple for
those of use who understand how Forrest pipelines work and how to
overrride those pipelines in a project sitemap. Unfortunately, you
have to climb that learning curve before it gets simple.

If you have no idea what the pipeline I posted into my earlier message
means then you need to start with developing a basic understanding of
how to customise Forrest [2].

Once you understand that you need to get to grips with the
SourceWritingTransformer. The full documentation for the transformer I
refer to is on the Cocoon website [1].

Finally you need to know how to override specifc transformations in
the Forrest sitemaps. However, your requirement above is quite general
and you need identify specific stages you want to write to disk before
we can give specific help.

BUT...

Many of the intermediate steps are allready available by requesting a
speific URL. For example, if you simply want a copy of the internal
intermediate format (XDoc) for all pages you can turn on the XML link
in skin-conf [3]:

<!-- The xml source link makes it possible to access the xml rendition
of the source frim the html page, and to have it generated statically.
This can be used to enable other sites and services to reuse the
xml format for their uses. Keep this disabled if you don't want other
sites to easily reuse your pages.-->
<disable-xml-link>false</disable-xml-link>

Now do "forrest run" and you have an xdoc representation of every file.

Ross


[1] http://cocoon.apache.org/2.0/userdocs/transformers/sourcewriting-transformer.html
[2] http://forrest.apache.org/docs_0_90/your-project.html#sitemap.xmap
[3] http://svn.apache.org/repos/asf/forrest/trunk/main/fresh-site/src/documentation/skinconf.xml

> Praveen
>
>
> ----- Original Message ----- From: "Ross Gardler" <rgardler@apache.org>
> To: <user@forrest.apache.org>; "Dr. Bhatia Praveen"
> <praveen.bhatia@sumpurn.com>
> Sent: Tuesday, March 03, 2009 10:55 PM
> Subject: Re: write a file in forrest via sitemap
> - Show quoted text -
>
>
> 2009/3/2 Dr. Bhatia Praveen <praveen.bhatia@sumpurn.com>:
>>
>> Hello,
>> How can one use forrest (when running in say run), to write data into a
>> file?
>
> It's hard to answer such a general question, as Gavin says can you
> provide more details.
>
> In the meantime you can look at the note taking pluging in the
> whiteboard. This enables a dispatcher contract that allows the user to
> add a note field to a forrest page. In particular you should be
> looking at org.apache.cocoon.transformation.SourceWritingTransformer
> (see cocoon docs):
>
>
> For example in the above plugin see input.xmap:
>
>     <map:match pattern="noteTaking/do/addNote.xml">
>       <map:generate type="request"/>
>       <map:transform
> src="{lm:noteTaking.transform.postedNotes.sourceWriterNotes}">
>         <map:parameter name="notesFile"
> value="{properties:noteTaking.repository.URL}{properties:noteTaking.filename}"/>
>       </map:transform>
>       <map:transform type="write-source"/>
>       <map:transform
> src="{lm:noteTaking.transform.writeResult.acknowledgement}">
>         <map:parameter name="use-request-parameters" value="true"/>
>       </map:transform>
>       <map:serialize type="xml-document"/>
>     </map:match>
>
>
>
> --
> --
> Ross Gardler
>
> OSS Watch - awareness and understanding of open source software
> development and use in education
> http://www.oss-watch.ac.uk
>
>
>
> --------------------------------------------------------------------------------
>
>
>
> No virus found in this incoming message.
> Checked by AVG - www.avg.com
> Version: 8.0.233 / Virus Database: 270.11.5/1977 - Release Date: 02/18/09
> 20:55:00
>
>



--
--
Ross Gardler

OSS Watch - awareness and understanding of open source software
development and use in education
http://www.oss-watch.ac.uk