summaryrefslogtreecommitdiffstats
path: root/pki/base/common/src/com/netscape/certsrv/logging/ILogEventListener.java
blob: 12c09b0bcc9a83fa4870e91153ebf9e1e9eadf3b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
// --- BEGIN COPYRIGHT BLOCK ---
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; version 2 of the License.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License along
// with this program; if not, write to the Free Software Foundation, Inc.,
// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
//
// (C) 2007 Red Hat, Inc.
// All rights reserved.
// --- END COPYRIGHT BLOCK ---
package com.netscape.certsrv.logging;


import java.io.IOException;
import java.util.EventListener;
import java.util.Hashtable;
import java.util.Vector;

import javax.servlet.ServletException;

import com.netscape.certsrv.base.EBaseException;
import com.netscape.certsrv.base.IConfigStore;
import com.netscape.certsrv.base.ISubsystem;
import com.netscape.certsrv.common.NameValuePairs;



/**
 * An interface represents a log event listener.
 * A ILogEventListener is registered to  a specific
 * ILogQueue to be notified of created ILogEvents.
 * the log queue will notify all its registered listeners
 * of the logged event. The listener will then proceed to
 * process the event accordingly which will result in a log
 * message existing in some file.
 *
 * @version $Revision$, $Date$
 */
public interface ILogEventListener extends EventListener {

    /**
     *  The event notification method: Logs event.
     *
     * @param event The log event to be processed.
     */
    public void log(ILogEvent event) throws ELogException;

    /**
     *  Flushes the log buffers (if any). Will result in the messages
     *  being actually written to their destination.
     */
    public void flush();

    /**
     *  Closes the log file and destroys any associated threads.
     */
    public void shutdown();

    /**
     * Get the configuration store for the log event listener.
     * @return The configuration store of this log event listener.
     */
    public IConfigStore getConfigStore();

    /**
     * Initialize this log listener
	 * @param owner The subsystem.
	 * @param config Configuration store for this log listener.
	 * @exception initialization error.
     */
    public void init(ISubsystem owner, IConfigStore config) 
        throws EBaseException;

    /**
     * Startup the instance.
     */
    public void startup()
        throws EBaseException;

    /**
     * Retrieve last "maxLine" number of system logs with log level >"level"
     * and from  source "source". If the parameter is omitted. All entries
     * are sent back.
         * @param req a Hashtable containing the required information such as
         * log entry, log level, log source, and log name.
         * @return NameValue pair list of log messages.
         * @exception ServletException For Servelet errros.
         * @exception IOException For input/output problems.
         * @exception EBaseException For other problems.
     */
    public NameValuePairs retrieveLogContent(Hashtable req) throws ServletException,
            IOException, EBaseException;

    /**
    * Retrieve list of log files.
    *
    */
    public NameValuePairs retrieveLogList(Hashtable req) throws ServletException,
            IOException, EBaseException;

    /**
     * Returns implementation name.
     * @return String name of event listener implementation.
     */
    public String getImplName();

    /**
     * Returns the description of this log event listener.
     * @return String with listener description.
     */
    public String getDescription();

    /**
    * Return list of default config parameters for this log event listener.
    * @return Vector of default parameters.
    */
    public Vector getDefaultParams();

    /**
    * Return list of instance config parameters for this log event listener.
    * @return Vector of instance parameters.
    */
    public Vector getInstanceParams();
}