org.neo4j.kernel.configuration.Config.getRaw()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(8.0k)|赞(0)|评价(0)|浏览(129)

本文整理了Java中org.neo4j.kernel.configuration.Config.getRaw()方法的一些代码示例,展示了Config.getRaw()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Config.getRaw()方法的具体详情如下:
包路径:org.neo4j.kernel.configuration.Config
类名称:Config
方法名:getRaw

Config.getRaw介绍

暂无

代码示例

代码示例来源:origin: neo4j/neo4j

@Nonnull
private String getDefaultProvider( @Nullable String indexName, @Nonnull Config dbConfig )
{
  return dbConfig.getRaw( "index." + indexName )
      .orElseGet( () -> dbConfig.getRaw( "index" ).orElse( "lucene" ) );
}

代码示例来源:origin: neo4j/neo4j

/**
   * @param config initial configuration for the database.
   * @return an instance of {@link GraphDatabaseService}.
   */
  default GraphDatabaseService newDatabase( @Nonnull Config config )
  {
    return newDatabase( config.getRaw() );
  }
}

代码示例来源:origin: neo4j/neo4j

@Override
public int denseNodeThreshold()
{
  return config.getRaw().containsKey( dense_node_threshold.name() )
      ? config.get( dense_node_threshold )
      : defaults.denseNodeThreshold();
}

代码示例来源:origin: neo4j/neo4j

private Config mockConfig( Map<String,String> rawConfig )
  {
    Config config = Mockito.mock( Config.class );

    when( config.getRaw() ).thenReturn( rawConfig );
    when( config.get( strict_config_validation ) )
        .thenReturn( Boolean.valueOf( rawConfig.get( strict_config_validation.name() ) ) );

    return config;
  }
}

代码示例来源:origin: neo4j/neo4j

@Override
public Map<String,String> validate( @Nonnull Config config, @Nonnull Log log ) throws InvalidSettingException
  Map<String,String> rawConfig = config.getRaw();
  Map<String,String> validConfig = stringMap();
  for ( SettingValidator validator : settingValidators )

代码示例来源:origin: neo4j/neo4j

public static DbRepresentation of( File storeDir, boolean includeIndexes, Config config )
{
  GraphDatabaseBuilder builder = new TestGraphDatabaseFactory().newEmbeddedDatabaseBuilder( storeDir );
  builder.setConfig( config.getRaw() );
  GraphDatabaseService db = builder.newGraphDatabase();
  try
  {
    return of( db, includeIndexes );
  }
  finally
  {
    db.shutdown();
  }
}

代码示例来源:origin: neo4j/neo4j

private BatchInserter newBatchInserter( Config config ) throws Exception
{
  return BatchInserters.inserter( storeDir.databaseDir(), fileSystemRule.get(), config.getRaw() );
}

代码示例来源:origin: neo4j/neo4j

@Test( expected = ToolFailureException.class )
public void failOnNotCleanlyShutdownStoreWithLogsInCustomAbsoluteLocation() throws Exception
{
  File customConfigFile = testDirectory.file( "customConfig" );
  File otherLocation = testDirectory.directory( "otherLocation" );
  Config customConfig = Config.defaults( logical_logs_location, otherLocation.getAbsolutePath() );
  createGraphDbAndKillIt( customConfig );
  MapUtil.store( customConfig.getRaw(), customConfigFile );
  String[] args = {testDirectory.databaseDir().getPath(), "-config", customConfigFile.getPath()};
  runConsistencyCheckToolWith( fs.get(), args );
}

代码示例来源:origin: neo4j/neo4j

@Test( expected = ToolFailureException.class )
public void failOnNotCleanlyShutdownStoreWithLogsInCustomRelativeLocation() throws Exception
{
  File customConfigFile = testDirectory.file( "customConfig" );
  Config customConfig = Config.defaults( logical_logs_location, "otherLocation" );
  createGraphDbAndKillIt( customConfig );
  MapUtil.store( customConfig.getRaw(), fs.openAsOutputStream( customConfigFile, false ) );
  String[] args = {testDirectory.databaseDir().getPath(), "-config", customConfigFile.getPath()};
  runConsistencyCheckToolWith( fs.get(), args );
}

代码示例来源:origin: neo4j/neo4j

private GraphDatabaseService graphDatabaseService( Config config )
{
  TestGraphDatabaseFactory factory = new TestGraphDatabaseFactory();
  factory.setFileSystem( fileSystemRule.get() );
  return factory.newImpermanentDatabaseBuilder( storeDir.databaseDir() )
      // Shouldn't be necessary to set dense node threshold since it's a stick config
      .setConfig( config.getRaw() )
      .newGraphDatabase();
}

代码示例来源:origin: neo4j/neo4j

private void recoverBrokenStoreWithConfig( Config config ) throws IOException
{
  try ( FileSystemAbstraction fileSystemAbstraction = createSomeDataAndCrash( storeDir, fileSystem, config ) )
  {
    PageCache pageCache = pageCacheRule.getPageCache( fileSystemAbstraction );
    RecoveryRequiredChecker recoverer = getRecoveryChecker( fileSystemAbstraction, pageCache, config );
    assertThat( recoverer.isRecoveryRequiredAt( databaseLayout ), is( true ) );
    new TestGraphDatabaseFactory()
        .setFileSystem( fileSystemAbstraction )
        .newEmbeddedDatabaseBuilder( storeDir )
        .setConfig( config.getRaw() )
        .newGraphDatabase()
        .shutdown();
    assertThat( recoverer.isRecoveryRequiredAt( databaseLayout ), is( false ) );
  }
}

