On Thu, Mar 12, 2009 at 12:39 AM, David Blevins <[email protected]>wrote:

>
> On Mar 11, 2009, at 7:43 PM, Karan Malhi wrote:
>
>
>>> Definitely.  We went with the new class over the InitialContext as it
>>> gives
>>> us the ability to add methods and functionality in future specs.  Always
>>> a
>>> nice door to leave open.
>>>
>>>  EJBContainer container = EJBContainer.createEJBContainer(p);
>>>>
>>>>>
>>>>>
>>>>  Would love to see some more methods in EJBContainer like
>>
>> public Object inject(Class clazz){
>>  // creates a new instance of the clazz and injects dependencies in it and
>> returns the object
>> }
>> public void inject(Object obj){
>>  // inject dependencies into obj
>> }
>>
>> The above would make it easy to add injection support to other frameworks
>> like struts, jsf etc.
>>
>
> You and me both.

Wanted to mention that we discussed the above methods on IRC. Wanted to
share them with the dev list

>  There was talk of general functionality like that at the JSR-316 (EE 6)
> level and as a result there was moratorium on identical functionality in the
> other specs.  The talks stalled and nothing was ever flushed out.  Now it's
> too late.
>

> Regardless, that won't stop us from implementing it :)  I suspect if we do
> it and other vendors follow suit, it'll pretty much have to make it into the
> spec next time around.

Nice! .  Is this on the top of your priority list? I have an area in struts2
integration which could use this funcionality.

>
>
>  Would also be nice to have a method which returns the current instance of
>> the  EJBContainer.
>>
>
> We had something like that and it got messy quick.  The questions it raises
> are



> 1) what happens if it is called before createEJBContainer and no instance
> has yet been created; do you create one automatically, return null, or throw
> an exception,

return null

> 2) what happens if it is called after the EJBContainer has been closed
>
return null

> 3) if more than one EJBContainer is active and the most recently created
> one is closed, do you return the current closed container, the most recent
> open container, null, or throw an exception.
>
This is tricky.Does that mean that per JVM there could be multiple
EJBContainer's?  If thats the case then this method could throw an
exception.

>
> I personally never liked it as 'public static EJBContainer ejbContainer' in
> your own code is extremely simple and doesn't require people to learn
> anything, reduces the amount of new things they have to deal with, and
> there's zero chance for misinterpreting the spec.

Agree, we could always write our own utility for that. So ignore the
responses to 1,2,3 above :)


>
> -David
>
>


-- 
Karan Singh Malhi

Reply via email to