Hi Sergey:

I am now at this step from your comment:
> Now, there's one thing which is missing from the above representation
> and it is a link to a resource which will deal with a particular MBean
> (possible updates of properties, handling the notifications). We need
> to put it all into a more practical surface so it should be something
> like
> 
> <MBeans>
> <MBean href="http://localhost:8080/soapdemo/jmx/mbean/1";>
>  <domain>org.apache.cxf</domain>
>
  
<canonicalName>org.apache.cxf:bus.id=cxf5663550,port="CustomerServiceImpl",service="{http://server.gsoc.apache.org/}CustomerServiceImpl",type=Bus.Service.Endpoint</canonicalName>
> <MBean>
> <MBean href="http://localhost:8080/soapdemo/jmx/mbean/2";>
>  <domain>org.apache.cxf</domain>
>
  
<canonicalName>org.apache.cxf:bus.id=cxf5663551,port="UserServiceImpl",service="{http://server.gsoc.apache.org/}UserServiceImpl",type=Bus.Service.Endpoint</canonicalName>
> <MBean>
> </MBeans>
> 
> where http://localhost:8080/soapdemo/jmx/mbean/1,
> http://localhost:8080/soapdemo/jmx/mbean/2, etc, uniquely identify
> those individual MBeans only.
> 
> So please update MBean class to have "href" attribute (with
> @XmlAttribute). Have a '@Context UriInfo uriinfo' field in JMXServer
> class. When you create a response for /list or /service/*, etc, use
> UriInfo to get to the *base* UriBuilder which will represent a URI
> like "http://localhost:8080/soapdemo/jmx";. Next add "mbean" and then a
> number like 1/2/etc which identifies a particular MBean, may be a
> short objectname instead of the compete canonical name, etc, so and
> have UriBuilder to return you
> 'http://localhost:8080/soapdemo/jmx/mbean/1', etc:
> 
> 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.)

My current response on this url: http://localhost:8080/services/jmx/ 
<MBeans>
   <MBean href="http://localhost:8080/services/jmx/list/0";>
      <attribute>
         <busId>cxf33425430</busId>
         <port>"UserServiceImpl"</port>
         <service>"{http://server.gsoc.apache.org/}UserServiceImpl";</service>
         <type>Bus.Service.Endpoint</type>
      </attribute>
      
<canonicalName>org.apache.cxf:bus.id=cxf33425430,port="UserServiceImpl",service="{http://server.gsoc.apache.org/}UserServiceImpl",type=Bus.Service.Endpoint</canonicalName>
      <domain>org.apache.cxf</domain>
   </MBean>
   <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>
   <MBean href="http://localhost:8080/services/jmx/list/0/1/2/3";>
      <attribute>
         <busId>cxf33425430</busId>
         <type>Bus</type>
      </attribute>
      <canonicalName>org.apache.cxf:bus.id=cxf33425430,type=Bus</canonicalName>
      <domain>org.apache.cxf</domain>
   </MBean>
   <MBean href="http://localhost:8080/services/jmx/list/0/1/2/3/4";>
      <attribute>
         <busId>cxf33425430</busId>
         <port>"SoapPort"</port>
         
<service>"{http://org.apache.gsoc.server/Greeter_Soap}SOAPService";</service>
         <type>Bus.Service.Endpoint</type>
      </attribute>
      
<canonicalName>org.apache.cxf:bus.id=cxf33425430,port="SoapPort",service="{http://org.apache.gsoc.server/Greeter_Soap}SOAPService",type=Bus.Service.Endpoint</canonicalName>
      <domain>org.apache.cxf</domain>
   </MBean>
   <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>
   <MBean href="http://localhost:8080/services/jmx/list/0/1/2";>
      <attribute>
         <busId>cxf33425430</busId>
         <port>"CustomerServiceImpl"</port>
         
<service>"{http://server.gsoc.apache.org/}CustomerServiceImpl";</service>
         <type>Bus.Service.Endpoint</type>
      </attribute>
      
<canonicalName>org.apache.cxf:bus.id=cxf33425430,port="CustomerServiceImpl",service="{http://server.gsoc.apache.org/}CustomerServiceImpl",type=Bus.Service.Endpoint</canonicalName>
      <domain>org.apache.cxf</domain>
   </MBean>
</MBeans>

Of course, as you required, I format the output.

Regards:
Shenglin Qiu


> Date: Wed, 18 May 2011 11:38:24 +0100
> Subject: Re: Expose MBeans in CXF
> From: sberyoz...@gmail.com
> To: dev@cxf.apache.org
> 
> Hi Shenglin
> 
> Well done, you are progressing well.
> 
> Note that you don't have to start formatting the updates to the dev
> list, it's just
> the work as usual, keep it simple please :-). And don't CC to the secretary 
> :-)
> 
> Some comments below.
> 
> > I am fully upgrade it to 2.4.0, I have some testing phase exceptions
> > ocurring even I don't have a test case in maven test src folder. I will
> > figure this out later after this doc.
> >
> If you are seeing some unrelated test failures when building the trunk
> then add '-Pfastinstall'
> 
> > The RAR src is attached, hope this 'soap' won't confuse you, it actually has
> > 1 soap inbound and 2 restful inbounds. I am always stuck at the naming,
> > previous demoserver has been down when I was upgrading, that's another
> > story, and I will fix it.
> >
> 
> Well, /soapdemo is confusing.
> Have the context named as "/services" or "/application" and set the
> address of SOAP endpoint as "/soap/greeter" or simply "/greeter" as
> you do now.
> 
> <snip/>
> >
> > Here are the 3 enabled inbound service, including 1 soap webservice and 2
> > Restful service:(They are up and running)
> >
> > http://localhost:8080/soapdemo/greeter?wsdl
> >
> > http://localhost:8080/soapdemo/customerservice/customers
> >
> > http://localhost:8080/soapdemo/customerservice/customer/firstname/Lois
> >
> > http://localhost:8080/soapdemo/customerservice/customer/id/1
> >
> > http://localhost:8080/soapdemo/userservice/users
> >
> > http://localhost:8080/soapdemo/userservice/user/1
> >
> 
> OK, lets have
> http://localhost:8080/services/greeter
> http://localhost:8080/services/customerservice
> http://localhost:8080/services/userservice
> 
> >
> >
> > And here is the demo inbound Restful service url which is holding the above
> > 3 services MBeans:
> >
> > http://localhost:8080/soapdemo/jmx/service/%7Bhttp:%2F%2Fserver.gsoc.apache.org%2F%7DCustomerServiceImpl
> >
> 
> I think you meant to say:
> 
> > http://localhost:8080/soapdemo/jmx
> 
> which is the address of your JMX server endpoint which should be changed to 
> say
> "http://localhost:8080/services/jmx";.
> 
> > which is:
> >
> > http://localhost:8080/soapdemo/jmx/service/{http://server.gsoc.apache.org/}CustomerServiceImpl
> >
> > http://localhost:8080/soapdemo/jmx/objectname/org.apache.cxf:type=Bus.Service.Endpoint,*
> >
> > http://localhost:8080/soapdemo/jmx/type/Bus.Service.Endpoint
> >
> > http://localhost:8080/soapdemo/jmx/list
> >
> >
> 
> Ok, so what are you saying is that you can have a list of all MBeans
> returned, using "/list" or a list of all MBeans which have a matching
> objectname or attribute (such as type, service, port, etc)
> 
> I like "http://localhost:8080/soapdemo/jmx/list and
> http://localhost:8080/soapdemo/jmx/objectname/"; though I think we can
> simplify those,  but right now make sure that you have something like
> @Path("{attribute}/{value}") for a method which serves /service/*, and
> /type/* requests. because 'service' and 'type' are attributes and we
> can have many attributes.
> 
> >
> > Request:
> >
> > http://localhost:8080/soapdemo/jmx/service/%7Bhttp:%2F%2Fserver.gsoc.apache.org%2F%7DCustomerServiceImpl
> >
> > Note: this is actually an url encoded string which is  from:
> >
> > http://localhost:8080/soapdemo/jmx/service/{http://server.gsoc.apache.org/}CustomerServiceImpl
> >
> OK, we should also be able to support
> 
> http://localhost:8080/soapdemo/jmx/service/{http://server.gsoc.apache.org/}*
> 
> which means get all MBeans which have a service attribute with
> namespace equal to 'http://server.gsoc.apache.org'
> 
> 
> > Response:
> >
> > <MBeanCollection>
> >
> >    <MBeans>
> >
> >       <MBean>
> >
> >
> > <canonicalName>org.apache.cxf:bus.id=cxf5663550,port="CustomerServiceImpl",service="{http://server.gsoc.apache.org/}CustomerServiceImpl",type=Bus.Service.Endpoint</canonicalName>
> >
> >          <domain>org.apache.cxf</domain>
> >
> >
> > <endpointName>"{http://server.gsoc.apache.org/}CustomerServiceImpl";</endpointName>
> >
> >       </MBean>
> >
> >    </MBeans>
> >
> > </MBeanCollection>
> >
> OK. Please remove MBeanCollection wrapper, you have another wrapper, MBeans.
> No need to have quotes around endpointName's value.
> How about having MBean representation structured like this:
> 
> <MBean>
> <domain>org.apache.cxf</domain>
> <canonicalName>org.apache.cxf:bus.id=cxf5663550,port="CustomerServiceImpl",service="{http://server.gsoc.apache.org/}CustomerServiceImpl",type=Bus.Service.Endpoint</canonicalName>
> <!-- this is another representation of canonical's name
> <attributes>
>    <type>Bus.Service.Endpoint</type>
>    <service>{http://server.gsoc.apache.org/}CustomerServiceImpl</service>
>    <endpoint>CustomerServiceImpl</endpoint>
> <attributes>
> <!--
> This can be ignored for now
> <properties/>
> -->
> </MBean>
> 
> This will make it simpler for consumers to understand - we may support
> returning canonicalNames only or alternative, structured reps but for
> now just have MBean representation updated as suggested.
> 
> Now, there's one thing which is missing from the above representation
> and it is a link to a resource which will deal with a particular MBean
> (possible updates of properties, handling the notifications). We need
> to put it all into a more practical surface so it should be something
> like
> 
> <MBeans>
> <MBean href="http://localhost:8080/soapdemo/jmx/mbean/1";>
>  <domain>org.apache.cxf</domain>
>  
> <canonicalName>org.apache.cxf:bus.id=cxf5663550,port="CustomerServiceImpl",service="{http://server.gsoc.apache.org/}CustomerServiceImpl",type=Bus.Service.Endpoint</canonicalName>
> <MBean>
> <MBean href="http://localhost:8080/soapdemo/jmx/mbean/2";>
>  <domain>org.apache.cxf</domain>
>  
> <canonicalName>org.apache.cxf:bus.id=cxf5663551,port="UserServiceImpl",service="{http://server.gsoc.apache.org/}UserServiceImpl",type=Bus.Service.Endpoint</canonicalName>
> <MBean>
> </MBeans>
> 
> where http://localhost:8080/soapdemo/jmx/mbean/1,
> http://localhost:8080/soapdemo/jmx/mbean/2, etc, uniquely identify
> those individual MBeans only.
> 
> So please update MBean class to have "href" attribute (with
> @XmlAttribute). Have a '@Context UriInfo uriinfo' field in JMXServer
> class. When you create a response for /list or /service/*, etc, use
> UriInfo to get to the *base* UriBuilder which will represent a URI
> like "http://localhost:8080/soapdemo/jmx";. Next add "mbean" and then a
> number like 1/2/etc which identifies a particular MBean, may be a
> short objectname instead of the compete canonical name, etc, so and
> have UriBuilder to return you
> 'http://localhost:8080/soapdemo/jmx/mbean/1', etc:
> 
> String href = builder.path("mbean").path(someUniqueKey).build().toString()
> 
> Now, the question is how to handle requests like
> 'http://localhost:8080/soapdemo/jmx/mbean/1'
> 
> Your JMXServer should have a subresource locator, with @Path("mbean")
> and without HttpMethod.
> This locator will return something like MBeanResource and that class,
> at this stage, will have *only*
> a single @GET resource method with @Path("{key}") and which will
> return the above MBean representaion only, without MBeans wrapper:
> 
> GET http://localhost:8080/soapdemo/jmx/mbean/1
> 
> returns
> 
> <MBean href="http://localhost:8080/soapdemo/jmx/mbean/1";>
>  <domain>org.apache.cxf</domain>
>  
> <canonicalName>org.apache.cxf:bus.id=cxf5663550,port="CustomerServiceImpl",service="{http://server.gsoc.apache.org/}CustomerServiceImpl",type=Bus.Service.Endpoint</canonicalName>
> </MBean>
> 
> Having a subresource handly because at the next step we will start
> working on dealing with notifications/updatiing properties or invoking
> operations somehow when applicable.
> 
> Does it make sense ? If you have any questions or suggestions - please
> ask them here or ping me on #cxf
> I guess we have two weeks or so and then I'd like to discuss how
> LogBrowser can be extended to act as a consumer of your JMXServer
> 
> I'm removing the rest of your message to make it shorter, everything
> you posted there looked OK, those who are interested can check the
> previous message if needed for more info.
> 
> You are progressing very well.
> 
> Thanks, Sergey
> 
> >
> > Thank you.
> >ld
> > Regards:
> > Shenglin Qiu
> >
                                          

Reply via email to