Skip to content

Commit

Permalink
Removed deprecated Specs
Browse files Browse the repository at this point in the history
- added readme's

Signed-off-by: Mark Hoffmann <m.hoffmann@data-in-motion.biz>
  • Loading branch information
maho7791 committed Sep 2, 2023
1 parent f92f6f7 commit 5f35bad
Show file tree
Hide file tree
Showing 60 changed files with 481 additions and 577 deletions.
12 changes: 12 additions & 0 deletions cnf/application.log
Expand Up @@ -444,3 +444,15 @@ Caused by: java.lang.IllegalStateException: InjectionManagerFactory not found.
2023.02.17 14:03:58,667 INFO [FelixStartLevel] org.eclipse.jetty.server.Server: Started Server@3abd06de{STARTING}[11.0.13,sto=0] @1069ms
2023.02.17 14:03:58,713 INFO [FelixStartLevel] org.eclipse.jetty.server.AbstractConnector: Started ServerConnector@32c6b470{HTTP/1.1, (http/1.1)}{0.0.0.0:8080}
2023.02.17 14:03:58,715 INFO [FelixStartLevel] org.apache.felix.http: Started Jetty 11.0.13 at port(s) HTTP:8080 on context path / [minThreads=8,maxThreads=200,acceptors=1,selectors=6]
2023.09.02 14:28:33,214 INFO [FelixStartLevel] org.eclipse.jetty.server.Server: jetty-11.0.13; built: 2022-12-07T20:47:15.149Z; git: a04bd1ccf844cf9bebc12129335d7493111cbff6; jvm 17.0.8.1+1-Ubuntu-0ubuntu122.04
2023.09.02 14:28:33,255 INFO [FelixStartLevel] org.eclipse.jetty.server.session.DefaultSessionIdManager: Session workerName=node0
2023.09.02 14:28:33,263 INFO [FelixStartLevel] org.eclipse.jetty.server.handler.ContextHandler: Started o.e.j.s.ServletContextHandler@3bd7c854{/,null,AVAILABLE}
2023.09.02 14:28:33,264 INFO [FelixStartLevel] org.eclipse.jetty.server.Server: Started Server@53134114{STARTING}[11.0.13,sto=0] @766ms
2023.09.02 14:28:33,285 INFO [FelixStartLevel] org.eclipse.jetty.server.AbstractConnector: Started ServerConnector@59cac307{HTTP/1.1, (http/1.1)}{0.0.0.0:8080}
2023.09.02 14:28:33,286 INFO [FelixStartLevel] org.apache.felix.http: Started Jetty 11.0.13 at port(s) HTTP:8080 on context path / [minThreads=8,maxThreads=200,acceptors=2,selectors=8]
2023.09.02 14:35:28,034 INFO [Start Level: Equinox Container: 1f1164d1-7fbc-4738-ab7e-e1befaa761bf] org.eclipse.jetty.server.Server: jetty-11.0.13; built: 2022-12-07T20:47:15.149Z; git: a04bd1ccf844cf9bebc12129335d7493111cbff6; jvm 17.0.8.1+1-Ubuntu-0ubuntu122.04
2023.09.02 14:35:28,153 INFO [Start Level: Equinox Container: 1f1164d1-7fbc-4738-ab7e-e1befaa761bf] org.eclipse.jetty.server.session.DefaultSessionIdManager: Session workerName=node0
2023.09.02 14:35:28,182 INFO [Start Level: Equinox Container: 1f1164d1-7fbc-4738-ab7e-e1befaa761bf] org.eclipse.jetty.server.handler.ContextHandler: Started o.e.j.s.ServletContextHandler@3e05ca06{/,null,AVAILABLE}
2023.09.02 14:35:28,187 INFO [Start Level: Equinox Container: 1f1164d1-7fbc-4738-ab7e-e1befaa761bf] org.eclipse.jetty.server.Server: Started Server@4491ac88{STARTING}[11.0.13,sto=0] @1201ms
2023.09.02 14:35:28,276 INFO [Start Level: Equinox Container: 1f1164d1-7fbc-4738-ab7e-e1befaa761bf] org.eclipse.jetty.server.AbstractConnector: Started ServerConnector@3e11a389{HTTP/1.1, (http/1.1)}{0.0.0.0:8080}
2023.09.02 14:35:28,278 INFO [Start Level: Equinox Container: 1f1164d1-7fbc-4738-ab7e-e1befaa761bf] org.apache.felix.http: Started Jetty 11.0.13 at port(s) HTTP:8080 on context path / [minThreads=8,maxThreads=200,acceptors=2,selectors=8]
38 changes: 38 additions & 0 deletions cnf/osgi.log
Expand Up @@ -633,3 +633,41 @@
2023.02.17 13:59:40,098 INFO [Start Level: Equinox Container: c53e8998-c4e8-4834-be61-3c6ad74bbc1c] Events.Bundle.slf4j.api: BundleEvent STARTING
2023.02.17 13:59:40,098 INFO [Start Level: Equinox Container: c53e8998-c4e8-4834-be61-3c6ad74bbc1c] Events.Bundle.slf4j.api: BundleEvent STARTED
2023.02.17 13:59:40,099 INFO [Framework Event Dispatcher: Equinox Container: c53e8998-c4e8-4834-be61-3c6ad74bbc1c] Events.Framework.org.eclipse.osgi: FrameworkEvent STARTLEVEL CHANGED
2023.09.02 14:35:27,773 INFO [Start Level: Equinox Container: 1f1164d1-7fbc-4738-ab7e-e1befaa761bf] Events.Bundle.org.gecko.playground.logging.log4j: BundleEvent STARTED
2023.09.02 14:35:27,774 INFO [Start Level: Equinox Container: 1f1164d1-7fbc-4738-ab7e-e1befaa761bf] Events.Bundle.org.apache.felix.gogo.command: BundleEvent STARTING
2023.09.02 14:35:27,776 INFO [Start Level: Equinox Container: 1f1164d1-7fbc-4738-ab7e-e1befaa761bf] Events.Service.org.apache.felix.gogo.command: ServiceEvent REGISTERED
2023.09.02 14:35:27,777 INFO [Start Level: Equinox Container: 1f1164d1-7fbc-4738-ab7e-e1befaa761bf] Events.Service.org.apache.felix.gogo.command: ServiceEvent REGISTERED
2023.09.02 14:35:27,777 INFO [Start Level: Equinox Container: 1f1164d1-7fbc-4738-ab7e-e1befaa761bf] Events.Service.org.apache.felix.gogo.command: ServiceEvent REGISTERED
2023.09.02 14:35:27,777 INFO [Start Level: Equinox Container: 1f1164d1-7fbc-4738-ab7e-e1befaa761bf] Events.Bundle.org.apache.felix.gogo.command: BundleEvent STARTED
2023.09.02 14:35:27,778 INFO [Start Level: Equinox Container: 1f1164d1-7fbc-4738-ab7e-e1befaa761bf] Events.Bundle.org.apache.felix.gogo.shell: BundleEvent STARTING
2023.09.02 14:35:27,779 INFO [Start Level: Equinox Container: 1f1164d1-7fbc-4738-ab7e-e1befaa761bf] Events.Bundle.org.apache.felix.gogo.shell: BundleEvent STARTED
2023.09.02 14:35:27,779 INFO [Start Level: Equinox Container: 1f1164d1-7fbc-4738-ab7e-e1befaa761bf] Events.Bundle.org.gecko.playground.wab: BundleEvent STARTING
2023.09.02 14:35:27,779 INFO [Start Level: Equinox Container: 1f1164d1-7fbc-4738-ab7e-e1befaa761bf] Events.Bundle.org.gecko.playground.wab: BundleEvent STARTED
2023.09.02 14:35:27,780 INFO [Start Level: Equinox Container: 1f1164d1-7fbc-4738-ab7e-e1befaa761bf] Events.Bundle.org.apache.felix.gogo.runtime: BundleEvent STARTING
2023.09.02 14:35:27,782 INFO [Start Level: Equinox Container: 1f1164d1-7fbc-4738-ab7e-e1befaa761bf] Events.Service.org.apache.felix.gogo.runtime: ServiceEvent REGISTERED
2023.09.02 14:35:27,784 INFO [Start Level: Equinox Container: 1f1164d1-7fbc-4738-ab7e-e1befaa761bf] Events.Service.org.apache.felix.gogo.runtime: ServiceEvent REGISTERED
2023.09.02 14:35:27,784 INFO [Start Level: Equinox Container: 1f1164d1-7fbc-4738-ab7e-e1befaa761bf] Events.Service.org.apache.felix.gogo.shell: ServiceEvent REGISTERED
2023.09.02 14:35:27,785 INFO [Start Level: Equinox Container: 1f1164d1-7fbc-4738-ab7e-e1befaa761bf] Events.Service.org.apache.felix.gogo.shell: ServiceEvent REGISTERED
2023.09.02 14:35:27,785 INFO [Start Level: Equinox Container: 1f1164d1-7fbc-4738-ab7e-e1befaa761bf] Events.Service.org.apache.felix.gogo.shell: ServiceEvent REGISTERED
2023.09.02 14:35:27,786 INFO [Start Level: Equinox Container: 1f1164d1-7fbc-4738-ab7e-e1befaa761bf] Events.Service.org.apache.felix.gogo.shell: ServiceEvent REGISTERED
2023.09.02 14:35:27,787 INFO [Start Level: Equinox Container: 1f1164d1-7fbc-4738-ab7e-e1befaa761bf] Events.Service.org.apache.felix.gogo.shell: ServiceEvent REGISTERED
2023.09.02 14:35:27,788 INFO [Start Level: Equinox Container: 1f1164d1-7fbc-4738-ab7e-e1befaa761bf] Events.Service.org.apache.felix.gogo.shell: ServiceEvent REGISTERED
2023.09.02 14:35:27,790 INFO [Start Level: Equinox Container: 1f1164d1-7fbc-4738-ab7e-e1befaa761bf] Events.Bundle.org.apache.felix.gogo.runtime: BundleEvent STARTED
2023.09.02 14:35:27,790 INFO [Start Level: Equinox Container: 1f1164d1-7fbc-4738-ab7e-e1befaa761bf] Events.Bundle.org.apache.felix.http.jetty: BundleEvent STARTING
2023.09.02 14:35:27,808 INFO [Start Level: Equinox Container: 1f1164d1-7fbc-4738-ab7e-e1befaa761bf] Events.Service.org.apache.felix.http.jetty: ServiceEvent REGISTERED
2023.09.02 14:35:27,815 INFO [Start Level: Equinox Container: 1f1164d1-7fbc-4738-ab7e-e1befaa761bf] Events.Service.org.apache.felix.http.jetty: ServiceEvent REGISTERED
2023.09.02 14:35:27,857 INFO [Start Level: Equinox Container: 1f1164d1-7fbc-4738-ab7e-e1befaa761bf] Events.Service.org.apache.felix.http.jetty: ServiceEvent REGISTERED
2023.09.02 14:35:28,290 INFO [Start Level: Equinox Container: 1f1164d1-7fbc-4738-ab7e-e1befaa761bf] Events.Service.org.apache.felix.http.jetty: ServiceEvent REGISTERED
2023.09.02 14:35:28,291 INFO [Start Level: Equinox Container: 1f1164d1-7fbc-4738-ab7e-e1befaa761bf] Events.Service.org.apache.felix.http.jetty: ServiceEvent REGISTERED
2023.09.02 14:35:28,293 INFO [Start Level: Equinox Container: 1f1164d1-7fbc-4738-ab7e-e1befaa761bf] Events.Service.org.apache.felix.http.jetty: ServiceEvent REGISTERED
2023.09.02 14:35:28,307 INFO [Start Level: Equinox Container: 1f1164d1-7fbc-4738-ab7e-e1befaa761bf] Events.Service.org.apache.felix.http.jetty: ServiceEvent REGISTERED
2023.09.02 14:35:28,307 INFO [Start Level: Equinox Container: 1f1164d1-7fbc-4738-ab7e-e1befaa761bf] Events.Service.org.apache.felix.http.jetty: ServiceEvent REGISTERED
2023.09.02 14:35:28,308 INFO [Start Level: Equinox Container: 1f1164d1-7fbc-4738-ab7e-e1befaa761bf] Events.Service.org.apache.felix.http.jetty: ServiceEvent REGISTERED
2023.09.02 14:35:28,308 INFO [Start Level: Equinox Container: 1f1164d1-7fbc-4738-ab7e-e1befaa761bf] Events.Bundle.org.apache.felix.http.jetty: BundleEvent STARTED
2023.09.02 14:35:28,308 INFO [Start Level: Equinox Container: 1f1164d1-7fbc-4738-ab7e-e1befaa761bf] Events.Bundle.org.apache.felix.http.servlet-api: BundleEvent STARTING
2023.09.02 14:35:28,310 INFO [Start Level: Equinox Container: 1f1164d1-7fbc-4738-ab7e-e1befaa761bf] Events.Bundle.org.apache.felix.http.servlet-api: BundleEvent STARTED
2023.09.02 14:35:28,310 INFO [Start Level: Equinox Container: 1f1164d1-7fbc-4738-ab7e-e1befaa761bf] Events.Bundle.org.apache.logging.log4j.slf4j-impl: BundleEvent STARTING
2023.09.02 14:35:28,310 INFO [Start Level: Equinox Container: 1f1164d1-7fbc-4738-ab7e-e1befaa761bf] Events.Bundle.org.apache.logging.log4j.slf4j-impl: BundleEvent STARTED
2023.09.02 14:35:28,311 INFO [Start Level: Equinox Container: 1f1164d1-7fbc-4738-ab7e-e1befaa761bf] Events.Bundle.slf4j.api: BundleEvent STARTING
2023.09.02 14:35:28,311 INFO [Start Level: Equinox Container: 1f1164d1-7fbc-4738-ab7e-e1befaa761bf] Events.Bundle.slf4j.api: BundleEvent STARTED
2023.09.02 14:35:28,312 INFO [Framework Event Dispatcher: Equinox Container: 1f1164d1-7fbc-4738-ab7e-e1befaa761bf] Events.Framework.org.eclipse.osgi: FrameworkEvent STARTLEVEL CHANGED
12 changes: 6 additions & 6 deletions org.gecko.playground.e4.rcp/Application.e4xmi
Expand Up @@ -43,12 +43,12 @@
<children xmi:id="_6wlLesgZEeSyMNYR5xypkQ" elementId="org.eclipse.ui.contexts.window" name="In Windows"/>
<children xmi:id="_6wlLe8gZEeSyMNYR5xypkQ" elementId="org.eclipse.ui.contexts.dialog" name="In Dialogs"/>
</rootContext>
<commands xmi:id="_6wlLfMgZEeSyMNYR5xypkQ" elementId="org.eclipse.ui.menu.exit" commandName="quitCommand"/>
<commands xmi:id="_6wlLgMgZEeSyMNYR5xypkQ" elementId="org.eclipse.ui.menu.form" commandName="formCommand"/>
<commands xmi:id="_6wlLg8gZEeSyMNYR5xypkQ" elementId="org.eclipse.ui.menu.search" commandName="searchCommand"/>
<commands xmi:id="_6wlLhsgZEeSyMNYR5xypkQ" elementId="org.eclipse.ui.help.aboutAction" commandName="aboutCommand"/>
<commands xmi:id="_5lqhUMJDEe2GialD90Jrog" elementId="org.eclipse.ui.help.saveAction" commandName="saveCommand"/>
<commands xmi:id="_P2KqwMJLEe2GialD90Jrog" elementId="org.eclipse.ui.help.exitFormAction" commandName="exitFormCommand"/>
<commands xmi:id="_6wlLfMgZEeSyMNYR5xypkQ" elementId="org.eclipse.ui.menu.exit" commandName="Quit"/>
<commands xmi:id="_6wlLgMgZEeSyMNYR5xypkQ" elementId="org.eclipse.ui.menu.form" commandName="New Person" description="Create a new Person"/>
<commands xmi:id="_6wlLg8gZEeSyMNYR5xypkQ" elementId="org.eclipse.ui.menu.search" commandName="Search Person" description="Search Persons by Lastname, Firstname"/>
<commands xmi:id="_6wlLhsgZEeSyMNYR5xypkQ" elementId="org.eclipse.ui.help.aboutAction" commandName="About"/>
<commands xmi:id="_5lqhUMJDEe2GialD90Jrog" elementId="org.eclipse.ui.help.saveAction" commandName="Save"/>
<commands xmi:id="_P2KqwMJLEe2GialD90Jrog" elementId="org.eclipse.ui.help.exitFormAction" commandName="Exit"/>
<addons xmi:id="_6wlLcsgZEeSyMNYR5xypkQ" elementId="org.eclipse.e4.core.commands.service" contributionURI="bundleclass://org.eclipse.e4.core.commands/org.eclipse.e4.core.commands.CommandServiceAddon"/>
<addons xmi:id="_6wlLc8gZEeSyMNYR5xypkQ" elementId="org.eclipse.e4.ui.contexts.service" contributionURI="bundleclass://org.eclipse.e4.ui.services/org.eclipse.e4.ui.services.ContextServiceAddon"/>
<addons xmi:id="_6wlLdMgZEeSyMNYR5xypkQ" elementId="org.eclipse.e4.ui.bindings.service" contributionURI="bundleclass://org.eclipse.e4.ui.bindings/org.eclipse.e4.ui.bindings.BindingServiceAddon"/>
Expand Down
24 changes: 23 additions & 1 deletion org.gecko.playground.e4.rcp/README.MD
@@ -1,3 +1,4 @@
# Bnd Launch and Export
This project is a simple Example that represents the default Eclipse E4 Application with sample content the PDE also provides.

