mirror of
https://github.com/apache/openjpa.git
synced 2025-02-20 17:05:15 +00:00
opened up BrokerFactoryValue bootstrapping configuration a bit; added better error bootstrapping error messages
git-svn-id: https://svn.apache.org/repos/asf/incubator/openjpa/trunk@423271 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
99eb918da3
commit
19b401bcc7
@ -15,6 +15,8 @@
|
||||
*/
|
||||
package org.apache.openjpa.conf;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
@ -38,15 +40,13 @@ public class BrokerFactoryValue
|
||||
|
||||
private static final String KEY = "BrokerFactory";
|
||||
|
||||
private static final String[] ALIASES = new String[]{
|
||||
"abstractstore",
|
||||
"org.apache.openjpa.abstractstore.AbstractStoreBrokerFactory",
|
||||
};
|
||||
|
||||
private static final List _aliases = new ArrayList();
|
||||
private static final Collection _prefixes = new HashSet();
|
||||
|
||||
static {
|
||||
_prefixes.add("openjpa");
|
||||
addDefaultAlias("abstractstore",
|
||||
"org.apache.openjpa.abstractstore.AbstractStoreBrokerFactory");
|
||||
}
|
||||
|
||||
public BrokerFactoryValue() {
|
||||
@ -55,7 +55,7 @@ public class BrokerFactoryValue
|
||||
|
||||
public BrokerFactoryValue(String prop) {
|
||||
super(prop, false);
|
||||
setAliases(ALIASES);
|
||||
setAliases((String[]) _aliases.toArray(new String[_aliases.size()]));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -88,4 +88,14 @@ public class BrokerFactoryValue
|
||||
public static void addPropertyPrefix(String prefix) {
|
||||
_prefixes.add(prefix);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Add a mapping from <code>alias</code> to <code>cls</code> to the list
|
||||
* of default aliases for new values created after this invocation.
|
||||
*/
|
||||
public static void addDefaultAlias(String alias, String cls) {
|
||||
_aliases.add(alias);
|
||||
_aliases.add(cls);
|
||||
}
|
||||
}
|
||||
|
@ -17,7 +17,6 @@ package org.apache.openjpa.kernel;
|
||||
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.openjpa.conf.BrokerFactoryValue;
|
||||
import org.apache.openjpa.conf.ProductDerivations;
|
||||
|
@ -169,7 +169,7 @@ public class ConfigurationImpl
|
||||
if (provider == null) {
|
||||
Log log = getConfigurationLog();
|
||||
if (log.isTraceEnabled())
|
||||
log.trace(_loc.get("no-providers"));
|
||||
log.trace(_loc.get("no-default-providers"));
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
@ -500,7 +500,12 @@ public class Configurations {
|
||||
errs.append(e.toString());
|
||||
}
|
||||
}
|
||||
String msg = (errs == null) ? resource : errs.toString();
|
||||
String msg;
|
||||
if (errs != null)
|
||||
msg = errs.toString();
|
||||
else
|
||||
msg = _loc.get("no-provider", resource);
|
||||
|
||||
throw new MissingResourceException(msg,
|
||||
Configurations.class.getName(), resource);
|
||||
}
|
||||
|
@ -43,8 +43,9 @@ not-singleton: You cannot set the value of property "{0}" as an object. The \
|
||||
cant-set-string: Configuration property "{0}" cannot be set from a string. \
|
||||
You must supply the object value.
|
||||
loaded-via-provider: Configuration information loaded via "{0}".
|
||||
no-providers: Default configuration information couldn''t be loaded from any \
|
||||
provider.
|
||||
no-default-providers: Default configuration information couldn''t be loaded \
|
||||
from any configuration provider.
|
||||
no-provider: No registered configuration provider could load "{0}".
|
||||
hook-before: An exception occurred while invoking beforeConfigurationLoad() \
|
||||
on "{0}". This exception will be consumed.
|
||||
hook-after: An exception occurred while invoking afterConfigurationLoad() \
|
||||
|
Loading…
x
Reference in New Issue
Block a user