From 812e184e89c3bf7166a95f2e77ac88fbedc70854 Mon Sep 17 00:00:00 2001 From: Marc Prud'hommeaux Date: Fri, 8 Sep 2006 01:24:18 +0000 Subject: [PATCH] Added openjpa-all module which will manually create an openjpa-all-VERSION.jar file that aggregates all the other openja-*.jar files; fixed Configurations.java to provide more information when a missing services resource is caused by a deeper exception git-svn-id: https://svn.apache.org/repos/asf/incubator/openjpa/trunk@441318 13f79535-47bb-0310-9956-ffa450edef68 --- openjpa-all/pom.xml | 91 +++++++++++++++++++ .../openjpa/lib/conf/Configurations.java | 37 +++++--- openjpa-project/README.txt | 6 +- openjpa-project/assembly.xml | 35 +++++-- openjpa-project/pom.xml | 11 ++- pom.xml | 1 + 6 files changed, 152 insertions(+), 29 deletions(-) create mode 100644 openjpa-all/pom.xml diff --git a/openjpa-all/pom.xml b/openjpa-all/pom.xml new file mode 100644 index 000000000..9a7a61ce6 --- /dev/null +++ b/openjpa-all/pom.xml @@ -0,0 +1,91 @@ + + + 4.0.0 + openjpa-all + jar + OpenJPA Aggregate Jar + + org.apache.openjpa + openjpa + 0.9.0-incubating-SNAPSHOT + + + + + + maven-antrun-plugin + + + build-single-jar + package + + + + + + + + + + + + + Building service: @{servicename} + + + + + + + + + + + + + + run + + + + + + + + org.apache.maven.plugins + maven-jar-plugin + + + + + org.apache.openjpa.enhance.PCEnhancerAgent + + + + + + + + + org.apache.openjpa + openjpa-persistence-jdbc + ${pom.version} + + + diff --git a/openjpa-lib/src/main/java/org/apache/openjpa/lib/conf/Configurations.java b/openjpa-lib/src/main/java/org/apache/openjpa/lib/conf/Configurations.java index 5aa0990b9..c1cb8f155 100644 --- a/openjpa-lib/src/main/java/org/apache/openjpa/lib/conf/Configurations.java +++ b/openjpa-lib/src/main/java/org/apache/openjpa/lib/conf/Configurations.java @@ -18,8 +18,10 @@ package org.apache.openjpa.lib.conf; import java.io.File; import java.io.IOException; import java.util.Arrays; +import java.util.ArrayList; import java.util.Collection; import java.util.Iterator; +import java.util.List; import java.util.Map; import java.util.MissingResourceException; import java.util.Properties; @@ -30,6 +32,7 @@ import javax.naming.NamingException; import org.apache.commons.lang.exception.NestableRuntimeException; import org.apache.openjpa.lib.log.Log; +import org.apache.openjpa.lib.util.JavaVersions; import org.apache.openjpa.lib.util.Localizer; import org.apache.openjpa.lib.util.Options; import org.apache.openjpa.lib.util.ParseException; @@ -466,36 +469,40 @@ public class Configurations { (ConfigurationProvider.class, loader); ConfigurationProvider provider = null; int providerCount = 0; - StringBuffer errs = null; + List errs = null; for (int i = 0; i < impls.length; i++) { - provider = newProvider(impls[i]); - if (provider == null) - continue; - - providerCount++; try { + provider = (ConfigurationProvider) impls[i].newInstance(); + if (provider == null) + continue; + + providerCount++; + if ((globals && provider.loadGlobals(loader)) || (!globals && provider.loadDefaults(loader))) return provider; } catch (MissingResourceException mre) { throw mre; - } catch (Exception e) { - if (errs == null) - errs = new StringBuffer(); - else - errs.append(", "); - errs.append(e.toString()); + } catch (Throwable t) { + (errs == null ? errs = new ArrayList() : errs).add(t); } } String type = (globals) ? "globals" : "defaults"; + MissingResourceException ex = null; + if (errs != null) - throw new MissingResourceException(errs.toString(), + ex = new MissingResourceException(errs.toString(), Configurations.class.getName(), type); - if (providerCount == 0) - throw new MissingResourceException(_loc.get ("no-providers", + else if (providerCount == 0) + ex = new MissingResourceException(_loc.get ("no-providers", ConfigurationProvider.class.getName()).getMessage(), Configurations.class.getName(), type); + + if (ex != null) + throw (MissingResourceException) JavaVersions.initCause(ex, + errs.size() == 0 ? null : (Throwable) errs.get(0)); + return null; } diff --git a/openjpa-project/README.txt b/openjpa-project/README.txt index e88cdf60e..d80eb4ea6 100644 --- a/openjpa-project/README.txt +++ b/openjpa-project/README.txt @@ -1,2 +1,6 @@ -Thanks! +Thank you for downloading this incubator release of OpenJPA. For +documentation and project information, please see: + + http://incubator.apache.org/openjpa/ + diff --git a/openjpa-project/assembly.xml b/openjpa-project/assembly.xml index 38e6f5e17..fc08a875e 100644 --- a/openjpa-project/assembly.xml +++ b/openjpa-project/assembly.xml @@ -12,6 +12,7 @@ NOTICE* + @@ -65,30 +67,43 @@ junit:junit + + + org.apache.openjpa:openjpa-all + org.apache.openjpa:openjpa-lib + org.apache.openjpa:openjpa-kernel + org.apache.openjpa:openjpa-kernel-4 + org.apache.openjpa:openjpa-kernel-5 + org.apache.openjpa:openjpa-jdbc + org.apache.openjpa:openjpa-jdbc-5 + org.apache.openjpa:openjpa-persistence + org.apache.openjpa:openjpa-persistence-jdbc + org.apache.openjpa:openjpa-xmlstore - - - diff --git a/openjpa-project/pom.xml b/openjpa-project/pom.xml index 91338c8ff..b9064e399 100644 --- a/openjpa-project/pom.xml +++ b/openjpa-project/pom.xml @@ -12,7 +12,7 @@ 4.0.0 openjpa-project pom - OpenJPA Project + OpenJPA Distribution org.apache.openjpa openjpa @@ -78,7 +78,7 @@ bin package - assembly + attached assembly.xml @@ -91,7 +91,7 @@ sources package - assembly + attached source-assembly.xml @@ -134,6 +134,11 @@ + + org.apache.openjpa + openjpa-all + ${pom.version} + org.apache.openjpa openjpa-lib diff --git a/pom.xml b/pom.xml index 2fe67a7b9..e66a1b2ef 100644 --- a/pom.xml +++ b/pom.xml @@ -86,6 +86,7 @@ openjpa-kernel openjpa-jdbc openjpa-xmlstore + openjpa-all openjpa-project