If you want to modify it, only add -runrequire bundles in the **launch_base.bndrun** and resolve only the **launch_base.bndrun**.
Expand All @@ -6,4 +7,25 @@ To start or export use the *launch_linux* or *launch_win32* because they contain

What OS Specific launcher to use, will be determined via the `-runsystemcapabilities'. If you use the `native_capability` Macro without any parameters, it will use the ones of your current system.

You may realize that the splash screen appears only for a blink of an eye. This is because the application starts to quick :-)
You may realize that the splash screen appears only for a blink of an eye. This is because the application starts to quick :-)

# The Application

## Precondition

You need a running mongo database as backing storage.

In addition to that this RCP uses the following *playground* projects:

* org.gecko.playground.lucene - using OSGyfied Lucene
* org.gecko.playground.model - an EMF example data model for our person
* org.gecko.playground.search - an search service for our persons
* org.gecko.playground.mongo - Persistence service using MongoDB backing including the configuration in */config/config.json*
* org.gecko.playground.e4.rcp - the RCP application

## Features

In the RCP there are:

* Create Person form - Create a new person, save it into the database using the save icon
* Search Person Form - Look for persons using lucene search. To search for all, leave the text field empty and press search
2 changes: 1 addition & 1 deletion org.gecko.playground.e4.rcp/launch_base.bndrun
Expand Up @@ -142,7 +142,7 @@
org.osgi.util.converter;version='[1.0.9,1.0.10)',\
org.osgi.util.pushstream;version='[1.1.0,1.1.1)',\
org.apache.felix.configadmin;version='[1.9.26,1.9.27)',\
org.eclipse.parsson.jakarta.json;version='[1.1.1,1.1.2)',\
org.eclipse.parsson.jakarta.json;version='[1.1.2,1.1.3)',\
com.google.guava;version='[31.1.0,31.1.1)',\
com.google.guava.failureaccess;version='[1.0.1,1.0.2)',\
org.gecko.emf.repository.api;version='[9.2.2,9.2.3)',\
Expand Down
Binary file not shown.
Expand Up @@ -26,7 +26,12 @@ public void run() {
// Exit from main loop
break;
} catch (Exception e) {
log.error("Error handling event: ", e);
if (log != null) {
log.error("Error handling event: ", e);
} else {
System.err.println("Error handling event: ");
e.printStackTrace();
}
}
}
}
Expand Down
4 changes: 4 additions & 0 deletions org.gecko.playground.http.jersey/README.md
@@ -0,0 +1,4 @@
# `org.gecko.playground.http.jersey`

This project is just a companion bundle that shows OSGi *@Requirement* annotations in *@RequireJersey*

13 changes: 13 additions & 0 deletions org.gecko.playground.httpwhiteboard/README.md
@@ -0,0 +1,13 @@
# `org.gecko.playground.httpwhiteboard`

This project shows how to use Jakarta Servlets in OSGi using the Servlet whiteboard.

It contains a Servlets, registered as services and static resource configurations.

The URLs are like this:

* *HelloWorldServlet* - [http://localhost:8080/hello](http://localhost:8080/hello)
* *ResourceService* for static resources:
* [http://localhost:8080/myapp/index.html](http://localhost:8080/myapp/index.html) or
* [http://localhost:8080/myapp/d3-demo2.html](http://localhost:8080/myapp/d3-demo2.html)

5 changes: 5 additions & 0 deletions org.gecko.playground.jaxb/README.md
@@ -0,0 +1,5 @@
# `org.gecko.playground.jaxb`

This project show an OSGi setup for JAXB. The important thing is to make JAXB find its implementation in an post Java 8 setup.

For this we use the HK2-OSGi-ResourceLocator, that is called as part of the JAXB API implementation finding search order.
20 changes: 20 additions & 0 deletions org.gecko.playground.logging/README.md
@@ -0,0 +1,20 @@
# `org.gecko.playground.logging`

This project is a multi bundle project in bndtools. This means on project can generate multiple bundles. This is a simple bridge to log various logging API's:

* slf4j
* Java Util Logging
* log4j
* OSGi Log

into one Log4j2 backend.

The corresponding log4j2 configuration is located in *config/log4j2.xml* and you will find the resulting log file *gecko.log* in *cnf/logs/gecko.log*

```
2023.09.02 14:46:33,784 INFO [Start Level: Equinox Container: b11aaa01-5f0e-4d8b-89f7-f771e0ba2703] org.gecko.playground.logging.test.LoggingComponent: Activate with Log4J
2023.09.02 14:46:33,785 INFO [Start Level: Equinox Container: b11aaa01-5f0e-4d8b-89f7-f771e0ba2703] org.gecko.playground.logging.test.LoggingComponent: Activate with SLF4J
2023.09.02 14:46:33,785 INFO [Start Level: Equinox Container: b11aaa01-5f0e-4d8b-89f7-f771e0ba2703] org.gecko.playground.logging.test.LoggingComponent: Activate with OSGi Logging
```

These log entries come out of *LoggingComponent*, that test logging with different log API's.
25 changes: 25 additions & 0 deletions org.gecko.playground.mongo/README.md
@@ -0,0 +1,25 @@
# `org.gecko.playground.mongo`

This project shows how to use a mongo-backed service to store and retrieve persons from an EMF model *org.gecko.playground.model*.

The console *help* shows the commands:

* `persistence:getPerson`
* `persistence:savePerson`

Here is an example:

```
g! savePerson Emil Tester
Sept. 02, 2023 12:31:33 PM com.mongodb.diagnostics.logging.JULLogger log
INFORMATION: Opened connection [connectionId{localValue:2, serverValue:13}] to mongodb:27017
Saved Person in db with id 64f30f04f4bcc54824b1b8e5
g! getPerson 64f30f04f4bcc54824b1b8e5
Retrieved Person with id 64f30f04f4bcc54824b1b8e5 from db: Emil Tester
```

This service is also used by the *playground.e4.rcp* example and the *playground.vaadin* applications as part of a more complex, re-usable part.

9 changes: 4 additions & 5 deletions org.gecko.playground.mongo/launch.bndrun
Expand Up @@ -9,10 +9,7 @@
org.apache.felix.gogo.runtime;version='[1.1.6,1.1.7)',\
org.apache.felix.gogo.shell;version='[1.1.4,1.1.5)',\
org.apache.felix.scr;version='[2.2.6,2.2.7)',\
org.eclipse.emf.common;version='[2.27.0,2.27.1)',\
org.eclipse.emf.ecore;version='[2.29.0,2.29.1)',\
org.eclipse.emf.ecore.xmi;version='[2.17.0,2.17.1)',\
org.eclipse.emf.gwt.common;version='[2.13.0,2.13.1)',\
org.eclipse.equinox.cm;version='[1.5.100,1.5.101)',\
org.gecko.emf.collections;version='[2.1.1,2.1.2)',\
org.gecko.emf.mongo.api;version='[6.0.0,6.0.1)',\
Expand All @@ -32,10 +29,12 @@
org.osgi.util.converter;version='[1.0.9,1.0.10)',\
org.osgi.util.function;version='[1.2.0,1.2.1)',\
org.osgi.util.promise;version='[1.3.0,1.3.1)',\
org.eclipse.parsson.jakarta.json;version='[1.1.1,1.1.2)',\
org.gecko.emf.mongo.pushstream;version='[6.0.0,6.0.1)',\
org.gecko.emf.pushstreams;version='[1.1.1,1.1.2)',\
org.osgi.util.pushstream;version='[1.1.0,1.1.1)'
org.osgi.util.pushstream;version='[1.1.0,1.1.1)',\
org.eclipse.emf.common;version='[2.28.0,2.28.1)',\
org.eclipse.emf.ecore;version='[2.33.0,2.33.1)',\
org.eclipse.parsson.jakarta.json;version='[1.1.2,1.1.3)'

-runrequires: \
osgi.identity;filter:='(osgi.identity=org.apache.felix.gogo.shell)',\
Expand Down
47 changes: 47 additions & 0 deletions org.gecko.playground.promise/README.md
@@ -0,0 +1,47 @@
# `org.gecko.playground.promise`

This project shows how to use asynchronous programming with OSGi Promises. The example shows how to use a `Deferred`, to hook in external frameworks and use their callbacks to trigger resolving of promises. This is a more advanced example, than the usual promises stuff.

When starting the programm, you will see:

```
g! Scheduling database connection (main)
Finished activation (main)
```

After 15 seconds the database is connected and sends the resolved state:

```
Try connecting to database ... (pool-4-thread-1)
Database seems available: Doing sthg with the database ...
Database ID: CONID-b152b893-8961-4da7-8a80-11bf800a844a
```

The `list` command shows you two components:

```
g! list
org.gecko.playground.promise.DatabaseDriverComponent in bundle 3 (org.gecko.playground.promise:1.0.0.202309021036-SNAPSHOT) enabled, 1 instance.
Id: 1, State:ACTIVE
org.gecko.playground.promise.DatabaseAvailableChecker in bundle 3 (org.gecko.playground.promise:1.0.0.202309021036-SNAPSHOT) enabled, 1 instance.
Id: 0, State:ACTIVE
```



If you e.g. stop the *DatabaseDriverComponent* with:

```
g! disable org.gecko.playground.promise.DatabaseDriverComponent
```

you will see, that the promise informs, that the database will be disconnected gracefully:

```
Disconnected Database with ID: b152b893-8961-4da7-8a80-11bf800a844a
true
Database has gone! Stop working with database!
```



0 comments on commit 5f35bad

Please sign in to comment.