geronimo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Jencks <david_jen...@yahoo.com>
Subject Re: reference to ServerInfo from inside a j2ee app?
Date Wed, 10 Aug 2005 21:59:32 GMT

On Aug 10, 2005, at 2:44 PM, toby cabot wrote:

> Hi Folks,
>
> I'm working on getting web authentication to work, and it's mostly
> there thanks to whoever wrote the "demo" application.  Thanks for
> that, I learned a lot from looking at it.
>
> Now I'd like to start the various gbeans in geronimo-application.xml
> instead of relying on the ones in the org/apache/geronimo/Secure plan.
> It mostly works, but the problem is getting a reference to ServerInfo.
> If I crib from the demo app, like so:
>
>     <gbean name="hello-realm"  
> class="org.apache.geronimo.security.realm.GenericSecurityRealm">
>         <attribute name="realmName">hello-realm</attribute>
>         <reference name="LoginModuleConfiguration">
>             <name>hello-login-chain</name>
>         </reference>
>         <reference name="ServerInfo">
>             <module>org/apache/geronimo/System</module>
>             <name>ServerInfo</name>
>         </reference>
>     </gbean>
>
> I get this in the log:
>
> 17:03:49,034 DEBUG main  
> [org.apache.geronimo.gbean.runtime.GBeanSingleReference] Waiting to  
> start  
> geronimo.server: 
> J2EEApplication=hello,J2EEModule=null,J2EEServer=geronimo,j2eeType=Secu 
> rityRealm,name=hello-realm because no targets are running for  
> reference ServerInfo matching the patternspatterns  
> geronimo.server:J2EEApplication=hello,J2EEModule=org/apache/geronimo/ 
> System,J2EEServer=geronimo,j2eeType=GBean,name=ServerInfo
>
> ... and the hello-realm gbean is stuck in the starting state.  Note
> that it's looking for ServerInfo with "J2EEApplication=hello" (which
> is the name of my application) whereas the real ServerInfo has
> "J2EEApplication=null".  I also tried swapping the module and name
> elements with:
>
> <gbean-name>geronimo.server:J2EEApplication=null,J2EEModule=org/ 
> apache/geronimo/ 
> System,J2EEServer=geronimo,j2eeType=GBean,name=ServerInfo</gbean-name>
>
> ... then it works, but this seems much more brittle to me than using
> the module and the name.  It works in the module/name case if I deploy
> the gbean descriptors in a standalone descriptor file rather than in
> the ear.
>
> I'm wondering if in the module/name case Geronimo should try the
> current application first, and if that fails try J2EEApplication=null.
> If that sounds like a good idea I'd be willing to take a stab at it if
> someone could point me to roughly the code that's doing the
> translation from module/name to gbean name.

I'd like to think a bit more about whether this is appropriate before I  
agree.  You can include an <application>null</application> element to  
specify the app.  One reason I hesitate to say "great idea" is that  
currently we are explicitly constructing a gbean name from what you  
supply + the context of the configuration (which is where the  
application name you see comes from).  Your suggestion would require  
querying the deployment context and kernel for an existing gbean of  
that name.  This would mean you'd have to install gbeandatas for every  
gbean in a configuration during the install phase rather than the  
addGBeans phase and it would impede constructing references between  
modules when one module is not deployed yet.

I guess we could query in the current configuration/DeploymentContext  
and then construct a gbean with application name "null"  This would  
require only rewriting all the deployers to register gbeandatas during  
the install phase and changing the service builder to do queries on the  
current deployment context.  I'm still not sure this is a good idea.

BTW, the "secure" configuration should really be part of the demo app,  
in its plan :-)  Would you be interested in patching up moving it  
there?

thanks
david jencks

>
> Thanks,
> Toby
>


Mime
View raw message