cxf-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Shenglin Qiu <dabaip...@hotmail.com>
Subject RE: Expose MBeans in CXF
Date Wed, 08 Jun 2011 04:46:19 GMT

Hi Sergey:

I attached the src and due to I am working on the mvn project only sync to svn, so I will
take some time and sync this to github.

And here is an update on the request:

Self-defined demo inbound service:
http://localhost:8080/services/greeter?wsdl
http://localhost:8080/services/customerservice/customers
http://localhost:8080/services/customerservice/customer/firstname/Lois
http://localhost:8080/services/customerservice/customer/id/1
http://localhost:8080/services/userservice/users
http://localhost:8080/services/userservice/user/1
/**
 *  Specification:
 *  Function 1:
 *    Jmx Server: 
 *    sub-resource locator
 *    http://localhost:8080/services/jmx/property/id/0
 *    http://localhost:8080/services/jmx/property/id/1
 *    ...
 *    
 *    
 *    Function 2:
 *    Note: search by bus.id, bus.id will be changed on every time server had been bounced.
 *    http://localhost:8080/services/jmx/objectname/org.apache.cxf:*
 *    http://localhost:8080/services/jmx/objectname/org.apache.cxf:bus.id=cxf28619341,*
 *    ...
 *    http://localhost:8080/services/jmx/objectname/org.apache.cxf:port=%22CustomerServiceImpl%22,*
 *    http://localhost:8080/services/jmx/objectname/org.apache.cxf:bus.id=cxf28619341,port=%22SoapPort%22,type=Bus.Service.Endpoint,*
 *    http://localhost:8080/services/jmx/objectname/org.apache.cxf:type=Bus.Service.Endpoint,*
 *    http://localhost:8080/services/jmx/objectname/org.apache.cxf:bus.id=cxf28619341,service=%22%7Bhttp%3A%2F%2Fserver.gsoc.apache.org%2F%7DCustomerServiceImpl%22,type=Bus.Service.Endpoint,*
 *    http://localhost:8080/services/jmx/objectname/org.apache.cxf:service=%22%7Bhttp%3A%2F%2Fserver.gsoc.apache.org%2F%7DCustomerServiceImpl%22,*
 *    
 *    Function 3:
 *    Search by service:
 *    http://localhost:8080/services/jmx/property/service/%7Bhttp:%2F%2Fserver.gsoc.apache.org%2F%7DCustomerServiceImpl
 *    http://localhost:8080/services/jmx/property/service/%7Bhttp:%2F%2Fserver.gsoc.apache.org%2F%7DUserServiceImpl
 *    
 *  Note, above queries are searching these 2, but replace by url encoding from:
 *  {http://server.gsoc.apache.org/}UserServiceImpl
 *  {http://server.gsoc.apache.org/}CustomerServiceImpl
 *  
 *    Search by type:
 *    http://localhost:8080/services/jmx/property/type/Bus.Service.Endpoint
 *    
 *    Search by port:
 *    http://localhost:8080/services/jmx/property/port/UserServiceImpl
 *    http://localhost:8080/services/jmx/property/port/CustomerServiceImpl
 *    http://localhost:8080/services/jmx/property/port/SoapPort
 *    
 *    Function 4:
 *    http://localhost:8080/services/jmx/list
 * 
 * */

I will ping you tomorrow morning.

Thank you.
Regards:

Shenglin Qiu


