1 // ========================================================================
2 // Copyright (c) 2004-2009 Mort Bay Consulting Pty. Ltd.
3 // ------------------------------------------------------------------------
4 // All rights reserved. This program and the accompanying materials
5 // are made available under the terms of the Eclipse Public License v1.0
6 // and Apache License v2.0 which accompanies this distribution.
7 // The Eclipse Public License is available at
8 // http://www.eclipse.org/legal/epl-v10.html
9 // The Apache License v2.0 is available at
10 // http://www.opensource.org/licenses/apache2.0.php
11 // You may elect to redistribute this code under either of these licenses.
12 // ========================================================================
13
14 package org.eclipse.jetty.webapp.jmx;
15
16 import org.eclipse.jetty.server.handler.jmx.ContextHandlerMBean;
17 import org.eclipse.jetty.webapp.WebAppContext;
18
19 public class WebAppContextMBean extends ContextHandlerMBean
20 {
21
22 public WebAppContextMBean(Object managedObject)
23 {
24 super(managedObject);
25 }
26
27 /* ------------------------------------------------------------ */
28 public String getObjectNameBasis()
29 {
30 String basis = super.getObjectNameBasis();
31 if (basis!=null)
32 return basis;
33
34 if (_managed!=null && _managed instanceof WebAppContext)
35 {
36 WebAppContext context = (WebAppContext)_managed;
37 String name = context.getWar();
38 if (name!=null)
39 return name;
40 }
41 return null;
42 }
43 }