|
|||||||||||||||||||
| 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 | |||||||||||||||
| LogSessionFactory.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.Map;
|
|
| 13 |
|
|
| 14 |
import javax.naming.NamingException;
|
|
| 15 |
import javax.naming.Reference;
|
|
| 16 |
|
|
| 17 |
import net.sf.hibernate.Databinder;
|
|
| 18 |
import net.sf.hibernate.HibernateException;
|
|
| 19 |
import net.sf.hibernate.Interceptor;
|
|
| 20 |
import net.sf.hibernate.Session;
|
|
| 21 |
import net.sf.hibernate.SessionFactory;
|
|
| 22 |
import net.sf.hibernate.metadata.ClassMetadata;
|
|
| 23 |
import net.sf.hibernate.metadata.CollectionMetadata;
|
|
| 24 |
|
|
| 25 |
import org.asyrinx.brownie.core.log.CascadeNamedLog;
|
|
| 26 |
import org.asyrinx.brownie.core.log.DispatchLog;
|
|
| 27 |
import org.asyrinx.brownie.hibernate.wrapper.SessionFactoryWrapper;
|
|
| 28 |
|
|
| 29 |
/**
|
|
| 30 |
* @author akima
|
|
| 31 |
*/
|
|
| 32 |
public class LogSessionFactory extends SessionFactoryWrapper { |
|
| 33 |
|
|
| 34 |
/**
|
|
| 35 |
*
|
|
| 36 |
*/
|
|
| 37 | 0 |
public LogSessionFactory() {
|
| 38 | 0 |
super();
|
| 39 | 0 |
this.log = new CascadeNamedLog(this.getClass()); |
| 40 |
} |
|
| 41 |
|
|
| 42 |
/**
|
|
| 43 |
*
|
|
| 44 |
*/
|
|
| 45 | 0 |
public LogSessionFactory(SessionFactory source, CascadeNamedLog parentLog) {
|
| 46 | 0 |
super();
|
| 47 | 0 |
setSource(source); |
| 48 | 0 |
this.log = parentLog.subLog(source);
|
| 49 |
} |
|
| 50 |
|
|
| 51 |
private final CascadeNamedLog log;
|
|
| 52 |
|
|
| 53 |
/**
|
|
| 54 |
* @return
|
|
| 55 |
*/
|
|
| 56 | 0 |
public String getDefaultLevel() {
|
| 57 | 0 |
return log.getDefaultLevel();
|
| 58 |
} |
|
| 59 |
|
|
| 60 |
/**
|
|
| 61 |
* @return
|
|
| 62 |
*/
|
|
| 63 | 0 |
public String getLoggerName() {
|
| 64 | 0 |
return log.getLoggerName();
|
| 65 |
} |
|
| 66 |
|
|
| 67 |
/**
|
|
| 68 |
* @param string
|
|
| 69 |
*/
|
|
| 70 | 0 |
public void setDefaultLevel(String string) { |
| 71 | 0 |
log.setDefaultLevel(string); |
| 72 |
} |
|
| 73 |
|
|
| 74 |
/**
|
|
| 75 |
* @param string
|
|
| 76 |
*/
|
|
| 77 | 0 |
public void setLoggerName(String string) { |
| 78 | 0 |
log.setLoggerName(string); |
| 79 |
} |
|
| 80 |
|
|
| 81 | 0 |
private DispatchLog getLog() {
|
| 82 | 0 |
return log;
|
| 83 |
} |
|
| 84 |
|
|
| 85 |
/**
|
|
| 86 |
* @see net.sf.hibernate.SessionFactory#close()
|
|
| 87 |
*/
|
|
| 88 | 0 |
public void close() throws HibernateException { |
| 89 | 0 |
getLog().log("close()");
|
| 90 | 0 |
super.close();
|
| 91 |
} |
|
| 92 |
|
|
| 93 |
/**
|
|
| 94 |
* @see net.sf.hibernate.SessionFactory#evict(java.lang.Class,
|
|
| 95 |
* java.io.Serializable)
|
|
| 96 |
*/
|
|
| 97 | 0 |
public void evict(Class persistentClass, Serializable id) |
| 98 |
throws HibernateException {
|
|
| 99 | 0 |
getLog().log("evict(" + persistentClass.getName() + ", " + id + ")"); |
| 100 | 0 |
super.evict(persistentClass, id);
|
| 101 |
} |
|
| 102 |
|
|
| 103 |
/**
|
|
| 104 |
* @see net.sf.hibernate.SessionFactory#evict(java.lang.Class)
|
|
| 105 |
*/
|
|
| 106 | 0 |
public void evict(Class persistentClass) throws HibernateException { |
| 107 | 0 |
getLog().log("evict(" + persistentClass.getName() + ")"); |
| 108 | 0 |
super.evict(persistentClass);
|
| 109 |
} |
|
| 110 |
|
|
| 111 |
/**
|
|
| 112 |
* @see net.sf.hibernate.SessionFactory#evictCollection(java.lang.String,
|
|
| 113 |
* java.io.Serializable)
|
|
| 114 |
*/
|
|
| 115 | 0 |
public void evictCollection(String roleName, Serializable id) |
| 116 |
throws HibernateException {
|
|
| 117 | 0 |
getLog().log("evict(" + roleName + ", " + id + ")"); |
| 118 | 0 |
super.evictCollection(roleName, id);
|
| 119 |
} |
|
| 120 |
|
|
| 121 |
/**
|
|
| 122 |
* @see net.sf.hibernate.SessionFactory#evictCollection(java.lang.String)
|
|
| 123 |
*/
|
|
| 124 | 0 |
public void evictCollection(String roleName) throws HibernateException { |
| 125 | 0 |
getLog().log("evict(" + roleName + ")"); |
| 126 | 0 |
super.evictCollection(roleName);
|
| 127 |
} |
|
| 128 |
|
|
| 129 |
/**
|
|
| 130 |
* @see net.sf.hibernate.SessionFactory#evictQueries()
|
|
| 131 |
*/
|
|
| 132 | 0 |
public void evictQueries() throws HibernateException { |
| 133 | 0 |
getLog().log("evictQueries()");
|
| 134 | 0 |
super.evictQueries();
|
| 135 |
} |
|
| 136 |
|
|
| 137 |
/**
|
|
| 138 |
* @see net.sf.hibernate.SessionFactory#evictQueries(java.lang.String)
|
|
| 139 |
*/
|
|
| 140 | 0 |
public void evictQueries(String cacheRegion) throws HibernateException { |
| 141 | 0 |
getLog().log("evictQueries(" + cacheRegion + ")"); |
| 142 | 0 |
super.evictQueries(cacheRegion);
|
| 143 |
} |
|
| 144 |
|
|
| 145 |
/**
|
|
| 146 |
* @see net.sf.hibernate.SessionFactory#getAllClassMetadata()
|
|
| 147 |
*/
|
|
| 148 | 0 |
public Map getAllClassMetadata() throws HibernateException { |
| 149 | 0 |
return super.getAllClassMetadata(); |
| 150 |
} |
|
| 151 |
|
|
| 152 |
/**
|
|
| 153 |
* @see net.sf.hibernate.SessionFactory#getAllCollectionMetadata()
|
|
| 154 |
*/
|
|
| 155 | 0 |
public Map getAllCollectionMetadata() throws HibernateException { |
| 156 | 0 |
return super.getAllCollectionMetadata(); |
| 157 |
} |
|
| 158 |
|
|
| 159 |
/**
|
|
| 160 |
* @see net.sf.hibernate.SessionFactory#getClassMetadata(java.lang.Class)
|
|
| 161 |
*/
|
|
| 162 | 0 |
public ClassMetadata getClassMetadata(Class persistentClass)
|
| 163 |
throws HibernateException {
|
|
| 164 | 0 |
return super.getClassMetadata(persistentClass); |
| 165 |
} |
|
| 166 |
|
|
| 167 |
/**
|
|
| 168 |
* @see net.sf.hibernate.SessionFactory#getCollectionMetadata(java.lang.String)
|
|
| 169 |
*/
|
|
| 170 | 0 |
public CollectionMetadata getCollectionMetadata(String roleName)
|
| 171 |
throws HibernateException {
|
|
| 172 | 0 |
return super.getCollectionMetadata(roleName); |
| 173 |
} |
|
| 174 |
|
|
| 175 |
/**
|
|
| 176 |
* @see javax.naming.Referenceable#getReference()
|
|
| 177 |
*/
|
|
| 178 | 0 |
public Reference getReference() throws NamingException { |
| 179 | 0 |
return super.getReference(); |
| 180 |
} |
|
| 181 |
|
|
| 182 |
/**
|
|
| 183 |
* @see net.sf.hibernate.SessionFactory#openDatabinder()
|
|
| 184 |
*/
|
|
| 185 | 0 |
public Databinder openDatabinder() throws HibernateException { |
| 186 | 0 |
getLog().log("openDatabinder()");
|
| 187 | 0 |
return new LogDatabinder(super.openDatabinder(), log); |
| 188 |
} |
|
| 189 |
|
|
| 190 |
/**
|
|
| 191 |
* @see net.sf.hibernate.SessionFactory#openSession()
|
|
| 192 |
*/
|
|
| 193 | 0 |
public Session openSession() throws HibernateException { |
| 194 | 0 |
getLog().log("openSession()");
|
| 195 | 0 |
return new LogSession(super.openSession(), log); |
| 196 |
} |
|
| 197 |
|
|
| 198 |
/**
|
|
| 199 |
* @see net.sf.hibernate.SessionFactory#openSession(java.sql.Connection,
|
|
| 200 |
* net.sf.hibernate.Interceptor)
|
|
| 201 |
*/
|
|
| 202 | 0 |
public Session openSession(Connection connection, Interceptor interceptor) {
|
| 203 | 0 |
getLog().log("openSession(" + connection + ", " + interceptor + ")"); |
| 204 | 0 |
return new LogSession(super.openSession(connection, interceptor), log); |
| 205 |
} |
|
| 206 |
|
|
| 207 |
/**
|
|
| 208 |
* @see net.sf.hibernate.SessionFactory#openSession(java.sql.Connection)
|
|
| 209 |
*/
|
|
| 210 | 0 |
public Session openSession(Connection connection) {
|
| 211 | 0 |
getLog().log("openSession(" + connection + ")"); |
| 212 | 0 |
return new LogSession(super.openSession(connection), log); |
| 213 |
} |
|
| 214 |
|
|
| 215 |
/**
|
|
| 216 |
* @see net.sf.hibernate.SessionFactory#openSession(net.sf.hibernate.Interceptor)
|
|
| 217 |
*/
|
|
| 218 | 0 |
public Session openSession(Interceptor interceptor)
|
| 219 |
throws HibernateException {
|
|
| 220 | 0 |
getLog().log("openSession(" + interceptor + ")"); |
| 221 | 0 |
return new LogSession(super.openSession(interceptor), log); |
| 222 |
} |
|
| 223 |
|
|
| 224 |
} |
|
||||||||||