001: /**
002: * Copyright (C) 2001-2005 France Telecom R&D
003: *
004: * This library is free software; you can redistribute it and/or
005: * modify it under the terms of the GNU Lesser General Public
006: * License as published by the Free Software Foundation; either
007: * version 2 of the License, or (at your option) any later version.
008: *
009: * This library is distributed in the hope that it will be useful,
010: * but WITHOUT ANY WARRANTY; without even the implied warranty of
011: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
012: * Lesser General Public License for more details.
013: *
014: * You should have received a copy of the GNU Lesser General Public
015: * License along with this library; if not, write to the Free Software
016: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
017: */package org.objectweb.util.monolog.wrapper.remote.api;
018:
019: import org.objectweb.util.monolog.api.Level;
020:
021: import java.util.Map;
022: import java.util.Properties;
023:
024: /**
025: * Defines a MBean for managing the 3 Monolog concepts: Logger, Handler and
026: * Level
027: *
028: * @see org.objectweb.util.monolog.wrapper.remote.api.LoggerInfo
029: * @author S.Chassande-Barrioz
030: */
031: public interface MonologFactoryMBean {
032:
033: /**
034: * It defines a new Level with a name and an integer value.
035: * @param name is the name of the new level
036: * @param value is the integer value of the new level
037: * @return true if the level has been created.
038: */
039: boolean defineLevel(String name, int value);
040:
041: /**
042: * It defines a new Level with a name and a string value. The string value
043: * is analyzed to obtain the integer value.
044: * @param name is the name of the new level
045: * @param value is the string value of the new level
046: * @return true if the level has been created.
047: */
048: boolean defineLevel(String name, String value);
049:
050: /**
051: * It removes a Level instance to this manager.
052: */
053: void removeLevel(String name);
054:
055: /**
056: * It retrieves a Level instance which the name is equals to the parameter.
057: * @param name is the name of request Level
058: * @return a Leve instance or a null value if the level does not exist.
059: */
060: Level getLevel(String name);
061:
062: /**
063: * It retrieves a Level instance which the integer value is equals to the
064: * parameter.
065: * @param value is the integer value of request Level
066: * @return a Leve instance or a null value if the level does not exist. As
067: * it is possible to define several Levels which have the same integer value
068: * this methods returns the Level instance of first name found in the list.
069: */
070: Level getLevel(int value);
071:
072: /**
073: * It retrieves all Level instances defined in this manager.
074: */
075: Level[] getLevels();
076:
077: /**
078: * Compares two levels.
079: * @param levelname1 is the name of the first level
080: * @param levelname2 is the name of the second level
081: * @returns a
082: * negative integer, zero, or a positive integer as the first level is less than,
083: * equal to, or greater than the second level.
084: */
085: int compareTo(String levelname1, String levelname2);
086:
087: /**
088: * Creates a new handler
089: * @param hn is the name of the handler to create
090: * @param handlertype is the type of the parameter. The possible value are
091: * defined in this interface by the XXX_HANDLER_TYPE constants.
092: * @return true if the handler has been created
093: */
094: boolean createHandler(String hn, String handlertype);
095:
096: /**
097: * It removes the handler which the name is specified by the parameter
098: * @param handlername is the name of the handler
099: * @return true if the handler has been removed.
100: */
101: boolean removeHandler(String handlername);
102:
103: /**
104: * It retrieves name of all handler managed by this factory.
105: */
106: String[] getHandlerNames();
107:
108: /**
109: * It retrieves the attributes of an handler
110: * @param handlername is the name of the handler
111: * @return a map containing the association between an attribute name
112: * (String) and an attribute value (String).
113: */
114: Map getHandlerAttributes(String handlername);
115:
116: /**
117: * It retrieves the attributes of all handlers
118: * @return Map(
119: * String handlername,
120: * Map(String attributename, String attributevalue)
121: * )
122: */
123: Map getAllHandlerAttributes();
124:
125: /**
126: * Assignes a value to an handler attribute.
127: * @param handlername is the name of the handler
128: * @param attributeName is the name of the attribute
129: * @param value is the new value of the attribute
130: */
131: void setHandlerAttribute(String handlername, String attributeName,
132: String value);
133:
134: /**
135: * Creates a logger if it does not exist.
136: * @param loggername is the name of the logger
137: */
138: LoggerInfo getLogger(String loggername);
139:
140: /**
141: * Creates a logger if it does not exist.
142: * @param loggername is the name of the logger
143: * @param resourceBundleName allows specifying the name of a
144: * resource bundle in order to internationalise the logging.
145: */
146: LoggerInfo getLogger(String key, String resourceBundleName);
147:
148: /**
149: * Accessors to a resource bundle name associated to a LoggerFactory.
150: */
151: String getResourceBundleName();
152:
153: /**
154: * Accessors to a resource bundle name associated to a LoggerFactory.
155: */
156: void setResourceBundleName(String resourceBundleName);
157:
158: /**
159: * It retrieves a list of all loggers.
160: */
161: LoggerInfo[] getLoggers();
162:
163: /**
164: * A TopicalLogger manages a list of Handler instances. This method
165: * allows adding a handler to this list. The addHandler method returns
166: * true only if the Handler did not exist
167: */
168: void addHandlerToLogger(String handlerName, String loggerName);
169:
170: /**
171: * A TopicalLogger manages a list of Handler instances. This method
172: * allows removing a handler to this list.
173: */
174: void removeHandlerFromLogger(String handlerName, String loggerName);
175:
176: /**
177: * A TopicalLogger manages a list of Handler instances. This method
178: * allows removing all handler.
179: */
180: void removeAllHandlersFromLogger(String loggerName);
181:
182: /**
183: * It assigns the additivity flag for this logger instance.
184: */
185: void setAdditivity(boolean a, String loggerName);
186:
187: /**
188: * It assigns a level to a logger.
189: * @param level is an int value corresponding to a level
190: * @param loggerName is the name of logger which the level must be set.
191: */
192: void setLoggerLevel(int level, String loggerName);
193:
194: /**
195: * It assigns a level to a logger. If the level name does not match any
196: * existing level, the level is not set on the logger.
197: * @param level is a string value corresponding to a level defined into the
198: * LevelFactory
199: * @param loggerName is the name of logger which the level must be set.
200: */
201: void setLoggerLevel(String levelName, String loggerName);
202:
203: /**
204: *This method allows adding a topic to a TopicalLogger. This actions change
205: * the hierarchical structure, but also the list of handlers. The list of handlers
206: * of a TopicalLogger is composed of its handlers and all handlers inherited
207: * from its parents. Adding a topic changes the inherited handlers list.
208: */
209: void addTopicToLogger(String topic, String loggerName);
210:
211: /**
212: *This method allows removing a topic to a TopicalLogger. This actions change
213: * the hierarchical structure, but also the list of handlers. The list of handlers
214: * of a TopicalLogger is composed of its handlers and all handlers inherited
215: * from its parents. Removing a topic changes the inherited handlers list.
216: */
217: void removeTopicFromLogger(String topic, String loggerName);
218:
219: /**
220: * Retrieves the properties corresponding to the current configuration.
221: */
222: Properties getMonologProperties();
223:
224: /**
225: * Configure Monolog with properties.
226: */
227: void setMonologProperties(Properties p);
228: }
|