mirror of
https://github.com/apache/openjpa.git
synced 2025-02-21 17:45:51 +00:00
OPENJPA-849, OPENJPA-1251: property management, hidden values
git-svn-id: https://svn.apache.org/repos/asf/openjpa/trunk@805565 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
0e4769e43b
commit
814341420d
@ -77,10 +77,10 @@ class AutoDetachValue
|
|||||||
return _flags;
|
return _flags;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected List getAliasList() {
|
protected List<String> getAliasList() {
|
||||||
// We do not document the numeric values and they are not
|
// We do not document the numeric values and they are not
|
||||||
// helpful to someone trying to understand the error message
|
// helpful to someone trying to understand the error message
|
||||||
ArrayList list = new ArrayList();
|
ArrayList<String> list = new ArrayList<String>();
|
||||||
for (int x = 0; x < ALIASES.length; x += 2)
|
for (int x = 0; x < ALIASES.length; x += 2)
|
||||||
list.add(ALIASES[x]);
|
list.add(ALIASES[x]);
|
||||||
return list;
|
return list;
|
||||||
|
@ -41,6 +41,7 @@ import org.apache.openjpa.kernel.FinderCache;
|
|||||||
import org.apache.openjpa.kernel.InverseManager;
|
import org.apache.openjpa.kernel.InverseManager;
|
||||||
import org.apache.openjpa.kernel.LockLevels;
|
import org.apache.openjpa.kernel.LockLevels;
|
||||||
import org.apache.openjpa.kernel.LockManager;
|
import org.apache.openjpa.kernel.LockManager;
|
||||||
|
import org.apache.openjpa.kernel.MixedLockLevels;
|
||||||
import org.apache.openjpa.kernel.PreparedQueryCache;
|
import org.apache.openjpa.kernel.PreparedQueryCache;
|
||||||
import org.apache.openjpa.kernel.QueryFlushModes;
|
import org.apache.openjpa.kernel.QueryFlushModes;
|
||||||
import org.apache.openjpa.kernel.RestoreState;
|
import org.apache.openjpa.kernel.RestoreState;
|
||||||
@ -86,8 +87,7 @@ public class OpenJPAConfigurationImpl
|
|||||||
extends ConfigurationImpl
|
extends ConfigurationImpl
|
||||||
implements OpenJPAConfiguration {
|
implements OpenJPAConfiguration {
|
||||||
|
|
||||||
private static final Localizer _loc =
|
private static final Localizer _loc = Localizer.forPackage(OpenJPAConfigurationImpl.class);
|
||||||
Localizer.forPackage(OpenJPAConfigurationImpl.class);
|
|
||||||
|
|
||||||
// cached state; some of this is created in getter methods, so make
|
// cached state; some of this is created in getter methods, so make
|
||||||
// protected in case subclasses want to access without creating
|
// protected in case subclasses want to access without creating
|
||||||
@ -172,6 +172,7 @@ public class OpenJPAConfigurationImpl
|
|||||||
public ObjectValue writeBehindCachePlugin;
|
public ObjectValue writeBehindCachePlugin;
|
||||||
public ObjectValue writeBehindCacheManagerPlugin;
|
public ObjectValue writeBehindCacheManagerPlugin;
|
||||||
public ObjectValue writeBehindCallbackPlugin;
|
public ObjectValue writeBehindCallbackPlugin;
|
||||||
|
public BooleanValue dynamicEnhancementAgent;
|
||||||
|
|
||||||
// custom values
|
// custom values
|
||||||
public BrokerFactoryValue brokerFactoryPlugin;
|
public BrokerFactoryValue brokerFactoryPlugin;
|
||||||
@ -179,12 +180,9 @@ public class OpenJPAConfigurationImpl
|
|||||||
public AutoDetachValue autoDetach;
|
public AutoDetachValue autoDetach;
|
||||||
|
|
||||||
private Collection<String> supportedOptions = new HashSet<String>(33);
|
private Collection<String> supportedOptions = new HashSet<String>(33);
|
||||||
private final StoreFacadeTypeRegistry _storeFacadeRegistry =
|
private final StoreFacadeTypeRegistry _storeFacadeRegistry = new StoreFacadeTypeRegistry();
|
||||||
new StoreFacadeTypeRegistry();
|
private BrokerFactoryEventManager _brokerFactoryEventManager = new BrokerFactoryEventManager(this);
|
||||||
private BrokerFactoryEventManager _brokerFactoryEventManager =
|
|
||||||
new BrokerFactoryEventManager(this);
|
|
||||||
|
|
||||||
public BooleanValue dynamicEnhancementAgent;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Default constructor. Attempts to load global properties.
|
* Default constructor. Attempts to load global properties.
|
||||||
@ -213,9 +211,8 @@ public class OpenJPAConfigurationImpl
|
|||||||
String[] aliases;
|
String[] aliases;
|
||||||
|
|
||||||
classResolverPlugin = addPlugin("ClassResolver", true);
|
classResolverPlugin = addPlugin("ClassResolver", true);
|
||||||
aliases =
|
aliases = new String[] {
|
||||||
new String[] { "default",
|
"default", "org.apache.openjpa.util.ClassResolverImpl",
|
||||||
"org.apache.openjpa.util.ClassResolverImpl",
|
|
||||||
// deprecated alias
|
// deprecated alias
|
||||||
"spec", "org.apache.openjpa.util.ClassResolverImpl", };
|
"spec", "org.apache.openjpa.util.ClassResolverImpl", };
|
||||||
classResolverPlugin.setAliases(aliases);
|
classResolverPlugin.setAliases(aliases);
|
||||||
@ -273,41 +270,38 @@ public class OpenJPAConfigurationImpl
|
|||||||
|
|
||||||
lockManagerPlugin = addPlugin("LockManager", false);
|
lockManagerPlugin = addPlugin("LockManager", false);
|
||||||
aliases =
|
aliases =
|
||||||
new String[] { "none", "org.apache.openjpa.kernel.NoneLockManager",
|
new String[] {
|
||||||
|
"none", "org.apache.openjpa.kernel.NoneLockManager",
|
||||||
"version", "org.apache.openjpa.kernel.VersionLockManager", };
|
"version", "org.apache.openjpa.kernel.VersionLockManager", };
|
||||||
lockManagerPlugin.setAliases(aliases);
|
lockManagerPlugin.setAliases(aliases);
|
||||||
lockManagerPlugin.setDefault(aliases[0]);
|
lockManagerPlugin.setDefault(aliases[0]);
|
||||||
lockManagerPlugin.setString(aliases[0]);
|
lockManagerPlugin.setString(aliases[0]);
|
||||||
|
|
||||||
inverseManagerPlugin = addPlugin("InverseManager", false);
|
inverseManagerPlugin = addPlugin("InverseManager", false);
|
||||||
aliases =
|
aliases = new String[] {
|
||||||
new String[] { "false", null, "true",
|
"false", null,
|
||||||
"org.apache.openjpa.kernel.InverseManager", };
|
"true", "org.apache.openjpa.kernel.InverseManager", };
|
||||||
inverseManagerPlugin.setAliases(aliases);
|
inverseManagerPlugin.setAliases(aliases);
|
||||||
inverseManagerPlugin.setDefault(aliases[0]);
|
inverseManagerPlugin.setDefault(aliases[0]);
|
||||||
inverseManagerPlugin.setString(aliases[0]);
|
inverseManagerPlugin.setString(aliases[0]);
|
||||||
|
|
||||||
savepointManagerPlugin = addPlugin("SavepointManager", true);
|
savepointManagerPlugin = addPlugin("SavepointManager", true);
|
||||||
aliases =
|
aliases = new String[] {
|
||||||
new String[] { "in-mem",
|
"in-mem", "org.apache.openjpa.kernel.InMemorySavepointManager", };
|
||||||
"org.apache.openjpa.kernel.InMemorySavepointManager", };
|
|
||||||
savepointManagerPlugin.setAliases(aliases);
|
savepointManagerPlugin.setAliases(aliases);
|
||||||
savepointManagerPlugin.setDefault(aliases[0]);
|
savepointManagerPlugin.setDefault(aliases[0]);
|
||||||
savepointManagerPlugin.setString(aliases[0]);
|
savepointManagerPlugin.setString(aliases[0]);
|
||||||
savepointManagerPlugin
|
savepointManagerPlugin.setInstantiatingGetter("getSavepointManagerInstance");
|
||||||
.setInstantiatingGetter("getSavepointManagerInstance");
|
|
||||||
|
|
||||||
orphanedKeyPlugin = addPlugin("OrphanedKeyAction", true);
|
orphanedKeyPlugin = addPlugin("OrphanedKeyAction", true);
|
||||||
aliases =
|
aliases = new String[] {
|
||||||
new String[] { "log",
|
"log", "org.apache.openjpa.event.LogOrphanedKeyAction",
|
||||||
"org.apache.openjpa.event.LogOrphanedKeyAction", "exception",
|
"exception", "org.apache.openjpa.event.ExceptionOrphanedKeyAction",
|
||||||
"org.apache.openjpa.event.ExceptionOrphanedKeyAction", "none",
|
"none", "org.apache.openjpa.event.NoneOrphanedKeyAction", };
|
||||||
"org.apache.openjpa.event.NoneOrphanedKeyAction", };
|
|
||||||
orphanedKeyPlugin.setAliases(aliases);
|
orphanedKeyPlugin.setAliases(aliases);
|
||||||
orphanedKeyPlugin.setDefault(aliases[0]);
|
orphanedKeyPlugin.setDefault(aliases[0]);
|
||||||
orphanedKeyPlugin.setString(aliases[0]);
|
orphanedKeyPlugin.setString(aliases[0]);
|
||||||
orphanedKeyPlugin
|
orphanedKeyPlugin.setInstantiatingGetter("getOrphanedKeyActionInstance");
|
||||||
.setInstantiatingGetter("getOrphanedKeyActionInstance");
|
|
||||||
|
|
||||||
remoteProviderPlugin = new RemoteCommitProviderValue();
|
remoteProviderPlugin = new RemoteCommitProviderValue();
|
||||||
addValue(remoteProviderPlugin);
|
addValue(remoteProviderPlugin);
|
||||||
@ -318,11 +312,10 @@ public class OpenJPAConfigurationImpl
|
|||||||
transactionMode.setDefault(aliases[0]);
|
transactionMode.setDefault(aliases[0]);
|
||||||
|
|
||||||
managedRuntimePlugin = addPlugin("ManagedRuntime", true);
|
managedRuntimePlugin = addPlugin("ManagedRuntime", true);
|
||||||
aliases =
|
aliases = new String[] {
|
||||||
new String[] { "auto",
|
"auto", "org.apache.openjpa.ee.AutomaticManagedRuntime",
|
||||||
"org.apache.openjpa.ee.AutomaticManagedRuntime", "jndi",
|
"jndi", "org.apache.openjpa.ee.JNDIManagedRuntime",
|
||||||
"org.apache.openjpa.ee.JNDIManagedRuntime", "invocation",
|
"invocation", "org.apache.openjpa.ee.InvocationManagedRuntime", };
|
||||||
"org.apache.openjpa.ee.InvocationManagedRuntime", };
|
|
||||||
managedRuntimePlugin.setAliases(aliases);
|
managedRuntimePlugin.setAliases(aliases);
|
||||||
managedRuntimePlugin.setDefault(aliases[0]);
|
managedRuntimePlugin.setDefault(aliases[0]);
|
||||||
managedRuntimePlugin.setString(aliases[0]);
|
managedRuntimePlugin.setString(aliases[0]);
|
||||||
@ -330,9 +323,8 @@ public class OpenJPAConfigurationImpl
|
|||||||
.setInstantiatingGetter("getManagedRuntimeInstance");
|
.setInstantiatingGetter("getManagedRuntimeInstance");
|
||||||
|
|
||||||
proxyManagerPlugin = addPlugin("ProxyManager", true);
|
proxyManagerPlugin = addPlugin("ProxyManager", true);
|
||||||
aliases =
|
aliases = new String[] {
|
||||||
new String[] { "default",
|
"default", "org.apache.openjpa.util.ProxyManagerImpl" };
|
||||||
"org.apache.openjpa.util.ProxyManagerImpl" };
|
|
||||||
proxyManagerPlugin.setAliases(aliases);
|
proxyManagerPlugin.setAliases(aliases);
|
||||||
proxyManagerPlugin.setDefault(aliases[0]);
|
proxyManagerPlugin.setDefault(aliases[0]);
|
||||||
proxyManagerPlugin.setString(aliases[0]);
|
proxyManagerPlugin.setString(aliases[0]);
|
||||||
@ -380,8 +372,7 @@ public class OpenJPAConfigurationImpl
|
|||||||
connection2URL = addString("Connection2URL");
|
connection2URL = addString("Connection2URL");
|
||||||
connection2DriverName = addString("Connection2DriverName");
|
connection2DriverName = addString("Connection2DriverName");
|
||||||
connection2Properties = addString("Connection2Properties");
|
connection2Properties = addString("Connection2Properties");
|
||||||
connectionFactory2Properties =
|
connectionFactory2Properties = addString("ConnectionFactory2Properties");
|
||||||
addString("ConnectionFactory2Properties");
|
|
||||||
connectionFactory2Name = addString("ConnectionFactory2Name");
|
connectionFactory2Name = addString("ConnectionFactory2Name");
|
||||||
|
|
||||||
connectionFactoryMode = addBoolean("ConnectionFactoryMode");
|
connectionFactoryMode = addBoolean("ConnectionFactoryMode");
|
||||||
@ -408,13 +399,13 @@ public class OpenJPAConfigurationImpl
|
|||||||
retainState.set(true);
|
retainState.set(true);
|
||||||
|
|
||||||
restoreState = addInt("RestoreState");
|
restoreState = addInt("RestoreState");
|
||||||
aliases =
|
aliases = new String[] {
|
||||||
new String[] { "none", String.valueOf(RestoreState.RESTORE_NONE),
|
"none", String.valueOf(RestoreState.RESTORE_NONE),
|
||||||
"false", String.valueOf(RestoreState.RESTORE_NONE),
|
"false", String.valueOf(RestoreState.RESTORE_NONE),
|
||||||
"immutable", String.valueOf(RestoreState.RESTORE_IMMUTABLE),
|
"immutable", String.valueOf(RestoreState.RESTORE_IMMUTABLE),
|
||||||
// "true" for compat with jdo RestoreValues
|
// "true" for compat with jdo RestoreValues
|
||||||
"true", String.valueOf(RestoreState.RESTORE_IMMUTABLE), "all",
|
"true", String.valueOf(RestoreState.RESTORE_IMMUTABLE),
|
||||||
String.valueOf(RestoreState.RESTORE_ALL), };
|
"all", String.valueOf(RestoreState.RESTORE_ALL), };
|
||||||
restoreState.setAliases(aliases);
|
restoreState.setAliases(aliases);
|
||||||
restoreState.setDefault(aliases[0]);
|
restoreState.setDefault(aliases[0]);
|
||||||
restoreState.set(RestoreState.RESTORE_IMMUTABLE);
|
restoreState.set(RestoreState.RESTORE_IMMUTABLE);
|
||||||
@ -425,10 +416,10 @@ public class OpenJPAConfigurationImpl
|
|||||||
|
|
||||||
detachStatePlugin = addPlugin("DetachState", true);
|
detachStatePlugin = addPlugin("DetachState", true);
|
||||||
aliases = new String[] {
|
aliases = new String[] {
|
||||||
"loaded", DetachOptions.Loaded.class.getName(),
|
"loaded", DetachOptions.Loaded.class.getName(),
|
||||||
"fgs", DetachOptions.FetchGroups.class.getName(),
|
"fgs", DetachOptions.FetchGroups.class.getName(),
|
||||||
"fetch-groups", DetachOptions.FetchGroups.class.getName(),
|
"fetch-groups", DetachOptions.FetchGroups.class.getName(),
|
||||||
"all", DetachOptions.All.class.getName(),
|
"all", DetachOptions.All.class.getName(),
|
||||||
};
|
};
|
||||||
detachStatePlugin.setAliases(aliases);
|
detachStatePlugin.setAliases(aliases);
|
||||||
detachStatePlugin.setDefault(aliases[0]);
|
detachStatePlugin.setDefault(aliases[0]);
|
||||||
@ -458,11 +449,11 @@ public class OpenJPAConfigurationImpl
|
|||||||
fetchGroups.set(new String[] { "default" });
|
fetchGroups.set(new String[] { "default" });
|
||||||
|
|
||||||
flushBeforeQueries = addInt("FlushBeforeQueries");
|
flushBeforeQueries = addInt("FlushBeforeQueries");
|
||||||
aliases =
|
aliases = new String[] {
|
||||||
new String[] { "true", String.valueOf(QueryFlushModes.FLUSH_TRUE),
|
"true", String.valueOf(QueryFlushModes.FLUSH_TRUE),
|
||||||
"false", String.valueOf(QueryFlushModes.FLUSH_FALSE),
|
"false", String.valueOf(QueryFlushModes.FLUSH_FALSE),
|
||||||
"with-connection",
|
"with-connection", String.valueOf(QueryFlushModes.FLUSH_WITH_CONNECTION),
|
||||||
String.valueOf(QueryFlushModes.FLUSH_WITH_CONNECTION), };
|
};
|
||||||
flushBeforeQueries.setAliases(aliases);
|
flushBeforeQueries.setAliases(aliases);
|
||||||
flushBeforeQueries.setDefault(aliases[0]);
|
flushBeforeQueries.setDefault(aliases[0]);
|
||||||
flushBeforeQueries.set(QueryFlushModes.FLUSH_TRUE);
|
flushBeforeQueries.set(QueryFlushModes.FLUSH_TRUE);
|
||||||
@ -474,8 +465,7 @@ public class OpenJPAConfigurationImpl
|
|||||||
lockTimeout.setDynamic(true);
|
lockTimeout.setDynamic(true);
|
||||||
|
|
||||||
readLockLevel = addInt("ReadLockLevel");
|
readLockLevel = addInt("ReadLockLevel");
|
||||||
aliases =
|
aliases = new String[] {
|
||||||
new String[] {
|
|
||||||
"read", String.valueOf(LockLevels.LOCK_READ),
|
"read", String.valueOf(LockLevels.LOCK_READ),
|
||||||
"write", String.valueOf(LockLevels.LOCK_WRITE),
|
"write", String.valueOf(LockLevels.LOCK_WRITE),
|
||||||
"none", String.valueOf(LockLevels.LOCK_NONE),
|
"none", String.valueOf(LockLevels.LOCK_NONE),
|
||||||
@ -486,8 +476,7 @@ public class OpenJPAConfigurationImpl
|
|||||||
readLockLevel.setAliasListComprehensive(true);
|
readLockLevel.setAliasListComprehensive(true);
|
||||||
|
|
||||||
writeLockLevel = addInt("WriteLockLevel");
|
writeLockLevel = addInt("WriteLockLevel");
|
||||||
aliases =
|
aliases = new String[] {
|
||||||
new String[] {
|
|
||||||
"read", String.valueOf(LockLevels.LOCK_READ),
|
"read", String.valueOf(LockLevels.LOCK_READ),
|
||||||
"write", String.valueOf(LockLevels.LOCK_WRITE),
|
"write", String.valueOf(LockLevels.LOCK_WRITE),
|
||||||
"none", String.valueOf(LockLevels.LOCK_NONE),
|
"none", String.valueOf(LockLevels.LOCK_NONE),
|
||||||
@ -502,17 +491,12 @@ public class OpenJPAConfigurationImpl
|
|||||||
addValue(seqPlugin);
|
addValue(seqPlugin);
|
||||||
|
|
||||||
connectionRetainMode = addInt("ConnectionRetainMode");
|
connectionRetainMode = addInt("ConnectionRetainMode");
|
||||||
aliases =
|
aliases = new String[] {
|
||||||
new String[] {
|
"on-demand", String.valueOf(ConnectionRetainModes.CONN_RETAIN_DEMAND),
|
||||||
"on-demand",
|
"transaction", String.valueOf(ConnectionRetainModes.CONN_RETAIN_TRANS),
|
||||||
String.valueOf(ConnectionRetainModes.CONN_RETAIN_DEMAND),
|
"always", String.valueOf(ConnectionRetainModes.CONN_RETAIN_ALWAYS),
|
||||||
"transaction",
|
|
||||||
String.valueOf(ConnectionRetainModes.CONN_RETAIN_TRANS),
|
|
||||||
"always",
|
|
||||||
String.valueOf(ConnectionRetainModes.CONN_RETAIN_ALWAYS),
|
|
||||||
// deprecated
|
// deprecated
|
||||||
"persistence-manager",
|
"persistence-manager", String.valueOf(ConnectionRetainModes.CONN_RETAIN_ALWAYS),
|
||||||
String.valueOf(ConnectionRetainModes.CONN_RETAIN_ALWAYS),
|
|
||||||
};
|
};
|
||||||
connectionRetainMode.setAliases(aliases);
|
connectionRetainMode.setAliases(aliases);
|
||||||
connectionRetainMode.setDefault(aliases[0]);
|
connectionRetainMode.setDefault(aliases[0]);
|
||||||
@ -520,12 +504,10 @@ public class OpenJPAConfigurationImpl
|
|||||||
connectionRetainMode.set(ConnectionRetainModes.CONN_RETAIN_DEMAND);
|
connectionRetainMode.set(ConnectionRetainModes.CONN_RETAIN_DEMAND);
|
||||||
|
|
||||||
filterListenerPlugins = addPluginList("FilterListeners");
|
filterListenerPlugins = addPluginList("FilterListeners");
|
||||||
filterListenerPlugins
|
filterListenerPlugins.setInstantiatingGetter("getFilterListenerInstances");
|
||||||
.setInstantiatingGetter("getFilterListenerInstances");
|
|
||||||
|
|
||||||
aggregateListenerPlugins = addPluginList("AggregateListeners");
|
aggregateListenerPlugins = addPluginList("AggregateListeners");
|
||||||
aggregateListenerPlugins
|
aggregateListenerPlugins.setInstantiatingGetter("getAggregateListenerInstances");
|
||||||
.setInstantiatingGetter("getAggregateListenerInstances");
|
|
||||||
|
|
||||||
retryClassRegistration = addBoolean("RetryClassRegistration");
|
retryClassRegistration = addBoolean("RetryClassRegistration");
|
||||||
|
|
||||||
@ -543,27 +525,21 @@ public class OpenJPAConfigurationImpl
|
|||||||
callbackPlugin.setString(aliases[0]);
|
callbackPlugin.setString(aliases[0]);
|
||||||
callbackPlugin.setInstantiatingGetter("getCallbackOptionsInstance");
|
callbackPlugin.setInstantiatingGetter("getCallbackOptionsInstance");
|
||||||
|
|
||||||
queryCompilationCachePlugin = new QueryCompilationCacheValue(
|
queryCompilationCachePlugin = new QueryCompilationCacheValue("QueryCompilationCache");
|
||||||
"QueryCompilationCache");
|
queryCompilationCachePlugin.setInstantiatingGetter("getQueryCompilationCacheInstance");
|
||||||
queryCompilationCachePlugin.setInstantiatingGetter(
|
|
||||||
"getQueryCompilationCacheInstance");
|
|
||||||
addValue(queryCompilationCachePlugin);
|
addValue(queryCompilationCachePlugin);
|
||||||
|
|
||||||
runtimeUnenhancedClasses = addInt("RuntimeUnenhancedClasses");
|
runtimeUnenhancedClasses = addInt("RuntimeUnenhancedClasses");
|
||||||
runtimeUnenhancedClasses.setAliases(new String[] {
|
runtimeUnenhancedClasses.setAliases(new String[] {
|
||||||
"supported", String.valueOf(
|
"supported", String.valueOf(RuntimeUnenhancedClassesModes.SUPPORTED),
|
||||||
RuntimeUnenhancedClassesModes.SUPPORTED),
|
"unsupported", String.valueOf(RuntimeUnenhancedClassesModes.UNSUPPORTED),
|
||||||
"unsupported", String.valueOf(
|
"warn", String.valueOf(RuntimeUnenhancedClassesModes.WARN),
|
||||||
RuntimeUnenhancedClassesModes.UNSUPPORTED),
|
|
||||||
"warn", String.valueOf(
|
|
||||||
RuntimeUnenhancedClassesModes.WARN),
|
|
||||||
});
|
});
|
||||||
runtimeUnenhancedClasses.setDefault("unsupported");
|
runtimeUnenhancedClasses.setDefault("unsupported");
|
||||||
runtimeUnenhancedClasses.setString("unsupported");
|
runtimeUnenhancedClasses.setString("unsupported");
|
||||||
runtimeUnenhancedClasses.setAliasListComprehensive(true);
|
runtimeUnenhancedClasses.setAliasListComprehensive(true);
|
||||||
|
|
||||||
cacheMarshallerPlugins = (CacheMarshallersValue)
|
cacheMarshallerPlugins = (CacheMarshallersValue) addValue(new CacheMarshallersValue(this));
|
||||||
addValue(new CacheMarshallersValue(this));
|
|
||||||
|
|
||||||
eagerInitialization = addBoolean("InitializeEagerly");
|
eagerInitialization = addBoolean("InitializeEagerly");
|
||||||
|
|
||||||
@ -581,26 +557,22 @@ public class OpenJPAConfigurationImpl
|
|||||||
validationMode.setDynamic(true);
|
validationMode.setDynamic(true);
|
||||||
|
|
||||||
String defValidationGroup = "javax.validation.groups.Default";
|
String defValidationGroup = "javax.validation.groups.Default";
|
||||||
validationGroupPrePersist =
|
validationGroupPrePersist = addString("javax.persistence.validation.group.pre-persist");
|
||||||
addString("javax.persistence.validation.group.pre-persist");
|
|
||||||
validationGroupPrePersist.setString(defValidationGroup);
|
validationGroupPrePersist.setString(defValidationGroup);
|
||||||
validationGroupPrePersist.setDefault("");
|
validationGroupPrePersist.setDefault("");
|
||||||
validationGroupPrePersist.setDynamic(true);
|
validationGroupPrePersist.setDynamic(true);
|
||||||
|
|
||||||
validationGroupPreUpdate =
|
validationGroupPreUpdate = addString("javax.persistence.validation.group.pre-update");
|
||||||
addString("javax.persistence.validation.group.pre-update");
|
|
||||||
validationGroupPreUpdate.setString(defValidationGroup);
|
validationGroupPreUpdate.setString(defValidationGroup);
|
||||||
validationGroupPreUpdate.setDefault("");
|
validationGroupPreUpdate.setDefault("");
|
||||||
validationGroupPreUpdate.setDynamic(true);
|
validationGroupPreUpdate.setDynamic(true);
|
||||||
|
|
||||||
validationGroupPreRemove =
|
validationGroupPreRemove = addString("javax.persistence.validation.group.pre-remove");
|
||||||
addString("javax.persistence.validation.group.pre-remove");
|
|
||||||
validationGroupPreRemove.setDefault("");
|
validationGroupPreRemove.setDefault("");
|
||||||
validationGroupPreRemove.setDynamic(true);
|
validationGroupPreRemove.setDynamic(true);
|
||||||
|
|
||||||
validationFactory = addObject("javax.persistence.validation.factory");
|
validationFactory = addObject("javax.persistence.validation.factory");
|
||||||
validationFactory.setInstantiatingGetter(
|
validationFactory.setInstantiatingGetter("getValidationFactoryInstance");
|
||||||
"getValidationFactoryInstance");
|
|
||||||
validationFactory.setDynamic(true);
|
validationFactory.setDynamic(true);
|
||||||
|
|
||||||
validator = addObject("Validator");
|
validator = addObject("Validator");
|
||||||
@ -615,8 +587,7 @@ public class OpenJPAConfigurationImpl
|
|||||||
lifecycleEventManager.setAliases(aliases);
|
lifecycleEventManager.setAliases(aliases);
|
||||||
lifecycleEventManager.setDefault(aliases[0]);
|
lifecycleEventManager.setDefault(aliases[0]);
|
||||||
lifecycleEventManager.setString(aliases[0]);
|
lifecycleEventManager.setString(aliases[0]);
|
||||||
lifecycleEventManager.setInstantiatingGetter(
|
lifecycleEventManager.setInstantiatingGetter("getLifecycleEventManagerInstance");
|
||||||
"getLifecycleEventManagerInstance");
|
|
||||||
|
|
||||||
dynamicEnhancementAgent = addBoolean("DynamicEnhancementAgent");
|
dynamicEnhancementAgent = addBoolean("DynamicEnhancementAgent");
|
||||||
dynamicEnhancementAgent.setDefault("true");
|
dynamicEnhancementAgent.setDefault("true");
|
||||||
@ -648,8 +619,8 @@ public class OpenJPAConfigurationImpl
|
|||||||
|
|
||||||
writeBehindCachePlugin = addPlugin("WriteBehindCache", false);
|
writeBehindCachePlugin = addPlugin("WriteBehindCache", false);
|
||||||
aliases = new String[] {
|
aliases = new String[] {
|
||||||
"false", null,
|
"false", null,
|
||||||
"true", SimpleWriteBehindCache.class.getName(),
|
"true", SimpleWriteBehindCache.class.getName(),
|
||||||
"simple", SimpleWriteBehindCache.class.getName() };
|
"simple", SimpleWriteBehindCache.class.getName() };
|
||||||
writeBehindCachePlugin.setAliases(aliases);
|
writeBehindCachePlugin.setAliases(aliases);
|
||||||
writeBehindCachePlugin.setDefault(aliases[0]);
|
writeBehindCachePlugin.setDefault(aliases[0]);
|
||||||
@ -657,8 +628,8 @@ public class OpenJPAConfigurationImpl
|
|||||||
|
|
||||||
writeBehindCallbackPlugin = addPlugin("WriteBehindCallback", true);
|
writeBehindCallbackPlugin = addPlugin("WriteBehindCallback", true);
|
||||||
aliases = new String[] {
|
aliases = new String[] {
|
||||||
"false", null,
|
"false", null,
|
||||||
"true", SimpleWriteBehindCallback.class.getName(),
|
"true", SimpleWriteBehindCallback.class.getName(),
|
||||||
"simple", SimpleWriteBehindCallback.class.getName() };
|
"simple", SimpleWriteBehindCallback.class.getName() };
|
||||||
writeBehindCallbackPlugin.setAliases(aliases);
|
writeBehindCallbackPlugin.setAliases(aliases);
|
||||||
writeBehindCallbackPlugin.setDefault(aliases[0]);
|
writeBehindCallbackPlugin.setDefault(aliases[0]);
|
||||||
@ -737,8 +708,7 @@ public class OpenJPAConfigurationImpl
|
|||||||
}
|
}
|
||||||
|
|
||||||
public BrokerImpl newBrokerInstance(String user, String pass) {
|
public BrokerImpl newBrokerInstance(String user, String pass) {
|
||||||
BrokerImpl broker =
|
BrokerImpl broker = (BrokerImpl) brokerPlugin.instantiate(BrokerImpl.class, this);
|
||||||
(BrokerImpl) brokerPlugin.instantiate(BrokerImpl.class, this);
|
|
||||||
if (broker != null)
|
if (broker != null)
|
||||||
broker.setAuthentication(user, pass);
|
broker.setAuthentication(user, pass);
|
||||||
return broker;
|
return broker;
|
||||||
@ -761,9 +731,7 @@ public class OpenJPAConfigurationImpl
|
|||||||
public DataCacheManager getDataCacheManagerInstance() {
|
public DataCacheManager getDataCacheManagerInstance() {
|
||||||
DataCacheManager dcm = (DataCacheManager) dataCacheManagerPlugin.get();
|
DataCacheManager dcm = (DataCacheManager) dataCacheManagerPlugin.get();
|
||||||
if (dcm == null) {
|
if (dcm == null) {
|
||||||
dcm =
|
dcm = (DataCacheManager) dataCacheManagerPlugin.instantiate(DataCacheManager.class, this);
|
||||||
(DataCacheManager) dataCacheManagerPlugin.instantiate(
|
|
||||||
DataCacheManager.class, this);
|
|
||||||
dcm.initialize(this, dataCachePlugin, queryCachePlugin);
|
dcm.initialize(this, dataCachePlugin, queryCachePlugin);
|
||||||
}
|
}
|
||||||
return dcm;
|
return dcm;
|
||||||
@ -849,8 +817,7 @@ public class OpenJPAConfigurationImpl
|
|||||||
}
|
}
|
||||||
|
|
||||||
public InverseManager newInverseManagerInstance() {
|
public InverseManager newInverseManagerInstance() {
|
||||||
return (InverseManager) inverseManagerPlugin.instantiate(
|
return (InverseManager) inverseManagerPlugin.instantiate(InverseManager.class, this);
|
||||||
InverseManager.class, this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSavepointManager(String savepointManager) {
|
public void setSavepointManager(String savepointManager) {
|
||||||
|
@ -43,15 +43,7 @@ public interface BrokerFactory
|
|||||||
/**
|
/**
|
||||||
* Return properties describing this runtime.
|
* Return properties describing this runtime.
|
||||||
*/
|
*/
|
||||||
public Properties getProperties();
|
public Map<String,Object> getProperties();
|
||||||
|
|
||||||
/**
|
|
||||||
* Return all of the configured properties plus those returned in
|
|
||||||
* @see #getProperties().
|
|
||||||
*
|
|
||||||
* @since 2.0.0
|
|
||||||
*/
|
|
||||||
public Map<String, String> getAllProperties();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return all of the supported properties as a set of keys. If a property
|
* Return all of the supported properties as a set of keys. If a property
|
||||||
|
@ -26,6 +26,7 @@ import java.lang.reflect.Modifier;
|
|||||||
import java.security.AccessController;
|
import java.security.AccessController;
|
||||||
import java.util.AbstractCollection;
|
import java.util.AbstractCollection;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.BitSet;
|
import java.util.BitSet;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
@ -53,13 +54,13 @@ import org.apache.openjpa.datacache.DataCache;
|
|||||||
import org.apache.openjpa.ee.ManagedRuntime;
|
import org.apache.openjpa.ee.ManagedRuntime;
|
||||||
import org.apache.openjpa.enhance.PCRegistry;
|
import org.apache.openjpa.enhance.PCRegistry;
|
||||||
import org.apache.openjpa.enhance.PersistenceCapable;
|
import org.apache.openjpa.enhance.PersistenceCapable;
|
||||||
|
import org.apache.openjpa.enhance.Reflection;
|
||||||
import org.apache.openjpa.event.LifecycleEvent;
|
import org.apache.openjpa.event.LifecycleEvent;
|
||||||
import org.apache.openjpa.event.LifecycleEventManager;
|
import org.apache.openjpa.event.LifecycleEventManager;
|
||||||
import org.apache.openjpa.event.RemoteCommitEventManager;
|
import org.apache.openjpa.event.RemoteCommitEventManager;
|
||||||
import org.apache.openjpa.event.TransactionEvent;
|
import org.apache.openjpa.event.TransactionEvent;
|
||||||
import org.apache.openjpa.event.TransactionEventManager;
|
import org.apache.openjpa.event.TransactionEventManager;
|
||||||
import org.apache.openjpa.kernel.exps.ExpressionParser;
|
import org.apache.openjpa.kernel.exps.ExpressionParser;
|
||||||
import org.apache.openjpa.lib.conf.Value;
|
|
||||||
import org.apache.openjpa.lib.log.Log;
|
import org.apache.openjpa.lib.log.Log;
|
||||||
import org.apache.openjpa.lib.util.J2DoPrivHelper;
|
import org.apache.openjpa.lib.util.J2DoPrivHelper;
|
||||||
import org.apache.openjpa.lib.util.Localizer;
|
import org.apache.openjpa.lib.util.Localizer;
|
||||||
@ -98,6 +99,7 @@ import org.apache.openjpa.util.WrappedException;
|
|||||||
*
|
*
|
||||||
* @author Abe White
|
* @author Abe White
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("serial")
|
||||||
public class BrokerImpl
|
public class BrokerImpl
|
||||||
implements Broker, FindCallbacks, Cloneable, Serializable {
|
implements Broker, FindCallbacks, Cloneable, Serializable {
|
||||||
|
|
||||||
@ -229,8 +231,8 @@ public class BrokerImpl
|
|||||||
|
|
||||||
|
|
||||||
// Map of properties whose values have been changed
|
// Map of properties whose values have been changed
|
||||||
private Map<String, String> _changedProperties =
|
// private Map<String, String> _changedProperties =
|
||||||
new HashMap<String, String>();
|
// new HashMap<String, String>();
|
||||||
|
|
||||||
// status
|
// status
|
||||||
private int _flags = 0;
|
private int _flags = 0;
|
||||||
@ -251,8 +253,30 @@ public class BrokerImpl
|
|||||||
private transient boolean _initializeWasInvoked = false;
|
private transient boolean _initializeWasInvoked = false;
|
||||||
private LinkedList _fcs;
|
private LinkedList _fcs;
|
||||||
|
|
||||||
// Set of supported properties
|
// Set of supported property keys. The keys in this set correspond to bean-style setter methods
|
||||||
private Set<String> _supportedPropertyNames;
|
// that can be set by reflection. The keys are not qualified by any prefix.
|
||||||
|
private static Set<String> _supportedPropertyNames;
|
||||||
|
static {
|
||||||
|
_supportedPropertyNames = new HashSet<String>();
|
||||||
|
_supportedPropertyNames.addAll(Arrays.asList(new String[] {
|
||||||
|
"AutoClear",
|
||||||
|
"AutoDetach",
|
||||||
|
"CacheFinderQuery",
|
||||||
|
"CachePreparedQuery",
|
||||||
|
"DetachedNew",
|
||||||
|
"DetachState",
|
||||||
|
"EvictFromDataCache",
|
||||||
|
"IgnoreChanges",
|
||||||
|
"LifecycleListenerCallbackMode",
|
||||||
|
"Multithreaded",
|
||||||
|
"NontransactionalRead",
|
||||||
|
"NontransactionalWrite",
|
||||||
|
"Optimistic",
|
||||||
|
"PopulateDataCache",
|
||||||
|
"RestoreState",
|
||||||
|
"RetainState",
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the persistence manager's authentication. This is the first
|
* Set the persistence manager's authentication. This is the first
|
||||||
@ -472,8 +496,6 @@ public class BrokerImpl
|
|||||||
public void setIgnoreChanges(boolean val) {
|
public void setIgnoreChanges(boolean val) {
|
||||||
assertOpen();
|
assertOpen();
|
||||||
_ignoreChanges = val;
|
_ignoreChanges = val;
|
||||||
_changedProperties.put("IgnoreChanges", String
|
|
||||||
.valueOf(_ignoreChanges));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean getNontransactionalRead() {
|
public boolean getNontransactionalRead() {
|
||||||
@ -492,8 +514,6 @@ public class BrokerImpl
|
|||||||
("nontrans-read-not-supported"));
|
("nontrans-read-not-supported"));
|
||||||
|
|
||||||
_nontransRead = val;
|
_nontransRead = val;
|
||||||
_changedProperties.put("NontransactionalRead", String
|
|
||||||
.valueOf(_nontransRead));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean getNontransactionalWrite() {
|
public boolean getNontransactionalWrite() {
|
||||||
@ -506,8 +526,6 @@ public class BrokerImpl
|
|||||||
throw new UserException(_loc.get("illegal-op-in-prestore"));
|
throw new UserException(_loc.get("illegal-op-in-prestore"));
|
||||||
|
|
||||||
_nontransWrite = val;
|
_nontransWrite = val;
|
||||||
_changedProperties.put("NontransactionalWrite", String
|
|
||||||
.valueOf(_nontransWrite));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean getOptimistic() {
|
public boolean getOptimistic() {
|
||||||
@ -526,8 +544,6 @@ public class BrokerImpl
|
|||||||
("optimistic-not-supported"));
|
("optimistic-not-supported"));
|
||||||
|
|
||||||
_optimistic = val;
|
_optimistic = val;
|
||||||
_changedProperties.put("Optimistic", String
|
|
||||||
.valueOf(_optimistic));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getRestoreState() {
|
public int getRestoreState() {
|
||||||
@ -541,8 +557,6 @@ public class BrokerImpl
|
|||||||
"Restore"));
|
"Restore"));
|
||||||
|
|
||||||
_restoreState = val;
|
_restoreState = val;
|
||||||
_changedProperties.put("RestoreState", String
|
|
||||||
.valueOf(_restoreState));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean getRetainState() {
|
public boolean getRetainState() {
|
||||||
@ -554,8 +568,6 @@ public class BrokerImpl
|
|||||||
if ((_flags & FLAG_PRESTORING) != 0)
|
if ((_flags & FLAG_PRESTORING) != 0)
|
||||||
throw new UserException(_loc.get("illegal-op-in-prestore"));
|
throw new UserException(_loc.get("illegal-op-in-prestore"));
|
||||||
_retainState = val;
|
_retainState = val;
|
||||||
_changedProperties.put("RetainState", String
|
|
||||||
.valueOf(_retainState));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getAutoClear() {
|
public int getAutoClear() {
|
||||||
@ -565,7 +577,6 @@ public class BrokerImpl
|
|||||||
public void setAutoClear(int val) {
|
public void setAutoClear(int val) {
|
||||||
assertOpen();
|
assertOpen();
|
||||||
_autoClear = val;
|
_autoClear = val;
|
||||||
_changedProperties.put("AutoClear", String.valueOf(_autoClear));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getAutoDetach() {
|
public int getAutoDetach() {
|
||||||
@ -575,8 +586,6 @@ public class BrokerImpl
|
|||||||
public void setAutoDetach(int detachFlags) {
|
public void setAutoDetach(int detachFlags) {
|
||||||
assertOpen();
|
assertOpen();
|
||||||
_autoDetach = detachFlags;
|
_autoDetach = detachFlags;
|
||||||
_changedProperties.put("AutoDetach", String
|
|
||||||
.valueOf(_autoDetach));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setAutoDetach(int detachFlag, boolean on) {
|
public void setAutoDetach(int detachFlag, boolean on) {
|
||||||
@ -585,8 +594,6 @@ public class BrokerImpl
|
|||||||
_autoDetach |= detachFlag;
|
_autoDetach |= detachFlag;
|
||||||
else
|
else
|
||||||
_autoDetach &= ~detachFlag;
|
_autoDetach &= ~detachFlag;
|
||||||
_changedProperties.put("AutoDetach", String
|
|
||||||
.valueOf(_autoDetach));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getDetachState() {
|
public int getDetachState() {
|
||||||
@ -596,8 +603,6 @@ public class BrokerImpl
|
|||||||
public void setDetachState(int mode) {
|
public void setDetachState(int mode) {
|
||||||
assertOpen();
|
assertOpen();
|
||||||
_detachState = mode;
|
_detachState = mode;
|
||||||
_changedProperties.put("DetachState", String
|
|
||||||
.valueOf(_detachState));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isDetachedNew() {
|
public boolean isDetachedNew() {
|
||||||
@ -668,65 +673,29 @@ public class BrokerImpl
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Map<String, String> getProperties() {
|
/**
|
||||||
Map<String, String> currentProperties = _conf.getAllProperties();
|
* Get current configuration property values used by this instance.
|
||||||
|
* This values are combination of the current configuration values
|
||||||
// Update the properties from the config with properties that may
|
* overwritten by values maintained by this instance such as
|
||||||
// have changed for this broker
|
* Optimistic flag.
|
||||||
if (!_changedProperties.isEmpty()) {
|
*/
|
||||||
Set<String> changedKeys = _changedProperties.keySet();
|
public Map<String, Object> getProperties() {
|
||||||
for (String changedKey : changedKeys) {
|
Map props = _conf.toProperties(true);
|
||||||
Value value = _conf.getValue(changedKey);
|
for (String s : _supportedPropertyNames) {
|
||||||
String valueKey = value.getLoadKey();
|
props.put("openjpa." + s, Reflection.getValue(this, s, true));
|
||||||
if (valueKey == null) {
|
|
||||||
valueKey = "openjpa." + value.getProperty();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (currentProperties.containsKey(valueKey)) {
|
|
||||||
currentProperties.put(valueKey, _changedProperties
|
|
||||||
.get(changedKey));
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
Set<String> equivalentKeys = value.getEquivalentKeys();
|
|
||||||
if (!equivalentKeys.isEmpty()) {
|
|
||||||
for (String equivalentKey : equivalentKeys) {
|
|
||||||
if (currentProperties.containsKey(equivalentKey)) {
|
|
||||||
currentProperties.put(equivalentKey,
|
|
||||||
_changedProperties.get(changedKey));
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
return props;
|
||||||
return currentProperties;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the property names that can be used to corresponding setter methods of this receiver
|
||||||
|
* to set its value.
|
||||||
|
*/
|
||||||
public Set<String> getSupportedProperties() {
|
public Set<String> getSupportedProperties() {
|
||||||
if (_supportedPropertyNames == null) {
|
Set<String> keys = _conf.getPropertyKeys();
|
||||||
_supportedPropertyNames = new TreeSet<String>();
|
for (String s : _supportedPropertyNames)
|
||||||
_supportedPropertyNames.add("AutoClear");
|
keys.add("openjpa." + s);
|
||||||
_supportedPropertyNames.add("AutoDetach");
|
return keys;
|
||||||
_supportedPropertyNames.add("DetachState");
|
|
||||||
_supportedPropertyNames.add("IgnoreChanges");
|
|
||||||
_supportedPropertyNames.add("LockTimeout");
|
|
||||||
_supportedPropertyNames.add("Multithreaded");
|
|
||||||
_supportedPropertyNames.add("NontransactionalRead");
|
|
||||||
_supportedPropertyNames.add("NontransactionalWrite");
|
|
||||||
_supportedPropertyNames.add("Optimistic");
|
|
||||||
_supportedPropertyNames.add("RestoreState");
|
|
||||||
_supportedPropertyNames.add("RetainState");
|
|
||||||
}
|
|
||||||
Set<String> supportedProperties = new LinkedHashSet<String>();
|
|
||||||
for (String propertyName : _supportedPropertyNames) {
|
|
||||||
supportedProperties.addAll(_conf.getPropertyKeys(propertyName));
|
|
||||||
}
|
|
||||||
supportedProperties.add("javax.persistence.query.timeout");
|
|
||||||
supportedProperties.add("javax.persistence.lock.timeout");
|
|
||||||
|
|
||||||
return supportedProperties;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ////////
|
// ////////
|
||||||
|
@ -180,7 +180,7 @@ public class DelegatingBroker
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Map<String, String> getProperties() {
|
public Map<String,Object> getProperties() {
|
||||||
try {
|
try {
|
||||||
return _broker.getProperties();
|
return _broker.getProperties();
|
||||||
} catch (RuntimeException re) {
|
} catch (RuntimeException re) {
|
||||||
|
@ -50,7 +50,7 @@ public class BooleanValue extends Value {
|
|||||||
/**
|
/**
|
||||||
* The internal value.
|
* The internal value.
|
||||||
*/
|
*/
|
||||||
public boolean get() {
|
public Boolean get() {
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -51,7 +51,7 @@ public class DoubleValue extends Value {
|
|||||||
/**
|
/**
|
||||||
* The internal value.
|
* The internal value.
|
||||||
*/
|
*/
|
||||||
public double get() {
|
public Double get() {
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -40,6 +40,7 @@ public abstract class Value implements Cloneable {
|
|||||||
|
|
||||||
private static final String[] EMPTY_ALIASES = new String[0];
|
private static final String[] EMPTY_ALIASES = new String[0];
|
||||||
private static final Localizer s_loc = Localizer.forPackage(Value.class);
|
private static final Localizer s_loc = Localizer.forPackage(Value.class);
|
||||||
|
public static final String INVISIBLE = "******";
|
||||||
|
|
||||||
private String prop = null;
|
private String prop = null;
|
||||||
private String loadKey = null;
|
private String loadKey = null;
|
||||||
@ -53,7 +54,7 @@ public abstract class Value implements Cloneable {
|
|||||||
private String originalValue = null;
|
private String originalValue = null;
|
||||||
private Set<String> otherNames = null;
|
private Set<String> otherNames = null;
|
||||||
private boolean visible = true;
|
private boolean visible = true;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Default constructor.
|
* Default constructor.
|
||||||
*/
|
*/
|
||||||
@ -285,7 +286,7 @@ public abstract class Value implements Cloneable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The default value for the propert as a string.
|
* The default value for the property as a string.
|
||||||
*/
|
*/
|
||||||
public void setDefault(String def) {
|
public void setDefault(String def) {
|
||||||
this.def = def;
|
this.def = def;
|
||||||
@ -411,7 +412,7 @@ public abstract class Value implements Cloneable {
|
|||||||
/**
|
/**
|
||||||
* Returns the type of the property that this Value represents.
|
* Returns the type of the property that this Value represents.
|
||||||
*/
|
*/
|
||||||
public abstract Class getValueType();
|
public abstract Class<?> getValueType();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the internal string form of this value.
|
* Return the internal string form of this value.
|
||||||
@ -559,4 +560,13 @@ public abstract class Value implements Cloneable {
|
|||||||
public void setVisible(boolean visible) {
|
public void setVisible(boolean visible) {
|
||||||
this.visible = visible;
|
this.visible = visible;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the actual data stored in this value.
|
||||||
|
*/
|
||||||
|
public abstract Object get();
|
||||||
|
|
||||||
|
public String toString() {
|
||||||
|
return getProperty()+ ":" + get() + "[" + getValueType().getName() + "]";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -28,6 +28,7 @@ import java.io.ObjectOutput;
|
|||||||
import java.io.ObjectOutputStream;
|
import java.io.ObjectOutputStream;
|
||||||
import java.io.ObjectStreamClass;
|
import java.io.ObjectStreamClass;
|
||||||
import java.lang.reflect.Array;
|
import java.lang.reflect.Array;
|
||||||
|
import java.lang.reflect.Method;
|
||||||
import java.sql.Connection;
|
import java.sql.Connection;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
@ -53,6 +54,7 @@ import org.apache.openjpa.conf.OpenJPAConfiguration;
|
|||||||
import org.apache.openjpa.ee.ManagedRuntime;
|
import org.apache.openjpa.ee.ManagedRuntime;
|
||||||
import org.apache.openjpa.enhance.PCEnhancer;
|
import org.apache.openjpa.enhance.PCEnhancer;
|
||||||
import org.apache.openjpa.enhance.PCRegistry;
|
import org.apache.openjpa.enhance.PCRegistry;
|
||||||
|
import org.apache.openjpa.enhance.Reflection;
|
||||||
import org.apache.openjpa.kernel.AbstractBrokerFactory;
|
import org.apache.openjpa.kernel.AbstractBrokerFactory;
|
||||||
import org.apache.openjpa.kernel.Broker;
|
import org.apache.openjpa.kernel.Broker;
|
||||||
import org.apache.openjpa.kernel.DelegatingBroker;
|
import org.apache.openjpa.kernel.DelegatingBroker;
|
||||||
@ -66,6 +68,7 @@ import org.apache.openjpa.kernel.QueryFlushModes;
|
|||||||
import org.apache.openjpa.kernel.QueryLanguages;
|
import org.apache.openjpa.kernel.QueryLanguages;
|
||||||
import org.apache.openjpa.kernel.Seq;
|
import org.apache.openjpa.kernel.Seq;
|
||||||
import org.apache.openjpa.kernel.jpql.JPQLParser;
|
import org.apache.openjpa.kernel.jpql.JPQLParser;
|
||||||
|
import org.apache.openjpa.lib.log.Log;
|
||||||
import org.apache.openjpa.lib.util.Closeable;
|
import org.apache.openjpa.lib.util.Closeable;
|
||||||
import org.apache.openjpa.lib.util.Localizer;
|
import org.apache.openjpa.lib.util.Localizer;
|
||||||
import org.apache.openjpa.meta.ClassMetaData;
|
import org.apache.openjpa.meta.ClassMetaData;
|
||||||
@ -81,6 +84,8 @@ import org.apache.openjpa.util.RuntimeExceptionTranslator;
|
|||||||
import org.apache.openjpa.util.UserException;
|
import org.apache.openjpa.util.UserException;
|
||||||
import org.apache.openjpa.util.WrappedException;
|
import org.apache.openjpa.util.WrappedException;
|
||||||
|
|
||||||
|
import serp.util.Strings;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implementation of {@link EntityManager} interface.
|
* Implementation of {@link EntityManager} interface.
|
||||||
*
|
*
|
||||||
@ -92,17 +97,14 @@ public class EntityManagerImpl
|
|||||||
implements OpenJPAEntityManagerSPI, Externalizable,
|
implements OpenJPAEntityManagerSPI, Externalizable,
|
||||||
FindCallbacks, OpCallbacks, Closeable, OpenJPAEntityTransaction {
|
FindCallbacks, OpCallbacks, Closeable, OpenJPAEntityTransaction {
|
||||||
|
|
||||||
private static final Localizer _loc = Localizer.forPackage
|
private static final Localizer _loc = Localizer.forPackage(EntityManagerImpl.class);
|
||||||
(EntityManagerImpl.class);
|
|
||||||
private static final Object[] EMPTY_OBJECTS = new Object[0];
|
private static final Object[] EMPTY_OBJECTS = new Object[0];
|
||||||
|
|
||||||
private DelegatingBroker _broker;
|
private DelegatingBroker _broker;
|
||||||
private EntityManagerFactoryImpl _emf;
|
private EntityManagerFactoryImpl _emf;
|
||||||
private Map<FetchConfiguration,FetchPlan> _plans =
|
private Map<FetchConfiguration,FetchPlan> _plans = new IdentityHashMap<FetchConfiguration,FetchPlan>(1);
|
||||||
new IdentityHashMap<FetchConfiguration,FetchPlan>(1);
|
|
||||||
|
|
||||||
private RuntimeExceptionTranslator _ret =
|
private RuntimeExceptionTranslator _ret = PersistenceExceptions.getRollbackTranslator(this);
|
||||||
PersistenceExceptions.getRollbackTranslator(this);
|
|
||||||
|
|
||||||
public EntityManagerImpl() {
|
public EntityManagerImpl() {
|
||||||
// for Externalizable
|
// for Externalizable
|
||||||
@ -111,8 +113,7 @@ public class EntityManagerImpl
|
|||||||
/**
|
/**
|
||||||
* Constructor; supply factory and delegate.
|
* Constructor; supply factory and delegate.
|
||||||
*/
|
*/
|
||||||
public EntityManagerImpl(EntityManagerFactoryImpl factory,
|
public EntityManagerImpl(EntityManagerFactoryImpl factory, Broker broker) {
|
||||||
Broker broker) {
|
|
||||||
initialize(factory, broker);
|
initialize(factory, broker);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1551,19 +1552,14 @@ public class EntityManagerImpl
|
|||||||
return createQuery(jpql);
|
return createQuery(jpql);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* @see javax.persistence.EntityManager#getProperties()
|
|
||||||
*
|
|
||||||
* This does not return the password property.
|
|
||||||
*/
|
|
||||||
public Map<String, Object> getProperties() {
|
public Map<String, Object> getProperties() {
|
||||||
Map<String, String> currentProperties = _broker.getProperties();
|
Map props = _broker.getProperties();
|
||||||
|
for (String s : _broker.getSupportedProperties()) {
|
||||||
// Convert the <String, String> map into a <String, Object> map
|
Method getter = Reflection.findGetter(this.getClass(), getPropertyName(s), false);
|
||||||
Map<String, Object> finalMap =
|
if (getter != null)
|
||||||
new HashMap<String, Object>(currentProperties);
|
props.put(s, Reflection.get(this, getter));
|
||||||
|
}
|
||||||
return finalMap;
|
return props;
|
||||||
}
|
}
|
||||||
|
|
||||||
public CriteriaBuilder getQueryBuilder() {
|
public CriteriaBuilder getQueryBuilder() {
|
||||||
@ -1614,8 +1610,29 @@ public class EntityManagerImpl
|
|||||||
return _emf.getMetamodel();
|
return _emf.getMetamodel();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setProperty(String arg0, Object arg1) {
|
public void setProperty(String prop, Object value) {
|
||||||
throw new UnsupportedOperationException(
|
String beanProp = getPropertyName(prop);
|
||||||
"JPA 2.0 - Method not yet implemented");
|
try {
|
||||||
|
Method setter = Reflection.findSetter(this.getClass(), beanProp, false);
|
||||||
|
if (setter != null) {
|
||||||
|
if (value instanceof String) {
|
||||||
|
if ("null".equals(value)) {
|
||||||
|
value = null;
|
||||||
|
} else {
|
||||||
|
value = Strings.parse((String) value, setter.getParameterTypes()[0]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Reflection.set(this, setter, value);
|
||||||
|
}
|
||||||
|
} catch (Exception ex) {
|
||||||
|
Log log = getConfiguration().getLog(OpenJPAConfiguration.LOG_RUNTIME);
|
||||||
|
if (log.isWarnEnabled())
|
||||||
|
log.warn(_loc.get("bad-em-prop", prop, value));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
String getPropertyName(String s) {
|
||||||
|
int dot = s.lastIndexOf('.');
|
||||||
|
return dot == -1 ? s : s.substring(dot+1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -99,6 +99,11 @@ public class PersistenceProductDerivation
|
|||||||
public int getType() {
|
public int getType() {
|
||||||
return TYPE_SPEC;
|
return TYPE_SPEC;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getConfigurationPrefix() {
|
||||||
|
return "javax.persistence";
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void validate()
|
public void validate()
|
||||||
@ -174,8 +179,7 @@ public class PersistenceProductDerivation
|
|||||||
conf.lockManagerPlugin.setString("mixed");
|
conf.lockManagerPlugin.setString("mixed");
|
||||||
conf.nontransactionalWrite.setDefault("true");
|
conf.nontransactionalWrite.setDefault("true");
|
||||||
conf.nontransactionalWrite.set(true);
|
conf.nontransactionalWrite.set(true);
|
||||||
int specVersion = ((OpenJPAConfiguration) c).getSpecificationInstance()
|
int specVersion = ((OpenJPAConfiguration) c).getSpecificationInstance().getVersion();
|
||||||
.getVersion();
|
|
||||||
if (specVersion < 2) {
|
if (specVersion < 2) {
|
||||||
Compatibility compatibility = conf.getCompatibilityInstance();
|
Compatibility compatibility = conf.getCompatibilityInstance();
|
||||||
compatibility.setFlushBeforeDetach(true);
|
compatibility.setFlushBeforeDetach(true);
|
||||||
@ -354,7 +358,7 @@ public class PersistenceProductDerivation
|
|||||||
*/
|
*/
|
||||||
public boolean checkPuNameCollisions(Log logger,String puName){
|
public boolean checkPuNameCollisions(Log logger,String puName){
|
||||||
PUNameCollision p = _puNameCollisions.get(puName);
|
PUNameCollision p = _puNameCollisions.get(puName);
|
||||||
if(p!=null){
|
if (p != null){
|
||||||
p.logCollision(logger);
|
p.logCollision(logger);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -365,13 +369,10 @@ public class PersistenceProductDerivation
|
|||||||
throws IOException {
|
throws IOException {
|
||||||
Enumeration<URL> urls = null;
|
Enumeration<URL> urls = null;
|
||||||
try {
|
try {
|
||||||
urls = AccessController.doPrivileged(
|
urls = AccessController.doPrivileged(J2DoPrivHelper.getResourcesAction(loader, rsrc));
|
||||||
J2DoPrivHelper.getResourcesAction(loader, rsrc));
|
|
||||||
if (!urls.hasMoreElements()) {
|
if (!urls.hasMoreElements()) {
|
||||||
if (!rsrc.startsWith("META-INF"))
|
if (!rsrc.startsWith("META-INF"))
|
||||||
urls = AccessController.doPrivileged(
|
urls = AccessController.doPrivileged(J2DoPrivHelper.getResourcesAction(loader, "META-INF/" + rsrc));
|
||||||
J2DoPrivHelper.getResourcesAction(
|
|
||||||
loader, "META-INF/" + rsrc));
|
|
||||||
if (!urls.hasMoreElements())
|
if (!urls.hasMoreElements())
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@ -396,22 +397,19 @@ public class PersistenceProductDerivation
|
|||||||
String name, Map m, ClassLoader loader, boolean explicit)
|
String name, Map m, ClassLoader loader, boolean explicit)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
if (loader == null)
|
if (loader == null)
|
||||||
loader = AccessController.doPrivileged(
|
loader = AccessController.doPrivileged(J2DoPrivHelper.getContextClassLoaderAction());
|
||||||
J2DoPrivHelper.getContextClassLoaderAction());
|
|
||||||
|
|
||||||
List<URL> urls = getResourceURLs(rsrc, loader);
|
List<URL> urls = getResourceURLs(rsrc, loader);
|
||||||
if (urls == null || urls.size() == 0)
|
if (urls == null || urls.size() == 0)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
ConfigurationParser parser = new ConfigurationParser(m);
|
ConfigurationParser parser = new ConfigurationParser(m);
|
||||||
PersistenceUnitInfoImpl pinfo = parseResources(parser, urls, name,
|
PersistenceUnitInfoImpl pinfo = parseResources(parser, urls, name, loader);
|
||||||
loader);
|
|
||||||
if (pinfo == null) {
|
if (pinfo == null) {
|
||||||
if (!explicit)
|
if (!explicit)
|
||||||
return Boolean.FALSE;
|
return Boolean.FALSE;
|
||||||
throw new MissingResourceException(_loc.get("missing-xml-config",
|
throw new MissingResourceException(_loc.get("missing-xml-config",
|
||||||
rsrc, String.valueOf(name)).getMessage(), getClass().getName(),
|
rsrc, String.valueOf(name)).getMessage(), getClass().getName(), rsrc);
|
||||||
rsrc);
|
|
||||||
} else if (!isOpenJPAPersistenceProvider(pinfo, loader)) {
|
} else if (!isOpenJPAPersistenceProvider(pinfo, loader)) {
|
||||||
if (!explicit) {
|
if (!explicit) {
|
||||||
warnUnknownProvider(pinfo);
|
warnUnknownProvider(pinfo);
|
||||||
@ -434,8 +432,7 @@ public class PersistenceProductDerivation
|
|||||||
private PersistenceUnitInfoImpl parseResources(ConfigurationParser parser,
|
private PersistenceUnitInfoImpl parseResources(ConfigurationParser parser,
|
||||||
List<URL> urls, String name, ClassLoader loader)
|
List<URL> urls, String name, ClassLoader loader)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
List<PersistenceUnitInfoImpl> pinfos =
|
List<PersistenceUnitInfoImpl> pinfos = new ArrayList<PersistenceUnitInfoImpl>();
|
||||||
new ArrayList<PersistenceUnitInfoImpl>();
|
|
||||||
for (URL url : urls) {
|
for (URL url : urls) {
|
||||||
parser.parse(url);
|
parser.parse(url);
|
||||||
pinfos.addAll((List<PersistenceUnitInfoImpl>) parser.getResults());
|
pinfos.addAll((List<PersistenceUnitInfoImpl>) parser.getResults());
|
||||||
@ -455,16 +452,13 @@ public class PersistenceProductDerivation
|
|||||||
// found named unit?
|
// found named unit?
|
||||||
if (name != null) {
|
if (name != null) {
|
||||||
if (name.equals(pinfo.getPersistenceUnitName())){
|
if (name.equals(pinfo.getPersistenceUnitName())){
|
||||||
|
if (result != null){
|
||||||
if(result!=null){
|
this.addPuNameCollision(name, result.getPersistenceXmlFileUrl().toString(),
|
||||||
this.addPuNameCollision(name,
|
|
||||||
result.getPersistenceXmlFileUrl().toString(),
|
|
||||||
pinfo.getPersistenceXmlFileUrl().toString());
|
pinfo.getPersistenceXmlFileUrl().toString());
|
||||||
|
|
||||||
}else{
|
} else {
|
||||||
// Grab a ref to the pinfo that matches the name we're
|
// Grab a ref to the pinfo that matches the name we're
|
||||||
// looking for. Keep going to look for duplicate pu
|
// looking for. Keep going to look for duplicate pu names.
|
||||||
// names.
|
|
||||||
result = pinfo;
|
result = pinfo;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -473,8 +467,7 @@ public class PersistenceProductDerivation
|
|||||||
|
|
||||||
if (isOpenJPAPersistenceProvider(pinfo, loader)) {
|
if (isOpenJPAPersistenceProvider(pinfo, loader)) {
|
||||||
// if no name given and found unnamed unit, return it.
|
// if no name given and found unnamed unit, return it.
|
||||||
// otherwise record as default unit unless we find a
|
// otherwise record as default unit unless we find a better match later
|
||||||
// better match later
|
|
||||||
if (StringUtils.isEmpty(pinfo.getPersistenceUnitName()))
|
if (StringUtils.isEmpty(pinfo.getPersistenceUnitName()))
|
||||||
return pinfo;
|
return pinfo;
|
||||||
if (ojpa == null)
|
if (ojpa == null)
|
||||||
@ -493,16 +486,13 @@ public class PersistenceProductDerivation
|
|||||||
private static boolean isOpenJPAPersistenceProvider
|
private static boolean isOpenJPAPersistenceProvider
|
||||||
(PersistenceUnitInfo pinfo, ClassLoader loader) {
|
(PersistenceUnitInfo pinfo, ClassLoader loader) {
|
||||||
String provider = pinfo.getPersistenceProviderClassName();
|
String provider = pinfo.getPersistenceProviderClassName();
|
||||||
if (StringUtils.isEmpty(provider)
|
if (StringUtils.isEmpty(provider) || PersistenceProviderImpl.class.getName().equals(provider))
|
||||||
|| PersistenceProviderImpl.class.getName().equals(provider))
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if (loader == null)
|
if (loader == null)
|
||||||
loader = AccessController.doPrivileged(
|
loader = AccessController.doPrivileged(J2DoPrivHelper.getContextClassLoaderAction());
|
||||||
J2DoPrivHelper.getContextClassLoaderAction());
|
|
||||||
try {
|
try {
|
||||||
if (PersistenceProviderImpl.class.isAssignableFrom
|
if (PersistenceProviderImpl.class.isAssignableFrom(Class.forName(provider, false, loader)))
|
||||||
(Class.forName(provider, false, loader)))
|
|
||||||
return true;
|
return true;
|
||||||
} catch (Throwable t) {
|
} catch (Throwable t) {
|
||||||
log(_loc.get("unloadable-provider", provider, t).getMessage());
|
log(_loc.get("unloadable-provider", provider, t).getMessage());
|
||||||
@ -516,8 +506,7 @@ public class PersistenceProductDerivation
|
|||||||
* provider.
|
* provider.
|
||||||
*/
|
*/
|
||||||
private static void warnUnknownProvider(PersistenceUnitInfo pinfo) {
|
private static void warnUnknownProvider(PersistenceUnitInfo pinfo) {
|
||||||
log(_loc.get("unrecognized-provider",
|
log(_loc.get("unrecognized-provider", pinfo.getPersistenceProviderClassName()).getMessage());
|
||||||
pinfo.getPersistenceProviderClassName()).getMessage());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -530,13 +519,11 @@ public class PersistenceProductDerivation
|
|||||||
|
|
||||||
private void addPuNameCollision(String puName, String file1, String file2){
|
private void addPuNameCollision(String puName, String file1, String file2){
|
||||||
PUNameCollision pun = _puNameCollisions.get(puName);
|
PUNameCollision pun = _puNameCollisions.get(puName);
|
||||||
if(pun!=null){
|
if (pun != null){
|
||||||
pun.addCollision(file1, file2);
|
pun.addCollision(file1, file2);
|
||||||
}else{
|
} else {
|
||||||
_puNameCollisions.put(puName,
|
_puNameCollisions.put(puName, new PUNameCollision(puName, file1, file2));
|
||||||
new PUNameCollision(puName, file1, file2));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -565,17 +552,13 @@ public class PersistenceProductDerivation
|
|||||||
public void setInto(Configuration conf) {
|
public void setInto(Configuration conf) {
|
||||||
if (conf instanceof OpenJPAConfiguration) {
|
if (conf instanceof OpenJPAConfiguration) {
|
||||||
OpenJPAConfiguration oconf = (OpenJPAConfiguration) conf;
|
OpenJPAConfiguration oconf = (OpenJPAConfiguration) conf;
|
||||||
Object persistenceVersion =
|
Object persistenceVersion = getProperties().get(PersistenceUnitInfoImpl.PERSISTENCE_VERSION);
|
||||||
getProperties().get(
|
|
||||||
PersistenceUnitInfoImpl.PERSISTENCE_VERSION);
|
|
||||||
if (persistenceVersion == null) {
|
if (persistenceVersion == null) {
|
||||||
oconf.setSpecification(SPEC_JPA);
|
oconf.setSpecification(SPEC_JPA);
|
||||||
} else {
|
} else {
|
||||||
// Set the spec level based on the persistence version
|
// Set the spec level based on the persistence version
|
||||||
oconf.setSpecification("jpa " +
|
oconf.setSpecification("jpa " + persistenceVersion.toString());
|
||||||
persistenceVersion.toString());
|
getProperties().remove(PersistenceUnitInfoImpl.PERSISTENCE_VERSION);
|
||||||
getProperties().remove(
|
|
||||||
PersistenceUnitInfoImpl.PERSISTENCE_VERSION);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -586,12 +569,10 @@ public class PersistenceProductDerivation
|
|||||||
// the global value with our settings
|
// the global value with our settings
|
||||||
String orig = oconf.getMetaDataFactory();
|
String orig = oconf.getMetaDataFactory();
|
||||||
if (!StringUtils.isEmpty(orig)) {
|
if (!StringUtils.isEmpty(orig)) {
|
||||||
String key = ProductDerivations.getConfigurationKey
|
String key = ProductDerivations.getConfigurationKey("MetaDataFactory", getProperties());
|
||||||
("MetaDataFactory", getProperties());
|
|
||||||
Object override = getProperties().get(key);
|
Object override = getProperties().get(key);
|
||||||
if (override instanceof String)
|
if (override instanceof String)
|
||||||
addProperty(key, Configurations.combinePlugins(orig,
|
addProperty(key, Configurations.combinePlugins(orig, (String) override));
|
||||||
(String) override));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -674,16 +655,14 @@ public class PersistenceProductDerivation
|
|||||||
protected Object getSchemaSource() {
|
protected Object getSchemaSource() {
|
||||||
// use the version 1 schema by default. non-versioned docs will
|
// use the version 1 schema by default. non-versioned docs will
|
||||||
// continue to parse with the old xml if they do not contain a
|
// continue to parse with the old xml if they do not contain a
|
||||||
// persistence-unit. that is currently the only signficant change
|
// persistence-unit. that is currently the only significant change
|
||||||
// to the schema. if more significant changes are made in the
|
// to the schema. if more significant changes are made in the
|
||||||
// future, the 2.0 schema may be preferable.
|
// future, the 2.0 schema may be preferable.
|
||||||
String persistencexsd = "persistence-xsd.rsrc";
|
String persistencexsd = "persistence-xsd.rsrc";
|
||||||
// if the version and/or schema location is for 1.0, use the 1.0
|
// if the version and/or schema location is for 1.0, use the 1.0
|
||||||
// schema
|
// schema
|
||||||
if (_persistenceVersion != null &&
|
if (_persistenceVersion != null && _persistenceVersion.equals(XMLVersionParser.VERSION_2_0)
|
||||||
_persistenceVersion.equals(XMLVersionParser.VERSION_2_0) ||
|
|| (_schemaLocation != null && _schemaLocation.indexOf(PERSISTENCE_XSD_2_0) != -1)) {
|
||||||
(_schemaLocation != null &&
|
|
||||||
_schemaLocation.indexOf(PERSISTENCE_XSD_2_0) != -1)) {
|
|
||||||
persistencexsd = "persistence_2_0-xsd.rsrc";
|
persistencexsd = "persistence_2_0-xsd.rsrc";
|
||||||
}
|
}
|
||||||
return getClass().getResourceAsStream(persistencexsd);
|
return getClass().getResourceAsStream(persistencexsd);
|
||||||
@ -701,8 +680,7 @@ public class PersistenceProductDerivation
|
|||||||
if (currentDepth() == 1)
|
if (currentDepth() == 1)
|
||||||
startPersistenceUnit(attrs);
|
startPersistenceUnit(attrs);
|
||||||
else if (currentDepth() == 3 && "property".equals(name))
|
else if (currentDepth() == 3 && "property".equals(name))
|
||||||
_info.setProperty(attrs.getValue("name"),
|
_info.setProperty(attrs.getValue("name"), attrs.getValue("value"));
|
||||||
attrs.getValue("value"));
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -772,16 +750,15 @@ public class PersistenceProductDerivation
|
|||||||
// transaction type to local
|
// transaction type to local
|
||||||
String val = attrs.getValue("transaction-type");
|
String val = attrs.getValue("transaction-type");
|
||||||
if (val == null)
|
if (val == null)
|
||||||
_info.setTransactionType
|
_info.setTransactionType(PersistenceUnitTransactionType.RESOURCE_LOCAL);
|
||||||
(PersistenceUnitTransactionType.RESOURCE_LOCAL);
|
|
||||||
else
|
else
|
||||||
_info.setTransactionType(Enum.valueOf
|
_info.setTransactionType(Enum.valueOf(PersistenceUnitTransactionType.class, val));
|
||||||
(PersistenceUnitTransactionType.class, val));
|
|
||||||
|
|
||||||
if (_source != null)
|
if (_source != null)
|
||||||
_info.setPersistenceXmlFileUrl(_source);
|
_info.setPersistenceXmlFileUrl(_source);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This private class is used to hold onto information regarding
|
* This private class is used to hold onto information regarding
|
||||||
* PersistentUnit name collisions.
|
* PersistentUnit name collisions.
|
||||||
@ -797,13 +774,14 @@ public class PersistenceProductDerivation
|
|||||||
|
|
||||||
_puName=puName;
|
_puName=puName;
|
||||||
}
|
}
|
||||||
|
|
||||||
void logCollision(Log logger){
|
void logCollision(Log logger){
|
||||||
if(logger.isWarnEnabled()){
|
if(logger.isWarnEnabled()){
|
||||||
logger.warn(_loc.getFatal("dup-pu",
|
logger.warn(_loc.getFatal("dup-pu", new Object[]{_puName,_resources.toString(),
|
||||||
new Object[]{_puName,_resources.toString(),
|
_resources.iterator().next()}));
|
||||||
_resources.iterator().next()}));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void addCollision(String file1, String file2){
|
void addCollision(String file1, String file2){
|
||||||
_resources.add(file1);
|
_resources.add(file1);
|
||||||
_resources.add(file2);
|
_resources.add(file2);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user