Skip to content

Commit

Permalink
Make discovery_type and discovery_implementation case insensitive.
Browse files Browse the repository at this point in the history
Make case sensitivity of options settings explicit.
  • Loading branch information
andrewkerr9000 committed Oct 3, 2018
1 parent 9ebbc9c commit fa475b1
Show file tree
Hide file tree
Showing 15 changed files with 48 additions and 46 deletions.
Expand Up @@ -75,8 +75,8 @@
import static org.neo4j.kernel.configuration.Settings.listenAddress; import static org.neo4j.kernel.configuration.Settings.listenAddress;
import static org.neo4j.kernel.configuration.Settings.matches; import static org.neo4j.kernel.configuration.Settings.matches;
import static org.neo4j.kernel.configuration.Settings.min; import static org.neo4j.kernel.configuration.Settings.min;
import static org.neo4j.kernel.configuration.Settings.options;
import static org.neo4j.kernel.configuration.Settings.optionsIgnoreCase; import static org.neo4j.kernel.configuration.Settings.optionsIgnoreCase;
import static org.neo4j.kernel.configuration.Settings.optionsObeyCase;
import static org.neo4j.kernel.configuration.Settings.pathSetting; import static org.neo4j.kernel.configuration.Settings.pathSetting;
import static org.neo4j.kernel.configuration.Settings.range; import static org.neo4j.kernel.configuration.Settings.range;
import static org.neo4j.kernel.configuration.Settings.setting; import static org.neo4j.kernel.configuration.Settings.setting;
Expand Down Expand Up @@ -189,12 +189,12 @@ public class GraphDatabaseSettings implements LoadableConfig
@Description( "Set this to specify the default parser (language version)." ) @Description( "Set this to specify the default parser (language version)." )
public static final Setting<String> cypher_parser_version = setting( public static final Setting<String> cypher_parser_version = setting(
"cypher.default_language_version", "cypher.default_language_version",
options( "2.3", "3.1", "3.3","3.5", DEFAULT ), DEFAULT ); optionsObeyCase( "2.3", "3.1", "3.3","3.5", DEFAULT ), DEFAULT );


@Description( "Set this to specify the default planner for the default language version." ) @Description( "Set this to specify the default planner for the default language version." )
public static final Setting<String> cypher_planner = setting( public static final Setting<String> cypher_planner = setting(
"cypher.planner", "cypher.planner",
options( "COST", "RULE", DEFAULT ), DEFAULT ); optionsObeyCase( "COST", "RULE", DEFAULT ), DEFAULT );


@Description( "Set this to specify the behavior when Cypher planner or runtime hints cannot be fulfilled. " @Description( "Set this to specify the behavior when Cypher planner or runtime hints cannot be fulfilled. "
+ "If true, then non-conformance will result in an error, otherwise only a warning is generated." ) + "If true, then non-conformance will result in an error, otherwise only a warning is generated." )
Expand Down Expand Up @@ -333,7 +333,7 @@ public class GraphDatabaseSettings implements LoadableConfig
"Setting the algorithm to 'none' will cause the threshold to not decay over time." ) "Setting the algorithm to 'none' will cause the threshold to not decay over time." )
@Internal @Internal
public static final Setting<String> cypher_replan_algorithm = setting( "unsupported.cypher.replan_algorithm", public static final Setting<String> cypher_replan_algorithm = setting( "unsupported.cypher.replan_algorithm",
options( "inverse", "exponential", "none", DEFAULT ), DEFAULT ); optionsObeyCase( "inverse", "exponential", "none", DEFAULT ), DEFAULT );


