aries-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From timothyjw...@apache.org
Subject svn commit: r1748744 - in /aries/trunk/jpa/jpa-container/src/main/java/org/apache/aries/jpa/container/impl: PersistenceBundleTracker.java PersistenceProviderTracker.java
Date Thu, 16 Jun 2016 15:20:52 GMT
Author: timothyjward
Date: Thu Jun 16 15:20:52 2016
New Revision: 1748744

URL: http://svn.apache.org/viewvc?rev=1748744&view=rev
Log:
[ARIES-1575] Use the Persistence Bundle's context to get the Persistence Provider

Modified:
    aries/trunk/jpa/jpa-container/src/main/java/org/apache/aries/jpa/container/impl/PersistenceBundleTracker.java
    aries/trunk/jpa/jpa-container/src/main/java/org/apache/aries/jpa/container/impl/PersistenceProviderTracker.java

Modified: aries/trunk/jpa/jpa-container/src/main/java/org/apache/aries/jpa/container/impl/PersistenceBundleTracker.java
URL: http://svn.apache.org/viewvc/aries/trunk/jpa/jpa-container/src/main/java/org/apache/aries/jpa/container/impl/PersistenceBundleTracker.java?rev=1748744&r1=1748743&r2=1748744&view=diff
==============================================================================
--- aries/trunk/jpa/jpa-container/src/main/java/org/apache/aries/jpa/container/impl/PersistenceBundleTracker.java
(original)
+++ aries/trunk/jpa/jpa-container/src/main/java/org/apache/aries/jpa/container/impl/PersistenceBundleTracker.java
Thu Jun 16 15:20:52 2016
@@ -40,11 +40,11 @@ import org.slf4j.LoggerFactory;
 public class PersistenceBundleTracker implements BundleTrackerCustomizer<Bundle> {
     private static final Logger LOGGER = LoggerFactory.getLogger(PersistenceBundleTracker.class);
     private final Map<Bundle, Collection<PersistenceProviderTracker>> trackers;
-    private final BundleContext context;
+    private final BundleContext containerContext;
     private Map<Integer, String> typeMap;
 
     public PersistenceBundleTracker(BundleContext context) {
-        this.context = context;
+        this.containerContext = context;
         trackers = new HashMap<Bundle, Collection<PersistenceProviderTracker>>();
         this.typeMap = new HashMap<Integer, String>();
         this.typeMap.put(BundleEvent.INSTALLED, "INSTALLED");
@@ -102,7 +102,7 @@ public class PersistenceBundleTracker im
         LOGGER.info(String.format("Found persistence unit %s in bundle %s with provider %s.",
                                   punit.getPersistenceUnitName(), bundle.getSymbolicName(),
                                   punit.getPersistenceProviderClassName()));
-        PersistenceProviderTracker tracker = new PersistenceProviderTracker(context, punit);
+        PersistenceProviderTracker tracker = new PersistenceProviderTracker(containerContext,
punit);
         tracker.open();
         getTrackers(bundle).add(tracker);
     }

Modified: aries/trunk/jpa/jpa-container/src/main/java/org/apache/aries/jpa/container/impl/PersistenceProviderTracker.java
URL: http://svn.apache.org/viewvc/aries/trunk/jpa/jpa-container/src/main/java/org/apache/aries/jpa/container/impl/PersistenceProviderTracker.java?rev=1748744&r1=1748743&r2=1748744&view=diff
==============================================================================
--- aries/trunk/jpa/jpa-container/src/main/java/org/apache/aries/jpa/container/impl/PersistenceProviderTracker.java
(original)
+++ aries/trunk/jpa/jpa-container/src/main/java/org/apache/aries/jpa/container/impl/PersistenceProviderTracker.java
Thu Jun 16 15:20:52 2016
@@ -48,8 +48,8 @@ public class PersistenceProviderTracker
 
     private PersistenceUnit punit;
 
-    public PersistenceProviderTracker(BundleContext context, PersistenceUnit punit) {
-        super(context, createFilter(context, punit), null);
+    public PersistenceProviderTracker(BundleContext containerContext, PersistenceUnit punit)
{
+        super(containerContext, createFilter(containerContext, punit), null);
         this.punit = punit;
     }
 
@@ -80,7 +80,9 @@ public class PersistenceProviderTracker
         }
         StoredPerProvider stored = new StoredPerProvider();
         LOGGER.info("Found provider for " + punit.getPersistenceUnitName() + " " + punit.getPersistenceProviderClassName());
-        PersistenceProvider provider = context.getService(reference);
+        
+        // This get must happen using the persistence bundle's context to avoid ARIES-1575
+        PersistenceProvider provider = punit.getBundle().getBundleContext().getService(reference);
 
         createAndCloseDummyEMF(provider);
 



Mime
View raw message