CFORM XML bind only works with file resource. Cocoon 2.19

2006-09-19 Thread Manuel Ottaviano




Hello cocoon world.
I'm using the 2.19 version of Cocoon. I'm developing some CFROM using
the example included in the framework.
I'm using the example "samples/blocks/forms/form2simpleXML.flow"  
as starting point.
The example works fine with a binding file , but if I substitute the
file with a cocoon resource as follow:



  

    

    

       
      
  

    

       

  

  

    



Cocoon generates an error : 
org.mozilla._javascript_.EvaluatorException:
"resource://org/apache/cocoon/forms/flow/_javascript_/Form.js", line 285:
The choice of Java method
org.apache.cocoon.components.source.SourceUtil.toSAX matching
_javascript_ argument types
(org.apache.cocoon.components.source.impl.SitemapSource,org.apache.cocoon.forms.util.XMLAdapter)
is ambiguous; candidate methods are: void
toSAX(org.apache.excalibur.source.Source,org.xml.sax.ContentHandler),
void
toSAX(org.apache.excalibur.xml.sax.XMLizable,org.xml.sax.ContentHandler)

Looking in the web I've found the same  bug of the current
development version of Cocoon. The article is below:

http://issues.apache.org/jira/browse/COCOON-1906


I've patched my verson of cocoon but it does not solve the
problem.
Why??
thanks 4 the attention
manuel ottaviano










RE: Free for use: SaveFilesTransformer

2006-09-19 Thread Geert Josten
> Can I ask why we need a simplified SourceWritingTransformer?

Ofcourse you can: you just did.. :-)

No, I don't think a simplified one is needed, but it is the second use
case that is most interesting.

Perhaps I should have said that it is *another*
SourceWritingTransformer.. :-P

Kind regards,
Geert
   
 
Drs. G.P.H. Josten
Consultant
 
 

Daidalos BV
Source of Innovation
Hoekeindsehof 1-4
2665  JZ  Bleiswijk
Tel.: +31 (0) 10 850 1200
Fax: +31 (0) 10 850 1199
www.daidalos.nl
KvK 27164984


De informatie - verzonden in of met dit emailbericht - is afkomstig van 
Daidalos BV en is uitsluitend bestemd voor de geadresseerde. Indien u dit 
bericht onbedoeld hebt ontvangen, verzoeken wij u het te verwijderen. Aan dit 
bericht kunnen geen rechten worden ontleend.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: cocoon serializer

2006-09-19 Thread Geert Josten
Hi Zsombor, 

> > [Geert]
> > Besides, it is a pity that the serializer you created has such a 
> > limited use case, while mine can be used in many situations. And I 
> > always found transformers much more powerfull than serializers.
> 
> [Zsombor]
> But how can you use the FPO fo2pdf serializer in a 
> transormer? It's my only problem.
> Untill now i only use transformers to create xml from other 
> xml generated by the generator.
> So how can i create a pdf document or a jpeg image with a transformer?

Well.. That is the real magic of my transformer.. ;-)

No, it is actually not that complex. The sourcewritingtransformer and
first use case for my savefilestransformer takes an xml fragment. But
you need a stream to be able to write to a file. That is provided by a
serializer (specified by the serializer attribute of the element that
wrapped the fragment and) that is instantiated *inside* the
transformer.. :-)

During the parsing of the fragment, the events are passed to the
serializer that writes to the output stream that I provided to it. At
the end of the fragment, the serializer is disconnected and events
continue their path through Cocoon.

The second use case of my transformer interrupts the events to open a
new input source which takes any url type that Cocoon can process, gets
the input stream from the source and simply copies the input stream to
the output stream. Because this does not involve a serializer, it can
also handle binary streams.. :-)

> > [Geert]
> > Have you noted my remark about making internal calls? 
> > Something to keep in mind when using your serializer.
> >
> > > When calling pipes internally, serializers are 
> circumvented and that
> is most likely not what you want.
> 
> [Zsombor]
> What kind of internal calls do you think? What is an internal 
> call of the pipe?

Internal calls use the cocoon protocol, eg:

cocoon:/other-match-in-same-sitemap

Or

cocoon://path-from-root/match-in-other-sitemap

If you have a pipeline that generates PDF with the fo2pdf serializer and
call it from another through a generate using the cocoon protocol, the
generater simply bypasses or replaces the serializer of the PDF
generating pipeline! That is also the reason why using a reader on a
cocoon pipeline (intentionally) does not work (though generating the
result of a reader does work, or was it the other way around? I am
always getting confused about it).. :-P

