| 1 | /* |
|---|
| 2 | * $Id$ |
|---|
| 3 | * |
|---|
| 4 | * Copyright 2006, The jCoderZ.org Project. All rights reserved. |
|---|
| 5 | * |
|---|
| 6 | * Redistribution and use in source and binary forms, with or without |
|---|
| 7 | * modification, are permitted provided that the following conditions are |
|---|
| 8 | * met: |
|---|
| 9 | * |
|---|
| 10 | * * Redistributions of source code must retain the above copyright |
|---|
| 11 | * notice, this list of conditions and the following disclaimer. |
|---|
| 12 | * * Redistributions in binary form must reproduce the above |
|---|
| 13 | * copyright notice, this list of conditions and the following |
|---|
| 14 | * disclaimer in the documentation and/or other materials |
|---|
| 15 | * provided with the distribution. |
|---|
| 16 | * * Neither the name of the jCoderZ.org Project nor the names of |
|---|
| 17 | * its contributors may be used to endorse or promote products |
|---|
| 18 | * derived from this software without specific prior written |
|---|
| 19 | * permission. |
|---|
| 20 | * |
|---|
| 21 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS" AND |
|---|
| 22 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
|---|
| 23 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
|---|
| 24 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS AND CONTRIBUTORS |
|---|
| 25 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
|---|
| 26 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
|---|
| 27 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR |
|---|
| 28 | * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, |
|---|
| 29 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR |
|---|
| 30 | * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF |
|---|
| 31 | * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
|---|
| 32 | */ |
|---|
| 33 | package org.jcoderz.commons; |
|---|
| 34 | |
|---|
| 35 | import java.io.Serializable; |
|---|
| 36 | import java.util.List; |
|---|
| 37 | import java.util.Map; |
|---|
| 38 | import java.util.logging.Level; |
|---|
| 39 | |
|---|
| 40 | |
|---|
| 41 | /** |
|---|
| 42 | * Interface for the log message info data structure. |
|---|
| 43 | * Implementations for this type are expected to be generated from |
|---|
| 44 | * MessageInfo xml files. Data in here is bound to the Message and |
|---|
| 45 | * not to specific log events. |
|---|
| 46 | * |
|---|
| 47 | * @author Andreas Mandel |
|---|
| 48 | */ |
|---|
| 49 | public interface LogMessageInfo |
|---|
| 50 | extends Serializable |
|---|
| 51 | { |
|---|
| 52 | /** |
|---|
| 53 | * Returns the symbolic name for this log message info. |
|---|
| 54 | * @return the symbolic name for this log message info. |
|---|
| 55 | */ |
|---|
| 56 | String getSymbol (); |
|---|
| 57 | |
|---|
| 58 | /** |
|---|
| 59 | * Returns the integer code representation of this log message info. This |
|---|
| 60 | * should be logged in hexadecimal form for increasing human readability. |
|---|
| 61 | * |
|---|
| 62 | * @return integer code of this log message info. |
|---|
| 63 | */ |
|---|
| 64 | int toInt (); |
|---|
| 65 | |
|---|
| 66 | /** |
|---|
| 67 | * Returns the log level that should be used (by default) for this message. |
|---|
| 68 | * @return the log level that should be used (by default) for this message. |
|---|
| 69 | */ |
|---|
| 70 | Level getLogLevel (); |
|---|
| 71 | |
|---|
| 72 | /** |
|---|
| 73 | * Returns the message pattern used to create detailed messages for |
|---|
| 74 | * this message type. |
|---|
| 75 | * The string can contain parameters as described for |
|---|
| 76 | * {@link java.text.MessageFormat}. The order of the parameters is |
|---|
| 77 | * given by the parameter list {@link #getParameterList()}. |
|---|
| 78 | * @return the detailed message for this message type with no |
|---|
| 79 | * parameters substituted. |
|---|
| 80 | */ |
|---|
| 81 | String getMessagePattern (); |
|---|
| 82 | |
|---|
| 83 | /** |
|---|
| 84 | * Fills the detail message into the given string buffer with it's |
|---|
| 85 | * parameters substituted. |
|---|
| 86 | * @param parameters The map of parameters to be substituted. |
|---|
| 87 | * @param buffer the StringBuffer to be filled. |
|---|
| 88 | * @return the buffer argument. |
|---|
| 89 | */ |
|---|
| 90 | StringBuffer formatMessage (Map parameters, StringBuffer buffer); |
|---|
| 91 | |
|---|
| 92 | /** |
|---|
| 93 | * Returns a string describing the <b>possible</b> solution for this |
|---|
| 94 | * message. This might also contain a descriptive text about the |
|---|
| 95 | * reason. |
|---|
| 96 | * @return a string describing the <b>possible</b> solution for this |
|---|
| 97 | * message. |
|---|
| 98 | */ |
|---|
| 99 | String getSolution (); |
|---|
| 100 | |
|---|
| 101 | /** |
|---|
| 102 | * Returns the <b>possible</b> business impact of the event that |
|---|
| 103 | * triggered this message to be dumped. |
|---|
| 104 | * @return the <b>possible</b> business impact of the event that |
|---|
| 105 | * triggered this message to be dumped. |
|---|
| 106 | */ |
|---|
| 107 | BusinessImpact getBusinessImpact (); |
|---|
| 108 | |
|---|
| 109 | /** |
|---|
| 110 | * Returns the category of the event that triggered this message to be |
|---|
| 111 | * dumped. |
|---|
| 112 | * |
|---|
| 113 | * @return the category of the event that triggered this message to be |
|---|
| 114 | * dumped. |
|---|
| 115 | */ |
|---|
| 116 | Category getCategory (); |
|---|
| 117 | |
|---|
| 118 | /** |
|---|
| 119 | * Returns a List of Strings containing the name of the parameters |
|---|
| 120 | * that are used by this message. The order of the parameter must |
|---|
| 121 | * accord to the parameters used in the message pattern. |
|---|
| 122 | * @return list of possible parameter names (Strings). |
|---|
| 123 | */ |
|---|
| 124 | List getParameterList (); |
|---|
| 125 | |
|---|
| 126 | /** |
|---|
| 127 | * Returns the application name as string. |
|---|
| 128 | * @return the application name as string. |
|---|
| 129 | */ |
|---|
| 130 | String getAppName (); |
|---|
| 131 | |
|---|
| 132 | /** |
|---|
| 133 | * Returns the application name abbreviation as string. |
|---|
| 134 | * @return the application name abbreviation as string. |
|---|
| 135 | */ |
|---|
| 136 | String getAppNameAbbreviation (); |
|---|
| 137 | |
|---|
| 138 | /** |
|---|
| 139 | * Returns the group name as string. |
|---|
| 140 | * @return the group name as string. |
|---|
| 141 | */ |
|---|
| 142 | String getGroupName (); |
|---|
| 143 | |
|---|
| 144 | /** |
|---|
| 145 | * Returns the group name abbreviation as string. |
|---|
| 146 | * @return the group name abbreviation as string. |
|---|
| 147 | */ |
|---|
| 148 | String getGroupNameAbbreviation (); |
|---|
| 149 | |
|---|
| 150 | } |
|---|