Packaging the application

Use the CICS Explorer® to package the JCICS web example into an application for deployment on the platform.

About this task

The CICS Explorer provides JCICS examples to help you get started with Java™ development and deployment. This scenario uses one of those examples, the web example, to demonstrate how you can package and deploy an application.

Ensure that the target platform for the CICS Explorer is specified as CICS® Transaction Server for z/OS®, Version 5 Release 2. For instructions to set up the target environment, from the CICS Explorer Help menu, select Help Contents > CICS Java Developer Guide > Developing and deploying applications > Setting up the target environment.

Procedure

  1. Open the CICS Cloud perspective.
  2. In the Project Explorer view, right-click and click New > Example to open the wizard.
  3. In the CICS Java folder, select CICS Web Example and click Next.
  4. In the Project name field enter a name for the new project.
    By default, Eclipse creates a name that is the folder location of the examples in the workspace, followed by the example name. For example, the default project name for the web example is com.ibm.cics.server.examples.web.
  5. Click Finish.
    Eclipse creates the plug-in project containing the JCICS web sample as an OSGi bundle.
  6. Create a CICS Bundle project to reference the OSGi bundle:
    1. Open the CICS Cloud perspective.
    2. In the Project Explorer view, right-click and click New > Project....
    3. Expand the CICS Resources folder, click CICS Bundle Project and click Next.
    4. Enter the project name java.web.example.programs and specify an appropriate version number for the bundle, such as 1.0.0 for the original version, then click Finish.
    5. Add the OSGi bundle by right-clicking the project and clicking New > OSGi Bundle Project Reference. Select the name of the OSGi bundle.
    6. In the JVM Server field, enter the name of the JVMSERVER resource, either DFHJVMS or your own resource, which you set up in Configuring the platform. Then click Finish.
  7. Define a program resource for the Java application in the CICS bundle project.
    1. Expand the CICS bundle project java.web.example.programs and double-click the cics.xml file in the META-INF folder to open the bundle manifest editor. In the editor, click New and select Program Definition. Alternatively, right-click the CICS bundle project java.web.example.programs and click New > Program Definition.
    2. In the Name field, enter the program name DFJ$JWB1.
    3. In the Program Type section, select Java.
    4. In the Service Name field, enter the name of the OSGi service, examples.Web.Sample1.
      The OSGi service is declared as the CICS main class.
    5. In the JVM Server field, enter the name of the JVMSERVER resource, either DFHJVMS or your own resource, which you set up in Configuring the platform.
    6. Check the box Create an Application entry point and enter a name for the operation performed by the program, such as READ
    7. Click Finish to create the definition in the project.
  8. Define a URIMAP resource for the Java application in the CICS bundle project.
    The URI map directs the HTTP request to the Java application.
    1. Working with the CICS bundle project java.web.example.programs in the bundle manifest editor, click New and select URI Mapping Definition. Alternatively, right-click the CICS bundle project and click New > URI Mapping Definition.
    2. In the Name field, enter the name JWB1URI.
    3. In the Host field, enter an asterisk (*) to make the URIMAP definition match any host name.
    4. In the Path field, enter myJavaWebExample or another suitable URI to access the application.
    5. In the Usage section, select Server, and use the drop-down box to select Program. Enter the name of the PROGRAM resource, DFJ$JWB1.
    6. Click Finish to create the definition in the project.
    Tip: If you prefer to separate the business logic from the presentation, you can create separate CICS bundle projects for the program resource definition and the URIMAP resource definition.
  9. Define the dependencies for the Java example.
    The Java web example requires a JVM server to run the Java application and a TCP/IP service to accept HTTP requests, both of which you set up in Configuring the platform.
    1. Working with the CICS bundle project java.web.example.programs in the bundle manifest editor, in the Imported Resources section, click Add to add a dependency.
    2. Enter the resource type.
      Use the key combination Ctrl+Space to select a valid type, either JVM Server or TCP/IP Service.
    3. Enter the name of the JVMSERVER or TCPIPSERVICE resource that you set up for the platform in Configuring the platform.
      You can also optionally change the behavior for when the BUNDLE resource is enabled. By default, the dependency is required, meaning that it must be satisfied for the BUNDLE resource to enable successfully in CICS at run time. However, you can specify that the dependency is optional, so the BUNDLE resource is enabled even if the dependencies it requires are not satisfied in the CICS region.
    4. Click OK to create the dependency.
    Repeat this step until you have declared all the dependencies. The resource names must match the resources in the platform. You can click Properties to edit a selected dependency if you want to change the values.

Tip: If you want to install policies with your application, follow the procedure in Creating and editing policies so that the CICS bundle that contains your policies is ready to be selected and deployed with your application in the next step.

  1. Create a CICS Application project to define an application bundle that references the CICS bundle:
    1. In the Project Explorer view, right-click and click New > Project....
    2. Expand the CICS Resources folder, click CICS Application project and click Next.
    3. Enter the project name java.web.example.application for your CICS Application project. Fill in a suitable description, and specify an appropriate version number for the bundle, such as 1.0.0 for the original version.
      Then click Next.
    4. Click Add and select the CICS Bundle project java.web.example.programs which you created during this task.
      This CICS bundle will be included in the application. You can include multiple CICS bundles in a CICS Application project. If you want to include policies with your application, select the CICS bundle Policy_Bundle here.
    5. Click Finish to create the CICS Application project for the application.
  2. Create a CICS Application Binding project to define how the application is deployed on the platform:
    1. In the Project Explorer view, right-click and click New > Project....
    2. Expand the CICS Resources folder, click CICS Application Binding project and click Next.
    3. Enter the project name java.web.example.binding for your CICS Application Binding project. Fill in a suitable description, and specify an appropriate version number for the bundle, such as 1.0.0 for the original version.
    4. Click Browse by the Application field and select the CICS Application project java.web.example.application that you created in Step 10.
      The version number that you specified is shown as part of the project name.
      Then click OK.
    5. Click Browse by the Platform field and select the platform my.demo.platform that you created in Configuring the platform.
      Then click OK
    6. Click Next.
      The next panel lets you select additional CICS bundles to be packaged with the application binding. For this scenario there are no additional CICS bundles, so click Next.
    7. The next panel shows the CICS bundles that are included in your CICS Application project, and the region types in the target platform. Select the CICS bundle java.web.example.programs, and the region type demo.platform.AOR.regiontype, to bind the bundle to the region type. Repeat the selection of the region type for CICS bundle Policy_Bundle, if it is included with your application
    8. Click Finish to create the CICS Application Binding project for the application.

What to do next

Export the application bundle and application binding to the home directory for the platform on zFS, and deploy the application to the platform.