private AliceRecognition() { try { CombinedConfiguration config = new CombinedConfiguration(new MergeCombiner()); config.addConfiguration(new SystemConfiguration()); config.addConfiguration(new FileBasedConfigurationBuilder<FileBasedConfiguration>(PropertiesConfiguration.class) .configure(new Parameters().properties().setFileName(ALICE_PROPERTIES)).getConfiguration()); this.enabled = config.getBoolean(ALICE_ENABLED, false); String url = config.getString(ALICE_SERVICE_URL, null); String accessToken = config.getString(ALICE_ACCESS_TOKEN, null); String command = config.getString(ALICE_COMMAND, null); if(enabled && !StringUtils.isEmpty(url) && !StringUtils.isEmpty(accessToken)) { this.client = new AliceClient(url, command); this.client.setAuthToken(accessToken); this.enabled = this.client.isAvailable(); } } catch (Exception e) { LOGGER.error("Unable to initialize Alice: " + e.getMessage()); } }
public ConfigurationProvider() { SystemConfiguration sysConfig = new SystemConfiguration(); propertyFilePath = sysConfig.getString(Constants.CONFIG_PROP_FILE_PATH, Constants.CONFIG_PROP_FILE_PATH_DEFAULT); }
private Optional<Configuration> createSystem() { return Optional.of(new SystemConfiguration()); }
/** * This ctor supports 4 levels of configuration. * Levels higher in the list override levels lower in the list. * <ol> * <li>heapSpank properties passed in as java -D parameters, aka "Java System Properties" </li> * <li>heapSpank.properties file in the current folder</li> * <li>heapSpank.properties file in the current user's 'home' folder.</li> * <li>com.github.eostermueller.heapspank.leakyspank.console.DefaultConfig</li> * @throws ConfigurationException */ public ApacheCommonsConfigFile() throws ConfigurationException { this.compositeConfiguration.addConfiguration( new SystemConfiguration() ); this.compositeConfiguration.addConfiguration( getCurrentFolderConfiguration() ); this.compositeConfiguration.addConfiguration( getHomeFolderConfiguration() ); this.compositeConfiguration.addConfiguration( getHeapSpankJarConfiguration() ); }