private static boolean setExtensionOnBusIfMissing(Bus bus, Map<String, Extension> exts, String extensionName) { if (exts.containsKey(extensionName) && !bus.hasExtensionByName(extensionName)) { ExtensionManager extMan = bus.getExtension(ExtensionManager.class); if (extMan instanceof ExtensionManagerImpl) { ((ExtensionManagerImpl) extMan).add(exts.get(extensionName)); return true; } else { throw new RuntimeException( "A required extension '" + extensionName + "' is not loaded on the CXF bus used by Job Controller. " + "In the same time, the bus uses unknown implementation of ExtensionManager, " + "so it is not possible to set the extension automatically."); } } return false; } }
private static boolean setExtensionOnBusIfMissing(Bus bus, Map<String, Extension> exts, String extensionName) { if (exts.containsKey(extensionName) && !bus.hasExtensionByName(extensionName)) { ExtensionManager extMan = bus.getExtension(ExtensionManager.class); if (extMan instanceof ExtensionManagerImpl) { ((ExtensionManagerImpl) extMan).add(exts.get(extensionName)); return true; } else { throw new RuntimeException( "A required extension '" + extensionName + "' is not loaded on the CXF bus used by Job Controller. " + "In the same time, the bus uses unknown implementation of ExtensionManager, " + "so it is not possible to set the extension automatically."); } } return false; } }
private static void ensureServiceRegistryAvailable(Bus bus) { //for TESB-9006, update extensions when registry enabled but no wsdl-client/policy-client //extension set on the old bus. (used to instead the action of refresh job controller bundle. if (!bus.hasExtensionByName(WSDL_CLIENT_EXTENSION_NAME) || !bus.hasExtensionByName(POLICY_CLIENT_EXTENSION_NAME)) { boolean updated = false; Map<String, Extension> exts = ExtensionRegistry.getRegisteredExtensions(); updated |= setExtensionOnBusIfMissing(bus, exts, WSDL_CLIENT_EXTENSION_NAME); updated |= setExtensionOnBusIfMissing(bus, exts, POLICY_CLIENT_EXTENSION_NAME); if (updated) { // this should cause FactoryBeanListenerManager to refresh its list of event listeners FactoryBeanListenerManager fblm = bus.getExtension(FactoryBeanListenerManager.class); if (fblm != null) { fblm.setBus(bus); } else { throw new RuntimeException("CXF bus doesn't contain FactoryBeanListenerManager."); } } } }
private static void ensureServiceRegistryAvailable(Bus bus) { //for TESB-9006, update extensions when registry enabled but no wsdl-client/policy-client //extension set on the old bus. (used to instead the action of refresh job controller bundle. if (!bus.hasExtensionByName(WSDL_CLIENT_EXTENSION_NAME) || !bus.hasExtensionByName(POLICY_CLIENT_EXTENSION_NAME)) { boolean updated = false; Map<String, Extension> exts = ExtensionRegistry.getRegisteredExtensions(); updated |= setExtensionOnBusIfMissing(bus, exts, WSDL_CLIENT_EXTENSION_NAME); updated |= setExtensionOnBusIfMissing(bus, exts, POLICY_CLIENT_EXTENSION_NAME); if (updated) { // this should cause FactoryBeanListenerManager to refresh its list of event listeners FactoryBeanListenerManager fblm = bus.getExtension(FactoryBeanListenerManager.class); if (fblm != null) { fblm.setBus(bus); } else { throw new RuntimeException("CXF bus doesn't contain FactoryBeanListenerManager."); } } } }