KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > enterprise > web > WebDebugMonitor


1 /*
2  * The contents of this file are subject to the terms
3  * of the Common Development and Distribution License
4  * (the License). You may not use this file except in
5  * compliance with the License.
6  *
7  * You can obtain a copy of the license at
8  * https://glassfish.dev.java.net/public/CDDLv1.0.html or
9  * glassfish/bootstrap/legal/CDDLv1.0.txt.
10  * See the License for the specific language governing
11  * permissions and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL
14  * Header Notice in each file and include the License file
15  * at glassfish/bootstrap/legal/CDDLv1.0.txt.
16  * If applicable, add the following below the CDDL Header,
17  * with the fields enclosed by brackets [] replaced by
18  * you own identifying information:
19  * "Portions Copyrighted [year] [name of copyright owner]"
20  *
21  * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
22  */

23
24 /*
25  * WebDebugMonitor.java
26  *
27  * Created on January 14, 2003, 11:16 AM
28  */

29
30 package com.sun.enterprise.web;
31
32 import java.util.*;
33 import java.util.logging.*;
34 import com.sun.logging.*;
35
36 /**
37  *
38  * @author lwhite
39  */

40 public class WebDebugMonitor {
41     
42     private static Logger _logger;
43     static
44     {
45         _logger=LogDomains.getLogger(LogDomains.WEB_LOGGER);
46     }
47     
48     /** Creates a new instance of WebDebugMonitor */
49     public WebDebugMonitor() {
50     }
51     
52     HashMap getDebugMonitoringDetails() {
53         HashMap resultMap = new HashMap();
54         boolean debugMonitoring = false;
55         resultMap.put("debugMonitoring", new Boolean JavaDoc(false));
56         long debugMonitoringPeriodMS = 30000L;
57     try{
58             Properties props = System.getProperties();
59             String JavaDoc str=props.getProperty("MONITOR_WEB_CONTAINER");
60             if(null!=str) {
61                 if( str.equalsIgnoreCase("TRUE"))
62                 //if( str.startsWith("TRUE") || str.startsWith("true") )
63
debugMonitoring=true;
64             }
65             String JavaDoc period=props.getProperty("MONITOR_WEB_TIME_PERIOD_SECONDS");
66             if(null!=period) {
67                 debugMonitoringPeriodMS = (new Long JavaDoc (period).longValue())* 1000;
68             }
69             resultMap.put("debugMonitoringPeriodMS", new Long JavaDoc(debugMonitoringPeriodMS));
70             resultMap.put("debugMonitoring", new Boolean JavaDoc(debugMonitoring));
71
72         } catch(Exception JavaDoc e)
73         {
74             _logger.log(Level.SEVERE,"WebDebugMonitor.getDebugMonitoringDetails(), Exception when trying to get the System properties - ", e.toString());
75         }
76         return resultMap;
77     }
78     
79 }
80
Popular Tags