You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@aries.apache.org by cs...@apache.org on 2021/03/07 18:38:05 UTC

[aries-component-dsl] branch master updated (1654bed -> a28ae83)

This is an automated email from the ASF dual-hosted git repository.

csierra pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/aries-component-dsl.git.


    from 1654bed  Simplify update support removing the selectors
     new e5125ba  This was incorrect
     new bf80a9b  Without update selectors we can't propagate the update
     new a28ae83  match order

The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../java/org/apache/aries/component/dsl/OSGi.java  | 14 +++------
 .../component/dsl/internal/RefreshWhenOSGi.java    | 36 ++++++++++++----------
 .../dsl/internal/ServiceReferenceOSGi.java         |  2 +-
 .../component/dsl/services/ServiceReferences.java  |  6 ++--
 4 files changed, 29 insertions(+), 29 deletions(-)


[aries-component-dsl] 02/03: Without update selectors we can't propagate the update

Posted by cs...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

csierra pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/aries-component-dsl.git

commit bf80a9b2a49cd3d237c9108ac7084b0578ecd603
Author: Carlos Sierra Andrés <ca...@liferay.com>
AuthorDate: Sun Mar 7 19:10:27 2021 +0100

    Without update selectors we can't propagate the update
    
    Nodes supporting updates can't propagate the update because we can't
    differentiate which one we want to refresh.
---
 .../component/dsl/internal/RefreshWhenOSGi.java    | 36 ++++++++++++----------
 1 file changed, 20 insertions(+), 16 deletions(-)

