KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > mortbay > jetty > servlet > jmx > WebApplicationHandlerMBean


1 // ========================================================================
2
// $Id: WebApplicationHandlerMBean.java,v 1.9 2005/08/13 00:01:27 gregwilkins Exp $
3
// Copyright 2002-2004 Mort Bay Consulting Pty. Ltd.
4
// ------------------------------------------------------------------------
5
// Licensed under the Apache License, Version 2.0 (the "License");
6
// you may not use this file except in compliance with the License.
7
// You may obtain a copy of the License at
8
// http://www.apache.org/licenses/LICENSE-2.0
9
// Unless required by applicable law or agreed to in writing, software
10
// distributed under the License is distributed on an "AS IS" BASIS,
11
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
// See the License for the specific language governing permissions and
13
// limitations under the License.
14
// ========================================================================
15

16 package org.mortbay.jetty.servlet.jmx;
17
18 import java.util.HashMap JavaDoc;
19 import java.util.List JavaDoc;
20 import java.util.Map JavaDoc;
21
22 import javax.management.MBeanException JavaDoc;
23 import javax.management.ObjectName JavaDoc;
24
25 import org.apache.commons.logging.Log;
26 import org.mortbay.log.LogFactory;
27 import org.mortbay.jetty.servlet.WebApplicationHandler;
28
29
30 /* ------------------------------------------------------------ */
31 /**
32  *
33  * @version $Revision: 1.9 $
34  * @author Greg Wilkins (gregw)
35  */

36 public class WebApplicationHandlerMBean extends ServletHandlerMBean
37 {
38     /* ------------------------------------------------------------ */
39     private static final Log log = LogFactory.getLog (WebApplicationHandlerMBean.class);
40     private WebApplicationHandler _webappHandler;
41     private Map JavaDoc _filters = new HashMap JavaDoc();
42     
43     /* ------------------------------------------------------------ */
44     /** Constructor.
45      * @exception MBeanException
46      */

47     public WebApplicationHandlerMBean()
48         throws MBeanException JavaDoc
49     {}
50     
51     /* ------------------------------------------------------------ */
52     protected void defineManagedResource()
53     {
54         super.defineManagedResource();
55         defineAttribute("acceptRanges");
56         defineAttribute("filterChainsCached");
57         defineAttribute("filters",READ_ONLY,ON_MBEAN);
58         _webappHandler=(WebApplicationHandler)getManagedResource();
59     }
60
61     /* ------------------------------------------------------------ */
62     public ObjectName JavaDoc[] getFilters()
63     {
64         List JavaDoc l=_webappHandler.getFilters();
65         return getComponentMBeans(l.toArray(),_filters);
66     }
67     
68     public void postDeregister ()
69     {
70        destroyComponentMBeans(_filters);
71         super.postDeregister();
72     }
73 }
74
Popular Tags