Return-Path: Delivered-To: apmail-jakarta-avalon-dev-archive@apache.org Received: (qmail 5929 invoked from network); 19 Sep 2002 14:18:27 -0000 Received: from unknown (HELO nagoya.betaversion.org) (192.18.49.131) by daedalus.apache.org with SMTP; 19 Sep 2002 14:18:27 -0000 Received: (qmail 3943 invoked by uid 97); 19 Sep 2002 14:18:54 -0000 Delivered-To: qmlist-jakarta-archive-avalon-dev@jakarta.apache.org Received: (qmail 3800 invoked by uid 97); 19 Sep 2002 14:18:52 -0000 Mailing-List: contact avalon-dev-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Avalon Developers List" Reply-To: "Avalon Developers List" Delivered-To: mailing list avalon-dev@jakarta.apache.org Received: (qmail 3739 invoked by uid 98); 19 Sep 2002 14:18:52 -0000 X-Antivirus: nagoya (v4218 created Aug 14 2002) Message-ID: <3D89DE22.30908@apache.org> Date: Thu, 19 Sep 2002 10:24:34 -0400 From: Berin Loritsch User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.1) Gecko/20020826 X-Accept-Language: en-us, en MIME-Version: 1.0 To: "avalon-dev@jakarta.apache.org" Subject: [RT] Attributes (possibly the ravings of a mad man!) Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N As I was going through my pile of papers I printed out to review later (most of which I already did), I stumbled on the BCEL instructions. When they described the class file structure, a lightbulb went off in my head. At the end of every Class, is space for Class Attributes, including application specific attributes. The same thing for the end of every method for Method Attributes. Instead of embedding descriptors in XML files, we can combine the powers of BCEL and XDoclet to place all the relavant attributes directly in the Class file! We would first compile the classes the normal way, then apply the XDoclet/BCEL driven filter to add the attributes directly into the class file. The important thing is that we would have to override the defineClass(String name, byte[] b, int off, int len) method of the ClassLoader to make it work. We can offload that into a helper class like I did for JarScanner so that we get the following info: interface ClassDescriptor { boolean isAvalonClass(); // has attributes Class getClass(); // return the defined class Object getDescriptor(); // will return the Type or Service // descriptor } public final class AvalonClassUtil { public static ClassDescriptor defineClass( String name, byte[] b, int offset, int length ); } Or something like that. Using BCEL to add and read attributes will make our lives easier, although it is entirely possible to have something that will scan the class file without BCEL (to limit the number of runtime dependencies). As an additional benefit, we can use BCEL to get rid of all the NOP entries in the class files. :) So am I a mad man or a genious? (I tend to think I am tetering on the edge between the two) -- "They that give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety." - Benjamin Franklin -- To unsubscribe, e-mail: For additional commands, e-mail: