aries-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From csie...@apache.org
Subject [3/4] aries-jax-rs-whiteboard git commit: Apply counter more accurately
Date Fri, 25 Aug 2017 16:38:33 GMT
Apply counter more accurately


Project: http://git-wip-us.apache.org/repos/asf/aries-jax-rs-whiteboard/repo
Commit: http://git-wip-us.apache.org/repos/asf/aries-jax-rs-whiteboard/commit/999afada
Tree: http://git-wip-us.apache.org/repos/asf/aries-jax-rs-whiteboard/tree/999afada
Diff: http://git-wip-us.apache.org/repos/asf/aries-jax-rs-whiteboard/diff/999afada

Branch: refs/heads/master
Commit: 999afada6cce3094b04f524e1499b285fa32c0e5
Parents: 8a07626
Author: Carlos Sierra <csierra@apache.org>
Authored: Fri Aug 25 18:36:44 2017 +0200
Committer: Carlos Sierra <csierra@apache.org>
Committed: Fri Aug 25 18:36:44 2017 +0200

----------------------------------------------------------------------
 .../jax/rs/whiteboard/internal/Whiteboard.java  | 52 ++++++++++++--------
 1 file changed, 31 insertions(+), 21 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/aries-jax-rs-whiteboard/blob/999afada/jax-rs.whiteboard/src/main/java/org/apache/aries/jax/rs/whiteboard/internal/Whiteboard.java
----------------------------------------------------------------------
diff --git a/jax-rs.whiteboard/src/main/java/org/apache/aries/jax/rs/whiteboard/internal/Whiteboard.java
b/jax-rs.whiteboard/src/main/java/org/apache/aries/jax/rs/whiteboard/internal/Whiteboard.java
index 3b6abef..b19b523 100644
--- a/jax-rs.whiteboard/src/main/java/org/apache/aries/jax/rs/whiteboard/internal/Whiteboard.java
+++ b/jax-rs.whiteboard/src/main/java/org/apache/aries/jax/rs/whiteboard/internal/Whiteboard.java
@@ -132,33 +132,37 @@ public class Whiteboard {
         )));
     }
 
-    public static OSGi<?> createWhiteboard(Dictionary<String, ?> configuration)
{
+    public static OSGi<?> createWhiteboard(
+        Dictionary<String, ?> configuration) {
+
         AriesJaxRSServiceRuntime runtime = new AriesJaxRSServiceRuntime();
 
         Map<String, ?> configurationMap = Maps.from(configuration);
 
         return
             bundleContext().flatMap(bundleContext ->
-            registerJaxRSServiceRuntime(runtime, bundleContext, configurationMap).flatMap(runtimeRegistration
->
-            createDefaultJaxRsServiceRegistrator(configurationMap, runtime).flatMap(defaultApplicationReference
->
-            just(new ServiceRegistrationChangeCounter(runtimeRegistration)).flatMap(counter
->
+            registerJaxRSServiceRuntime(
+                    runtime, bundleContext, configurationMap).
+                flatMap(runtimeRegistration ->
+            createDefaultJaxRsServiceRegistrator(configurationMap, runtime).
+                flatMap(defaultApplicationReference ->
+            just(new ServiceRegistrationChangeCounter(runtimeRegistration)).
+                flatMap(counter ->
             just(runtimeRegistration.getReference()).flatMap(runtimeReference ->
                 all(
-                    ignore(countChanges(
+                    ignore(
                         whiteboardApplications(
-                            runtimeReference, runtime, configurationMap),
-                        counter)),
-                    ignore(countChanges(
+                            runtimeReference, runtime, configurationMap,
+                            counter)),
+                    ignore(
                         whiteBoardApplicationResources(
                             bundleContext, runtimeReference,
-                            defaultApplicationReference, runtime),
-                        counter)),
-                    ignore(countChanges(
+                            defaultApplicationReference, runtime, counter)),
+                    ignore(
                         whiteBoardApplicationExtensions(
                             bundleContext, runtimeReference,
-                            defaultApplicationReference, runtime),
-                        counter))
-            ))))));
+                            defaultApplicationReference, runtime, counter)
+            )))))));
     }
 
     public static OSGi<?> deployRegistrator(
@@ -544,11 +548,12 @@ public class Whiteboard {
         BundleContext bundleContext,
         ServiceReference<?> jaxRsRuntimeServiceReference,
         ApplicationReference defaultApplicationReference,
-        AriesJaxRSServiceRuntime runtime) {
+        AriesJaxRSServiceRuntime runtime, ServiceRegistrationChangeCounter counter) {
         return
             onlySupportedInterfaces(
-                serviceReferences(getApplicationExtensionsFilter()).
+                countChanges(serviceReferences(getApplicationExtensionsFilter()).
                     filter(new TargetFilter<>(jaxRsRuntimeServiceReference)),
+                    counter),
                 runtime::addInvalidExtension, runtime::removeInvalidExtension).
                     flatMap(endpointReference ->
             chooseApplication(
@@ -570,10 +575,13 @@ public class Whiteboard {
         BundleContext bundleContext,
         ServiceReference<?> jaxRsRuntimeServiceReference,
         ApplicationReference defaultApplicationReference,
-        AriesJaxRSServiceRuntime runtime) {
+        AriesJaxRSServiceRuntime runtime, ServiceRegistrationChangeCounter counter) {
         return
-            serviceReferences(getResourcesFilter()).
-                filter(new TargetFilter<>(jaxRsRuntimeServiceReference)).
+            countChanges(
+                    serviceReferences(getResourcesFilter()).
+                        filter(
+                            new TargetFilter<>(jaxRsRuntimeServiceReference)),
+                    counter).
                 flatMap(resourceReference ->
             chooseApplication(
                 resourceReference, just(defaultApplicationReference)).
@@ -591,11 +599,13 @@ public class Whiteboard {
     private static OSGi<?> whiteboardApplications(
         ServiceReference<?> jaxRsRuntimeServiceReference,
         AriesJaxRSServiceRuntime runtime,
-        Map<String, ?> configuration) {
+        Map<String, ?> configuration, ServiceRegistrationChangeCounter counter) {
 
         OSGi<ServiceTuple<Application>> gettableAplicationForWhiteboard =
             onlyGettables(
-                getApplicationsForWhiteboard(jaxRsRuntimeServiceReference),
+                countChanges(
+                    getApplicationsForWhiteboard(jaxRsRuntimeServiceReference),
+                    counter),
                 runtime::addNotGettableApplication,
                 runtime::removeNotGettableApplication);
 


Mime
View raw message