You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Antonio Gallardo <ag...@agsoftware.dnsalias.com> on 2003/11/14 03:17:24 UTC

[Woody] Datatypes revisited

Hi:

I found another problem with binding:

Woody current support is for java.util.Date
OJB support is for java.sql.Date:

http://db.apache.org/ojb/jdbc-types.html

Problem here is we cannot make "direct" binding because of a cast class
expception if we try to insert using OJB an Object java.util.Date (woody
defined type).

On the other hand if I set the type of the bean to java.sql.Date then the
woody binding framework reject to work.

So this is a dilema. I thought about a convertor between java.sql.Date and
java.util.Date. For binding

What else can we do?

Best Regards,

Antonio Gallardo

Re: [Woody] Datatypes revisited

Posted by Sylvain Wallez <sy...@apache.org>.
Bruno Dumon wrote:

<snip/>

>>I had a deeper look at JXPath, and this doesn't seem to be so easy, as 
>>JXPath doesn't provide us a way to know the type of the data that has to 
>>be set.
>>
>>Furthermore, JXPath relies on an internal type conversion mechanism in 
>>TypeUtils, which can be extended with a TypeConverter. But this 
>>TypeUtils accepts only one TypeConverter, which is stored in a static 
>>variable !!
>>    
>>
>
>Hmm, maybe best to fix that in JXPath. I think ideally we should be able
>to provide a custom TypeConvertor on each setValue call.
>  
>

Good idea! This would allows us to have full control on the conversion 
process, and shouldn't be too much difficult to plug into JXPath.

Sylvain



-- 
Sylvain Wallez                                  Anyware Technologies
http://www.apache.org/~sylvain           http://www.anyware-tech.com
{ XML, Java, Cocoon, OpenSource }*{ Training, Consulting, Projects }
Orixo, the opensource XML business alliance  -  http://www.orixo.com



Re: [Woody] Datatypes revisited

Posted by Bruno Dumon <br...@outerthought.org>.
On Fri, 2003-11-14 at 17:03, Sylvain Wallez wrote:
> Antonio Gallardo wrote:
> 
> >Bruno Dumon dijo:
> >  
> >
> >>The convertors in Woody are for translating between string and object
> >>representations.
> >>
> >>It has been proposed before to add some casting methods to the
> >>datatypes, for example:
> >>http://marc.theaimsgroup.com/?l=xml-cocoon-dev&m=106776875918689&w=2
> >>    
> >>
> >
> >Thanks Bruno for your answer.
> >
> >I saw the mail yesterday. Thanks for the link. Now, I am willing to do
> >that, but need your help.
> >
> >The receipt of this:
> >
> >1- As Sylvain suggested I will add 2 new methods to the Datatype interface.
> >2-Add this methods in o.a.c.woody.binding.ValueJXPathBinding
> >  
> >
> 
> I had a deeper look at JXPath, and this doesn't seem to be so easy, as 
> JXPath doesn't provide us a way to know the type of the data that has to 
> be set.
> 
> Furthermore, JXPath relies on an internal type conversion mechanism in 
> TypeUtils, which can be extended with a TypeConverter. But this 
> TypeUtils accepts only one TypeConverter, which is stored in a static 
> variable !!

Hmm, maybe best to fix that in JXPath. I think ideally we should be able
to provide a custom TypeConvertor on each setValue call.

-- 
Bruno Dumon                             http://outerthought.org/
Outerthought - Open Source, Java & XML Competence Support Center
bruno@outerthought.org                          bruno@apache.org


Re: [Woody] Datatypes revisited

Posted by Sylvain Wallez <sy...@apache.org>.
Antonio Gallardo wrote:

>Bruno Dumon dijo:
>  
>
>>The convertors in Woody are for translating between string and object
>>representations.
>>
>>It has been proposed before to add some casting methods to the
>>datatypes, for example:
>>http://marc.theaimsgroup.com/?l=xml-cocoon-dev&m=106776875918689&w=2
>>    
>>
>
>Thanks Bruno for your answer.
>
>I saw the mail yesterday. Thanks for the link. Now, I am willing to do
>that, but need your help.
>
>The receipt of this:
>
>1- As Sylvain suggested I will add 2 new methods to the Datatype interface.
>2-Add this methods in o.a.c.woody.binding.ValueJXPathBinding
>  
>

I had a deeper look at JXPath, and this doesn't seem to be so easy, as 
JXPath doesn't provide us a way to know the type of the data that has to 
be set.

Furthermore, JXPath relies on an internal type conversion mechanism in 
TypeUtils, which can be extended with a TypeConverter. But this 
TypeUtils accepts only one TypeConverter, which is stored in a static 
variable !!

Sylvain

-- 
Sylvain Wallez                                  Anyware Technologies
http://www.apache.org/~sylvain           http://www.anyware-tech.com
{ XML, Java, Cocoon, OpenSource }*{ Training, Consulting, Projects }
Orixo, the opensource XML business alliance  -  http://www.orixo.com



Re: [Woody] Datatypes revisited

Posted by Antonio Gallardo <ag...@agsoftware.dnsalias.com>.
Bruno Dumon dijo:
> The convertors in Woody are for translating between string and object
> representations.
>
> It has been proposed before to add some casting methods to the
> datatypes, for example:
> http://marc.theaimsgroup.com/?l=xml-cocoon-dev&m=106776875918689&w=2

Thanks Bruno for your answer.

I saw the mail yesterday. Thanks for the link. Now, I am willing to do
that, but need your help.

The receipt of this:

1- As Sylvain suggested I will add 2 new methods to the Datatype interface.
2-Add this methods in o.a.c.woody.binding.ValueJXPathBinding

Is this correct?

Best Regards,

Antonio Gallardo


Re: [Woody] Datatypes revisited

Posted by Bruno Dumon <br...@outerthought.org>.
On Fri, 2003-11-14 at 03:17, Antonio Gallardo wrote:
> Hi:
> 
> I found another problem with binding:
> 
> Woody current support is for java.util.Date
> OJB support is for java.sql.Date:
> 
> http://db.apache.org/ojb/jdbc-types.html
> 
> Problem here is we cannot make "direct" binding because of a cast class
> expception if we try to insert using OJB an Object java.util.Date (woody
> defined type).
> 
> On the other hand if I set the type of the bean to java.sql.Date then the
> woody binding framework reject to work.
> 
> So this is a dilema. I thought about a convertor between java.sql.Date and
> java.util.Date. For binding

The convertors in Woody are for translating between string and object
representations.

It has been proposed before to add some casting methods to the
datatypes, for example:
http://marc.theaimsgroup.com/?l=xml-cocoon-dev&m=106776875918689&w=2

-- 
Bruno Dumon                             http://outerthought.org/
Outerthought - Open Source, Java & XML Competence Support Center
bruno@outerthought.org                          bruno@apache.org


RE: [Woody] Datatypes revisited

Posted by Antonio Gallardo <ag...@agsoftware.dnsalias.com>.
Reinhard Poetz dijo:
> Antonio,
>
> AFAIK OJB supports converters, doesn't it?

Yep. I already solved this. Thanks for the tip. BTW, Druid is updated too.

Best Regards,

Antonio Gallardo