001: /**
002: * Copyright (C) 2001-2003 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.api;
018:
019: /**
020: * Handler is an output. For example a
021: * handler might be a console, a file, a socket, or a Logger.
022: *
023: * @author Sebastien Chassande-Barrioz
024: */
025: public interface Handler {
026:
027: // Handler constant types //
028: //------------------------//
029:
030: /**
031: * This constant is used to represent an handler which stores message into
032: * one file.
033: * @deprecated the type is a string now: "file"
034: */
035: byte FILE_HANDLER_TYPE = 1;
036:
037: /**
038: * This constant is used to represent an handler which prints message on
039: * a console.
040: * @deprecated the type is a string now: "console"
041: */
042: byte CONSOLE_HANDLER_TYPE = 2;
043:
044: /**
045: * This constant is used to represent an handler which stores message into
046: * several files.
047: */
048: byte ROLLING_FILE_HANDLER_TYPE = 3;
049:
050: /**
051: * This constant is used to represent an handler which stores message into
052: * several files.
053: * @deprecated the type is a string now: "generic"
054: */
055: byte GENERIC_HANDLER_TYPE = 4;
056:
057: /**
058: * This constant is used to represent an handler which is a Logger.
059: * @deprecated the type is a string now: "logger"
060: */
061: byte LOGGER_HANDLER_TYPE = 5;
062:
063: /**
064: * This constant is used to represent a handler witch is a JMX notification emetter.
065: * @deprecated the type is a string now: "logger"
066: */
067: byte JMX_HANDLER_TYPE = 6;
068:
069: // Handler attributes //
070: //--------------------//
071:
072: String OUTPUT_ATTRIBUTE = "output";
073: String PATTERN_ATTRIBUTE = "pattern";
074: String LEVEL_ATTRIBUTE = "level";
075:
076: String APPEND_MODE_ATTRIBUTE = "appendMode";
077:
078: String FILE_NUMBER_ATTRIBUTE = "fileNumber";
079: String MAX_SIZE_ATTRIBUTE = "maxSize";
080: String BUFFER_ATTRIBUTE = "bufferSize";
081:
082: /**
083: * It retrieves the name of the handler
084: */
085: String getName();
086:
087: /**
088: * It assigns the name of the handler
089: */
090: void setName(String name);
091:
092: /**
093: * It retrieves the Handler type
094: */
095: String getType();
096:
097: /**
098: * It retrieves the attributes of the handler
099: */
100: String[] getAttributeNames();
101:
102: /**
103: * It retrieves the value of an attribute value of the handler.
104: * @param name is an attribute name
105: */
106: Object getAttribute(String name);
107:
108: /**
109: * It assigns an attributte to the handler.
110: * @param name is the attribute name
111: * @param value is the attribute value
112: * @return the old value is the attribute was already defined
113: */
114: Object setAttribute(String name, Object value);
115: }
|