Author: epbernard
Date: 2008-05-17 08:50:57 -0400 (Sat, 17 May 2008)
New Revision: 14672
Modified:
entitymanager/trunk/ivy.xml
entitymanager/trunk/pom.xml
entitymanager/trunk/src/java/org/hibernate/ejb/AbstractEntityManagerImpl.java
entitymanager/trunk/src/java/org/hibernate/ejb/Ejb3Configuration.java
entitymanager/trunk/src/java/org/hibernate/ejb/EntityManagerImpl.java
entitymanager/trunk/src/java/org/hibernate/ejb/Version.java
entitymanager/trunk/src/java/org/hibernate/ejb/connection/InjectedDataSourceConnectionProvider.java
entitymanager/trunk/src/java/org/hibernate/ejb/event/EJB3PersistEventListener.java
entitymanager/trunk/src/java/org/hibernate/ejb/packaging/AbstractJarVisitor.java
entitymanager/trunk/src/java/org/hibernate/ejb/packaging/ExplodedJarVisitor.java
entitymanager/trunk/src/java/org/hibernate/ejb/packaging/FileZippedJarVisitor.java
entitymanager/trunk/src/java/org/hibernate/ejb/packaging/InputStreamZippedJarVisitor.java
entitymanager/trunk/src/java/org/hibernate/ejb/packaging/JarVisitorFactory.java
entitymanager/trunk/src/java/org/hibernate/ejb/packaging/PersistenceXmlLoader.java
entitymanager/trunk/src/java/org/hibernate/ejb/util/NamingHelper.java
entitymanager/trunk/src/java/org/hibernate/engine/EJB3CascadingAction.java
Log:
EJB-359 move to slf4j
Modified: entitymanager/trunk/ivy.xml
===================================================================
--- entitymanager/trunk/ivy.xml 2008-05-17 12:49:38 UTC (rev 14671)
+++ entitymanager/trunk/ivy.xml 2008-05-17 12:50:57 UTC (rev 14672)
@@ -9,7 +9,7 @@
<conf name="test" visibility="private"
description="Dependencies needed for testing purposes"/>
</configurations>
<publications>
- <artifact name="entitymanager" conf="default"/>
+ <artifact name="hibernate-entitymanager"
conf="default"/>
</publications>
<dependencies>
<!-- compile time dependencies -->
@@ -17,13 +17,13 @@
<dependency name="commons-annotations" rev="latest"
conf="default->default"/>
<dependency name="annotations" rev="latest"
conf="default->default"/>
<dependency org="org.hibernate" name="hibernate-core"
rev="3.3.0.CR1" conf="default->default"/>
- <dependency org="commons-logging" name="commons-logging"
rev="1.0.4" conf="default->default"/>
<dependency org="dom4j" name="dom4j" rev="1.6.1"
conf="default->default"/>
<dependency org="javax.transaction" name="jta"
rev="1.1" conf="default->default"/>
<dependency org="javassist" name="javassist"
rev="3.4.GA" conf="default->default"/>
+ <dependency org="org.slf4j" name="slf4j-api"
rev="1.4.2" conf="default->default"/>
+
<!-- transitive dependencies -->
- <dependency org="org.slf4j" name="slf4j-api"
rev="1.4.2" conf="test->default"/>
<dependency org="antlr" name="antlr" rev="2.7.6"
conf="test->default"/>
<dependency org="commons-collections"
name="commons-collections" rev="3.1"
conf="test->default"/>
Modified: entitymanager/trunk/pom.xml
===================================================================
--- entitymanager/trunk/pom.xml 2008-05-17 12:49:38 UTC (rev 14671)
+++ entitymanager/trunk/pom.xml 2008-05-17 12:50:57 UTC (rev 14672)
@@ -42,10 +42,10 @@
<version>3.3.0.CR1</version>
</dependency>
<dependency>
- <groupId>commons-logging</groupId>
- <artifactId>commons-logging</artifactId>
- <version>1.0.4</version>
- </dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ <version>1.4.2</version>
+ </dependency>
<dependency>
<groupId>dom4j</groupId>
<artifactId>dom4j</artifactId>
Modified: entitymanager/trunk/src/java/org/hibernate/ejb/AbstractEntityManagerImpl.java
===================================================================
---
entitymanager/trunk/src/java/org/hibernate/ejb/AbstractEntityManagerImpl.java 2008-05-17
12:49:38 UTC (rev 14671)
+++
entitymanager/trunk/src/java/org/hibernate/ejb/AbstractEntityManagerImpl.java 2008-05-17
12:50:57 UTC (rev 14672)
@@ -27,8 +27,6 @@
import javax.transaction.SystemException;
import javax.transaction.TransactionManager;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
import org.hibernate.AssertionFailure;
import org.hibernate.FlushMode;
import org.hibernate.HibernateException;
@@ -56,13 +54,15 @@
import org.hibernate.transaction.TransactionFactory;
import org.hibernate.util.JTAHelper;
import org.hibernate.util.CollectionHelper;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* @author <a href="mailto:gavin@hibernate.org">Gavin King</a>
* @author Emmanuel Bernard
*/
public abstract class AbstractEntityManagerImpl implements
HibernateEntityManagerImplementor, Serializable {
- private static Log log = LogFactory.getLog( AbstractEntityManagerImpl.class );
+ private static final Logger log = LoggerFactory.getLogger(
AbstractEntityManagerImpl.class );
protected transient TransactionImpl tx = new TransactionImpl( this );
protected PersistenceContextType persistenceContextType;
@@ -408,7 +408,7 @@
boolean isTransactionActive = isTransactionInProgress();
if ( isTransactionActive && session.getFlushMode() == FlushMode.MANUAL ) {
- log.debug( "Transaction activated, move to FlushMode " + flushModeType );
+ log.debug( "Transaction activated, move to FlushMode {}", flushModeType );
setFlushMode( flushModeType );
}
else if ( ! isTransactionActive && session.getFlushMode() != FlushMode.MANUAL )
{
@@ -559,7 +559,7 @@
);
}
else {
- log.warn( "Cannot join transaction: do not override " +
Environment.TRANSACTION_STRATEGY );
+ log.warn( "Cannot join transaction: do not override {}",
Environment.TRANSACTION_STRATEGY );
}
}
catch (HibernateException he) {
Modified: entitymanager/trunk/src/java/org/hibernate/ejb/Ejb3Configuration.java
===================================================================
--- entitymanager/trunk/src/java/org/hibernate/ejb/Ejb3Configuration.java 2008-05-17
12:49:38 UTC (rev 14671)
+++ entitymanager/trunk/src/java/org/hibernate/ejb/Ejb3Configuration.java 2008-05-17
12:50:57 UTC (rev 14672)
@@ -35,8 +35,6 @@
import javax.persistence.spi.PersistenceUnitTransactionType;
import javax.sql.DataSource;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
import org.dom4j.DocumentException;
import org.dom4j.Element;
import org.dom4j.io.SAXReader;
@@ -81,6 +79,8 @@
import org.hibernate.util.XMLHelper;
import org.xml.sax.EntityResolver;
import org.xml.sax.SAXException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* Allow a fine tuned configuration of an EJB 3.0 EntityManagerFactory
@@ -102,7 +102,7 @@
public class Ejb3Configuration implements Serializable, Referenceable {
private static final String IMPLEMENTATION_NAME = HibernatePersistence.class.getName();
private static final String META_INF_ORM_XML = "META-INF/orm.xml";
- private static Log log = LogFactory.getLog( Ejb3Configuration.class );
+ private final Logger log = LoggerFactory.getLogger( Ejb3Configuration.class );
private static EntityNotFoundDelegate ejb3EntityNotFoundDelegate = new
Ejb3EntityNotFoundDelegate();
private static Configuration DEFAULT_CONFIGURATION = new AnnotationConfiguration();
private String persistenceUnitName;
@@ -155,7 +155,7 @@
* Especially the scanning of classes and additional jars is done already at this
point.
*/
private Ejb3Configuration configure(PersistenceMetadata metadata, Map overrides) {
- log.debug( "Creating Factory: " + metadata.getName() );
+ log.debug( "Creating Factory: {}", metadata.getName() );
Map workingVars = new HashMap();
workingVars.put( HibernatePersistence.PERSISTENCE_UNIT_NAME, metadata.getName() );
@@ -206,7 +206,7 @@
*/
public Ejb3Configuration configure(String persistenceUnitName, Map integration) {
try {
- log.debug( "Look up for persistence unit: " + persistenceUnitName );
+ log.debug( "Look up for persistence unit: {}", persistenceUnitName );
integration = integration == null ?
CollectionHelper.EMPTY_MAP :
Collections.unmodifiableMap( integration );
@@ -218,14 +218,14 @@
}
while ( xmls.hasMoreElements() ) {
URL url = xmls.nextElement();
- log.trace( "Analysing persistence.xml: " + url );
+ log.trace( "Analysing persistence.xml: {}", url );
List<PersistenceMetadata> metadataFiles = PersistenceXmlLoader.deploy(
url,
integration,
cfg.getEntityResolver(),
PersistenceUnitTransactionType.RESOURCE_LOCAL );
for ( PersistenceMetadata metadata : metadataFiles ) {
- log.trace( metadata.toString() );
+ log.trace( "{}", metadata );
if ( metadata.getProvider() == null || IMPLEMENTATION_NAME.equalsIgnoreCase(
metadata.getProvider()
@@ -309,17 +309,17 @@
*/
public Ejb3Configuration configure(PersistenceUnitInfo info, Map integration) {
if ( log.isDebugEnabled() ) {
- log.debug( "Processing " + LogHelper.logPersistenceUnitInfo( info ) );
+ log.debug( "Processing {}", LogHelper.logPersistenceUnitInfo( info ) );
}
else {
- log.info( "Processing PersistenceUnitInfo [\n\tname: " +
info.getPersistenceUnitName() + "\n\t...]" );
+ log.info( "Processing PersistenceUnitInfo [\n\tname: {}\n\t...]",
info.getPersistenceUnitName() );
}
integration = integration != null ? Collections.unmodifiableMap( integration ) :
CollectionHelper.EMPTY_MAP;
String provider = (String) integration.get( HibernatePersistence.PROVIDER );
if ( provider == null ) provider = info.getPersistenceProviderClassName();
if ( provider != null && ! provider.trim().startsWith( IMPLEMENTATION_NAME ) )
{
- log.info( "Required a different provider: " + provider );
+ log.info( "Required a different provider: {}", provider );
return null;
}
if ( info.getClassLoader() == null ) {
@@ -559,7 +559,7 @@
if ( "class".equalsIgnoreCase( element ) ) result[0] = true;
if ( "hbm".equalsIgnoreCase( element ) ) result[1] = true;
}
- log.debug( "Detect class: " + result[0] + "; detect hbm: " +
result[1] );
+ log.debug( "Detect class: {}; detect hbm: {}", result[0], result[1] );
return result;
}
@@ -856,7 +856,7 @@
//some spec compliance checking
//TODO centralize that?
if ( ! "true".equalsIgnoreCase( cfg.getProperty( Environment.AUTOCOMMIT ) ) )
{
- log.warn( Environment.AUTOCOMMIT + " = false break the EJB3 specification"
);
+ log.warn( "{} = false break the EJB3 specification", Environment.AUTOCOMMIT
);
}
discardOnClose = preparedProperties.getProperty(
HibernatePersistence.DISCARD_PC_ON_CLOSE )
.equals( "true" );
@@ -911,10 +911,10 @@
}
if ( log.isInfoEnabled() ) {
if ( Boolean.TRUE.equals( useMetaInf ) ) {
- log.info( getExceptionHeader() + META_INF_ORM_XML + " found");
+ log.info( "{} {} found", getExceptionHeader(), META_INF_ORM_XML);
}
else if (Boolean.FALSE.equals( useMetaInf ) ) {
- log.info( getExceptionHeader() + "no " + META_INF_ORM_XML + "
found");
+ log.info( "{} No {} found", getExceptionHeader(), META_INF_ORM_XML);
}
}
}
@@ -994,12 +994,13 @@
}
if ( hasTxStrategy ) {
log.warn(
- "Overriding " + Environment.TRANSACTION_STRATEGY + " is dangerous,
this might break the EJB3 specification implementation"
+ "Overriding {} is dangerous, this might break the EJB3 specification
implementation",
+ Environment.TRANSACTION_STRATEGY
);
}
if ( preparedProperties.getProperty( Environment.FLUSH_BEFORE_COMPLETION ).equals(
"true" ) ) {
preparedProperties.setProperty( Environment.FLUSH_BEFORE_COMPLETION, "false"
);
- log.warn( "Defining " + Environment.FLUSH_BEFORE_COMPLETION + "=true
ignored in HEM" );
+ log.warn( "Defining {}=true ignored in HEM",
Environment.FLUSH_BEFORE_COMPLETION );
}
return preparedProperties;
}
Modified: entitymanager/trunk/src/java/org/hibernate/ejb/EntityManagerImpl.java
===================================================================
--- entitymanager/trunk/src/java/org/hibernate/ejb/EntityManagerImpl.java 2008-05-17
12:49:38 UTC (rev 14671)
+++ entitymanager/trunk/src/java/org/hibernate/ejb/EntityManagerImpl.java 2008-05-17
12:50:57 UTC (rev 14672)
@@ -7,8 +7,6 @@
import javax.persistence.spi.PersistenceUnitTransactionType;
import javax.transaction.Synchronization;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
import org.hibernate.HibernateException;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
@@ -16,13 +14,15 @@
import org.hibernate.annotations.common.util.ReflectHelper;
import org.hibernate.cfg.Environment;
import org.hibernate.engine.SessionImplementor;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* @author Gavin King
*/
public class EntityManagerImpl extends AbstractEntityManagerImpl {
- private static Log log = LogFactory.getLog( EntityManagerImpl.class );
+ private static final Logger log = LoggerFactory.getLogger( EntityManagerImpl.class );
protected Session session;
protected SessionFactory sessionFactory;
protected boolean open;
@@ -110,9 +110,8 @@
session.close();
}
else {
- log.warn( "Entity Manager closed by someone else ("
- + Environment.AUTO_CLOSE_SESSION
- + " must not be used)");
+ log.warn( "Entity Manager closed by someone else ({} must not be
used)",
+ Environment.AUTO_CLOSE_SESSION);
}
}
//TODO session == null should not happen
Modified: entitymanager/trunk/src/java/org/hibernate/ejb/Version.java
===================================================================
--- entitymanager/trunk/src/java/org/hibernate/ejb/Version.java 2008-05-17 12:49:38 UTC
(rev 14671)
+++ entitymanager/trunk/src/java/org/hibernate/ejb/Version.java 2008-05-17 12:50:57 UTC
(rev 14672)
@@ -1,18 +1,19 @@
//$Id: $
package org.hibernate.ejb;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
/**
* @author Emmanuel Bernard
*/
public class Version {
public static final String VERSION = "3.3.2.GA";
- private static Log log = LogFactory.getLog( Version.class );
+ private static final Logger log = LoggerFactory.getLogger( Version.class );
static {
- log.info( "Hibernate EntityManager " + VERSION );
+ log.info( "Hibernate EntityManager {}", VERSION );
}
public static void touch() {
Modified:
entitymanager/trunk/src/java/org/hibernate/ejb/connection/InjectedDataSourceConnectionProvider.java
===================================================================
---
entitymanager/trunk/src/java/org/hibernate/ejb/connection/InjectedDataSourceConnectionProvider.java 2008-05-17
12:49:38 UTC (rev 14671)
+++
entitymanager/trunk/src/java/org/hibernate/ejb/connection/InjectedDataSourceConnectionProvider.java 2008-05-17
12:50:57 UTC (rev 14672)
@@ -6,11 +6,11 @@
import java.sql.SQLException;
import javax.sql.DataSource;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
import org.hibernate.HibernateException;
import org.hibernate.cfg.Environment;
import org.hibernate.connection.DatasourceConnectionProvider;
+import org.slf4j.LoggerFactory;
+import org.slf4j.Logger;
/**
* A connection provider that uses an injected <tt>DataSource</tt>.
@@ -20,11 +20,10 @@
* @see org.hibernate.connection.ConnectionProvider
*/
public class InjectedDataSourceConnectionProvider extends DatasourceConnectionProvider {
- //TODO make datasource connection provider properties protected in 3.3
private String user;
private String pass;
- private static final Log log = LogFactory.getLog(
InjectedDataSourceConnectionProvider.class );
+ private final Logger log = LoggerFactory.getLogger(
InjectedDataSourceConnectionProvider.class );
public void setDataSource(DataSource ds) {
super.setDataSource( ds );
Modified:
entitymanager/trunk/src/java/org/hibernate/ejb/event/EJB3PersistEventListener.java
===================================================================
---
entitymanager/trunk/src/java/org/hibernate/ejb/event/EJB3PersistEventListener.java 2008-05-17
12:49:38 UTC (rev 14671)
+++
entitymanager/trunk/src/java/org/hibernate/ejb/event/EJB3PersistEventListener.java 2008-05-17
12:50:57 UTC (rev 14672)
@@ -16,7 +16,7 @@
*/
public class EJB3PersistEventListener extends DefaultPersistEventListener implements
CallbackHandlerConsumer {
static {
- EJB3CascadeStyle.PERSIST_EJB3.hasOrphanDelete(); //triggers class loading
+ EJB3CascadeStyle.PERSIST_EJB3.hasOrphanDelete(); //triggers class loading to override
persist with PERSIST_EJB3
}
private EntityCallbackHandler callbackHandler;
Modified:
entitymanager/trunk/src/java/org/hibernate/ejb/packaging/AbstractJarVisitor.java
===================================================================
---
entitymanager/trunk/src/java/org/hibernate/ejb/packaging/AbstractJarVisitor.java 2008-05-17
12:49:38 UTC (rev 14671)
+++
entitymanager/trunk/src/java/org/hibernate/ejb/packaging/AbstractJarVisitor.java 2008-05-17
12:50:57 UTC (rev 14672)
@@ -12,8 +12,8 @@
import javassist.bytecode.AnnotationsAttribute;
import javassist.bytecode.ClassFile;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* Parse a JAR of any form (zip file, exploded directory, ...)
@@ -25,7 +25,7 @@
*/
//TODO shortcut when filters are null or empty
public abstract class AbstractJarVisitor implements JarVisitor {
- private static Log log = LogFactory.getLog( AbstractJarVisitor.class );
+ private final Logger log = LoggerFactory.getLogger( AbstractJarVisitor.class );
protected String unqualifiedJarName;
protected URL jarUrl;
protected boolean done = false;
@@ -113,7 +113,7 @@
fileName = fileName.substring( 0, fileName.length() - 4 );
}
unqualifiedJarName = fileName;
- log.debug( "Searching mapped entities in jar/par: " + jarUrl );
+ log.debug( "Searching mapped entities in jar/par: {}", jarUrl );
}
/**
@@ -159,7 +159,7 @@
}
else if ( entryName.endsWith( ".class" ) ) {
String name = entryName.substring( 0, entryNameLength - ".class".length()
).replace( '/', '.' );
- log.debug( "Filtering: " + name );
+ log.debug( "Filtering: {}", name );
executeJavaElementFilter( name, classFilters, is, secondIs );
}
else {
@@ -177,7 +177,7 @@
secondIs.close();
}
is.close();
- log.debug( "File Filter matched for " + name );
+ log.debug( "File Filter matched for {}", name );
Entry entry = new Entry( name, localIs );
int index = this.filters.indexOf( filter );
this.entries[index].add( entry );
@@ -210,7 +210,7 @@
localIs = null;
secondIs.close();
}
- log.debug( "Java element filter matched for " + name );
+ log.debug( "Java element filter matched for {}", name );
Entry entry = new Entry( name, localIs );
int index = this.filters.indexOf( filter );
this.entries[index].add( entry );
Modified:
entitymanager/trunk/src/java/org/hibernate/ejb/packaging/ExplodedJarVisitor.java
===================================================================
---
entitymanager/trunk/src/java/org/hibernate/ejb/packaging/ExplodedJarVisitor.java 2008-05-17
12:49:38 UTC (rev 14671)
+++
entitymanager/trunk/src/java/org/hibernate/ejb/packaging/ExplodedJarVisitor.java 2008-05-17
12:50:57 UTC (rev 14672)
@@ -5,23 +5,21 @@
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
-import java.io.InputStream;
-import java.io.ByteArrayInputStream;
-import java.net.URL;
import java.net.URISyntaxException;
-import java.util.zip.ZipEntry;
+import java.net.URL;
import java.util.Enumeration;
-import java.util.jar.JarInputStream;
import java.util.jar.JarFile;
+import java.util.zip.ZipEntry;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
+import org.slf4j.LoggerFactory;
+import org.slf4j.Logger;
+
/**
* @author Emmanuel Bernard
*/
public class ExplodedJarVisitor extends AbstractJarVisitor {
- private static Log log = LogFactory.getLog( ExplodedJarVisitor.class );
+ private final Logger log = LoggerFactory.getLogger( ExplodedJarVisitor.class );
private String entry;
public ExplodedJarVisitor(URL url, Filter[] filters, String entry) {
@@ -51,11 +49,11 @@
}
if ( !jarFile.exists() ) {
- log.warn( "Exploded jar does not exists (ignored): " + jarUrl );
+ log.warn( "Exploded jar does not exists (ignored): {}", jarUrl );
return;
}
if ( !jarFile.isDirectory() ) {
- log.warn( "Exploded jar file not a directory (ignored): " + jarUrl );
+ log.warn( "Exploded jar file not a directory (ignored): {}", jarUrl );
return;
}
File rootFile;
Modified:
entitymanager/trunk/src/java/org/hibernate/ejb/packaging/FileZippedJarVisitor.java
===================================================================
---
entitymanager/trunk/src/java/org/hibernate/ejb/packaging/FileZippedJarVisitor.java 2008-05-17
12:49:38 UTC (rev 14671)
+++
entitymanager/trunk/src/java/org/hibernate/ejb/packaging/FileZippedJarVisitor.java 2008-05-17
12:50:57 UTC (rev 14672)
@@ -13,8 +13,8 @@
import java.util.jar.JarInputStream;
import java.util.zip.ZipEntry;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* Work on a JAR that can be accessed through a File
@@ -22,7 +22,7 @@
* @author Emmanuel Bernard
*/
public class FileZippedJarVisitor extends AbstractJarVisitor {
- private static Log log = LogFactory.getLog( FileZippedJarVisitor.class );
+ private final Logger log = LoggerFactory.getLogger( FileZippedJarVisitor.class );
private String entry;
public FileZippedJarVisitor(String fileName, Filter[] filters) {
Modified:
entitymanager/trunk/src/java/org/hibernate/ejb/packaging/InputStreamZippedJarVisitor.java
===================================================================
---
entitymanager/trunk/src/java/org/hibernate/ejb/packaging/InputStreamZippedJarVisitor.java 2008-05-17
12:49:38 UTC (rev 14671)
+++
entitymanager/trunk/src/java/org/hibernate/ejb/packaging/InputStreamZippedJarVisitor.java 2008-05-17
12:50:57 UTC (rev 14672)
@@ -3,16 +3,15 @@
import java.io.ByteArrayInputStream;
import java.io.IOException;
-import java.io.InputStream;
-import java.io.BufferedInputStream;
import java.net.URL;
import java.util.jar.JarEntry;
import java.util.jar.JarInputStream;
import java.util.zip.ZipEntry;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
/**
* Work on a JAR that can only be accessed through a inputstream
* This is less efficient than the {@link FileZippedJarVisitor}
@@ -20,7 +19,7 @@
* @author Emmanuel Bernard
*/
public class InputStreamZippedJarVisitor extends AbstractJarVisitor {
- private static Log log = LogFactory.getLog( InputStreamZippedJarVisitor.class );
+ private final Logger log = LoggerFactory.getLogger( InputStreamZippedJarVisitor.class
);
private String entry;
public InputStreamZippedJarVisitor(URL url, Filter[] filters, String entry) {
Modified: entitymanager/trunk/src/java/org/hibernate/ejb/packaging/JarVisitorFactory.java
===================================================================
---
entitymanager/trunk/src/java/org/hibernate/ejb/packaging/JarVisitorFactory.java 2008-05-17
12:49:38 UTC (rev 14671)
+++
entitymanager/trunk/src/java/org/hibernate/ejb/packaging/JarVisitorFactory.java 2008-05-17
12:50:57 UTC (rev 14672)
@@ -8,15 +8,15 @@
import java.net.URISyntaxException;
import java.net.URL;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
import org.hibernate.util.StringHelper;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* @author Emmanuel Bernard
*/
public class JarVisitorFactory {
- private static Log log = LogFactory.getLog( JarVisitorFactory.class );
+ private static final Logger log = LoggerFactory.getLogger( JarVisitorFactory.class );
/**
* Get the JAR URL of the JAR containing the given entry
@@ -70,7 +70,7 @@
"Unable to determine JAR Url from " + url + ". Cause: " +
e.getMessage()
);
}
- log.trace("JAR URL from URL Entry: " + url + " >> " +
jarUrl);
+ log.trace("JAR URL from URL Entry: {} >> {}", url, jarUrl);
return jarUrl;
}
Modified:
entitymanager/trunk/src/java/org/hibernate/ejb/packaging/PersistenceXmlLoader.java
===================================================================
---
entitymanager/trunk/src/java/org/hibernate/ejb/packaging/PersistenceXmlLoader.java 2008-05-17
12:49:38 UTC (rev 14671)
+++
entitymanager/trunk/src/java/org/hibernate/ejb/packaging/PersistenceXmlLoader.java 2008-05-17
12:50:57 UTC (rev 14672)
@@ -13,8 +13,6 @@
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
import org.hibernate.cfg.EJB3DTDEntityResolver;
import org.hibernate.ejb.HibernatePersistence;
import org.hibernate.ejb.util.ConfigurationHelper;
@@ -27,6 +25,8 @@
import org.xml.sax.ErrorHandler;
import org.xml.sax.InputSource;
import org.xml.sax.SAXParseException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* Persistence.xml handler
@@ -35,7 +35,7 @@
* @author Emmanuel Bernard
*/
public final class PersistenceXmlLoader {
- private static Log log = LogFactory.getLog( PersistenceXmlLoader.class );
+ private static final Logger log = LoggerFactory.getLogger( PersistenceXmlLoader.class
);
private PersistenceXmlLoader() {
}
@@ -153,7 +153,7 @@
PersistenceMetadata metadata = new PersistenceMetadata();
String puName = top.getAttribute( "name" );
if ( StringHelper.isNotEmpty( puName ) ) {
- log.trace( "Persistent Unit name from persistence.xml: " + puName );
+ log.trace( "Persistent Unit name from persistence.xml: {}", puName );
metadata.setName( puName );
}
NodeList children = top.getChildNodes();
@@ -243,17 +243,17 @@
if ( resolver instanceof EJB3DTDEntityResolver ) {
if ( ( (EJB3DTDEntityResolver) resolver ).isResolved() == false ) return;
}
- log.error( "Error parsing XML: " + file + '(' +
error.getLineNumber() + ") " + error.getMessage() );
+ log.error( "Error parsing XML: {}({}) {}", new Object[] { file,
error.getLineNumber(), error.getMessage() } );
errors.add( error );
}
public void fatalError(SAXParseException error) {
- log.error( "Error parsing XML: " + file + '(' +
error.getLineNumber() + ") " + error.getMessage() );
+ log.error( "Error parsing XML: {}({}) {}", new Object[] { file,
error.getLineNumber(), error.getMessage() } );
errors.add( error );
}
public void warning(SAXParseException warn) {
- log.warn( "Warning parsing XML: " + file + '(' +
warn.getLineNumber() + ") " + warn.getMessage() );
+ log.warn( "Warning parsing XML: {}({}) {}", new Object[] { file,
warn.getLineNumber(), warn.getMessage() } );
}
}
Modified: entitymanager/trunk/src/java/org/hibernate/ejb/util/NamingHelper.java
===================================================================
--- entitymanager/trunk/src/java/org/hibernate/ejb/util/NamingHelper.java 2008-05-17
12:49:38 UTC (rev 14671)
+++ entitymanager/trunk/src/java/org/hibernate/ejb/util/NamingHelper.java 2008-05-17
12:50:57 UTC (rev 14672)
@@ -10,18 +10,18 @@
import javax.naming.event.NamingExceptionEvent;
import javax.naming.event.NamingListener;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
import org.hibernate.ejb.Ejb3Configuration;
import org.hibernate.ejb.HibernatePersistence;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* @author Emmanuel Bernard
*/
public class NamingHelper {
- private NamingHelper() {};
+ private NamingHelper() {}
- private static Log log = LogFactory.getLog( NamingHelper.class );
+ private static final Logger log = LoggerFactory.getLogger( NamingHelper.class );
/** bind the configuration to the JNDI */
public static void bind(Ejb3Configuration cfg) {
@@ -30,12 +30,12 @@
log.debug( "No JNDI name configured for binding Ejb3Configuration" );
}
else {
- log.info( "Ejb3Configuration name: " + name );
+ log.info( "Ejb3Configuration name: {}", name );
try {
Context ctx = org.hibernate.util.NamingHelper.getInitialContext( cfg.getProperties()
);
org.hibernate.util.NamingHelper.bind( ctx, name, cfg );
- log.info( "Bound Ejb3Configuration to JNDI name: " + name );
+ log.info( "Bound Ejb3Configuration to JNDI name: {}", name );
( (EventContext) ctx ).addNamingListener( name, EventContext.OBJECT_SCOPE, LISTENER
);
}
catch (InvalidNameException ine) {
@@ -52,21 +52,21 @@
private static final NamingListener LISTENER = new NamespaceChangeListener() {
public void objectAdded(NamingEvent evt) {
- log.debug( "An Ejb3Configuration was successfully bound to name: " +
evt.getNewBinding().getName() );
+ log.debug( "An Ejb3Configuration was successfully bound to name: {}",
evt.getNewBinding().getName() );
}
public void objectRemoved(NamingEvent evt) {
String name = evt.getOldBinding().getName();
- log.info( "An Ejb3Configuration was unbound from name: " + name );
+ log.info( "An Ejb3Configuration was unbound from name: {}", name );
}
public void objectRenamed(NamingEvent evt) {
String name = evt.getOldBinding().getName();
- log.info( "An Ejb3Configuration was renamed from name: " + name );
+ log.info( "An Ejb3Configuration was renamed from name: {}", name );
}
public void namingExceptionThrown(NamingExceptionEvent evt) {
- log.warn( "Naming exception occurred accessing Ejb3Configuration: " +
evt.getException() );
+ log.warn( "Naming exception occurred accessing Ejb3Configuration",
evt.getException() );
}
};
Modified: entitymanager/trunk/src/java/org/hibernate/engine/EJB3CascadingAction.java
===================================================================
--- entitymanager/trunk/src/java/org/hibernate/engine/EJB3CascadingAction.java 2008-05-17
12:49:38 UTC (rev 14671)
+++ entitymanager/trunk/src/java/org/hibernate/engine/EJB3CascadingAction.java 2008-05-17
12:50:57 UTC (rev 14672)
@@ -7,8 +7,8 @@
import org.hibernate.event.EventSource;
import org.hibernate.HibernateException;
import org.hibernate.type.CollectionType;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
+import org.slf4j.LoggerFactory;
+import org.slf4j.Logger;
/**
* Because of CascadingAction constructor visibility
@@ -17,16 +17,14 @@
* @author Emmanuel Bernard
*/
public abstract class EJB3CascadingAction extends CascadingAction {
- private static Log log = LogFactory.getLog( CascadingAction.class );
+ private static Logger log = LoggerFactory.getLogger( CascadingAction.class );
/**
* @see org.hibernate.Session#persist(Object)
*/
public static final CascadingAction PERSIST_SKIPLAZY = new CascadingAction() {
public void cascade(EventSource session, Object child, String entityName, Object
anything, boolean isCascadeDeleteEnabled)
throws HibernateException {
- if ( log.isTraceEnabled() ) {
- log.trace( "cascading to persist: " + entityName );
- }
+ log.trace( "cascading to persist: {}", entityName );
session.persist( entityName, child, (Map) anything );
}
public Iterator getCascadableChildrenIterator(EventSource session, CollectionType
collectionType, Object collection) {