aries-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cschnei...@apache.org
Subject svn commit: r1766052 - in /aries/trunk/jpa/jpa-container/src/main/java/org/apache/aries/jpa/container/impl: Activator.java PersistenceBundleTracker.java PersistenceProviderTracker.java
Date Fri, 21 Oct 2016 15:48:30 GMT
Author: cschneider
Date: Fri Oct 21 15:48:30 2016
New Revision: 1766052

URL: http://svn.apache.org/viewvc?rev=1766052&view=rev
Log:
[ARIES-1575] Use bundle context of persistence bundle for tracker

Modified:
    aries/trunk/jpa/jpa-container/src/main/java/org/apache/aries/jpa/container/impl/Activator.java
    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/Activator.java
URL: http://svn.apache.org/viewvc/aries/trunk/jpa/jpa-container/src/main/java/org/apache/aries/jpa/container/impl/Activator.java?rev=1766052&r1=1766051&r2=1766052&view=diff
==============================================================================
--- aries/trunk/jpa/jpa-container/src/main/java/org/apache/aries/jpa/container/impl/Activator.java
(original)
+++ aries/trunk/jpa/jpa-container/src/main/java/org/apache/aries/jpa/container/impl/Activator.java
Fri Oct 21 15:48:30 2016
@@ -38,7 +38,7 @@ public class Activator implements Bundle
     public void start(BundleContext context) throws Exception {
         registerWeavingHook(context, TransformerRegistrySingleton.get());
 
-        PersistenceBundleTracker customizer = new PersistenceBundleTracker(context);
+        PersistenceBundleTracker customizer = new PersistenceBundleTracker();
         persistenceBundleManager = new BundleTracker<Bundle>(context, Bundle.STARTING
| Bundle.ACTIVE, customizer);
         persistenceBundleManager.open();
     }

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=1766052&r1=1766051&r2=1766052&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
Fri Oct 21 15:48:30 2016
@@ -27,7 +27,6 @@ import java.util.Map;
 import org.apache.aries.jpa.container.parser.impl.PersistenceUnit;
 import org.apache.aries.jpa.container.parser.impl.PersistenceUnitParser;
 import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleContext;
 import org.osgi.framework.BundleEvent;
 import org.osgi.util.tracker.BundleTrackerCustomizer;
 import org.slf4j.Logger;
@@ -40,11 +39,9 @@ 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 containerContext;
     private Map<Integer, String> typeMap;
 
-    public PersistenceBundleTracker(BundleContext context) {
-        this.containerContext = context;
+    public PersistenceBundleTracker() {
         trackers = new HashMap<Bundle, Collection<PersistenceProviderTracker>>();
         this.typeMap = new HashMap<Integer, String>();
         this.typeMap.put(BundleEvent.INSTALLED, "INSTALLED");
@@ -102,7 +99,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(containerContext,
punit);
+        PersistenceProviderTracker tracker = new PersistenceProviderTracker(bundle.getBundleContext(),
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=1766052&r1=1766051&r2=1766052&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
Fri Oct 21 15:48:30 2016
@@ -81,8 +81,7 @@ public class PersistenceProviderTracker
         StoredPerProvider stored = new StoredPerProvider();
         LOGGER.info("Found provider for " + punit.getPersistenceUnitName() + " " + punit.getPersistenceProviderClassName());
         
-        // This get must happen using the persistence bundle's context to avoid ARIES-1575
-        PersistenceProvider provider = punit.getBundle().getBundleContext().getService(reference);
+        PersistenceProvider provider = context.getService(reference);
 
         createAndCloseDummyEMF(provider);
 



Mime
View raw message