@Description( "Enable using minimum cardinality estimates in the Cypher cost planner, so that cardinality " + @Description( "Enable using minimum cardinality estimates in the Cypher cost planner, so that cardinality " +
"estimates for logical plan operators are not allowed to go below certain thresholds even when " + "estimates for logical plan operators are not allowed to go below certain thresholds even when " +
Expand Down Expand Up @@ -456,17 +456,17 @@ public class GraphDatabaseSettings implements LoadableConfig


@Description( "Debug log level threshold." ) @Description( "Debug log level threshold." )
public static final Setting<Level> store_internal_log_level = setting( "dbms.logs.debug.level", public static final Setting<Level> store_internal_log_level = setting( "dbms.logs.debug.level",
options( Level.class ), "INFO" ); optionsObeyCase( Level.class ), "INFO" );


@Description( "Database timezone. Among other things, this setting influences which timezone the logs and monitoring procedures use." ) @Description( "Database timezone. Among other things, this setting influences which timezone the logs and monitoring procedures use." )
public static final Setting<LogTimeZone> db_timezone = public static final Setting<LogTimeZone> db_timezone =
setting( "dbms.db.timezone", options( LogTimeZone.class ), LogTimeZone.UTC.name() ); setting( "dbms.db.timezone", optionsObeyCase( LogTimeZone.class ), LogTimeZone.UTC.name() );


@Description( "Database logs timezone." ) @Description( "Database logs timezone." )
@Deprecated @Deprecated
@ReplacedBy( "dbms.db.timezone" ) @ReplacedBy( "dbms.db.timezone" )
public static final Setting<LogTimeZone> log_timezone = public static final Setting<LogTimeZone> log_timezone =
setting( "dbms.logs.timezone", options( LogTimeZone.class ), LogTimeZone.UTC.name() ); setting( "dbms.logs.timezone", optionsObeyCase( LogTimeZone.class ), LogTimeZone.UTC.name() );


@Description( "Database timezone for temporal functions. All Time and DateTime values that are created without " + @Description( "Database timezone for temporal functions. All Time and DateTime values that are created without " +
"an explicit timezone will use this configured default timezone." ) "an explicit timezone will use this configured default timezone." )
Expand Down Expand Up @@ -1053,7 +1053,7 @@ public enum TransactionStateMemoryAllocation
@Description( "Defines whether memory for transaction state should be allocated on- or off-heap." ) @Description( "Defines whether memory for transaction state should be allocated on- or off-heap." )
public static final Setting<TransactionStateMemoryAllocation> tx_state_memory_allocation = buildSetting( public static final Setting<TransactionStateMemoryAllocation> tx_state_memory_allocation = buildSetting(
"dbms.tx_state.memory_allocation", "dbms.tx_state.memory_allocation",
options( TransactionStateMemoryAllocation.class, true ), optionsIgnoreCase( TransactionStateMemoryAllocation.class ),
TransactionStateMemoryAllocation.OFF_HEAP.name() ).build(); TransactionStateMemoryAllocation.OFF_HEAP.name() ).build();


@Description( "The maximum amount of off-heap memory that can be used to store transaction state data; it's a total amount of memory " + @Description( "The maximum amount of off-heap memory that can be used to store transaction state data; it's a total amount of memory " +
Expand Down Expand Up @@ -1123,7 +1123,7 @@ public Connector( String key, @SuppressWarnings( "UnusedParameters" ) String typ
{ {
group = new GroupSettingSupport( Connector.class, key ); group = new GroupSettingSupport( Connector.class, key );
enabled = group.scope( setting( "enabled", BOOLEAN, FALSE ) ); enabled = group.scope( setting( "enabled", BOOLEAN, FALSE ) );
type = group.scope( setting( "type", options( ConnectorType.class ), NO_DEFAULT ) ); type = group.scope( setting( "type", optionsObeyCase( ConnectorType.class ), NO_DEFAULT ) );
} }


public enum ConnectorType public enum ConnectorType
Expand Down Expand Up @@ -1169,7 +1169,7 @@ public BoltConnector( String key )
{ {
super( key, null ); super( key, null );
encryption_level = group.scope( encryption_level = group.scope(
setting( "tls_level", options( EncryptionLevel.class ), EncryptionLevel.OPTIONAL.name() ) ); setting( "tls_level", optionsObeyCase( EncryptionLevel.class ), EncryptionLevel.OPTIONAL.name() ) );
Setting<ListenSocketAddress> legacyAddressSetting = listenAddress( "address", 7687 ); Setting<ListenSocketAddress> legacyAddressSetting = listenAddress( "address", 7687 );
Setting<ListenSocketAddress> listenAddressSetting = legacyFallback( legacyAddressSetting, Setting<ListenSocketAddress> listenAddressSetting = legacyFallback( legacyAddressSetting,
listenAddress( "listen_address", 7687 ) ); listenAddress( "listen_address", 7687 ) );
Expand Down
Expand Up @@ -34,7 +34,7 @@
import static org.neo4j.kernel.configuration.Settings.advertisedAddress; import static org.neo4j.kernel.configuration.Settings.advertisedAddress;
import static org.neo4j.kernel.configuration.Settings.legacyFallback; import static org.neo4j.kernel.configuration.Settings.legacyFallback;
import static org.neo4j.kernel.configuration.Settings.listenAddress; import static org.neo4j.kernel.configuration.Settings.listenAddress;
import static org.neo4j.kernel.configuration.Settings.options; import static org.neo4j.kernel.configuration.Settings.optionsObeyCase;
import static org.neo4j.kernel.configuration.Settings.setting; import static org.neo4j.kernel.configuration.Settings.setting;


@Description( "Configuration options for Bolt connectors. " + @Description( "Configuration options for Bolt connectors. " +
Expand Down Expand Up @@ -80,7 +80,7 @@ public BoltConnector( String key )
{ {
super( key ); super( key );
encryption_level = group.scope( encryption_level = group.scope(
Settings.setting( "tls_level", options( EncryptionLevel.class ), OPTIONAL.name() ) ); Settings.setting( "tls_level", optionsObeyCase( EncryptionLevel.class ), OPTIONAL.name() ) );
Setting<ListenSocketAddress> legacyAddressSetting = listenAddress( "address", 7687 ); Setting<ListenSocketAddress> legacyAddressSetting = listenAddress( "address", 7687 );
Setting<ListenSocketAddress> listenAddressSetting = legacyFallback( legacyAddressSetting, Setting<ListenSocketAddress> listenAddressSetting = legacyFallback( legacyAddressSetting,
listenAddress( "listen_address", 7687 ) ); listenAddress( "listen_address", 7687 ) );
Expand Down
Expand Up @@ -35,7 +35,7 @@
import static org.neo4j.kernel.configuration.Settings.NO_DEFAULT; import static org.neo4j.kernel.configuration.Settings.NO_DEFAULT;
import static org.neo4j.kernel.configuration.Settings.advertisedAddress; import static org.neo4j.kernel.configuration.Settings.advertisedAddress;
import static org.neo4j.kernel.configuration.Settings.listenAddress; import static org.neo4j.kernel.configuration.Settings.listenAddress;
import static org.neo4j.kernel.configuration.Settings.options; import static org.neo4j.kernel.configuration.Settings.optionsObeyCase;
import static org.neo4j.kernel.configuration.Settings.setting; import static org.neo4j.kernel.configuration.Settings.setting;


public class BoltConnectorValidator extends ConnectorValidator public class BoltConnectorValidator extends ConnectorValidator
Expand Down Expand Up @@ -64,13 +64,13 @@ protected Optional<Setting<Object>> getSettingFor( @Nonnull String settingName,
break; break;
case "type": case "type":
setting = setting =
(BaseSetting) setting( settingName, options( Connector.ConnectorType.class ), NO_DEFAULT ); (BaseSetting) setting( settingName, optionsObeyCase( Connector.ConnectorType.class ), NO_DEFAULT );
setting.setDeprecated( true ); setting.setDeprecated( true );
setting.setDescription( "Connector type. This setting is deprecated and its value will instead be " + setting.setDescription( "Connector type. This setting is deprecated and its value will instead be " +
"inferred from the name of the connector." ); "inferred from the name of the connector." );
break; break;
case "tls_level": case "tls_level":
setting = (BaseSetting) setting( settingName, options( BoltConnector.EncryptionLevel.class ), setting = (BaseSetting) setting( settingName, optionsObeyCase( BoltConnector.EncryptionLevel.class ),
OPTIONAL.name() ); OPTIONAL.name() );
setting.setDescription( "Encryption level to require this connector to use." ); setting.setDescription( "Encryption level to require this connector to use." );
break; break;
Expand Down
Expand Up @@ -24,7 +24,7 @@


import static org.neo4j.kernel.configuration.Settings.BOOLEAN; import static org.neo4j.kernel.configuration.Settings.BOOLEAN;
import static org.neo4j.kernel.configuration.Settings.NO_DEFAULT; import static org.neo4j.kernel.configuration.Settings.NO_DEFAULT;
import static org.neo4j.kernel.configuration.Settings.options; import static org.neo4j.kernel.configuration.Settings.optionsObeyCase;
import static org.neo4j.kernel.configuration.Settings.setting; import static org.neo4j.kernel.configuration.Settings.setting;


@Group( "dbms.connector" ) @Group( "dbms.connector" )
Expand Down Expand Up @@ -58,7 +58,7 @@ public Connector( String key )
{ {
group = new GroupSettingSupport( Connector.class, key ); group = new GroupSettingSupport( Connector.class, key );
enabled = group.scope( setting( "enabled", BOOLEAN, "false" ) ); enabled = group.scope( setting( "enabled", BOOLEAN, "false" ) );
type = group.scope( setting( "type", options( ConnectorType.class ), NO_DEFAULT ) ); type = group.scope( setting( "type", optionsObeyCase( ConnectorType.class ), NO_DEFAULT ) );
} }


public enum ConnectorType public enum ConnectorType
Expand Down
Expand Up @@ -29,7 +29,7 @@
import static org.neo4j.kernel.configuration.Settings.advertisedAddress; import static org.neo4j.kernel.configuration.Settings.advertisedAddress;
import static org.neo4j.kernel.configuration.Settings.legacyFallback; import static org.neo4j.kernel.configuration.Settings.legacyFallback;
import static org.neo4j.kernel.configuration.Settings.listenAddress; import static org.neo4j.kernel.configuration.Settings.listenAddress;
import static org.neo4j.kernel.configuration.Settings.options; import static org.neo4j.kernel.configuration.Settings.optionsObeyCase;
import static org.neo4j.kernel.configuration.Settings.setting; import static org.neo4j.kernel.configuration.Settings.setting;


@Description( "Configuration options for HTTP connectors. " + @Description( "Configuration options for HTTP connectors. " +
Expand Down Expand Up @@ -73,7 +73,7 @@ public HttpConnector( String key, Encryption encryptionLevel )
{ {
super( key ); super( key );
this.encryptionLevel = encryptionLevel; this.encryptionLevel = encryptionLevel;
encryption = group.scope( setting( "encryption", options( HttpConnector.Encryption.class ), NO_DEFAULT ) ); encryption = group.scope( setting( "encryption", optionsObeyCase( HttpConnector.Encryption.class ), NO_DEFAULT ) );
Setting<ListenSocketAddress> legacyAddressSetting = listenAddress( "address", encryptionLevel.defaultPort ); Setting<ListenSocketAddress> legacyAddressSetting = listenAddress( "address", encryptionLevel.defaultPort );
Setting<ListenSocketAddress> listenAddressSetting = legacyFallback( legacyAddressSetting, Setting<ListenSocketAddress> listenAddressSetting = legacyFallback( legacyAddressSetting,
listenAddress( "listen_address", encryptionLevel.defaultPort ) ); listenAddress( "listen_address", encryptionLevel.defaultPort ) );
Expand Down
Expand Up @@ -41,7 +41,7 @@
import static org.neo4j.kernel.configuration.Settings.advertisedAddress; import static org.neo4j.kernel.configuration.Settings.advertisedAddress;
import static org.neo4j.kernel.configuration.Settings.describeOneOf; import static org.neo4j.kernel.configuration.Settings.describeOneOf;
import static org.neo4j.kernel.configuration.Settings.listenAddress; import static org.neo4j.kernel.configuration.Settings.listenAddress;
import static org.neo4j.kernel.configuration.Settings.options; import static org.neo4j.kernel.configuration.Settings.optionsObeyCase;
import static org.neo4j.kernel.configuration.Settings.setting; import static org.neo4j.kernel.configuration.Settings.setting;


public class HttpConnectorValidator extends ConnectorValidator public class HttpConnectorValidator extends ConnectorValidator
Expand Down Expand Up @@ -76,7 +76,7 @@ protected Optional<Setting<Object>> getSettingFor( @Nonnull String settingName,
break; break;
case "type": case "type":
setting = setting =
(BaseSetting) setting( settingName, options( Connector.ConnectorType.class ), NO_DEFAULT ); (BaseSetting) setting( settingName, optionsObeyCase( Connector.ConnectorType.class ), NO_DEFAULT );
setting.setDeprecated( true ); setting.setDeprecated( true );
setting.setDescription( "Connector type. This setting is deprecated and its value will instead be " + setting.setDescription( "Connector type. This setting is deprecated and its value will instead be " +
"inferred from the name of the connector." ); "inferred from the name of the connector." );
Expand Down Expand Up @@ -177,7 +177,7 @@ public static BaseSetting<HttpConnector.Encryption> encryptionSetting( @Nonnull
defaultValue ) defaultValue )
{ {
Setting<Encryption> s = setting( "dbms.connector." + name + ".encryption", Setting<Encryption> s = setting( "dbms.connector." + name + ".encryption",
options( Encryption.class ), defaultValue.name() ); optionsObeyCase( Encryption.class ), defaultValue.name() );


return new BaseSetting<Encryption>() return new BaseSetting<Encryption>()
{ {
Expand Down
Expand Up @@ -775,17 +775,17 @@ public String toString()
} }
}; };


public static <T extends Enum<T>> Function<String, T> options( final Class<T> enumClass ) public static <T extends Enum<T>> Function<String, T> optionsObeyCase( final Class<T> enumClass )
{ {
return options( EnumSet.allOf( enumClass ), false ); return options( EnumSet.allOf( enumClass ), false );
} }


public static <T extends Enum<T>> Function<String, T> options( final Class<T> enumClass, boolean ignoreCase ) public static <T extends Enum<T>> Function<String, T> optionsIgnoreCase( final Class<T> enumClass )
{ {
return options( EnumSet.allOf( enumClass ), ignoreCase ); return options( EnumSet.allOf( enumClass ), true );
} }


public static <T> Function<String, T> options( T... optionValues ) public static <T> Function<String, T> optionsObeyCase( T... optionValues )
{ {
return options( Iterables.iterable( optionValues ), false ); return options( Iterables.iterable( optionValues ), false );
} }
Expand Down
Expand Up @@ -39,7 +39,7 @@
import static org.neo4j.kernel.configuration.Settings.STRING; import static org.neo4j.kernel.configuration.Settings.STRING;
import static org.neo4j.kernel.configuration.Settings.STRING_LIST; import static org.neo4j.kernel.configuration.Settings.STRING_LIST;
import static org.neo4j.kernel.configuration.Settings.derivedSetting; import static org.neo4j.kernel.configuration.Settings.derivedSetting;
import static org.neo4j.kernel.configuration.Settings.options; import static org.neo4j.kernel.configuration.Settings.optionsIgnoreCase;
import static org.neo4j.kernel.configuration.Settings.pathSetting; import static org.neo4j.kernel.configuration.Settings.pathSetting;
import static org.neo4j.kernel.configuration.Settings.setting; import static org.neo4j.kernel.configuration.Settings.setting;


Expand Down Expand Up @@ -109,7 +109,7 @@ public SslPolicyConfig( String policyName )
this.revoked_dir = group.scope( derivedDefault( "revoked_dir", base_directory, "revoked" ) ); this.revoked_dir = group.scope( derivedDefault( "revoked_dir", base_directory, "revoked" ) );


this.private_key_password = group.scope( setting( "private_key_password", STRING, NO_DEFAULT ) ); this.private_key_password = group.scope( setting( "private_key_password", STRING, NO_DEFAULT ) );
this.client_auth = group.scope( setting( "client_auth", options( ClientAuth.class, true ), ClientAuth.REQUIRE.name() ) ); this.client_auth = group.scope( setting( "client_auth", optionsIgnoreCase( ClientAuth.class ), ClientAuth.REQUIRE.name() ) );
this.tls_versions = group.scope( setting( "tls_versions", STRING_LIST, joinList( TLS_VERSION_DEFAULTS ) ) ); this.tls_versions = group.scope( setting( "tls_versions", STRING_LIST, joinList( TLS_VERSION_DEFAULTS ) ) );
this.ciphers = group.scope( setting( "ciphers", STRING_LIST, joinList( CIPHER_SUITES_DEFAULTS ) ) ); this.ciphers = group.scope( setting( "ciphers", STRING_LIST, joinList( CIPHER_SUITES_DEFAULTS ) ) );
this.verify_hostname = group.scope( setting( "verify_hostname", BOOLEAN, FALSE ) ); this.verify_hostname = group.scope( setting( "verify_hostname", BOOLEAN, FALSE ) );
Expand Down
Expand Up @@ -25,7 +25,7 @@
import org.neo4j.configuration.LoadableConfig; import org.neo4j.configuration.LoadableConfig;
import org.neo4j.graphdb.config.Setting; import org.neo4j.graphdb.config.Setting;


import static org.neo4j.kernel.configuration.Settings.options; import static org.neo4j.kernel.configuration.Settings.optionsObeyCase;
import static org.neo4j.kernel.configuration.Settings.setting; import static org.neo4j.kernel.configuration.Settings.setting;


/** /**
Expand All @@ -35,5 +35,6 @@
public class SslSystemSettings implements LoadableConfig public class SslSystemSettings implements LoadableConfig
{ {
@Description( "Netty SSL provider" ) @Description( "Netty SSL provider" )
public static final Setting<SslProvider> netty_ssl_provider = setting( "dbms.netty.ssl.provider", options( SslProvider.class ), SslProvider.JDK.name() ); public static final Setting<SslProvider> netty_ssl_provider =
setting( "dbms.netty.ssl.provider", optionsObeyCase( SslProvider.class ), SslProvider.JDK.name() );
} }
Expand Up @@ -72,7 +72,7 @@
import static org.neo4j.kernel.configuration.Settings.list; import static org.neo4j.kernel.configuration.Settings.list;
import static org.neo4j.kernel.configuration.Settings.listenAddress; import static org.neo4j.kernel.configuration.Settings.listenAddress;
import static org.neo4j.kernel.configuration.Settings.min; import static org.neo4j.kernel.configuration.Settings.min;
import static org.neo4j.kernel.configuration.Settings.options; import static org.neo4j.kernel.configuration.Settings.optionsIgnoreCase;
import static org.neo4j.kernel.configuration.Settings.prefixSetting; import static org.neo4j.kernel.configuration.Settings.prefixSetting;
import static org.neo4j.kernel.configuration.Settings.setting; import static org.neo4j.kernel.configuration.Settings.setting;


Expand Down Expand Up @@ -197,7 +197,7 @@ public class CausalClusteringSettings implements LoadableConfig


@Description( "Type of in-flight cache." ) @Description( "Type of in-flight cache." )
public static final Setting<InFlightCacheFactory.Type> in_flight_cache_type = public static final Setting<InFlightCacheFactory.Type> in_flight_cache_type =
setting( "causal_clustering.in_flight_cache.type", options( InFlightCacheFactory.Type.class, true ), setting( "causal_clustering.in_flight_cache.type", optionsIgnoreCase( InFlightCacheFactory.Type.class ),
InFlightCacheFactory.Type.CONSECUTIVE.name() ); InFlightCacheFactory.Type.CONSECUTIVE.name() );


@Description( "The maximum number of entries in the in-flight cache." ) @Description( "The maximum number of entries in the in-flight cache." )
Expand Down Expand Up @@ -241,11 +241,11 @@ public HostnameResolver getHostnameResolver( LogProvider logProvider, LogProvide


@Description( "Configure the discovery type used for cluster name resolution" ) @Description( "Configure the discovery type used for cluster name resolution" )
public static final Setting<DiscoveryType> discovery_type = public static final Setting<DiscoveryType> discovery_type =
setting( "causal_clustering.discovery_type", options( DiscoveryType.class ), DiscoveryType.LIST.name() ); setting( "causal_clustering.discovery_type", optionsIgnoreCase( DiscoveryType.class ), DiscoveryType.LIST.name() );


@Description( "Select the middleware used for cluster topology discovery" ) @Description( "Select the middleware used for cluster topology discovery" )
public static final Setting<DiscoveryServiceFactorySelector.DiscoveryImplementation> discovery_implementation = public static final Setting<DiscoveryServiceFactorySelector.DiscoveryImplementation> discovery_implementation =
setting( "causal_clustering.discovery_implementation", options( DiscoveryServiceFactorySelector.DiscoveryImplementation.class ), setting( "causal_clustering.discovery_implementation", optionsIgnoreCase( DiscoveryServiceFactorySelector.DiscoveryImplementation.class ),
DiscoveryServiceFactorySelector.DEFAULT.name() ); DiscoveryServiceFactorySelector.DEFAULT.name() );


@Description( "Prevents the network middleware from dumping its own logs. Defaults to true." ) @Description( "Prevents the network middleware from dumping its own logs. Defaults to true." )
Expand Down
Expand Up @@ -27,7 +27,7 @@


public abstract class DiscoveryServiceFactorySelector<T extends DiscoveryServiceFactory> public abstract class DiscoveryServiceFactorySelector<T extends DiscoveryServiceFactory>
{ {
public static DiscoveryImplementation DEFAULT = DiscoveryImplementation.hazelcast; public static DiscoveryImplementation DEFAULT = DiscoveryImplementation.HAZELCAST;


public T select( Config config ) public T select( Config config )
{ {
Expand All @@ -39,6 +39,7 @@ public T select( Config config )


public enum DiscoveryImplementation public enum DiscoveryImplementation
{ {
hazelcast, akka HAZELCAST,
AKKA
} }
} }
Expand Up @@ -29,8 +29,8 @@ protected DiscoveryServiceFactory select( DiscoveryImplementation middleware )
{ {
switch ( middleware ) switch ( middleware )
{ {
case hazelcast: return new HazelcastDiscoveryServiceFactory(); case HAZELCAST: return new HazelcastDiscoveryServiceFactory();
case akka: throw new UnsupportedOperationException( "Akka based discovery is Commercial release only" ); case AKKA: throw new UnsupportedOperationException( "Akka based discovery is Commercial release only" );
default: throw new IllegalArgumentException( "Should have matched a discovery service factory to " + middleware ); default: throw new IllegalArgumentException( "Should have matched a discovery service factory to " + middleware );
} }
} }
Expand Down

0 comments on commit fa475b1

Please sign in to comment.