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/04 13:50:16 UTC
[aries-component-dsl] branch master updated: Simplify update
support removing the selectors
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
The following commit(s) were added to refs/heads/master by this push:
new 1654bed Simplify update support removing the selectors
1654bed is described below
commit 1654bedd5265509c73224facdcad0bb6bf369177
Author: Carlos Sierra Andrés <ca...@liferay.com>
AuthorDate: Thu Mar 4 14:47:58 2021 +0100
Simplify update support removing the selectors
---
.../java/org/apache/aries/component/dsl/OSGi.java | 42 +++++--------
.../org/apache/aries/component/dsl/OSGiResult.java | 4 +-
.../dsl/configuration/Configurations.java | 5 +-
.../dsl/internal/AggregateOSGiResult.java | 5 +-
.../aries/component/dsl/internal/AllOSGi.java | 2 +-
.../aries/component/dsl/internal/BaseOSGiImpl.java | 32 ++++------
.../aries/component/dsl/internal/BundleOSGi.java | 8 +--
.../component/dsl/internal/CoalesceOSGiImpl.java | 8 +--
.../dsl/internal/ConfigurationOSGiImpl.java | 22 ++-----
.../dsl/internal/ConfigurationsOSGiImpl.java | 23 ++-----
.../component/dsl/internal/DistributeOSGiImpl.java | 5 +-
.../aries/component/dsl/internal/EffectsOSGi.java | 16 ++---
.../component/dsl/internal/HighestRankingOSGi.java | 4 +-
.../aries/component/dsl/internal/JustOSGiImpl.java | 2 +-
.../component/dsl/internal/NothingOSGiImpl.java | 2 +-
.../component/dsl/internal/OSGiResultImpl.java | 11 ++--
.../component/dsl/internal/OnlyLastPublisher.java | 2 +-
.../apache/aries/component/dsl/internal/Pad.java | 5 +-
.../aries/component/dsl/internal/ProbeImpl.java | 2 +-
.../component/dsl/internal/RefreshWhenOSGi.java | 17 ++---
.../dsl/internal/ServiceReferenceOSGi.java | 22 +++----
.../component/dsl/services/ServiceReferences.java | 7 +--
.../aries/component/dsl/update/UpdateQuery.java | 51 ---------------
.../aries/component/dsl/update/UpdateSelector.java | 25 --------
.../aries/component/dsl/update/UpdateTuple.java | 48 --------------
.../aries/component/dsl/update/package-info.java | 20 ------
.../apache/aries/component/dsl/test/DSLTest.java | 73 ++++++++--------------
27 files changed, 116 insertions(+), 347 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 b6b9487..4935cac 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
@@ -45,16 +45,12 @@ import org.apache.aries.component.dsl.function.Function26;
import org.apache.aries.component.dsl.function.Function3;
import org.apache.aries.component.dsl.function.Function5;
import org.apache.aries.component.dsl.function.Function7;
-import org.apache.aries.component.dsl.update.UpdateQuery;
-import org.apache.aries.component.dsl.update.UpdateSelector;
-import org.apache.aries.component.dsl.update.UpdateTuple;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
import org.osgi.framework.ServiceFactory;
import org.osgi.framework.ServiceObjects;
import org.osgi.framework.ServiceReference;
import org.osgi.framework.ServiceRegistration;
-import org.osgi.service.cm.Configuration;
import java.util.*;
import java.util.concurrent.atomic.AtomicInteger;
@@ -294,9 +290,7 @@ public interface OSGi<T> extends OSGiRunnable<T> {
static OSGi<Dictionary<String, ?>> configuration(String pid) {
return refreshWhen(
new ConfigurationOSGiImpl(pid),
- (__, ___) -> true
- ).map(
- UpdateTuple::getT
+ __ -> true
).map(
ConfigurationHolder::getUpdatedProperties
);
@@ -305,9 +299,7 @@ public interface OSGi<T> extends OSGiRunnable<T> {
static OSGi<Dictionary<String, ?>> configurations(String factoryPid) {
return refreshWhen(
new ConfigurationsOSGiImpl(factoryPid),
- (__, ___) -> true
- ).map(
- UpdateTuple::getT
+ __ -> true
).map(
ConfigurationHolder::getUpdatedProperties
);
@@ -319,11 +311,11 @@ public interface OSGi<T> extends OSGiRunnable<T> {
NOOP,
NOOP,
() -> effect.getOnLeaving().accept(null),
- UpdateQuery.onUpdate());
+ NOOP);
}
static OSGi<Void> effects(Runnable onAdding, Runnable onRemoving) {
- return new EffectsOSGi(onAdding, NOOP, NOOP, onRemoving, UpdateQuery.onUpdate());
+ return new EffectsOSGi(onAdding, NOOP, NOOP, onRemoving, NOOP);
}
static OSGi<Void> effects(
@@ -332,24 +324,24 @@ public interface OSGi<T> extends OSGiRunnable<T> {
return new EffectsOSGi(
onAddingBefore, onAddingAfter, onRemovingBefore, onRemovingAfter,
- UpdateQuery.onUpdate());
+ NOOP);
}
static OSGi<Void> effects(
Runnable onAddingBefore, Runnable onAddingAfter,
- Runnable onRemovingBefore, Runnable onRemovingAfter, UpdateQuery<Void> updateQuery) {
+ Runnable onRemovingBefore, Runnable onRemovingAfter, Runnable onUpdate) {
return new EffectsOSGi(
- onAddingBefore, onAddingAfter, onRemovingBefore, onRemovingAfter, updateQuery);
+ onAddingBefore, onAddingAfter, onRemovingBefore, onRemovingAfter, onUpdate);
}
static <T> OSGi<T> fromOsgiRunnable(OSGiRunnable<T> runnable) {
return getOsgiFactory().create(
- (ec, op) -> new OSGiResultImpl(runnable.run(ec, op), __ -> true));
+ (ec, op) -> new OSGiResultImpl(runnable.run(ec, op), () -> true));
}
static <T> OSGi<T> fromOsgiRunnableWithUpdateSupport(OSGiRunnable<T> runnable) {
- return getOsgiFactory().create(runnable::run);
+ return getOsgiFactory().create(runnable);
}
static OSGiFactory getOsgiFactory() {
@@ -467,7 +459,7 @@ public interface OSGi<T> extends OSGiRunnable<T> {
return new RecoverWithOSGi<>(program, function);
}
- static <T> OSGi<T> refreshWhen(OSGi<T> program, BiPredicate<UpdateSelector, T> refresher) {
+ static <T> OSGi<T> refreshWhen(OSGi<T> program, Predicate<T> refresher) {
return new RefreshWhenOSGi<>(program, refresher);
}
@@ -547,19 +539,19 @@ public interface OSGi<T> extends OSGiRunnable<T> {
static <T> OSGi<CachingServiceReference<T>> serviceReferences(
Class<T> clazz) {
- return new ServiceReferenceOSGi<>(null, clazz).map(UpdateTuple::getT);
+ return new ServiceReferenceOSGi<>(null, clazz);
}
static OSGi<CachingServiceReference<Object>> serviceReferences(
String filterString) {
- return new ServiceReferenceOSGi<>(filterString, null).map(UpdateTuple::getT);
+ return new ServiceReferenceOSGi<>(filterString, null);
}
static <T> OSGi<CachingServiceReference<T>> serviceReferences(
Class<T> clazz, String filterString) {
- return new ServiceReferenceOSGi<>(filterString, clazz).map(UpdateTuple::getT);
+ return new ServiceReferenceOSGi<>(filterString, clazz);
}
static <T> OSGi<CachingServiceReference<T>> serviceReferences(
@@ -568,7 +560,7 @@ public interface OSGi<T> extends OSGiRunnable<T> {
return refreshWhen(
serviceReferences(clazz, filterString),
- (__, csr) -> onModified.test(csr));
+ onModified::test);
}
@@ -578,7 +570,7 @@ public interface OSGi<T> extends OSGiRunnable<T> {
return refreshWhen(
serviceReferences(clazz, (String)null),
- (__, csr) -> onModified.test(csr));
+ onModified::test);
}
static OSGi<CachingServiceReference<Object>> serviceReferences(
@@ -587,7 +579,7 @@ public interface OSGi<T> extends OSGiRunnable<T> {
return refreshWhen(
serviceReferences(null, filterString),
- (__, csr) -> onModified.test(csr));
+ onModified::test);
}
static <T> OSGi<T> services(Class<T> clazz) {
@@ -644,7 +636,7 @@ public interface OSGi<T> extends OSGiRunnable<T> {
Consumer<? super T> onAddedBefore, Consumer<? super T> onAddedAfter,
Consumer<? super T> onRemovedBefore,
Consumer<? super T> onRemovedAfter,
- UpdateQuery<T> updateQuery);
+ Consumer<? super T> onUpdate);
OSGi<T> filter(Predicate<T> predicate);
diff --git a/component-dsl/src/main/java/org/apache/aries/component/dsl/OSGiResult.java b/component-dsl/src/main/java/org/apache/aries/component/dsl/OSGiResult.java
index 8085975..26f9807 100644
--- a/component-dsl/src/main/java/org/apache/aries/component/dsl/OSGiResult.java
+++ b/component-dsl/src/main/java/org/apache/aries/component/dsl/OSGiResult.java
@@ -17,8 +17,6 @@
package org.apache.aries.component.dsl;
-import org.apache.aries.component.dsl.update.UpdateSelector;
-
/**
* @author Carlos Sierra Andrés
*/
@@ -31,7 +29,7 @@ public interface OSGiResult extends AutoCloseable, Runnable {
close();
}
- public default boolean update(UpdateSelector updateSelector) {
+ public default boolean update() {
return false;
};
diff --git a/component-dsl/src/main/java/org/apache/aries/component/dsl/configuration/Configurations.java b/component-dsl/src/main/java/org/apache/aries/component/dsl/configuration/Configurations.java
index f1472b4..e514890 100644
--- a/component-dsl/src/main/java/org/apache/aries/component/dsl/configuration/Configurations.java
+++ b/component-dsl/src/main/java/org/apache/aries/component/dsl/configuration/Configurations.java
@@ -20,15 +20,14 @@ package org.apache.aries.component.dsl.configuration;
import org.apache.aries.component.dsl.OSGi;
import org.apache.aries.component.dsl.internal.ConfigurationOSGiImpl;
import org.apache.aries.component.dsl.internal.ConfigurationsOSGiImpl;
-import org.apache.aries.component.dsl.update.UpdateTuple;
public interface Configurations {
- public static OSGi<UpdateTuple<ConfigurationHolder>> singleton(String pid) {
+ public static OSGi<ConfigurationHolder> singleton(String pid) {
return new ConfigurationOSGiImpl(pid);
}
- public static OSGi<UpdateTuple<ConfigurationHolder>> factories(String pid) {
+ public static OSGi<ConfigurationHolder> factories(String pid) {
return new ConfigurationsOSGiImpl(pid);
}
diff --git a/component-dsl/src/main/java/org/apache/aries/component/dsl/internal/AggregateOSGiResult.java b/component-dsl/src/main/java/org/apache/aries/component/dsl/internal/AggregateOSGiResult.java
index a6f98e7..f39022c 100644
--- a/component-dsl/src/main/java/org/apache/aries/component/dsl/internal/AggregateOSGiResult.java
+++ b/component-dsl/src/main/java/org/apache/aries/component/dsl/internal/AggregateOSGiResult.java
@@ -18,7 +18,6 @@
package org.apache.aries.component.dsl.internal;
import org.apache.aries.component.dsl.OSGiResult;
-import org.apache.aries.component.dsl.update.UpdateSelector;
import java.util.concurrent.atomic.AtomicBoolean;
@@ -46,13 +45,13 @@ public class AggregateOSGiResult implements OSGiResult {
}
@Override
- public boolean update(UpdateSelector updateSelector) {
+ public boolean update() {
boolean bool = false;
if (!_closed.get()) {
for (OSGiResult result : results) {
try {
- bool |= result.update(updateSelector);
+ bool |= result.update();
} catch (Exception e) {
}
}
diff --git a/component-dsl/src/main/java/org/apache/aries/component/dsl/internal/AllOSGi.java b/component-dsl/src/main/java/org/apache/aries/component/dsl/internal/AllOSGi.java
index 341792e..87ef222 100644
--- a/component-dsl/src/main/java/org/apache/aries/component/dsl/internal/AllOSGi.java
+++ b/component-dsl/src/main/java/org/apache/aries/component/dsl/internal/AllOSGi.java
@@ -46,7 +46,7 @@ public class AllOSGi<T> extends OSGiImpl<T> {
return new OSGiResultImpl(
() -> cleanUp(results),
- us -> results.stream().map(result -> result.update(us)).reduce(Boolean.FALSE, Boolean::logicalOr)
+ () -> results.stream().map(result -> result.update()).reduce(Boolean.FALSE, Boolean::logicalOr)
);
});
}
diff --git a/component-dsl/src/main/java/org/apache/aries/component/dsl/internal/BaseOSGiImpl.java b/component-dsl/src/main/java/org/apache/aries/component/dsl/internal/BaseOSGiImpl.java
index 686ee2e..1bf1358 100644
--- a/component-dsl/src/main/java/org/apache/aries/component/dsl/internal/BaseOSGiImpl.java
+++ b/component-dsl/src/main/java/org/apache/aries/component/dsl/internal/BaseOSGiImpl.java
@@ -18,8 +18,6 @@
package org.apache.aries.component.dsl.internal;
import org.apache.aries.component.dsl.*;
-import org.apache.aries.component.dsl.update.UpdateQuery;
-import org.apache.aries.component.dsl.update.UpdateSelector;
import org.osgi.framework.Filter;
import org.osgi.framework.InvalidSyntaxException;
@@ -134,12 +132,12 @@ public class BaseOSGiImpl<T> implements OSGi<T> {
});
}
},
- us -> {
+ () -> {
synchronized (identities) {
return identities.stream().map(t -> {
OSGiResult terminator = terminators.get(t).get(f);
- return terminator.update(us);
+ return terminator.update();
}).reduce(
Boolean.FALSE, Boolean::logicalOr
);
@@ -175,12 +173,12 @@ public class BaseOSGiImpl<T> implements OSGi<T> {
});
}
},
- us -> {
+ () -> {
synchronized (identities) {
return functions.stream().map(f -> {
OSGiResult terminator = terminators.get(t).get(f);
- return terminator.update(us);
+ return terminator.update();
}).reduce(
Boolean.FALSE, Boolean::logicalOr
);
@@ -231,7 +229,7 @@ public class BaseOSGiImpl<T> implements OSGi<T> {
Consumer<? super T> onRemovedBefore,
Consumer<? super T> onRemovedAfter) {
- return effects(onAddedBefore, onAddedAfter, onRemovedBefore, onRemovedAfter, UpdateQuery.onUpdate());
+ return effects(onAddedBefore, onAddedAfter, onRemovedBefore, onRemovedAfter, __ -> {});
}
@Override
@@ -239,7 +237,7 @@ public class BaseOSGiImpl<T> implements OSGi<T> {
Consumer<? super T> onAddedBefore, Consumer<? super T> onAddedAfter,
Consumer<? super T> onRemovedBefore,
Consumer<? super T> onRemovedAfter,
- UpdateQuery<T> updateQuery) {
+ Consumer<? super T> onUpdate) {
return new BaseOSGiImpl<>((executionContext, op) ->
run(
@@ -272,16 +270,10 @@ public class BaseOSGiImpl<T> implements OSGi<T> {
//TODO: logging
}
},
- us -> {
- UpdateQuery.From<T>[] froms = updateQuery.froms;
-
- for (UpdateQuery.From<T> from : froms) {
- if (from.selector == us || from.selector == UpdateSelector.ALL) {
- from.consumer.accept(t);
- }
- }
+ () -> {
+ onUpdate.accept(t);
- return terminator.update(us);
+ return terminator.update();
}
);
@@ -397,11 +389,11 @@ public class BaseOSGiImpl<T> implements OSGi<T> {
result.close();
},
- us -> pads.values().stream().map(
- pad -> pad.update(us)
+ () -> pads.values().stream().map(
+ Pad::update
).reduce(
Boolean.FALSE, Boolean::logicalOr
- ) | result.update(us)
+ ) | result.update()
);
});
}
diff --git a/component-dsl/src/main/java/org/apache/aries/component/dsl/internal/BundleOSGi.java b/component-dsl/src/main/java/org/apache/aries/component/dsl/internal/BundleOSGi.java
index 9eae7fd..1ea33f0 100644
--- a/component-dsl/src/main/java/org/apache/aries/component/dsl/internal/BundleOSGi.java
+++ b/component-dsl/src/main/java/org/apache/aries/component/dsl/internal/BundleOSGi.java
@@ -18,7 +18,6 @@
package org.apache.aries.component.dsl.internal;
import org.apache.aries.component.dsl.OSGiResult;
-import org.apache.aries.component.dsl.update.UpdateSelector;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleEvent;
import org.osgi.util.tracker.BundleTracker;
@@ -31,7 +30,6 @@ public class BundleOSGi extends OSGiImpl<Bundle> {
public BundleOSGi(int stateMask) {
super((executionContext, op) -> {
- UpdateSelector updateSelector = new UpdateSelector() {};
BundleTracker<OSGiResult> bundleTracker =
new BundleTracker<>(
@@ -50,7 +48,7 @@ public class BundleOSGi extends OSGiImpl<Bundle> {
Bundle bundle, BundleEvent bundleEvent,
OSGiResult osgiResult) {
- osgiResult.update(updateSelector);
+ osgiResult.update();
}
@Override
@@ -66,8 +64,8 @@ public class BundleOSGi extends OSGiImpl<Bundle> {
return new OSGiResultImpl(
bundleTracker::close,
- us -> bundleTracker.getTracked().values().stream().map(
- result -> result.update(us)
+ () -> bundleTracker.getTracked().values().stream().map(
+ OSGiResult::update
).reduce(
Boolean.FALSE, Boolean::logicalOr
)
diff --git a/component-dsl/src/main/java/org/apache/aries/component/dsl/internal/CoalesceOSGiImpl.java b/component-dsl/src/main/java/org/apache/aries/component/dsl/internal/CoalesceOSGiImpl.java
index 6ce33a6..113d51f 100644
--- a/component-dsl/src/main/java/org/apache/aries/component/dsl/internal/CoalesceOSGiImpl.java
+++ b/component-dsl/src/main/java/org/apache/aries/component/dsl/internal/CoalesceOSGiImpl.java
@@ -95,9 +95,9 @@ public class CoalesceOSGiImpl<T> extends OSGiImpl<T> {
}
}
}),
- us -> {
+ () -> {
synchronized (initialized) {
- return result.get().update(us);
+ return result.get().update();
}
});
};
@@ -130,10 +130,10 @@ public class CoalesceOSGiImpl<T> extends OSGiImpl<T> {
}
}
},
- us -> {
+ () -> {
synchronized (initialized) {
return Arrays.stream(results).map(
- res -> res.update(us)
+ res -> res.update()
).reduce(
Boolean.FALSE, Boolean::logicalOr
);
diff --git a/component-dsl/src/main/java/org/apache/aries/component/dsl/internal/ConfigurationOSGiImpl.java b/component-dsl/src/main/java/org/apache/aries/component/dsl/internal/ConfigurationOSGiImpl.java
index 7080fb7..2690c05 100644
--- a/component-dsl/src/main/java/org/apache/aries/component/dsl/internal/ConfigurationOSGiImpl.java
+++ b/component-dsl/src/main/java/org/apache/aries/component/dsl/internal/ConfigurationOSGiImpl.java
@@ -19,8 +19,6 @@ package org.apache.aries.component.dsl.internal;
import org.apache.aries.component.dsl.OSGiResult;
import org.apache.aries.component.dsl.configuration.ConfigurationHolder;
-import org.apache.aries.component.dsl.update.UpdateSelector;
-import org.apache.aries.component.dsl.update.UpdateTuple;
import org.osgi.framework.BundleContext;
import org.osgi.framework.ServiceReference;
import org.osgi.framework.ServiceRegistration;
@@ -39,7 +37,7 @@ import java.util.concurrent.atomic.AtomicReference;
/**
* @author Carlos Sierra Andrés
*/
-public class ConfigurationOSGiImpl extends OSGiImpl<UpdateTuple<ConfigurationHolder>> {
+public class ConfigurationOSGiImpl extends OSGiImpl<ConfigurationHolder> {
public ConfigurationOSGiImpl(String pid) {
super((executionContext, op) -> {
@@ -48,12 +46,10 @@ public class ConfigurationOSGiImpl extends OSGiImpl<UpdateTuple<ConfigurationHol
AtomicReference<OSGiResult>
terminatorAtomicReference = new AtomicReference<>(
- new OSGiResultImpl(NOOP, __ -> false));
+ new OSGiResultImpl(NOOP, () -> false));
AtomicBoolean closed = new AtomicBoolean();
- UpdateSelector updateSelector = new UpdateSelector() {};
-
AtomicLong initialCounter = new AtomicLong();
CountDownLatch countDownLatch = new CountDownLatch(1);
@@ -100,7 +96,7 @@ public class ConfigurationOSGiImpl extends OSGiImpl<UpdateTuple<ConfigurationHol
atomicReference.set(configuration);
}
else {
- if (!terminatorAtomicReference.get().update(updateSelector)) {
+ if (!terminatorAtomicReference.get().update()) {
return;
}
}
@@ -109,10 +105,7 @@ public class ConfigurationOSGiImpl extends OSGiImpl<UpdateTuple<ConfigurationHol
signalLeave(terminatorAtomicReference);
terminatorAtomicReference.set(
- op.apply(
- new UpdateTuple<>(
- updateSelector,
- new ConfigurationHolderImpl(configuration))));
+ op.apply(new ConfigurationHolderImpl(configuration)));
});
@@ -141,10 +134,7 @@ public class ConfigurationOSGiImpl extends OSGiImpl<UpdateTuple<ConfigurationHol
initialCounter.set(configuration.getChangeCount());
terminatorAtomicReference.set(
- op.apply(
- new UpdateTuple<>(
- updateSelector,
- new ConfigurationHolderImpl(configuration))));
+ op.apply(new ConfigurationHolderImpl(configuration)));
}
}
@@ -158,7 +148,7 @@ public class ConfigurationOSGiImpl extends OSGiImpl<UpdateTuple<ConfigurationHol
signalLeave(terminatorAtomicReference);
},
- us -> terminatorAtomicReference.get().update(us))
+ () -> terminatorAtomicReference.get().update())
;
});
}
diff --git a/component-dsl/src/main/java/org/apache/aries/component/dsl/internal/ConfigurationsOSGiImpl.java b/component-dsl/src/main/java/org/apache/aries/component/dsl/internal/ConfigurationsOSGiImpl.java
index e91d373..d718560 100644
--- a/component-dsl/src/main/java/org/apache/aries/component/dsl/internal/ConfigurationsOSGiImpl.java
+++ b/component-dsl/src/main/java/org/apache/aries/component/dsl/internal/ConfigurationsOSGiImpl.java
@@ -19,8 +19,6 @@ package org.apache.aries.component.dsl.internal;
import org.apache.aries.component.dsl.OSGiResult;
import org.apache.aries.component.dsl.configuration.ConfigurationHolder;
-import org.apache.aries.component.dsl.update.UpdateSelector;
-import org.apache.aries.component.dsl.update.UpdateTuple;
import org.osgi.framework.BundleContext;
import org.osgi.framework.ServiceReference;
import org.osgi.framework.ServiceRegistration;
@@ -29,7 +27,6 @@ import org.osgi.service.cm.ConfigurationAdmin;
import org.osgi.service.cm.ConfigurationEvent;
import org.osgi.service.cm.ConfigurationListener;
-import java.util.Dictionary;
import java.util.Hashtable;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.CountDownLatch;
@@ -39,7 +36,7 @@ import java.util.concurrent.atomic.AtomicBoolean;
/**
* @author Carlos Sierra Andrés
*/
-public class ConfigurationsOSGiImpl extends OSGiImpl<UpdateTuple<ConfigurationHolder>> {
+public class ConfigurationsOSGiImpl extends OSGiImpl<ConfigurationHolder> {
public ConfigurationsOSGiImpl(String factoryPid) {
super((executionContext, op) -> {
@@ -51,8 +48,6 @@ public class ConfigurationsOSGiImpl extends OSGiImpl<UpdateTuple<ConfigurationHo
AtomicBoolean closed = new AtomicBoolean();
- UpdateSelector updateSelector = new UpdateSelector() {};
-
CountDownLatch countDownLatch = new CountDownLatch(1);
final BundleContext bundleContext = executionContext.getBundleContext();
@@ -100,7 +95,7 @@ public class ConfigurationsOSGiImpl extends OSGiImpl<UpdateTuple<ConfigurationHo
OSGiResult osgiResult = terminators.get(pid);
- if (osgiResult != null && !osgiResult.update(updateSelector)) {
+ if (osgiResult != null && !osgiResult.update()) {
return;
}
}
@@ -109,10 +104,7 @@ public class ConfigurationsOSGiImpl extends OSGiImpl<UpdateTuple<ConfigurationHo
signalLeave(pid, terminators);
terminators.put(
- pid, op.apply(
- new UpdateTuple<>(
- updateSelector,
- new ConfigurationHolderImpl(configuration))));
+ pid, op.apply(new ConfigurationHolderImpl(configuration)));
});
if (closed.get()) {
@@ -140,10 +132,7 @@ public class ConfigurationsOSGiImpl extends OSGiImpl<UpdateTuple<ConfigurationHo
terminators.put(
configuration.getPid(),
- op.publish(
- new UpdateTuple<>(
- updateSelector,
- new ConfigurationHolderImpl(configuration))));
+ op.publish(new ConfigurationHolderImpl(configuration)));
}
}
@@ -161,8 +150,8 @@ public class ConfigurationsOSGiImpl extends OSGiImpl<UpdateTuple<ConfigurationHo
}
}
},
- us -> terminators.values().stream().map(
- osgiResult -> osgiResult.update(us)
+ () -> terminators.values().stream().map(
+ OSGiResult::update
).reduce(
Boolean.FALSE, Boolean::logicalOr
));
diff --git a/component-dsl/src/main/java/org/apache/aries/component/dsl/internal/DistributeOSGiImpl.java b/component-dsl/src/main/java/org/apache/aries/component/dsl/internal/DistributeOSGiImpl.java
index 35e9e55..8c96066 100644
--- a/component-dsl/src/main/java/org/apache/aries/component/dsl/internal/DistributeOSGiImpl.java
+++ b/component-dsl/src/main/java/org/apache/aries/component/dsl/internal/DistributeOSGiImpl.java
@@ -19,7 +19,6 @@ package org.apache.aries.component.dsl.internal;
import org.apache.aries.component.dsl.OSGi;
import org.apache.aries.component.dsl.OSGiResult;
-import org.apache.aries.component.dsl.Publisher;
import java.util.ArrayList;
import java.util.List;
@@ -61,8 +60,8 @@ public class DistributeOSGiImpl<T, S> extends BaseOSGiImpl<S> {
return new OSGiResultImpl(
() -> cleanUp(terminators),
- us -> terminators.stream().map(
- os -> os.update(us)
+ () -> terminators.stream().map(
+ os -> os.update()
).reduce(
Boolean.FALSE, Boolean::logicalOr
)
diff --git a/component-dsl/src/main/java/org/apache/aries/component/dsl/internal/EffectsOSGi.java b/component-dsl/src/main/java/org/apache/aries/component/dsl/internal/EffectsOSGi.java
index 747a883..ed6864a 100644
--- a/component-dsl/src/main/java/org/apache/aries/component/dsl/internal/EffectsOSGi.java
+++ b/component-dsl/src/main/java/org/apache/aries/component/dsl/internal/EffectsOSGi.java
@@ -18,8 +18,6 @@
package org.apache.aries.component.dsl.internal;
import org.apache.aries.component.dsl.OSGiResult;
-import org.apache.aries.component.dsl.update.UpdateQuery;
-import org.apache.aries.component.dsl.update.UpdateSelector;
/**
* @author Carlos Sierra Andrés
@@ -28,7 +26,7 @@ public class EffectsOSGi extends OSGiImpl<Void> {
public EffectsOSGi(
Runnable onAddingBefore, Runnable onAddingAfter,
- Runnable onRemovingBefore, Runnable onRemovingAfter, UpdateQuery<Void> updateQuery) {
+ Runnable onRemovingBefore, Runnable onRemovingAfter, Runnable onUpdate) {
super((executionContext, op) -> {
onAddingBefore.run();
@@ -59,16 +57,10 @@ public class EffectsOSGi extends OSGiImpl<Void> {
//TODO: logging
}
},
- us -> {
- UpdateQuery.From<Void>[] froms = updateQuery.froms;
-
- for (UpdateQuery.From<Void> from : froms) {
- if (from.selector == us || from.selector == UpdateSelector.ALL) {
- from.consumer.accept(null);
- }
- }
+ () -> {
+ onUpdate.run();
- return terminator.update(us);
+ return terminator.update();
}
);
diff --git a/component-dsl/src/main/java/org/apache/aries/component/dsl/internal/HighestRankingOSGi.java b/component-dsl/src/main/java/org/apache/aries/component/dsl/internal/HighestRankingOSGi.java
index 31d01e3..9dae821 100644
--- a/component-dsl/src/main/java/org/apache/aries/component/dsl/internal/HighestRankingOSGi.java
+++ b/component-dsl/src/main/java/org/apache/aries/component/dsl/internal/HighestRankingOSGi.java
@@ -93,11 +93,11 @@ public class HighestRankingOSGi<T> extends OSGiImpl<T> {
}
}
},
- us -> {
+ () -> {
synchronized (set) {
Tuple<T> current = set.peek();
- return current.osgiResult.update(us);
+ return current.osgiResult.update();
}
}
);
diff --git a/component-dsl/src/main/java/org/apache/aries/component/dsl/internal/JustOSGiImpl.java b/component-dsl/src/main/java/org/apache/aries/component/dsl/internal/JustOSGiImpl.java
index cd516d6..1f8db5a 100644
--- a/component-dsl/src/main/java/org/apache/aries/component/dsl/internal/JustOSGiImpl.java
+++ b/component-dsl/src/main/java/org/apache/aries/component/dsl/internal/JustOSGiImpl.java
@@ -55,7 +55,7 @@ public class JustOSGiImpl<T> extends OSGiImpl<T> {
return new OSGiResultImpl(
() -> cleanUp(references),
- us -> references.stream().map(res -> res.update(us)).reduce(Boolean.FALSE, Boolean::logicalOr)
+ () -> references.stream().map(res -> res.update()).reduce(Boolean.FALSE, Boolean::logicalOr)
);
});
}
diff --git a/component-dsl/src/main/java/org/apache/aries/component/dsl/internal/NothingOSGiImpl.java b/component-dsl/src/main/java/org/apache/aries/component/dsl/internal/NothingOSGiImpl.java
index ff8b0e6..8781c0b 100644
--- a/component-dsl/src/main/java/org/apache/aries/component/dsl/internal/NothingOSGiImpl.java
+++ b/component-dsl/src/main/java/org/apache/aries/component/dsl/internal/NothingOSGiImpl.java
@@ -25,6 +25,6 @@ import org.apache.aries.component.dsl.OSGi;
public class NothingOSGiImpl<S> extends OSGiImpl<S> {
public NothingOSGiImpl() {
- super((executionContext, __) -> new OSGiResultImpl(OSGi.NOOP, ___ -> false));
+ super((executionContext, __) -> new OSGiResultImpl(OSGi.NOOP, () -> false));
}
}
diff --git a/component-dsl/src/main/java/org/apache/aries/component/dsl/internal/OSGiResultImpl.java b/component-dsl/src/main/java/org/apache/aries/component/dsl/internal/OSGiResultImpl.java
index 36a0745..16bfe02 100644
--- a/component-dsl/src/main/java/org/apache/aries/component/dsl/internal/OSGiResultImpl.java
+++ b/component-dsl/src/main/java/org/apache/aries/component/dsl/internal/OSGiResultImpl.java
@@ -18,17 +18,16 @@
package org.apache.aries.component.dsl.internal;
import org.apache.aries.component.dsl.OSGiResult;
-import org.apache.aries.component.dsl.update.UpdateSelector;
import java.util.concurrent.atomic.AtomicBoolean;
-import java.util.function.Predicate;
+import java.util.function.Supplier;
/**
* @author Carlos Sierra Andrés
*/
public class OSGiResultImpl implements OSGiResult {
- public OSGiResultImpl(Runnable close, Predicate<UpdateSelector> onUpdate) {
+ public OSGiResultImpl(Runnable close, Supplier<Boolean> onUpdate) {
this.close = close;
this.onUpdate = onUpdate;
}
@@ -41,16 +40,16 @@ public class OSGiResultImpl implements OSGiResult {
}
@Override
- public boolean update(UpdateSelector updateSelector) {
+ public boolean update() {
if (_closed.get()) {
return false;
}
- return onUpdate.test(updateSelector);
+ return onUpdate.get();
}
private final Runnable close;
- private Predicate<UpdateSelector> onUpdate;
+ private Supplier<Boolean> onUpdate;
private AtomicBoolean _closed = new AtomicBoolean();
}
diff --git a/component-dsl/src/main/java/org/apache/aries/component/dsl/internal/OnlyLastPublisher.java b/component-dsl/src/main/java/org/apache/aries/component/dsl/internal/OnlyLastPublisher.java
index cd316da..f075549 100644
--- a/component-dsl/src/main/java/org/apache/aries/component/dsl/internal/OnlyLastPublisher.java
+++ b/component-dsl/src/main/java/org/apache/aries/component/dsl/internal/OnlyLastPublisher.java
@@ -68,7 +68,7 @@ public class OnlyLastPublisher<T> implements Publisher<T> {
}
}
},
- us -> _terminator.update(us)
+ () -> _terminator.update()
);
}
}
diff --git a/component-dsl/src/main/java/org/apache/aries/component/dsl/internal/Pad.java b/component-dsl/src/main/java/org/apache/aries/component/dsl/internal/Pad.java
index 2da4baa..89eabed 100644
--- a/component-dsl/src/main/java/org/apache/aries/component/dsl/internal/Pad.java
+++ b/component-dsl/src/main/java/org/apache/aries/component/dsl/internal/Pad.java
@@ -21,7 +21,6 @@ import org.apache.aries.component.dsl.OSGi;
import org.apache.aries.component.dsl.OSGiResult;
import org.apache.aries.component.dsl.OSGiRunnable.ExecutionContext;
import org.apache.aries.component.dsl.Publisher;
-import org.apache.aries.component.dsl.update.UpdateSelector;
import java.util.function.Function;
@@ -56,8 +55,8 @@ public class Pad<T, S> implements Publisher<T>, OSGiResult {
}
@Override
- public boolean update(UpdateSelector updateSelector) {
- return _result.update(updateSelector);
+ public boolean update() {
+ return _result.update();
}
@Override
diff --git a/component-dsl/src/main/java/org/apache/aries/component/dsl/internal/ProbeImpl.java b/component-dsl/src/main/java/org/apache/aries/component/dsl/internal/ProbeImpl.java
index b825dc3..3124b2e 100644
--- a/component-dsl/src/main/java/org/apache/aries/component/dsl/internal/ProbeImpl.java
+++ b/component-dsl/src/main/java/org/apache/aries/component/dsl/internal/ProbeImpl.java
@@ -45,7 +45,7 @@ public class ProbeImpl<T> extends BaseOSGiImpl<T> {
return new OSGiResultImpl(
() -> {_onClose.close(); _onClose = NOOP;},
- us -> _onClose.update(us)
+ () -> _onClose.update()
);
}
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 cab0a0b..0db1055 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
@@ -19,14 +19,7 @@ package org.apache.aries.component.dsl.internal;
import org.apache.aries.component.dsl.OSGi;
import org.apache.aries.component.dsl.OSGiResult;
-import org.apache.aries.component.dsl.Publisher;
-import org.apache.aries.component.dsl.Refresher;
-import org.apache.aries.component.dsl.update.UpdateSelector;
-import org.apache.aries.component.dsl.update.UpdateTuple;
-
-import java.util.concurrent.atomic.AtomicReference;
-import java.util.function.BiFunction;
-import java.util.function.BiPredicate;
+
import java.util.function.Predicate;
/**
@@ -34,7 +27,7 @@ import java.util.function.Predicate;
*/
public class RefreshWhenOSGi<T> extends OSGiImpl<T> {
- public RefreshWhenOSGi(OSGi<T> program, BiPredicate<UpdateSelector, T> refresher) {
+ public RefreshWhenOSGi(OSGi<T> program, Predicate<T> refresher) {
super((executionContext, op) -> program.run(
executionContext,
op.pipe(
@@ -43,12 +36,12 @@ public class RefreshWhenOSGi<T> extends OSGiImpl<T> {
return new OSGiResultImpl(
osgiResult::close,
- us -> {
- if (refresher.test(us, t)) {
+ () -> {
+ if (refresher.test(t)) {
return true;
}
- return osgiResult.update(us);
+ return osgiResult.update();
}
);
}
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 cac5c73..d93904f 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
@@ -20,8 +20,6 @@ package org.apache.aries.component.dsl.internal;
import org.apache.aries.component.dsl.OSGiResult;
import org.apache.aries.component.dsl.CachingServiceReference;
import org.apache.aries.component.dsl.Publisher;
-import org.apache.aries.component.dsl.update.UpdateSelector;
-import org.apache.aries.component.dsl.update.UpdateTuple;
import org.osgi.framework.ServiceReference;
import org.osgi.util.tracker.ServiceTracker;
import org.osgi.util.tracker.ServiceTrackerCustomizer;
@@ -30,7 +28,7 @@ import org.osgi.util.tracker.ServiceTrackerCustomizer;
* @author Carlos Sierra Andrés
*/
public class ServiceReferenceOSGi<T>
- extends OSGiImpl<UpdateTuple<CachingServiceReference<T>>> implements UpdateSelector {
+ extends OSGiImpl<CachingServiceReference<T>> {
public ServiceReferenceOSGi(String filterString, Class<T> clazz) {
@@ -45,8 +43,8 @@ public class ServiceReferenceOSGi<T>
return new OSGiResultImpl(
serviceTracker::close,
- us -> serviceTracker.getTracked().values().stream().map(
- tracked -> tracked.runnable.update(us)
+ () -> serviceTracker.getTracked().values().stream().map(
+ tracked -> tracked.runnable.update()
).reduce(
Boolean.FALSE, Boolean::logicalOr
)
@@ -55,10 +53,10 @@ public class ServiceReferenceOSGi<T>
}
private static class DefaultServiceTrackerCustomizer<T>
- implements ServiceTrackerCustomizer<T, Tracked<T>>, UpdateSelector{
+ implements ServiceTrackerCustomizer<T, Tracked<T>> {
public DefaultServiceTrackerCustomizer(
- Publisher<? super UpdateTuple<CachingServiceReference<T>>> addedSource) {
+ Publisher<? super CachingServiceReference<T>> addedSource) {
_addedSource = addedSource;
}
@@ -69,22 +67,20 @@ public class ServiceReferenceOSGi<T>
new CachingServiceReference<>(reference);
return new Tracked<>(
- cachingServiceReference,
- _addedSource.apply(new UpdateTuple<>(this, cachingServiceReference)));
+ cachingServiceReference, _addedSource.apply(cachingServiceReference));
}
@Override
public void modifiedService(
ServiceReference<T> reference, Tracked<T> tracked) {
- if (tracked.runnable.update(this)) {
+ if (tracked.runnable.update()) {
UpdateSupport.runUpdate(() -> {
tracked.runnable.run();
tracked.cachingServiceReference = new CachingServiceReference<>(
reference);
tracked.runnable =
- _addedSource.apply(
- new UpdateTuple<>(this, tracked.cachingServiceReference));
+ _addedSource.apply(tracked.cachingServiceReference);
});
}
}
@@ -96,7 +92,7 @@ public class ServiceReferenceOSGi<T>
tracked.runnable.run();
}
- private final Publisher<? super UpdateTuple<CachingServiceReference<T>>> _addedSource;
+ private final Publisher<? super CachingServiceReference<T>> _addedSource;
}
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 7601989..4dc59d0 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
@@ -20,23 +20,22 @@ package org.apache.aries.component.dsl.services;
import org.apache.aries.component.dsl.CachingServiceReference;
import org.apache.aries.component.dsl.OSGi;
import org.apache.aries.component.dsl.internal.ServiceReferenceOSGi;
-import org.apache.aries.component.dsl.update.UpdateTuple;
public interface ServiceReferences {
- static <T> OSGi<UpdateTuple<CachingServiceReference<T>>> withUpdate(
+ static <T> OSGi<CachingServiceReference<T>> withUpdate(
Class<T> clazz) {
return new ServiceReferenceOSGi<>(null, clazz);
}
- static OSGi<UpdateTuple<CachingServiceReference<Object>>> withUpdate(
+ static OSGi<CachingServiceReference<Object>> withUpdate(
String filterString) {
return new ServiceReferenceOSGi<>(filterString, null);
}
- static <T> OSGi<UpdateTuple<CachingServiceReference<T>>> withUpdate(
+ static <T> OSGi<CachingServiceReference<T>> withUpdate(
Class<T> clazz, String filterString) {
return new ServiceReferenceOSGi<>(filterString, clazz);
diff --git a/component-dsl/src/main/java/org/apache/aries/component/dsl/update/UpdateQuery.java b/component-dsl/src/main/java/org/apache/aries/component/dsl/update/UpdateQuery.java
deleted file mode 100644
index d6e3870..0000000
--- a/component-dsl/src/main/java/org/apache/aries/component/dsl/update/UpdateQuery.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.aries.component.dsl.update;
-
-import java.util.function.Consumer;
-
-/**
- * @author Carlos Sierra Andrés
- */
-public final class UpdateQuery<T> {
- public final From<T>[] froms;
-
- @SafeVarargs
- public UpdateQuery(From<T>... froms) {
- this.froms = froms;
- }
-
- @SafeVarargs
- public static <T> UpdateQuery<T> onUpdate(From<T> ... froms) {
- return new UpdateQuery<>(froms);
- }
-
- public static class From<T> {
- public final UpdateSelector selector;
- public final Consumer<T> consumer;
-
- public From(UpdateSelector selector, Consumer<T> consumer) {
- this.selector = selector;
- this.consumer = consumer;
- }
-
- public static <T> From<T> from(UpdateSelector selector, Consumer<T> consumer) {
- return new From<>(selector, consumer);
- }
- }
-}
diff --git a/component-dsl/src/main/java/org/apache/aries/component/dsl/update/UpdateSelector.java b/component-dsl/src/main/java/org/apache/aries/component/dsl/update/UpdateSelector.java
deleted file mode 100644
index 397e349..0000000
--- a/component-dsl/src/main/java/org/apache/aries/component/dsl/update/UpdateSelector.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.aries.component.dsl.update;
-
-public interface UpdateSelector {
-
- public static final UpdateSelector ALL = new UpdateSelector() {};
-
- public static final UpdateSelector STATIC = new UpdateSelector() {};
-}
diff --git a/component-dsl/src/main/java/org/apache/aries/component/dsl/update/UpdateTuple.java b/component-dsl/src/main/java/org/apache/aries/component/dsl/update/UpdateTuple.java
deleted file mode 100644
index 5622638..0000000
--- a/component-dsl/src/main/java/org/apache/aries/component/dsl/update/UpdateTuple.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.aries.component.dsl.update;
-
-import org.apache.aries.component.dsl.OSGi;
-
-import java.util.function.BiFunction;
-
-public final class UpdateTuple<T> {
-
- public final UpdateSelector updateSelector;
- public final T t;
-
- public UpdateTuple(UpdateSelector updateSelector, T t) {
- this.updateSelector = updateSelector;
- this.t = t;
- }
-
- public T getT() {
- return t;
- }
-
- public static <S, R> OSGi<R> flatMap(
- OSGi<UpdateTuple<S>> tuple, BiFunction<UpdateSelector, S, OSGi<R>> biFunction) {
-
- return tuple.flatMap(updateTuple -> biFunction.apply(updateTuple.updateSelector, updateTuple.t));
- }
-
- public static <T> UpdateTuple<T> fromStatic(T t) {
- return new UpdateTuple<>(UpdateSelector.STATIC, t);
- }
-
-}
diff --git a/component-dsl/src/main/java/org/apache/aries/component/dsl/update/package-info.java b/component-dsl/src/main/java/org/apache/aries/component/dsl/update/package-info.java
deleted file mode 100644
index 4a45062..0000000
--- a/component-dsl/src/main/java/org/apache/aries/component/dsl/update/package-info.java
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-@org.osgi.annotation.bundle.Export
-@org.osgi.annotation.versioning.Version("1.0.0")
-package org.apache.aries.component.dsl.update;
diff --git a/itests/src/main/java/org/apache/aries/component/dsl/test/DSLTest.java b/itests/src/main/java/org/apache/aries/component/dsl/test/DSLTest.java
index f69ea34..f98cd4a 100644
--- a/itests/src/main/java/org/apache/aries/component/dsl/test/DSLTest.java
+++ b/itests/src/main/java/org/apache/aries/component/dsl/test/DSLTest.java
@@ -22,13 +22,9 @@ import org.apache.aries.component.dsl.OSGi;
import org.apache.aries.component.dsl.OSGiResult;
import org.apache.aries.component.dsl.Publisher;
import org.apache.aries.component.dsl.Utils;
-import org.apache.aries.component.dsl.configuration.ConfigurationHolder;
import org.apache.aries.component.dsl.configuration.Configurations;
import org.apache.aries.component.dsl.internal.ProbeImpl;
import org.apache.aries.component.dsl.services.ServiceReferences;
-import org.apache.aries.component.dsl.update.UpdateQuery;
-import org.apache.aries.component.dsl.update.UpdateSelector;
-import org.apache.aries.component.dsl.update.UpdateTuple;
import org.junit.Test;
import org.osgi.framework.BundleContext;
import org.osgi.framework.FrameworkUtil;
@@ -61,10 +57,6 @@ import static org.apache.aries.component.dsl.OSGi.*;
import static org.apache.aries.component.dsl.Utils.accumulate;
import static org.apache.aries.component.dsl.Utils.highest;
import static org.apache.aries.component.dsl.configuration.ConfigurationHolder.fromMap;
-import static org.apache.aries.component.dsl.update.UpdateQuery.From.from;
-import static org.apache.aries.component.dsl.update.UpdateQuery.onUpdate;
-import static org.apache.aries.component.dsl.update.UpdateTuple.flatMap;
-import static org.apache.aries.component.dsl.update.UpdateTuple.fromStatic;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
@@ -514,12 +506,10 @@ public class DSLTest {
effect.set(countDownLatch::countDown);
try(OSGiResult result =
- flatMap(coalesce(
+ coalesce(
Configurations.singleton("test.configuration"),
- just(() -> fromStatic(fromMap(new HashMap<>())))),
- (configurationUpdate, cholder) ->
- just(() -> cholder).
- effects(
+ just(fromMap(new HashMap<>())))
+ .effects(
holder -> {
atomicReference.set(holder.getUpdatedProperties());
@@ -530,16 +520,16 @@ public class DSLTest {
__ -> {},
__ -> {},
__ -> {},
- onUpdate(
- from(configurationUpdate, holder -> {
+ holder -> {
atomicReference.set(holder.getUpdatedProperties());
updateCounter.incrementAndGet();
effect.get().run();
- }))
- )).run(bundleContext))
- {
+ }
+ )
+ .run(bundleContext)
+ ) {
configuration.update(
new Hashtable<String, Object>() {{
put("property", "value");
@@ -1899,14 +1889,10 @@ public class DSLTest {
__ -> {},
__ -> {},
__ -> {},
- onUpdate(
- from(
- UpdateSelector.ALL,
- csr ->
- atomicReference.set(
- String.valueOf(
- csr.getServiceReference().getProperty("property"))))
- )
+ csr ->
+ atomicReference.set(
+ String.valueOf(
+ csr.getServiceReference().getProperty("property")))
);
program.run(bundleContext);
@@ -1950,28 +1936,21 @@ public class DSLTest {
AtomicInteger atomicInteger = new AtomicInteger();
try {
- OSGi<?> program = UpdateTuple.flatMap(
- refreshWhen(
+ OSGi<?> program = refreshWhen(
ServiceReferences.withUpdate(Service.class),
- (us, ut) -> ut.t.getServiceReference().getProperty("property").equals("refresh")
- ),
- (serviceUpdate, csr) ->
- effects(
- () -> {
- atomicReference.set(String.valueOf(csr.getServiceReference().getProperty("property")));
-
- atomicInteger.incrementAndGet();
- },
- () -> {},
- () -> {},
- () -> {},
- onUpdate(
- from(
- serviceUpdate,
- __ ->
- atomicReference.set(
- String.valueOf(csr.getServiceReference().getProperty("property"))))
- ))
+ csr -> csr.getServiceReference().getProperty("property").equals("refresh")
+ ).effects(
+ csr -> {
+ atomicReference.set(String.valueOf(csr.getServiceReference().getProperty("property")));
+
+ atomicInteger.incrementAndGet();
+ },
+ __ -> {},
+ __ -> {},
+ __ -> {},
+ csr ->
+ atomicReference.set(
+ String.valueOf(csr.getServiceReference().getProperty("property")))
);
program.run(bundleContext);