public DriverRemoteConnection(final Configuration conf) { if (conf.containsKey(GREMLIN_REMOTE_GRAPH_DRIVER_CLUSTERFILE) && conf.containsKey("clusterConfiguration")) throw new IllegalStateException( String.format( "A configuration should not contain both '%s' and 'clusterConfiguration'", GREMLIN_REMOTE_GRAPH_DRIVER_CLUSTERFILE)); connectionGraphName = conf.getString(GREMLIN_REMOTE_GRAPH_DRIVER_GRAPHNAME, DEFAULT_GRAPH); try { final Cluster cluster; if (!conf.containsKey(GREMLIN_REMOTE_GRAPH_DRIVER_CLUSTERFILE) && !conf.containsKey("clusterConfiguration")) cluster = Cluster.open(); else cluster = conf.containsKey(GREMLIN_REMOTE_GRAPH_DRIVER_CLUSTERFILE) ? Cluster.open(conf.getString(GREMLIN_REMOTE_GRAPH_DRIVER_CLUSTERFILE)) : Cluster.open(conf.subset("clusterConfiguration")); client = cluster .connect(Client.Settings.build().unrollTraversers(false).create()) .alias(connectionGraphName); } catch (Exception ex) { throw new IllegalStateException(ex); } tryCloseCluster = true; this.conf = Optional.of(conf); }
private AstyanaxContext.Builder getContextBuilder( Configuration config, int maxConnsPerHost, String usedFor) { final ConnectionPoolType poolType = ConnectionPoolType.valueOf( config.getString(CONNECTION_POOL_TYPE_KEY, CONNECTION_POOL_TYPE_DEFAULT)); final NodeDiscoveryType discType = NodeDiscoveryType.valueOf( config.getString(NODE_DISCOVERY_TYPE_KEY, NODE_DISCOVERY_TYPE_DEFAULT)); AstyanaxContext.Builder builder = new AstyanaxContext.Builder() .forCluster(clusterName) .forKeyspace(keySpaceName) .withAstyanaxConfiguration( new AstyanaxConfigurationImpl() .setConnectionPoolType(poolType) .setDiscoveryType(discType)) .withConnectionPoolConfiguration( new ConnectionPoolConfigurationImpl(usedFor + "TitanConnectionPool") .setPort(port) .setMaxConnsPerHost(maxConnsPerHost) .setRetryBackoffStrategy( new FixedRetryBackoffStrategy(1000, 5000)) // TODO configuration .setSocketTimeout(connectionTimeout) .setConnectTimeout(connectionTimeout) .setSeeds(hostname)) .withConnectionPoolMonitor(new CountingConnectionPoolMonitor()); return builder; }
public Backend(Configuration storageConfig) { this.storageConfig = storageConfig; storeManager = getStorageManager(storageConfig); indexes = getIndexes(storageConfig); storeFeatures = storeManager.getFeatures(); basicMetrics = storageConfig.getBoolean(BASIC_METRICS, BASIC_METRICS_DEFAULT); mergeBasicMetrics = storageConfig.getBoolean(MERGE_BASIC_METRICS_KEY, MERGE_BASIC_METRICS_DEFAULT); int bufferSizeTmp = storageConfig.getInt(BUFFER_SIZE_KEY, BUFFER_SIZE_DEFAULT); Preconditions.checkArgument( bufferSizeTmp >= 0, "Buffer size must be non-negative (use 0 to disable)"); if (!storeFeatures.supportsBatchMutation()) { bufferSize = 0; log.debug("Buffering disabled because backend does not support batch mutations"); } else bufferSize = bufferSizeTmp; writeAttempts = storageConfig.getInt(WRITE_ATTEMPTS_KEY, WRITE_ATTEMPTS_DEFAULT); Preconditions.checkArgument(writeAttempts > 0, "Write attempts must be positive"); readAttempts = storageConfig.getInt(READ_ATTEMPTS_KEY, READ_ATTEMPTS_DEFAULT); Preconditions.checkArgument(readAttempts > 0, "Read attempts must be positive"); persistAttemptWaittime = storageConfig.getInt(STORAGE_ATTEMPT_WAITTIME_KEY, STORAGE_ATTEMPT_WAITTIME_DEFAULT); Preconditions.checkArgument( persistAttemptWaittime > 0, "Persistence attempt retry wait time must be non-negative"); // If lock prefix is unspecified, specify it now storageConfig.setProperty( ExpectedValueCheckingStore.LOCAL_LOCK_MEDIATOR_PREFIX_KEY, storageConfig.getString( ExpectedValueCheckingStore.LOCAL_LOCK_MEDIATOR_PREFIX_KEY, storeManager.getName())); final String lockBackendName = storageConfig.getString( GraphDatabaseConfiguration.LOCK_BACKEND, GraphDatabaseConfiguration.LOCK_BACKEND_DEFAULT); if (REGISTERED_LOCKERS.containsKey(lockBackendName)) { lockerCreator = REGISTERED_LOCKERS.get(lockBackendName); } else { throw new TitanConfigurationException( "Unknown lock backend \"" + lockBackendName + "\". Known lock backends: " + Joiner.on(", ").join(REGISTERED_LOCKERS.keySet()) + "."); } // Never used for backends that have innate transaction support, but we // want to maintain the non-null invariant regardless; it will default // to connsistentkey impl if none is specified Preconditions.checkNotNull(lockerCreator); if (storeFeatures.isDistributed() && storeFeatures.isKeyOrdered()) { log.debug("Wrapping index store with HashPrefix"); hashPrefixIndex = true; } else { hashPrefixIndex = false; } }
public static String buildCheckoutToCartUrl(MerchantStore store) { StringBuffer chk = new StringBuffer(); chk.append(getSecureDomain(store)) .append((String) conf.getString("core.salesmanager.catalog.url")) .append((String) conf.getString("core.salesmanager.checkout.checkoutAction")); return chk.toString(); }
public static String buildRemoteLogonUrl(MerchantStore store) { StringBuffer chk = new StringBuffer(); chk.append(getSecureDomain(store)) .append((String) conf.getString("core.salesmanager.catalog.url")) .append((String) conf.getString("core.accountmanagement.loginAjaxAction")); return chk.toString(); }
@Test public void test_loading_of_module_settings() { BatchSettings batchSettings = mock(BatchSettings.class); when(batchSettings.getDefinitions()).thenReturn(new PropertyDefinitions()); when(batchSettings.getProperties()) .thenReturn( ImmutableMap.of( "overridding", "batch", "on-batch", "true")); when(batchSettings.getModuleProperties("struts-core")) .thenReturn( ImmutableMap.of( "on-module", "true", "overridding", "module")); ProjectDefinition module = ProjectDefinition.create().setKey("struts-core"); Configuration deprecatedConf = new PropertiesConfiguration(); ModuleSettings moduleSettings = new ModuleSettings(batchSettings, module, deprecatedConf); assertThat(moduleSettings.getString("overridding")).isEqualTo("module"); assertThat(moduleSettings.getString("on-batch")).isEqualTo("true"); assertThat(moduleSettings.getString("on-module")).isEqualTo("true"); assertThat(deprecatedConf.getString("overridding")).isEqualTo("module"); assertThat(deprecatedConf.getString("on-batch")).isEqualTo("true"); assertThat(deprecatedConf.getString("on-module")).isEqualTo("true"); }
/** * Returns an instance of the annotation MorphiaDatastore if the morphia configuration is ok. * * @param application Application * @param morphiaClass persistent morphia object * @return MorphiaDatastore */ public static MorphiaDatastore getMongoDatastore(Application application, Class<?> morphiaClass) { Configuration morphiaEntityConfiguration = application.getConfiguration(morphiaClass).subset("morphia"); if (morphiaEntityConfiguration.isEmpty()) { throw SeedException.createNew(MorphiaErrorCodes.UNKNOW_DATASTORE_CONFIGURATION) .put("aggregate", morphiaClass.getName()); } String clientName = morphiaEntityConfiguration.getString("clientName"); if (clientName == null) { throw SeedException.createNew(MorphiaErrorCodes.UNKNOW_DATASTORE_CLIENT) .put("aggregate", morphiaClass.getName()); } String dbName = morphiaEntityConfiguration.getString("dbName"); if (dbName == null) { throw SeedException.createNew(MorphiaErrorCodes.UNKNOW_DATASTORE_DATABASE) .put("aggregate", morphiaClass.getName()) .put("clientName", clientName); } checkMongoClient(application.getConfiguration(), morphiaClass, clientName, dbName); return new MorphiaDatastoreImpl(clientName, dbName); }
/** Main method. */ public static void main(String[] args) throws Exception { // QcConstants.class.getClass(); Configuration configData = QcConfigDataHandler.getConfigDataHandler().getConfigData(); String testName = configData.getString("qc.test.name"); String testInstanceName = configData.getString("qc.test.instancename"); String testsetName = configData.getString("qc.testset.name"); String strTestStatus = configData.getString("qc.test.status"); // Check for empty string. testName = (!QcUtil.isEmpty(testName) ? testName : null); testInstanceName = (!QcUtil.isEmpty(testInstanceName) ? testInstanceName : null); testsetName = (!QcUtil.isEmpty(testsetName) ? testsetName : null); strTestStatus = (!QcUtil.isEmpty(strTestStatus) ? strTestStatus : null); List<String> fileNames = (!QcUtil.isEmpty(configData.getString("qc.log.filenames")) ? configData.getList("qc.log.filenames") : null); QcTestStatus testStatus = QcTestStatus.fromValue(strTestStatus); // Check that all files exist. if (fileNames != null) { for (String fileName : fileNames) { File file = new File(fileName); if (!(file.exists() && file.isFile())) { log.error("File is not found :" + fileName); System.exit(-1); } } } boolean success = postResult2Qc(testsetName, testName, testInstanceName, testStatus, fileNames); if (!success) { System.exit(-1); } }
public static String buildBinUri(MerchantStore store) { StringBuffer chk = new StringBuffer(); chk.append(getSecureDomain(store)) .append((String) conf.getString("core.store.mediaurl")) .append((String) conf.getString("core.bin.uri")); return chk.toString(); }
/** Asserts that the actual configuration contains the expected ones. */ private static void assertContains(Configuration expected, Configuration actual) { @SuppressWarnings("rawtypes") Iterator keys = expected.getKeys(); while (keys.hasNext()) { String key = (String) keys.next(); assertPropertyEquals(key, expected.getString(key), actual.getString(key)); } }
public static String buildCartUri(MerchantStore store) { StringBuffer chk = new StringBuffer(); chk.append(getUnSecureDomain(store)) .append((String) conf.getString("core.salesmanager.catalog.url")) .append("/") .append((String) conf.getString("core.salesmanager.cart.uri")); return chk.toString(); }
@Override public void configurate(Configuration configuration, ConfigurableBuilder builder) throws BuildException { this.hostname = configuration.getString(HOSTNAME); this.port = configuration.getInt(PORT); this.workerHostname = configuration.getString(WORKER_HOSTNAME); this.workerPort = configuration.getInt(WORKER_PORT); }
public static String buildDisplayInvoiceUrl(MerchantStore store) { StringBuffer chk = new StringBuffer(); chk.append(getUnSecureDomain(store)) .append((String) conf.getString("core.salesmanager.catalog.url")) .append("/") .append((String) conf.getString("core.salesmanager.checkout.uri")) .append((String) conf.getString("core.salesmanager.checkout.showInvoiceAction")); return chk.toString(); }
@Test public void testCommon() throws Exception { Configuration conf = HadoopConfigurationBuilder.buildCommonConfiguration(clusterSpec, cluster, defaults); assertThat(Iterators.size(conf.getKeys()), is(3)); assertThat(conf.getString("p1"), is("common1")); assertThat(conf.getString("p2"), is("common2")); assertThat(conf.getString("fs.default.name"), matches("hdfs://.+:8020/")); }
/** * Reads properties from the provided {@link Configuration} object.<br> * <br> * Known properties: * * <ul> * <li>api.adwords.clientCustomerId * <li>api.adwords.userAgent * <li>api.adwords.developerToken * <li>api.adwords.isPartialFailure * <li>api.adwords.endpoint * <li>api.adwords.reportMoneyInMicros * </ul> * * @param config * @return Builder populated from the Configuration */ public Builder from(Configuration config) { this.clientCustomerId = config.getString("api.adwords.clientCustomerId", null); this.userAgent = config.getString("api.adwords.userAgent", null); this.developerToken = config.getString("api.adwords.developerToken", null); this.isPartialFailure = config.getBoolean("api.adwords.isPartialFailure", null); this.endpoint = config.getString("api.adwords.endpoint", null); this.isReportMoneyInMicros = config.getBoolean("api.adwords.reportMoneyInMicros", null); return this; }
/** * Configuration method. * * <p>Configuration parameters for PrefExprIndividualSpecies are: * * <ul> * </ul> */ @SuppressWarnings("unchecked") public void configure(Configuration settings) { // Header String header = "expression-tree"; // Get minimum-tree-size int minTreeSize = settings.getInt(header + ".min-tree-size"); setMinTreeSize(minTreeSize); // Get minimum-tree-size int maxTreeSize = settings.getInt(header + ".max-tree-size"); setMaxTreeSize(maxTreeSize); // Get root type String rootTypeName = settings.getString(header + ".root-type"); try { Class<?> rootType = Class.forName(rootTypeName); setRootType(rootType); } catch (ClassNotFoundException e) { throw new ConfigurationRuntimeException(""); } // Get terminals set int numberOfTerminals = settings.getList(header + ".terminals.terminal[@class]").size(); IPrimitive[] terminals = new IPrimitive[numberOfTerminals]; for (int j = 0; j < numberOfTerminals; j++) { try { String terminalClassname = settings.getString(header + ".terminals.terminal(" + j + ")[@class]"); Class<IPrimitive> terminalClass = (Class<IPrimitive>) Class.forName(terminalClassname); terminals[j] = terminalClass.newInstance(); } catch (ClassNotFoundException e) { throw new ConfigurationRuntimeException(); } catch (InstantiationException e) { throw new ConfigurationRuntimeException(); } catch (IllegalAccessException e) { throw new ConfigurationRuntimeException(); } } setTerminals(terminals); // Get functions set int numberOfFunctions = settings.getList(header + ".functions.function[@class]").size(); IPrimitive[] functions = new IPrimitive[numberOfFunctions]; for (int j = 0; j < numberOfFunctions; j++) { try { String functionClassname = settings.getString(header + ".functions.function(" + j + ")[@class]"); Class<IPrimitive> functionClass = (Class<IPrimitive>) Class.forName(functionClassname); functions[j] = functionClass.newInstance(); } catch (ClassNotFoundException e) { throw new ConfigurationRuntimeException(); } catch (InstantiationException e) { throw new ConfigurationRuntimeException(); } catch (IllegalAccessException e) { throw new ConfigurationRuntimeException(); } } setFunctions(functions); }
@Test public void testMapReduce() throws Exception { Cluster cluster = newCluster(5); Configuration conf = HadoopConfigurationBuilder.buildMapReduceConfiguration(clusterSpec, cluster, defaults); assertThat(conf.getString("p1"), is("mapred1")); assertThat(conf.getString("mapred.job.tracker"), matches(".+:8021")); assertThat(conf.getString("mapred.tasktracker.map.tasks.maximum"), is("4")); assertThat(conf.getString("mapred.tasktracker.reduce.tasks.maximum"), is("3")); assertThat(conf.getString("mapred.reduce.tasks"), is("15")); }
@Override public void run() { try { Thread.sleep(3000); String uberdustServerDnsName = config.getString("uberdustcoapserver.dnsName"); if (uberdustServerDnsName == null) { throw new Exception("Property uberdustcoapserver.dnsName not set."); } int uberdustServerPort = config.getInt("uberdustcoapserver.port", 0); if (uberdustServerPort == 0) { throw new Exception("Property uberdustcoapserver.port not set."); } InetSocketAddress uberdustServerSocketAddress = new InetSocketAddress(InetAddress.getByName(uberdustServerDnsName), uberdustServerPort); String baseURI = config.getString("baseURIHost", "localhost"); CoapRequest fakeRequest = new CoapRequest( MsgType.NON, Code.POST, new URI("coap://" + baseURI + ":5683/here_i_am")); CoapNodeRegistrationServer registrationServer = CoapNodeRegistrationServer.getInstance(); if (registrationServer == null) { log.error("NULL!"); } registrationServer.receiveCoapRequest(fakeRequest, uberdustServerSocketAddress); } catch (InterruptedException e) { e.printStackTrace(); } catch (UnknownHostException e) { e.printStackTrace(); } catch (URISyntaxException e) { e .printStackTrace(); // To change body of catch statement use File | Settings | File // Templates. } catch (InvalidMessageException e) { e .printStackTrace(); // To change body of catch statement use File | Settings | File // Templates. } catch (InvalidOptionException e) { e .printStackTrace(); // To change body of catch statement use File | Settings | File // Templates. } catch (ToManyOptionsException e) { e .printStackTrace(); // To change body of catch statement use File | Settings | File // Templates. } catch (Exception e) { e .printStackTrace(); // To change body of catch statement use File | Settings | File // Templates. } }
static { try { CompositeConfiguration settings = new CompositeConfiguration(); settings.addConfiguration(new PropertiesConfiguration("system.properties")); Configuration serverConf = settings.subset("service"); dbReadUrls = serverConf.getString("dbReadUrls"); dbDriver = serverConf.getString("dbDriver"); dbClient = new MoDBRW(dbReadUrls, dbDriver); } catch (Exception e) { logger.error("init database error", e); } }
@Override public void init(Configuration handlerConfiguration) throws ConfigurationException { try { setTempBlockTime(handlerConfiguration.getString("tempBlockTime")); } catch (NumberFormatException e) { throw new ConfigurationException(e.getMessage()); } try { setAutoWhiteListLifeTime(handlerConfiguration.getString("autoWhiteListLifeTime")); } catch (NumberFormatException e) { throw new ConfigurationException(e.getMessage()); } try { setUnseenLifeTime(handlerConfiguration.getString("unseenLifeTime")); } catch (NumberFormatException e) { throw new ConfigurationException(e.getMessage()); } String nets = handlerConfiguration.getString("whitelistedNetworks"); if (nets != null) { String[] whitelistArray = nets.split(","); List<String> wList = new ArrayList<String>(whitelistArray.length); for (String aWhitelistArray : whitelistArray) { wList.add(aWhitelistArray.trim()); } setWhiteListedNetworks(new NetMatcher(wList, dnsService)); serviceLog.info("Whitelisted addresses: " + getWhiteListedNetworks().toString()); } // Get the SQL file location String sFile = handlerConfiguration.getString("sqlFile", null); if (sFile != null) { setSqlFileUrl(sFile); if (!sqlFileUrl.startsWith("file://") && !sqlFileUrl.startsWith("classpath:")) { throw new ConfigurationException( "Malformed sqlFile - Must be of the format \"file://<filename>\"."); } } else { throw new ConfigurationException("sqlFile is not configured"); } try { initSqlQueries(datasource.getConnection(), sqlFileUrl); // create table if not exist createTable("greyListTableName", "createGreyListTable"); } catch (Exception e) { throw new RuntimeException("Unable to init datasource", e); } }
@GET @Produces(MediaType.APPLICATION_JSON) public Response getDiscoveryDocument() throws URISyntaxException { String webAdminManagementUri = configuration.getString( Configurator.MANAGEMENT_PATH_PROPERTY_KEY, Configurator.DEFAULT_MANAGEMENT_API_PATH); String dataUri = configuration.getString( Configurator.REST_API_PATH_PROPERTY_KEY, Configurator.DEFAULT_DATA_API_PATH); DiscoveryRepresentation dr = new DiscoveryRepresentation(webAdminManagementUri, dataUri); return outputFormat.ok(dr); }
/** Expected to initialize n servlet initializaton. */ public void contextInitialized(ServletContextEvent event) { Configuration config = ConfigUtils.getSystemConfig(); String programIndex = config.getString("luceneIndex"); String compositeIndex = config.getString("compositeIndex"); String spellIndex = config.getString("spellIndex"); String liveIndex = config.getString("luceneLiveIndex"); String productIndex = config.getString("luceneProductIndex"); unlockIndex(programIndex); unlockIndex(compositeIndex); unlockIndex(spellIndex); unlockIndex(liveIndex); unlockIndex(productIndex); }
public static String getUnSecureDomain(MerchantStore store) { String domain = conf.getString("core.domain.server"); if (store != null && !StringUtils.isBlank(store.getDomainName())) { domain = store.getDomainName(); } StringBuffer url = new StringBuffer(); return url.append((String) conf.getString("core.domain.http.unsecure")) .append("://") .append(domain) .toString(); }
public GeoJsfOfxDocumentation(Configuration config, Db dbSeed, Translations translations) { this.config = config; this.translations = translations; seedUtil = new UtilsDbXmlSeedUtil(dbSeed, null); baseLatexDir = new File(config.getString(UtilsDocumentation.keyBaseLatexDir)); baseOfxDir = new File(config.getString(UtilsDocumentation.keyBaseOfxDir)); File trackerDb = new File(config.getString("doc.ofx.mediaSourceTracker")); MediaSourceModificationTracker msmt = new MediaSourceModificationTracker(trackerDb); cmm = new LatexCrossMediaManager( new File(config.getString(UtilsDocumentation.keyBaseLatexDir)), msmt); dsm = new GeoJsfOfxSettingsManager(); }
private BaiduDriver() { Configuration config = null; try { config = new XMLConfiguration(BaiduDriver.class.getClassLoader().getResource("Cloud.xml")); } catch (ConfigurationException e) { // TODO Auto-generated catch block e.printStackTrace(); } this.ACCESS_KEY_ID = config.getString("Baidu.ACCESS_KEY_ID"); this.SECRET_ACCESS_KEY = config.getString("Baidu.SECRET_ACCESS_KEY"); BosClientConfiguration bosconfig = new BosClientConfiguration(); bosconfig.setCredentials(new DefaultBceCredentials(ACCESS_KEY_ID, SECRET_ACCESS_KEY)); baiduClient = new BosClient(bosconfig); }
public URI createHttpMirrorURI(InetAddress remoteAddress, String path) throws URISyntaxException { String uberdustServerDns = config.getString("uberdustcoapserver.dnsName", remoteAddress.getHostAddress()); String sspHostname = ""; int sspPort; try { sspHostname = config.getString("baseURIHost", InetAddress.getLocalHost().getHostAddress()); } catch (UnknownHostException e) { log.error(e); } sspPort = config.getInt("listenPort"); return new URI("http://" + sspHostname + ":" + sspPort + "/" + uberdustServerDns + path + "#"); }
@Test @SuppressWarnings("unchecked") public void testCreateCombinedConfiguration_requiredUrlNoOverride() throws Exception { System.setProperty("testProperty", "testValue"); Configuration configuration = configurationHelper.createCombinedConfiguration( null, Lists.<ConfigurationInfo<URL>>newArrayList( new ConfigurationInfo<URL>( ConfigurationHelperTest.class.getResource("props/test3.properties"), true))); assertEquals("jklm", configuration.getString("a.b.c")); assertEquals("testValue", configuration.getString("testProperty")); }
public ClusterClient buildClusterClient() { String clusterName = _senseiConf.getString(SENSEI_CLUSTER_NAME); String clusterClientName = _senseiConf.getString(SENSEI_CLUSTER_CLIENT_NAME, clusterName); String zkUrl = _senseiConf.getString(SENSEI_CLUSTER_URL); int zkTimeout = _senseiConf.getInt(SENSEI_CLUSTER_TIMEOUT, 300000); ClusterClient clusterClient = new ZooKeeperClusterClient(clusterClientName, clusterName, zkUrl, zkTimeout); logger.info("Connecting to cluster: " + clusterName + " ..."); clusterClient.awaitConnectionUninterruptibly(); logger.info("Cluster: " + clusterName + " successfully connected "); return clusterClient; }
/** * Configuration parameters for an interval are: * * <ul> * <li><code>[@left] (double)</code> Left extremum * <li><code>[@right] (double)</code> Right extremum * <li><code>[@closure] (String)</code> Interval closure. Supported values are "closed-closed", * "closed-open", "open-closed" and "open-open". Default value is "closed-closed". * </ul> */ public void configure(Configuration configuration) { // Get left extremum double left = configuration.getDouble("[@left]"); // Set left extremum setLeft(left); // Get right extremum double right = configuration.getDouble("[@right]"); // Set right extremum setRight(right); // Get closure string String closureString = configuration.getString("[@closure]", "closed-closed"); // Convert closureString Closure closure; if (closureString.equals("closed-closed")) { closure = Closure.ClosedClosed; } else if (closureString.equals("open-open")) { closure = Closure.OpenOpen; } else if (closureString.equals("closed-open")) { closure = Closure.ClosedOpen; } else if (closureString.equals("open-closed")) { closure = Closure.OpenClosed; } else { throw new ConfigurationRuntimeException("Illegal value for interval closure"); } // Set closure setClosure(closure); }
/** * Returns a list of all configured weather locations. * * @return */ @Override public List<IServiceModel> getServiceData(boolean forceRefresh) { if (!forceRefresh && !latestServiceData.isEmpty()) { return latestServiceData; } List<IServiceModel> infoList = new ArrayList<IServiceModel>(); final Configuration configuration = Config.getConfiguration("weather.properties"); int count = 0; while (true) { count++; String url = configuration.getString(String.valueOf(count)); if (!StringUtils.isEmpty(url)) { WeatherInfo info = getWeather(url); if (info != null) { info.setDefaultLocation(count == 1); infoList.add(info); } } else { break; } } latestServiceData = infoList; return latestServiceData; }