avalon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Leo Simons <leosim...@apache.org>
Subject Re: [general][attributes][clazz][A5] metadata & the java world
Date Sat, 04 Jan 2003 00:22:46 GMT
Jakob Praher wrote:
<snip/>
> I have thought about custom meta data and .Net style attributes too. 
> how about a custom classloader and storing them as a custom java class
> file attribute.

eh? (scratches head, hits google)

> as the avalon framework controls the loading process (IoC) through the
> service/component manager this shouldn't be a problem.

(Avalon containers far from always have control of (or want to control) 
classloading, for example you might want to use 'em in a J2ME env, a 
servlet engine, or any other existing app with existing classloader 
infrastructure.)

> I imagine implementing it like this:
> 
> * every constant pool element in a java class file can have custom
> attributes
> 
> * custom attributes in a java class file are just raw data - so you can
> store an arbitrary serialized object as a custom attribute
> 
> http://java.sun.com/docs/books/vmspec/2nd-edition/html/ClassFile.doc.html#43817
> 
> attribute_info {    	
> 	u2 attribute_name_index;    	
> 	u4 attribute_length;    	
> 	u1 info[attribute_length];    
> }
> 
> * during class-loading, the class loader overloads the defineClass
> method and intercepts the class for custom attributes which are .Net
> like attributes.
> 
> * then it builds an attribute object model and associates with the
> loaded class and its code source.
> 
> just my 2 cent.
> 
> to inject the attributes you would need a kind of tacker component that
> tacks the attributes, based on a javadoc description onto a compiled
> class file.
> 
> this would be insofar interesting as attributes can be attached to any
> kind of constant pool item - fields and methods too can have custom
> attributes.

certainly sounds like it could work, and sounds terribly similar to the 
actual .Net setup (I know mostly zip about bytecode 'n stuff though). Is 
it neccessary to have control over the classloading in order to get 
access to the custom attributes? It seems to me that having this as a 
requirment could really limit its application.

The other thought that occured is that this might be a step further away 
from the well-known (and accepted) *BeanInfo setup, and hence more 
controversial.

Definately sounds as something worth exploring though (for one, it would 
probably be several dozen times faster than another route), even if I 
don't fully understand....

> With 
>>gmane setup, it is no longer neccessary to subscribe to 
>>yet-another-gazillion-messages-a-day list :D
>>
> sounds interesting, can you point me to more information about that 

gmane is a news<->email gateway, see http://www.gmane.org/.

cheers,

- Leo




--
To unsubscribe, e-mail:   <mailto:avalon-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:avalon-dev-help@jakarta.apache.org>


Mime
View raw message