KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > enterprise > admin > event > LogLevelChangeEvent


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.event;
24
25 /**
26  * LogLevelChangeEvent is used to represent change in the log level for
27  * a module. Log levels and modules are configured in the configuration
28  * file element module-log-levels.
29  */

30 public class LogLevelChangeEvent extends AdminEvent {
31
32     /**
33      * Event type
34      */

35     static final String JavaDoc eventType = LogLevelChangeEvent.class.getName();
36
37     /**
38      * Logger module name
39      */

40     private String JavaDoc moduleName;
41  
42     /**
43      * Old log level
44      */

45     private String JavaDoc oldLogLevel;
46
47     /**
48      * New log level
49      */

50     private String JavaDoc newLogLevel;
51
52     /**
53      * true when this event represents property changes in the
54      * module-log-level element
55      */

56     private boolean propertyChanged = false;
57
58     /**
59      * name of the modified property
60      */

61     private String JavaDoc modifiedPropertyName = null;
62
63     /**
64      * Creates a new instance of LogLevelChangeEvent
65      * @param instanceName the server instance affected by the change
66      */

67     public LogLevelChangeEvent(String JavaDoc instanceName) {
68         this(eventType, instanceName);
69     }
70
71     /**
72      * Creates a new instance of LogLevelChangeEvent
73      * @eventType type of the event
74      * @param instanceName the server instance affected by the change
75      */

76     protected LogLevelChangeEvent(String JavaDoc eventType, String JavaDoc instanceName) {
77         super(eventType, instanceName);
78     }
79
80     /**
81      * Get name of the module for which log level has changed. The name
82      * of the module is defined in the dtd for configuration.
83      */

84     public String JavaDoc getModuleName() {
85         return moduleName;
86     }
87
88     /**
89      * Set module name.
90      * @param moduleName name of the module for which the event is being created
91      */

92     void setModuleName(String JavaDoc moduleName) {
93         this.moduleName = moduleName;
94     }
95
96     /**
97      * Get old log level for the module returned by method getModuleName().
98      * The log levels are defined in dtd for configuration
99      */

100     public String JavaDoc getOldLogLevel() {
101         return oldLogLevel;
102     }
103
104     /**
105      * Set old log level
106      */

107     void setOldLogLevel(String JavaDoc oldLevel) {
108         oldLogLevel = oldLevel;
109     }
110
111     /**
112      * Get new log level for the module returned by method getModuleName().
113      * The log levels are defined in the dtd for configuration
114      */

115     public String JavaDoc getNewLogLevel() {
116         return newLogLevel;
117     }
118
119     /**
120      * Set new log level
121      */

122     void setNewLogLevel(String JavaDoc newLevel) {
123         this.newLogLevel = newLevel;
124     }
125     
126     /**
127      * Returns true when propery changed for module-log-levels.
128      *
129      * @return true when property changed for module-log-levels
130      */

131     public boolean isPropertyChanged() {
132         return this.propertyChanged;
133     }
134
135     /**
136      * Sets the property change flag for module-log-levels.
137      *
138      * @param tf val for property change flag
139      */

140     void setPropertyChanged(boolean tf) {
141         this.propertyChanged = tf;
142     }
143
144     /**
145      * Returns the name of the modified property when isPropertyChanged is true.
146      * @return name of the modified property or null
147      */

148     public String JavaDoc getPropertyName() {
149         return this.modifiedPropertyName;
150     }
151
152     /**
153      * Sets the name of the modified property.
154      * @param name name of the modified property
155      */

156     void setPropertyName(String JavaDoc name) {
157         this.modifiedPropertyName = name;
158     }
159 }
160
Popular Tags