Refine search
boolean readIsSharedConfigurationEnabled() { if (this.optionalFields == null || this.optionalFields.isEmpty()) { return false; } return Boolean.parseBoolean((this.optionalFields.getProperty(IS_SHARED_CONFIG_ENABLED))); }
private String getVariable(String key, Properties prop) { if (prop != null && !prop.isEmpty()) { return prop.getProperty(key, System.getenv(key)); } else { return System.getenv(key); } } }
/** * Clones all the values from the properties. If the value is null, it will be ignored. * * @param properties to clone */ private void clone(final Properties properties) { if (properties.isEmpty()) return; synchronized (properties) { for (final String key : properties.stringPropertyNames()) { final String value = properties.getProperty(key); if (!Strings.isNullOrEmpty(value)) { data.put(key, value); } } } } }
private String getNotifyOptions(RedisConnection connection) { try { Properties config = connection.getConfig(CONFIG_NOTIFY_KEYSPACE_EVENTS); if (config.isEmpty()) { return ""; } return config.getProperty(config.stringPropertyNames().iterator().next()); } catch (InvalidDataAccessApiUsageException ex) { throw new IllegalStateException( "Unable to configure Redis to keyspace notifications. See http://docs.spring.io/spring-session/docs/current/reference/html5/#api-redisoperationssessionrepository-sessiondestroyedevent", ex); } }
@Override public CacheEventListener createCacheEventListener(Properties props) { try { if (props == null || props.isEmpty()) { manager = EhcacheHydratedCacheManagerImpl.getInstance(); } else { String managerClass = props.getProperty("managerClass"); Class<?> clazz = Class.forName(managerClass); Method method = clazz.getDeclaredMethod("getInstance"); manager = (HydratedCacheManager) method.invoke(null); } } catch (Exception e) { throw new RuntimeException("Unable to create a CacheEventListener instance", e); } return (CacheEventListener) manager; }
/** * Check for the optional field {@link #HOSTED_LOCATORS} and return the value or null. */ Collection<String> readHostedLocators() { if (this.optionalFields == null || this.optionalFields.isEmpty()) { return null; } Collection<String> hostedLocators = null; String hostedLocatorsString = this.optionalFields.getProperty(HOSTED_LOCATORS); if (hostedLocatorsString != null && !hostedLocatorsString.isEmpty()) { StringTokenizer st = new StringTokenizer(hostedLocatorsString, COMMA_DELIMITER); hostedLocators = new ArrayList<String>(); while (st.hasMoreTokens()) { String locatorString = st.nextToken(); if (locatorString != null && !locatorString.isEmpty()) { hostedLocators.add(locatorString); } } if (hostedLocators.isEmpty()) { hostedLocators = null; } } return hostedLocators; }
/** * add calcite props into queryToggles */ private void addServerProps(Map<String, String> queryToggles, KylinConnection connection) { Properties connProps = connection.getConnectionProperties(); Properties props = new Properties(); for (String key : connProps.stringPropertyNames()) { if (Driver.CLIENT_CALCITE_PROP_NAMES.contains(key)) { props.put(key, connProps.getProperty(key)); } } if (props.isEmpty()) { return; } StringWriter writer = new StringWriter(); try { props.store(writer, ""); } catch (IOException ignored) { // ignored return; } queryToggles.put("JDBC_CLIENT_CALCITE_PROPS", writer.toString()); }
/** * <p> * Adds Step level properties to the context. * </p> * * @param properties the step {@link Properties} to add */ public void setStepProperties(Map<String, Properties> properties) { Assert.notNull(properties, "Step properties cannot be null"); for(Map.Entry<String, Properties> propertiesEntry : properties.entrySet()) { String stepName = propertiesEntry.getKey(); Properties stepProperties = propertiesEntry.getValue(); if (!stepProperties.isEmpty()) { if (this.stepProperties.containsKey(stepName)) { Properties existingStepProperties = this.stepProperties.get(stepName); Enumeration<?> stepPropertyNames = stepProperties.propertyNames(); while(stepPropertyNames.hasMoreElements()) { String propertyEntryName = (String) stepPropertyNames.nextElement(); existingStepProperties.put(propertyEntryName, stepProperties.getProperty(propertyEntryName)); } this.stepProperties.put(stepName, existingStepProperties); } else { this.stepProperties.put(stepName, propertiesEntry.getValue()); } } } }
@Override public IRichBolt getConsumer() { Preconditions.checkArgument(!props.isEmpty(), "Writable MongoDB must contain collection config"); String serField; if (props.contains(VALUE_SERIALIZED_FIELD)) { serField = props.getProperty(VALUE_SERIALIZED_FIELD); } else if (props.contains(TRIDENT_VALUE_SERIALIZED_FIELD)) { // backward compatibility serField = props.getProperty(TRIDENT_VALUE_SERIALIZED_FIELD); } else { serField = DEFAULT_VALUE_SERIALIZED_FIELD; } MongoMapper mapper = new SqlMongoMapper(serField, serializer); return new MongoInsertBolt(url, props.getProperty(COLLECTION_NAME), mapper); } }
private void setJobPropertiesBean(Properties properties) { if (batchArtifactType.equals(BatchArtifactType.JOB)) { Map<String, String> jobProperties = new HashMap<>(); if (properties != null && !properties.isEmpty()) { for (String param : properties.stringPropertyNames()) { jobProperties.put(param, properties.getProperty(param)); } } BeanDefinition jobPropertiesBeanDefinition = parserContext.getRegistry().getBeanDefinition(JOB_PROPERTIES_BEAN_NAME); jobPropertiesBeanDefinition.getConstructorArgumentValues().addGenericArgumentValue(jobProperties); } }
/** * START_REPLICATION SLOT slot_name LOGICAL XXX/XXX [ ( option_name [option_value] [, ... ] ) ] */ private String createStartLogicalQuery(LogicalReplicationOptions options) { StringBuilder builder = new StringBuilder(); builder.append("START_REPLICATION SLOT ") .append(options.getSlotName()) .append(" LOGICAL ") .append(options.getStartLSNPosition().asString()); Properties slotOptions = options.getSlotOptions(); if (slotOptions.isEmpty()) { return builder.toString(); } //todo replace on java 8 builder.append(" ("); boolean isFirst = true; for (String name : slotOptions.stringPropertyNames()) { if (isFirst) { isFirst = false; } else { builder.append(", "); } builder.append('\"').append(name).append('\"').append(" ") .append('\'').append(slotOptions.getProperty(name)).append('\''); } builder.append(")"); return builder.toString(); }
} else if (cacheProperties.isEmpty()) { List<String> fileList = new ArrayList<String>(); if (sourceDirectoryList != null && !sourceDirectoryList.isEmpty()) { String md5 = cacheProperties.getProperty(cacheKey); if (!sourceFileMd5.equals(md5)) { sourceList.add(fullFilename);
public static String getUrl(Properties props) throws BeelineHS2ConnectionFileParseException { if (props == null || props.isEmpty()) { return null; urlSb.append(propertyName); urlSb.append("="); urlSb.append(props.getProperty(propertyName));
if (overlayProperties.isEmpty()) { return names; String deprecatedKey = deprecations.getReverseDeprecatedKeyMap().get(n); if (deprecatedKey != null && !overlayProperties.containsKey(n)) { String deprecatedValue = overlayProperties.getProperty(deprecatedKey); if (deprecatedValue != null) { getProps().setProperty(n, deprecatedValue);
if (!properties.isEmpty()) { Enumeration<?> propertyNames = properties.propertyNames(); while (propertyNames.hasMoreElements()) { String propertyName = String.valueOf(propertyNames.nextElement()); propertiesLogDump.append("\t").append(propertyName).append(" = ").append(properties.getProperty(propertyName)).append(NEW_LINE);
if (overlayProperties.isEmpty()) { return names; String deprecatedKey = deprecations.getReverseDeprecatedKeyMap().get(n); if (deprecatedKey != null && !overlayProperties.containsKey(n)) { String deprecatedValue = overlayProperties.getProperty(deprecatedKey); if (deprecatedValue != null) { getProps().setProperty(n, deprecatedValue);
} else if (cacheProperties.isEmpty()) { List<String> fileList = new ArrayList<String>(); if (sourceDirectoryList != null && !sourceDirectoryList.isEmpty()) { String md5 = cacheProperties.getProperty(cacheKey); if (!sourceFileMd5.equals(md5)) { sourceList.add(fullFilename);
String locatorStr = null; if (props != null && !props.isEmpty()) { String serverPortStr = props.getProperty(SERVERPORT_PROPERTY_NAME); if (serverPortStr != null) { serverPort = Integer.parseInt(serverPortStr); serverHost = props.getProperty(SERVERHOST_PROPERTY_NAME, SERVERHOST_PROPERTY_DEFAULT); locatorStr = props.getProperty(LOCATOR_PROPERTY_NAME); String topology = props.getProperty(TOPOLOGY_PROPERTY_NAME);
if (!overriddenDefaults.isEmpty()) { for (String key : overriddenDefaults.stringPropertyNames()) { key.substring(ProcessLauncherContext.OVERRIDDEN_DEFAULTS_PREFIX.length()); if (!props.containsKey(property)) { props.put(property, overriddenDefaults.getProperty(key)); sourceMap.put(property, ConfigSource.launcher());
Properties options = extractOptions(credentialString); if (!options.isEmpty()) { String authMechanism = options.getProperty(AUTH_MECHANISM_KEY);