tamaya-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From anat...@apache.org
Subject [08/11] incubator-tamaya-extensions git commit: TAMAYA-238: OSGI improvements and service loading.
Date Sun, 26 Feb 2017 23:05:21 GMT
TAMAYA-238: OSGI improvements and service loading.


Project: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/commit/364604b0
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/tree/364604b0
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/diff/364604b0

Branch: refs/heads/master
Commit: 364604b07504572705bf7e3f4dd310ecf70d0693
Parents: 01610f6
Author: anatole <anatole@apache.org>
Authored: Thu Feb 23 01:08:12 2017 +0100
Committer: anatole <anatole@apache.org>
Committed: Mon Feb 27 00:05:00 2017 +0100

----------------------------------------------------------------------
 .../tamaya/events/ConfigEventManager.java       | 51 ++++++++------------
 modules/formats/base/bnd.bnd                    |  4 +-
 modules/formats/json/bnd.bnd                    |  4 +-
 modules/formats/yaml/bnd.bnd                    |  4 +-
 modules/functions/bnd.bnd                       |  4 +-
 modules/injection/injection-api/bnd.bnd         |  5 +-
 modules/injection/standalone/bnd.bnd            |  4 +-
 modules/optional/bnd.bnd                        |  4 +-
 modules/resolver/bnd.bnd                        |  4 +-
 modules/resources/bnd.bnd                       |  4 +-
 modules/spi-support/bnd.bnd                     |  4 +-
 modules/spring/bnd.bnd                          |  4 +-
 12 files changed, 55 insertions(+), 41 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/364604b0/modules/events/src/main/java/org/apache/tamaya/events/ConfigEventManager.java
----------------------------------------------------------------------
diff --git a/modules/events/src/main/java/org/apache/tamaya/events/ConfigEventManager.java
b/modules/events/src/main/java/org/apache/tamaya/events/ConfigEventManager.java
index f6bd3da..b5cb0ae 100644
--- a/modules/events/src/main/java/org/apache/tamaya/events/ConfigEventManager.java
+++ b/modules/events/src/main/java/org/apache/tamaya/events/ConfigEventManager.java
@@ -32,8 +32,15 @@ public final class ConfigEventManager {
     /**
      * The backing SPI.
      */
-    private static final ConfigEventManagerSpi SPI = ServiceContextManager.getServiceContext()
-            .getService(ConfigEventManagerSpi.class);
+    private static final ConfigEventManagerSpi spi(){
+        ConfigEventManagerSpi spi = ServiceContextManager.getServiceContext()
+                .getService(ConfigEventManagerSpi.class);
+        if(spi==null){
+            throw new ConfigException("No SPI registered for " +
+                    ConfigEventManager.class.getName());
+        }
+        return spi;
+    }
 
     /**
      * Private singleton constructor.
@@ -46,11 +53,7 @@ public final class ConfigEventManager {
      * @param l the listener not null.
      */
     public static void addListener(ConfigEventListener l) {
-        if (SPI == null) {
-            throw new ConfigException("No SPI registered for " +
-                    ConfigEventManager.class.getName());
-        }
-        SPI.addListener(l);
+        spi().addListener(l);
     }
 
     /**
@@ -60,11 +63,7 @@ public final class ConfigEventManager {
      * @param eventType the event type to which this listener listens to.
      */
     public static <T extends ConfigEvent> void addListener(ConfigEventListener l, Class<T>
eventType) {
-        if (SPI == null) {
-            throw new ConfigException("No SPI registered for " +
-                    ConfigEventManager.class.getName());
-        }
-        SPI.addListener(l);
+        spi().addListener(l);
     }
 
     /**
@@ -73,11 +72,7 @@ public final class ConfigEventManager {
      * @param l the listener not null.
      */
     public static void removeListener(ConfigEventListener l) {
-        if (SPI == null) {
-            throw new ConfigException("No SPI registered for " +
-                    ConfigEventManager.class.getName());
-        }
-        SPI.removeListener(l);
+        spi().removeListener(l);
     }
 
     /**
@@ -88,11 +83,7 @@ public final class ConfigEventManager {
      * @param eventType the event type to which this listener listens to.
      */
     public static <T extends ConfigEvent> void removeListener(ConfigEventListener l,
Class<T> eventType) {
-        if (SPI == null) {
-            throw new ConfigException("No SPI registered for " +
-                    ConfigEventManager.class.getName());
-        }
-        SPI.removeListener(l);
+        spi().removeListener(l);
     }
 
     /**
@@ -103,7 +94,7 @@ public final class ConfigEventManager {
      */
     public static <T extends ConfigEvent>
         Collection<? extends ConfigEventListener> getListeners(Class<T> type)
{
-        return SPI.getListeners(type);
+        return spi().getListeners(type);
     }
 
     /**
@@ -114,7 +105,7 @@ public final class ConfigEventManager {
      */
     public static <T extends ConfigEvent>
     Collection<? extends ConfigEventListener> getListeners() {
-        return SPI.getListeners();
+        return spi().getListeners();
     }
 
     /**
@@ -124,7 +115,7 @@ public final class ConfigEventManager {
      * @param event the event, not null.
      */
     public static <T> void fireEvent(ConfigEvent<?> event) {
-        SPI.fireEvent(event);
+        spi().fireEvent(event);
     }
 
     /**
@@ -134,7 +125,7 @@ public final class ConfigEventManager {
      * @param event the event, not null.
      */
     public static <T> void fireEventAsynch(ConfigEvent<?> event) {
-        SPI.fireEventAsynch(event);
+        spi().fireEventAsynch(event);
     }
 
     /**
@@ -150,7 +141,7 @@ public final class ConfigEventManager {
      * @see #getChangeMonitoringPeriod()
      */
     public static void enableChangeMonitoring(boolean enable) {
-        SPI.enableChangeMonitor(enable);
+        spi().enableChangeMonitor(enable);
     }
 
     /**
@@ -160,7 +151,7 @@ public final class ConfigEventManager {
      * @see #enableChangeMonitoring(boolean)
      */
     public static boolean isChangeMonitoring() {
-        return SPI.isChangeMonitorActive();
+        return spi().isChangeMonitorActive();
     }
 
     /**
@@ -169,7 +160,7 @@ public final class ConfigEventManager {
      * @return the check period in ms.
      */
     public static long getChangeMonitoringPeriod(){
-        return SPI.getChangeMonitoringPeriod();
+        return spi().getChangeMonitoringPeriod();
     }
 
     /**
@@ -180,7 +171,7 @@ public final class ConfigEventManager {
      * @see #isChangeMonitoring()
      */
     public static void setChangeMonitoringPeriod(long millis){
-        SPI.setChangeMonitoringPeriod(millis);
+        spi().setChangeMonitoringPeriod(millis);
     }
 
 }

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/364604b0/modules/formats/base/bnd.bnd
----------------------------------------------------------------------
diff --git a/modules/formats/base/bnd.bnd b/modules/formats/base/bnd.bnd
index 2f8a324..0d351d1 100644
--- a/modules/formats/base/bnd.bnd
+++ b/modules/formats/base/bnd.bnd
@@ -1,3 +1,5 @@
 Export-Package: \
 	org.apache.tamaya.format,\
