Return-Path: X-Original-To: apmail-cxf-dev-archive@www.apache.org Delivered-To: apmail-cxf-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 367212E96 for ; Thu, 5 May 2011 13:05:14 +0000 (UTC) Received: (qmail 38925 invoked by uid 500); 5 May 2011 13:05:14 -0000 Delivered-To: apmail-cxf-dev-archive@cxf.apache.org Received: (qmail 38874 invoked by uid 500); 5 May 2011 13:05:13 -0000 Mailing-List: contact dev-help@cxf.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cxf.apache.org Delivered-To: mailing list dev@cxf.apache.org Received: (qmail 38866 invoked by uid 99); 5 May 2011 13:05:13 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 05 May 2011 13:05:13 +0000 X-ASF-Spam-Status: No, hits=4.7 required=5.0 tests=FREEMAIL_FROM,FREEMAIL_REPLY,HTML_MESSAGE,RCVD_IN_DNSWL_NONE,RFC_ABUSE_POST,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of dabaipang@hotmail.com designates 65.54.190.33 as permitted sender) Received: from [65.54.190.33] (HELO bay0-omc1-s22.bay0.hotmail.com) (65.54.190.33) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 05 May 2011 13:05:05 +0000 Received: from BAY154-W38 ([65.54.190.61]) by bay0-omc1-s22.bay0.hotmail.com with Microsoft SMTPSVC(6.0.3790.4675); Thu, 5 May 2011 06:04:43 -0700 Message-ID: Content-Type: multipart/alternative; boundary="_3f850c92-287f-47d5-88c7-d6b56ab2581b_" X-Originating-IP: [174.62.198.251] From: Shenglin Qiu To: Sergey CC: CXF Apache Foundation Subject: RE: ServerLifeCycleListener and JMXServer Date: Thu, 5 May 2011 09:04:43 -0400 Importance: Normal In-Reply-To: References: MIME-Version: 1.0 X-OriginalArrivalTime: 05 May 2011 13:04:43.0484 (UTC) FILETIME=[005F41C0:01CC0B25] X-Virus-Checked: Checked by ClamAV on apache.org --_3f850c92-287f-47d5-88c7-d6b56ab2581b_ Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Yes=2C Sergey. I should have finished listing MBeans correctly and fully first=2C and then= look forward for the next. I will make my code cleaner=2C my code is synced at https://github.com/daba= ipang/demoserver Regards: Shenglin Qiu > Date: Thu=2C 5 May 2011 10:43:59 +0100 > Subject: Re: ServerLifeCycleListener and JMXServer > From: sberyozkin@gmail.com > To: dabaipang@hotmail.com > CC: dev@cxf.apache.org >=20 > Hi Shenglin >=20 > Thanks for this update. I'd like to clarify why I suggested adding > ServerLifeCycleManager listener. > The only reason is for JMXServer to be able to keep an internal > uptodate list of existing CXF endpoints which are currently being > managed. >=20 > Please check the comments I made in the other (main) thread about it. > Lets focus right now on only GETing the representations of: > 1. All CXF MBeans representing all the CXF endpoints > 2. CXF service-specific MBeans >=20 > I believe you've nearly implemented 1. In order to implement 2=2C we > need to know the list of existing CXF services (not MBeans) and > JMXServer needs to return this list (getListOfManagedServices or > similar). Next=2C JMXServer has to be able to return service-scoped > MBeans (see 2.)=2C it should have a resource method accepting the > service expanded qname ({http://bar}service or similar) and return a > collection of MBeans relevant to this particular service only > (Service=2C its Endpoints as well as the bus - the bus is not > necessarily endpoint specific - but is relevant). >=20 > So whenever your ServerLifeCycleManager listener gets an event it > updates the (concurrent/thread-safe) list accordingly. >=20 > The question is how to get this list (task 2.) initialized with the > list of service qnames which have already been created=2C by the time > JMXServer is being created itself. Looks like you need to get a > ServerRegistry extension from the bus and get a list of existing > Servers (and Services) from it. >=20 > Please see more comments inline >=20 > On Thu=2C May 5=2C 2011 at 4:04 AM=2C Shenglin Qiu wrote: > > Hi Sergey: > > > > As you mentioned last time=2C I am trying to have this > > ServerLifeCycleManager.class into > > > > private ServerLifeCycleManager lifeCycleManager=3B > > > > public void setInstrumentationManager(InstrumentationManagerImpl > > instrumentationManager) { > > this.instrumentationManager =3D instrumentationManager=3B > > lifeCycleManager =3D > > instrumentationManager.getBus().getExtension(ServerLifeCycleManager.cla= ss)=3B > > lifeCycleManager.registerListener(new ServerLifeCycleListener()= { > > public void startServer(Server server) { > > String address =3D > > server.getEndpoint().getEndpointInfo().getAddress()=3B > > } > > public void stopServer(Server server) { > > String address =3D > > server.getEndpoint().getEndpointInfo().getAddress()=3B > > } > > })=3B > > } > > > > @GET > > @POST > > @Path("start") > > public CxfMBeanCollection start(){ > > lifeCycleManager.startServer(server)=3B > > > > return ?=3B > > } > > > > @GET > > @POST > > @Path("stop") > > public CxfMBeanCollection stop(){ > > lifeCycleManager.startServer(server)=3B > > > > return ?=3B > > } > > > > > > I am stuck at getting a server instance in start() and stop()=3B Here i= s my > > applicationContext.xml=2C I think if applicationContext is loaded=2C th= en all > > Jax-Ws and Jax-Rs are started by default=2C then up in start() function= will > > have duplicated starting issue. I am thinking=2C should I use non-sprin= g > > approach=2C and create JAXRSServerFactoryBean -> create endpoint -> sta= rt > > server in plain java code at first? >=20 > JMXServer should not deal with starting/stopping CXF endpoints - at > least not at the initial stage=2C > at the moment its main 'responsibility' is to show all relevant MBeans > and also access properties of individual MBeans=2C and may be modify > some of the properties=2C when possible. >=20 >=20 > > Either way=2C I will spend some time more reading jax-rs-frontend-* mod= ule. > > > > > > > address=3D"/PersonService"> > > > > > /> > > > class=3D"org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor"> > > > > > > > > > > > value=3D"org.apache.cxf.gsoc.ws.auth.ServerPasswordCallback" /> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > >=20 > OK=2C we have 3 application endpoints=2C one JAX-WS=2C and JAX-RS endpoin= ts >=20 > > > > > > > > > > > > > > > > > > > > > > > > > > >=20 > OK >=20 > > > > > class=3D"org.apache.cxf.gsoc.management.web.JMXServer"> > > > > > > > > > > > > > > > > > > > > > > > > > ref=3D"instrumentationManager"/> > > > > >=20 > Right now=2C we probably do not need "managedJaxRsEndpoints" and > "managedJaxWsEndpoints" properties - only if we decide at the later > stage to return the list of MBeans specific to JAX-RS or JAX-WS > endpoints only then we will use them. > That may be a good idea=2C but at the moment please focus on using bus > extensions only for building up the list of endpoints. >=20 > > > class=3D"org.apache.cxf.gsoc.ws.service.impl.UserServiceImpl" /> > > > class=3D"org.apache.cxf.gsoc.ws.service.impl.CustomerServiceImpl" /> > > > > > > PS. I saw I a lot check-in at late night=2C you guys are really working= on cxf > > so hard=2C my previous web service projects are all 2.3.0=2C I think I = should > > all migrate the dependencies to 2.4. > > >=20 > Sure. Please finish the work to do with retrieving the list of all and > endpoint specific MBeans and then migrate >=20 > To summarize: > - Have only InstrumentationManager injected in JMXServer > - Use the bus to get ServiceRegistry in order to initialize a list of > existing managed endpoints > - Register ServerLifeCycleManager Listener for the list to be kept uptoda= te > - Have your server returning the list of all CXFMbeans=2C the list of > QNames representing managed services/endpoints and service specific > CXF MBeans >=20 > One you finish this task then we will move on to other ones... >=20 > Ping me on #cxf please if you have any questions >=20 >=20 > Thanks=2C Sergey >=20 > > > > Regards: > > Shenglin Qiu > > >=20 >=20 >=20 > --=20 > Sergey Beryozkin >=20 > Application Integration Division of Talend > http://sberyozkin.blogspot.com = --_3f850c92-287f-47d5-88c7-d6b56ab2581b_--