On Wednesday, August 27, 2003, at 10:07 PM, Christoph Gaffga wrote:


I've implemented a way to customize the serialization of EJBs through
dot-betwixt-files.

My solution looks up the dot-betwixt-file if the class to serialize is a
Proxy. I only changed some lines in XMLIntrospector.findByXMLDescriptor.

protected synchronized XMLBeanInfo findByXMLDescriptor( Class aClass ) {
Class showClass = aClass;


// If the class is a Proxy, use the interface
if ( Proxy.isProxyClass(aClass) && aClass.getInterfaces().length >
0 ) {
showClass = aClass.getInterfaces()[0];
}


        // trim the package name
        String name = showClass.getName();
        int idx = name.lastIndexOf( '.' );
        if ( idx >= 0 ) {
            name = name.substring( idx + 1 );
        }
        name += ".betwixt";

        URL url = showClass.getResource( name ); // Use showClass
classloader

This works fine.

I have two questions left:

- How/Where can I change behavior to use the interface-Description instead
of the classes one if no dot-betwixt-file ist found?

one way to approach this problem would be by creating a registry which would allow an interface class to be substituted for any class implementing it. this has the advantage of being generic (it allows any implementation of an interface to be serialized in the same form which may be an advantage to some users).


this should be pretty easy so i might even take a look at it myself (if no one beats me to it).

- Is there any chance to integrate my mechanism into betwixt? Is there
anybody else also interested in such a behavior?

i (for one) am quite intrigued by these ideas but i don't have a direct use. i believe that there's a certain level of demand amongst the cocoon community (it's just a pity that betwixt isn't finished yet. too little time :(


if you are interested in contributing to betwixt then there are a few things to keep in mind:

1. please read the guidelines (this saves everybody's energy)
2. please make sure you're patching CVS HEAD. betwixt has undergone extensive refactoring since the last release.
3. please don't lose enthusiasm if it takes a while for the patch to get committed. i've got a ton of code laying around on my machine (a lot of it from patches) which i really need to get polished off and committed but i'
m trying to be careful about the design and get it right (this time).


- robert


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



Reply via email to