private void addCustomConfigurationProviderProperties(ManagerParameter parameter) { Properties systemProps = System.getProperties(); String providersStrList = systemProps.getProperty(ConfigurationProvider.CONFIG_PROVIDERS_PROPERTY); if (providersStrList != null) { String[] providersClassNames = providersStrList.split(","); if (providersClassNames != null) { for (String providerClassName : providersClassNames) { if (providerClassName == null || "".equals(providerClassName)) continue; try { Class<?> providerClass = Class.forName(providerClassName.trim(), true, classLoadingUtil.getClassloader()); ConfigurationProvider configurationProvider = ConfigurationProvider.class.cast(providerClass.newInstance()); parameter.mergeProperties(configurationProvider.getProperties()); } catch (Exception e) { LOG.warning( "Cannot load configuration from provider class '" + providerClassName + "'. " + e.getClass().getSimpleName() + " (" + e.getMessage() + ")."); } } } } }
@Override public Configuration getConfiguration(ManagerParameter parameter) { URL resourceUrl = parameter.createResourceUrl(); try (InputStream inputStream = resourceUrl.openStream()) { return xmlUtil.unmarshallConfiguration(inputStream); } catch (Exception e) { throw new IllegalStateException( "Cannot instantiate configuration from URL '" + resourceUrl + "'.", e); } }
private void addInternalConfigurationProviderProperies(ManagerParameter parameter) { parameter.mergeProperties(urlConfigurationProvider.getProperties()); parameter.mergeProperties(defaultConfigurationProvider.getProperties()); }