Yes Sergey, will have these following pattern: http://localhost:8080/services/jmx/mbean/0 -> CXF Bus
http://localhost:8080/services/jmx/mbean/01 -> UserService http://localhost:8080/services/jmx/mbean/0123 -> CustomerService http://localhost:8080/services/jmx/mbean/01234 -> GreeterService (Soap) http://localhost:8080/services/jmx/mbean/012 -> JMXServer will be hidden to user. Regards: Shenglin Qiu > Date: Thu, 19 May 2011 14:19:13 +0100 > Subject: Re: Expose MBeans in CXF > From: sberyoz...@gmail.com > To: dabaip...@hotmail.com > CC: dev@cxf.apache.org > > Hi Shenglin > > Please don't copy all the response collection, copy only relevant fragments. > > > > > Because there are 2 unrelated MBean filtered out, > > > > http://localhost:8080/services/jmx/list/mbean/0 -> CXF BUS > > CXF Bus is definitely relevant, as it is in the org.apache.cxf domain. > Please include it whenever suitable, ex, when listing all MBeans, when > a /type/* query matches it, etc > > > > therefore, now href is somehow not continuous as followed, is it ok just > > for a unique identifier for the MBean we want? > > > > http://localhost:8080/services/jmx/list/mbean/0/mbean/1 > > -> restful UserService > > http://localhost:8080/services/jmx/list/mbean/0/mbean/1/mbean/2/mbean/3 > > -> restful CustomerService > > http://localhost:8080/services/jmx/list/mbean/0/mbean/1/mbean/2/mbean/3/mbean/4 > > -> soap Greeter > > All MBeans, irrespectively of whether you used /list or /service/*, > etc query, should have this format: > > http://localhost:8080/services/jmx/mbean/1 > or > http://localhost:8080/services/jmx/mbean/23 > or > http://localhost:8080/services/jmx/mbean/99 > or > http://localhost:8080/services/jmx/mbean/bus.service.id.1 > > Note, no 'list' is there. And the key is a simple value like 1 or 23, etc. > > Do you see what I mean ? > > Cheers, Sergey > > > > > Thank you. > > > > > > Regards: > > Shenglin Qiu > > > > > > > >> Date: Thu, 19 May 2011 10:20:19 +0100 > >> Subject: Re: Expose MBeans in CXF > >> From: sberyoz...@gmail.com > >> To: dabaip...@hotmail.com > >> CC: dev@cxf.apache.org > >> > >> HI Shenglin > >> > >> >> > >> >> String href = > >> >> builder.path("mbean").path(someUniqueKey).build().toString() > >> > > >> > > >> > Here is my progress, I use UriBuilder uriBuilder = > >> > uriInfo.getAbsolutePathBuilder().path(this.getClass(), "list"); and > >> > String uniqueKey = Integer.toString(index++); > >> > String href = > >> > uriBuilder.path(uniqueKey).build().toString(); > >> > in each MBean. > >> > > >> > > >> > (Actually, the result is something I never studied before. This is a > >> > very > >> > interesting topic. I will spend more time on it.) > >> > >> Indeed, it's interesting. > >> > >> You actually need to use uriInfo.getBaseUriBuilder() instead and add > >> "mbean" segment followed by some > >> unikey key. Using uriInfo.getBaseUriBuilder() will make sure that > >> irrespectively of whether you have a /list or /service/* or /type/* > >> query, you will alway get the same result for MBean href. > >> > >> More comments below. > >> > >> > > >> > My current response on this url: http://localhost:8080/services/jmx/ > >> > >> > <MBeans> > >> > >> > <MBean href="http://localhost:8080/services/jmx/list/0/1/2/3/4/5"> > >> > <attribute> > >> > <type>MBeanServerDelegate</type> > >> > </attribute> > >> > > >> > <canonicalName>JMImplementation:type=MBeanServerDelegate</canonicalName> > >> > <domain>JMImplementation</domain> > >> > </MBean> > >> > >> > >> MBeans which are not in the org.apace.cxf domain have to be dropped. > >> We can have the name of the domain injected as a property in the > >> future. At the moment have a 'final String DOMAIN_NAME' constant and > >> use it to filter out non-CXF MBeans > >> > >> The other note is that it should always be > >> "http://localhost:8080/services/jmx/mbean/{someuniquekey}" > >> with the key being 1, 2, or something more descriptive which can > >> uniquely identify a given MBean. You probably need to keep a > >> ConcurrentHashMap, where keys are 1, 2, and values are canonical > >> names, something like that, so that when you get a request like > >> "http://localhost:8080/services/jmx/mbean/1" you can retrieve the > >> corresponding Object name and do something with it > >> > >> > <MBean href="http://localhost:8080/services/jmx/list/0/1"> > >> > <attribute> > >> > <busId>cxf33425430</busId> > >> > <port>"JMXServer"</port> > >> > <service>"{http://server.gsoc.apache.org/}JMXServer"</service> > >> > <type>Bus.Service.Endpoint</type> > >> > </attribute> > >> > > >> > > >> > <canonicalName>org.apache.cxf:bus.id=cxf33425430,port="JMXServer",service="{http://server.gsoc.apache.org/}JMXServer",type=Bus.Service.Endpoint</canonicalName> > >> > <domain>org.apache.cxf</domain> > >> > </MBean> > >> > >> This bean has to be excluded as well, at least by default. > >> What you can do in the short term is to qualify the jmx server > >> endpoint like this: > >> <jaxrs:server xmlns:s="http://cxf.apache.org/jmx" > >> serviceName="s:JMXServer" address="/jmx"> > >> <property name="serviceName" > >> value="{http://cxf.apache.org/jmx}JMXServer"/> > >> </jaxrs:server> > >> > >> This will give you enough info for checking MBeans which have > >> 'service' attribute and blocking the one which matches this > >> serviceName. Another solution is use jaxrs:property or jaxws:property > >> to indicate that a given endpoint should not be JMX-exposed and update > >> InstrumnetationManager to check such a property - perhaps we can do it > >> later > >> > >> > > >> > Of course, as you required, I format the output. > >> > >> Sorry, I may've confused you, please don't format, > >> > >> thanks, Sergey > >> > >> > > >> > Regards: > >> > Shenglin Qiu > >> > > >> > > > > > > > -- > Sergey Beryozkin > > Application Integration Division of Talend > http://sberyozkin.blogspot.com