KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jahia > services > audit > JahiaAuditLogManagerService


1 //
2
// ____.
3
// __/\ ______| |__/\. _______
4
// __ .____| | \ | +----+ \
5
// _______| /--| | | - \ _ | : - \_________
6
// \\______: :---| : : | : | \________>
7
// |__\---\_____________:______: :____|____:_____\
8
// /_____|
9
//
10
// . . . i n j a h i a w e t r u s t . . .
11
//
12
// MJ 19.02.2001
13
//
14
//
15
//
16

17
18 package org.jahia.services.audit;
19
20 import java.util.ArrayList JavaDoc;
21
22 import org.jahia.data.JahiaDOMObject;
23 import org.jahia.data.events.JahiaEvent;
24 import org.jahia.exceptions.JahiaException;
25 import org.jahia.params.ParamBean;
26 import org.jahia.services.JahiaService;
27 import org.jahia.services.usermanager.JahiaUser;
28
29
30 /**
31  * The audit log manager takes care of writing audit log entries for any events that should
32  * be logged and to retrieve those entries for display or sending as a file.
33  *
34  *
35  * @author Mikha�l Janson
36  * @version 1.0
37  */

38
39 public abstract class JahiaAuditLogManagerService extends JahiaService {
40
41     private String JavaDoc mServiceName = "JahiaAuditLogManager";
42
43
44     /**
45      * standard access method to log an Event
46      *
47      * @param je a reference to the JahiaEvent object to log
48      * @param objectType an <code>int</code> representing the type of the of the logged event
49      * @param operationStr a <code>String</code> containing the message logged with the event
50      */

51     public abstract boolean logEvent (JahiaEvent je, int objectType, String JavaDoc operationStr);
52
53
54     /**
55      * utility method to retrieve log entries for a specific object type and ID
56      *
57      * @param objectType an <code>int</code> representing the object type to retrieve
58      * @param objectID an <code>int</code> representing the ID of the object to retrieve logs for
59      * @return a <code>List</code> of HashMaps containing keys for time, username, operation, and their value for each logged event
60      */

61     public abstract ArrayList JavaDoc getLog (int objectType, int objectID, ParamBean jParams);
62
63
64     /**
65      * utility method to retrieve all log entries
66      *
67      * @return a <code>List</code> of HashMaps containing keys for time, username, operation, and their value for each logged event
68      */

69     public abstract ArrayList JavaDoc getLog (ParamBean jParams);
70
71     /**
72      * utility method to flush log entries for a specific object type and ID
73      *
74      * @param objectType an <code>int</code> representing the object type to retrieve
75      * @param objectID an <code>int</code> representing the ID of the object to retrieve logs for
76      * @param jParams a <code>ParamBean</code> object
77      * @return a <code>List</code> of HashMaps containing keys for time, username, operation, and their value for each logged event
78      */

79     public abstract int flushLogs (int objectType, int objectID, ParamBean jParams);
80
81     /**
82      * utility method to flush all log entries
83      *
84      * @param theUser a reference to the JahiaUser object representing the administrator user requesting the flush
85      * @return true on success, false on any error
86      */

87     //public abstract boolean flushLogs ( JahiaUser theUser );
88

89     /**
90      * utility method to flush all log entries older than a given number of days
91      *
92      * @param theUser a reference to the JahiaUser object representing the administrator user requesting the flush
93      * @return true on success, false on any error
94      */

95     public abstract boolean flushLogs (JahiaUser theUser, Integer JavaDoc maxlogsdays);
96
97     /**
98      * utility method to flush all log entries of a site
99      *
100      * @param theUser a reference to the JahiaUser object representing the administrator user requesting the flush
101      * @return true on success, false on any error
102      */

103     public abstract boolean flushSiteLogs (JahiaUser theUser, String JavaDoc siteKey);
104
105
106     /**
107      * utility method to delete superfluous log entries when the maxLogs property has been set to a lower
108      * value than the current number of entries
109      *
110      * @param maxLogs the new maximal value for the number of log entries
111      * @param maxlogsdays the number of days to keep existing log entries for
112      * @return the number of rows deleted
113      */

114     public abstract int enforceMaxLogs (int MaxLogs);
115
116     //--------------------------------------------------------------------------
117
/**
118      * return a DOM document of all logs of a site
119      *
120      * @param String the site key
121      *
122      * @return JahiaDOMObject a DOM representation of this object
123      *
124      * @author NK
125      */

126     public abstract JahiaDOMObject getLogsAsDOM (String JavaDoc siteKey)
127             throws JahiaException;
128
129
130 } // end JahiaDBAuditLogManager
131

132
133
134
Popular Tags