So I'm still struggling with the issue of how to figure out which
network connectors go with which network containers. This is a general
problem that applies to Tomcat & Jetty (web connectors to web container),
OpenEJB, ActiveMQ, etc. Obviously in typical cases you'd only have one
container of any given type running, but it seems like we'd like to
support multiple.
The key problem is caused by:
1) I need to be able to do this for connectors or containers that are
loaded but not running (or stopped)
2) The kernel does not let you invoke operations or get non-persistent
attributes of a GBean that is not running
3) Group GBean references do not include non-running GBeans that would
otherwise be included (if you stop a GBean it's removed from the
reference collection)
So, put all this together, and anything that's stopped is
effectively invisible. One way to make it work is to put the relationship
into the ObjectName and query based on ObjectName. For example,
"...,type=webconnector,webcontainer=MyJettyContainer,...". However, this
doesn't work if there are multiple containers with the same name
(presumably, in different Configurations).
That being the case, as far as I can tell there's only one
alternative. That is to use a kernel query to list all connectors of the
correct type. Then for each one, get its GBeanData, and pick out the
container reference by name, and see what container ObjectName is in
there. I'm hoping this will always be a full ObjectName even if the
config file only specified certain parameters. If that's not true, I
think we've exhaused all the options. Even so, it's pretty brittle in
that the reference name is hardcoded and if it's changed in the GBean
definition but not where this logic is performed then things will silently
break.
Aaron