mirror of
https://github.com/hibernate/hibernate-orm
synced 2025-02-17 00:24:57 +00:00
HHH-6150 - JBoss AS7 integration work
This commit is contained in:
parent
f07b88c75f
commit
59ec34cffd
@ -1,106 +1,105 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2009, Red Hat Middleware LLC or third-party contributors as
|
* Hibernate, Relational Persistence for Idiomatic Java
|
||||||
* indicated by the @author tags or express copyright attribution
|
*
|
||||||
* statements applied by the authors. All third-party contributions are
|
* Copyright (c) 2009-2011, Red Hat Inc. or third-party contributors as
|
||||||
* distributed under license by Red Hat Middleware LLC.
|
* indicated by the @author tags or express copyright attribution
|
||||||
*
|
* statements applied by the authors. All third-party contributions are
|
||||||
* This copyrighted material is made available to anyone wishing to use, modify,
|
* distributed under license by Red Hat Inc.
|
||||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
*
|
||||||
* Lesser General Public License, as published by the Free Software Foundation.
|
* This copyrighted material is made available to anyone wishing to use, modify,
|
||||||
*
|
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||||
* This program is distributed in the hope that it will be useful,
|
* Lesser General Public License, as published by the Free Software Foundation.
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
*
|
||||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
* This program is distributed in the hope that it will be useful,
|
||||||
* for more details.
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||||
*
|
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
||||||
* You should have received a copy of the GNU Lesser General Public License
|
* for more details.
|
||||||
* along with this distribution; if not, write to:
|
*
|
||||||
* Free Software Foundation, Inc.
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
* 51 Franklin Street, Fifth Floor
|
* along with this distribution; if not, write to:
|
||||||
* Boston, MA 02110-1301 USA
|
* Free Software Foundation, Inc.
|
||||||
*/
|
* 51 Franklin Street, Fifth Floor
|
||||||
|
* Boston, MA 02110-1301 USA
|
||||||
|
*/
|
||||||
package org.hibernate.ejb.util;
|
package org.hibernate.ejb.util;
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Properties;
|
import javax.persistence.FlushModeType;
|
||||||
import java.util.Set;
|
import javax.persistence.PersistenceException;
|
||||||
import javax.persistence.FlushModeType;
|
import java.util.Map;
|
||||||
import javax.persistence.PersistenceException;
|
import java.util.Properties;
|
||||||
import org.hibernate.AssertionFailure;
|
|
||||||
import org.hibernate.CacheMode;
|
import org.hibernate.AssertionFailure;
|
||||||
import org.hibernate.FlushMode;
|
import org.hibernate.CacheMode;
|
||||||
|
import org.hibernate.FlushMode;
|
||||||
/**
|
|
||||||
* @author Emmanuel Bernard
|
/**
|
||||||
*/
|
* @author Emmanuel Bernard
|
||||||
public abstract class ConfigurationHelper {
|
*/
|
||||||
public static void overrideProperties(Properties properties, Map overrides) {
|
public abstract class ConfigurationHelper {
|
||||||
for ( Map.Entry entry : (Set<Map.Entry>) overrides.entrySet() ) {
|
public static void overrideProperties(Properties properties, Map overrides) {
|
||||||
if ( entry.getKey() instanceof String && entry.getValue() instanceof String ) {
|
properties.putAll( overrides );
|
||||||
properties.setProperty( (String) entry.getKey(), (String) entry.getValue() );
|
}
|
||||||
}
|
|
||||||
}
|
public static FlushMode getFlushMode(Object value) {
|
||||||
}
|
FlushMode flushMode = null;
|
||||||
|
if (value instanceof FlushMode) {
|
||||||
public static FlushMode getFlushMode(Object value) {
|
flushMode = (FlushMode) value;
|
||||||
FlushMode flushMode = null;
|
}
|
||||||
if (value instanceof FlushMode) {
|
else if (value instanceof javax.persistence.FlushModeType) {
|
||||||
flushMode = (FlushMode) value;
|
flushMode = ConfigurationHelper.getFlushMode( (javax.persistence.FlushModeType) value);
|
||||||
}
|
}
|
||||||
else if (value instanceof javax.persistence.FlushModeType) {
|
else if (value instanceof String) {
|
||||||
flushMode = ConfigurationHelper.getFlushMode( (javax.persistence.FlushModeType) value);
|
flushMode = ConfigurationHelper.getFlushMode( (String) value);
|
||||||
}
|
}
|
||||||
else if (value instanceof String) {
|
if (flushMode == null) {
|
||||||
flushMode = ConfigurationHelper.getFlushMode( (String) value);
|
throw new PersistenceException("Unable to parse org.hibernate.flushMode: " + value);
|
||||||
}
|
}
|
||||||
if (flushMode == null) {
|
return flushMode;
|
||||||
throw new PersistenceException("Unable to parse org.hibernate.flushMode: " + value);
|
}
|
||||||
}
|
|
||||||
return flushMode;
|
private static FlushMode getFlushMode(String flushMode) {
|
||||||
}
|
if (flushMode == null) {
|
||||||
|
return null;
|
||||||
private static FlushMode getFlushMode(String flushMode) {
|
}
|
||||||
if (flushMode == null) {
|
flushMode = flushMode.toUpperCase();
|
||||||
return null;
|
return FlushMode.parse( flushMode );
|
||||||
}
|
}
|
||||||
flushMode = flushMode.toUpperCase();
|
|
||||||
return FlushMode.parse( flushMode );
|
private static FlushMode getFlushMode(FlushModeType flushMode) {
|
||||||
}
|
switch(flushMode) {
|
||||||
|
case AUTO:
|
||||||
private static FlushMode getFlushMode(FlushModeType flushMode) {
|
return FlushMode.AUTO;
|
||||||
switch(flushMode) {
|
case COMMIT:
|
||||||
case AUTO:
|
return FlushMode.COMMIT;
|
||||||
return FlushMode.AUTO;
|
default:
|
||||||
case COMMIT:
|
throw new AssertionFailure("Unknown FlushModeType: " + flushMode);
|
||||||
return FlushMode.COMMIT;
|
}
|
||||||
default:
|
}
|
||||||
throw new AssertionFailure("Unknown FlushModeType: " + flushMode);
|
|
||||||
}
|
public static Integer getInteger(Object value) {
|
||||||
}
|
if ( value instanceof Integer ) {
|
||||||
|
return (Integer) value;
|
||||||
public static Integer getInteger(Object value) {
|
}
|
||||||
if ( value instanceof Integer ) {
|
else {
|
||||||
return (Integer) value;
|
return Integer.valueOf( (String) value );
|
||||||
}
|
}
|
||||||
else {
|
}
|
||||||
return Integer.valueOf( (String) value );
|
|
||||||
}
|
public static Boolean getBoolean(Object value) {
|
||||||
}
|
if ( value instanceof Boolean ) {
|
||||||
|
return (Boolean) value;
|
||||||
public static Boolean getBoolean(Object value) {
|
}
|
||||||
if ( value instanceof Boolean ) {
|
else {
|
||||||
return (Boolean) value;
|
return Boolean.valueOf( (String) value );
|
||||||
}
|
}
|
||||||
else {
|
}
|
||||||
return Boolean.valueOf( (String) value );
|
|
||||||
}
|
public static CacheMode getCacheMode(Object value) {
|
||||||
}
|
if ( value instanceof CacheMode ) {
|
||||||
|
return (CacheMode) value;
|
||||||
public static CacheMode getCacheMode(Object value) {
|
}
|
||||||
if ( value instanceof CacheMode ) {
|
else {
|
||||||
return (CacheMode) value;
|
return CacheMode.parse( (String) value );
|
||||||
}
|
}
|
||||||
else {
|
}
|
||||||
return CacheMode.parse( (String) value );
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user