Return-Path: Mailing-List: contact commons-user-help@jakarta.apache.org; run by ezmlm Delivered-To: mailing list commons-user@jakarta.apache.org Received: (qmail 78749 invoked from network); 28 Aug 2003 22:02:41 -0000 Received: from unknown (HELO smtp-out2.blueyonder.co.uk) (195.188.213.5) by daedalus.apache.org with SMTP; 28 Aug 2003 22:02:41 -0000 Received: from localhost ([82.38.66.131]) by smtp-out2.blueyonder.co.uk with Microsoft SMTPSVC(5.0.2195.5600); Thu, 28 Aug 2003 22:59:53 +0100 Date: Thu, 28 Aug 2003 23:01:53 +0100 Subject: Re: [betwixt] Use interface, if class if proxy Content-Type: text/plain; charset=US-ASCII; format=flowed Mime-Version: 1.0 (Apple Message framework v482) From: robert burrell donkin To: "Jakarta Commons Users List" Content-Transfer-Encoding: 7bit In-Reply-To: Message-Id: <3B985C24-D9A3-11D7-BB2B-003065DC754C@blueyonder.co.uk> X-Mailer: Apple Mail (2.482) X-OriginalArrivalTime: 28 Aug 2003 21:59:53.0610 (UTC) FILETIME=[B5F766A0:01C36DAF] X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N 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