dev@glassfish.java.net

Re: [HEADS-UP] Monitoring Mbean object name change (and question)

From: Satish Viswanatham <satish.viswanatham_at_Sun.COM>
Date: Thu, 20 Oct 2005 12:44:49 -0700

To get hold of AppsManager, please try the following:

  InstanceEnvironment ienv =
    ApplicationServer.getServerContext().getInstanceEnvironment();
  appsMgr = new AppsManager(ienv);

thanks
Satish

>
> >>>>>>Lloyd L Chambers wrote On 10/18/05 16:41,:
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>>Satish may be in a position to answer the question posed by Jan.
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>>>>One of the places I need to modify is the reconfigureMonitoring()
> >>>>>>>>>method inside:
> >>>>>>>>>
> >>>>>>>>>/cvs/glassfish/admin/ws-mgmt/src/java/com/sun/enterprise/admin/
> >>>>>>>>>wsmgmt/lifecycle/AppServWSMonitorLifeCycleProvider.java
> >>>>>>>>>
> >>>>>>>>>which takes an argument of type
> >>>>>>>>>com.sun.enterprise.config.serverbeans.WebServiceEndpoint.
> >>>>>>>>>How can I reliably determine the context root of a servlet-based
> >>>>>>>>>endpoint given an instance of WebServiceEndpoint?
> >>>>>>>>>I assume the following code will work:
> >>>>>>>>>
> >>>>>>>>>WebServiceEndpoint ep = ...;
> >>>>>>>>>String ctxRoot = null;
> >>>>>>>>>
> >>>>>>>>>BundleDescriptor bd = ep.getBundleDescriptor();
> >>>>>>>>>if (bd instanceof WebBundleDescriptor) {
> >>>>>>>>> ctxRoot = ((WebBundleDescriptor) bd).getContextRoot();
> >>>>>>>>>}
> >>>>>>>>>
> >>>>>>>>>Can someone confirm?
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>Unfortunately, the above won't work because we're dealing with
> >>>>>>an instance of com.sun.enterprise.config.serverbeans.WebServiceEndpoint
> >>>>>>(from which we can't get a BundleDescriptor),
> >>>>>>not com.sun.enterprise.deployment.WebServiceEndpoint (as I originally
> >>>>>>thought).
> >>>>>>
> >>>>>>The code in question is as follows:
> >>>>>>
> >>>>>> ConfigBean parent = (ConfigBean) ep.parent();
> >>>>>> if (parent instanceof J2eeApplication) {
> >>>>>> isStandAlone = false;
> >>>>>> appName = appId;
> >>>>>> modName =
> >>>>>> WebServiceMgrBackEnd.getManager().getModuleName(ep.getName());
> >>>>>> // set isEjb to true in case of ejb embedded module
> >>>>>> if (modName.endsWith("jar")) {
> >>>>>> isEjb = true;
> >>>>>> }
> >>>>>> } else if (parent instanceof WebModule) {
> >>>>>> isStandAlone = true;
> >>>>>> appName = null;
> >>>>>> modName = appId;
> >>>>>> } else if (parent instanceof EjbModule) {
> >>>>>> isStandAlone = true;
> >>>>>> isEjb = true;
> >>>>>> appName = null;
> >>>>>> modName = appId;
> >>>>>> }
> >>>>>>
> >>>>>>If parent is an instanceof WebModule, I can get the context
> >>>>>>root as follows:
> >>>>>>
> >>>>>>ctxRoot = ((WebModule) parent).getContextRoot();
> >>>>>>
> >>>>>>but I'm struggling with the case where parent is instanceof
> >>>>>>J2eeApplication and the module is a WAR. How can I get the
> >>>>>>context root in that case? Jerome suggested querying the
> >>>>>>AppsManager, but I'm not sure how to acquire the AppsManager
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>from the above code.
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>>>Any help most welcome.
> >>>>>>
> >>>>>>Thanks,
> >>>>>>
> >>>>>>
> >>>>>>Jan
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>
> >>>>
> >>>>
> >>>>
> >>
> >>
> >>
> >