private void loadNodeIdIfExists(File oldNodeIdFile, File newNodeIdFile) throws IOException { if (oldNodeIdFile.exists() && !newNodeIdFile.exists()) { this.myNodeId = FileUtil.readFileToString(GenericUtils.resolveLocation( Constants.DEPRECATED_MY_NODEID_LOCATION)).trim(); FileUtils.copyFile(oldNodeIdFile, newNodeIdFile); oldNodeIdFile.delete(); } else { this.myNodeId = FileUtil.readFileToString(GenericUtils.resolveLocation( Constants.MY_NODEID_LOCATION)).trim(); } }
private void initShardReplicaMap() throws AnalyticsException { String[] entries; String[] entryStrArray; int shardIndex; String shardReplicaConfig; try { shardReplicaConfig = FileUtil.readFileToString(GenericUtils.resolveLocation(Constants .LOCAL_SHARD_REPLICA_CONFIG_LOCATION)); } catch (FileNotFoundException e) { shardReplicaConfig = ""; } catch (IOException e) { throw new AnalyticsException("Error in loading local shard allocation configuration: " + e.getMessage(), e); } entries = shardReplicaConfig.split("\n"); int replica; for (String entry : entries) { entry = entry.trim(); if (!entry.isEmpty()) { entryStrArray = entry.split(","); shardIndex = Integer.parseInt(entryStrArray[0].trim()); replica = Integer.valueOf(entryStrArray[1].trim()); this.shardReplicaMap.put(shardIndex, replica); } } }
shardStatusConfig = FileUtil.readFileToString(GenericUtils.resolveLocation(Constants .LOCAL_SHARD_ALLOCATION_CONFIG_LOCATION)); String[] entries = shardStatusConfig.split("\n");
String configContent = FileUtil.readFileToString(srcConfigDir + File.separator + configPath); Resource resource = configRegistry.newResource(); resource.setContent(configContent.getBytes(Charset.defaultCharset()));
continue; String rxt = FileUtil.readFileToString(rxtDir + File.separator + rxtPath); Resource resource = systemRegistry.newResource(); resource.setContent(rxt.getBytes());
continue; String rxt = FileUtil.readFileToString(rxtDir + File.separator + rxtPath); Resource resource = registry.newResource(); resource.setContent(rxt.getBytes());
if (rxtCollection.getProperty(propertyName) == null) { rxtCollection.setProperty(propertyName, "true"); String rxt = FileUtil.readFileToString(rxtDir + File.separator + rxtPath); Resource resource = systemRegistry.newResource(); resource.setContent(rxt.getBytes());