要处理入局请求,可使用 com.ibm.wsspi.zos.connect.ServiceController 服务编程接口 (SPI) 在运行时创建 z/OS Connect 服务。
关于此任务
根据外部存储库中存储的配置,可在运行时动态创建 z/OS Connect 服务提供者。
过程
- 创建用于实现 z/OS Connect com.ibm.wsspi.zos.connect.ServiceController SPI 的服务提供者。
- 在运行时,通过将在 BundleContext 属性上使用 theregisterService 方法的 OSGi 框架注册该服务。
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.wsspi.zos.connect.ServiceController.class, new
MyServiceController(), dynamicServiceProps);
要点: 每个 Liberty SPI
的 Java API 文档在该文档的编程接口 (API) 部分中详细说明,并且在 ${wlp.install.dir}/dev 目录的某个子目录中以单独 .zip 文件形式提供。有关更多信息,请参阅有关扩展 Liberty 的文档。