-	org.apache.tamaya.format.formats
\ No newline at end of file
+	org.apache.tamaya.format.formats
+Bundle-SymbolicName: org.apache.tamaya.formats
+Bundle-Version: 0.3-INCUBATING-SNAPSHOT
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/364604b0/modules/formats/json/bnd.bnd
----------------------------------------------------------------------
diff --git a/modules/formats/json/bnd.bnd b/modules/formats/json/bnd.bnd
index 45ee7d7..62cd3f9 100644
--- a/modules/formats/json/bnd.bnd
+++ b/modules/formats/json/bnd.bnd
@@ -1,2 +1,4 @@
 Export-Package: \
-	org.apache.tamaya.json
\ No newline at end of file
+	org.apache.tamaya.json
+Bundle-SymbolicName: org.apache.tamaya.formats.json
+Bundle-Version: 0.3-INCUBATING-SNAPSHOT
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/364604b0/modules/formats/yaml/bnd.bnd
----------------------------------------------------------------------
diff --git a/modules/formats/yaml/bnd.bnd b/modules/formats/yaml/bnd.bnd
index 325dbc7..fc92b02 100644
--- a/modules/formats/yaml/bnd.bnd
+++ b/modules/formats/yaml/bnd.bnd
@@ -1,2 +1,4 @@
 Export-Package: \
-	org.apache.tamaya.yaml
\ No newline at end of file
+	org.apache.tamaya.yaml
+Bundle-SymbolicName: org.apache.tamaya.formats.yaml
+Bundle-Version: 0.3-INCUBATING-SNAPSHOT
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/364604b0/modules/functions/bnd.bnd
----------------------------------------------------------------------
diff --git a/modules/functions/bnd.bnd b/modules/functions/bnd.bnd
index 3951e26..62bda5d 100644
--- a/modules/functions/bnd.bnd
+++ b/modules/functions/bnd.bnd
@@ -1,2 +1,4 @@
 Export-Package: \
