本文整理了Java中org.neo4j.kernel.configuration.Config.isConfigured()
方法的一些代码示例,展示了Config.isConfigured()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Config.isConfigured()
方法的具体详情如下:
包路径:org.neo4j.kernel.configuration.Config
类名称:Config
方法名:isConfigured
[英]Test whether a setting is configured or not. Can be used to check if default value will be returned or not.
[中]测试是否配置了设置。可用于检查是否返回默认值。
代码示例来源:origin: neo4j/neo4j
@Override
protected PlatformModule createPlatform( File storeDir, Config config, Dependencies dependencies )
{
File absoluteStoreDir = storeDir.getAbsoluteFile();
File databasesRoot = absoluteStoreDir.getParentFile();
if ( !config.isConfigured( GraphDatabaseSettings.shutdown_transaction_end_timeout ) )
{
config.augment( GraphDatabaseSettings.shutdown_transaction_end_timeout, "0s" );
}
config.augment( GraphDatabaseSettings.ephemeral, Settings.FALSE );
config.augment( GraphDatabaseSettings.active_database, absoluteStoreDir.getName() );
config.augment( GraphDatabaseSettings.databases_root_path, databasesRoot.getAbsolutePath() );
if ( impermanent )
{
config.augment( ephemeral, TRUE );
return new ImpermanentTestDatabasePlatformModule( databasesRoot, config, dependencies, this.databaseInfo );
}
else
{
return new TestDatabasePlatformModule( databasesRoot, config, dependencies, this.databaseInfo );
}
}
代码示例来源:origin: neo4j/neo4j
public Builder addBoltConnectorFromConfig( String key, String scheme, Config config, Setting<URI> override, ConnectorPortRegister portRegister )
{
// If an override is configured, add it with the HIGHEST precedence
if ( config.isConfigured( override ) )
{
add( key, config.get( override ), HIGHEST );
}
config.enabledBoltConnectors().stream().findFirst().ifPresent( c ->
{
AdvertisedSocketAddress address = config.get( c.advertised_address );
int port = address.getPort();
if ( port == 0 )
{
port = portRegister.getLocalAddress( c.key() ).getPort();
}
// If advertised address is explicitly set, set the precedence to HIGH - eitherwise set it as LOWEST (default)
add( key, scheme, address.getHostname(), port, config.isConfigured( c.advertised_address ) ? HIGH : LOWEST );
} );
return this;
}
代码示例来源:origin: neo4j/neo4j
@Test
public void isConfigured()
{
Config config = Config();
assertFalse( config.isConfigured( MySettingsWithDefaults.hello ) );
config.augment( MySettingsWithDefaults.hello, "Hi" );
assertTrue( config.isConfigured( MySettingsWithDefaults.hello ) );
}
代码示例来源:origin: neo4j/neo4j
@Test
public void isConfiguredShouldNotReturnTrueEvenThoughDefaultValueExists()
{
Config config = Config();
assertFalse( config.isConfigured( MySettingsWithDefaults.hello ) );
assertEquals( "Hello, World!", config.get( MySettingsWithDefaults.hello ) );
}
代码示例来源:origin: org.neo4j/neo4j-causal-clustering
private void validateInitialDiscoveryMembers( Config config )
{
if ( !config.isConfigured( initial_discovery_members ) )
{
throw new InvalidSettingException(
String.format( "Missing mandatory non-empty value for '%s'", initial_discovery_members.name() ) );
}
}
}
代码示例来源:origin: org.neo4j.community/it-test-support
@Override
protected PlatformModule createPlatform( File storeDir, Config config, Dependencies dependencies )
{
File absoluteStoreDir = storeDir.getAbsoluteFile();
File databasesRoot = absoluteStoreDir.getParentFile();
if ( !config.isConfigured( GraphDatabaseSettings.shutdown_transaction_end_timeout ) )
{
config.augment( GraphDatabaseSettings.shutdown_transaction_end_timeout, "0s" );
}
config.augment( GraphDatabaseSettings.ephemeral, Settings.FALSE );
config.augment( GraphDatabaseSettings.active_database, absoluteStoreDir.getName() );
config.augment( GraphDatabaseSettings.databases_root_path, databasesRoot.getAbsolutePath() );
if ( impermanent )
{
config.augment( ephemeral, TRUE );
return new ImpermanentTestDatabasePlatformModule( databasesRoot, config, dependencies, this.databaseInfo );
}
else
{
return new TestDatabasePlatformModule( databasesRoot, config, dependencies, this.databaseInfo );
}
}
代码示例来源:origin: org.neo4j.app/neo4j-server
public Builder addBoltConnectorFromConfig( String key, String scheme, Config config, Setting<URI> override, ConnectorPortRegister portRegister )
{
// If an override is configured, add it with the HIGHEST precedence
if ( config.isConfigured( override ) )
{
add( key, config.get( override ), HIGHEST );
}
config.enabledBoltConnectors().stream().findFirst().ifPresent( c ->
{
AdvertisedSocketAddress address = config.get( c.advertised_address );
int port = address.getPort();
if ( port == 0 )
{
port = portRegister.getLocalAddress( c.key() ).getPort();
}
// If advertised address is explicitly set, set the precedence to HIGH - eitherwise set it as LOWEST (default)
add( key, scheme, address.getHostname(), port, config.isConfigured( c.advertised_address ) ? HIGH : LOWEST );
} );
return this;
}
内容来源于网络,如有侵权,请联系作者删除!