Skip to content

Commit

Permalink
HHH-10178 - Move Geronimo JTA jar to provided configuration (non-tran…
Browse files Browse the repository at this point in the history
…sitive)
  • Loading branch information
sebersole committed Nov 17, 2015
1 parent 2cb113c commit 4793ca3
Show file tree
Hide file tree
Showing 12 changed files with 91 additions and 52 deletions.
Expand Up @@ -9,6 +9,7 @@
import java.sql.SQLException;

import org.hibernate.internal.CoreMessageLogger;
import org.hibernate.internal.log.ConnectionPoolingLogger;

import org.jboss.logging.annotations.Cause;
import org.jboss.logging.annotations.LogMessage;
Expand All @@ -25,7 +26,7 @@
* New messages must be added after the last message defined to ensure message codes are unique.
*/
@MessageLogger(projectCode = "HHH")
public interface C3P0MessageLogger extends CoreMessageLogger {
public interface C3P0MessageLogger extends ConnectionPoolingLogger {

/**
* Log a message (WARN) about conflicting {@code hibernate.c3p0.XYZ} and {@code c3p0.XYZ} settings
Expand Down
4 changes: 2 additions & 2 deletions hibernate-core/hibernate-core.gradle
Expand Up @@ -16,7 +16,6 @@ dependencies {
compile( libraries.antlr )
compile( libraries.jandex )
compile( libraries.classmate )
compile( libraries.jta )

// We need dom4j for a number of things temporarily:
// 1) (unsupported) EntityMode.DOM4J support
Expand All @@ -27,9 +26,10 @@ dependencies {

antlr( libraries.antlr )

provided( libraries.ant )
provided( libraries.jta )
provided( libraries.jacc )
provided( libraries.validation )
provided( libraries.ant )

testCompile( project(':hibernate-testing') )
testCompile( libraries.validation )
Expand Down
Expand Up @@ -19,8 +19,7 @@
import org.hibernate.boot.registry.classloading.spi.ClassLoaderService;
import org.hibernate.cfg.AvailableSettings;
import org.hibernate.engine.jdbc.connections.spi.ConnectionProvider;
import org.hibernate.internal.CoreLogging;
import org.hibernate.internal.CoreMessageLogger;
import org.hibernate.internal.log.ConnectionPoolingLogger;
import org.hibernate.internal.util.config.ConfigurationHelper;
import org.hibernate.service.UnknownUnwrapTypeException;
import org.hibernate.service.spi.Configurable;
Expand All @@ -44,7 +43,7 @@
public class DriverManagerConnectionProviderImpl
implements ConnectionProvider, Configurable, Stoppable, ServiceRegistryAwareService {

private static final CoreMessageLogger log = CoreLogging.messageLogger( DriverManagerConnectionProviderImpl.class );
private static final ConnectionPoolingLogger log = ConnectionPoolingLogger.CONNECTIONS_LOGGER;

public static final String MIN_SIZE = "hibernate.connection.min_pool_size";
public static final String INITIAL_SIZE = "hibernate.connection.initial_pool_size";
Expand Down
Expand Up @@ -67,7 +67,7 @@ public interface CoreMessageLogger extends BasicLogger {
void autoCommitMode(boolean autocommit);

@LogMessage(level = WARN)
@Message(value = "JTASessionContext being used with JDBCTransactionFactory; auto-flush will not operate correctly with getCurrentSession()",
@Message(value = "JTASessionContext being used with JDBC transactions; auto-flush will not operate correctly with getCurrentSession()",
id = 8)
void autoFlushWillNotWork();

Expand Down Expand Up @@ -96,10 +96,6 @@ public interface CoreMessageLogger extends BasicLogger {
@Message(value = "Calling joinTransaction() on a non JTA EntityManager", id = 27)
void callingJoinTransactionOnNonJtaEntityManager();

@LogMessage(level = INFO)
@Message(value = "Cleaning up connection pool [%s]", id = 30)
void cleaningUpConnectionPool(String url);

@LogMessage(level = DEBUG)
@Message(value = "Closing", id = 31)
void closing();
Expand Down Expand Up @@ -160,10 +156,6 @@ public interface CoreMessageLogger extends BasicLogger {
@Message(value = "Configuring from XML document", id = 45)
void configuringFromXmlDocument();

@LogMessage(level = INFO)
@Message(value = "Connection properties: %s", id = 46)
void connectionProperties(Properties connectionProps);

@LogMessage(level = INFO)
@Message(value = "Connections obtained: %s", id = 48)
void connectionsObtained(long connectCount);
Expand Down Expand Up @@ -483,20 +475,9 @@ void JavaSqlTypesMappedSameCodeMultipleTimes(
@Message(value = "%s = false breaks the EJB3 specification", id = 144)
void jdbcAutoCommitFalseBreaksEjb3Spec(String autocommit);

@LogMessage(level = WARN)
@Message(value = "No JDBC Driver class was specified by property %s", id = 148)
void jdbcDriverNotSpecified(String driver);

@LogMessage(level = INFO)
@Message(value = "JDBC isolation level: %s", id = 149)
void jdbcIsolationLevel(String isolationLevelToString);

@Message(value = "JDBC rollback failed", id = 151)
String jdbcRollbackFailed();

@Message(value = "JDBC URL was not specified by property %s", id = 152)
String jdbcUrlNotSpecified(String url);

@LogMessage(level = INFO)
@Message(value = "JNDI InitialContext properties:%s", id = 154)
void jndiInitialContextProperties(Hashtable hash);
Expand Down Expand Up @@ -992,10 +973,6 @@ void unableToCloseOutputFile(
@Message(value = "IOException occurred closing output stream", id = 292)
void unableToCloseOutputStream(@Cause IOException e);

@LogMessage(level = WARN)
@Message(value = "Problem closing pooled connection", id = 293)
void unableToClosePooledConnection(@Cause SQLException e);

@LogMessage(level = ERROR)
@Message(value = "Could not close session", id = 294)
void unableToCloseSession(@Cause HibernateException e);
Expand Down Expand Up @@ -1437,16 +1414,6 @@ void usingDefaultIdGeneratorSegmentValue(
@Message(value = "Using dialect: %s", id = 400)
void usingDialect(Dialect dialect);

@LogMessage(level = INFO)
@Message(value = "using driver [%s] at URL [%s]", id = 401)
void usingDriver(
String driverClassName,
String url);

@LogMessage(level = WARN)
@Message(value = "Using Hibernate built-in connection pool (not for production use!)", id = 402)
void usingHibernateBuiltInConnectionPool();

@LogMessage(level = ERROR)
@Message(value = "Don't use old DTDs, read the Hibernate 3.x Migration Guide!", id = 404)
void usingOldDtd();
Expand Down
@@ -0,0 +1,71 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
*/
package org.hibernate.internal.log;

import java.sql.SQLException;
import java.util.Properties;

import org.jboss.logging.BasicLogger;
import org.jboss.logging.Logger;
import org.jboss.logging.annotations.Cause;
import org.jboss.logging.annotations.LogMessage;
import org.jboss.logging.annotations.Message;
import org.jboss.logging.annotations.MessageLogger;
import org.jboss.logging.annotations.ValidIdRange;

import static org.jboss.logging.Logger.Level.INFO;
import static org.jboss.logging.Logger.Level.WARN;

/**
* @author Steve Ebersole
*/
@MessageLogger( projectCode = "HHH" )
@ValidIdRange( min = 10001001, max = 10001500 )
public interface ConnectionPoolingLogger extends BasicLogger {
/**
* Static access to the logging instance
*/
public static final ConnectionPoolingLogger CONNECTIONS_LOGGER = Logger.getMessageLogger(
ConnectionPoolingLogger.class,
"org.hibernate.orm.connections"
);

@LogMessage(level = INFO)
@Message(value = "Connection properties: %s", id = 10001001)
void connectionProperties(Properties connectionProps);

@LogMessage(level = WARN)
@Message(value = "Using Hibernate built-in connection pool (not for production use!)", id = 10001002)
void usingHibernateBuiltInConnectionPool();

@LogMessage(level = INFO)
@Message(value = "Autocommit mode: %s", id = 10001003)
void autoCommitMode(boolean autocommit);

@Message(value = "JDBC URL was not specified by property %s", id = 10001004)
String jdbcUrlNotSpecified(String url);

@LogMessage(level = INFO)
@Message(value = "using driver [%s] at URL [%s]", id = 10001005)
void usingDriver(String driverClassName, String url);

@LogMessage(level = WARN)
@Message(value = "No JDBC Driver class was specified by property %s", id = 10001006)
void jdbcDriverNotSpecified(String driver);

@LogMessage(level = INFO)
@Message(value = "JDBC isolation level: %s", id = 10001007)
void jdbcIsolationLevel(String isolationLevelToString);

@LogMessage(level = INFO)
@Message(value = "Cleaning up connection pool [%s]", id = 10001008)
void cleaningUpConnectionPool(String url);

@LogMessage(level = WARN)
@Message(value = "Problem closing pooled connection", id = 10001009)
void unableToClosePooledConnection(@Cause SQLException e);
}
1 change: 1 addition & 0 deletions hibernate-ehcache/hibernate-ehcache.gradle
Expand Up @@ -7,6 +7,7 @@
dependencies {
compile project( ':hibernate-core' )
compile( libraries.ehcache )
provided( libraries.jta )

testCompile project( ':hibernate-testing' )
}
Expand Down
3 changes: 2 additions & 1 deletion hibernate-entitymanager/hibernate-entitymanager.gradle
Expand Up @@ -22,9 +22,10 @@ dependencies {
compile( libraries.dom4j )
compile( libraries.commons_annotations )
compile( libraries.jpa )
compile( libraries.jta )
compile( libraries.javassist )

provided( libraries.jta )

provided( "javax.enterprise:cdi-api:1.1-PFD" )

testCompile( project(':hibernate-testing') )
Expand Down
2 changes: 2 additions & 0 deletions hibernate-envers/hibernate-envers.gradle
Expand Up @@ -10,6 +10,8 @@ dependencies {
compile( project( ':hibernate-core' ) )
compile( project( ':hibernate-entitymanager' ) )

provided( libraries.jta )

provided( [group: 'org.hibernate', name: 'hibernate-tools', version: '3.2.0.ga'] )
provided( libraries.ant )
provided( project( ':hibernate-jpamodelgen' ) )
Expand Down
2 changes: 2 additions & 0 deletions hibernate-infinispan/hibernate-infinispan.gradle
Expand Up @@ -18,6 +18,8 @@ dependencies {
compile( libraries.infinispan )
compile( libraries.rhq )

provided( libraries.jta )

testCompile project( ':hibernate-testing' )
testCompile( libraries.infinispan_test )
testCompile( libraries.jboss_common_core )
Expand Down
1 change: 1 addition & 0 deletions hibernate-osgi/hibernate-osgi.gradle
Expand Up @@ -44,6 +44,7 @@ dependencies {

compile( project( ':hibernate-core' ) )
compile( project( ':hibernate-entitymanager' ) )
compile( libraries.jta )

// MUST use 4.3.1! 4.3.0 was compiled with "-target jsr14".
// http://blog.osgi.org/2012/10/43-companion-code-for-java-7.html
Expand Down
Expand Up @@ -193,7 +193,7 @@ else if ( StringHelper.isNotEmpty( propFile ) ) {
LOG.jdbcIsolationLevel( ConnectionProviderInitiator.toIsolationNiceName( isolation ) );

autocommit = ConfigurationHelper.getBoolean( Environment.AUTOCOMMIT, props );
LOG.autoCommmitMode( autocommit );
LOG.autoCommitMode( autocommit );
}

private Reader getConfigStreamReader(String resource) {
Expand Down
Expand Up @@ -7,10 +7,12 @@
package org.hibernate.proxool.internal;

import org.hibernate.internal.CoreMessageLogger;
import org.hibernate.internal.log.ConnectionPoolingLogger;

import org.jboss.logging.annotations.LogMessage;
import org.jboss.logging.annotations.Message;
import org.jboss.logging.annotations.MessageLogger;
import org.jboss.logging.annotations.ValidIdRange;

import static org.jboss.logging.Logger.Level.INFO;

Expand All @@ -21,16 +23,8 @@
* New messages must be added after the last message defined to ensure message codes are unique.
*/
@MessageLogger(projectCode = "HHH")
public interface ProxoolMessageLogger extends CoreMessageLogger {

/**
* Logs the autocommit mode to be used for pooled connections
*
* @param autocommit The autocommit mode
*/
@LogMessage(level = INFO)
@Message(value = "Autocommit mode: %s", id = 30001)
void autoCommmitMode(boolean autocommit);
@ValidIdRange( min = 30001, max = 35000 )
public interface ProxoolMessageLogger extends ConnectionPoolingLogger {

/**
* Logs the name of a named pool to be used for configuration information
Expand Down

0 comments on commit 4793ca3

Please sign in to comment.