openjpa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From p..@apache.org
Subject svn commit: r423271 - in /incubator/openjpa/trunk: openjpa-kernel/src/main/java/org/apache/openjpa/conf/ openjpa-kernel/src/main/java/org/apache/openjpa/kernel/ openjpa-lib/src/main/java/org/apache/openjpa/lib/conf/ openjpa-lib/src/main/resources/org/a...
Date Tue, 18 Jul 2006 22:32:17 GMT
Author: pcl
Date: Tue Jul 18 15:32:16 2006
New Revision: 423271

URL: http://svn.apache.org/viewvc?rev=423271&view=rev
Log:
opened up BrokerFactoryValue bootstrapping configuration a bit; added better error bootstrapping
error messages

Modified:
    incubator/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/conf/BrokerFactoryValue.java
    incubator/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/Bootstrap.java
    incubator/openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/conf/ConfigurationImpl.java
    incubator/openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/conf/Configurations.java
    incubator/openjpa/trunk/openjpa-lib/src/main/resources/org/apache/openjpa/lib/conf/localizer.properties

Modified: incubator/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/conf/BrokerFactoryValue.java
URL: http://svn.apache.org/viewvc/incubator/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/conf/BrokerFactoryValue.java?rev=423271&r1=423270&r2=423271&view=diff
==============================================================================
--- incubator/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/conf/BrokerFactoryValue.java
(original)
+++ incubator/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/conf/BrokerFactoryValue.java
Tue Jul 18 15:32:16 2006
@@ -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 @@
 
     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 BrokerFactoryValue(String prop) {
         super(prop, false);
-        setAliases(ALIASES);
+        setAliases((String[]) _aliases.toArray(new String[_aliases.size()]));
     }
 
     /**
@@ -87,5 +87,15 @@
      */
     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);
     }
 }

Modified: incubator/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/Bootstrap.java
URL: http://svn.apache.org/viewvc/incubator/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/Bootstrap.java?rev=423271&r1=423270&r2=423271&view=diff
==============================================================================
--- incubator/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/Bootstrap.java
(original)
+++ incubator/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/Bootstrap.java
Tue Jul 18 15:32:16 2006
@@ -17,7 +17,6 @@
 
 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;

Modified: incubator/openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/conf/ConfigurationImpl.java
URL: http://svn.apache.org/viewvc/incubator/openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/conf/ConfigurationImpl.java?rev=423271&r1=423270&r2=423271&view=diff
==============================================================================
--- incubator/openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/conf/ConfigurationImpl.java
(original)
+++ incubator/openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/conf/ConfigurationImpl.java
Tue Jul 18 15:32:16 2006
@@ -169,7 +169,7 @@
         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;

Modified: incubator/openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/conf/Configurations.java
URL: http://svn.apache.org/viewvc/incubator/openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/conf/Configurations.java?rev=423271&r1=423270&r2=423271&view=diff
==============================================================================
--- incubator/openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/conf/Configurations.java
(original)
+++ incubator/openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/conf/Configurations.java
Tue Jul 18 15:32:16 2006
@@ -500,7 +500,12 @@
                 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);
     }

Modified: incubator/openjpa/trunk/openjpa-lib/src/main/resources/org/apache/openjpa/lib/conf/localizer.properties
URL: http://svn.apache.org/viewvc/incubator/openjpa/trunk/openjpa-lib/src/main/resources/org/apache/openjpa/lib/conf/localizer.properties?rev=423271&r1=423270&r2=423271&view=diff
==============================================================================
--- incubator/openjpa/trunk/openjpa-lib/src/main/resources/org/apache/openjpa/lib/conf/localizer.properties
(original)
+++ incubator/openjpa/trunk/openjpa-lib/src/main/resources/org/apache/openjpa/lib/conf/localizer.properties
Tue Jul 18 15:32:16 2006
@@ -43,8 +43,9 @@
 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() \



Mime
View raw message