KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > mortbay > util > jmx > MX4JHttpAdaptor


1 // ========================================================================
2
// $Id: MX4JHttpAdaptor.java,v 1.5 2005/08/13 00:01:28 gregwilkins Exp $
3
// Copyright 1999-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.util.jmx;
17
18 import javax.management.MBeanServer JavaDoc;
19 import javax.management.ObjectName JavaDoc;
20
21 import mx4j.tools.adaptor.http.HttpAdaptor;
22
23 import org.apache.commons.logging.Log;
24 import org.mortbay.log.LogFactory;
25
26 public class MX4JHttpAdaptor extends HttpAdaptor
27 {
28     private static Log log = LogFactory.getLog(MX4JHttpAdaptor.class);
29
30     public MX4JHttpAdaptor()
31     {
32         super();
33     }
34     
35     public MX4JHttpAdaptor(int port)
36     {
37         super(port);
38     }
39     
40     public MX4JHttpAdaptor(int port, String JavaDoc host)
41     {
42         super(port,host);
43     }
44     
45     public ObjectName JavaDoc preRegister(MBeanServer JavaDoc server,
46                                   ObjectName JavaDoc name)
47         throws Exception JavaDoc
48     {
49         name=super.preRegister(server,name);
50         ObjectName JavaDoc processorName = new ObjectName JavaDoc(name+",processor=XSLT");
51         server.createMBean("mx4j.tools.adaptor.http.XSLTProcessor", processorName, null);
52         setProcessorName(processorName);
53         return name;
54     }
55
56     public void postRegister(Boolean JavaDoc done)
57     {
58         super.postRegister(done);
59         if (done.booleanValue())
60         {
61             try{start();} catch(Exception JavaDoc e){e.printStackTrace();}
62             log.info("Started MX4J HTTP Adaptor on : "+this.getPort());
63         }
64     }
65 }
66
67
68
Popular Tags