Reorganize methods supporting updates
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 4476539..b6b9487 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
@@ -590,24 +590,6 @@
(__, csr) -> onModified.test(csr));
}
- static <T> OSGi<UpdateTuple<CachingServiceReference<T>>> serviceReferencesUpdatable(
- Class<T> clazz) {
-
- return new ServiceReferenceOSGi<>(null, clazz);
- }
-
- static OSGi<UpdateTuple<CachingServiceReference<Object>>> serviceReferencesUpdatable(
- String filterString) {
-
- return new ServiceReferenceOSGi<>(filterString, null);
- }
-
- static <T> OSGi<UpdateTuple<CachingServiceReference<T>>> serviceReferencesUpdatable(
- Class<T> clazz, String filterString) {
-
- return new ServiceReferenceOSGi<>(filterString, clazz);
- }
-
static <T> OSGi<T> services(Class<T> clazz) {
return services(clazz, null);
}
@@ -658,6 +640,12 @@
return effects(effect.getOnIncoming(), effect.getOnLeaving());
}
+ OSGi<T> effects(
+ Consumer<? super T> onAddedBefore, Consumer<? super T> onAddedAfter,
+ Consumer<? super T> onRemovedBefore,
+ Consumer<? super T> onRemovedAfter,
+ UpdateQuery<T> updateQuery);
+
OSGi<T> filter(Predicate<T> predicate);
<S> OSGi<S> flatMap(Function<? super T, OSGi<? extends S>> fun);
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
new file mode 100644
index 0000000..f1472b4
--- /dev/null
+++ b/component-dsl/src/main/java/org/apache/aries/component/dsl/configuration/Configurations.java
@@ -0,0 +1,35 @@
+/*
+ * 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.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) {
+ return new ConfigurationOSGiImpl(pid);
+ }
+
+ public static OSGi<UpdateTuple<ConfigurationHolder>> factories(String pid) {
+ return new ConfigurationsOSGiImpl(pid);
+ }
+
+}
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 4f54586..686ee2e 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
@@ -234,16 +234,13 @@
return effects(onAddedBefore, onAddedAfter, onRemovedBefore, onRemovedAfter, UpdateQuery.onUpdate());
}
+ @Override
public OSGi<T> effects(
Consumer<? super T> onAddedBefore, Consumer<? super T> onAddedAfter,
Consumer<? super T> onRemovedBefore,
Consumer<? super T> onRemovedAfter,
UpdateQuery<T> updateQuery) {
- //TODO: logging
- //TODO: logging
- //TODO: logging
- //TODO: logging
return new BaseOSGiImpl<>((executionContext, op) ->
run(
executionContext,
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
new file mode 100644
index 0000000..7601989
--- /dev/null
+++ b/component-dsl/src/main/java/org/apache/aries/component/dsl/services/ServiceReferences.java
@@ -0,0 +1,45 @@
+/*
+ * 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.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(
+ Class<T> clazz) {
+
+ return new ServiceReferenceOSGi<>(null, clazz);
+ }
+
+ static OSGi<UpdateTuple<CachingServiceReference<Object>>> withUpdate(
+ String filterString) {
+
+ return new ServiceReferenceOSGi<>(filterString, null);
+ }
+
+ static <T> OSGi<UpdateTuple<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/services/package-info.java b/component-dsl/src/main/java/org/apache/aries/component/dsl/services/package-info.java
new file mode 100644
index 0000000..90da14b
--- /dev/null
+++ b/component-dsl/src/main/java/org/apache/aries/component/dsl/services/package-info.java
@@ -0,0 +1,20 @@
+/*
+ * 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.services;