openjpa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ppod...@apache.org
Subject svn commit: r1190716 [5/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/kernel/ExtentImpl.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/ExtentImpl.java?rev=1190716&r1=1190715&r2=1190716&view=diff
==============================================================================
--- openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/ExtentImpl.java (original)
+++ openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/ExtentImpl.java Sat Oct 29 00:44:11 2011
@@ -66,7 +66,7 @@ public class ExtentImpl<T>
      * @param type the candidate class
      * @param subs whether subclasses are included in the extent
      */
-    ExtentImpl(Broker broker, Class<T> type, boolean subs,
+    protected ExtentImpl(Broker broker, Class<T> type, boolean subs,
         FetchConfiguration fetch) {
         _broker = broker;
         _type = type;
@@ -120,8 +120,7 @@ public class ExtentImpl<T>
             // add database iterators for each implementing class
             MetaDataRepository repos = _broker.getConfiguration().
                 getMetaDataRepositoryInstance();
-            ClassMetaData meta = repos.getMetaData(_type,
-                _broker.getClassLoader(), false);
+            ClassMetaData meta = repos.getMetaData(_type, false);
 
             ClassMetaData[] metas;
             if (meta != null && (!_subs || !meta.isManagedInterface())
@@ -129,8 +128,7 @@ public class ExtentImpl<T>
                 && meta.getMappedPCSubclassMetaDatas().length > 0)))
                 metas = new ClassMetaData[]{ meta };
             else if (_subs && (meta == null || meta.isManagedInterface()))
-                metas = repos.getImplementorMetaDatas(_type,
-                    _broker.getClassLoader(), false);
+                metas = repos.getImplementorMetaDatas(_type, false);
             else
                 metas = EMPTY_METAS;
 

Modified: openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/QueryImpl.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/QueryImpl.java?rev=1190716&r1=1190715&r2=1190716&view=diff
==============================================================================
--- openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/QueryImpl.java (original)
+++ openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/QueryImpl.java Sat Oct 29 00:44:11 2011
@@ -86,7 +86,6 @@ public class QueryImpl
     private final StoreQuery _storeQuery;
     private transient final BrokerImpl _broker;
     private transient final Log _log;
-    private transient ClassLoader _loader = null;
 
     // query has its own internal lock
     private ReentrantLock _lock;
@@ -354,7 +353,6 @@ public class QueryImpl
             boolean invalidate = false;
             if (_extent.getElementType() != _class) {
                 _class = _extent.getElementType();
-                _loader = null;
                 invalidate = true;
             }
             if (_extent.hasSubclasses() != _subclasses) {
@@ -414,7 +412,6 @@ public class QueryImpl
             assertNotReadOnly();
             _class = candidateClass;
             _subclasses = subs;
-            _loader = null;
             invalidateCompilation();
         } finally {
             unlock();
@@ -723,17 +720,14 @@ public class QueryImpl
     private StoreQuery.Executor createExecutor(boolean inMem) {
         assertCandidateType();
 
-        MetaDataRepository repos = _broker.getConfiguration().
-            getMetaDataRepositoryInstance();
-        ClassMetaData meta = repos.getMetaData(_class,
-            _broker.getClassLoader(), false);
+        MetaDataRepository repos = _broker.getConfiguration().getMetaDataRepositoryInstance();
+        ClassMetaData meta = repos.getMetaData(_class, false);
 
         ClassMetaData[] metas;
         if (_class == null || _storeQuery.supportsAbstractExecutors())
             metas = new ClassMetaData[]{ meta };
         else if (_subclasses && (meta == null || meta.isManagedInterface()))
-            metas = repos.getImplementorMetaDatas(_class,
-                _broker.getClassLoader(), true);
+            metas = repos.getImplementorMetaDatas(_class, true);
         else if (meta != null && (_subclasses || meta.isMapped()))
             metas = new ClassMetaData[]{ meta };
         else
@@ -744,8 +738,7 @@ public class QueryImpl
         try {
             if (metas.length == 1) {
                 if (inMem)
-                    return _storeQuery.newInMemoryExecutor(metas[0],
-                        _subclasses);
+                    return _storeQuery.newInMemoryExecutor(metas[0], _subclasses);
                 return _storeQuery.newDataStoreExecutor(metas[0], _subclasses);
             }
 
@@ -1635,11 +1628,8 @@ public class QueryImpl
             return type;
 
         // first check the aliases map in the MetaDataRepository
-        ClassLoader loader = (_class == null) ? _loader
-            : AccessController.doPrivileged(
-                J2DoPrivHelper.getClassLoaderAction(_class)); 
         ClassMetaData meta = _broker.getConfiguration().
-            getMetaDataRepositoryInstance().getMetaData(name, loader, false);
+            getMetaDataRepositoryInstance().getMetaData(name, false);
         if (meta != null)
             return meta.getDescribedType();
 
@@ -1683,14 +1673,10 @@ public class QueryImpl
     /**
      * Return the {@link Class} for the given name, or null if name not valid.
      */
-    private Class toClass(String name) {
-        if (_loader == null)
-            _loader = _broker.getConfiguration().getClassResolverInstance().
-                getClassLoader(_class, _broker.getClassLoader());
+    private Class<?> toClass(String name) {
         try {
-            return Strings.toClass(name, _loader);
-        } catch (RuntimeException re) {
-        } catch (NoClassDefFoundError ncdfe) {
+            return Class.forName(name, true, getBroker().getConfiguration().getClassLoader());
+        } catch (Exception re) {
         }
         return null;
     }

Modified: openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/StateManagerImpl.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/StateManagerImpl.java?rev=1190716&r1=1190715&r2=1190716&view=diff
==============================================================================
--- openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/StateManagerImpl.java (original)
+++ openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/StateManagerImpl.java Sat Oct 29 00:44:11 2011
@@ -160,8 +160,7 @@ public class StateManagerImpl
     /**
      * Constructor; supply id, type metadata, and owning persistence manager.
      */
-    protected StateManagerImpl(Object id, ClassMetaData meta, 
-        BrokerImpl broker) {
+    public StateManagerImpl(Object id, ClassMetaData meta, BrokerImpl broker) {
         _id = id;
         _meta = meta;
         _broker = broker;
@@ -303,15 +302,13 @@ public class StateManagerImpl
         // metadata to a superclass id -- the subclass' id may be a
         // different class, so we need to reset it
         if (_meta.getDescribedType() != cls) {
-            ClassMetaData sub = _meta.getRepository().getMetaData
-                (cls, _broker.getClassLoader(), true);
+            ClassMetaData sub = _meta.getRepository().getMetaData(cls, true);
             if (_oid != null) {
-                if (_meta.getIdentityType() == ClassMetaData.ID_DATASTORE)
-                    _oid = _broker.getStoreManager().copyDataStoreId(_oid,
-                        sub);
-                else if (_meta.isOpenJPAIdentity())
+                if (_meta.getIdentityType() == ClassMetaData.ID_DATASTORE) {
+                    _oid = _broker.getStoreManager().copyDataStoreId(_oid, sub);
+                } else if (_meta.isOpenJPAIdentity()) {
                     _oid = ApplicationIds.copy(_oid, sub);
-                else if (sub.getObjectIdType() != _meta.getObjectIdType()) {
+                } else if (sub.getObjectIdType() != _meta.getObjectIdType()) {
                     Object[] pkFields = ApplicationIds.toPKValues(_oid, _meta);
                     _oid = ApplicationIds.fromPKValues(pkFields, sub);
                 }
@@ -324,9 +321,9 @@ public class StateManagerImpl
             // the instance was null: check to see if the instance is
             // abstract (as can sometimes be the case when the
             // class discriminator strategy is not configured correctly)
-            if (Modifier.isAbstract(cls.getModifiers()))
-                throw new UserException(_loc.get("instantiate-abstract",
-                    cls.getName(), _oid));
+            if (Modifier.isAbstract(cls.getModifiers())) {
+                throw new UserException(_loc.get("instantiate-abstract", cls.getName(), _oid));
+            }
             throw new InternalException();
         }
 
@@ -336,7 +333,7 @@ public class StateManagerImpl
     /**
      * Initialize with the given instance and state.
      */
-    protected void initialize(PersistenceCapable pc, PCState state) {
+    public void initialize(PersistenceCapable pc, PCState state) {
         if (pc == null)
             throw new UserException(_loc.get("init-null-pc", _meta));
         if (pc.pcGetStateManager() != null && pc.pcGetStateManager() != this)
@@ -3367,7 +3364,7 @@ public class StateManagerImpl
         // penalizes the serialization footprint of non-ReflectingPC SMs also.
         Class managedType = (Class) in.readObject();
         _meta = _broker.getConfiguration().getMetaDataRepositoryInstance()
-            .getMetaData(managedType, null, true);
+            .getMetaData(managedType, true);
 
         _pc = readPC(in);
     }

Modified: openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/StoreContext.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/StoreContext.java?rev=1190716&r1=1190715&r2=1190716&view=diff
==============================================================================
--- openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/StoreContext.java (original)
+++ openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/StoreContext.java Sat Oct 29 00:44:11 2011
@@ -94,12 +94,6 @@ public interface StoreContext {
     public void popFetchConfiguration();
 
     /**
-     * Return the current thread's class loader at the time this context
-     * was obtained.
-     */
-    public ClassLoader getClassLoader();
-
-    /**
      * Return the lock manager in use.
      */
     public LockManager getLockManager();
@@ -153,8 +147,7 @@ public interface StoreContext {
      * parameter
      * @see #find(Object,boolean,FindCallbacks)
      */
-    public Object[] findAll(Collection<Object> oids, boolean validate,
-        FindCallbacks call);
+    public Object[] findAll(Collection<?> oids, boolean validate, FindCallbacks call);
 
     /**
      * Return the object with the given oid. If present, the
@@ -169,15 +162,14 @@ public interface StoreContext {
      * if a cached instance has been deleted concurrently. These options
      * are controllable through the given <code>OID_XXX</code> flags.
      */
-    public Object find(Object oid, FetchConfiguration fetch, BitSet exclude,
-        Object edata, int flags);
+    public Object find(Object oid, FetchConfiguration fetch, BitSet exclude, Object edata, int flags);
 
     /**
      * Return the objects with the given oids.
      *
      * @see #find(Object,FetchConfiguration,BitSet,Object,int)
      */
-    public Object[] findAll(Collection<Object> oids, FetchConfiguration fetch,
+    public Object[] findAll(Collection<?> oids, FetchConfiguration fetch,
         BitSet exclude, Object edata, int flags);
 
     /**
@@ -186,8 +178,7 @@ public interface StoreContext {
      * when no longer needed. This method delegates to 
      * {@link StoreManager#executeExtent}.
      */
-    public Iterator<Object> extentIterator(Class<?> cls, boolean subs,
-        FetchConfiguration fetch, boolean ignoreChanges);
+    public <T> Iterator<T> extentIterator(Class<T> cls, boolean subs, FetchConfiguration fetch, boolean ignoreChanges);
 
     /**
      * Immediately load the given object's persistent fields. One might
@@ -209,7 +200,7 @@ public interface StoreContext {
      * @param fgOnly indicator as to whether to retrieve only fields
      * @see #retrieve
      */
-    public void retrieveAll(Collection<Object> objs, boolean fgOnly, OpCallbacks call);
+    public void retrieveAll(Collection<?> objs, boolean fgOnly, OpCallbacks call);
 
     /**
      * Make the given instance embedded.
@@ -221,8 +212,7 @@ public interface StoreContext {
      * @param ownerMeta the value in which the object is embedded
      * @return the state manager for the embedded instance
      */
-    public OpenJPAStateManager embed(Object obj, Object id,
-        OpenJPAStateManager owner, ValueMetaData ownerMeta);
+    public OpenJPAStateManager embed(Object obj, Object id, OpenJPAStateManager owner, ValueMetaData ownerMeta);
 
     /**
      * Return the application or datastore identity class the given persistent
@@ -339,7 +329,7 @@ public interface StoreContext {
      * @param updateVersion if true, the instance's version will be
      * incremented at the next flush
      */
-    public void transactionalAll(Collection<Object> objs, boolean updateVersion, OpCallbacks call);
+    public void transactionalAll(Collection<?> objs, boolean updateVersion, OpCallbacks call);
 
     /**
      * Make the given object non-transactional.
@@ -349,7 +339,7 @@ public interface StoreContext {
     /**
      * Make the given objects nontransactional.
      */
-    public void nontransactionalAll(Collection<Object> objs, OpCallbacks call);
+    public void nontransactionalAll(Collection<?> objs, OpCallbacks call);
 
     /**
      * Return whether the given object is persistent.

Modified: openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/StoreManager.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/StoreManager.java?rev=1190716&r1=1190715&r2=1190716&view=diff
==============================================================================
--- openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/StoreManager.java (original)
+++ openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/StoreManager.java Sat Oct 29 00:44:11 2011
@@ -252,7 +252,7 @@ public interface StoreManager
      *
      * @see org.apache.openjpa.util.ApplicationIds#assign()
      */
-    public Collection<Exception> flush(Collection<OpenJPAStateManager> sms);
+    public Collection<Exception> flush(Collection<? extends OpenJPAStateManager> sms);
 
     /**
      * Assign an object id to the given new instance. Return false if the

Modified: openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/VersionAttachStrategy.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/VersionAttachStrategy.java?rev=1190716&r1=1190715&r2=1190716&view=diff
==============================================================================
--- openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/VersionAttachStrategy.java (original)
+++ openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/VersionAttachStrategy.java Sat Oct 29 00:44:11 2011
@@ -23,6 +23,7 @@ import java.util.Collection;
 import java.util.Iterator;
 import java.util.Map;
 
+import org.apache.openjpa.conf.OpenJPAConfiguration;
 import org.apache.openjpa.enhance.PersistenceCapable;
 import org.apache.openjpa.enhance.Reflection;
 import org.apache.openjpa.enhance.StateManager;
@@ -48,39 +49,31 @@ class VersionAttachStrategy
     extends AttachStrategy
     implements DetachState {
 
-    private static final Localizer _loc = Localizer.forPackage
-        (VersionAttachStrategy.class);
+    private static final Localizer _loc = Localizer.forPackage(VersionAttachStrategy.class);
 
-    protected Object getDetachedObjectId(AttachManager manager,
-        Object toAttach) {
+    protected Object getDetachedObjectId(AttachManager manager, Object toAttach) {
         Broker broker = manager.getBroker();
         ClassMetaData meta = broker.getConfiguration().
             getMetaDataRepositoryInstance().getMetaData(
-                ImplHelper.getManagedInstance(toAttach).getClass(),
-                broker.getClassLoader(), true);
-        return ApplicationIds.create(ImplHelper.toPersistenceCapable(toAttach,
-            broker.getConfiguration()),
-            meta);
+                ImplHelper.getManagedInstance(toAttach).getClass(), true);
+        return ApplicationIds.create(ImplHelper.toPersistenceCapable(toAttach, broker.getConfiguration()), meta);
     }
 
-    protected void provideField(Object toAttach, StateManagerImpl sm,
-        int field) {
-        sm.provideField(ImplHelper.toPersistenceCapable(toAttach,
-            sm.getContext().getConfiguration()), this, field);
+    protected void provideField(Object toAttach, StateManagerImpl sm,  int field) {
+        sm.provideField(ImplHelper.toPersistenceCapable(toAttach, sm.getContext().getConfiguration()), this, field);
     }
 
     public Object attach(AttachManager manager, Object toAttach,
         ClassMetaData meta, PersistenceCapable into, OpenJPAStateManager owner,
         ValueMetaData ownerMeta, boolean explicit) {
         BrokerImpl broker = manager.getBroker();
-        PersistenceCapable pc = ImplHelper.toPersistenceCapable(toAttach,
-            meta.getRepository().getConfiguration());
+        PersistenceCapable pc = ImplHelper.toPersistenceCapable(toAttach, meta.getRepository().getConfiguration());
 
         boolean embedded = ownerMeta != null && ownerMeta.isEmbeddedPC();
         boolean isNew = !broker.isDetached(pc);
         Object version = null;
         StateManagerImpl sm;
-
+        OpenJPAConfiguration conf = broker.getConfiguration();
         // if the state manager for the embedded instance is null, then
         // it should be treated as a new instance (since the
         // newly persisted owner may create a new embedded instance
@@ -90,39 +83,35 @@ class VersionAttachStrategy
         // copy into a new embedded instance
         if (embedded && (isNew || into == null
             || broker.getStateManager(into) == null)) {
-            if (into == null)
+            if (into == null) {
                 into = pc.pcNewInstance(null, false);
+            }
             sm = (StateManagerImpl) broker.embed(into, null, owner, ownerMeta);
             into = sm.getPersistenceCapable();
         } else if (isNew) {
             Object oid = null;
-            if (!isPrimaryKeysGenerated(meta))
+            if (!isPrimaryKeysGenerated(meta)) {
                 oid = ApplicationIds.create(pc, meta);
-
+            }
             sm = persist(manager, pc, meta, oid, explicit);
             into = sm.getPersistenceCapable();
         } else if (!embedded && into == null) {
             Object id = getDetachedObjectId(manager, toAttach);
-            if (id != null)
-                into =
-                    ImplHelper.toPersistenceCapable(broker.find(id, true, null),
-                        broker.getConfiguration());
-            if (into == null)
+            if (id != null) {
+                into =  ImplHelper.toPersistenceCapable(broker.find(id, true, null), conf);
+            }
+            if (into == null) {
                 throw new OptimisticException(_loc.get("attach-version-del",
-                    ImplHelper.getManagedInstance(pc).getClass(), id, version))
-                    .setFailedObject(toAttach);
-
+                    ImplHelper.getManagedInstance(pc).getClass(), id, version)).setFailedObject(toAttach);
+            }
             sm = manager.assertManaged(into);
-            if (meta.getDescribedType()
-                != sm.getMetaData().getDescribedType()) {
-                throw new ObjectNotFoundException(_loc.get
-                    ("attach-wrongclass", id, toAttach.getClass(),
-                        sm.getMetaData().getDescribedType())).
-                    setFailedObject(toAttach);
+            if (meta.getDescribedType() != sm.getMetaData().getDescribedType()) {
+                throw new ObjectNotFoundException(_loc.get("attach-wrongclass", id, toAttach.getClass(),
+                        sm.getMetaData().getDescribedType())).setFailedObject(toAttach);
             }
-        } else
+        } else {
             sm = manager.assertManaged(into);
-
+        }
         // mark that we attached the instance *before* we
         // fill in values to avoid endless recursion
         manager.setAttachedCopy(toAttach, into);
@@ -134,8 +123,7 @@ class VersionAttachStrategy
         }
 
         if (isNew) {
-            broker.fireLifecycleEvent(toAttach, null, meta,
-                LifecycleEvent.BEFORE_PERSIST);
+            broker.fireLifecycleEvent(toAttach, null, meta, LifecycleEvent.BEFORE_PERSIST);
         } else {
             // invoke any preAttach on the detached instance
             manager.fireBeforeAttach(toAttach, meta);
@@ -155,9 +143,9 @@ class VersionAttachStrategy
                         attachField(manager, toAttach, sm, fmds[i], true);
                         break;
                     case DETACH_FETCH_GROUPS:
-                        if (fetch.requiresFetch(fmds[i]) 
-                            != FetchConfiguration.FETCH_NONE)
+                        if (fetch.requiresFetch(fmds[i]) != FetchConfiguration.FETCH_NONE) {
                             attachField(manager, toAttach, sm, fmds[i], true);
+                        }
                         break;
                     case DETACH_LOADED:
                         attachField(manager, toAttach, sm, fmds[i], false);
@@ -167,8 +155,9 @@ class VersionAttachStrategy
         } finally {
             pc.pcReplaceStateManager(smBefore);
         }
-        if (!embedded && !isNew)
+        if (!embedded && !isNew) {
             compareVersion(sm, pc);
+        }
         return ImplHelper.getManagedInstance(into);
     }
 

Modified: openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/exps/AbstractExpressionBuilder.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/exps/AbstractExpressionBuilder.java?rev=1190716&r1=1190715&r2=1190716&view=diff
==============================================================================
--- openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/exps/AbstractExpressionBuilder.java (original)
+++ openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/exps/AbstractExpressionBuilder.java Sat Oct 29 00:44:11 2011
@@ -234,16 +234,8 @@ public abstract class AbstractExpression
      * Convenience method to get metadata for the given type.
      */
     protected ClassMetaData getMetaData(Class<?> c, boolean required) {
-        return getMetaData(c, required, getClassLoader());
-    }
-
-    /**
-     * Convenience method to get metadata for the given type.
-     */
-    protected ClassMetaData getMetaData(Class<?> c, boolean required,
-        ClassLoader loader) {
         return resolver.getConfiguration().getMetaDataRepositoryInstance().
-            getMetaData(c, loader, required);
+            getMetaData(c, required);
     }
 
     /**

Modified: openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/exps/CandidatePath.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/exps/CandidatePath.java?rev=1190716&r1=1190715&r2=1190716&view=diff
==============================================================================
--- openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/exps/CandidatePath.java (original)
+++ openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/exps/CandidatePath.java Sat Oct 29 00:44:11 2011
@@ -167,7 +167,7 @@ public class CandidatePath
     /**
      * Represents a traversal through a field.
      */
-    private static class Traversal {
+    public static class Traversal {
 
         public final FieldMetaData field;
         public final boolean nullTraversal;

Modified: openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/exps/Exp.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/exps/Exp.java?rev=1190716&r1=1190715&r2=1190716&view=diff
==============================================================================
--- openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/exps/Exp.java (original)
+++ openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/exps/Exp.java Sat Oct 29 00:44:11 2011
@@ -27,7 +27,7 @@ import org.apache.openjpa.kernel.StoreCo
  *
  * @author Abe White
  */
-class Exp
+public class Exp
     implements Expression {
 
     /**

Modified: openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/exps/InMemoryExpressionFactory.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/exps/InMemoryExpressionFactory.java?rev=1190716&r1=1190715&r2=1190716&view=diff
==============================================================================
--- openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/exps/InMemoryExpressionFactory.java (original)
+++ openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/exps/InMemoryExpressionFactory.java Sat Oct 29 00:44:11 2011
@@ -82,7 +82,7 @@ public class InMemoryExpressionFactory
      * of embedded procedural loops over the extents of all variables in the
      * unbounds list.
      */
-    private boolean matches(Exp exp, Object candidate, StoreContext ctx,
+    protected boolean matches(Exp exp, Object candidate, StoreContext ctx,
         Object[] params, int i) {
         // base case: all variables have been aliased; evaluate for current
         // values

Modified: openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/jpql/JPQLExpressionBuilder.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/jpql/JPQLExpressionBuilder.java?rev=1190716&r1=1190715&r2=1190716&view=diff
==============================================================================
--- openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/jpql/JPQLExpressionBuilder.java (original)
+++ openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/jpql/JPQLExpressionBuilder.java Sat Oct 29 00:44:11 2011
@@ -168,12 +168,11 @@ public class JPQLExpressionBuilder
     }
 
     private ClassMetaData getClassMetaData(String alias, boolean assertValid) {
-        ClassLoader loader = getClassLoader();
         MetaDataRepository repos = resolver.getConfiguration().
             getMetaDataRepositoryInstance();
 
         // first check for the alias
-        ClassMetaData cmd = repos.getMetaData(alias, loader, false);
+        ClassMetaData cmd = repos.getMetaData(alias, false);
 
         if (cmd != null)
             return cmd;
@@ -184,9 +183,9 @@ public class JPQLExpressionBuilder
         // the concept of entity names or aliases
         Class<?> c = resolver.classForName(alias, null);
         if (c != null)
-            cmd = repos.getMetaData(c, loader, assertValid);
+            cmd = repos.getMetaData(c, assertValid);
         else if (assertValid)
-            cmd = repos.getMetaData(alias, loader, false);
+            cmd = repos.getMetaData(alias, false);
 
         if (cmd == null && assertValid) {
             String close = repos.getClosestAliasName(alias);

Modified: openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/meta/AbstractCFMetaDataFactory.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/meta/AbstractCFMetaDataFactory.java?rev=1190716&r1=1190715&r2=1190716&view=diff
==============================================================================
--- openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/meta/AbstractCFMetaDataFactory.java (original)
+++ openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/meta/AbstractCFMetaDataFactory.java Sat Oct 29 00:44:11 2011
@@ -61,7 +61,7 @@ import serp.util.Strings;
 
 /**
  * Base class for factory implementations built around XML metadata files
- * in the common fomat.
+ * in the common format.
  *
  * @author Abe White
  * @since 0.4.0
@@ -69,8 +69,7 @@ import serp.util.Strings;
 public abstract class AbstractCFMetaDataFactory
     extends AbstractMetaDataFactory {
 
-    private static final Localizer _loc = Localizer.forPackage
-        (AbstractMetaDataFactory.class);
+    private static final Localizer _loc = Localizer.forPackage(AbstractMetaDataFactory.class);
 
     protected Collection<File> files = null;
     protected Collection<URL> urls = null;
@@ -181,8 +180,7 @@ public abstract class AbstractCFMetaData
         if (!strict && (mode & MODE_META) != 0)
             mode |= MODE_MAPPING;
         Class<?> cls = (metas.length == 0) ? null : metas[0].getDescribedType();
-        ClassLoader loader = repos.getConfiguration().
-            getClassResolverInstance().getClassLoader(cls, null);
+        ClassLoader loader = repos.getConfiguration().getClassLoader();
         Map<String,ClassMetaData> clsNames = new HashMap<String,ClassMetaData>
         	((int) (metas.length * 1.33 + 1));
         for (int i = 0; i < metas.length; i++)
@@ -193,8 +191,7 @@ public abstract class AbstractCFMetaData
         Set metaFiles = null;
         Set queryFiles = null;
         if (isMappingOnlyFactory() || (mode & MODE_META) != 0)
-            metaFiles = assignDefaultMetaDataFiles(metas, queries, seqs, mode,
-                clsNames);
+            metaFiles = assignDefaultMetaDataFiles(metas, queries, seqs, mode, clsNames);
         if (!isMappingOnlyFactory() && (mode & MODE_QUERY) != 0)
             queryFiles = assignDefaultQueryFiles(queries, clsNames);
 
@@ -212,7 +209,6 @@ public abstract class AbstractCFMetaData
             if (metaFiles != null) {
                 parser = newParser(false);
                 parser.setMode(sermode);
-                parser.setClassLoader(loader);
                 parse(parser, metaFiles);
 
                 MetaDataRepository pr = parser.getRepository();
@@ -234,9 +230,9 @@ public abstract class AbstractCFMetaData
                     && (queries[i].getSourceMode() & mode) != 0)
                     ser.addQueryMetaData(queries[i]);
 
-            int flags = ser.PRETTY;
+            int flags = MetaDataSerializer.PRETTY;
             if ((store & STORE_VERBOSE) != 0)
-                flags |= ser.VERBOSE;
+                flags |= MetaDataSerializer.VERBOSE;
             serialize(ser, output, flags);
         }
 
@@ -254,20 +250,19 @@ public abstract class AbstractCFMetaData
                 if (queryFiles != null) {
                     parser = newParser(false);
                     parser.setMode(MODE_QUERY);
-                    parser.setClassLoader(loader);
                     parse(parser, queryFiles);
                     ser.addAll(parser.getRepository());
                 }
                 for (int i = 0; i < queries.length; i++)
                     if (queries[i].getSourceMode() == MODE_QUERY)
                         ser.addQueryMetaData(queries[i]);
-                serialize(ser, output, ser.PRETTY);
+                serialize(ser, output, MetaDataSerializer.PRETTY);
             }
         }
         return true;
     }
 
-    public boolean drop(Class[] cls, int mode, ClassLoader envLoader) {
+    public boolean drop(Class[] cls, int mode) {
         if (mode == MODE_NONE)
             return true;
         if (isMappingOnlyFactory() && (mode & MODE_MAPPING) == 0)
@@ -300,7 +295,7 @@ public abstract class AbstractCFMetaData
                     clsNames.add(null);
                 else
                     clsNames.add(cls[i].getName());
-                meta = pr.getMetaData(cls[i], envLoader, false);
+                meta = pr.getMetaData(cls[i], false);
                 if (meta != null) {
                     if (getSourceFile(meta) != null)
                         files.add(getSourceFile(meta));
@@ -342,8 +337,7 @@ public abstract class AbstractCFMetaData
             // calling code can take advantage of metadata still in repos
             if (isMappingOnlyFactory())
                 for (int i = 0; i < cls.length; i++)
-                    ser.removeMetaData(pr.getMetaData(cls[i], envLoader,
-                        false));
+                    ser.removeMetaData(pr.getMetaData(cls[i], false));
             serialize(ser, null, Serializer.PRETTY);
         }
         if (qqs != null && !qqs.isEmpty()) {
@@ -502,8 +496,7 @@ public abstract class AbstractCFMetaData
         for (Iterator itr = files.iterator(); itr.hasNext();) {
             file = (File) itr.next();
             if (Files.backup(file, false) != null)
-                AccessController
-                    .doPrivileged(J2DoPrivHelper.deleteAction(file));
+                AccessController.doPrivileged(J2DoPrivHelper.deleteAction(file));
         }
     }
 
@@ -601,8 +594,7 @@ public abstract class AbstractCFMetaData
         return null;
     }
 
-    public Set<String> getPersistentTypeNames(boolean devpath, 
-    	ClassLoader envLoader) {
+    public Set<String> getPersistentTypeNames(boolean devpath) {
         // some configured locations might be implicit in spec, so return
         // null if we don't find any classes, rather than if we don't have
         // any locations
@@ -610,15 +602,16 @@ public abstract class AbstractCFMetaData
             return (_typeNames.isEmpty()) ? null : _typeNames;
 
         try {
-            ClassLoader loader = repos.getConfiguration().
-                getClassResolverInstance().getClassLoader(getClass(),
-                envLoader);
+            ClassLoader loader = repos.getConfiguration().getClassLoader();
             long start = System.currentTimeMillis();
 
             Set names = parsePersistentTypeNames(loader);
-            if (names.isEmpty() && devpath)
+            if (names.isEmpty() && devpath) {
+            	ClassArgParser cap = newClassArgParser();
+            	cap.setClassLoader(repos.getConfiguration().getClassLoader());
                 scan(new ClasspathMetaDataIterator(null, newMetaDataFilter()),
-                    newClassArgParser(), names, false, null);
+                    cap, names, false, null);
+            }
             else // we don't cache a full dev cp scan
                 _typeNames = names;
 
@@ -637,6 +630,7 @@ public abstract class AbstractCFMetaData
     protected Set<String> parsePersistentTypeNames(ClassLoader loader)
         throws IOException {
         ClassArgParser cparser = newClassArgParser();
+        cparser.setClassLoader(loader);
         String[] clss;
         Set<String> names = new HashSet<String>();
         if (files != null) {
@@ -760,8 +754,8 @@ public abstract class AbstractCFMetaData
                 } else {
                     if (log.isTraceEnabled())
                         log.trace(_loc.get("scanning-resource", rsrc));
-                    mitr = new ResourceMetaDataIterator(rsrc, loader);
                     OpenJPAConfiguration conf = repos.getConfiguration();
+                    mitr = new ResourceMetaDataIterator(rsrc, conf.getClassLoader());
                     Map peMap = null;
                     if (conf instanceof OpenJPAConfigurationImpl)
                         peMap = ((OpenJPAConfigurationImpl)conf).getPersistenceEnvironment();

Modified: openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/meta/AbstractMetaDataFactory.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/meta/AbstractMetaDataFactory.java?rev=1190716&r1=1190715&r2=1190716&view=diff
==============================================================================
--- openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/meta/AbstractMetaDataFactory.java (original)
+++ openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/meta/AbstractMetaDataFactory.java Sat Oct 29 00:44:11 2011
@@ -45,13 +45,13 @@ public abstract class AbstractMetaDataFa
     protected File dir = null;
     protected int store = STORE_DEFAULT;
     protected boolean strict = false;
-    protected Set types = null;
+    protected Set<String> types = null;
 
 
     /**
      * Set of persistent type names supplied by user.
      */
-    public void setTypes(Set types) {
+    public void setTypes(Set<String> types) {
         this.types = types;
     }
 
@@ -61,14 +61,13 @@ public abstract class AbstractMetaDataFa
      */
     public void setTypes(String types) {
         this.types = (StringUtils.isEmpty(types)) ? null
-            : new HashSet(Arrays.asList(Strings.split(types, ";", 0)));
+            : new HashSet<String>(Arrays.asList(Strings.split(types, ";", 0)));
     }
 
     public void setRepository(MetaDataRepository repos) {
         this.repos = repos;
         if (repos != null)
-            log = repos.getConfiguration().getLog
-                (OpenJPAConfiguration.LOG_METADATA);
+            log = repos.getConfiguration().getLog(OpenJPAConfiguration.LOG_METADATA);
     }
 
     public void setStoreDirectory(File dir) {

Modified: openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/meta/ClassMetaData.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/meta/ClassMetaData.java?rev=1190716&r1=1190715&r2=1190716&view=diff
==============================================================================
--- openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/meta/ClassMetaData.java (original)
+++ openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/meta/ClassMetaData.java Sat Oct 29 00:44:11 2011
@@ -135,12 +135,10 @@ public class ClassMetaData
     private static final Localizer _loc = Localizer.forPackage
         (ClassMetaData.class);
 
-    private static final FetchGroup[] EMPTY_FETCH_GROUP_ARRAY
-        = new FetchGroup[0];
+    private static final FetchGroup[] EMPTY_FETCH_GROUP_ARRAY = new FetchGroup[0];
     private static final String[] EMPTY_STRING_ARRAY = new String[0];
 
     private MetaDataRepository _repos;
-    private transient ClassLoader _loader = null;
 
     private final ValueMetaData _owner;
     private final LifecycleMetaData _lifeMeta = new LifecycleMetaData(this);
@@ -236,8 +234,6 @@ public class ClassMetaData
     protected ClassMetaData(ValueMetaData owner) {
         _owner = owner;
         _repos = owner.getRepository();
-        setEnvClassLoader(owner.getFieldMetaData().getDefiningMetaData().
-            getEnvClassLoader());
         registerForValueUpdate("DataCacheTimeout");
     }
 
@@ -285,24 +281,6 @@ public class ClassMetaData
     }
 
     /**
-     * The environmental loader used when loading this metadata.
-     * The class metadata should use this loader when loading metadata for
-     * its superclass and field types.
-     */
-    public ClassLoader getEnvClassLoader() {
-        return _loader;
-    }
-
-    /**
-     * The class environmental loader used when loading this metadata.
-     * The class metadata should use this loader when loading metadata for
-     * its superclass and field types.
-     */
-    public void setEnvClassLoader(ClassLoader loader) {
-        _loader = loader;
-    }
-
-    /**
      * The persistence capable superclass of the described type.
      */
     public Class<?> getPCSuperclass() {
@@ -326,7 +304,7 @@ public class ClassMetaData
                 _superMeta = _repos.newEmbeddedClassMetaData(_owner);
                 _superMeta.setDescribedType(_super);
             } else
-                _superMeta = _repos.getMetaData(_super, _loader, true);
+                _superMeta = _repos.getMetaData(_super, true);
         }
         return _superMeta;
     }
@@ -368,7 +346,7 @@ public class ClassMetaData
         if (_owner != null)
             return MetaDataRepository.EMPTY_CLASSES;
 
-        _repos.processRegisteredClasses(_loader);
+        _repos.processRegisteredClasses();
         if (_subs == null) {
             Collection<Class<?>> subs = _repos.getPCSubclasses(_type);
             _subs = (Class[]) subs.toArray(new Class[subs.size()]);
@@ -393,7 +371,7 @@ public class ClassMetaData
                 ClassMetaData[] metas = _repos.newClassMetaDataArray
                     (subs.length);
                 for (int i = 0; i < subs.length; i++)
-                    metas[i] = _repos.getMetaData(subs[i], _loader, true);
+                    metas[i] = _repos.getMetaData(subs[i], true);
                 _subMetas = metas;
             }
         }
@@ -1829,7 +1807,7 @@ public class ClassMetaData
             }
 
             // copy info from the "real" metadata for this type
-            ClassMetaData meta = _repos.getMetaData(_type, _loader, true);
+            ClassMetaData meta = _repos.getMetaData(_type, true);
             meta.resolve(MODE_META);
             copy(this, meta);
             _embedded = Boolean.FALSE; // embedded instance isn't embedded-only
@@ -2620,21 +2598,20 @@ public class ClassMetaData
     	if (values == null)
     		return;
     	for (String key : values) {
-    		Value value = getRepository().getConfiguration()
-    			.getValue(key);
+    		Value<?> value = getRepository().getConfiguration().getValue(key);
     		if (value != null)
     			value.addListener(this);
     	}
     }
     
-    public void valueChanged(Value val) {
+    public void valueChanged(Value<?> val) {
     	if (val != null && val.matches("DataCacheTimeout")) {
     		_cacheTimeout = Integer.MIN_VALUE;
     	}
     }
     
     /**
-     * Utility method to get names of all fields including the superclasses'
+     * Utility method to get names of all fields including the super classes'
      * sorted in lexical order.
      */
     public String[] getFieldNames() {
@@ -2643,7 +2620,7 @@ public class ClassMetaData
     
     /**
      * Utility method to get names of all declared fields excluding the 
-     * superclasses' sorted in lexical order.
+     * super classes' sorted in lexical order.
      */
     public String[] getDeclaredFieldNames() {
     	return toNames(getDeclaredFields());

Modified: openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/meta/DelegatingMetaDataFactory.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/meta/DelegatingMetaDataFactory.java?rev=1190716&r1=1190715&r2=1190716&view=diff
==============================================================================
--- openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/meta/DelegatingMetaDataFactory.java (original)
+++ openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/meta/DelegatingMetaDataFactory.java Sat Oct 29 00:44:11 2011
@@ -55,8 +55,7 @@ public class DelegatingMetaDataFactory
      */
     public MetaDataFactory getInnermostDelegate() {
         if (_delegate instanceof DelegatingMetaDataFactory)
-            return ((DelegatingMetaDataFactory) _delegate).
-                getInnermostDelegate();
+            return ((DelegatingMetaDataFactory) _delegate).getInnermostDelegate();
         return _delegate;
     }
 
@@ -76,17 +75,17 @@ public class DelegatingMetaDataFactory
         _delegate.setStrict(true);
     }
 
-    public void load(Class cls, int mode, ClassLoader envLoader) {
-        _delegate.load(cls, mode, envLoader);
+    public void load(Class<?> cls, int mode) {
+        _delegate.load(cls, mode);
     }
 
     public boolean store(ClassMetaData[] metas, QueryMetaData[] queries,
-        SequenceMetaData[] seqs, int mode, Map output) {
+    	SequenceMetaData[] seqs, int mode, Map output) {
         return _delegate.store(metas, queries, seqs, mode, output);
     }
 
-    public boolean drop(Class[] cls, int mode, ClassLoader envLoader) {
-        return _delegate.drop(cls, mode, envLoader);
+    public boolean drop(Class<?>[] cls, int mode) {
+        return _delegate.drop(cls, mode);
     }
 
     public MetaDataDefaults getDefaults() {
@@ -97,18 +96,16 @@ public class DelegatingMetaDataFactory
         return _delegate.newClassArgParser();
     }
 
-    public Set getPersistentTypeNames(boolean classpath,
-        ClassLoader envLoader) {
-        return _delegate.getPersistentTypeNames(classpath, envLoader);
+    public Set<String> getPersistentTypeNames(boolean classpath) {
+        return _delegate.getPersistentTypeNames(classpath);
     }
 
-    public Class getQueryScope(String queryName, ClassLoader loader) {
-        return _delegate.getQueryScope(queryName, loader);
+    public Class<?> getQueryScope(String queryName) {
+        return _delegate.getQueryScope(queryName);
     }
 
-    public Class getResultSetMappingScope(String resultSetMappingName,
-        ClassLoader loader) {
-        return _delegate.getResultSetMappingScope(resultSetMappingName, loader);
+    public Class<?> getResultSetMappingScope(String resultSetMappingName) {
+        return _delegate.getResultSetMappingScope(resultSetMappingName);
     }
 
     public void clear() {

Modified: openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/meta/FieldMetaData.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/meta/FieldMetaData.java?rev=1190716&r1=1190715&r2=1190716&view=diff
==============================================================================
--- openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/meta/FieldMetaData.java (original)
+++ openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/meta/FieldMetaData.java Sat Oct 29 00:44:11 2011
@@ -328,8 +328,7 @@ public class FieldMetaData
         if (_dec == null)
             return _owner;
         if (_decMeta == null)
-            _decMeta = getRepository().getMetaData(_dec,
-                _owner.getEnvClassLoader(), true);
+            _decMeta = getRepository().getMetaData(_dec, true);
         return _decMeta;
     }
 

Modified: openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/meta/JavaTypes.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/meta/JavaTypes.java?rev=1190716&r1=1190715&r2=1190716&view=diff
==============================================================================
--- openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/meta/JavaTypes.java (original)
+++ openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/meta/JavaTypes.java Sat Oct 29 00:44:11 2011
@@ -215,11 +215,10 @@ public class JavaTypes {
      * @param mustExist Whether the supplied loader <b>must</b> be able to load the class. If true no attempt to use a 
      *        different classloader will be made. If false the ClassResolver from the configuration will be used. 
      */
-    public static Class<?> classForName(String name, ValueMetaData context,
-            ClassLoader loader, boolean mustExist) {    	
+    public static Class<?> classForName(String name, ValueMetaData context, boolean mustExist) {    	
             return classForName(name,
                 context.getFieldMetaData().getDefiningMetaData(),
-                context.getFieldMetaData().getDeclaringType(), context, loader, mustExist);
+                context.getFieldMetaData().getDeclaringType(), context, mustExist);
         }
 
     /**
@@ -228,7 +227,7 @@ public class JavaTypes {
      */
     private static Class<?> classForName(String name, ClassMetaData meta,
             Class<?> dec, ValueMetaData vmd, ClassLoader loader) {
-    	return classForName(name, meta, dec, vmd,  loader, true);
+    	return classForName(name, meta, dec, vmd,  true);
     }
 
     /**
@@ -236,7 +235,7 @@ public class JavaTypes {
      * when parsing metadata.
      */
     private static Class<?> classForName(String name, ClassMetaData meta, Class<?> dec, ValueMetaData vmd, 
-        ClassLoader loader, boolean mustExist) {
+        boolean mustExist) {
         // special case for PersistenceCapable and Object
         if ("PersistenceCapable".equals(name)
             || "javax.jdo.PersistenceCapable".equals(name)) // backwards compatibility
@@ -246,9 +245,7 @@ public class JavaTypes {
 
         MetaDataRepository rep = meta.getRepository();
         boolean runtime = (rep.getValidate() & MetaDataRepository.VALIDATE_RUNTIME) != 0;
-        if (loader == null)
-            loader = rep.getConfiguration().getClassResolverInstance().
-                getClassLoader(dec, meta.getEnvClassLoader());
+        ClassLoader loader = rep.getConfiguration().getClassLoader();
 
         // try the owner's package
         String pkg = Strings.getPackageName(dec);
@@ -263,8 +260,7 @@ public class JavaTypes {
         //load the class, check with the ClassResolver to get a loader
         //and use it to attempt to load the class. 
         if (cls == null  && !mustExist){
-            loader = rep.getConfiguration().getClassResolverInstance().
-            getClassLoader(dec, meta.getEnvClassLoader());
+            loader = rep.getConfiguration().getClassLoader();
             cls = CFMetaDataParser.classForName(name, pkg, runtime, loader);
         }         	
         //OJ-758 end  

Modified: openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/meta/MetaDataFactory.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/meta/MetaDataFactory.java?rev=1190716&r1=1190715&r2=1190716&view=diff
==============================================================================
--- openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/meta/MetaDataFactory.java (original)
+++ openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/meta/MetaDataFactory.java Sat Oct 29 00:44:11 2011
@@ -75,7 +75,7 @@ public interface MetaDataFactory
      * {@link MetaDataModes#MODE_META MODE_META}, so long as
      * the <code>strict</code> property hasn't been set
      */
-    public void load(Class<?> cls, int mode, ClassLoader envLoader);
+    public void load(Class<?> cls, int mode);
 
     /**
      * Store the given metadata.
@@ -95,7 +95,7 @@ public interface MetaDataFactory
      *
      * @return false if any metadata could not be dropped
      */
-    public boolean drop(Class<?>[] cls, int mode, ClassLoader envLoader);
+    public boolean drop(Class<?>[] cls, int mode);
 
     /**
      * Return the metadata defaults for this factory.
@@ -112,19 +112,17 @@ public interface MetaDataFactory
      * @see MetaDataRepository#getPersistentTypeNames
      * @see MetaDataRepository#loadPersistentTypes
      */
-    public Set<String> getPersistentTypeNames(boolean devpath, 
-    		ClassLoader envLoader);
+    public Set<String> getPersistentTypeNames(boolean devpath);
 
     /**
      * Return the type defining the given query name, if any.
      */
-    public Class<?> getQueryScope(String queryName, ClassLoader loader);
+    public Class<?> getQueryScope(String queryName);
 
     /**
      * Return the type defining the given result set mapping name, if any.
      */
-    public Class<?> getResultSetMappingScope(String resultSetMappingName,
-        ClassLoader loader);
+    public Class<?> getResultSetMappingScope(String resultSetMappingName);
     
     /**
      * Return a properly-configured class arg parser for our expected

Modified: openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/meta/MetaDataRepository.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/meta/MetaDataRepository.java?rev=1190716&r1=1190715&r2=1190716&view=diff
==============================================================================
--- openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/meta/MetaDataRepository.java (original)
+++ openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/meta/MetaDataRepository.java Sat Oct 29 00:44:11 2011
@@ -313,21 +313,7 @@ public class MetaDataRepository implemen
         }
 
 
-        MultiClassLoader multi = AccessController.doPrivileged(J2DoPrivHelper.newMultiClassLoaderAction());
-        multi.addClassLoader(AccessController.doPrivileged(J2DoPrivHelper.getContextClassLoaderAction()));
-        multi.addClassLoader(AccessController.doPrivileged(J2DoPrivHelper
-            .getClassLoaderAction(MetaDataRepository.class)));
-        // If a ClassLoader was passed into Persistence.createContainerEntityManagerFactory on the PersistenceUnitInfo
-        // we need to add that loader to the chain of classloaders
-        ClassResolver resolver = _conf.getClassResolverInstance();
-        if (resolver != null) {
-            ClassLoader cl = resolver.getClassLoader(null, null);
-            if (cl != null) {
-                multi.addClassLoader(cl);
-            }
-        }
-
-        Set<String> classes = getPersistentTypeNames(false, multi);
+        Set<String> classes = getPersistentTypeNames(false);
         if (classes == null || classes.size() == 0) {
             throw new MetaDataException(_loc.get("repos-initializeEager-none"));
         }
@@ -338,15 +324,15 @@ public class MetaDataRepository implemen
         List<Class<?>> loaded = new ArrayList<Class<?>>();
         for (String c : classes) {
             try {
-                Class<?> cls = AccessController.doPrivileged((J2DoPrivHelper.getForNameAction(c, true, multi)));
+                Class<?> cls = Class.forName(c, true, _conf.getClassLoader());
                 loaded.add(cls);
                 // This call may be unnecessary?
-                _factory.load(cls, MODE_ALL, multi);
-            } catch (PrivilegedActionException pae) {
+                _factory.load(cls, MODE_ALL);
+            } catch (Exception pae) {
                 throw new MetaDataException(_loc.get("repos-initializeEager-error"), pae);
             }
         }
-        resolveAll(multi);
+        resolveAll();
         
         // Preload XML MetaData
         for (Class<?> cls : loaded) {
@@ -362,7 +348,7 @@ public class MetaDataRepository implemen
         // Hook in this class as a listener and process registered classes list to populate _aliases
         // list.
         PCRegistry.addRegisterClassListener(this);
-        processRegisteredClasses(multi);
+        processRegisteredClasses();
         _locking = false;
         _preloadComplete = true;
     }
@@ -378,17 +364,17 @@ public class MetaDataRepository implemen
      * @param mustExist
      *            if true, throws a {@link MetaDataException} if no metadata is found
      */
-    public ClassMetaData getMetaData(Class<?> cls, ClassLoader envLoader, boolean mustExist) {
+    public ClassMetaData getMetaData(Class<?> cls, boolean mustExist) {
         if (_locking) {
             synchronized(this){
-                return getMetaDataInternal(cls, envLoader, mustExist);    
+                return getMetaDataInternal(cls, mustExist);    
             }
         } else {
-            return getMetaDataInternal(cls, envLoader, mustExist);
+            return getMetaDataInternal(cls, mustExist);
         }
     }
 
-    private ClassMetaData getMetaDataInternal(Class<?> cls, ClassLoader envLoader, boolean mustExist) {
+    private ClassMetaData getMetaDataInternal(Class<?> cls, boolean mustExist) {
             if (cls != null && DynamicPersistenceCapable.class.isAssignableFrom(cls))
                 cls = cls.getSuperclass();
 
@@ -397,12 +383,12 @@ public class MetaDataRepository implemen
             if (cls != null && _implGen != null && _implGen.isImplType(cls))
                 cls = _implGen.toManagedInterface(cls);
 
-            ClassMetaData meta = getMetaDataInternal(cls, envLoader);
+            ClassMetaData meta = getMetaDataInternal(cls);
             if (meta == null && mustExist) {
                 if (cls != null && !ImplHelper.isManagedType(_conf, cls))
                     throw new MetaDataException(_loc.get("no-meta-notpc", cls)).setFatal(false);
 
-                Set<String> pcNames = getPersistentTypeNames(false, envLoader);
+                Set<String> pcNames = getPersistentTypeNames(false);
                 if (pcNames != null && pcNames.size() > 0)
                     throw new MetaDataException(_loc.get("no-meta-types", cls, pcNames));
 
@@ -423,28 +409,22 @@ public class MetaDataRepository implemen
      *            if true, throws a {@link MetaDataException} if no metadata is found
      * @see ClassMetaData#getTypeAlias
      */
-    public ClassMetaData getMetaData(String alias, ClassLoader envLoader, boolean mustExist) {
+    public ClassMetaData getMetaData(String alias, boolean mustExist) {
         if (alias == null && mustExist)
             throw new MetaDataException(_loc.get("no-alias-meta", alias, _aliases));
         if (alias == null)
             return null;
 
         // check cache
-        processRegisteredClasses(envLoader);
+        processRegisteredClasses();
         List<Class<?>> classList = _aliases.get(alias);
 
-        // multiple classes may have been defined with the same alias: we
-        // will filter by checking against the current list of the
-        // persistent types and filter based on which classes are loadable
-        // via the current environment's ClassLoader
-        Set<String> pcNames = getPersistentTypeNames(false, envLoader);
+        Set<String> pcNames = getPersistentTypeNames(false);
         Class<?> cls = null;
         for (int i = 0; classList != null && i < classList.size(); i++) {
             Class<?> c = classList.get(i);
             try {
-                // re-load the class in the current environment loader so
-                // that we can handle redeployment of the same class name
-                Class<?> nc = Class.forName(c.getName(), false, envLoader);
+                Class<?> nc = Class.forName(c.getName(), false, _conf.getClassLoader());
 
                 // if we have specified a list of persistent clases,
                 // also check to ensure that the class is in that list
@@ -455,14 +435,10 @@ public class MetaDataRepository implemen
                     break;
                 }
             } catch (Throwable t) {
-                // this happens when the class is not loadable by
-                // the environment class loader, so it was probably
-                // listed elsewhere; also ignore linkage failures and
-                // other class loading problems
             }
         }
         if (cls != null)
-            return getMetaData(cls, envLoader, mustExist);
+            return getMetaData(cls, mustExist);
 
         // maybe this is some type we've seen but just isn't valid
         if (_aliases.containsKey(alias)) {
@@ -527,7 +503,7 @@ public class MetaDataRepository implemen
     /**
      * Internal method to get the metadata for the given class, without resolving it.
      */
-    private ClassMetaData getMetaDataInternal(Class<?> cls, ClassLoader envLoader) {
+    private ClassMetaData getMetaDataInternal(Class<?> cls) {
         if (cls == null)
             return null;
 
@@ -541,7 +517,7 @@ public class MetaDataRepository implemen
         // dev time so that user can manipulate persistent classes he's writing
         // before adding them to the list
         if ((_validate & VALIDATE_RUNTIME) != 0) {
-            Set<String> pcNames = getPersistentTypeNames(false, envLoader);
+            Set<String> pcNames = getPersistentTypeNames(false);
             if (pcNames != null && !pcNames.contains(cls.getName()))
                 return meta;
         }
@@ -577,7 +553,7 @@ public class MetaDataRepository implemen
         if (mode != MODE_NONE) {
             if (_log.isTraceEnabled())
                 _log.trace(_loc.get("load-cls", cls, toModeString(mode)));
-            _factory.load(cls, mode, envLoader);
+            _factory.load(cls, mode);
         }
 
         // check cache again
@@ -684,7 +660,7 @@ public class MetaDataRepository implemen
             Class<?> sup = meta.getDescribedType().getSuperclass();
             ClassMetaData supMeta;
             while (sup != null && sup != Object.class) {
-                supMeta = getMetaData(sup, meta.getEnvClassLoader(), false);
+                supMeta = getMetaData(sup, false);
                 if (supMeta != null) {
                     meta.setPCSuperclass(sup);
                     meta.setPCSuperclassMetaData(supMeta);
@@ -695,7 +671,7 @@ public class MetaDataRepository implemen
             if (meta.getDescribedType().isInterface()) {
                 Class<?>[] sups = meta.getDescribedType().getInterfaces();
                 for (int i = 0; i < sups.length; i++) {
-                    supMeta = getMetaData(sups[i], meta.getEnvClassLoader(), false);
+                    supMeta = getMetaData(sups[i], false);
                     if (supMeta != null) {
                         meta.setPCSuperclass(sup);
                         meta.setPCSuperclassMetaData(supMeta);
@@ -711,7 +687,7 @@ public class MetaDataRepository implemen
         FieldMetaData[] fmds = meta.getDeclaredFields();
         for (int i = 0; i < fmds.length; i++)
             if (fmds[i].isPrimaryKey())
-                getMetaData(fmds[i].getDeclaredType(), meta.getEnvClassLoader(), false);
+                getMetaData(fmds[i].getDeclaredType(), false);
 
         // resolve metadata; if we're not in the process of resolving
         // others, this will return the set of interrelated metas that
@@ -737,7 +713,7 @@ public class MetaDataRepository implemen
                 if (_log.isTraceEnabled())
                     _log.trace(_loc.get("load-mapping", meta, toModeString(mode)));
                 try {
-                    _factory.load(meta.getDescribedType(), mode, meta.getEnvClassLoader());
+                    _factory.load(meta.getDescribedType(), mode);
                 } catch (RuntimeException re) {
                     removeMetaData(meta);
                     _errs.add(re);
@@ -861,7 +837,7 @@ public class MetaDataRepository implemen
             ClassMetaData[] metas = (ClassMetaData[]) _metas.values().toArray(new ClassMetaData[_metas.size()]);
             for (int i = 0; i < metas.length; i++)
                 if (metas[i] != null)
-                    getMetaData(metas[i].getDescribedType(), metas[i].getEnvClassLoader(), true);
+                    getMetaData(metas[i].getDescribedType(), true);
 
             List<ClassMetaData> resolved = new ArrayList<ClassMetaData>(_metas.size());
             for (ClassMetaData meta : _metas.values()) {
@@ -1149,7 +1125,7 @@ public class MetaDataRepository implemen
      * @param mustExist
      *            if true, throws a {@link MetaDataException} if no metadata is found
      */
-    public ClassMetaData getMetaData(Object oid, ClassLoader envLoader, boolean mustExist) {
+    public ClassMetaData getMetaData(Object oid, boolean mustExist) {
         if (oid == null && mustExist)
             throw new MetaDataException(_loc.get("no-oid-meta", oid, "?", _oids.toString()));
         if (oid == null)
@@ -1157,14 +1133,14 @@ public class MetaDataRepository implemen
 
         if (oid instanceof OpenJPAId) {
             Class<?> cls = ((OpenJPAId) oid).getType();
-            return getMetaData(cls, envLoader, mustExist);
+            return getMetaData(cls, mustExist);
         }
 
         // check cache
-        processRegisteredClasses(envLoader);
+        processRegisteredClasses();
         Class<?> cls = _oids.get(oid.getClass());
         if (cls != null)
-            return getMetaData(cls, envLoader, mustExist);
+            return getMetaData(cls, mustExist);
 
         // maybe this is some type we've seen but just isn't valid
         if (_oids.containsKey(oid.getClass())) {
@@ -1176,10 +1152,10 @@ public class MetaDataRepository implemen
         // if still not match, register any classes that look similar to the
         // oid class and check again
         resolveIdentityClass(oid);
-        if (processRegisteredClasses(envLoader).length > 0) {
+        if (processRegisteredClasses().length > 0) {
             cls = _oids.get(oid.getClass());
             if (cls != null)
-                return getMetaData(cls, envLoader, mustExist);
+                return getMetaData(cls, mustExist);
         }
 
         // record that this is an invalid type
@@ -1242,23 +1218,23 @@ public class MetaDataRepository implemen
      * @param mustExist
      *            if true, throws a {@link MetaDataException} if no metadata is found
      */
-    public ClassMetaData[] getImplementorMetaDatas(Class<?> cls, ClassLoader envLoader, boolean mustExist) {
+    public ClassMetaData[] getImplementorMetaDatas(Class<?> cls, boolean mustExist) {
         if (cls == null && mustExist)
             throw new MetaDataException(_loc.get("no-meta", cls));
         if (cls == null)
             return EMPTY_METAS;
 
         // get impls of given interface / abstract class
-        loadRegisteredClassMetaData(envLoader);
+        loadRegisteredClassMetaData();
         Collection<Class<?>> vals = _impls.get(cls);
         ClassMetaData[] mapped = null;
         if (vals != null) {
             if (_locking) {
                 synchronized (vals) {
-                    mapped = getImplementorMetaDatasInternal(vals, envLoader, mustExist);
+                    mapped = getImplementorMetaDatasInternal(vals, mustExist);
                 }
             } else {
-                mapped = getImplementorMetaDatasInternal(vals, envLoader, mustExist);
+                mapped = getImplementorMetaDatasInternal(vals, mustExist);
             }
         }
 
@@ -1269,12 +1245,11 @@ public class MetaDataRepository implemen
         return mapped;
     }
 
-    private ClassMetaData[] getImplementorMetaDatasInternal(Collection<Class<?>> classes, ClassLoader envLoader,
-        boolean mustExist) {
+    private ClassMetaData[] getImplementorMetaDatasInternal(Collection<Class<?>> classes, boolean mustExist) {
         Collection<ClassMetaData> mapped = new ArrayList<ClassMetaData>(classes.size());
         ClassMetaData meta = null;
         for (Class<?> c : classes) {
-            meta = getMetaData(c, envLoader, true);
+            meta = getMetaData(c, true);
             if (meta.isMapped() || meta.getMappedPCSubclassMetaDatas().length > 0) {
                 mapped.add(meta);
             }
@@ -1457,18 +1432,18 @@ public class MetaDataRepository implemen
      * @param envLoader
      *            the class loader to use, or null for default
      */
-    public Set<String> getPersistentTypeNames(boolean devpath, ClassLoader envLoader) {
+    public Set<String> getPersistentTypeNames(boolean devpath) {
         if (_locking) {
             synchronized (this) {
-                return getPersistentTypeNamesInternal(devpath, envLoader);
+                return getPersistentTypeNamesInternal(devpath);
             }
         } else {
-            return getPersistentTypeNamesInternal(devpath, envLoader);
+            return getPersistentTypeNamesInternal(devpath);
         }
     }
 
-    private Set<String> getPersistentTypeNamesInternal(boolean devpath, ClassLoader envLoader) {
-        return _factory.getPersistentTypeNames(devpath, envLoader);
+    private Set<String> getPersistentTypeNamesInternal(boolean devpath) {
+        return _factory.getPersistentTypeNames(devpath);
     }
     /**
      * Load the persistent classes named in configuration.
@@ -1482,8 +1457,8 @@ public class MetaDataRepository implemen
      * @param envLoader the class loader to use, or null for default
      * @return the loaded classes, or empty collection if none
      */
-    public Collection<Class<?>> loadPersistentTypes(boolean devpath, ClassLoader envLoader) {
-        return loadPersistentTypes(devpath, envLoader, false);
+    public Collection<Class<?>> loadPersistentTypes(boolean devpath) {
+        return loadPersistentTypes(devpath, false);
     }
     /**
      * Load the persistent classes named in configuration. This ensures that all subclasses and
@@ -1500,19 +1475,18 @@ public class MetaDataRepository implemen
      *            raise an exception.
      * @return the loaded classes, or empty collection if none
      */
-    public Collection<Class<?>> loadPersistentTypes(boolean devpath, ClassLoader envLoader, boolean mustExist) {
+    public Collection<Class<?>> loadPersistentTypes(boolean devpath, boolean mustExist) {
         if (_locking) {
             synchronized (this) {
-                return loadPersistentTypesInternal(devpath, envLoader, mustExist);
+                return loadPersistentTypesInternal(devpath, mustExist);
             }
         } else {
-            return loadPersistentTypesInternal(devpath, envLoader, mustExist);
+            return loadPersistentTypesInternal(devpath, mustExist);
         }
     }
 
-    private Collection<Class<?>> loadPersistentTypesInternal(boolean devpath, ClassLoader envLoader, 
-        boolean mustExist) {
-            Set<String> names = getPersistentTypeNames(devpath, envLoader);
+    private Collection<Class<?>> loadPersistentTypesInternal(boolean devpath, boolean mustExist) {
+            Set<String> names = getPersistentTypeNames(devpath);
             if (names == null || names.isEmpty()) {
                 if (!mustExist)
                     return Collections.emptyList();
@@ -1521,11 +1495,10 @@ public class MetaDataRepository implemen
             }
 
             // attempt to load classes so that they get processed
-            ClassLoader clsLoader = _conf.getClassResolverInstance().getClassLoader(getClass(), envLoader);
             List<Class<?>> classes = new ArrayList<Class<?>>(names.size());
             Class<?> cls;
             for (String className : names) {
-                cls = classForName(className, clsLoader);
+                cls = classForName(className);
                 if (_factory.isMetaClass(cls)) {
                     setMetaModel(cls);
                     continue;
@@ -1536,7 +1509,7 @@ public class MetaDataRepository implemen
                     // if the class is an interface, load its metadata to kick
                     // off the impl generator
                     if (cls.isInterface())
-                        getMetaData(cls, clsLoader, false);
+                        getMetaData(cls, false);
                 } else if (cls == null && mustExist) {
                     throw new MetaDataException(_loc.get("eager-class-not-found", className));
                 }
@@ -1547,7 +1520,8 @@ public class MetaDataRepository implemen
     /**
      * Return the class for the given name, or null if not loadable.
      */
-    private Class<?> classForName(String name, ClassLoader loader) {
+    private Class<?> classForName(String name) {
+    	ClassLoader loader = _conf.getClassLoader();
         try {
             return Class.forName(name, true, loader);
         } catch (Exception e) {
@@ -1603,11 +1577,11 @@ public class MetaDataRepository implemen
     /**
      * Parses the metadata for all registered classes.
      */
-    private void loadRegisteredClassMetaData(ClassLoader envLoader) {
-        Class<?>[] reg = processRegisteredClasses(envLoader);
+    private void loadRegisteredClassMetaData() {
+        Class<?>[] reg = processRegisteredClasses();
         for (int i = 0; i < reg.length; i++) {
             try {
-                getMetaData(reg[i], envLoader, false);
+                getMetaData(reg[i], false);
             } catch (MetaDataException me) {
                 if (_log.isWarnEnabled())
                     _log.warn(me);
@@ -1618,7 +1592,7 @@ public class MetaDataRepository implemen
     /**
      * Updates our datastructures with the latest registered classes.
      */
-    Class<?>[] processRegisteredClasses(ClassLoader envLoader) {
+    Class<?>[] processRegisteredClasses() {
         if (_registered.isEmpty())
             return EMPTY_CLASSES;
 
@@ -1630,7 +1604,7 @@ public class MetaDataRepository implemen
             _registered.clear();
         }
 
-        Collection<String> pcNames = getPersistentTypeNames(false, envLoader);
+        Collection<String> pcNames = getPersistentTypeNames(false);
         Collection<Class<?>> failed = null;
         for (int i = 0; i < reg.length; i++) {
             // don't process types that aren't listed by the user; may belong
@@ -1913,30 +1887,29 @@ public class MetaDataRepository implemen
     /**
      * Return query metadata for the given class, name, and classloader.
      */
-    public QueryMetaData getQueryMetaData(Class<?> cls, String name, ClassLoader envLoader, boolean mustExist) {
+    public QueryMetaData getQueryMetaData(Class<?> cls, String name, boolean mustExist) {
         if (_locking) {
             synchronized (this) {
-                return getQueryMetaDataInternal(cls, name, envLoader, mustExist);
+                return getQueryMetaDataInternal(cls, name, mustExist);
             }
         } else {
-            return getQueryMetaDataInternal(cls, name, envLoader, mustExist);
+            return getQueryMetaDataInternal(cls, name, mustExist);
         }
     }
 
-    private QueryMetaData getQueryMetaDataInternal(Class<?> cls, String name, ClassLoader envLoader, 
-        boolean mustExist) {
-            QueryMetaData meta = getQueryMetaDataInternal(cls, name, envLoader);
+    private QueryMetaData getQueryMetaDataInternal(Class<?> cls, String name, boolean mustExist) {
+            QueryMetaData meta = getQueryMetaDataInternal(cls, name);
             if (meta == null) {
                 // load all the metadatas for all the known classes so that
                 // query names are seen and registered
-                resolveAll(envLoader);
-                meta = getQueryMetaDataInternal(cls, name, envLoader);
+                resolveAll();
+                meta = getQueryMetaDataInternal(cls, name);
             }
 
             if (meta == null && mustExist) {
                 if (cls == null) {
-                    throw new MetaDataException(_loc.get("no-named-query-null-class", getPersistentTypeNames(false,
-                        envLoader), name));
+                    throw new MetaDataException(_loc.get("no-named-query-null-class", 
+                    		getPersistentTypeNames(false), name));
                 } else {
                     throw new MetaDataException(_loc.get("no-named-query", cls, name));
                 }
@@ -1948,17 +1921,17 @@ public class MetaDataRepository implemen
     /**
      * Resolve all known metadata classes.
      */
-    private void resolveAll(ClassLoader envLoader) {
-        Collection<Class<?>> types = loadPersistentTypes(false, envLoader);
+    private void resolveAll() {
+        Collection<Class<?>> types = loadPersistentTypes(false);
         for (Class<?> c : types) {
-            getMetaData(c, envLoader, false);
+            getMetaData(c, false);
         }
     }
 
     /**
      * Return query metadata for the given class, name, and classloader.
      */
-    private QueryMetaData getQueryMetaDataInternal(Class<?> cls, String name, ClassLoader envLoader) {
+    private QueryMetaData getQueryMetaDataInternal(Class<?> cls, String name) {
         if (name == null)
             return null;
         QueryMetaData qm = null;
@@ -1974,7 +1947,7 @@ public class MetaDataRepository implemen
             return qm;
 
         // get metadata for class, which will find queries in metadata file
-        if (cls != null && getMetaData(cls, envLoader, false) != null) {
+        if (cls != null && getMetaData(cls, false) != null) {
             qm = _queries.get(key);
             if (qm != null)
                 return qm;
@@ -1984,10 +1957,10 @@ public class MetaDataRepository implemen
 
         // see if factory can figure out a scope for this query
         if (cls == null)
-            cls = _factory.getQueryScope(name, envLoader);
+            cls = _factory.getQueryScope(name);
 
         // not in cache; load
-        _factory.load(cls, MODE_QUERY, envLoader);
+        _factory.load(cls, MODE_QUERY);
         return _queries.get(key);
     }
 
@@ -2116,18 +2089,18 @@ public class MetaDataRepository implemen
     /**
      * Return sequence metadata for the given name and classloader.
      */
-    public SequenceMetaData getSequenceMetaData(String name, ClassLoader envLoader, boolean mustExist) {
+    public SequenceMetaData getSequenceMetaData(String name, boolean mustExist) {
         if (_locking) {
             synchronized (this) {
-                return getSequenceMetaDataInternal(name, envLoader, mustExist);
+                return getSequenceMetaDataInternal(name, mustExist);
             }
         } else {
-            return getSequenceMetaDataInternal(name, envLoader, mustExist);
+            return getSequenceMetaDataInternal(name, mustExist);
         }
     }
 
-    private SequenceMetaData getSequenceMetaDataInternal(String name, ClassLoader envLoader, boolean mustExist) {
-            SequenceMetaData meta = getSequenceMetaDataInternal(name, envLoader);
+    private SequenceMetaData getSequenceMetaDataInternal(String name, boolean mustExist) {
+            SequenceMetaData meta = getSequenceMetaDataInternal(name);
             if (meta == null && SequenceMetaData.NAME_SYSTEM.equals(name)) {
                 if (_sysSeq == null)
                     _sysSeq = newSequenceMetaData(name);
@@ -2146,7 +2119,7 @@ public class MetaDataRepository implemen
         // try with given name
         MetaDataException e = null;
         try {
-            SequenceMetaData seq = getSequenceMetaData(name, context.getEnvClassLoader(), mustExist);
+            SequenceMetaData seq = getSequenceMetaData(name, mustExist);
             if (seq != null)
                 return seq;
         } catch (MetaDataException mde) {
@@ -2163,7 +2136,7 @@ public class MetaDataRepository implemen
         // try with qualified name
         name = Strings.getPackageName(context.getDescribedType()) + "." + name;
         try {
-            return getSequenceMetaData(name, context.getEnvClassLoader(), mustExist);
+            return getSequenceMetaData(name, mustExist);
         } catch (MetaDataException mde) {
             // throw original exception
             if (e != null)
@@ -2175,7 +2148,7 @@ public class MetaDataRepository implemen
     /**
      * Return sequence metadata for the given name and classloader.
      */
-    private SequenceMetaData getSequenceMetaDataInternal(String name, ClassLoader envLoader) {
+    private SequenceMetaData getSequenceMetaDataInternal(String name) {
         if (name == null)
             return null;
 
@@ -2184,7 +2157,7 @@ public class MetaDataRepository implemen
         if (meta == null) {
             // load metadata for registered classes to hopefully find sequence
             // definition
-            loadRegisteredClassMetaData(envLoader);
+            loadRegisteredClassMetaData();
             meta = _seqs.get(name);
         }
         return meta;

Modified: openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/meta/MetaDataTool.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/meta/MetaDataTool.java?rev=1190716&r1=1190715&r2=1190716&view=diff
==============================================================================
--- openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/meta/MetaDataTool.java (original)
+++ openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/meta/MetaDataTool.java Sat Oct 29 00:44:11 2011
@@ -188,7 +188,7 @@ public class MetaDataTool
         try {
             if (_drop != null && !_drop.isEmpty()
                 && !mdf.drop((Class[]) _drop.toArray(new Class[_drop.size()]),
-                MODE_META | MODE_MAPPING | MODE_QUERY, null)) {
+                MODE_META | MODE_MAPPING | MODE_QUERY)) {
                 Log log = _conf.getLog(OpenJPAConfiguration.LOG_METADATA);
                 if (log.isWarnEnabled())
                     log.warn(_loc.get("bad-drop", _drop));
@@ -285,8 +285,7 @@ public class MetaDataTool
         }
 
         Configurations.populateConfiguration(conf, opts);
-        ClassLoader loader = conf.getClassResolverInstance().
-            getClassLoader(MetaDataTool.class, null);
+        ClassLoader loader = conf.getClassLoader();
 
         if (fileName != null)
             flags.file = Files.getFile(fileName, loader);
@@ -320,8 +319,8 @@ public class MetaDataTool
         Log log = conf.getLog(OpenJPAConfiguration.LOG_TOOL);
         ClassArgParser cap = conf.getMetaDataRepositoryInstance().
             getMetaDataFactory().newClassArgParser();
-        cap.setClassLoader(loader);
-        Class[] classes;
+        cap.setClassLoader(conf.getClassLoader());
+        Class<?>[] classes;
         for (int i = 0; i < args.length; i++) {
             classes = cap.parseTypes(args[i]);
             for (int j = 0; j < classes.length; j++) {

Modified: openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/meta/NoneMetaDataFactory.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/meta/NoneMetaDataFactory.java?rev=1190716&r1=1190715&r2=1190716&view=diff
==============================================================================
--- openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/meta/NoneMetaDataFactory.java (original)
+++ openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/meta/NoneMetaDataFactory.java Sat Oct 29 00:44:11 2011
@@ -55,7 +55,7 @@ public class NoneMetaDataFactory
     public void setStrict(boolean strict) {
     }
 
-    public void load(Class cls, int mode, ClassLoader envLoader) {
+    public void load(Class cls, int mode) {
     }
 
     public boolean store(ClassMetaData[] metas, QueryMetaData[] queries,
@@ -63,7 +63,7 @@ public class NoneMetaDataFactory
         return false;
     }
 
-    public boolean drop(Class[] cls, int mode, ClassLoader envLoader) {
+    public boolean drop(Class[] cls, int mode) {
         return false;
     }
 
@@ -71,17 +71,15 @@ public class NoneMetaDataFactory
         return this;
     }
 
-    public Set getPersistentTypeNames(boolean classpath,
-        ClassLoader envLoader) {
+    public Set getPersistentTypeNames(boolean classpath) {
         return null;
     }
 
-    public Class getQueryScope(String queryName, ClassLoader loader) {
+    public Class getQueryScope(String queryName) {
         return null;
     }
 
-    public Class getResultSetMappingScope(String resultSetMappingName,
-        ClassLoader loader) {
+    public Class getResultSetMappingScope(String resultSetMappingName) {
         return null;
     }
 

Modified: openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/meta/SequenceMetaData.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/meta/SequenceMetaData.java?rev=1190716&r1=1190715&r2=1190716&view=diff
==============================================================================
--- openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/meta/SequenceMetaData.java (original)
+++ openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/meta/SequenceMetaData.java Sat Oct 29 00:44:11 2011
@@ -70,8 +70,7 @@ public class SequenceMetaData
     private static final String PROP_SCHEMA = "Schema";
     private static final String PROP_CATALOG = "Catalog";
 
-    private static final Localizer _loc = Localizer.forPackage
-        (SequenceMetaData.class);
+    private static final Localizer _loc = Localizer.forPackage(SequenceMetaData.class);
 
     private MetaDataRepository _repos;
     private SequenceFactory _factory = null;
@@ -258,27 +257,25 @@ public class SequenceMetaData
     /**
      * Return the initialized sequence instance.
      */
-    public synchronized Seq getInstance(ClassLoader envLoader) {
+    public synchronized Seq getInstance() {
         if (_instance == null)
-            _instance = instantiate(envLoader);
+            _instance = instantiate();
         return _instance;
     }
 
     /**
      * Create a new uninitialized instance of this sequence.
      */
-    protected Seq instantiate(ClassLoader envLoader) {
+    protected Seq instantiate() {
         if (NAME_SYSTEM.equals(_name))
             return _repos.getConfiguration().getSequenceInstance();
 
         try {
-            PluginValue plugin = newPluginValue("sequence-plugin");
+            PluginValue<Seq> plugin = newPluginValue("sequence-plugin");
             plugin.setString(_plugin);
             String clsName = plugin.getClassName();
 
-            Class cls = Class.forName(clsName, true,
-                AccessController.doPrivileged(
-                    J2DoPrivHelper.getClassLoaderAction(Seq.class)));
+            Class cls = Class.forName(clsName, true, _repos.getConfiguration().getClassLoader());
             StringBuilder props = new StringBuilder();
             if (plugin.getProperties() != null)
                 props.append(plugin.getProperties());
@@ -288,10 +285,8 @@ public class SequenceMetaData
             // interface or a factory class
             Seq seq;
             if (Seq.class.isAssignableFrom(cls)) {
-                seq = (Seq) AccessController.doPrivileged(
-                    J2DoPrivHelper.newInstanceAction(cls));
-                Configurations.configureInstance(seq,
-                    _repos.getConfiguration(), props.toString());
+                seq = (Seq) AccessController.doPrivileged(J2DoPrivHelper.newInstanceAction(cls));
+                Configurations.configureInstance(seq, _repos.getConfiguration(), props.toString());
                 if(_type != Seq.TYPE_DEFAULT)
                     seq.setType(_type);
             } else if (_factory != null)
@@ -336,7 +331,7 @@ public class SequenceMetaData
      * Create a new plugin value for sequences. Returns a standard
      * {@link SeqValue} by default.
      */
-    protected PluginValue newPluginValue(String property) {
+    protected PluginValue<Seq> newPluginValue(String property) {
         return new SeqValue(property);
     }
 

Modified: openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/meta/ValueMetaDataImpl.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/meta/ValueMetaDataImpl.java?rev=1190716&r1=1190715&r2=1190716&view=diff
==============================================================================
--- openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/meta/ValueMetaDataImpl.java (original)
+++ openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/meta/ValueMetaDataImpl.java Sat Oct 29 00:44:11 2011
@@ -106,8 +106,7 @@ public class ValueMetaDataImpl
             return getDeclaredTypeMetaData();
         if (_typeMeta == null && _code == JavaTypes.PC) {
             ClassMetaData meta = _owner.getDefiningMetaData();
-            _typeMeta = meta.getRepository().getMetaData(_type,
-                meta.getEnvClassLoader(), true);
+            _typeMeta = meta.getRepository().getMetaData(_type, true);
         }
         return _typeMeta;
     }
@@ -142,8 +141,7 @@ public class ValueMetaDataImpl
                 _decTypeMeta = getEmbeddedMetaData();
             else {
                 ClassMetaData meta = _owner.getDefiningMetaData();
-                _decTypeMeta = meta.getRepository().getMetaData(_decType,
-                    meta.getEnvClassLoader(), true);
+                _decTypeMeta = meta.getRepository().getMetaData(_decType, true);
             }
         }
         return _decTypeMeta;
@@ -298,8 +296,7 @@ public class ValueMetaDataImpl
         if (_mappedBy == MAPPED_BY_PK) {
             // use this instead of getting meta from element b/c that
             // requires element to be resolved
-            ClassMetaData meta = getRepository().getMetaData
-                (_owner.getElement().getType(), null, false);
+            ClassMetaData meta = getRepository().getMetaData(_owner.getElement().getType(), false);
             if (meta == null)
                 throw new MetaDataException(_loc.get("val-not-pc", _owner));
             if (meta.getPrimaryKeyFields().length != 1)
@@ -409,8 +406,7 @@ public class ValueMetaDataImpl
 
         // see if actual type is pc
         if (JavaTypes.maybePC(_code, _type)) {
-            _typeMeta = _owner.getRepository().getMetaData(_type,
-                _owner.getDefiningMetaData().getEnvClassLoader(), false);
+            _typeMeta = _owner.getRepository().getMetaData(_type, false);
             if (_typeMeta != null)
                 _code = JavaTypes.PC;
         }
@@ -446,8 +442,7 @@ public class ValueMetaDataImpl
      * Resolve the declared type.
      */
     private void resolveDeclaredType(Class type) {
-        ClassMetaData meta = _owner.getRepository().getMetaData(type,
-            _owner.getDefiningMetaData().getEnvClassLoader(), false);
+        ClassMetaData meta = _owner.getRepository().getMetaData(type, false);
         if (meta != null)
             _decCode = JavaTypes.PC;
         



Mime
View raw message