代码示例来源:origin: neo4j/neo4j

private static FileSystemAbstraction createSomeDataAndCrash( File store, EphemeralFileSystemAbstraction fileSystem, Config config )
  {
    final GraphDatabaseService db = new TestGraphDatabaseFactory()
            .setFileSystem( fileSystem )
            .newImpermanentDatabaseBuilder( store )
            .setConfig( config.getRaw() )
            .newGraphDatabase();

    try ( Transaction tx = db.beginTx() )
    {
      db.createNode();
      tx.success();
    }

    EphemeralFileSystemAbstraction snapshot = fileSystem.snapshot();
    db.shutdown();
    return snapshot;
  }
}

代码示例来源:origin: neo4j/neo4j

private void createGraphDbAndKillIt( Config config ) throws Exception
{
  final GraphDatabaseService db = new TestGraphDatabaseFactory()
      .setFileSystem( fs.get() )
      .newImpermanentDatabaseBuilder( testDirectory.databaseDir() )
      .setConfig( config.getRaw()  )
      .newGraphDatabase();
  try ( Transaction tx = db.beginTx() )
  {
    db.createNode( label( "FOO" ) );
    db.createNode( label( "BAR" ) );
    tx.success();
  }
  fs.snapshot( db::shutdown );
}

代码示例来源:origin: neo4j-contrib/neo4j-apoc-procedures

public static void initialize(GraphDatabaseAPI db) {
  Static.clear();
  Config neo4jConfig = db.getDependencyResolver().resolveDependency(Config.class);
  Map<String, String> params = neo4jConfig.getRaw();
  apocConfig.clear();
  apocConfig.putAll(Util.subMap(params, PREFIX));
  PARAM_WHITELIST.forEach((k, v) -> {
    Optional<Object> configValue = neo4jConfig.getValue(k);
    if (configValue.isPresent()) {
      apocConfig.put(v, configValue.get().toString());
    }
  });
  config.clear();
  params.forEach((k, v) -> { if (!SKIP.matcher(k).find()) {config.put(k, v);} });
}

代码示例来源:origin: org.neo4j/neo4j-kernel

@Nonnull
private String getDefaultProvider( @Nullable String indexName, @Nonnull Config dbConfig )
{
  return dbConfig.getRaw( "index." + indexName )
      .orElseGet( () -> dbConfig.getRaw( "index" ).orElse( "lucene" ) );
}

代码示例来源:origin: com.graphaware.neo4j/runtime

private Map<String, String> findModuleConfig(String moduleId) {
  Map<String, String> moduleConfig = new HashMap<>();
  String moduleConfigKeyPrefix = MODULE_CONFIG_KEY + "." + moduleId + ".";
  for (String paramKey : config.getRaw().keySet()) {
    if (paramKey.startsWith(moduleConfigKeyPrefix) || !MODULE_ENABLED_KEY.matcher(paramKey).find()) {
      moduleConfig.put(paramKey.replace(moduleConfigKeyPrefix, ""), config.getRaw(paramKey).get());
    }
  }
  return moduleConfig;
}

代码示例来源:origin: org.neo4j/neo4j-kernel

/**
   * @param config initial configuration for the database.
   * @return an instance of {@link GraphDatabaseService}.
   */
  default GraphDatabaseService newDatabase( @Nonnull Config config )
  {
    return newDatabase( config.getRaw() );
  }
}

代码示例来源:origin: org.neo4j/neo4j-backup

public void recoverWithDatabase( Path targetDirectory, PageCache pageCache, Config config )
  {
    Map<String,String> configParams = config.getRaw();
    configParams.put( GraphDatabaseSettings.logical_logs_location.name(), targetDirectory.toString() );
    configParams.put( GraphDatabaseSettings.pagecache_warmup_enabled.name(), Settings.FALSE );
    GraphDatabaseAPI targetDb = startTemporaryDb( targetDirectory, pageCache, configParams );
    targetDb.shutdown();
  }
}

代码示例来源:origin: org.neo4j/neo4j-kernel

@Override
public int denseNodeThreshold()
{
  return config.getRaw().containsKey( dense_node_threshold.name() )
      ? config.get( dense_node_threshold )
      : defaults.denseNodeThreshold();
}

代码示例来源:origin: com.graphaware.neo4j/server

private StatsCollector createStatsCollector() {
  String disable = neoServer.getConfig().getRaw().get("com.graphaware.runtime.stats.disable");
  String disabled = neoServer.getConfig().getRaw().get("com.graphaware.runtime.stats.disabled");
  if (Boolean.parseBoolean(disable) || Boolean.parseBoolean(disabled)) {
    LOG.info("Google Analytics disabled");
    return NullStatsCollector.getInstance();
  } else {
    LOG.info("Google Analytics enabled");
  }
  return new GoogleAnalyticsStatsCollector(neoServer.getDatabase().getGraph());
}

相关文章