geronimo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Jencks <>
Subject Re: Can GBean get its configuration ClassLoader?
Date Fri, 19 Nov 2004 07:04:13 GMT

On Nov 18, 2004, at 9:54 PM, Srinath Perera wrote:

> Just two quick question,
> 1) is there anyway one can add/register magic attributes form code or
> plan? (Just for INFO have not find for use case for it yet :) )
no, unless you rewrite the GBeanMBean class.  There's a fairly wide 
variety, and a request to add a reference to ServerInfo as a magic 
attribute.  If you need another, discuss it: adding one is a moderately 
large architectural decision.
> 2) Does GBean constrcters support injecting magic attributes only?
You can inject any persistent attribute, magic attribute, or reference 
(collection).  Most gbeans now use constructor dependency injection 
only, and the ones that don't are being converted as their classes are 
worked on.

I think the normal ordering convention is to put regular persistent 
attributes first, then references (and reference collections), then 
magic attributes.

Attributes start with lower case letters, References with upper case.

note that magic attributes are NOT persistent, whereas regular 
attributes in the constructor must be persistent.

david jencks

> Thanks
> Srinath
> On Thu, 18 Nov 2004 13:54:28 -0500 (EST), Aaron Mulder
> <> wrote:
>>         Right, you helped me out with this in person a few days ago...
>> Thanks.  BTW, as a note for anyone else who's interested, GBeanMBean 
>> has a
>> section at the bottom defining all the available magic attributes, and
>> there are a lot of them.  Dain pointed me to that, too.  :)
>> Aaron
>> On Thu, 18 Nov 2004, Dain Sundstrom wrote:
>>> You simply declare an attribute of type ClassLoader, named
>>> "classLoader", which is not persistent, and the framework will
>>> automatically inject the correct class loader.
>>> -dain
>>> --
>>> Dain Sundstrom
>>> Chief Architect
>>> Gluecode Software
>>> 310.536.8355, ext. 26
>>> On Nov 18, 2004, at 7:49 AM, Alan D. Cabrera wrote:
>>>>> -----Original Message-----
>>>>> From: Aaron Mulder []
>>>>> Sent: Sunday, November 14, 2004 10:56 PM
>>>>> To:
>>>>> Subject: Can GBean get its configuration ClassLoader?
>>>>>    I wonder if there's a way for a GBean to get the ClassLoader for
>>>>> the configuration it's a part of -- in other words, the
>>>>> GBeanMBean.getClassLoader(), which includes the dependencies in the
>>>>> deployment plan, etc.
>>>>>    I want the SQLSecurityRealm to be able to load a driver class.
>>>>> However, the SQLSecurityRealm itself was loaded in the Server
>>>>> configuration, and the JDBC driver is included as a dependency of 
>>>>> the
>>>>> service deployment plan that declares the realm (but gets the
>>>>> SQLSecurityRealm class from its parent).  So the SQLSecurityRealm
>>>> can't
>>>>> see the driver classes in a child of it's own CL, and the
>>>>> ThreadContextClassLoader does not appear to be set to something 
>>>>> useful
>>>>> when doStart is called on the GBean.
>>>>>    I basically want to be able to call some static method to get
>>>> the
>>>>> GBeanMBean for the current GBean implementation class, becasue 
>>>>> then I
>>>>> could get the ClassLoader from it.  But any other suggestions 
>>>>> would be
>>>>> appreciated too.  :)
>>>> Why not declare the driver in the same plan as the SQLSecurityRealm 
>>>> and
>>>> use the magic attribute classLoader?
>>>> Regards,
>>>> Alan

View raw message