KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > enterprise > admin > wsmgmt > lifecycle > WSMonitoringLevelListener


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 package com.sun.enterprise.admin.wsmgmt.lifecycle;
24
25 import java.util.ArrayList JavaDoc;
26 import java.util.HashMap JavaDoc;
27 import java.util.Hashtable JavaDoc;
28 import java.util.Iterator JavaDoc;
29 import java.util.List JavaDoc;
30 import java.util.Map JavaDoc;
31 import java.util.logging.Level JavaDoc;
32 import java.util.logging.Logger JavaDoc;
33
34 import javax.management.j2ee.statistics.Stats JavaDoc;
35
36 import com.sun.enterprise.admin.monitor.registry.MonitoredObjectType;
37 import com.sun.enterprise.admin.monitor.registry.MonitoringLevel;
38 import com.sun.enterprise.admin.monitor.registry.MonitoringLevelListener;
39 import com.sun.enterprise.admin.monitor.registry.MonitoringRegistry;
40 import com.sun.logging.LogDomains;
41
42
43 /**
44  * Provides an implementation of the MonitoringLevelListener interface to
45  * receive callbacks from admin regarding change in the monitoring level.
46  * Though there are 3 monitoring levels defined by JSR77, we support
47  * only 2 levels - OFF and ON (HIGH/LOW). So essentially, HIGH and LOW
48  * for us is only ON
49  *
50  * @author Satish Viswanatham
51  * @since s1aspe 9.0
52  */

53 public class WSMonitoringLevelListener implements MonitoringLevelListener {
54     
55     private MonitoringRegistry registry_;
56
57     private static final MonitoringLevel OFF = MonitoringLevel.OFF;
58     private static final MonitoringLevel HIGH = MonitoringLevel.HIGH;
59     private static final MonitoringLevel LOW = MonitoringLevel.LOW;
60
61     private static Logger JavaDoc _logger = null; // LogDomains.getLogger( LogDomains.RSR_LOGGER );
62

63     public WSMonitoringLevelListener(String JavaDoc n, String JavaDoc mName, String JavaDoc ctxRoot,
64         boolean isa, String JavaDoc v, String JavaDoc appName, boolean isEjbM) {
65         name = n;
66         moduleName = mName;
67         this.ctxRoot = ctxRoot;
68         isStandAlone = isa;
69         vs = v;
70         j2eeAppName = appName;
71         isEjbModule = isEjbM;
72     }
73
74     /**
75      * @see com.sun.enterprise.admin.monitor.registry.MonitoringLevelListener
76      * #setLevel(com.sun.enterprise.admin.monitor.registry.MonitoringLevel)
77      * @deprecated
78      */

79     //remove after admin removes it
80
public void setLevel( MonitoringLevel level ) {}
81     
82     /**
83      * This is the callback invoked by the MonitoringRegistry
84      * on change in monitoring level
85      *
86      * @param from - the past level
87      * @param to - the new level
88      * @param handback - the Stats object this listener was registered for
89      * @deprecated
90      */

91     public void changeLevel( MonitoringLevel from, MonitoringLevel to,
92         Stats JavaDoc handback ) {
93
94         try {
95             new MonitoringLifeCycleImpl().instrumentMonitoring(name,
96                 moduleName, ctxRoot, isStandAlone, vs, j2eeAppName, from, to,
97                 isEjbModule);
98         } catch (Exception JavaDoc e) {
99             // XXX log warning message
100
}
101     }
102
103     public void changeLevel(MonitoringLevel from, MonitoringLevel to,
104             MonitoredObjectType type) {
105
106         try {
107             new MonitoringLifeCycleImpl().instrumentMonitoring(name,
108                 moduleName, ctxRoot, isStandAlone, vs, j2eeAppName, from, to,
109                 isEjbModule);
110         } catch (Exception JavaDoc e) {
111             // XXX log warning message
112
}
113     }
114
115     // -------- PRIVATE VARIABLES -----
116

117     private String JavaDoc ctxRoot = null;
118     String JavaDoc name = null;
119     String JavaDoc moduleName = null;
120     boolean isStandAlone;
121     String JavaDoc vs = null;
122     String JavaDoc j2eeAppName = null;
123     boolean isEjbModule;
124 }
125
Popular Tags