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