KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > util > monolog > wrapper > remote > api > MonologFactoryMBean


1 /**
2  * Copyright (C) 2001-2005 France Telecom R&D
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17  */

18 package org.objectweb.util.monolog.wrapper.remote.api;
19
20 import org.objectweb.util.monolog.api.Level;
21
22 import java.util.Map JavaDoc;
23 import java.util.Properties JavaDoc;
24
25 /**
26  * Defines a MBean for managing the 3 Monolog concepts: Logger, Handler and
27  * Level
28  *
29  * @see org.objectweb.util.monolog.wrapper.remote.api.LoggerInfo
30  * @author S.Chassande-Barrioz
31  */

32 public interface MonologFactoryMBean {
33
34
35     /**
36      * It defines a new Level with a name and an integer value.
37      * @param name is the name of the new level
38      * @param value is the integer value of the new level
39      * @return true if the level has been created.
40      */

41     boolean defineLevel(String JavaDoc name, int value);
42
43     /**
44      * It defines a new Level with a name and a string value. The string value
45      * is analyzed to obtain the integer value.
46      * @param name is the name of the new level
47      * @param value is the string value of the new level
48      * @return true if the level has been created.
49      */

50     boolean defineLevel(String JavaDoc name, String JavaDoc value);
51
52     /**
53      * It removes a Level instance to this manager.
54      */

55     void removeLevel(String JavaDoc name);
56
57     /**
58      * It retrieves a Level instance which the name is equals to the parameter.
59      * @param name is the name of request Level
60      * @return a Leve instance or a null value if the level does not exist.
61      */

62     Level getLevel(String JavaDoc name);
63
64     /**
65      * It retrieves a Level instance which the integer value is equals to the
66      * parameter.
67      * @param value is the integer value of request Level
68      * @return a Leve instance or a null value if the level does not exist. As
69      * it is possible to define several Levels which have the same integer value
70      * this methods returns the Level instance of first name found in the list.
71      */

72     Level getLevel(int value);
73
74     /**
75      * It retrieves all Level instances defined in this manager.
76      */

77     Level[] getLevels();
78
79     /**
80      * Compares two levels.
81      * @param levelname1 is the name of the first level
82      * @param levelname2 is the name of the second level
83      * @returns a
84      * negative integer, zero, or a positive integer as the first level is less than,
85      * equal to, or greater than the second level.
86      */

87     int compareTo(String JavaDoc levelname1, String JavaDoc levelname2);
88
89     /**
90      * Creates a new handler
91      * @param hn is the name of the handler to create
92      * @param handlertype is the type of the parameter. The possible value are
93      * defined in this interface by the XXX_HANDLER_TYPE constants.
94      * @return true if the handler has been created
95      */

96     boolean createHandler(String JavaDoc hn, String JavaDoc handlertype);
97
98     /**
99      * It removes the handler which the name is specified by the parameter
100      * @param handlername is the name of the handler
101      * @return true if the handler has been removed.
102      */

103     boolean removeHandler(String JavaDoc handlername);
104
105     /**
106      * It retrieves name of all handler managed by this factory.
107      */

108     String JavaDoc[] getHandlerNames();
109
110     /**
111      * It retrieves the attributes of an handler
112      * @param handlername is the name of the handler
113      * @return a map containing the association between an attribute name
114      * (String) and an attribute value (String).
115      */

116     Map JavaDoc getHandlerAttributes(String JavaDoc handlername);
117
118     /**
119      * It retrieves the attributes of all handlers
120      * @return Map(
121      * String handlername,
122      * Map(String attributename, String attributevalue)
123      * )
124      */

125     Map JavaDoc getAllHandlerAttributes() ;
126     
127     /**
128      * Assignes a value to an handler attribute.
129      * @param handlername is the name of the handler
130      * @param attributeName is the name of the attribute
131      * @param value is the new value of the attribute
132      */

133     void setHandlerAttribute(String JavaDoc handlername,
134             String JavaDoc attributeName,
135             String JavaDoc value);
136     
137     
138     /**
139      * Creates a logger if it does not exist.
140      * @param loggername is the name of the logger
141      */

142     LoggerInfo getLogger(String JavaDoc loggername);
143     
144     /**
145      * Creates a logger if it does not exist.
146      * @param loggername is the name of the logger
147      * @param resourceBundleName allows specifying the name of a
148      * resource bundle in order to internationalise the logging.
149      */

150     LoggerInfo getLogger(String JavaDoc key, String JavaDoc resourceBundleName);
151     
152     /**
153      * Accessors to a resource bundle name associated to a LoggerFactory.
154      */

155     String JavaDoc getResourceBundleName();
156     
157     /**
158      * Accessors to a resource bundle name associated to a LoggerFactory.
159      */

160     void setResourceBundleName(String JavaDoc resourceBundleName);
161
162     /**
163      * It retrieves a list of all loggers.
164      */

165     LoggerInfo[] getLoggers();
166
167     /**
168      * A TopicalLogger manages a list of Handler instances. This method
169      * allows adding a handler to this list. The addHandler method returns
170      * true only if the Handler did not exist
171      */

172     void addHandlerToLogger(String JavaDoc handlerName, String JavaDoc loggerName);
173
174     /**
175     * A TopicalLogger manages a list of Handler instances. This method
176     * allows removing a handler to this list.
177     */

178     void removeHandlerFromLogger(String JavaDoc handlerName, String JavaDoc loggerName);
179
180     /**
181     * A TopicalLogger manages a list of Handler instances. This method
182     * allows removing all handler.
183     */

184    void removeAllHandlersFromLogger(String JavaDoc loggerName);
185
186     /**
187      * It assigns the additivity flag for this logger instance.
188      */

189     void setAdditivity(boolean a, String JavaDoc loggerName);
190     
191     /**
192      * It assigns a level to a logger.
193      * @param level is an int value corresponding to a level
194      * @param loggerName is the name of logger which the level must be set.
195      */

196     void setLoggerLevel(int level, String JavaDoc loggerName);
197
198     /**
199      * It assigns a level to a logger. If the level name does not match any
200      * existing level, the level is not set on the logger.
201      * @param level is a string value corresponding to a level defined into the
202      * LevelFactory
203      * @param loggerName is the name of logger which the level must be set.
204      */

205     void setLoggerLevel(String JavaDoc levelName, String JavaDoc loggerName);
206
207     /**
208      *This method allows adding a topic to a TopicalLogger. This actions change
209      * the hierarchical structure, but also the list of handlers. The list of handlers
210      * of a TopicalLogger is composed of its handlers and all handlers inherited
211      * from its parents. Adding a topic changes the inherited handlers list.
212      */

213     void addTopicToLogger(String JavaDoc topic, String JavaDoc loggerName) ;
214
215     /**
216      *This method allows removing a topic to a TopicalLogger. This actions change
217      * the hierarchical structure, but also the list of handlers. The list of handlers
218      * of a TopicalLogger is composed of its handlers and all handlers inherited
219      * from its parents. Removing a topic changes the inherited handlers list.
220      */

221     void removeTopicFromLogger(String JavaDoc topic, String JavaDoc loggerName) ;
222     
223     /**
224      * Retrieves the properties corresponding to the current configuration.
225      */

226     Properties JavaDoc getMonologProperties();
227     
228     /**
229      * Configure Monolog with properties.
230      */

231     void setMonologProperties(Properties JavaDoc p);
232 }
233
Popular Tags