diff --git a/component-dsl/src/main/java/org/apache/aries/component/dsl/internal/RefreshWhenOSGi.java b/component-dsl/src/main/java/org/apache/aries/component/dsl/internal/RefreshWhenOSGi.java
index 0db1055..e591787 100644
--- a/component-dsl/src/main/java/org/apache/aries/component/dsl/internal/RefreshWhenOSGi.java
+++ b/component-dsl/src/main/java/org/apache/aries/component/dsl/internal/RefreshWhenOSGi.java
@@ -28,24 +28,28 @@ import java.util.function.Predicate;
 public class RefreshWhenOSGi<T> extends OSGiImpl<T> {
 
     public RefreshWhenOSGi(OSGi<T> program, Predicate<T> refresher) {
-        super((executionContext, op) -> program.run(
-            executionContext,
-            op.pipe(
-                t -> {
-                    OSGiResult osgiResult = op.publish(t);
-
-                    return new OSGiResultImpl(
-                        osgiResult::close,
-                        () -> {
-                            if (refresher.test(t)) {
-                                return true;
+        super((executionContext, op) -> {
+            OSGiResult result = program.run(
+                executionContext,
+                op.pipe(
+                    t -> {
+                        OSGiResult osgiResult = op.publish(t);
+
+                        return new OSGiResultImpl(
+                            osgiResult::close,
+                            () -> {
+                                if (refresher.test(t)) {
+                                    return true;
+                                }
+
+                                return osgiResult.update();
                             }
+                        );
+                    }
+                ));
 
-                            return osgiResult.update();
-                        }
-                    );
-                }
-            )));
+            return new OSGiResultImpl(result::close, () -> false);
+        });
     }
 
 }


[aries-component-dsl] 01/03: This was incorrect

Posted by cs...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

csierra pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/aries-component-dsl.git

commit e5125baed3f6ac4c6d17f849ee676232ae8f6279
Author: Carlos Sierra Andrés <ca...@liferay.com>
AuthorDate: Sun Mar 7 19:09:48 2021 +0100

    This was incorrect
---
 component-dsl/src/main/java/org/apache/aries/component/dsl/OSGi.java | 5 -----
 1 file changed, 5 deletions(-)

diff --git a/component-dsl/src/main/java/org/apache/aries/component/dsl/OSGi.java b/component-dsl/src/main/java/org/apache/aries/component/dsl/OSGi.java
index 4935cac..d13185d 100644
--- a/component-dsl/src/main/java/org/apache/aries/component/dsl/OSGi.java
+++ b/component-dsl/src/main/java/org/apache/aries/component/dsl/OSGi.java
@@ -336,11 +336,6 @@ public interface OSGi<T> extends OSGiRunnable<T> {
 	}
 
 	static <T> OSGi<T> fromOsgiRunnable(OSGiRunnable<T> runnable) {
-		return getOsgiFactory().create(
-			(ec, op) -> new OSGiResultImpl(runnable.run(ec, op), () -> true));
-	}
-
-	static <T> OSGi<T> fromOsgiRunnableWithUpdateSupport(OSGiRunnable<T> runnable) {
 		return getOsgiFactory().create(runnable);
 	}
 


[aries-component-dsl] 03/03: match order

Posted by cs...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

csierra pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/aries-component-dsl.git

commit a28ae833768581d51c979dbe3ee97627c9a354a6
Author: Carlos Sierra Andrés <ca...@liferay.com>
AuthorDate: Sun Mar 7 19:12:42 2021 +0100

    match order
---
 .../src/main/java/org/apache/aries/component/dsl/OSGi.java       | 9 +++++----
 .../aries/component/dsl/internal/ServiceReferenceOSGi.java       | 2 +-
 .../apache/aries/component/dsl/services/ServiceReferences.java   | 6 +++---
 3 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/component-dsl/src/main/java/org/apache/aries/component/dsl/OSGi.java b/component-dsl/src/main/java/org/apache/aries/component/dsl/OSGi.java
index d13185d..b935efa 100644
--- a/component-dsl/src/main/java/org/apache/aries/component/dsl/OSGi.java
+++ b/component-dsl/src/main/java/org/apache/aries/component/dsl/OSGi.java
@@ -534,19 +534,20 @@ public interface OSGi<T> extends OSGiRunnable<T> {
 	static <T> OSGi<CachingServiceReference<T>> serviceReferences(
 		Class<T> clazz) {
 
-		return new ServiceReferenceOSGi<>(null, clazz);
+		return serviceReferences(clazz, (String)null);
 	}
 
 	static OSGi<CachingServiceReference<Object>> serviceReferences(
 		String filterString) {
 
-		return new ServiceReferenceOSGi<>(filterString, null);
+		return serviceReferences(null, filterString);
 	}
 
 	static <T> OSGi<CachingServiceReference<T>> serviceReferences(
 		Class<T> clazz, String filterString) {
 
-		return new ServiceReferenceOSGi<>(filterString, clazz);
+		return serviceReferences(
+			clazz, filterString, CachingServiceReference::isDirty);
 	}
 
 	static <T> OSGi<CachingServiceReference<T>> serviceReferences(
@@ -554,7 +555,7 @@ public interface OSGi<T> extends OSGiRunnable<T> {
 		Refresher<? super CachingServiceReference<T>> onModified) {
 
 		return refreshWhen(
-			serviceReferences(clazz, filterString),
+			new ServiceReferenceOSGi<>(clazz, filterString),
 			onModified::test);
 
 	}
diff --git a/component-dsl/src/main/java/org/apache/aries/component/dsl/internal/ServiceReferenceOSGi.java b/component-dsl/src/main/java/org/apache/aries/component/dsl/internal/ServiceReferenceOSGi.java
index d93904f..998bbae 100644
--- a/component-dsl/src/main/java/org/apache/aries/component/dsl/internal/ServiceReferenceOSGi.java
+++ b/component-dsl/src/main/java/org/apache/aries/component/dsl/internal/ServiceReferenceOSGi.java
@@ -30,7 +30,7 @@ import org.osgi.util.tracker.ServiceTrackerCustomizer;
 public class ServiceReferenceOSGi<T>
 	extends OSGiImpl<CachingServiceReference<T>> {
 
-	public ServiceReferenceOSGi(String filterString, Class<T> clazz) {
+	public ServiceReferenceOSGi(Class<T> clazz, String filterString) {
 
 		super((executionContext, op) -> {
 			ServiceTracker<T, Tracked<T>>
diff --git a/component-dsl/src/main/java/org/apache/aries/component/dsl/services/ServiceReferences.java b/component-dsl/src/main/java/org/apache/aries/component/dsl/services/ServiceReferences.java
index 4dc59d0..cc2886f 100644
--- a/component-dsl/src/main/java/org/apache/aries/component/dsl/services/ServiceReferences.java
+++ b/component-dsl/src/main/java/org/apache/aries/component/dsl/services/ServiceReferences.java
@@ -26,19 +26,19 @@ public interface ServiceReferences {
     static <T> OSGi<CachingServiceReference<T>> withUpdate(
         Class<T> clazz) {
 
-        return new ServiceReferenceOSGi<>(null, clazz);
+        return new ServiceReferenceOSGi<>(clazz, null);
     }
 
     static OSGi<CachingServiceReference<Object>> withUpdate(
         String filterString) {
 
-        return new ServiceReferenceOSGi<>(filterString, null);
+        return new ServiceReferenceOSGi<>(null, filterString);
     }
 
     static <T> OSGi<CachingServiceReference<T>> withUpdate(
         Class<T> clazz, String filterString) {
 
-        return new ServiceReferenceOSGi<>(filterString, clazz);
+        return new ServiceReferenceOSGi<>(clazz, filterString);
     }
 
 }