-	org.apache.tamaya.functions
\ No newline at end of file
+	org.apache.tamaya.functions
+Bundle-SymbolicName: org.apache.tamaya.functions
+Bundle-Version: 0.3-INCUBATING-SNAPSHOT
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/364604b0/modules/injection/injection-api/bnd.bnd
----------------------------------------------------------------------
diff --git a/modules/injection/injection-api/bnd.bnd b/modules/injection/injection-api/bnd.bnd
index c68fb11..ea781a8 100644
--- a/modules/injection/injection-api/bnd.bnd
+++ b/modules/injection/injection-api/bnd.bnd
@@ -1,3 +1,6 @@
 Export-Package: \
 	org.apache.tamaya.inject.api,\
-	org.apache.tamaya.inject.spi
\ No newline at end of file
+	org.apache.tamaya.inject.spi
+Bundle-SymbolicName: org.apache.tamaya.inject.api
+Import-Package: org.apache.tamaya;version="[0.3,1)",\
+ org.apache.tamaya.inject.api,org.apache.tamaya.spi;version="[0.3,1)"
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/364604b0/modules/injection/standalone/bnd.bnd
----------------------------------------------------------------------
diff --git a/modules/injection/standalone/bnd.bnd b/modules/injection/standalone/bnd.bnd
index 8bfdf02..e886fba 100644
--- a/modules/injection/standalone/bnd.bnd
+++ b/modules/injection/standalone/bnd.bnd
@@ -1,2 +1,4 @@
 Export-Package: \
-	org.apache.tamaya.inject
\ No newline at end of file
+	org.apache.tamaya.inject
+Bundle-SymbolicName: org.apache.tamaya.inject-se
+Bundle-Version: 0.3-INCUBATING-SNAPSHOT
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/364604b0/modules/optional/bnd.bnd
----------------------------------------------------------------------
diff --git a/modules/optional/bnd.bnd b/modules/optional/bnd.bnd
index 9463045..5c1ba27 100644
--- a/modules/optional/bnd.bnd
+++ b/modules/optional/bnd.bnd
@@ -1,2 +1,4 @@
 Export-Package: \
-	org.apache.tamaya.optional
\ No newline at end of file
+	org.apache.tamaya.optional
+Bundle-SymbolicName: org.apache.tamaya.optional
+Bundle-Version: 0.3-INCUBATING-SNAPSHOT
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/364604b0/modules/resolver/bnd.bnd
----------------------------------------------------------------------
diff --git a/modules/resolver/bnd.bnd b/modules/resolver/bnd.bnd
index 21965e8..ea2ed8a 100644
--- a/modules/resolver/bnd.bnd
+++ b/modules/resolver/bnd.bnd
@@ -1,3 +1,5 @@
 Export-Package: \
 	org.apache.tamaya.resolver,\
-	org.apache.tamaya.resolver.spi
\ No newline at end of file
+	org.apache.tamaya.resolver.spi
+Bundle-SymbolicName: org.apache.tamaya.resolver
+Bundle-Version: 0.3-INCUBATING-SNAPSHOT
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/364604b0/modules/resources/bnd.bnd
----------------------------------------------------------------------
diff --git a/modules/resources/bnd.bnd b/modules/resources/bnd.bnd
index 44ece01..98f60ff 100644
--- a/modules/resources/bnd.bnd
+++ b/modules/resources/bnd.bnd
@@ -1,2 +1,4 @@
 Export-Package: \
-	org.apache.tamaya.resource
\ No newline at end of file
+	org.apache.tamaya.resource
+Bundle-SymbolicName: org.apache.tamaya.resources
+Bundle-Version: 0.3-INCUBATING-SNAPSHOT
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/364604b0/modules/spi-support/bnd.bnd
----------------------------------------------------------------------
diff --git a/modules/spi-support/bnd.bnd b/modules/spi-support/bnd.bnd
index 37c99b7..6dafaa7 100644
--- a/modules/spi-support/bnd.bnd
+++ b/modules/spi-support/bnd.bnd
@@ -1,2 +1,4 @@
 Export-Package: \
-	org.apache.tamaya.spisupport
\ No newline at end of file
+	org.apache.tamaya.spisupport
+Bundle-SymbolicName: org.apache.tamaya.spisupport
+Bundle-Version: 0.3-INCUBATING-SNAPSHOT
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/364604b0/modules/spring/bnd.bnd
----------------------------------------------------------------------
diff --git a/modules/spring/bnd.bnd b/modules/spring/bnd.bnd
index eb0c2fb..6ee583f 100644
--- a/modules/spring/bnd.bnd
+++ b/modules/spring/bnd.bnd
@@ -1,2 +1,4 @@
 Export-Package: \
-	org.apache.tamaya.integration.spring
\ No newline at end of file
+	org.apache.tamaya.integration.spring
+Bundle-SymbolicName: org.apache.tamaya.spring
+Bundle-Version: 0.3-INCUBATING-SNAPSHOT
\ No newline at end of file


Mime
View raw message