private static void load(ModuleConfig moduleConfig, OptionalInt num, List<LocalAppFileSystemConfig> configs) { StringBuilder driveNameTag = new StringBuilder("drive-name"); StringBuilder rootDirTag = new StringBuilder("root-dir"); StringBuilder remotelyAccessibleTag = new StringBuilder("remotely-accessible"); num.ifPresent(value -> { driveNameTag.append("-").append(value); rootDirTag.append("-").append(value); remotelyAccessibleTag.append("-").append(value); }); if (moduleConfig.hasProperty(driveNameTag.toString()) && moduleConfig.hasProperty(rootDirTag.toString())) { String driveName = moduleConfig.getStringProperty(driveNameTag.toString()); boolean remotelyAccessible = moduleConfig.getBooleanProperty(remotelyAccessibleTag.toString(), DEFAULT_REMOTELY_ACCESSIBLE); Path rootDir = moduleConfig.getPathProperty(rootDirTag.toString()); configs.add(new LocalAppFileSystemConfig(driveName, remotelyAccessible, rootDir)); } }
public static List<MapDbAppFileSystemConfig> load(PlatformConfig platformConfig) { return platformConfig.getOptionalModuleConfig("mapdb-app-file-system") .map(moduleConfig -> { List<MapDbAppFileSystemConfig> configs = new ArrayList<>(); if (moduleConfig.hasProperty("drive-name") && moduleConfig.hasProperty("db-file")) { String driveName = moduleConfig.getStringProperty("drive-name"); boolean remotelyAccessible = moduleConfig.getBooleanProperty("remotely-accessible", DEFAULT_REMOTELY_ACCESSIBLE); Path rootDir = moduleConfig.getPathProperty("db-file"); configs.add(new MapDbAppFileSystemConfig(driveName, remotelyAccessible, rootDir)); } int maxAdditionalDriveCount = moduleConfig.getIntProperty("max-additional-drive-count", 0); for (int i = 0; i < maxAdditionalDriveCount; i++) { if (moduleConfig.hasProperty("drive-name-" + i) && moduleConfig.hasProperty("db-file-" + i)) { String driveName = moduleConfig.getStringProperty("drive-name-" + i); boolean remotelyAccessible = moduleConfig.getBooleanProperty("remotely-accessible-" + i, DEFAULT_REMOTELY_ACCESSIBLE); Path rootDir = moduleConfig.getPathProperty("db-file-" + i); configs.add(new MapDbAppFileSystemConfig(driveName, remotelyAccessible, rootDir)); } } return configs; }) .orElse(Collections.emptyList()); }
double branchSideOneFaultShortCircuitDuration; double branchSideTwoFaultShortCircuitDuration; if ((config.hasProperty(BRANCH_SIDE_ONE_FAULT_SHORT_CIRCUIT_PROPERTY_NAME)) || (config.hasProperty(BRANCH_SIDE_TWO_FAULT_SHORT_CIRCUIT_PROPERTY_NAME))) { branchSideOneFaultShortCircuitDuration = config.getDoubleProperty(BRANCH_SIDE_ONE_FAULT_SHORT_CIRCUIT_PROPERTY_NAME); branchSideTwoFaultShortCircuitDuration = config.getDoubleProperty(BRANCH_SIDE_TWO_FAULT_SHORT_CIRCUIT_PROPERTY_NAME); if (config.hasProperty(BRANCH_FAULT_SHORT_CIRCUIT_PROPERTY_NAME)) { LOGGER.warn("deprecated property {} is overridden by properties {} and {} ", BRANCH_FAULT_SHORT_CIRCUIT_PROPERTY_NAME, BRANCH_SIDE_ONE_FAULT_SHORT_CIRCUIT_PROPERTY_NAME, BRANCH_SIDE_TWO_FAULT_SHORT_CIRCUIT_PROPERTY_NAME); if (config.hasProperty(BRANCH_FAULT_SHORT_CIRCUIT_PROPERTY_NAME)) { branchSideOneFaultShortCircuitDuration = config.getDoubleProperty(BRANCH_FAULT_SHORT_CIRCUIT_PROPERTY_NAME); branchSideTwoFaultShortCircuitDuration = branchSideOneFaultShortCircuitDuration;
assertEquals(Interval.parse("2009-01-03T18:15:05Z/2009-01-09T02:54:25Z"), modConfig.getIntervalProperty("it")); assertTrue(modConfig.hasProperty("p"));