geronimo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Hiram Chirino" <hi...@hiramchirino.com>
Subject Re: Dynamically registering a GBean
Date Wed, 22 Mar 2006 19:12:18 GMT
Awesome!  This could give me a kewl approach to exposing the ActiveMQ
objects in Geronimo..  Now if I could just have complex data  (like
say an xml fragment) injected into a gbean, then I would be so happy.

Then I could implement 1 coarse gbean the represents the activemq
broker with 1 configuration element that is the xbean xml
configuration.  The coarse gbean would start up activemq using xbean +
the xml fragment.  And then the broker would expose object to the
GBean kernel using dynamic registration similar to how it expose
object the JMX MBean server today.

What do you guys think?  Is that possible or do you think it's a bad idea?

On 3/22/06, Aaron Mulder <ammulder@alumni.princeton.edu> wrote:
> Yes, you can.  To add a GBean, fill out a GBeanData and then do
> something like this:
>
> Kernel kernel = ... (injected)
> ObjectName mine = (creator object name, normally injected)
> ObjectName oName = (new GBean object name)
> GBeanData data = ...
>
>         EditableConfigurationManager mgr =
> ConfigurationUtil.getEditableConfigurationManager(kernel);
>         if(mgr != null) {
>             try {
>                 ObjectName config = Util.getConfiguration(kernel, mine);
>
> mgr.addGBeanToConfiguration(Configuration.getConfigurationID(config),
> data, true);
>                 return (...)
> kernel.getProxyManager().createProxy(oName, SomeInterface.class);
>             } catch (InvalidConfigException e) {
>                 log.error("Should never happen", e);
>             } catch (URISyntaxException e) {
>                 log.error("Should never happen", e);
>             } finally {
>                 ConfigurationUtil.releaseConfigurationManager(kernel, mgr);
>             }
>         } else {
>             log.warn("The ConfigurationManager in the kernel does not
> allow changes at runtime");
>         }
>         return null;
>
> I haven't looked at removing recently, but I know it's possible.
>
> Thanks,
>     Aaron
>
> On 3/21/06, Hiram Chirino <hiram@hiramchirino.com> wrote:
> > Hi Dain,
> >
> > Is possible to dynamicaly register/unregister a GBean in the kernel?
> > Last time I checked, that was not really possible, but I'm hoping
> > things have changed since then?
> >
> > --
> > Regards,
> > Hiram
> >
>


--
Regards,
Hiram

Mime
View raw message