You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@aries.apache.org by ro...@apache.org on 2021/04/08 15:22:50 UTC
[aries-component-dsl] branch master updated (9efbc64 -> 1ed28af)
This is an automated email from the ASF dual-hosted git repository.
rotty3000 pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/aries-component-dsl.git.
from 9efbc64 update dependencies and simplify integration testing layout
new a656fbb flatten poms
new 5943258 don't deploy/install itests
new 1ed28af fix code snippets for proper highlighting
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:
README.md | 129 +++++++++++++++++++++++++++++++++------------------------
itests/pom.xml | 5 +++
pom.xml | 24 +++++++++++
3 files changed, 104 insertions(+), 54 deletions(-)
[aries-component-dsl] 02/03: don't deploy/install itests
Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
rotty3000 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/aries-component-dsl.git
commit 59432585bb880efb741fef2b14543f681bc542a5
Author: Raymond Augé <ra...@liferay.com>
AuthorDate: Thu Apr 8 10:51:24 2021 -0400
don't deploy/install itests
Signed-off-by: Raymond Augé <ra...@liferay.com>
---
itests/pom.xml | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/itests/pom.xml b/itests/pom.xml
index b31c70c..656d0c5 100644
--- a/itests/pom.xml
+++ b/itests/pom.xml
@@ -29,6 +29,11 @@
<description>Apache Aries Component DSL Integration Tests</description>
<name>Apache Aries Component DSL Integration Tests</name>
+ <properties>
+ <maven.deploy.skip>true</maven.deploy.skip>
+ <maven.install.skip>true</maven.install.skip>
+ </properties>
+
<dependencies>
<dependency>
<groupId>org.apache.aries.component-dsl</groupId>
[aries-component-dsl] 01/03: flatten poms
Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
rotty3000 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/aries-component-dsl.git
commit a656fbba70a5096ce1e4f2a30e3a2e73efd72e7d
Author: Raymond Augé <ra...@liferay.com>
AuthorDate: Thu Apr 8 10:51:06 2021 -0400
flatten poms
Signed-off-by: Raymond Augé <ra...@liferay.com>
---
pom.xml | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)
diff --git a/pom.xml b/pom.xml
index 800b89a..7436969 100644
--- a/pom.xml
+++ b/pom.xml
@@ -69,6 +69,30 @@
</execution>
</executions>
</plugin>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>flatten-maven-plugin</artifactId>
+ <version>1.2.7</version>
+ <configuration>
+ <flattenMode>oss</flattenMode>
+ </configuration>
+ <executions>
+ <execution>
+ <id>flatten</id>
+ <phase>process-resources</phase>
+ <goals>
+ <goal>flatten</goal>
+ </goals>
+ </execution>
+ <execution>
+ <id>flatten-clean</id>
+ <phase>clean</phase>
+ <goals>
+ <goal>clean</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
</plugins>
</build>
[aries-component-dsl] 03/03: fix code snippets for proper
highlighting
Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
rotty3000 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/aries-component-dsl.git
commit 1ed28af4609f07335b1e0c0080116ceffa659f8e
Author: Raymond Augé <ra...@liferay.com>
AuthorDate: Thu Apr 8 10:57:14 2021 -0400
fix code snippets for proper highlighting
Signed-off-by: Raymond Augé <ra...@liferay.com>
---
README.md | 129 ++++++++++++++++++++++++++++++++++++--------------------------
1 file changed, 75 insertions(+), 54 deletions(-)
diff --git a/README.md b/README.md
index 958159c..7e60305 100644
--- a/README.md
+++ b/README.md
@@ -31,13 +31,16 @@ The foundation of the DSL is one type `OSGi<T>`. There exist several static
functions defined on the `OSGi` class that provide us with instances of the
type. Let's start getting a reference to a service:
- OSGi<Service> program = OSGi.service(OSGi.serviceReferences(Service.class));
+```java
+OSGi<Service> program = OSGi.service(OSGi.serviceReferences(Service.class));
+```
if we allow static imports from `OSGi` class we can type the former as:
- OSGi<Service> services = service(serviceReferences(Service.class));
- OSGi<Dictionary<String, ?>> configurations = configurations("factory-pid");
-
+```java
+OSGi<Service> services = service(serviceReferences(Service.class));
+OSGi<Dictionary<String, ?>> configurations = configurations("factory-pid");
+```
### Combining operations
@@ -45,30 +48,36 @@ Once we have instances of `OSGi` we can combine them. We can use `flatMap` to
specify that one operation depends on a previous one. For example we could need
to specify a filter for the services that comes in the configuration:
- OSGi<Service> services = configurations("factory-pid").flatMap(conf ->
- service(serviceReferences(Service.class, conf.get("service.filter").toString()))
- );
+```java
+OSGi<Service> services = configurations("factory-pid").flatMap(conf ->
+ service(serviceReferences(Service.class, conf.get("service.filter").toString()))
+);
+```
we can also register instances. For this purpose let's create a new class that
will hold instances of both `Dictionary<String, ?>` and `Service`.
- class Holder {
-
- Dictionary<String, ?> properties;
- Service service;
+```java
+class Holder {
- public Holder(Dictionary<String, ?> properties, Service service) {
- this.properties = properties;
- this.service = service;
- }
+ Dictionary<String, ?> properties;
+ Service service;
+ public Holder(Dictionary<String, ?> properties, Service service) {
+ this.properties = properties;
+ this.service = service;
}
+}
+```
+
and we can register instances of that class with:
- OSGi<ServiceRegistration<Holder>> program = configurations("factory-pid").flatMap(conf ->
- service(serviceReferences(Service.class, conf.get("service.filter").toString())).flatMap(service ->
- register(Holder.class, new Holder(conf, service), new HashMap<>())));
+```java
+OSGi<ServiceRegistration<Holder>> program = configurations("factory-pid").flatMap(conf ->
+ service(serviceReferences(Service.class, conf.get("service.filter").toString())).flatMap(service ->
+ register(Holder.class, new Holder(conf, service), new HashMap<>())));
+```
in this example we are tracking factory configurations from pid
`factory-pid`. For each configuration factory that's there, or that's created in
@@ -91,15 +100,19 @@ programs like reusable components.
Once you have a complete specification you can run it passing a `BundleContext`
to it:
- OSGi<T> program;
- BundleContext bundleContext;
+```java
+OSGi<T> program;
+BundleContext bundleContext;
- OSGiResult result = program.run(bundleContext);
+OSGiResult result = program.run(bundleContext);
+```
the `OSGiResult` instance references the execution of the program. To stop and
clean it we call:
- result.close()
+```java
+result.close()
+```
### Combinations without dependency
@@ -107,8 +120,9 @@ we can also specify combinations when there exist no dependencies between the
operations. For instance we can declare we want to register a `Holder` for every
configuration + service combination using `OSGi.combine`:
- OSGi<Holder> holders = combine(Holder::new, configurations("factory.pid"), services(Service.class));
-
+```java
+OSGi<Holder> holders = combine(Holder::new, configurations("factory.pid"), services(Service.class));
+```
## Predefined Operations
@@ -127,22 +141,24 @@ There are two operations to deal with `Configuration Admin` configurations:
`OSGi.serviceReferences` is a set of overloaded functions that return operations
of type `OSGi<CachingServiceReference>`:
- OSGi<CachingServiceReference<T>> serviceReferences(Class<T> clazz)
+```java
+OSGi<CachingServiceReference<T>> serviceReferences(Class<T> clazz)
- OSGi<CachingServiceReference<Object>> serviceReferences(String filterString)
+OSGi<CachingServiceReference<Object>> serviceReferences(String filterString)
- OSGi<CachingServiceReference<T>> serviceReferences(Class<T> clazz, String filterString)
+OSGi<CachingServiceReference<T>> serviceReferences(Class<T> clazz, String filterString)
- OSGi<CachingServiceReference<T>> serviceReferences(
- Class<T> clazz, String filterString,
- Refresher<? super CachingServiceReference<T>> onModified)
+OSGi<CachingServiceReference<T>> serviceReferences(
+ Class<T> clazz, String filterString,
+ Refresher<? super CachingServiceReference<T>> onModified)
- OSGi<CachingServiceReference<T>> serviceReferences(
- Class<T> clazz, Refresher<? super CachingServiceReference<T>> onModified)
+OSGi<CachingServiceReference<T>> serviceReferences(
+ Class<T> clazz, Refresher<? super CachingServiceReference<T>> onModified)
- OSGi<CachingServiceReference<Object>> serviceReferences(
- String filterString,
- Refresher<? super CachingServiceReference<Object>> onModified)
+OSGi<CachingServiceReference<Object>> serviceReferences(
+ String filterString,
+ Refresher<? super CachingServiceReference<Object>> onModified)
+```
#### CachingServiceReference<T>
@@ -200,25 +216,27 @@ the library offers `register` set of functions. When the associated instances
are retracted, `register` set of functions also unregister their instances as a
result.
- OSGi<ServiceRegistration<T>> register(
- Class<T> clazz, ServiceFactory<T> service,
- Map<String, Object> properties)
+```java
+OSGi<ServiceRegistration<T>> register(
+ Class<T> clazz, ServiceFactory<T> service,
+ Map<String, Object> properties)
- OSGi<ServiceRegistration<?>> register(
- String[] classes, Object service, Map<String, ?> properties)
+OSGi<ServiceRegistration<?>> register(
+ String[] classes, Object service, Map<String, ?> properties)
- OSGi<ServiceRegistration<T>> register(
- Class<T> clazz, Supplier<T> service,
- Supplier<Map<String, ?>> properties)
+OSGi<ServiceRegistration<T>> register(
+ Class<T> clazz, Supplier<T> service,
+ Supplier<Map<String, ?>> properties)
- OSGi<ServiceRegistration<T>> register(
- Class<T> clazz, ServiceFactory<T> service,
- Supplier<Map<String, ?>> properties)
+OSGi<ServiceRegistration<T>> register(
+ Class<T> clazz, ServiceFactory<T> service,
+ Supplier<Map<String, ?>> properties)
- OSGi<ServiceRegistration<?>> register(
- String[] classes, Supplier<Object> service,
- Supplier<Map<String, ?>> properties)
+OSGi<ServiceRegistration<?>> register(
+ String[] classes, Supplier<Object> service,
+ Supplier<Map<String, ?>> properties)
+```
## Combinators
@@ -234,10 +252,12 @@ all the elements that the given programs produce.
given as argument, from left to right. Since OSGi is a dynamic environment
`coalesce` will retract and reintroduce instances when needed. For example:
- OSGi<Dictionary<String, ?>> props = coalesce(
- configuration("some.config.pid"),
- just(Hashtable::new)
- );
+```java
+OSGi<Dictionary<String, ?>> props = coalesce(
+ configuration("some.config.pid"),
+ just(Hashtable::new)
+);
+```
this operation will return an empty Hashtable while no configuration is
available. If, at any moment, there is a configuration available the operation
@@ -266,7 +286,7 @@ retracted. It won't retract the instance it produces until all the instances it
has _seen_ are gone.
## License
-
+```
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.
@@ -281,3 +301,4 @@ has _seen_ are gone.
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.
+```
\ No newline at end of file