You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+15-13Lines changed: 15 additions & 13 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,25 +2,25 @@
2
2
Demonstration of Declarative Services (DS) in OSGi JVM servers
3
3
4
4
## Preface
5
-
This example shows how OSGi Declarative Services (DS) can be used in OSGi JVM servers to construct modular applications, with the ability to change implementations without loss of service.
5
+
This example shows how OSGi Declarative Services (DS) can be used in an OSGi JVM server to perform application component refresh (change of, or fix to, implementations) without loss of service. Declarative Services removes the need for boilerplate tracking code such as ServiceTrackers, and by moving to a service component architecture from bundle-wiring (Import-Package) you gain all the dynamic refresh and look-up benefits of services. DS handles all the injection of components into your application, and ensures that if a service (or implementation) is removed it can seamlessly switch to a replacement (or updated) service.
6
6
7
-
There are a number of projects in this simple sample (4 OSGi projects, each a corresponding CICS bundle project). However, even a complex application may still fit into this structure, depending on architecture.
7
+
There are 8 projects in this simple sample (4 OSGi projects, and each has a corresponding CICS bundle project). This same architecture can be used for complex applications.
8
8
9
9
Below is a simple diagram which explains the relationships between these projects:
The *CICS App* is the OSGi bundle which contains the CICS main class. It uses the interfaceprovided by the *Storage Interface* to put data into storage and retrieve data from storage.
23
+
The *CICS App* is the OSGi bundle which contains the CICS main class. It uses the interface, or service, provided by the *Storage Service* to put data into storage and retrieve data from storage.
24
24
25
25
In this example, we have two separate implementations of the storage service. Version 1.0.0 is a simple in-memory storage system, which uses Java objects to store data.
26
26
@@ -30,6 +30,8 @@ In our example we follow the scenario that we have the base application running
30
30
31
31
When we first install the new bundle, the TSQ storage service will activate, but the CICS App will remain bound to the in-memory implementation. We can then disable the in-memory implementation. At which point OSGi declarative services will bind the new TSQ service and unbind the in-memory service (in that order). This means the CICS App is never left without a working implementation and therefore avoiding loss of service.
32
32
33
+
We have chosen to separate each component of the application into distinct CICS bundles to give ultimate flexibility.
34
+
33
35
## Supporting Files
34
36
*[com.ibm.cicsdev.osgi.ds.cicsapp_1.0.0](projects/com.ibm.cicsdev.osgi.ds.cicsapp_1.0.0) - CICS application entry point
35
37
*[com.ibm.cicsdev.osgi.ds.cicsapp.bundle_1.0.0](projects/com.ibm.cicsdev.osgi.ds.cicsapp.bundle_1.0.0) - CICS Bundle containing the application, program and transaction definitions.
@@ -41,18 +43,18 @@ When we first install the new bundle, the TSQ storage service will activate, but
41
43
*[com.ibm.cicsdev.osgi.ds.storage.impl.bundle_1.1.0](projects/com.ibm.cicsdev.osgi.ds.storage.impl.bundle_1.1.0) - CICS Bundle for the TSQ implementation
42
44
43
45
## Usage
44
-
1. Deploy all found bundle projects to z/FS
46
+
1. Deploy all the CICS bundle projects to z/FS
45
47
2. Create an OSGi JVM server with the name `DFHOSGI`.
46
48
3. Create CICS bundle definitions for these bundle projects. [Table 1](#table-1) shows the mapping of bundle to bundle name used.
47
-
4. Install the bundles: `DS `, `DS-APP ` and `DS-IMP10`.
49
+
4. Install the bundle definitions: `DS `, `DS-APP ` and `DS-IMP10`.
48
50
5. Run the transaction `DSTS PUT INMEM`, this should display the message `Created entry 1`
49
51
6. Run the transaction `DSTS GET 1`, this should display the message `INMEM`, which confirms the data was stored correctly in-memory
50
52
7. Install the bundle `DS-IMP11`.
51
53
8. Disable the bundle `DS-IMP10`.
52
54
9. Run the transaction `DSTS GET 1`, this should ABEND because the entry was not found in the TSQ.
53
55
10. Run the transaction `DSTS PUT TSQ`, this should display the message `Created entry 1`
54
56
10. Run the transaction `DSTS GET 1`, this should display the message `TSQ`, which confirms the data was stored correctly in the TSQ (confirm by browsing on the TSQ `TSQS`, using the `CEBR` transaction for example).
55
-
11. The standard out (STDOUT) file for the JVM server should display messages which indicate that the in-memory service (version 1.0.0) was first bound. Then later unbound when the bundle was disabled. Then that the TSQ service (1.1.0) was bound in it's place.
57
+
11. The standard out (STDOUT) file for the JVM server should display messages that indicate the in-memory service (version 1.0.0) was first bound. Then later the service will be unbound when the bundle is disabled. You should also see that the TSQ service (1.1.0) is bound in it's place.
0 commit comments