Skip to content

Commit

Permalink
HHH-10056 - Separate settings for notions of (1) disabling EnversServ…
Browse files Browse the repository at this point in the history
…ice and (2) auto-registering Envers listeners
  • Loading branch information
sebersole committed Sep 2, 2015
1 parent 29de3c8 commit 73c46e2
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
Expand Up @@ -34,13 +34,7 @@ public interface EnversService extends Service {
* The name of the configuration setting used to control whether the Envers integration
* is enabled. Default is true
*/
public static final String INTEGRATION_ENABLED = "hibernate.integration.envers.enabled";

/**
* The name of the legacy configuration setting used to control whether auto registration
* of envers listeners should happen or not. Default is true
*/
public static final String LEGACY_AUTO_REGISTER = "hibernate.listeners.envers.autoRegister";
String INTEGRATION_ENABLED = "hibernate.integration.envers.enabled";

/**
* Is the Envers integration enabled? This is generally used as a
Expand Down
Expand Up @@ -50,6 +50,8 @@
public class EnversServiceImpl implements EnversService, Configurable, Stoppable {
private static final Logger log = Logger.getLogger( EnversServiceImpl.class );

private static final String LEGACY_AUTO_REGISTER = "hibernate.listeners.envers.autoRegister";

private boolean integrationEnabled;
private boolean initialized;

Expand Down Expand Up @@ -77,9 +79,15 @@ public class EnversServiceImpl implements EnversService, Configurable, Stoppable

@Override
public void configure(Map configurationValues) {
final boolean legacySetting = ConfigurationHelper.getBoolean( LEGACY_AUTO_REGISTER, configurationValues, true );
this.integrationEnabled = ConfigurationHelper.getBoolean( INTEGRATION_ENABLED, configurationValues, legacySetting );

if ( configurationValues.containsKey( LEGACY_AUTO_REGISTER ) ) {
log.debugf(
"Encountered deprecated Envers setting [%s]; use [%s] or [%s] instead",
LEGACY_AUTO_REGISTER,
INTEGRATION_ENABLED,
EnversIntegrator.AUTO_REGISTER
);
}
this.integrationEnabled = ConfigurationHelper.getBoolean( INTEGRATION_ENABLED, configurationValues, true );
log.infof( "Envers integration enabled? : %s", integrationEnabled );
}

Expand Down

0 comments on commit 73c46e2

Please sign in to comment.