Kind regards,
Geert
   
 
Drs. G.P.H. Josten
Consultant
 
 

Daidalos BV
Source of Innovation
Hoekeindsehof 1-4
2665  JZ  Bleiswijk
Tel.: +31 (0) 10 850 1200
Fax: +31 (0) 10 850 1199
www.daidalos.nl
KvK 27164984


De informatie - verzonden in of met dit emailbericht - is afkomstig van 
Daidalos BV en is uitsluitend bestemd voor de geadresseerde. Indien u dit 
bericht onbedoeld hebt ontvangen, verzoeken wij u het te verwijderen. Aan dit 
bericht kunnen geen rechten worden ontleend.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



FW: cocoon serializer

2006-09-19 Thread Geert Josten
Might be interesting for other users..

(read below) 

> 
   
 
Drs. G.P.H. Josten
Consultant
 
 

Daidalos BV
Source of Innovation
Hoekeindsehof 1-4
2665  JZ  Bleiswijk
Tel.: +31 (0) 10 850 1200
Fax: +31 (0) 10 850 1199
www.daidalos.nl
KvK 27164984


De informatie - verzonden in of met dit emailbericht - is afkomstig van 
Daidalos BV en is uitsluitend bestemd voor de geadresseerde. Indien u dit 
bericht onbedoeld hebt ontvangen, verzoeken wij u het te verwijderen. Aan dit 
bericht kunnen geen rechten worden ontleend.
 

> Van: Geert Josten 
> Verzonden: dinsdag 19 september 2006 11:12
> Aan: 'Varga, Zsombor'
> Onderwerp: RE: cocoon serializer
> 
> > > Anyhow, I might have an answer for you. I have tried adapting the 
> > > SourceWritingTransformer to act as a Serializer, but 
> encountered the 
> > > same problem as you. As far as I recall you cannot parametrize a 
> > > serializer after it is created and initialized. (Please 
> correct me 
> > > if I am wrong, anyone!)
> > i found an other solution here:
> > http://comments.gmane.org/gmane.text.xml.cocoon.user/53269. 
> And it is 
> > works!!!
> > 
> > I only implemented the SitemapModelComponent interface. i 
> have to add 
> > some more methods to my serializer (but Eclipse did it 
> instead of me).
> > And in the setup() method i got Parameters, and objectModel 
> which is a 
> > Map. With Parameters you can get the SiteMap parameters, 
> and with the 
> > objectModel yo can access to the Request object, wher you can get 
> > anything [Request oRequest = 
> > ObjectModelHelper.getRequest(objectModel)]
> > 
> > It's really working!
> 
> Cheers for getting it to work! :-)
> 
> Yes, I recognize the thread. But I was still using older 
> version of Cocoon, so I couldn't use the suggestion they made. :-P
> 
> Besides, it is a pity that the serializer you created has 
> such a limited use case, while mine can be used in many 
> situations. And I always found transformers much more 
> powerfull than serializers. I believe there are components 
> that reuse code for both transformers and serializers, 
> however; cannot mention one though.
> 
> Have you noted my remark about making internal calls? 
> Something to keep in mind when using your serializer.
> 
> Kind regards,
> Geert

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: cocoon serializer

2006-09-19 Thread Geert Josten
Dear Zsombor,

I advice to register yourself on the cocoon users mailing list. That way
you will not depend on my availability and access many others with
experience simultaniously. I included the list in the CC. (I think you
need to register to be allowed to submit messages to it.)

Anyhow, I might have an answer for you. I have tried adapting the
SourceWritingTransformer to act as a Serializer, but encountered the
same problem as you. As far as I recall you cannot parametrize a
serializer after it is created and initialized. (Please correct me if I
am wrong, anyone!) Moreover, the way serializers work is quite a lot
more difficult than Transformers. When calling pipes internally,
serializers are circumvented and that is most likely not what you want.
It was certainly not what I wanted! :-P

Instead, I wrote a simple Transformer to do the job of saving to a file.
It happens to be that I published it on the Cocoon wiki just this
morning. :-) You can find it at:

http://wiki.apache.org/cocoon/SaveFilesTransformer

That page also explains how to use it.

Kind regards,
Geert

> 
   
 
Drs. G.P.H. Josten
Consultant
 
 

