OPENJPA-14. Use the class's classloader in environments when service lookups should be looking in the OpenJPA distribution. This imposes the restriction that OpenJPA will only find services in the same classloader as the OpenJPA jars themselves, which is a much better restriction than requiring that the classes be in the thread's context classloader.

git-svn-id: https://svn.apache.org/repos/asf/incubator/openjpa/trunk@436694 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Patrick Linskey 2006-08-25 07:33:50 +00:00
parent 323fce145e
commit dcb47f0fe4
4 changed files with 5 additions and 4 deletions

View File

@ -36,7 +36,8 @@ public class ProductDerivations {
private static final ProductDerivation[] _derivations;
static {
Class[] pdcls = Services.getImplementorClasses(ProductDerivation.class);
Class[] pdcls = Services.getImplementorClasses(ProductDerivation.class,
ProductDerivations.class.getClassLoader());
List derivations = new ArrayList(pdcls.length);
for (int i = 0; i < pdcls.length; i++) {
try {

View File

@ -2617,7 +2617,7 @@ public class PCEnhancer {
if (_auxEnhancers == null) {
try {
Class[] classes = Services.getImplementorClasses
(AuxiliaryEnhancer.class);
(AuxiliaryEnhancer.class, getClass().getClassLoader());
_auxEnhancers = new AuxiliaryEnhancer[classes.length];
for (int i = 0; i < _auxEnhancers.length; i++)
_auxEnhancers[i] = (AuxiliaryEnhancer) classes[i].

View File

@ -34,7 +34,7 @@ public class QueryLanguages {
static {
// Load and cache all the query languages available in the system.
Class[] classes = Services.getImplementorClasses(
ExpressionParser.class);
ExpressionParser.class, QueryLanguages.class.getClassLoader());
for (int i = 0; i < classes.length; i++) {
ExpressionParser ep;
try {

View File

@ -42,7 +42,7 @@ import org.apache.openjpa.lib.util.Localizer;
* &lt;/mytask&rt;
* </code>
*
* The defailt configuration for the system will be used if the
* The default configuration for the system will be used if the
* <code>&lt;config&rt;</code> subtask is excluded.
*
* @nojavadoc