public FileSystem getFsForDataset(Path path) throws IOException { Preconditions.checkArgument(this.props.containsKey(ConfigurationKeys.SUPER_USER_NAME_TO_PROXY_AS_OTHERS)); Preconditions.checkArgument(this.props.containsKey(ConfigurationKeys.SUPER_USER_KEY_TAB_LOCATION)); FileSystem proxiedFileSystem = this.fs; try { proxiedFileSystem = ProxiedFileSystemCache.getProxiedFileSystemUsingKeytab(this.fs.getFileStatus(path).getOwner(), this.props.getProperty(ConfigurationKeys.SUPER_USER_NAME_TO_PROXY_AS_OTHERS), new Path(this.props.getProperty(ConfigurationKeys.SUPER_USER_KEY_TAB_LOCATION)), this.fs.getUri(), this.fs.getConf()); } catch (ExecutionException e) { throw new IOException("Cannot get proxied filesystem at Path: " + path, e); } if (this.props.contains(DatasetCleaner.DATASET_CLEAN_HDFS_CALLS_PER_SECOND_LIMIT)) { return new RateControlledFileSystem(proxiedFileSystem, Long.parseLong(this.props.getProperty(DatasetCleaner.DATASET_CLEAN_HDFS_CALLS_PER_SECOND_LIMIT))); } return proxiedFileSystem; } }
try { FileSystem optionalRateControlledFs = targetFs; if (props.contains(DATASET_CLEAN_HDFS_CALLS_PER_SECOND_LIMIT)) { optionalRateControlledFs = this.closer.register(new RateControlledFileSystem(targetFs, Long.parseLong(props.getProperty(DATASET_CLEAN_HDFS_CALLS_PER_SECOND_LIMIT))));
public boolean contains(Object value) { return delegate.contains(value); }
public String getProperties() { if (this.properties == null) { return null; } Properties properties = new Properties(this.properties); if (properties.contains("password")) { properties.put("password", "******"); } return properties.toString(); }
/** * check the mimetype is referenced in the mimetypes database * * @param mimeType * the mimeType to verify */ public boolean isValidMimeType(String mimeType) { if (mimeType == null) { return false; } else if (mimeType.indexOf(";") != -1) { return mimetypes.contains(mimeType.split(";")[0]); } else { return mimetypes.contains(mimeType); } }
public boolean checkInterrupts() { if (checkInterrupts == null) { if (System.getProperties().contains("chronicle.queue.ignoreInterrupts")) return !Boolean.getBoolean("chronicle.queue.ignoreInterrupts"); if (System.getProperties().contains("chronicle.queue.checkInterrupts")) return Boolean.getBoolean("chronicle.queue.checkInterrupts"); } // default is true unless turned off. return !Boolean.FALSE.equals(checkInterrupts); }
public boolean contains(Object value) { return getDelegate().contains(value); }
@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); } }
public static Properties getAllDistributedSystemProperties(final Properties properties) { Properties dsProperties = DUnitEnv.get().getDistributedSystemProperties(); // our tests do not expect auto-reconnect to be on by default if (!dsProperties.contains(DISABLE_AUTO_RECONNECT)) { dsProperties.put(DISABLE_AUTO_RECONNECT, "true"); } for (Map.Entry<Object, Object> entry : properties.entrySet()) { String key = (String) entry.getKey(); Object value = entry.getValue(); dsProperties.put(key, value); } System.out.println("distributed system properties: " + dsProperties); return dsProperties; }
/** * Get a property from the underlying properties. * * @param key * the property key requested * @param defaultValue * the value to return if the property is not defined * @return the property value if found, defaultValue otherwise. */ public String getProperty(String key, String defaultValue) { String value; if (isSystemOverrides && System.getProperties().contains(key)) { value = System.getProperty(key); } else { value = p.getProperty(key, defaultValue); } if (value != null && replacements != null) { for (String s : replacements.keySet()) { if (value.contains(s)) { value = value.replace(s, replacements.get(s)); } } } return value; }
/** * Get a property from the underlying properties. * * @param key * the property key requested * @param defaultValue * the value to return if the property is not defined * @return the property value if found, defaultValue otherwise. */ public String getProperty(String key, String defaultValue) { String value; if (isSystemOverrides && System.getProperties().contains(key)) { value = System.getProperty(key); } else { value = p.getProperty(key, defaultValue); } if (value != null && replacements != null) { for (String s : replacements.keySet()) { if (value.contains(s)) { value = value.replace(s, replacements.get(s)); } } } return value; }
/** * Uses the properties {@link ConfigurationKeys#AZKABAN_EXECUTION_DAYS_LIST}, * {@link ConfigurationKeys#AZKABAN_EXECUTION_TIME_RANGE}, and * {@link TimeRangeChecker#isTimeInRange(List, String, String, DateTime)} to determine if the current job should * continue its execution based on the extra scheduled parameters defined in the config. * * @return true if this job should be launched, false otherwise. */ private boolean isCurrentTimeInRange() { Splitter splitter = Splitter.on(",").omitEmptyStrings().trimResults(); if (this.props.contains(ConfigurationKeys.AZKABAN_EXECUTION_DAYS_LIST) && this.props .contains(ConfigurationKeys.AZKABAN_EXECUTION_TIME_RANGE)) { List<String> executionTimeRange = splitter.splitToList(this.props.getProperty(ConfigurationKeys.AZKABAN_EXECUTION_TIME_RANGE)); List<String> executionDays = splitter.splitToList(this.props.getProperty(ConfigurationKeys.AZKABAN_EXECUTION_DAYS_LIST)); Preconditions.checkArgument(executionTimeRange.size() == 2, "The property " + ConfigurationKeys.AZKABAN_EXECUTION_DAYS_LIST + " should be a comma separated list of two entries"); return TimeRangeChecker.isTimeInRange(executionDays, executionTimeRange.get(0), executionTimeRange.get(1), new DateTime(DateTimeZone.forID(ConfigurationKeys.PST_TIMEZONE_NAME))); } return true; }
/** * Sets all deprecated properties that are not currently set but have a * corresponding new property that is set. Useful for iterating the * properties when all deprecated properties for currently set properties * need to be present. */ public void setDeprecatedProperties() { DeprecationContext deprecations = deprecationContext.get(); Properties props = getProps(); Properties overlay = getOverlay(); for (Map.Entry<String, DeprecatedKeyInfo> entry : deprecations.getDeprecatedKeyMap().entrySet()) { String depKey = entry.getKey(); if (!overlay.contains(depKey)) { for (String newKey : entry.getValue().newKeys) { String val = overlay.getProperty(newKey); if (val != null) { props.setProperty(depKey, val); overlay.setProperty(depKey, val); break; } } } } }
/** * Sets all deprecated properties that are not currently set but have a * corresponding new property that is set. Useful for iterating the * properties when all deprecated properties for currently set properties * need to be present. */ public void setDeprecatedProperties() { DeprecationContext deprecations = deprecationContext.get(); Properties props = getProps(); Properties overlay = getOverlay(); for (Entry<String, DeprecatedKeyInfo> entry : deprecations.getDeprecatedKeyMap().entrySet()) { String depKey = entry.getKey(); if (!overlay.contains(depKey)) { for (String newKey : entry.getValue().newKeys) { String val = overlay.getProperty(newKey); if (val != null) { props.setProperty(depKey, val); overlay.setProperty(depKey, val); break; } } } } }
/** * Sets all deprecated properties that are not currently set but have a * corresponding new property that is set. Useful for iterating the * properties when all deprecated properties for currently set properties * need to be present. */ public void setDeprecatedProperties() { DeprecationContext deprecations = deprecationContext.get(); Properties props = getProps(); Properties overlay = getOverlay(); for (Map.Entry<String, DeprecatedKeyInfo> entry : deprecations.getDeprecatedKeyMap().entrySet()) { String depKey = entry.getKey(); if (!overlay.contains(depKey)) { for (String newKey : entry.getValue().newKeys) { String val = overlay.getProperty(newKey); if (val != null) { props.setProperty(depKey, val); overlay.setProperty(depKey, val); break; } } } } }
if (!props.contains(prop.getKey())) { if (prop.getKey().contains(".")){ props.put(prop.getKey(), prop.getValue());
boolean shouldDistribute = dsParams.contains(ConfigParser.paramDistrib) && Boolean.parseBoolean(dsParams.getProperty(ConfigParser.paramDistrib)); dsParams.remove(ConfigParser.paramDistrib);
/** * Launch DUnit. If the unit test was launched through the hydra framework, leave the test alone. */ public static void launchIfNeeded() { if (System.getProperties().contains(VM_NUM_PARAM)) { // we're a dunit child vm, do nothing. return; } if (!isHydra() && !isLaunched()) { try { launch(); } catch (Exception e) { throw new RuntimeException("Unable to launch dunit VMs", e); } } Host.setAllVMsToCurrentVersion(); }
if (!properties.contains(ServiceBasedAppLauncher.APP_STOP_TIME_SECONDS)) { properties.setProperty(ServiceBasedAppLauncher.APP_STOP_TIME_SECONDS, Long.toString(300));