Daidalos BV
Source of Innovation
Hoekeindsehof 1-4
2665  JZ  Bleiswijk
Tel.: +31 (0) 10 850 1200
Fax: +31 (0) 10 850 1199
www.daidalos.nl
KvK 27164984


De informatie - verzonden in of met dit emailbericht - is afkomstig van 
Daidalos BV en is uitsluitend bestemd voor de geadresseerde. Indien u dit 
bericht onbedoeld hebt ontvangen, verzoeken wij u het te verwijderen. Aan dit 
bericht kunnen geen rechten worden ontleend.
 

> Van: Varga, Zsombor [mailto:[EMAIL PROTECTED] 
> Verzonden: dinsdag 19 september 2006 9:32
> Aan: Geert Josten
> Onderwerp: cocoon serializer
> 
> Dear Geert!
> 
> I have a problem with Cocoon serializers. I read an article 
> from you at http://article.gmane.org/, where you give advise 
> to a person whose problem like to mine.
> 
> I am generating pdf documents with xsl-fo. Our Cocoon version 
> is 2.1.9 .
> Here is the part of the sitemap:
> 
> 
> 
>
>type="fo2pdf"/> 
> 
> The pdf serializer is the standard, which comes with the 
> cocoon source.
> Everything works i get the correct pdf, at my browser. But i 
> have to save the generated pdf automatically.
> 
> I tried to write a new serializer, wich also writes to a 
> file, but i can't control the serializer where to write, 
> neither the name of the file. For this i should pass some 
> paramter to this new serializer, which come from request or 
> from the sitemap. And how i get theese parameters in the serializer?
> 
> Can you help me solving this problem, or can you advise me 
> another solution?
> 
> Thanks for your help!
> 
> Zsombor
>

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Exception in cocoon

2006-09-19 Thread Tomas Garijo


Hi!

I try to implement a custom error-hadle in cocoon.

We make this class es.clickonline.Exception.efacturaException with this 
code.


public class efacturaException extends Exception

{ 

private int errorCode;

public efacturaException(int errorCode, String message) {
super(message);
this.errorCode = errorCode;
}

public efacturaException(int errorCode) {
this.errorCode = errorCode;
}

public void setErrorCode(int errorCode) {
this.errorCode = errorCode;
}

public int getErrorCode() {
return this.errorCode;
}

}


How you see this class its very easy, extends of exception, in my 
application I do implement the pattern View-Model-Controller, my exceptios it´s 
generate in the class controller,  
but the error-hadle it´s in the View.

Code controller.

EfacturaDetailInvoiceResponseDocument docDetailInvoiceResponse;
docDetailInvoiceResponse = 
EfacturaDetailInvoiceResponseDocument.Factory.newInstance();
EfacturaDetailInvoiceResponse  EfacturaDetailInvoiceResponse;


if (session.isNew()) 
{


try {
throw new 
efacturaException(1,"validation");
} catch (efacturaException e) {
// TODO Auto-generated catch 
block
e.printStackTrace();
}

}
else
{
//Instancia a la clase driverDatabase Patron DAO
dDatabase = new driverDatabase (); 
dDatabase.putsUser("XX");
dDatabase.putsPwd("");

try 
{   


this controller its calling from distpacher and dispatcher it´s calling 
from custom tranform.

My problem it´s that I sure that the exception calling it´s not to 
branch off error-hadle.

This is my sitemap.





http://apache.org/cocoon/sitemap/1.0";>





  
  
  








false
false
false
xalan
true

   



 
 

 

 

 
  







 










 



 



 



 
  
   
 
 



 
  
   

 
  













 

Re: Free for use: SaveFilesTransformer

2006-09-19 Thread Leszek Gawron

Geert Josten wrote:

Hi all,

Available on wiki:

http://wiki.apache.org/cocoon/SaveFilesTransformer

It might be that someone else already wrote a Transformer like this one.
It is derived from the SourceWritingTransformer (yet simplified) and has
one important benefit over it: it can take a src attribute that can be
used to capture also binary streams and save them to disk.

Comments are welcome..

Can I ask why we need a simplified SourceWritingTransformer?

--
Leszek Gawron, IT Manager  MobileBox sp. z o.o.
+48 (61) 855 06 67  http://www.mobilebox.pl
mobile: +48 (501) 720 812   fax: +48 (61) 853 29 65

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]