Creating a IBM z/OS Connect service at run time

To process incoming requests, you can create a IBM z/OS Connect service at run time by using the com.ibm.zosconnect.spi.ServiceController service programming interface (SPI).

About this task

You can dynamically create a IBM z/OS Connect service provider at run time based on the configuration that is stored in an external repository.

Procedure

  1. Create a service provider that implements the IBM z/OS Connect com.ibm.zosconnect.spi.ServiceController SPI.
  2. At run time, register the service with the OSGi framework that is using the the registerService method on the BundleContext attribute.
    Dictionary<String, Object> dynamicServiceProps = new Hashtable<String, Object>();
    dynamicServiceProps.put(ServiceControllerConstants.SERVICE_NAME, "myNewService");
    dynamicServiceProps.put(ServiceControllerConstants.INVOKE_URI, new String[] { "/u/my/url1",
          "/u/myurl2", "/u/my/url3*" });
    ServiceRegistration<ServiceController> dynamicServiceReg =
          bundleContext.registerService(com.ibm.zosconnect.spi.ServiceController.class, new
    MyServiceController(), dynamicServiceProps);
    Note: The Java™ API documentation for each Liberty profile SPI can be found in the Liberty product documentation and is also available in a separate .zip file in one of the javadoc directories of the <installation_path>/wlp/dev directory.