|
1 |
| -# CICS OSGi Java Hello application |
| 1 | +# CICS OSGi Hello sample application |
2 | 2 |
|
3 |
| -This sample demonstrates a simple Hello World Java application running in a CICS OSGi JVM Server. |
| 3 | +A simple Hello World CICS Java application running in a CICS OSGi JVM server. |
4 | 4 |
|
5 |
| -## Versions |
6 |
| -| CICS TS for z/OS Version | Branch | Minimum Java Version | Build Status | |
7 |
| -|--------------------------|----------------------------------------|----------------------|--------------| |
8 |
| -| 5.5, 5.6 | [cicsts/v5.5](/../../tree/cicsts/v5.5) | 8 | [](https://github.com/cicsdev/cics-java-osgi-hello/actions/workflows/java.yaml) | |
9 |
| -| 6.1 | [cicsts/v6.1](/../../tree/cicsts/v6.1) | 17 | [](https://github.com/cicsdev/cics-java-osgi-hello/actions/workflows/java.yaml) | |
| 5 | + |
| 6 | +## Downloading |
| 7 | + |
| 8 | +- Clone the repository using your IDEs support, such as the Eclipse Git plugin |
| 9 | +- **or**, download the sample as a [ZIP](https://github.com/cicsdev/cics-java-osgi-hello/archive/cicsts/v5.5.zip) and unzip onto the workstation |
| 10 | + |
| 11 | +> [!TIP] |
| 12 | +> Eclipse Git provides an 'Import existing Projects' check-box when cloning a repository. |
| 13 | +
|
| 14 | +--- |
| 15 | + |
| 16 | +## Repository structure |
| 17 | +* [`cics-java-osgi-hello/`](/) - Top-level project |
| 18 | +* [`cics-java-osgi-hello-app/`](cics-java-osgi-hello-app) - Java application source |
| 19 | +* [`cics-java-osgi-hello-bundle/`](cics-java-osgi-hello-bundle/) - Build files for CICS bundle project |
| 20 | +* [`etc/eclipse_projects/com.ibm.cics.server.examples.osgi.hello.bundle`](etc/eclipse_projects/com.ibm.cics.server.examples.osgi.hello.bundle) - Static CICS Bundle Project |
| 21 | + |
| 22 | + |
| 23 | +## Building |
| 24 | +The sample includes an Eclipse project configuration, a Gradle build, a Maven POM, and Gradle/Maven Wrappers offering a wide range of build options with the tooling and IDE of your choice. |
| 25 | + |
| 26 | +Choose from the following approach: |
| 27 | +* Use the built-in Eclipse and CICS Explorer SDK capability |
| 28 | +* Use Eclipse with Buildship (Gradle), or m2e (Maven) to drive Gradle, or Maven. |
| 29 | +* Use the command line, or IDE terminal, to drive Gradle or Apache Maven (if installed on your workstation) |
| 30 | +* Use the command line, or IDE terminal, or IDE support for Wrappers, to drive the supplied Gradle or Apache Maven Wrappers (with no requirement for Gradle, Maven, Eclipse, or CICS Explorer SDK to be installed) |
| 31 | + |
| 32 | + |
| 33 | +** Note: ** If you import the project to your IDE, you might experience local project compile errors. To resolve these errors follow the relevant build section below. |
| 34 | + |
| 35 | + |
| 36 | +### Option 1 - Building with Eclipse |
| 37 | + |
| 38 | +The sample comes pre-configured for use with a standard JDK 1.8 and the CICS TS V5.5 Java EE 7 Target Platform. When you initially import the project to your IDE, if your IDE is not configured for a JDK 1.8, or does not have CICS Explorer SDK installed with the correct 'target platform' set, you might experience local project compile errors. |
| 39 | + |
| 40 | +To resolve issues: |
| 41 | +* ensure you have the CICS Explorer SDK plug-in installed |
| 42 | +* configure the Project's build-path, and Application Project settings to use your preferred JDK and Java compiler settings |
| 43 | +* set the CICS TS Target Platform to your intended CICS target (Hint: Window | Preferences | Plug-in Development | Target Platform | Add | Template | Other...) |
| 44 | + |
| 45 | + |
| 46 | +### Option 2 - Building with Gradle |
| 47 | + |
| 48 | +You don't necessarily need to fix the local errors, but to do so, you can run a tooling refresh on the cics-java-osgi-hello-app project. For example, in Eclipse: right-click on "Project", select "Gradle | Refresh Gradle Project". |
| 49 | + |
| 50 | +The CICS JVM server name should be modified in the `cics.jvmserver` property in the gradle build [cics-java-osgi-hello-bundle/build.gradle](cics-java-osgi-hello-bundle/build.gradle) to match the required CICS JVMSERVER resource name, or alternatively can be set on the command line (see below). |
| 51 | + |
| 52 | +If you have the Gradle buildship plug-in available, use the right-click **Run As...** menu on the cics-java-osgi-hello project to configure and run the `clean` and `build` tasks. Otherwise choose from the command-line approaches. |
| 53 | + |
| 54 | +**Gradle Wrapper (Linux/Mac):** |
| 55 | +```shell |
| 56 | +./gradlew clean build |
| 57 | +``` |
| 58 | + |
| 59 | +**Gradle Wrapper (Windows):** |
| 60 | +```shell |
| 61 | +gradle.bat clean build |
| 62 | +``` |
| 63 | + |
| 64 | +**Gradle (command-line):** |
| 65 | +```shell |
| 66 | +gradle clean build |
| 67 | +``` |
| 68 | + |
| 69 | +**Gradle (command-line & setting jvmserver):** |
| 70 | +```shell |
| 71 | +gradle clean build -Pcics.jvmserver=MYJVM |
| 72 | +``` |
| 73 | + |
| 74 | +A JAR file is created inside the `cics-java-osgi-hello-app/build/libs/` directory and a CICS bundle ZIP file inside the `cics-java-osgi-hello-bundle/build/distributions` directory. |
| 75 | + |
| 76 | + |
| 77 | +### Option 3 - Building with Apache Maven |
| 78 | + |
| 79 | +You don't necessarily need to fix the local errors, but to do so, you can run a tooling refresh on the cics-java-osgi-hello-app project. For example, in Eclipse: right-click on "Project", select "Maven -> Update Project...". |
| 80 | + |
| 81 | +> [!TIP] |
| 82 | +> In Eclipse, Gradle (buildship) is able to fully refresh and resolve the local classpath even if the project was previously updated by Maven. However, Maven (m2e) does not currently reciprocate that capability. If you previously refreshed the project with Gradle or with the CICS Explorer SDK Java Libraries, you'll need to manually remove the 'Project Dependencies' entry on the Java build-path of your Project Properties to avoid duplication errors when performing a Maven Project Update. |
| 83 | +
|
| 84 | +The CICS JVM server name should be modified in the `<cics.jvmserver>` property in the [`pom.xml`](pom.xml) to match the required CICS JVMSERVER resource name, or alternatively can be set on the command line (see below). |
| 85 | + |
| 86 | +If you have the Maven m2e plug-in available, use the right-click **Run As...** menu on the cics-java-osgi-hello project to configure and run the `clean` and `verify` tasks. Otherwise choose from the command-line approaches. |
| 87 | + |
| 88 | +**Maven Wrapper (Linux/Mac):** |
| 89 | +```shell |
| 90 | +./mvnw clean verify |
| 91 | +``` |
| 92 | + |
| 93 | +**Maven Wrapper (Windows):** |
| 94 | +```shell |
| 95 | +mvnw.cmd clean verify |
| 96 | +``` |
| 97 | + |
| 98 | +**Maven (command-line):** |
| 99 | +```shell |
| 100 | +mvn clean verify |
| 101 | +``` |
| 102 | + |
| 103 | +**Maven (command-line & setting jvmserver):** |
| 104 | +```shell |
| 105 | +mvn clean verify -Dcics.jvmserver=MYJVM |
| 106 | +``` |
| 107 | + |
| 108 | +A JAR file is created inside the `cics-java-osgi-hello-app/target` directory and a CICS bundle ZIP file inside the `cics-java-osgi-hello-bundle/target` directory. |
| 109 | + |
| 110 | +--- |
| 111 | + |
| 112 | +## Deploying to CICS |
| 113 | +1. Configure an OSGi JVMSERVER. |
| 114 | + |
| 115 | +2. CICS resource definitions for the bundle, programs, transactions and a JVM server are supplied in a group CDEVCJOH as a DFHCSDUP sample input stream supplied in [`DFHCSD.txt`](etc/DFHCSD.txt). Alternatively they can be installed using the bundle parts supplied with the cics-java-osgi-hello-bundle project. |
| 116 | + |
| 117 | + |
| 118 | +### Option 1 - Deploying using CICS Explorer SDK and the provided CICS bundle project |
| 119 | +1. Deploy the CICS bundle project 'com.ibm.cics.server.examples.osgi.hello.bundle' from CICS Explorer using the **Export Bundle Project to z/OS UNIX File System** wizard. This CICS bundle includes the OSGi bundlepart, the CJOH transaction and the CDEVCJOH program to run the sample. |
| 120 | + |
| 121 | + |
| 122 | +### Option 2 - Deploying using CICS Explorer SDK with own CICS bundle project |
| 123 | +1. Copy and paste the built JAR from your *projects/cics-java-osgi-hello-app/target* or *projects/cics-java-osgi-hello-app/build/libs* directory into a new Eclipse CICS bundle project. |
| 124 | +2. Create a new OSGi bundlepart that references the JAR (OSGi bundle) file. |
| 125 | +3. Optionally customise the CICS bundle contents, perhaps adding a TRANDEF of your choice |
| 126 | +4. Right click using the ** Export Bundle Project to z/OS UNIX File System ** wizard. |
| 127 | + |
| 128 | + |
| 129 | +### Option 3 - Deploying using CICS Explorer (Remote System Explorer) and CICS Bundle ZIP |
| 130 | +1. Connect to USS on the host system |
| 131 | +2. Create the bundle directory for the project. |
| 132 | +3. Copy & paste the built CICS bundle ZIP file from your *projects/cics-java-osgi-hello-bundle/target* or *projects/cics-java-osgi-hello-bundle/build/distributions* directory to z/FS on the host system into the bundle directory. |
| 133 | +4. Extract the ZIP by right-clicking on the ZIP file > User Action > unjar... |
| 134 | +5. Refresh the bundle directory |
| 135 | + |
| 136 | + |
| 137 | +### Option 4 - Deploying using command line tools |
| 138 | +1. Upload the built CICS bundle ZIP file from your *projects/cics-java-osgi-hello-bundle/target* or *projects/cics-java-osgi-hello-bundle/build/distributions* directory to z/FS on the host system (e.g. FTP). |
| 139 | +2. Connect to USS on the host system (e.g. SSH). |
| 140 | +3. Create the bundle directory for the project. |
| 141 | +4. Move the CICS bundle ZIP file into the bundle directory. |
| 142 | +5. Change directory into the bundle directoy. |
| 143 | +6. Extract the CICS bundle ZIP file. This can be done using the `jar` command. For example: |
| 144 | + ```shell |
| 145 | + jar xf file.zip |
| 146 | + ``` |
| 147 | + |
| 148 | +--- |
| 149 | + |
| 150 | +## Installing the CICS bundle |
| 151 | +### Installing the CICS bundle from a CICS terminal |
| 152 | +1. Create a new bundle definition, setting the bundle directory to the deployed bundle directory: |
| 153 | + ``` |
| 154 | + BUNDLE(CDEVCJOH) GROUP(CDEVCJOH) BUNDLEDIR(/path/to/bundle/directory) |
| 155 | + ``` |
| 156 | +2. Install the bundle |
| 157 | + |
| 158 | + |
| 159 | +### Installing the CICS bundle with CICS Explorer |
| 160 | +1. Definitions > Bundle Definitions |
| 161 | +2. Right-click > New... |
| 162 | +3. Fill in the Bundle and Group names as `CDEVCJOH` |
| 163 | +4. Fill in the Bundle Directory to point to the directory you expanded the ZIP |
| 164 | +5. Install the bundle |
| 165 | + |
| 166 | +--- |
| 167 | + |
| 168 | + |
| 169 | +## Running |
| 170 | +Run the `CJOH` transaction. This runs the `CDEVCJOH` program. |
10 | 171 |
|
11 | 172 | ## License
|
12 | 173 | This project is licensed under [Eclipse Public License - v 2.0](LICENSE).
|
13 | 174 |
|
14 | 175 | ## Usage terms
|
15 | 176 | By downloading, installing, and/or using this sample, you acknowledge that separate license terms may apply to any dependencies that might be required as part of the installation and/or execution and/or automated build of the sample, including the following IBM license terms for relevant IBM components:
|
16 | 177 |
|
17 |
| -• IBM CICS development components terms: https://www.ibm.com/support/customer/csol/terms/?id=L-ACRR-BBZLGX |
| 178 | +• IBM CICS development components terms: https://www.ibm.com/support/customer/csol/terms/?id=L-ACRR-BBZLGX |
0 commit comments