public void checkProperty(String name) { if (!mProperties.containsKey(name)) { throw new RuntimeException("Failed to find required configuration option '" + name + "'."); } }
/** * Constructor for the multiple star-trees builder. * * @param builderConfigs List of builder configs * @param indexDir Index directory * @param buildMode Build mode (ON_HEAP or OFF_HEAP) * @throws Exception */ public MultipleTreesBuilder(List<StarTreeV2BuilderConfig> builderConfigs, File indexDir, BuildMode buildMode) throws Exception { _builderConfigs = builderConfigs; _segmentDirectory = SegmentDirectoryPaths.findSegmentDirectory(indexDir); _segment = ImmutableSegmentLoader.load(indexDir, ReadMode.mmap); _metadataProperties = new PropertiesConfiguration(new File(_segmentDirectory, V1Constants.MetadataKeys.METADATA_FILE_NAME)); Preconditions .checkState(!_metadataProperties.getBoolean(V1Constants.MetadataKeys.StarTree.STAR_TREE_ENABLED, false), "Star-tree already exists"); Preconditions .checkState(!_metadataProperties.containsKey(MetadataKey.STAR_TREE_COUNT), "Star-tree v2 already exists"); _buildMode = buildMode; }
/** * Helper method to set time related information: * <ul> * <li> Time column Name. </li> * <li> Tine Unit. </li> * <li> Time Interval. </li> * <li> Start and End time. </li> * </ul> */ private void setTimeInfo(PropertiesConfiguration segmentMetadataPropertiesConfiguration) { _timeColumn = segmentMetadataPropertiesConfiguration.getString(TIME_COLUMN_NAME); if (segmentMetadataPropertiesConfiguration.containsKey(SEGMENT_START_TIME) && segmentMetadataPropertiesConfiguration .containsKey(SEGMENT_END_TIME) && segmentMetadataPropertiesConfiguration.containsKey(TIME_UNIT)) { try { _timeUnit = TimeUtils.timeUnitFromString(segmentMetadataPropertiesConfiguration.getString(TIME_UNIT)); _timeGranularity = new Duration(_timeUnit.toMillis(1)); String startTimeString = segmentMetadataPropertiesConfiguration.getString(SEGMENT_START_TIME); String endTimeString = segmentMetadataPropertiesConfiguration.getString(SEGMENT_END_TIME); _segmentStartTime = Long.parseLong(startTimeString); _segmentEndTime = Long.parseLong(endTimeString); _timeInterval = new Interval(_timeUnit.toMillis(_segmentStartTime), _timeUnit.toMillis(_segmentEndTime)); } catch (Exception e) { LOGGER.warn("Caught exception while setting time interval and granularity", e); _timeInterval = null; _timeGranularity = null; _segmentStartTime = Long.MAX_VALUE; _segmentEndTime = Long.MIN_VALUE; } } }
private void init(PropertiesConfiguration segmentMetadataPropertiesConfiguration) { if (segmentMetadataPropertiesConfiguration.containsKey(SEGMENT_CREATOR_VERSION)) { _creatorName = segmentMetadataPropertiesConfiguration.getString(SEGMENT_CREATOR_VERSION); if (segmentMetadataPropertiesConfiguration.containsKey(SEGMENT_PADDING_CHARACTER)) { String padding = segmentMetadataPropertiesConfiguration.getString(SEGMENT_PADDING_CHARACTER); _paddingCharacter = StringEscapeUtils.unescapeJava(padding).charAt(0);
builder.setTimeUnit(TimeUnit.valueOf(config.getString(TIME_UNIT, "DAYS").toUpperCase())); char paddingCharacter = V1Constants.Str.LEGACY_STRING_PAD_CHAR; if (config.containsKey(SEGMENT_PADDING_CHARACTER)) { String padding = config.getString(SEGMENT_PADDING_CHARACTER); paddingCharacter = StringEscapeUtils.unescapeJava(padding).charAt(0);
@Override public boolean containsKey(String key) { return conf.containsKey(key); }
@Override public synchronized boolean containsKey( Object key ) { if ( key == null || key instanceof String ) { return propertiesConfiguration.containsKey( (String) key ); } return false; }
@Override public boolean containsKey(String key) { return conf.containsKey(key); }
@Override public boolean containsKey(String key) { return conf.containsKey(key); }
public String[] getPreloadedEdgeLabels() { return conf.containsKey(Keys.PRELOAD_EDGES) ? conf.getStringArray(Keys.PRELOAD_EDGES) : null; }
public String[] getPreloadedEdgeLabels() { return conf.containsKey(Keys.PRELOAD_EDGES) ? conf.getStringArray(Keys.PRELOAD_EDGES) : null; }
public String[] getPreloadedProperties() { return conf.containsKey(Keys.PRELOADED_PROPERTIES) ? conf.getStringArray(Keys.PRELOADED_PROPERTIES) : null; }
/** * Gets a configuration property with multiple values, returned in an array. * The values are expected to be separated by comma and optional whitespace. * Returns the default value (which may be null) when there is no such key * * Use when key is not part of keys predefined in PropertyKeys * * @param key * @param defaultValue * String[] - default value to return if key does not exist. Can be {@code null}. * @return property value as an array of {@link java.lang.String} objects, or defaultValue, * which may be {@code null}. */ public String[] getConfigurationPropertyArray(final String key, final String[] defaultValue) { return configuration.containsKey( key ) ? configuration.getStringArray( key ) : defaultValue; }
public String[] getPreloadedProperties() { return conf.containsKey(Keys.PRELOADED_PROPERTIES) ? conf.getStringArray(Keys.PRELOADED_PROPERTIES) : null; }
/** * Print out this configuration. */ public void print() { System.out.println(AccumuloGraphConfiguration.class+":"); for (String key : getValidInternalKeys()) { String value = "(null)"; if (conf.containsKey(key)) { value = conf.getProperty(key).toString(); } System.out.println(" "+key+" = "+value); } }
/** * Print out this configuration. */ public void print() { System.out.println(AccumuloGraphConfiguration.class+":"); for (String key : getValidInternalKeys()) { String value = "(null)"; if (conf.containsKey(key)) { value = conf.getProperty(key).toString(); } System.out.println(" "+key+" = "+value); } }
public Authorizations getAuthorizations() { return conf.containsKey(Keys.AUTHORIZATIONS) ? new Authorizations(conf.getString(Keys.AUTHORIZATIONS).getBytes()) : null; }
private int getLongRetryDelay(Connector connector) { String key = connector.getName() + ".longRetryDelay"; if (env.connectors.containsKey(key)) { return Integer.valueOf((String)env.connectors.getProperty(key)); } else { return Integer.valueOf((String)env.connectors.getProperty("longRetryDelay")); } }
private int getMaxRetries(Connector connector) { String key = connector.getName() + ".maxRetries"; if (env.connectors.containsKey(key)) { return Integer.valueOf((String)env.connectors.getProperty(key)); } else { return Integer.valueOf((String)env.connectors.getProperty("maxRetries")); } }
private int getShortRetryDelay(Connector connector) { String key = connector.getName() + ".shortRetryDelay"; if (env.connectors.containsKey(key)) { return Integer.valueOf((String)env.connectors.getProperty(key)); } else { return Integer.valueOf((String)env.connectors.getProperty("shortRetryDelay")); } }