openjpa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ppod...@apache.org
Subject svn commit: r1190716 [6/10] - in /openjpa/trunk: openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/ant/ openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/conf/ openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/ openjpa-jdbc/src/main/java/org/...
Date Sat, 29 Oct 2011 00:44:18 GMT
Modified: openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/util/Id.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/util/Id.java?rev=1190716&r1=1190715&r2=1190716&view=diff
==============================================================================
--- openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/util/Id.java (original)
+++ openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/util/Id.java Sat Oct 29 00:44:11 2011
@@ -67,8 +67,7 @@ public final class Id
      * instance.
      */
     public Id(String str, OpenJPAConfiguration conf, ClassLoader brokerLoader) {
-        this(str, (conf == null) ? brokerLoader : conf.
-            getClassResolverInstance().getClassLoader(Id.class, brokerLoader));
+        this(str, (conf == null) ? brokerLoader : conf.getClassLoader());
     }
 
     /**

Modified: openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/util/ImplHelper.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/util/ImplHelper.java?rev=1190716&r1=1190715&r2=1190716&view=diff
==============================================================================
--- openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/util/ImplHelper.java (original)
+++ openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/util/ImplHelper.java Sat Oct 29 00:44:11 2011
@@ -146,7 +146,7 @@ public class ImplHelper {
     }
 
     /**
-     * Generate a value for the given metadaa.
+     * Generate a value for the given metadata.
      */
     private static Object generateValue(StoreContext ctx,
         ClassMetaData meta, FieldMetaData fmd, int typeCode) {
@@ -157,8 +157,7 @@ public class ImplHelper {
                 SequenceMetaData smd = (fmd == null)
                     ? meta.getIdentitySequenceMetaData()
                     : fmd.getValueSequenceMetaData();
-                return JavaTypes.convert(smd.getInstance(ctx.getClassLoader()).
-                    next(ctx, meta), typeCode);
+                return JavaTypes.convert(smd.getInstance().next(ctx, meta), typeCode);
             case ValueStrategies.UUID_STRING:
                 return UUIDGenerator.nextString(UUIDGenerator.TYPE1);
             case ValueStrategies.UUID_HEX:

Modified: openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/util/Serialization.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/util/Serialization.java?rev=1190716&r1=1190715&r2=1190716&view=diff
==============================================================================
--- openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/util/Serialization.java (original)
+++ openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/util/Serialization.java Sat Oct 29 00:44:11 2011
@@ -48,8 +48,7 @@ import org.apache.openjpa.lib.util.Multi
  */
 public class Serialization {
 
-    private static final Localizer _loc = Localizer.forPackage
-        (Serialization.class);
+    private static final Localizer _loc = Localizer.forPackage(Serialization.class);
 
     /**
      * Serialize a value that might contain persistent objects. Replaces
@@ -58,8 +57,7 @@ public class Serialization {
     public static byte[] serialize(Object val, StoreContext ctx) {
         ByteArrayOutputStream bytes = new ByteArrayOutputStream();
         try {
-            ObjectOutputStream objs = new PersistentObjectOutputStream(bytes,
-                ctx);
+            ObjectOutputStream objs = new PersistentObjectOutputStream(bytes, ctx);
             objs.writeObject(val);
             objs.flush();
             return bytes.toByteArray();
@@ -100,8 +98,7 @@ public class Serialization {
         /**
          * Constructor; supply underlying stream.
          */
-        public PersistentObjectOutputStream(OutputStream delegate,
-            StoreContext ctx)
+        public PersistentObjectOutputStream(OutputStream delegate, StoreContext ctx)
             throws IOException {
             super(delegate);
             _ctx = ctx;
@@ -155,8 +152,7 @@ public class Serialization {
          * Constructor; supply source stream and broker to
          * use for persistent object lookups.
          */
-        public PersistentObjectInputStream(InputStream delegate,
-            StoreContext ctx)
+        public PersistentObjectInputStream(InputStream delegate, StoreContext ctx)
             throws IOException {
             super(delegate);
             _ctx = ctx;
@@ -170,7 +166,7 @@ public class Serialization {
 
         protected void addContextClassLoaders(MultiClassLoader loader) {
             super.addContextClassLoaders(loader);
-            loader.addClassLoader(_ctx.getClassLoader());
+            loader.addClassLoader(_ctx.getConfiguration().getClassLoader());
         }
 
         protected Object resolveObject(Object obj) {

Modified: openjpa/trunk/openjpa-kernel/src/main/resources/org/apache/openjpa/kernel/localizer.properties
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-kernel/src/main/resources/org/apache/openjpa/kernel/localizer.properties?rev=1190716&r1=1190715&r2=1190716&view=diff
==============================================================================
--- openjpa/trunk/openjpa-kernel/src/main/resources/org/apache/openjpa/kernel/localizer.properties (original)
+++ openjpa/trunk/openjpa-kernel/src/main/resources/org/apache/openjpa/kernel/localizer.properties Sat Oct 29 00:44:11 2011
@@ -206,7 +206,8 @@ bad-brokerfactory: Could not invoke the 
 	named factory class "{0}".
 bad-new-brokerfactory: Could not invoke the static newInstance method on the \
 	named factory class "{0}".
-bad-brokerfactory-class: The named BrokerFactory "{0}" is not valid.
+bad-brokerfactory-class: The named BrokerFactory "{0}" can not be loaded by \
+	classloader "{1}".
 instantiate-abstract: Cannot instantiate abstract class of type "{0}" with \
 	object id "{1}"; this may indicate that the inheritance discriminator \
 	for the class is not configured correctly.

Modified: openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/ant/AbstractTask.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/ant/AbstractTask.java?rev=1190716&r1=1190715&r2=1190716&view=diff
==============================================================================
--- openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/ant/AbstractTask.java (original)
+++ openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/ant/AbstractTask.java Sat Oct 29 00:44:11 2011
@@ -53,8 +53,7 @@ import org.apache.tools.ant.types.Path;
  */
 public abstract class AbstractTask extends MatchingTask {
 
-    private static final Localizer _loc = Localizer.forPackage
-        (AbstractTask.class);
+    private static final Localizer _loc = Localizer.forPackage(AbstractTask.class);
 
     protected final List<FileSet> fileSets = new ArrayList<FileSet>();
     protected boolean haltOnError = true;
@@ -82,7 +81,7 @@ public abstract class AbstractTask exten
 
     /**
      * Whether we want to delegate to the parent ClassLoader
-     * for resolveing classes. This may "taint" classes.
+     * for resolving classes. This may "taint" classes.
      */
     public void setUseParentClassloader(boolean useParent) {
         this.useParent = useParent;
@@ -115,11 +114,12 @@ public abstract class AbstractTask exten
         if (_cl != null)
             return _cl;
 
-        if (classpath != null)
+        if (classpath != null) {
             _cl = new AntClassLoader(getProject(), classpath, useParent);
-        else
+        } else {
             _cl = new AntClassLoader(getProject().getCoreLoader(), getProject(),
                 new Path(getProject()), useParent);
+        }
         _cl.setIsolated(isolate);
 
         return _cl;
@@ -159,9 +159,7 @@ public abstract class AbstractTask exten
         if (_conf == null)
             _conf = newConfiguration();
         if (_conf.getPropertiesResource() == null) {
-            ConfigurationProvider cp = ProductDerivations.loadDefaults
-                (AccessController.doPrivileged(
-                    J2DoPrivHelper.getClassLoaderAction(_conf.getClass())));
+            ConfigurationProvider cp = ProductDerivations.loadDefaults();
             if (cp != null)
                 cp.setInto(_conf);
         }
@@ -187,11 +185,10 @@ public abstract class AbstractTask exten
             String[] dsFiles = ds.getIncludedFiles();
             for (int j = 0; j < dsFiles.length; j++) {
                 File f = new File(dsFiles[j]);
-                if (!( AccessController.doPrivileged(J2DoPrivHelper
-                    .isFileAction(f))).booleanValue())
+                if (!( AccessController.doPrivileged(J2DoPrivHelper.isFileAction(f))).booleanValue()) {
                     f = new File(ds.getBasedir(), dsFiles[j]);
-                files.add(AccessController.doPrivileged(
-                    J2DoPrivHelper.getAbsolutePathAction(f)));
+                }
+                files.add(AccessController.doPrivileged(J2DoPrivHelper.getAbsolutePathAction(f)));
             }
         }
         return (String[]) files.toArray(new String[files.size()]);

Modified: openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/conf/AbstractProductDerivation.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/conf/AbstractProductDerivation.java?rev=1190716&r1=1190715&r2=1190716&view=diff
==============================================================================
--- openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/conf/AbstractProductDerivation.java (original)
+++ openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/conf/AbstractProductDerivation.java Sat Oct 29 00:44:11 2011
@@ -40,18 +40,17 @@ public abstract class AbstractProductDer
         throws Exception {
     }
 
-    public ConfigurationProvider loadGlobals(ClassLoader loader)
+    public ConfigurationProvider loadGlobals()
         throws Exception {
         return null;
     }
 
-    public ConfigurationProvider loadDefaults(ClassLoader loader)
+    public ConfigurationProvider loadDefaults()
         throws Exception {
         return null;
     }
 
-    public ConfigurationProvider load(String resource, String anchor,
-        ClassLoader loader) 
+    public ConfigurationProvider load(String resource, String anchor) 
         throws Exception {
         return null;
     }

Modified: openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/conf/BooleanValue.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/conf/BooleanValue.java?rev=1190716&r1=1190715&r2=1190716&view=diff
==============================================================================
--- openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/conf/BooleanValue.java (original)
+++ openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/conf/BooleanValue.java Sat Oct 29 00:44:11 2011
@@ -23,19 +23,15 @@ package org.apache.openjpa.lib.conf;
  *
  * @author Marc Prud'hommeaux
  */
-public class BooleanValue extends Value {
+public class BooleanValue extends Value<Boolean> {
 
     private boolean value;
     
     public BooleanValue(String prop) {
-        super(prop);
+        super(Boolean.class, prop);
         setAliasListComprehensive(true);
     }
 
-    public Class<Boolean> getValueType() {
-        return boolean.class;
-    }
-
     /**
      * The internal value.
      */
@@ -59,13 +55,10 @@ public class BooleanValue extends Value 
     }
 
     protected void setInternalString(String val) {
-        set(Boolean.valueOf(val).booleanValue());
+        set(Boolean.valueOf(val));
     }
 
     protected void setInternalObject(Object obj) {
-        if (obj == null)
-            set(false);
-        else
-            set(((Boolean) obj).booleanValue());
+    	set(obj == null ? false : (Boolean)obj);
     }
 }

Modified: openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/conf/BootstrapException.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/conf/BootstrapException.java?rev=1190716&r1=1190715&r2=1190716&view=diff
==============================================================================
--- openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/conf/BootstrapException.java (original)
+++ openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/conf/BootstrapException.java Sat Oct 29 00:44:11 2011
@@ -24,6 +24,7 @@ package org.apache.openjpa.lib.conf;
  * @since 0.4.1.4
  *
  */
+@SuppressWarnings("serial")
 public class BootstrapException extends RuntimeException {
     private boolean _fatal = false;
 	

Modified: openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/conf/Configuration.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/conf/Configuration.java?rev=1190716&r1=1190715&r2=1190716&view=diff
==============================================================================
--- openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/conf/Configuration.java (original)
+++ openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/conf/Configuration.java Sat Oct 29 00:44:11 2011
@@ -33,10 +33,14 @@ import org.apache.openjpa.lib.util.Close
 /**
  * Interface for generic configuration objects. Includes the ability
  * to write configuration to and from {@link Properties} instances. Instances
- * are threadsafe for reads, but not for writes.
+ * are thread-safe for reads, but not for writes.
+ * <br>
+ * A configuration comprises of {@link Value values}. The configuration is
+ * responsible for loading the values. 
  *
  * @author Marc Prud'hommeaux
  * @author Abe White
+ * @author Pinaki Poddar
  */
 public interface Configuration
     extends BeanInfo, Serializable, Closeable, Cloneable {
@@ -147,24 +151,23 @@ public interface Configuration
     /**
      * Return the {@link Value} for the given property, or null if none.
      */
-    public Value getValue(String property);
+    public Value<?> getValue(String property);
 
     /**
      * Return the set of all {@link Value}s.
      */
-    public Value[] getValues();
+    public Value<?>[] getValues();
 
     /**
      * Add the given value to the set of configuration properties. This
      * method replaces any existing value under the same property.
      */
-    public <T extends Value> T addValue(T val);
-    //public Value addValue(Value val);
+    public <T> Value<T> addValue(Value<T> val);
 
     /**
      * Remove the given value from the set of configuration properties.
      */
-    public boolean removeValue(Value val);
+    public boolean removeValue(Value<?> val);
     
     /**
      * A properties representation of this Configuration.
@@ -245,33 +248,23 @@ public interface Configuration
      * Free the resources used by this object.
      */
     public void close();
+    
+    /**
+     * Adds a class loader for loading plug-ins by class name.
+     * 
+     * @param loader
+     */
+    public ClassLoader addClassLoader(ClassLoader loader);
+    
+    /**
+     * Gets the class loader for loading plug-ins by class name.
+     * 
+     */
+    public ClassLoader getClassLoader();
 
     /**
      * Return a copy of this configuration.
      */
     public Object clone();
     
-    /**
-     * Modifies a <em>dynamic</em> property of this receiver even when 
-     * {@link #setReadOnly(boolean) frozen}. 
-     *
-     * @since 1.0.0
-     */
-//    public void modifyDynamic(String property, Object newValue);
-//    
-//    /**
-//     * Affirms if the given property can be modified <em>dynamically</em> i.e.
-//     * even after the receiver is {@link #setReadOnly(boolean) frozen}. 
-//     *
-//     * @since 1.0.0
-//     */
-//    public boolean isDynamic(String property);
-//    
-//    /**
-//     * Gets the values that can be modified <em>dynamically</em> i.e.
-//     * even after the receiver is {@link #setReadOnly(boolean) frozen}. 
-//     *
-//     * @since 1.0.0
-//     */
-//    public Value[] getDynamicValues();
 }

Modified: openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/conf/ConfigurationImpl.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/conf/ConfigurationImpl.java?rev=1190716&r1=1190715&r2=1190716&view=diff
==============================================================================
--- openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/conf/ConfigurationImpl.java (original)
+++ openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/conf/ConfigurationImpl.java Sat Oct 29 00:44:11 2011
@@ -76,6 +76,7 @@ import serp.util.Strings;
  * provides base configuration functionality, including serialization,
  * the <code>equals</code> and <code>hashCode</code> contracts, and default
  * property loading.
+ * <br>
  * Property descriptors for {@link Value} instances are constructed from
  * the {@link Localizer} for the package of the configuration class. The
  * following localized strings will be used for describing a value, where
@@ -98,6 +99,8 @@ import serp.util.Strings;
  * <li><em>name</em>-displayorder: The order in which the property should
  * be displayer.</li>
  * </ul>
+ * <p>
+ * 
  *
  * @author Abe White
  */
@@ -106,10 +109,10 @@ public class ConfigurationImpl
 
     private static final String SEP = J2DoPrivHelper.getLineSeparator();
 
-    private static final Localizer _loc = Localizer.forPackage
-        (ConfigurationImpl.class);
+    private static final Localizer _loc = Localizer.forPackage(ConfigurationImpl.class);
 
-    public ObjectValue logFactoryPlugin;
+    public ObjectValue<LogFactory> logFactoryPlugin;
+    private final MultiClassLoader _pluginLoader;
     public StringValue id;
 
     private String _product = null;
@@ -117,7 +120,7 @@ public class ConfigurationImpl
     private Map _props = null;
     private boolean _globals = false;
     private String _auto = null;
-    private final List<Value> _vals = new ArrayList<Value>();
+    private final List<Value<?>> _vals = new ArrayList<Value<?>>();
     private Set<String> _supportedKeys;
     
     // property listener helper
@@ -141,9 +144,14 @@ public class ConfigurationImpl
      * @param loadGlobals whether to attempt to load the global properties
      */
     public ConfigurationImpl(boolean loadGlobals) {
+    	_pluginLoader = AccessController.doPrivileged(J2DoPrivHelper.newMultiClassLoaderAction());
+    	_pluginLoader.addClassLoader(MultiClassLoader.THREAD_LOADER);
+    	_pluginLoader.addClassLoader(getClass().getClassLoader());
+    	_pluginLoader.addClassLoader(MultiClassLoader.SYSTEM_LOADER);
+
         setProductName("openjpa");
 
-        logFactoryPlugin = addPlugin("Log", true);
+        logFactoryPlugin = addPlugin(LogFactory.class, "Log", true);
         String[] aliases = new String[]{
             "true", LogFactoryImpl.class.getName(),
             "openjpa", LogFactoryImpl.class.getName(),
@@ -169,20 +177,13 @@ public class ConfigurationImpl
      * {@link ProductDerivation}s, and from System properties.
      */
     public boolean loadGlobals() {
-        MultiClassLoader loader = AccessController
-            .doPrivileged(J2DoPrivHelper.newMultiClassLoaderAction()); 
-        loader.addClassLoader(AccessController.doPrivileged(
-            J2DoPrivHelper.getContextClassLoaderAction()));
-        loader.addClassLoader(getClass().getClassLoader());
-        ConfigurationProvider provider = ProductDerivations.loadGlobals(loader);
-        if (provider != null)
+        ConfigurationProvider provider = ProductDerivations.loadGlobals();
+        if (provider != null) {
             provider.setInto(this);
-
+        }
         // let system properties override other globals
         try {
-            fromProperties(new HashMap(
-                AccessController.doPrivileged(
-                    J2DoPrivHelper.getPropertiesAction())));
+            fromProperties(new HashMap(AccessController.doPrivileged(J2DoPrivHelper.getPropertiesAction())));
         } catch (SecurityException se) {
             // security manager might disallow
         }
@@ -207,8 +208,8 @@ public class ConfigurationImpl
 
     public LogFactory getLogFactory() {
         if (logFactoryPlugin.get() == null)
-            logFactoryPlugin.instantiate(LogFactory.class, this);
-        return (LogFactory) logFactoryPlugin.get();
+            logFactoryPlugin.instantiate(this);
+        return logFactoryPlugin.get();
     }
 
     public void setLogFactory(LogFactory logFactory) {
@@ -242,8 +243,8 @@ public class ConfigurationImpl
         return getLog("openjpa.Runtime");
     }
 
-    public Value[] getValues() {
-        return (Value[]) _vals.toArray(new Value[_vals.size()]);
+    public Value<?>[] getValues() {
+        return _vals.toArray(new Value[_vals.size()]);
     }
 
     /**
@@ -253,12 +254,12 @@ public class ConfigurationImpl
      * with which the value has been registered. A value may have multiple
      * equivalent names and this method searches with all equivalent names.
      */
-    public Value getValue(String property) {
+    public Value<?> getValue(String property) {
         if (property == null)
             return null;
 
         // search backwards so that custom values added after construction
-        // are found quickly, since this will be the std way of accessing them
+        // are found quickly, since this will be the standard way of accessing them
         for (int i = _vals.size()-1; i >= 0; i--) { 
             if (_vals.get(i).matches(property))
                 return _vals.get(i);
@@ -278,7 +279,7 @@ public class ConfigurationImpl
         String getterName;
         Method getter;
         Object getterTarget;
-        for(Value val : _vals) { 
+        for (Value<?> val : _vals) { 
             getterName = val.getInstantiatingGetter();
             if (getterName == null)
                 continue;
@@ -306,8 +307,7 @@ public class ConfigurationImpl
             }
         }
         if (errs != null)
-            throw new RuntimeException(_loc.get("get-prop-errs",
-                errs.toString()).getMessage());
+            throw new RuntimeException(_loc.get("get-prop-errs", errs.toString()).getMessage());
     }
 
     public boolean isReadOnly() {
@@ -325,7 +325,7 @@ public class ConfigurationImpl
             _changeSupport.removePropertyChangeListener(listener);
     }
 
-    public void valueChanged(Value val) {
+    public void valueChanged(Value<?> val) {
         if (_changeSupport == null && _props == null)
             return;
 
@@ -352,8 +352,8 @@ public class ConfigurationImpl
         
         preClose();
         
-        ObjectValue val;
-        for(Value v : _vals) { 
+        ObjectValue<?> val;
+        for (Value<?> v : _vals) { 
             if (v instanceof Closeable) {
                 try { ((Closeable)v).close(); }
                 catch (Exception e) {} 
@@ -363,7 +363,7 @@ public class ConfigurationImpl
             if (!(v  instanceof ObjectValue))
                 continue;
 
-            val = (ObjectValue) v;
+            val = (ObjectValue<?>) v;
             if (val.get() instanceof Closeable) {
                 try {
                     ((Closeable) val.get()).close();
@@ -437,9 +437,9 @@ public class ConfigurationImpl
         _pds = new PropertyDescriptor[_vals.size()];
         
         List<String> failures = null;
-        Value val;
+        Value<?> val;
         for (int i = 0; i < _vals.size(); i++) {
-            val = (Value) _vals.get(i);
+            val = (Value<?>) _vals.get(i);
             try {
                 _pds[i] = getPropertyDescriptor(val);
             } catch (MissingResourceException mre) {
@@ -462,7 +462,7 @@ public class ConfigurationImpl
     /**
      * Create a property descriptor for the given value.
      */
-    private PropertyDescriptor getPropertyDescriptor(Value val)
+    private PropertyDescriptor getPropertyDescriptor(Value<?> val)
         throws IntrospectionException {
         String prop = val.getProperty();
         prop = prop.substring(prop.lastIndexOf('.') + 1);
@@ -546,7 +546,6 @@ public class ConfigurationImpl
     /**
      * Find the given localized string, or return null if not found.
      */
-    @SuppressWarnings("unchecked")
     private String findLocalized(String key, boolean fatal, Class<?> scope) {
         // find the localizer package that contains this key
         Localizer loc = null;
@@ -561,8 +560,7 @@ public class ConfigurationImpl
             }
         }
 
-        for (Class cls = getClass(); cls != Object.class;
-            cls = cls.getSuperclass()) {
+        for (Class<?> cls = getClass(); cls != Object.class; cls = cls.getSuperclass()) {
             loc = Localizer.forPackage(cls);
             try {
                 return loc.getFatal(key).getMessage();
@@ -591,7 +589,7 @@ public class ConfigurationImpl
     public Map toProperties(boolean storeDefaults) {
         // clone properties before making any modifications; we need to keep
         // the internal properties instance consistent to maintain equals and
-        // hashcode contracts
+        // hash code contracts
         Map<String, String> clone;
         if (_props == null)
             clone = new TreeMap<String, String>();
@@ -604,7 +602,7 @@ public class ConfigurationImpl
         // with default values, add values to properties
         if (_props == null || storeDefaults) {
             String str;
-            for (Value val : _vals) {
+            for (Value<?> val : _vals) {
                 // NOTE: Following was removed to hide Value.INVISIBLE properties, like connectionPassword
                 // if key in existing properties, we already know value is up to date
                 //if (_props != null && Configurations.containsProperty(val, _props) && val.isVisible())
@@ -635,13 +633,13 @@ public class ConfigurationImpl
         }
 
         // copy the input to avoid mutation issues
-        if (map instanceof HashMap)
+        if (map instanceof HashMap) {
             map = (Map) ((HashMap) map).clone();
-        else if (map instanceof Properties)
+        } else if (map instanceof Properties) {
             map = (Map) ((Properties) map).clone();
-        else
+        } else {
             map = new LinkedHashMap(map);
-
+        }
         Map remaining = new HashMap(map);
         boolean ser = true;
         Object o;
@@ -668,9 +666,9 @@ public class ConfigurationImpl
 
         // now warn if there are any remaining properties that there
         // is an unhandled prop, and remove the unknown properties
-        Map.Entry entry;
-        for (Iterator itr = remaining.entrySet().iterator(); itr.hasNext();) {
-            entry = (Map.Entry) itr.next();
+        Map.Entry<?,?> entry;
+        for (Iterator<?> itr = remaining.entrySet().iterator(); itr.hasNext();) {
+            entry = (Map.Entry<?,?>) itr.next();
             Object key = entry.getKey();
             if (key != null) {
                 warnInvalidProperty((String) key);
@@ -684,7 +682,7 @@ public class ConfigurationImpl
     }
     
     public List<String> getPropertyKeys(String propertyName) {
-        Value value = getValue(propertyName);
+        Value<?> value = getValue(propertyName);
         return value == null ? Collections.EMPTY_LIST : value.getPropertyKeys();
     }
     
@@ -700,7 +698,7 @@ public class ConfigurationImpl
             return _supportedKeys;
         
         _supportedKeys = new TreeSet<String>();
-        for (Value val : _vals) {
+        for (Value<?> val : _vals) {
             if (val.isPrivate())
                 continue;
             List<String> keys = val.getPropertyKeys();
@@ -734,7 +732,7 @@ public class ConfigurationImpl
      * Use this method instead of attempting to add the value directly because 
      * this will account for the property prefix.
      */
-    private void setValue(Map map, Value val) {
+    private void setValue(Map map, Value<?> val) {
         Object key = val.getLoadKey();
         if (key == null) {
             List<String> keys = val.getPropertyKeys();
@@ -748,9 +746,7 @@ public class ConfigurationImpl
                 key = "openjpa." + val.getProperty();
             }
         }
-        Object external = val.isHidden() ? Value.INVISIBLE : 
-            val instanceof ObjectValue ? val.getString() : val.get();
-        map.put(key, external);
+        map.put(key, val.getExternal());
     }
 
     /**
@@ -758,12 +754,11 @@ public class ConfigurationImpl
      * property names. Detects if the given map contains multiple keys that
      * are equivalent names for the given value. 
      */
-    private Object findValue(Map map, Value val) {
+    private Object findValue(Map map, Value<?> val) {
         Object result = null;
         List<String> partialKeys = val.getPropertyKeys();
         for (String partialKey : partialKeys) {
-            String key = ProductDerivations.getConfigurationKey(
-                partialKey, map);
+            String key = ProductDerivations.getConfigurationKey(partialKey, map);
             if (map.containsKey(key)) {
                 // do not return immediately. Looping through all equivalent
                 // property names will detect if the Map contains multiple keys
@@ -780,7 +775,9 @@ public class ConfigurationImpl
      */
     private void warnInvalidProperty(String propName) {
         if (propName != null && 
-           (propName.startsWith("java.") || propName.startsWith("javax.persistence")|| propName.startsWith("sun."))) 
+           (propName.startsWith("java.") || 
+            propName.startsWith("javax.persistence") || 
+            propName.startsWith("sun."))) 
             return;
         if (!isInvalidProperty(propName))
             return;
@@ -805,7 +802,7 @@ public class ConfigurationImpl
     private Collection<String> newPropertyList() {
         String[] prefixes = ProductDerivations.getConfigurationPrefixes();
         List<String> l = new ArrayList<String>(_vals.size() * prefixes.length);
-        for(Value v : _vals) { 
+        for(Value<?> v : _vals) { 
             for (int j = 0; j < prefixes.length; j++)
                 l.add(prefixes[j] + "." + v.getProperty());
         }
@@ -843,14 +840,12 @@ public class ConfigurationImpl
      */
     public void setProperties(String resourceName) throws IOException {
         String anchor = null;
-        if (resourceName.indexOf("#") != -1)
-        {
+        if (resourceName.indexOf("#") != -1) {
             anchor = resourceName.substring(resourceName.lastIndexOf("#") + 1);
             resourceName = resourceName.substring(0,
                 resourceName.length() - anchor.length() - 1);
         }
-        ProductDerivations.load(resourceName, anchor,
-            getClass().getClassLoader()).setInto(this);
+        ProductDerivations.load(resourceName, anchor).setInto(this);
         _auto = resourceName;
     }
 
@@ -860,8 +855,7 @@ public class ConfigurationImpl
      * <code>propertiesFile</code> value with the name of a file.
      */
     public void setPropertiesFile(File file) throws IOException {
-        ProductDerivations.load(file, null, getClass().getClassLoader()).
-            setInto(this);
+        ProductDerivations.load(file, null).setInto(this);
         _auto = file.toString();
     }
 
@@ -894,10 +888,10 @@ public class ConfigurationImpl
         ConfigurationImpl conf = (ConfigurationImpl) other;
         if (_vals.size() != conf.getValues().length)
         	return false;
-        for(Value v : _vals) {
+        for(Value<?> v : _vals) {
             String propName = v.getProperty();
-        	Value thisV = this.getValue(propName);
-            Value thatV = conf.getValue(propName);
+        	Value<?> thisV = this.getValue(propName);
+            Value<?> thatV = conf.getValue(propName);
         	if (!thisV.equals(thatV)) {
         		return false;
         	}
@@ -912,7 +906,7 @@ public class ConfigurationImpl
      */
     public int hashCode() {
         int hash = 0;
-        for(Value v : _vals) { 
+        for(Value<?> v : _vals) { 
         	hash += v.hashCode();
         }
         return hash;
@@ -944,10 +938,8 @@ public class ConfigurationImpl
             
             // surround sequences of digits with dashes.
             if (i != 0
-                && ((!Character.isLetter(c) && Character.isLetter(propName
-                    .charAt(i - 1))) 
-                || (Character.isLetter(c) && !Character.isLetter(propName
-                    .charAt(i - 1)))))
+                && ((!Character.isLetter(c) && Character.isLetter(propName.charAt(i - 1))) 
+                || (Character.isLetter(c) && !Character.isLetter(propName.charAt(i - 1)))))
                 buf.append('-');
             
             buf.append(Character.toLowerCase(c));
@@ -959,7 +951,6 @@ public class ConfigurationImpl
      * Implementation of the {@link Externalizable} interface to read from
      * the properties written by {@link #writeExternal}.
      */
-    @SuppressWarnings("unchecked")
     public void readExternal(ObjectInput in)
         throws IOException, ClassNotFoundException {
         fromProperties((Map) in.readObject());
@@ -983,10 +974,8 @@ public class ConfigurationImpl
      */
     public Object clone() {
         try {
-            Constructor cons = getClass().getConstructor
-                (new Class[]{ boolean.class });
-            ConfigurationImpl clone = (ConfigurationImpl) cons.newInstance
-                (new Object[]{ Boolean.FALSE });
+            Constructor<? extends Configuration> cons = getClass().getConstructor(new Class[]{ boolean.class });
+            ConfigurationImpl clone = (ConfigurationImpl)cons.newInstance(new Object[]{ Boolean.FALSE });
             clone.fromProperties(toProperties(true));
             clone._props = (_props == null) ? null : new HashMap(_props);
             clone._globals = _globals;
@@ -998,14 +987,14 @@ public class ConfigurationImpl
         }
     }
 
-    public boolean removeValue(Value val) {
+    public boolean removeValue(Value<?> val) {
         if (!_vals.remove(val))
             return false;
         val.removeListener(this);
         return true;
     }
 
-    public <T extends Value> T addValue(T val) {
+    public <T> Value<T> addValue(Value<T> val) {
         _vals.add(val);
         val.addListener(this);
         return val;
@@ -1069,27 +1058,89 @@ public class ConfigurationImpl
     /**
      * Add the given value to the set of configuration properties.
      */
-    public ObjectValue addObject(String property) {
-        ObjectValue val = new ObjectValue(property);
+    public <T> ObjectValue<T> addObject(Class<T> type, String property) {
+        ObjectValue<T> val = new ObjectValue<T>(type, property);
         addValue(val);
         return val;
     }
 
     /**
-     * Add the given value to the set of configuration properties.
+     * Creates and adds a non-singleton {@link PluginValue plug-in value} of the given type.
+     * Property name of the plug-in is the simple name of the given type.
+     * 
+     * @param <T> type of the plug-in
+     * @param type class of the plug-in, often an interface
+     * @return the plug-in created
+     */
+    public <T> PluginValue<T> addPlugin(Class<T> type) {
+    	return addPlugin(type, false);
+    }
+    
+    /**
+     * Creates and adds a {@link PluginValue plug-in value} of the given type.
+     * Property name of the plug-in is the simple name of the given type.
+     * 
+     * @param <T> type of the plug-in
+     * @param type class of the plug-in, often an interface
+     * @param singleton whether this plug-in is a singleton for this configuration
+     * @return the plug-in created
      */
-    public PluginValue addPlugin(String property, boolean singleton) {
-        PluginValue val = new PluginValue(property, singleton);
+    public <T> PluginValue<T> addPlugin(Class<T> type, boolean singleton) {
+    	return addPlugin(type, type.getSimpleName(), singleton);
+    }
+    
+    /**
+     * Creates and adds a {@link PluginValue plug-in value} of the given type of the given property name.
+     * If the plug-in is a singleton set the instantiating getter method as <tt>get&lt;property&gt;Instance</tt>.
+     * 
+     * @param <T> type of the plug-in
+     * @param type class of the plug-in, often an interface
+     * @param property name of the plug-in
+     * @param singleton whether this plug-in is a singleton for this configuration
+     * @return the plug-in created
+     */
+    public <T> PluginValue<T> addPlugin(Class<T> type, String property, boolean singleton) {
+        PluginValue<T> val = new PluginValue<T>(type, property, singleton);
         addValue(val);
+        if (singleton) {
+        	val.setInstantiatingGetter("get" + property + "Instance");
+        }
         return val;
     }
 
     /**
      * Add the given value to the set of configuration properties.
      */
-    public PluginListValue addPluginList(String property) {
-        PluginListValue val = new PluginListValue(property);
+    public <T> PluginListValue<T> addPluginList(Class<T[]> type, String property) {
+        PluginListValue<T> val = new PluginListValue<T>(type, property);
         addValue(val);
         return val;
     }
+    
+    /**
+     * Add the given value to the set of configuration properties.
+     */
+    public <T extends Enum<T>> EnumValue<T> addEnum(Class<T> type, String property) {
+    	EnumValue<T> val = new EnumValue<T>(type, property);
+        addValue(val);
+        return val;
+    }
+
+    /**
+     * Adds an additional class loader to load the plug-in values.
+     */
+	@Override
+	public MultiClassLoader addClassLoader(ClassLoader loader) {
+		_pluginLoader.addClassLoader(loader);
+		return _pluginLoader;
+	}
+
+	/**
+	 * Gets the {@link MultiClassLoader special class loader} to load plug-in values.
+	 */
+	@Override
+	public MultiClassLoader getClassLoader() {
+		return _pluginLoader;
+	}
+
 }

Modified: openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/conf/ConfigurationProvider.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/conf/ConfigurationProvider.java?rev=1190716&r1=1190715&r2=1190716&view=diff
==============================================================================
--- openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/conf/ConfigurationProvider.java (original)
+++ openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/conf/ConfigurationProvider.java Sat Oct 29 00:44:11 2011
@@ -20,12 +20,21 @@ package org.apache.openjpa.lib.conf;
 
 import java.util.Map;
 
+import org.apache.openjpa.lib.util.MultiClassLoader;
+
 /**
- * Implementations of this interface can populate {@link Configuration}s in
- * some environment-specific way. Implementations must implement the
+ * Implementations of this interface populates {@link Configuration}s in
+ * some {@link ProductDerivation environment-specific} way. Implementations must implement the
  * <code>equals</code> and <code>hashCode</code> methods so that equivalent
  * configurations compare equal.
+ * <br>
+ * A provider looks up resources and resolves classes by their names <em>before</em>
+ * runtime is initialized. The class loader used by a provider eventually is 
+ * {@link #setInto(Configuration) set} in the {@link Configuration configuration} for runtime. 
+ * 
  *
+ * @author Abe White
+ * @author Pinaki Poddar
  * @nojavadoc
  * @since 0.4.0.0
  */
@@ -52,4 +61,12 @@ public interface ConfigurationProvider {
      * Set loaded information into the given configuration.
      */
     public void setInto(Configuration conf);
+    
+    
+    /**
+     * Gets the loader to load plug-in and resources by class name.
+     * 
+     * @since 2.2.0
+     */
+    public MultiClassLoader getClassLoader();
 }

Modified: openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/conf/Configurations.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/conf/Configurations.java?rev=1190716&r1=1190715&r2=1190716&view=diff
==============================================================================
--- openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/conf/Configurations.java (original)
+++ openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/conf/Configurations.java Sat Oct 29 00:44:11 2011
@@ -28,8 +28,6 @@ import java.util.List;
 import java.util.Map;
 import java.util.MissingResourceException;
 import java.util.Properties;
-import java.util.TreeSet;
-import java.util.concurrent.ConcurrentHashMap;
 
 import javax.naming.Context;
 import javax.naming.InitialContext;
@@ -40,11 +38,9 @@ import org.apache.commons.lang.exception
 import org.apache.openjpa.lib.log.Log;
 import org.apache.openjpa.lib.util.J2DoPrivHelper;
 import org.apache.openjpa.lib.util.Localizer;
-import org.apache.openjpa.lib.util.MultiClassLoader;
 import org.apache.openjpa.lib.util.Options;
 import org.apache.openjpa.lib.util.ParseException;
 import org.apache.openjpa.lib.util.StringDistance;
-import org.apache.openjpa.lib.util.concurrent.ConcurrentReferenceHashMap;
 
 import serp.util.Strings;
 
@@ -56,15 +52,8 @@ import serp.util.Strings;
  */
 public class Configurations {
 
-    private static final Localizer _loc = Localizer.forPackage
-        (Configurations.class);
+    private static final Localizer _loc = Localizer.forPackage(Configurations.class);
     
-    private static final ConcurrentReferenceHashMap _loaders = new
-        ConcurrentReferenceHashMap(ConcurrentReferenceHashMap.WEAK, 
-                ConcurrentReferenceHashMap.HARD);
-
-    private static final Object NULL_LOADER = "null-loader";
-
     /**
      * Return the class name from the given plugin string, or null if none.
      */
@@ -101,8 +90,7 @@ public class Configurations {
         // clsName(props) form
         if (clsName)
             return plugin.substring(0, openParen).trim();
-        String prop = plugin.substring(openParen + 1,
-            plugin.length() - 1).trim();
+        String prop = plugin.substring(openParen + 1, plugin.length() - 1).trim();
         return (prop.length() == 0) ? null : prop;
     }
 
@@ -152,33 +140,17 @@ public class Configurations {
         return getPlugin(cls, serializeProperties(props)); 
     }
 
-    /**
-     * Create the instance with the given class name, using the given
-     * class loader. No configuration of the instance is performed by
-     * this method.
-     */
-    public static Object newInstance(String clsName, ClassLoader loader) {
-        return newInstance(clsName, null, null, loader, true);
-    }
 
-    /**
-     * Create and configure an instance with the given class name and
-     * properties as a String.
-     */
-    public static Object newInstance(String clsName, Configuration conf,
-        String props, ClassLoader loader) {
-        Object obj = newInstance(clsName, null, conf, loader, true);
-        configureInstance(obj, conf, props);
-        return obj;
+    public static Object newInstance(String clsName, Configuration conf, String props) {
+    	return newInstance(clsName, conf, parseProperties(props));
     }
-
     /**
-     * Create and configure an instance with the given class name and
-     * properties.
+     * Create and configure an instance with the given class name and properties.
+     * The class name is loaded using the {@link Configuration#getClassLoader() class loader} of
+     * the given configuration.
      */
-    public static Object newInstance(String clsName, Configuration conf,
-        Properties props, ClassLoader loader) {
-        Object obj = newInstance(clsName, null, conf, loader, true);
+    public static Object newInstance(String clsName, Configuration conf, Properties props) {
+        Object obj = newInstance(clsName, null, conf, conf.getClassLoader(), true);
         configureInstance(obj, conf, props);
         return obj;
     }
@@ -187,52 +159,30 @@ public class Configurations {
      * Helper method used by members of this package to instantiate plugin
      * values.
      */
-    static Object newInstance(String clsName, Value val, Configuration conf,
-        ClassLoader loader, boolean fatal) {
+    static <T> T newInstance(String clsName, Value<T> val, Configuration conf, ClassLoader loader, boolean fatal) {
         if (StringUtils.isEmpty(clsName))
             return null;
-
-        Class cls = null; 
-
+        Class<T> cls = null; 
         while (cls == null) {
-            // can't have a null reference in the map, so use symbolic
-            // constant as key
-            Object key = loader == null ? NULL_LOADER : loader;
-            Map loaderCache = (Map) _loaders.get(key);
-            if (loaderCache == null) { // We don't have a cache for this loader.
-                loaderCache = new ConcurrentHashMap();
-                _loaders.put(key, loaderCache);
-            } else {  // We have a cache for this loader.
-                cls = (Class) loaderCache.get(clsName);
-            }
-
-            if (cls == null) {
-                try {
-                    cls = Strings.toClass(clsName, findDerivedLoader(conf,
-                            loader));
-                    loaderCache.put(clsName, cls);
-                } catch (RuntimeException re) {
-                    if (loader != null)  // Try one more time with loader=null
-                        loader = null;
-                    else {
-                        if (val != null)
-                            re = getCreateException(clsName, val, re);
-                        if (fatal)
-                            throw re;
-                        Log log = (conf == null) ? null : conf
-                                .getConfigurationLog();
-                        if (log != null && log.isErrorEnabled())
-                            log.error(_loc
-                                    .get("plugin-creation-exception", val), re);
-                        return null;
-                    }
+            try {
+                cls = (Class<T>)Class.forName(clsName, true, loader);
+            } catch (Exception e) {
+                if (loader != null)  { // Try one more time with loader=null
+                    loader = null;
+                } else {
+                    RuntimeException re = getCreateException(clsName, val, loader, e);
+                    if (fatal)
+                        throw re;
+                    Log log = (conf == null) ? null : conf.getConfigurationLog();
+                    if (log != null && log.isErrorEnabled())
+                        log.error(_loc.get("plugin-creation-exception", val), e);
+                    return null;
                 }
             }
         }
 
         try {
-            return AccessController.doPrivileged(
-                J2DoPrivHelper.newInstanceAction(cls));
+            return (T) AccessController.doPrivileged(J2DoPrivHelper.newInstanceAction(cls));
         } catch (Exception e) {
             if (e instanceof PrivilegedActionException) {
                 e = ((PrivilegedActionException) e).getException();   
@@ -248,48 +198,7 @@ public class Configurations {
         }
     }
 
-    /**
-     * Attempt to find a derived loader that delegates to our target loader.
-     * This allows application loaders that delegate appropriately for known
-     * classes first crack at class names.
-     */
-    private static ClassLoader findDerivedLoader(Configuration conf,
-        ClassLoader loader) {
-        // we always prefer the thread loader, because it's the only thing we
-        // can access that isn't bound to the OpenJPA classloader, unless
-        // the conf object is of a custom class
-        ClassLoader ctxLoader = AccessController.doPrivileged(
-            J2DoPrivHelper.getContextClassLoaderAction());
-        if (loader == null) {
-            if (ctxLoader != null)
-                return ctxLoader;
-            if (conf != null)
-                return AccessController.doPrivileged(
-                    J2DoPrivHelper.getClassLoaderAction(conf.getClass())); 
-            return Configurations.class.getClassLoader();
-        }
-
-        for (ClassLoader parent = ctxLoader; parent != null; 
-            parent = AccessController.doPrivileged(
-                J2DoPrivHelper.getParentAction(parent))) {
-            if (parent == loader)
-                return ctxLoader;
-        }
-        if (conf != null) {
-            for (ClassLoader parent = (ClassLoader)
-                AccessController.doPrivileged(
-                    J2DoPrivHelper.getClassLoaderAction(conf.getClass())); 
-                parent != null; 
-                parent = AccessController.doPrivileged(
-                    J2DoPrivHelper.getParentAction(parent))) {
-                if (parent == loader)
-                    return AccessController.doPrivileged(
-                        J2DoPrivHelper.getClassLoaderAction(conf.getClass())); 
-            }
-        }
-        return loader;
-    }
-
+    
     /**
      * Return a List<String> of all the fully-qualified anchors specified in the
      * properties location listed in <code>opts</code>. If no properties
@@ -315,8 +224,7 @@ public class Configurations {
                 return Arrays.asList(new String[] { props });
         }
 
-        return ProductDerivations.getFullyQualifiedAnchorsInPropertiesLocation(
-            props);
+        return ProductDerivations.getFullyQualifiedAnchorsInPropertiesLocation(props);
     }
 
     /**
@@ -347,14 +255,14 @@ public class Configurations {
             File file = new File(path);
             if ((AccessController.doPrivileged(J2DoPrivHelper
                 .isFileAction(file))).booleanValue())
-                provider = ProductDerivations.load(file, anchor, null);
+                provider = ProductDerivations.load(file, anchor);
             else {
                 file = new File("META-INF" + File.separatorChar + path);
                 if ((AccessController.doPrivileged(J2DoPrivHelper
                     .isFileAction(file))).booleanValue())
-                    provider = ProductDerivations.load(file, anchor, null);
+                    provider = ProductDerivations.load(file, anchor);
                 else
-                    provider = ProductDerivations.load(path, anchor, null);
+                    provider = ProductDerivations.load(path, anchor);
             }
             if (provider != null)
                 provider.setInto(conf);
@@ -363,7 +271,7 @@ public class Configurations {
                     props).getMessage(), Configurations.class.getName(), 
                     props);
         } else {
-            provider = ProductDerivations.loadDefaults(null);
+            provider = ProductDerivations.loadDefaults();
             if (provider != null)
                 provider.setInto(conf);
         }
@@ -373,8 +281,7 @@ public class Configurations {
     /**
      * Helper method to throw an informative description on instantiation error.
      */
-    private static RuntimeException getCreateException(String clsName,
-        Value val, Exception e) {
+    private static RuntimeException getCreateException(String clsName, Value val, ClassLoader loader, Exception e) {
         // re-throw the exception with some better information
         final String msg;
         final Object[] params;
@@ -382,30 +289,27 @@ public class Configurations {
         String alias = val.alias(clsName);
         String[] aliases = val.getAliases();
         String[] keys;
-        if (aliases.length == 0)
+        if (aliases.length == 0) {
             keys = aliases;
-        else {
+        } else {
             keys = new String[aliases.length / 2];
-            for (int i = 0; i < aliases.length; i += 2)
+            for (int i = 0; i < aliases.length; i += 2) {
                 keys[i / 2] = aliases[i];
+            }
+            Arrays.sort(keys);
         }
-
         String closest;
         if (keys.length == 0) {
             msg = "invalid-plugin";
-            params = new Object[]{ val.getProperty(), alias, e.toString(), };
-        } else if ((closest = StringDistance.getClosestLevenshteinDistance
-            (alias, keys, 0.5f)) == null) {
+            params = new Object[]{val.getProperty(), alias, e.toString(), loader};
+        } else if ((closest = StringDistance.getClosestLevenshteinDistance(alias, keys, 0.5f)) == null) {
             msg = "invalid-plugin-aliases";
-            params = new Object[]{
-                val.getProperty(), alias, e.toString(),
-                new TreeSet<String>(Arrays.asList(keys)), };
+            params = new Object[]{val.getProperty(), alias, e.toString(), keys, loader};
         } else {
             msg = "invalid-plugin-aliases-hint";
-            params = new Object[]{
-                val.getProperty(), alias, e.toString(),
-                new TreeSet<String>(Arrays.asList(keys)), closest, };
+            params = new Object[]{val.getProperty(), alias, e.toString(), keys, closest, loader};
         }
+        e.printStackTrace();
         return new ParseException(_loc.get(msg, params), e);
     }
 

Modified: openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/conf/DoubleValue.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/conf/DoubleValue.java?rev=1190716&r1=1190715&r2=1190716&view=diff
==============================================================================
--- openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/conf/DoubleValue.java (original)
+++ openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/conf/DoubleValue.java Sat Oct 29 00:44:11 2011
@@ -25,17 +25,14 @@ import org.apache.commons.lang.StringUti
  *
  * @author Marc Prud'hommeaux
  */
-public class DoubleValue extends Value {
+public class DoubleValue extends Value<Double> {
 
     private double value;
 
     public DoubleValue(String prop) {
-        super(prop);
+        super(Double.class, prop);
     }
 
-    public Class<Double> getValueType() {
-        return double.class;
-    }
 
     /**
      * The internal value.
@@ -60,16 +57,10 @@ public class DoubleValue extends Value {
     }
 
     protected void setInternalString(String val) {
-        if (StringUtils.isEmpty(val))
-            set(0D);
-        else
-            set(Double.parseDouble(val));
+        set (StringUtils.isEmpty(val) ? 0D : Double.parseDouble(val));
     }
 
     protected void setInternalObject(Object obj) {
-        if (obj == null)
-            set(0D);
-        else
-            set(((Number) obj).doubleValue());
+        set (obj == null ? 0D : ((Number)obj).doubleValue());
     }
 }

Added: openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/conf/EnumValue.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/conf/EnumValue.java?rev=1190716&view=auto
==============================================================================
--- openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/conf/EnumValue.java (added)
+++ openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/conf/EnumValue.java Sat Oct 29 00:44:11 2011
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.    
+ */
+package org.apache.openjpa.lib.conf;
+
+import java.util.EnumSet;
+
+public class EnumValue<T extends Enum<T>> extends ObjectValue<T> {
+
+	public EnumValue(Class<T> type, String prop) {
+		super(type, prop);
+		setAliasListComprehensive(true);
+		EnumSet<T> all = EnumSet.allOf(type);
+		for (T v : all) {
+			setAlias(v.toString(), v.toString().toLowerCase());
+		}
+	}
+
+	@Override
+	protected void setInternalString(String str) {
+		set(Enum.valueOf(getValueType(), str));
+	}
+}

Propchange: openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/conf/EnumValue.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/conf/FileValue.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/conf/FileValue.java?rev=1190716&r1=1190715&r2=1190716&view=diff
==============================================================================
--- openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/conf/FileValue.java (original)
+++ openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/conf/FileValue.java Sat Oct 29 00:44:11 2011
@@ -29,16 +29,12 @@ import org.apache.openjpa.lib.util.J2DoP
  *
  * @author Marc Prud'hommeaux
  */
-public class FileValue extends Value {
+public class FileValue extends Value<File> {
 
     private File value;
 
     public FileValue(String prop) {
-        super(prop);
-    }
-
-    public Class<File> getValueType() {
-        return File.class;
+        super(File.class, prop);
     }
 
     /**
@@ -69,7 +65,7 @@ public class FileValue extends Value {
     }
 
     protected void setInternalObject(Object obj) {
-        set((File) obj);
+        set((File)obj);
     }
 }
 

Modified: openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/conf/IntValue.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/conf/IntValue.java?rev=1190716&r1=1190715&r2=1190716&view=diff
==============================================================================
--- openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/conf/IntValue.java (original)
+++ openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/conf/IntValue.java Sat Oct 29 00:44:11 2011
@@ -25,16 +25,12 @@ import org.apache.commons.lang.StringUti
  *
  * @author Marc Prud'hommeaux
  */
-public class IntValue extends Value {
+public class IntValue extends Value<Number> {
 
     private int value;
 
     public IntValue(String prop) {
-        super(prop);
-    }
-
-    public Class<Integer> getValueType() {
-        return int.class;
+        super(Number.class, prop);
     }
 
     /**
@@ -60,16 +56,10 @@ public class IntValue extends Value {
     }
 
     protected void setInternalString(String val) {
-        if (StringUtils.isEmpty(val))
-            set(0);
-        else
-            set(Integer.parseInt(val));
+        set (StringUtils.isEmpty(val) ? 0 : Integer.parseInt(val));
     }
 
-    protected void setInternalObject(Object obj) {
-        if (obj == null)
-            set(0);
-        else
-            set(((Number) obj).intValue());
+    protected void setInternalObject(Object num) {
+        set (num == null ? 0 : ((Number)num).intValue());
     }
 }

Modified: openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/conf/MapConfigurationProvider.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/conf/MapConfigurationProvider.java?rev=1190716&r1=1190715&r2=1190716&view=diff
==============================================================================
--- openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/conf/MapConfigurationProvider.java (original)
+++ openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/conf/MapConfigurationProvider.java Sat Oct 29 00:44:11 2011
@@ -18,37 +18,51 @@
  */
 package org.apache.openjpa.lib.conf;
 
+import java.security.AccessController;
 import java.util.Collections;
 import java.util.HashMap;
 import java.util.Map;
 
 import org.apache.openjpa.lib.log.Log;
+import org.apache.openjpa.lib.util.J2DoPrivHelper;
 import org.apache.openjpa.lib.util.Localizer;
+import org.apache.openjpa.lib.util.MultiClassLoader;
 
 /**
  * Simple configuration provider that sets configuration based on a
  * provided map.
+ * <br>
+ * This provider uses a {@link MultiClassLoader flat class loader} comprised
+ * of system class loader, context class loader and the loader that loaded
+ * this class itself.
  *
  * @author Abe White
+ * @author Pinaki Poddar
  * @nojavadoc
  */
 public class MapConfigurationProvider implements ConfigurationProvider {
-
-    private static final Localizer _loc = Localizer.forPackage
-        (MapConfigurationProvider.class);
-
-    private Map _props = null;
+    private Map _props;
+    private final MultiClassLoader _loader;
+    private static final Localizer _loc = Localizer.forPackage(MapConfigurationProvider.class);
     
     /**
-     * Construct with null properties.
+     * Constructs a provider with default class loading scheme that employs 
+     * system class loader, current thread context class loader and the
+     * class loader that loaded this class itself.
      */
     public MapConfigurationProvider() {
+    	_loader = AccessController.doPrivileged(J2DoPrivHelper.newMultiClassLoaderAction());
+    	_loader.addClassLoader(MultiClassLoader.SYSTEM_LOADER);
+    	_loader.addClassLoader(MultiClassLoader.THREAD_LOADER);
+    	_loader.addClassLoader(this.getClass().getClassLoader());
     }
+    
 
     /**
      * Constructor; supply properties map.
      */
     public MapConfigurationProvider(Map props) {
+    	this();
         addProperties(props);
     }
 
@@ -75,13 +89,18 @@ public class MapConfigurationProvider im
     }
 
     /**
-     * Set properties into configuration. If the log is non-null, will log
-     * a TRACE message about the set.
+     * Set properties and class loader into configuration. 
      */
     protected void setInto(Configuration conf, Log log) {
+    	conf.addClassLoader(getClassLoader());
         if (log != null && log.isTraceEnabled())
             log.trace(_loc.get("conf-load", getProperties()));
         if (_props != null)
             conf.fromProperties(_props);
     }
+
+	@Override
+	public MultiClassLoader getClassLoader() {
+		return _loader;
+	}
 }

Modified: openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/conf/ObjectValue.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/conf/ObjectValue.java?rev=1190716&r1=1190715&r2=1190716&view=diff
==============================================================================
--- openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/conf/ObjectValue.java (original)
+++ openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/conf/ObjectValue.java Sat Oct 29 00:44:11 2011
@@ -18,45 +18,72 @@
  */
 package org.apache.openjpa.lib.conf;
 
-import java.security.AccessController;
-
 import org.apache.commons.lang.ObjectUtils;
-import org.apache.openjpa.lib.util.J2DoPrivHelper;
 import org.apache.openjpa.lib.util.Localizer;
-import org.apache.openjpa.lib.util.ReferenceMap;
-import org.apache.openjpa.lib.util.concurrent.ConcurrentReferenceHashMap;
 
 /**
  * An object {@link Value}.
  *
  * @author Abe White
+ * @author Pinaki Poddar
  */
-public class ObjectValue extends Value {
+public class ObjectValue<T> extends Value<T> {
 
-    private static final Localizer _loc = Localizer.forPackage
-        (ObjectValue.class);
+    private static final Localizer _loc = Localizer.forPackage(ObjectValue.class);
 
     // cache the types' classloader
-    private static ConcurrentReferenceHashMap _classloaderCache =
-        new ConcurrentReferenceHashMap(ReferenceMap.HARD, ReferenceMap.WEAK);
+//    private static ConcurrentReferenceHashMap _classloaderCache =
+//        new ConcurrentReferenceHashMap(ReferenceMap.HARD, ReferenceMap.WEAK);
 
-    private Object _value = null;
+    private T _value = null;
 
-    public ObjectValue(String prop) {
-        super(prop);
+    public ObjectValue(Class<T> type, String prop) {
+        super(type, prop);
+    }
+    
+    public void setAlias(String key, Class<? extends T> value) {
+        setAlias(key, value.getName());
+    }
+    
+    /**
+     * Sets the fully-qualified name of the given class as the value for an alias with fixed 
+     * name <tt>"default"</tt>.
+     * Also set the string value to the key i.e. value of this plug-in is set to its
+     * default value.
+     *   
+     * @param value value for the alias. also the value set to this plug-in.
+     * 
+     * @see #setDefaultAlias(String, Class)
+     */
+    public void setDefaultAlias(Class<? extends T> value) {
+    	setDefaultAlias("default", value);
+    }    
+    
+    /**
+     * Sets the given key as the default alias for the fully-qualified name of the given class.
+     * Also set the string value to the key i.e. value of this plug-in is set to its
+     * default value.
+     *   
+     * @param key alias which is also the default
+     * @param value value for the alias. also the value set to this plug-in.
+     */
+    public void setDefaultAlias(String key, Class<? extends T> value) {
+        setAlias(key, value == null ? null : value.getName());
+        setDefault(key);
+        setString(key);
     }
 
     /**
      * The internal value.
      */
-    public Object get() {
+    public T get() {
         return _value;
     }
 
     /**
      * The internal value.
      */
-    public void set(Object obj) {
+    public void set(T obj) {
         set(obj, false);
     }
 
@@ -65,7 +92,7 @@ public class ObjectValue extends Value {
      *
      * @param derived if true, this value was derived from other properties
      */
-    public void set(Object obj, boolean derived) {
+    public void set(T obj, boolean derived) {
         if (!derived) assertChangeable();
         Object oldValue = _value;
         _value = obj;
@@ -79,29 +106,28 @@ public class ObjectValue extends Value {
      * Instantiate the object as an instance of the given class. Equivalent
      * to <code>instantiate(type, conf, true)</code>.
      */
-    public Object instantiate(Class<?> type, Configuration conf) {
-        return instantiate(type, conf, true);
+    public T instantiate(Configuration conf) {
+        return instantiate(conf, true);
     }
 
     /**
      * Instantiate the object as an instance of the given class.
      */
-    public Object instantiate(Class<?> type, Configuration conf, boolean fatal)
-    {
+    public T instantiate(Configuration conf, boolean fatal) {
         throw new UnsupportedOperationException();
     }
 
     /**
      * Configure the given object.
      */
-    public Object configure(Object obj, Configuration conf) {
+    public Object configure(T obj, Configuration conf) {
         return configure(obj, conf, true);
     }
 
     /**
      * Configure the given object.
      */
-    public Object configure(Object obj, Configuration conf, boolean fatal) {
+    public Object configure(T obj, Configuration conf, boolean fatal) {
         throw new UnsupportedOperationException();
     }
 
@@ -109,25 +135,10 @@ public class ObjectValue extends Value {
      * Allow subclasses to instantiate additional plugins. This method does
      * not perform configuration.
      */
-    public Object newInstance(String clsName, Class<?> type, Configuration conf,
-            boolean fatal) {
-        ClassLoader cl = (ClassLoader) _classloaderCache.get(type);
-        if (cl == null) {
-            cl = AccessController.doPrivileged(
-                J2DoPrivHelper.getClassLoaderAction(type));
-            if (cl == null) {  // System classloader is returned as null
-                cl = AccessController.doPrivileged(
-                    J2DoPrivHelper.getSystemClassLoaderAction()); 
-            }
-            _classloaderCache.put(type, cl);
-        }
-        return Configurations.newInstance(clsName, this, conf, cl, fatal);
-    }
-
-    public Class<?> getValueType() {
-        return Object.class;
+    public T newInstance(String clsName, Configuration conf, boolean fatal) {
+        return Configurations.newInstance(clsName, this, conf, conf.getClassLoader(), fatal);
     }
-
+    
     /**
      * Implement this method to synchronize internal data with the new
      * object value.
@@ -143,11 +154,15 @@ public class ObjectValue extends Value {
         if (str == null)
             set(null);
         else
-            throw new IllegalArgumentException(_loc.get("cant-set-string",
-                getProperty()).getMessage());
+            throw new IllegalArgumentException(_loc.get("cant-set-string", getProperty()).getMessage());
     }
 
     protected void setInternalObject(Object obj) {
-        set(obj);
+        set((T)obj);
     }
+    
+    public Object getExternal() {
+      return isHidden() ? Value.INVISIBLE : getString();
+    }
+
 }

Modified: openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/conf/PluginListValue.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/conf/PluginListValue.java?rev=1190716&r1=1190715&r2=1190716&view=diff
==============================================================================
--- openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/conf/PluginListValue.java (original)
+++ openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/conf/PluginListValue.java Sat Oct 29 00:44:11 2011
@@ -31,15 +31,18 @@ import org.apache.commons.lang.StringUti
  * @author Abe White
  * @see PluginValue
  */
-public class PluginListValue extends ObjectValue {
+public class PluginListValue<T> extends ObjectValue<T[]> {
 
     private static final String[] EMPTY = new String[0];
 
     private String[] _names = EMPTY;
     private String[] _props = EMPTY;
+    
+    private final Class<T> elemType;
 
-    public PluginListValue(String prop) {
-        super(prop);
+    public PluginListValue(Class<T[]> cls, String prop) {
+        super(cls, prop);
+        elemType = (Class<T>)cls.getComponentType();
     }
 
     /**
@@ -81,17 +84,16 @@ public class PluginListValue extends Obj
     /**
      * Instantiate the plugins as instances of the given class.
      */
-    public Object instantiate(Class<?> elemType, Configuration conf,
-        boolean fatal) {
-        Object[] ret;
-        if (_names.length == 0)
-            ret = (Object[]) Array.newInstance(elemType, 0);
-        else {
-            ret = (Object[]) Array.newInstance(elemType, _names.length);
+    public T[] instantiate(Configuration conf, boolean fatal) {
+        T[] ret;
+        if (_names.length == 0) {
+            ret = (T[])Array.newInstance(elemType, 0);
+        } else {
+            ret = (T[]) Array.newInstance(elemType, _names.length);
             for (int i = 0; i < ret.length; i++) {
-                ret[i] = newInstance(_names[i], elemType, conf, fatal);
-                Configurations.configureInstance(ret[i], conf, _props[i],
-                    getProperty());
+            	PluginValue<T> elem = new PluginValue<T>(elemType, "element", false);
+            	ret[i] = elem.newInstance(_names[i], conf, fatal);
+                Configurations.configureInstance(ret[i], conf, _props[i],  getProperty());
             }
         }
         set(ret, true);
@@ -182,10 +184,6 @@ public class PluginListValue extends Obj
         valueChanged();
     }
 
-    public Class<Object []> getValueType() {
-        return Object[].class;
-    }
-
     protected void objectChanged() {
         Object[] vals = (Object[]) get();
         if (vals == null || vals.length == 0)

Modified: openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/conf/PluginValue.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/conf/PluginValue.java?rev=1190716&r1=1190715&r2=1190716&view=diff
==============================================================================
--- openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/conf/PluginValue.java (original)
+++ openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/conf/PluginValue.java Sat Oct 29 00:44:11 2011
@@ -33,17 +33,16 @@ import org.apache.openjpa.lib.util.Local
  *
  * @author Abe White
  */
-public class PluginValue extends ObjectValue {
+public class PluginValue<T> extends ObjectValue<T> {
 
-    private static final Localizer _loc = Localizer.forPackage
-        (PluginValue.class);
+    private static final Localizer _loc = Localizer.forPackage(PluginValue.class);
 
     private final boolean _singleton;
     private String _name = null;
     private String _props = null;
 
-    public PluginValue(String prop, boolean singleton) {
-        super(prop);
+    public PluginValue(Class<T> type, String prop, boolean singleton) {
+        super(type, prop);
         _singleton = singleton;
     }
 
@@ -98,32 +97,25 @@ public class PluginValue extends ObjectV
     /**
      * Instantiate the plugin as an instance of the given class.
      */
-    public Object instantiate(Class<?> type, Configuration conf, boolean fatal)
-    {
-        Object obj = newInstance(_name, type, conf, fatal);
-        Configurations.configureInstance(obj, conf, _props,
-            (fatal) ? getProperty() : null);
-        if (_singleton)
-            set(obj, true);
-        return obj;
+    public T instantiate(Configuration conf, boolean fatal) {
+        T obj = newInstance(_name, conf, fatal);
+        return configure(obj, conf, fatal);
     }
 
     /**
      * Configure the given object.
      */
-    public Object configure(Object obj, Configuration conf, boolean fatal) {
-        Configurations.configureInstance(obj, conf, _props,
-            (fatal) ? getProperty() : null);
+    public T configure(T obj, Configuration conf, boolean fatal) {
+        Configurations.configureInstance(obj, conf, _props, fatal ? getProperty() : null);
         if (_singleton)
             set(obj, true);
         return obj;
     }
     
 
-    public void set(Object obj, boolean derived) {
+    public void set(T obj, boolean derived) {
         if (!_singleton)
-            throw new IllegalStateException(_loc.get("not-singleton",
-                getProperty()).getMessage());
+            throw new IllegalStateException(_loc.get("not-singleton", getProperty()).getMessage());
         super.set(obj, derived);
     }
 
@@ -141,10 +133,6 @@ public class PluginValue extends ObjectV
         valueChanged();
     }
 
-    public Class<Object> getValueType() {
-        return Object.class;
-    }
-
     protected void objectChanged() {
         Object obj = get();
         _name = (obj == null) ? unalias(null) : obj.getClass().getName();

Modified: openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/conf/ProductDerivation.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/conf/ProductDerivation.java?rev=1190716&r1=1190715&r2=1190716&view=diff
==============================================================================
--- openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/conf/ProductDerivation.java (original)
+++ openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/conf/ProductDerivation.java Sat Oct 29 00:44:11 2011
@@ -25,10 +25,12 @@ import java.util.Set;
 
 /**
  * Hooks for deriving products with additional functionality.
- * Parses configuration information from global, default or explictly-specified
+ * Parses configuration information from global, default or explicitly-specified
  * resources. All implementations of this interface will have a chance to mutate
  * a {@link Configuration} both before and after the user-specified 
- * configuration data is loaded. The order in which the product derivations are
+ * configuration data is loaded. 
+ * <br>
+ * The order in which the product derivations are
  * evaluated is determined by the specificity of the derivation type.
  *
  * @author Abe White
@@ -55,23 +57,21 @@ public interface ProductDerivation {
      * loading classes for the product this derivation represents to be sure
      * they exist.  Throw any throwable to indicate an invalid derivation.
      * Invalid derivations will not be used.
+     * Throw non-fatal {@link BootstrapException} to supress error reporting.
      */
-    public void validate()
-        throws Exception;
+    public void validate() throws Exception;
 
     /**
      * Load globals into the returned ConfigurationProvider, or return null if 
      * no globals are found.
      */
-    public ConfigurationProvider loadGlobals(ClassLoader loader) 
-        throws Exception;
+    public ConfigurationProvider loadGlobals() throws Exception;
 
     /**
      * Load defaults into the returned ConfigurationProvider, or return null if 
      * no defaults are found.
      */
-    public ConfigurationProvider loadDefaults(ClassLoader loader) 
-        throws Exception;
+    public ConfigurationProvider loadDefaults() throws Exception;
 
     /**
      * Load the given given resource into the returned ConfigurationProvider, 
@@ -81,9 +81,7 @@ public interface ProductDerivation {
      * @param anchor optional named anchor within a multiple-configuration
      * resource
      */
-    public ConfigurationProvider load(String resource, String anchor, 
-        ClassLoader loader) 
-        throws Exception;
+    public ConfigurationProvider load(String resource, String anchor) throws Exception;
 
     /**
      * Load given file, or return null if it is not a file this receiver
@@ -91,8 +89,7 @@ public interface ProductDerivation {
      *
      * @param anchor optional named anchor within a multiple-configuration file
      */
-    public ConfigurationProvider load(File file, String anchor) 
-        throws Exception;
+    public ConfigurationProvider load(File file, String anchor) throws Exception;
 
     /**
      * Return a string identifying the default resource location for this
@@ -113,8 +110,7 @@ public interface ProductDerivation {
      *
      * @since 1.1.0
      */
-    public List<String> getAnchorsInFile(File file) throws IOException,
-            Exception;
+    public List<String> getAnchorsInFile(File file) throws IOException, Exception;
 
     /**
      * Return a List<String> of all the anchors defined in



Mime
View raw message