> Date: Wed, 1 Jun 2011 15:32:30 +0100
> Subject: Re: Expose MBeans in CXF
> From: sberyozkin@gmail.com
> To: dev@cxf.apache.org
> 
> Hi Shenglin
> 
> It's a step in the right direction, thanks, but JMXServer still needs
> to be cleaned up quite a bit.
> - as I said earlier you have 4 big functions basically duplicating
> each other. We can't have a method per every attribute a given MBean
> may have. Have a single function only, max two (one capturing all the
> attributes, another one - dedicated to objectname/{value}).
> - Introduce MBeanResource subresource instead of overloading MBean, it
> will be cleaner and easier to work with
> - as suggested earlier, update the domain MBean and/or MBeanAttribute
> such that you could drop a big chunk of code in JMXServer where
> individual attribute values are set, currently in getMbeanMap (if
> (attrName.equals("service") then/else)). That is because a number of
> attributes is basically unlimited, even though we have some well-known
> ones
> 
> - getMBeanMap - this is so complex I can't understand what it does. I
> do understand it returns a thread-safe Map - but I'm finding it
> difficult to understand how the method achieves that.  Please remove
> all those synchronized blocks and have ConcurrentHashMap. Have atomic
> integer counter, synchronized exlicitly (in a block) if you prefer,
> and try to get a simple and effective function implemented. Don't make
> the logic of that function dependent on a n
> I don't understand why you use "list" for creating MBean hrefs;
> 
> - there's no need for having Mbean.id and MBean.href because
> MBean.href is identifying a given MBean uniquely and thus you could
> use that calculated href as a key.
> 
> Thanks, Sergey
> 
> 
> On Tue, May 31, 2011 at 5:36 PM, Shenglin Qiu <dabaipang@hotmail.com> wrote:
> >
> > Hi Sergey:
> >
> > Project has been synced to Github:
> >
> > Browser:
> > https://github.com/dabaipang/services
> >
> >
> > Git address:
> > https://dabaipang@github.com/dabaipang/services.git
> > or
> > git@github.com:dabaipang/services.git
> >
> >
> > Thank you.
> >
> >
> > Regards:
> > Shenglin Qiu
> >
> >
> >
> >> From: dabaipang@hotmail.com
> >> To: sberyozkin@gmail.com
> >> CC: dev@cxf.apache.org
> >> Subject: RE: Expose MBeans in CXF
> >> Date: Tue, 31 May 2011 11:23:38 -0400
> >>
> >>
> >> Hi Sergey:
> >>
> >> > > Function 1: (0 - 5 is continuous, no gap)
> >> > > Jmx Server:
> >> > > sub-resource locator
> >> > > http://localhost:8080/services/jmx/mbean/0
> >> > > http://localhost:8080/services/jmx/mbean/1
> >> >
> >> > The id allocation (0, 1, etc) has to be thread safe
> >>
> >> Done with:
> >> private synchronized Map<String, MBean> getMBeansMap(){
> >>  ....
> >> }
> >> My reason not using synchronized block but using synchronized method is:
> >> this guarantees the order on mbeansMap's initialization,  so when it's called
by a lot of requests, the followings will have to wait, unit the first one finished,  after
that, following requests will see mbeansMap has been initialized, and simply return mbeansMap
without initializing it again.
> >>
> >>
> >> > http://localhost:8080/services/jmx/objectname/org.apache.cxf:*
> >> > or
> >> > http://localhost:8080/services/jmx/objectname/org.apache.cxf
> >> >
> >> > should also work
> >> >
> >> > >
> >>
> >> http://localhost:8080/services/jmx/objectname/org.apache.cxf:*
> >> is working.
> >>
> >> > > Due to the URL duplication with /mbean/{id}, I can't put
> >> > > {searchtype}/{query}, so I put things like:
> >> >
> >> > Personally I'd  prefer to keep a URI as minimal as possible.
> >> >
> >> > /mbean/{id}
> >> > and
> >> > {searchtype}/{query}
> >> >
> >> > do not duplicate each other given that /mbean/{id} is more specific
> >> > than {searchtype}/{query}.
> >> > Likewise /objectname/{objectname} is more specific than
> >> > {searchtype}/{query}, so consider dropping /search/ part,
> >> > we may have a dedicated /search handler later on.
> >>
> >> Done by dedicating each request per method:
> >>     @GET
> >>     @POST
> >>     @Path("/list")
> >>     public MBeanCollection list()
> >>
> >>     @Path("/mbean/")
> >>     public MBean locateMBean()
> >>
> >>
> >>     @GET
> >>     @POST
> >>     @Path("/type/{query}")
> >>     public MBeanCollection searchMBeansByType(@PathParam("query") String query)
> >>
> >>
> >>     @GET
> >>     @POST
> >>     @Path("/port/{query}")
> >>     public MBeanCollection searchMBeansByPort(@PathParam("query") String query)
> >>
> >>
> >>     @GET
> >>     @POST
> >>     @Path("/service/{query}")
> >>     public MBeanCollection searchMBeansByService(@PathParam("query") String
query)
> >>
> >>
> >>     @GET
> >>     @POST
> >>     @Path("/objectname/{objectname}")
> >>     public  MBeanCollection getComponent(@PathParam("objectname") String objectname)
> >>
> >> I remembered you mentioned to handle Exceptions once, currently I am still 'throws'
-ing them out, I will make the try catch block.
> >> Should I also add a new object which display the error or simply return empty?
> >>
> >>
> >> Thank you very much.
> >>
> >>
> >> Regards:
> >> Shenglin Qiu
> >>
> >>
> >> > Date: Tue, 31 May 2011 10:35:36 +0100
> >> > Subject: Re: Expose MBeans in CXF
> >> > From: sberyozkin@gmail.com
> >> > To: dev@cxf.apache.org
> >> >
> >> > Hi Shenglin
> >> >
> >> > Good progress, some comments below
> >> > >
> >> > > Function 1: (0 - 5 is continuous, no gap)
> >> > > Jmx Server:
> >> > > sub-resource locator
> >> > > http://localhost:8080/services/jmx/mbean/0
> >> > > http://localhost:8080/services/jmx/mbean/1
> >> >
> >> > The id allocation (0, 1, etc) has to be thread safe
> >> >
> >> > >
> >> > >
> >> > > Function 2:
> >> > > Note: search by bus.id, bus.id will be changed on every time server
had been
> >> > > bounced.
> >> > > http://localhost:8080/services/jmx/objectname/org.apache.cxf:bus.id=cxf28619341,*
> >> > > ...
> >> > that is ok, a user does not have to specify them as you demonstrated
> >> > with queries like
> >> >
> >> > > http://localhost:8080/services/jmx/objectname/org.apache.cxf:port=%22CustomerServiceImpl%22,*
> >> > I guess
> >> >
> >> > http://localhost:8080/services/jmx/objectname/org.apache.cxf:*
> >> > or
> >> > http://localhost:8080/services/jmx/objectname/org.apache.cxf
> >> >
> >> > should also work
> >> >
> >> > >
> >> > >
> >> > > I am only now use 2 methods to fulfill:
> >> > > 1 method for service/{serivce}, port/{port}, type/{type}
> >> > > 1 method for objectname/{objectname}
> >> >
> >> > OK
> >> >
> >> > >
> >> > > Due to the URL duplication with /mbean/{id}, I can't put
> >> > > {searchtype}/{query}, so I put things like:
> >> >
> >> > Personally I'd  prefer to keep a URI as minimal as possible.
> >> >
> >> > /mbean/{id}
> >> > and
> >> > {searchtype}/{query}
> >> >
> >> > do not duplicate each other given that /mbean/{id} is more specific
> >> > than {searchtype}/{query}.
> >> > Likewise /objectname/{objectname} is more specific than
> >> > {searchtype}/{query}, so consider dropping /search/ part,
> >> > we may have a dedicated /search handler later on.
> >> >
> >> > The other thing I forgot to mention, please remove all those
> >> > System.out.println, ping me please if you need some help with setting
> >> > up a remote debugging session
> >> >
> >> > Thanks, Sergey
> >> >
> >> > >
> >> > > Thank you so much!
> >> > >
> >> > > Regards:
> >> > > Shenglin Qiu
> >> > >
> >>
> >
> 
> 
> 
> -- 
> Sergey Beryozkin
> 
> Application Integration Division of Talend
> http://sberyozkin.blogspot.com
 		 	   		  
Mime
  • Unnamed multipart/mixed (inline, None, 0 bytes)
View raw message