@Override public Map<String, Object> getSubset(ConfigNamespace umbrella, String... umbrellaElements) { ImmutableMap.Builder<String, Object> b = ImmutableMap.builder(); Map<String, Object> fm = first.getSubset(umbrella, umbrellaElements); Map<String, Object> sm = second.getSubset(umbrella, umbrellaElements); b.putAll(first.getSubset(umbrella, umbrellaElements)); for (Map.Entry<String, Object> secondEntry : sm.entrySet()) { if (!fm.containsKey(secondEntry.getKey())) { b.put(secondEntry); } } return b.build(); } @Override
private static Map<String, IndexProvider> getIndexes(Configuration config) { ImmutableMap.Builder<String, IndexProvider> builder = ImmutableMap.builder(); for (String index : config.getContainedNamespaces(INDEX_NS)) { Preconditions.checkArgument(StringUtils.isNotBlank(index), "Invalid index name [%s]", index); log.info("Configuring index [{}]", index); IndexProvider provider = getImplementationClass(config.restrictTo(index), config.get(INDEX_BACKEND,index), StandardIndexProvider.getAllProviderClasses()); Preconditions.checkNotNull(provider); builder.put(index, provider); } return builder.build(); }
private static LogManager getLogManager(Configuration config, String logName, KeyColumnValueStoreManager sm) { Configuration logConfig = config.restrictTo(logName); String backend = logConfig.get(LOG_BACKEND); if (backend.equalsIgnoreCase(LOG_BACKEND.getDefaultValue())) { return new KCVSLogManager(sm,logConfig); } else { Preconditions.checkArgument(config!=null); LogManager lm = getImplementationClass(logConfig,logConfig.get(LOG_BACKEND),REGISTERED_LOG_MANAGERS); Preconditions.checkNotNull(lm); return lm; } }
this.compression = config.get(COMPRESSION); this.regionCount = config.has(REGION_COUNT) ? config.get(REGION_COUNT) : -1; this.regionsPerServer = config.has(REGIONS_PER_SERVER) ? config.get(REGIONS_PER_SERVER) : -1; this.skipSchemaCheck = config.get(SKIP_SCHEMA_CHECK); this.compatClass = config.has(COMPAT_CLASS) ? config.get(COMPAT_CLASS) : null; this.compat = HBaseCompatLoader.getCompat(compatClass); if (config.has(REGIONS_PER_SERVER) && config.has(REGION_COUNT)) { logger.warn("Both {} and {} are set in JanusGraph's configuration, but " + "the former takes precedence and the latter will be ignored.", Map<String,Object> configSub = config.getSubset(HBASE_CONFIGURATION_NAMESPACE); for (Map.Entry<String,Object> entry : configSub.entrySet()) { logger.info("HBase configuration: setting {}={}", entry.getKey(), entry.getValue()); if (config.has(GraphDatabaseConfiguration.STORAGE_HOSTS)) { String zkQuorumKey = "hbase.zookeeper.quorum"; String csHostList = Joiner.on(",").join(config.get(GraphDatabaseConfiguration.STORAGE_HOSTS)); hconf.set(zkQuorumKey, csHostList); logger.info("Copied host list from {} to {}: {}", GraphDatabaseConfiguration.STORAGE_HOSTS, zkQuorumKey, csHostList); this.shortCfNames = config.get(SHORT_CF_NAMES);
public static List<RegisteredAttributeClass<?>> getRegisteredAttributeClasses(Configuration configuration) { List<RegisteredAttributeClass<?>> all = new ArrayList<>(); for (String attributeId : configuration.getContainedNamespaces(CUSTOM_ATTRIBUTE_NS)) { Preconditions.checkArgument(attributeId.startsWith(ATTRIBUTE_PREFIX),"Invalid attribute definition: %s",attributeId); int position; String classname = configuration.get(CUSTOM_ATTRIBUTE_CLASS,attributeId); try { clazz = Class.forName(classname); Preconditions.checkArgument(configuration.has(CUSTOM_SERIALIZER_CLASS, attributeId)); String serializerName = configuration.get(CUSTOM_SERIALIZER_CLASS, attributeId); try { Class<?> serializerClass = Class.forName(serializerName);
public Client(final Configuration config) { final String credentialsClassName = config.get(Constants.DYNAMODB_CREDENTIALS_CLASS_NAME); final Class<?> clazz; try { final String[] credentialsConstructorArgsValues = config.get(Constants.DYNAMODB_CREDENTIALS_CONSTRUCTOR_ARGS); final List<String> filteredArgList = new ArrayList<>(); for (Object obj : credentialsConstructorArgsValues) { clientConfig.withConnectionTimeout(config.get(Constants.DYNAMODB_CLIENT_CONN_TIMEOUT)) .withConnectionTTL(config.get(Constants.DYNAMODB_CLIENT_CONN_TTL)) .withMaxConnections(config.get(Constants.DYNAMODB_CLIENT_MAX_CONN)) .withMaxErrorRetry(config.get(Constants.DYNAMODB_CLIENT_MAX_ERROR_RETRY)) .withGzip(config.get(Constants.DYNAMODB_CLIENT_USE_GZIP)) .withReaper(config.get(Constants.DYNAMODB_CLIENT_USE_REAPER)) .withUserAgentSuffix(config.get(Constants.DYNAMODB_CLIENT_USER_AGENT)) .withSocketTimeout(config.get(Constants.DYNAMODB_CLIENT_SOCKET_TIMEOUT)) .withSocketBufferSizeHints( config.get(Constants.DYNAMODB_CLIENT_SOCKET_BUFFER_SEND_HINT), config.get(Constants.DYNAMODB_CLIENT_SOCKET_BUFFER_RECV_HINT)) .withProxyDomain(config.get(Constants.DYNAMODB_CLIENT_PROXY_DOMAIN)) .withProxyWorkstation(config.get(Constants.DYNAMODB_CLIENT_PROXY_WORKSTATION)) .withProxyHost(config.get(Constants.DYNAMODB_CLIENT_PROXY_HOST)) .withProxyPort(config.get(Constants.DYNAMODB_CLIENT_PROXY_PORT)) .withProxyUsername(config.get(Constants.DYNAMODB_CLIENT_PROXY_USERNAME)) .withProxyPassword(config.get(Constants.DYNAMODB_CLIENT_PROXY_PASSWORD)); forceConsistentRead = config.get(Constants.DYNAMODB_FORCE_CONSISTENT_READ); enableParallelScan = config.get(Constants.DYNAMODB_ENABLE_PARALLEL_SCAN); prefix = config.get(Constants.DYNAMODB_TABLE_PREFIX);
@Override public Set<String> getContainedNamespaces(ConfigNamespace umbrella, String... umbrellaElements) { ImmutableSet.Builder<String> b = ImmutableSet.builder(); b.addAll(first.getContainedNamespaces(umbrella, umbrellaElements)); b.addAll(second.getContainedNamespaces(umbrella, umbrellaElements)); return b.build(); } @Override
@Override public Configuration restrictTo(String... umbrellaElements) { return new MergedConfiguration(first.restrictTo(umbrellaElements), second.restrictTo(umbrellaElements)); } }
public ElasticSearchIndex(Configuration config) throws BackendException { indexName = config.get(INDEX_NAME); useAllField = config.get(USE_ALL_FIELD); useExternalMappings = config.get(USE_EXTERNAL_MAPPINGS); allowMappingUpdate = config.get(ALLOW_MAPPING_UPDATE); createSleep = config.get(CREATE_SLEEP); ingestPipelines = config.getSubset(ES_INGEST_PIPELINES); final ElasticSearchSetup.Connection c = interfaceConfiguration(config); client = c.getClient(); batchSize = config.get(INDEX_MAX_RESULT_SET_SIZE); log.debug("Configured ES query nb result by query to {}", batchSize); client.clusterHealthRequest(config.get(HEALTH_REQUEST_TIMEOUT)); } catch (final IOException e) { throw new PermanentBackendException(e.getMessage(), e); if (!config.has(USE_DEPRECATED_MULTITYPE_INDEX) && client.isIndex(indexName)) { useMultitypeIndex = config.get(USE_DEPRECATED_MULTITYPE_INDEX); Preconditions.checkArgument(!useMultitypeIndex || !client.isAlias(indexName), "The key '" + USE_DEPRECATED_MULTITYPE_INDEX
public KCVSLogManager getKCVSLogManager(String logName) { Preconditions.checkArgument(configuration.restrictTo(logName).get(LOG_BACKEND).equalsIgnoreCase(LOG_BACKEND.getDefaultValue())); return (KCVSLogManager)getLogManager(logName); }
@Override public Set<String> getContainedNamespaces(ConfigNamespace umbrella, String... umbrellaElements) { return config.getContainedNamespaces(umbrella,concat(umbrellaElements)); }
@Override public Configuration restrictTo(String... umbrellaElements) { return config.restrictTo(concat(umbrellaElements)); } };
public DistributedStoreManager(Configuration storageConfig, int portDefault) { super(storageConfig); this.hostnames = storageConfig.get(STORAGE_HOSTS); Preconditions.checkArgument(hostnames.length > 0, "No hostname configured"); if (storageConfig.has(STORAGE_PORT)) this.port = storageConfig.get(STORAGE_PORT); else this.port = portDefault; this.connectionTimeoutMS = storageConfig.get(CONNECTION_TIMEOUT); this.pageSize = storageConfig.get(PAGE_SIZE); this.times = storageConfig.get(TIMESTAMP_PROVIDER); if (storageConfig.has(AUTH_USERNAME)) { this.username = storageConfig.get(AUTH_USERNAME); this.password = storageConfig.get(AUTH_PASSWORD); } else { this.username=null; this.password=null; } }
private void checkConfigDeprecation(org.janusgraph.diskstorage.configuration.Configuration config) { if (config.has(GraphDatabaseConfiguration.STORAGE_PORT)) { logger.warn("The configuration property {} is ignored for HBase. Set hbase.zookeeper.property.clientPort in hbase-site.xml or {}.hbase.zookeeper.property.clientPort in JanusGraph's configuration file.", ConfigElement.getPath(GraphDatabaseConfiguration.STORAGE_PORT), ConfigElement.getPath(HBASE_CONFIGURATION_NAMESPACE)); } }