|
|||||||||||||||||||
30 day Evaluation Version distributed via the Maven Jar Repository. Clover is not free. You have 30 days to evaluate it. Please visit http://www.thecortex.net/clover to obtain a licensed version of Clover | |||||||||||||||||||
Source file | Conditionals | Statements | Methods | TOTAL | |||||||||||||||
LogSession.java | - | 0% | 0% | 0% |
|
1 |
/*
|
|
2 |
* Joey and its relative products are published under the terms
|
|
3 |
* of the Apache Software License.
|
|
4 |
*/
|
|
5 |
/*
|
|
6 |
* Created on 2004/02/29
|
|
7 |
*/
|
|
8 |
package org.asyrinx.brownie.hibernate.logger;
|
|
9 |
|
|
10 |
import java.io.Serializable;
|
|
11 |
import java.sql.Connection;
|
|
12 |
import java.util.Collection;
|
|
13 |
import java.util.Iterator;
|
|
14 |
import java.util.List;
|
|
15 |
|
|
16 |
import net.sf.hibernate.Criteria;
|
|
17 |
import net.sf.hibernate.FlushMode;
|
|
18 |
import net.sf.hibernate.HibernateException;
|
|
19 |
import net.sf.hibernate.LockMode;
|
|
20 |
import net.sf.hibernate.Query;
|
|
21 |
import net.sf.hibernate.ReplicationMode;
|
|
22 |
import net.sf.hibernate.Session;
|
|
23 |
import net.sf.hibernate.SessionFactory;
|
|
24 |
import net.sf.hibernate.Transaction;
|
|
25 |
import net.sf.hibernate.type.Type;
|
|
26 |
|
|
27 |
import org.asyrinx.brownie.core.log.CascadeNamedLog;
|
|
28 |
import org.asyrinx.brownie.hibernate.wrapper.SessionWrapper;
|
|
29 |
|
|
30 |
/**
|
|
31 |
* @author akima
|
|
32 |
*/
|
|
33 |
public class LogSession extends SessionWrapper { |
|
34 |
|
|
35 |
/**
|
|
36 |
* @param wrapped
|
|
37 |
* @param log
|
|
38 |
*/
|
|
39 | 0 |
public LogSession(Session wrapped, CascadeNamedLog parentLog) {
|
40 | 0 |
super(wrapped);
|
41 | 0 |
this.log = parentLog.subLog(wrapped);
|
42 |
} |
|
43 |
|
|
44 |
protected final CascadeNamedLog log;
|
|
45 |
|
|
46 |
/**
|
|
47 |
* @see net.sf.hibernate.Session#beginTransaction()
|
|
48 |
*/
|
|
49 | 0 |
public Transaction beginTransaction() throws HibernateException { |
50 | 0 |
log.log("beginTransaction()");
|
51 | 0 |
return new LogTransaction(super.beginTransaction(), log); |
52 |
} |
|
53 |
|
|
54 |
/**
|
|
55 |
* @see net.sf.hibernate.Session#cancelQuery()
|
|
56 |
*/
|
|
57 | 0 |
public void cancelQuery() throws HibernateException { |
58 | 0 |
log.log("cancelQuery()");
|
59 | 0 |
super.cancelQuery();
|
60 |
} |
|
61 |
|
|
62 |
/**
|
|
63 |
* @see net.sf.hibernate.Session#clear()
|
|
64 |
*/
|
|
65 | 0 |
public void clear() { |
66 | 0 |
log.log("clear()");
|
67 | 0 |
super.clear();
|
68 |
} |
|
69 |
|
|
70 |
/**
|
|
71 |
* @see net.sf.hibernate.Session#close()
|
|
72 |
*/
|
|
73 | 0 |
public Connection close() throws HibernateException { |
74 | 0 |
log.log("close()");
|
75 | 0 |
return super.close(); |
76 |
} |
|
77 |
|
|
78 |
/**
|
|
79 |
* @see net.sf.hibernate.Session#connection()
|
|
80 |
*/
|
|
81 | 0 |
public Connection connection() throws HibernateException { |
82 | 0 |
log.log("connection()");
|
83 | 0 |
return super.connection(); |
84 |
} |
|
85 |
|
|
86 |
/**
|
|
87 |
* @see net.sf.hibernate.Session#contains(java.lang.Object)
|
|
88 |
*/
|
|
89 | 0 |
public boolean contains(Object object) { |
90 | 0 |
log.log("contains(" + object + ")"); |
91 | 0 |
return super.contains(object); |
92 |
} |
|
93 |
|
|
94 |
/**
|
|
95 |
* @see net.sf.hibernate.Session#createCriteria(java.lang.Class)
|
|
96 |
*/
|
|
97 | 0 |
public Criteria createCriteria(Class persistentClass) {
|
98 | 0 |
log.log("createCriteria(" + persistentClass + ")"); |
99 | 0 |
return new LogCriteria(super.createCriteria(persistentClass), log); |
100 |
} |
|
101 |
|
|
102 |
/**
|
|
103 |
* @see net.sf.hibernate.Session#createFilter(java.lang.Object,
|
|
104 |
* java.lang.String)
|
|
105 |
*/
|
|
106 | 0 |
public Query createFilter(Object collection, String queryString)
|
107 |
throws HibernateException {
|
|
108 | 0 |
log.log("createFilter(" + collection + ", " + queryString + ")"); |
109 | 0 |
return new LogQuery(super.createFilter(collection, queryString), log); |
110 |
} |
|
111 |
|
|
112 |
/**
|
|
113 |
* @see net.sf.hibernate.Session#createQuery(java.lang.String)
|
|
114 |
*/
|
|
115 | 0 |
public Query createQuery(String queryString) throws HibernateException { |
116 | 0 |
log.log("createQuery(" + queryString + ")"); |
117 | 0 |
return new LogQuery(super.createQuery(queryString), log); |
118 |
} |
|
119 |
|
|
120 |
/**
|
|
121 |
* @see net.sf.hibernate.Session#createSQLQuery(java.lang.String,
|
|
122 |
* java.lang.String, java.lang.Class)
|
|
123 |
*/
|
|
124 | 0 |
public Query createSQLQuery(String sql, String returnAlias,
|
125 |
Class returnClass) { |
|
126 | 0 |
log.log("createQuery(" + sql + ", " + returnAlias + ", " |
127 |
+ returnClass.getName() + ", " + ")"); |
|
128 | 0 |
return new LogQuery( |
129 |
super.createSQLQuery(sql, returnAlias, returnClass), log);
|
|
130 |
} |
|
131 |
|
|
132 |
/**
|
|
133 |
* @see net.sf.hibernate.Session#createSQLQuery(java.lang.String,
|
|
134 |
* java.lang.String[], java.lang.Class[])
|
|
135 |
*/
|
|
136 | 0 |
public Query createSQLQuery(String sql, String[] returnAliases,
|
137 |
Class[] returnClasses) { |
|
138 | 0 |
log.log("createQuery(" + sql + ", " + returnAliases + ", " |
139 |
+ returnClasses + ", " + ")"); |
|
140 | 0 |
return new LogQuery(super.createSQLQuery(sql, returnAliases, |
141 |
returnClasses), log); |
|
142 |
} |
|
143 |
|
|
144 |
/**
|
|
145 |
* @see net.sf.hibernate.Session#delete(java.lang.Object)
|
|
146 |
*/
|
|
147 | 0 |
public void delete(Object object) throws HibernateException { |
148 | 0 |
log.log("delete(" + object + ")"); |
149 | 0 |
super.delete(object);
|
150 |
} |
|
151 |
|
|
152 |
/**
|
|
153 |
* @see net.sf.hibernate.Session#delete(java.lang.String, java.lang.Object,
|
|
154 |
* net.sf.hibernate.type.Type)
|
|
155 |
*/
|
|
156 | 0 |
public int delete(String query, Object value, Type type) |
157 |
throws HibernateException {
|
|
158 | 0 |
log.log("delete(" + query + ", " + value + ", " + type + ")"); |
159 | 0 |
return super.delete(query, value, type); |
160 |
} |
|
161 |
|
|
162 |
/**
|
|
163 |
* @see net.sf.hibernate.Session#delete(java.lang.String,
|
|
164 |
* java.lang.Object[], net.sf.hibernate.type.Type[])
|
|
165 |
*/
|
|
166 | 0 |
public int delete(String query, Object[] values, Type[] types) |
167 |
throws HibernateException {
|
|
168 | 0 |
log.log("delete(" + query + ", " + values + ", " + types + ")"); |
169 | 0 |
return super.delete(query, values, types); |
170 |
} |
|
171 |
|
|
172 |
/**
|
|
173 |
* @see net.sf.hibernate.Session#delete(java.lang.String)
|
|
174 |
*/
|
|
175 | 0 |
public int delete(String query) throws HibernateException { |
176 | 0 |
log.log("delete(" + query + ")"); |
177 | 0 |
return super.delete(query); |
178 |
} |
|
179 |
|
|
180 |
/**
|
|
181 |
* @see net.sf.hibernate.Session#disconnect()
|
|
182 |
*/
|
|
183 | 0 |
public Connection disconnect() throws HibernateException { |
184 | 0 |
log.log("disconnect()");
|
185 | 0 |
return super.disconnect(); |
186 |
} |
|
187 |
|
|
188 |
/**
|
|
189 |
* @see net.sf.hibernate.Session#evict(java.lang.Object)
|
|
190 |
*/
|
|
191 | 0 |
public void evict(Object object) throws HibernateException { |
192 | 0 |
log.log("evict(" + object + ")"); |
193 | 0 |
super.evict(object);
|
194 |
} |
|
195 |
|
|
196 |
/**
|
|
197 |
* @see net.sf.hibernate.Session#filter(java.lang.Object, java.lang.String,
|
|
198 |
* java.lang.Object, net.sf.hibernate.type.Type)
|
|
199 |
*/
|
|
200 | 0 |
public Collection filter(Object collection, String filter, Object value,
|
201 |
Type type) throws HibernateException {
|
|
202 | 0 |
log.log("filter(" + collection + ", " + filter + ", " + value + ", " |
203 |
+ type + ")");
|
|
204 | 0 |
return super.filter(collection, filter, value, type); |
205 |
} |
|
206 |
|
|
207 |
/**
|
|
208 |
* @see net.sf.hibernate.Session#filter(java.lang.Object, java.lang.String,
|
|
209 |
* java.lang.Object[], net.sf.hibernate.type.Type[])
|
|
210 |
*/
|
|
211 | 0 |
public Collection filter(Object collection, String filter, Object[] values,
|
212 |
Type[] types) throws HibernateException {
|
|
213 | 0 |
log.log("filter(" + collection + ", " + filter + ", " + values + ", " |
214 |
+ types + ")");
|
|
215 | 0 |
return super.filter(collection, filter, values, types); |
216 |
} |
|
217 |
|
|
218 |
/**
|
|
219 |
* @see net.sf.hibernate.Session#filter(java.lang.Object, java.lang.String)
|
|
220 |
*/
|
|
221 | 0 |
public Collection filter(Object collection, String filter)
|
222 |
throws HibernateException {
|
|
223 | 0 |
log.log("filter(" + collection + ", " + filter + ")"); |
224 | 0 |
return super.filter(collection, filter); |
225 |
} |
|
226 |
|
|
227 |
/**
|
|
228 |
* @see net.sf.hibernate.Session#find(java.lang.String, java.lang.Object,
|
|
229 |
* net.sf.hibernate.type.Type)
|
|
230 |
*/
|
|
231 | 0 |
public List find(String query, Object value, Type type)
|
232 |
throws HibernateException {
|
|
233 | 0 |
log.log("find(" + query + ", " + value + ", " + type + ")"); |
234 | 0 |
return super.find(query, value, type); |
235 |
} |
|
236 |
|
|
237 |
/**
|
|
238 |
* @see net.sf.hibernate.Session#find(java.lang.String, java.lang.Object[],
|
|
239 |
* net.sf.hibernate.type.Type[])
|
|
240 |
*/
|
|
241 | 0 |
public List find(String query, Object[] values, Type[] types)
|
242 |
throws HibernateException {
|
|
243 | 0 |
log.log("find(" + query + ", " + values + ", " + types + ")"); |
244 | 0 |
return super.find(query, values, types); |
245 |
} |
|
246 |
|
|
247 |
/**
|
|
248 |
* @see net.sf.hibernate.Session#find(java.lang.String)
|
|
249 |
*/
|
|
250 | 0 |
public List find(String query) throws HibernateException { |
251 | 0 |
log.log("find(" + query + ")"); |
252 | 0 |
return super.find(query); |
253 |
} |
|
254 |
|
|
255 |
/**
|
|
256 |
* @see net.sf.hibernate.Session#flush()
|
|
257 |
*/
|
|
258 | 0 |
public void flush() throws HibernateException { |
259 | 0 |
log.log("flush()");
|
260 | 0 |
super.flush();
|
261 |
} |
|
262 |
|
|
263 |
/**
|
|
264 |
* @see net.sf.hibernate.Session#get(java.lang.Class, java.io.Serializable,
|
|
265 |
* net.sf.hibernate.LockMode)
|
|
266 |
*/
|
|
267 | 0 |
public Object get(Class clazz, Serializable id, LockMode lockMode)
|
268 |
throws HibernateException {
|
|
269 | 0 |
log.log("get(" + clazz + "," + id + "," + lockMode + ")"); |
270 | 0 |
return super.get(clazz, id, lockMode); |
271 |
} |
|
272 |
|
|
273 |
/**
|
|
274 |
* @see net.sf.hibernate.Session#get(java.lang.Class, java.io.Serializable)
|
|
275 |
*/
|
|
276 | 0 |
public Object get(Class clazz, Serializable id) throws HibernateException { |
277 | 0 |
log.log("get(" + clazz + "," + id + ")"); |
278 | 0 |
return super.get(clazz, id); |
279 |
} |
|
280 |
|
|
281 |
/**
|
|
282 |
* @see net.sf.hibernate.Session#getCurrentLockMode(java.lang.Object)
|
|
283 |
*/
|
|
284 | 0 |
public LockMode getCurrentLockMode(Object object) throws HibernateException { |
285 | 0 |
return super.getCurrentLockMode(object); |
286 |
} |
|
287 |
|
|
288 |
/**
|
|
289 |
* @see net.sf.hibernate.Session#getFlushMode()
|
|
290 |
*/
|
|
291 | 0 |
public FlushMode getFlushMode() {
|
292 | 0 |
return super.getFlushMode(); |
293 |
} |
|
294 |
|
|
295 |
/**
|
|
296 |
* @see net.sf.hibernate.Session#getIdentifier(java.lang.Object)
|
|
297 |
*/
|
|
298 | 0 |
public Serializable getIdentifier(Object object) throws HibernateException { |
299 | 0 |
log.log("getIdentifier(" + object + ")"); |
300 | 0 |
return super.getIdentifier(object); |
301 |
} |
|
302 |
|
|
303 |
/**
|
|
304 |
* @see net.sf.hibernate.Session#getNamedQuery(java.lang.String)
|
|
305 |
*/
|
|
306 | 0 |
public Query getNamedQuery(String queryName) throws HibernateException { |
307 | 0 |
log.log("getNamedQuery(" + queryName + ")"); |
308 | 0 |
return new LogQuery(super.getNamedQuery(queryName), log); |
309 |
} |
|
310 |
|
|
311 |
/**
|
|
312 |
* @see net.sf.hibernate.Session#getSessionFactory()
|
|
313 |
*/
|
|
314 | 0 |
public SessionFactory getSessionFactory() {
|
315 | 0 |
log.log("getSessionFactory()");
|
316 | 0 |
return new LogSessionFactory(super.getSessionFactory(), log); |
317 |
} |
|
318 |
|
|
319 |
/**
|
|
320 |
* @see net.sf.hibernate.Session#isConnected()
|
|
321 |
*/
|
|
322 | 0 |
public boolean isConnected() { |
323 | 0 |
return super.isConnected(); |
324 |
} |
|
325 |
|
|
326 |
/**
|
|
327 |
* @see net.sf.hibernate.Session#isOpen()
|
|
328 |
*/
|
|
329 | 0 |
public boolean isOpen() { |
330 | 0 |
return super.isOpen(); |
331 |
} |
|
332 |
|
|
333 |
/**
|
|
334 |
* @see net.sf.hibernate.Session#iterate(java.lang.String, java.lang.Object,
|
|
335 |
* net.sf.hibernate.type.Type)
|
|
336 |
*/
|
|
337 | 0 |
public Iterator iterate(String query, Object value, Type type)
|
338 |
throws HibernateException {
|
|
339 | 0 |
return super.iterate(query, value, type); |
340 |
} |
|
341 |
|
|
342 |
/**
|
|
343 |
* @see net.sf.hibernate.Session#iterate(java.lang.String,
|
|
344 |
* java.lang.Object[], net.sf.hibernate.type.Type[])
|
|
345 |
*/
|
|
346 | 0 |
public Iterator iterate(String query, Object[] values, Type[] types)
|
347 |
throws HibernateException {
|
|
348 | 0 |
return super.iterate(query, values, types); |
349 |
} |
|
350 |
|
|
351 |
/**
|
|
352 |
* @see net.sf.hibernate.Session#iterate(java.lang.String)
|
|
353 |
*/
|
|
354 | 0 |
public Iterator iterate(String query) throws HibernateException { |
355 | 0 |
return super.iterate(query); |
356 |
} |
|
357 |
|
|
358 |
/**
|
|
359 |
* @see net.sf.hibernate.Session#load(java.lang.Class, java.io.Serializable,
|
|
360 |
* net.sf.hibernate.LockMode)
|
|
361 |
*/
|
|
362 | 0 |
public Object load(Class theClass, Serializable id, LockMode lockMode)
|
363 |
throws HibernateException {
|
|
364 | 0 |
log.log("load(" + theClass + ", " + id + ", " + lockMode + ")"); |
365 | 0 |
return super.load(theClass, id, lockMode); |
366 |
} |
|
367 |
|
|
368 |
/**
|
|
369 |
* @see net.sf.hibernate.Session#load(java.lang.Class, java.io.Serializable)
|
|
370 |
*/
|
|
371 | 0 |
public Object load(Class theClass, Serializable id)
|
372 |
throws HibernateException {
|
|
373 | 0 |
log.log("load(" + theClass + ", " + id + ")"); |
374 | 0 |
return super.load(theClass, id); |
375 |
} |
|
376 |
|
|
377 |
/**
|
|
378 |
* @see net.sf.hibernate.Session#load(java.lang.Object,
|
|
379 |
* java.io.Serializable)
|
|
380 |
*/
|
|
381 | 0 |
public void load(Object object, Serializable id) throws HibernateException { |
382 | 0 |
log.log("load(" + object + ", " + id + ")"); |
383 | 0 |
super.load(object, id);
|
384 |
} |
|
385 |
|
|
386 |
/**
|
|
387 |
* @see net.sf.hibernate.Session#lock(java.lang.Object,
|
|
388 |
* net.sf.hibernate.LockMode)
|
|
389 |
*/
|
|
390 | 0 |
public void lock(Object object, LockMode lockMode) |
391 |
throws HibernateException {
|
|
392 | 0 |
log.log("lock(" + object + ", " + lockMode + ")"); |
393 | 0 |
super.lock(object, lockMode);
|
394 |
} |
|
395 |
|
|
396 |
/**
|
|
397 |
* @see net.sf.hibernate.Session#reconnect()
|
|
398 |
*/
|
|
399 | 0 |
public void reconnect() throws HibernateException { |
400 | 0 |
log.log("reconnect()");
|
401 | 0 |
super.reconnect();
|
402 |
} |
|
403 |
|
|
404 |
/**
|
|
405 |
* @see net.sf.hibernate.Session#reconnect(java.sql.Connection)
|
|
406 |
*/
|
|
407 | 0 |
public void reconnect(Connection connection) throws HibernateException { |
408 | 0 |
log.log("reconnect(" + connection + ")"); |
409 | 0 |
super.reconnect(connection);
|
410 |
} |
|
411 |
|
|
412 |
/**
|
|
413 |
* @see net.sf.hibernate.Session#refresh(java.lang.Object,
|
|
414 |
* net.sf.hibernate.LockMode)
|
|
415 |
*/
|
|
416 | 0 |
public void refresh(Object object, LockMode lockMode) |
417 |
throws HibernateException {
|
|
418 | 0 |
log.log("refresh(" + object + ", " + lockMode + ")"); |
419 | 0 |
super.refresh(object, lockMode);
|
420 |
} |
|
421 |
|
|
422 |
/**
|
|
423 |
* @see net.sf.hibernate.Session#refresh(java.lang.Object)
|
|
424 |
*/
|
|
425 | 0 |
public void refresh(Object object) throws HibernateException { |
426 | 0 |
log.log("refresh(" + object + ")"); |
427 | 0 |
super.refresh(object);
|
428 |
} |
|
429 |
|
|
430 |
/**
|
|
431 |
* @see net.sf.hibernate.Session#replicate(java.lang.Object,
|
|
432 |
* net.sf.hibernate.ReplicationMode)
|
|
433 |
*/
|
|
434 | 0 |
public void replicate(Object object, ReplicationMode replicationMode) |
435 |
throws HibernateException {
|
|
436 | 0 |
log.log("replicate(" + object + ", " + replicationMode + ")"); |
437 | 0 |
super.replicate(object, replicationMode);
|
438 |
} |
|
439 |
|
|
440 |
/**
|
|
441 |
* @see net.sf.hibernate.Session#save(java.lang.Object,
|
|
442 |
* java.io.Serializable)
|
|
443 |
*/
|
|
444 | 0 |
public void save(Object object, Serializable id) throws HibernateException { |
445 | 0 |
log.log("save(" + object + ", " + id + ")"); |
446 | 0 |
super.save(object, id);
|
447 |
} |
|
448 |
|
|
449 |
/**
|
|
450 |
* @see net.sf.hibernate.Session#save(java.lang.Object)
|
|
451 |
*/
|
|
452 | 0 |
public Serializable save(Object object) throws HibernateException { |
453 | 0 |
log.log("save(" + object + ")"); |
454 | 0 |
return super.save(object); |
455 |
} |
|
456 |
|
|
457 |
/**
|
|
458 |
* @see net.sf.hibernate.Session#saveOrUpdate(java.lang.Object)
|
|
459 |
*/
|
|
460 | 0 |
public void saveOrUpdate(Object object) throws HibernateException { |
461 | 0 |
log.log("saveOrUpdate(" + object + ")"); |
462 | 0 |
super.saveOrUpdate(object);
|
463 |
} |
|
464 |
|
|
465 |
/**
|
|
466 |
* @see net.sf.hibernate.Session#saveOrUpdateCopy(java.lang.Object,
|
|
467 |
* java.io.Serializable)
|
|
468 |
*/
|
|
469 | 0 |
public Object saveOrUpdateCopy(Object object, Serializable id)
|
470 |
throws HibernateException {
|
|
471 | 0 |
log.log("saveOrUpdateCopy(" + object + ", " + id + ")"); |
472 | 0 |
return super.saveOrUpdateCopy(object, id); |
473 |
} |
|
474 |
|
|
475 |
/**
|
|
476 |
* @see net.sf.hibernate.Session#saveOrUpdateCopy(java.lang.Object)
|
|
477 |
*/
|
|
478 | 0 |
public Object saveOrUpdateCopy(Object object) throws HibernateException { |
479 | 0 |
log.log("saveOrUpdateCopy(" + object + ")"); |
480 | 0 |
return super.saveOrUpdateCopy(object); |
481 |
} |
|
482 |
|
|
483 |
/**
|
|
484 |
* @see net.sf.hibernate.Session#setFlushMode(net.sf.hibernate.FlushMode)
|
|
485 |
*/
|
|
486 | 0 |
public void setFlushMode(FlushMode flushMode) { |
487 | 0 |
log.log("setFlushMode(" + flushMode + ")"); |
488 | 0 |
super.setFlushMode(flushMode);
|
489 |
} |
|
490 |
|
|
491 |
/**
|
|
492 |
* @see net.sf.hibernate.Session#update(java.lang.Object,
|
|
493 |
* java.io.Serializable)
|
|
494 |
*/
|
|
495 | 0 |
public void update(Object object, Serializable id) |
496 |
throws HibernateException {
|
|
497 | 0 |
log.log("update(" + object + ", " + id + ")"); |
498 | 0 |
super.update(object, id);
|
499 |
} |
|
500 |
|
|
501 |
/**
|
|
502 |
* @see net.sf.hibernate.Session#update(java.lang.Object)
|
|
503 |
*/
|
|
504 | 0 |
public void update(Object object) throws HibernateException { |
505 | 0 |
log.log("update(" + object + ")"); |
506 | 0 |
super.update(object);
|
507 |
} |
|
508 |
|
|
509 |
} |
|