Exemplo n.º 1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Override @Nonnull protected java.util.Optional<org.neo4j.graphdb.config.Setting<Object>> getSettingFor(@Nonnull String settingName, @Nonnull Map<String,String> params)
        protected internal override Optional <Setting <object> > GetSettingFor(string settingName, IDictionary <string, string> @params)
        {
            // owns has already verified that 'type' is correct and that this split is possible
            string[] parts = settingName.Split("\\.", true);
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final String name = parts[2];
            string name = parts[2];
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final String subsetting = parts[3];
            string subsetting = parts[3];

            BaseSetting setting;

            switch (subsetting)
            {
            case "enabled":
                setting = ( BaseSetting )setting(settingName, BOOLEAN, "false");
                setting.setDescription("Enable this connector.");
                break;

            case "type":
                setting = ( BaseSetting )setting(settingName, optionsObeyCase(typeof(Connector.ConnectorType)), NO_DEFAULT);
                setting.setDeprecated(true);
                setting.setDescription("Connector type. This setting is deprecated and its value will instead be " + "inferred from the name of the connector.");
                break;

            case "tls_level":
                setting = ( BaseSetting )setting(settingName, optionsObeyCase(typeof(BoltConnector.EncryptionLevel)), OPTIONAL.name());
                setting.setDescription("Encryption level to require this connector to use.");
                break;

            case "address":
                setting = listenAddress(settingName, 7687);
                setting.setDeprecated(true);
                setting.setReplacement("dbms.connector." + name + ".listen_address");
                setting.setDescription("Address the connector should bind to. Deprecated and replaced by " + setting.replacement().get() + ".");
                break;

            case "listen_address":
                setting = listenAddress(settingName, 7687);
                setting.setDescription("Address the connector should bind to.");
                break;

            case "advertised_address":
                setting = advertisedAddress(settingName, listenAddress(settingName, 7687));
                setting.setDescription("Advertised address for this connector.");
                break;

            case "thread_pool_min_size":
                setting = ( BaseSetting )setting(settingName, INTEGER, NO_DEFAULT);
                setting.setDescription("The number of threads to keep in the thread pool bound to this connector, even if they are idle.");
                break;

            case "thread_pool_max_size":
                setting = ( BaseSetting )setting(settingName, INTEGER, NO_DEFAULT);
                setting.setDescription("The maximum number of threads allowed in the thread pool bound to this connector.");
                break;

            case "thread_pool_keep_alive":
                setting = ( BaseSetting )setting(settingName, DURATION, NO_DEFAULT);
                setting.setDescription("The maximum time an idle thread in the thread pool bound to this connector will wait for new tasks.");
                break;

            case "unsupported_thread_pool_queue_size":
                setting = ( BaseSetting )setting(settingName, INTEGER, NO_DEFAULT);
                setting.setDescription("The queue size of the thread pool bound to this connector (-1 for unbounded, 0 for direct handoff, > 0 for bounded)");
                break;

            default:
                return(null);
            }

            // If not deprecated for other reasons
            if (IsDeprecatedConnectorName(name) && !setting.deprecated())
            {
                setting.setDeprecated(true);
                setting.setReplacement(format("%s.%s.%s.%s", parts[0], parts[1], "bolt", subsetting));
            }
            return(setting);
        }
Exemplo n.º 2
0
        public BoltConnector(string key) : base(key)
        {
            EncryptionLevel = Group.scope(Settings.Setting("tls_level", optionsObeyCase(typeof(EncryptionLevel)), OPTIONAL.name()));
            Setting <ListenSocketAddress> legacyAddressSetting = listenAddress("address", 7687);
            Setting <ListenSocketAddress> listenAddressSetting = legacyFallback(legacyAddressSetting, listenAddress("listen_address", 7687));

            this.Address                        = Group.scope(legacyAddressSetting);
            this.ListenAddress                  = Group.scope(listenAddressSetting);
            this.AdvertisedAddress              = Group.scope(advertisedAddress("advertised_address", listenAddressSetting));
            this.ThreadPoolMinSize              = Group.scope(setting("thread_pool_min_size", INTEGER, 5.ToString()));
            this.ThreadPoolMaxSize              = Group.scope(setting("thread_pool_max_size", INTEGER, 400.ToString()));
            this.ThreadPoolKeepAlive            = Group.scope(setting("thread_pool_keep_alive", DURATION, "5m"));
            this.UnsupportedThreadPoolQueueSize = Group.scope(setting("unsupported_thread_pool_queue_size", INTEGER, 0.ToString()));
        }
Exemplo n.º 3
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: AbstractRESTInteraction(java.util.Map<String,String> config) throws java.io.IOException
        internal AbstractRESTInteraction(IDictionary <string, string> config)
        {
            CommunityServerBuilder builder = EnterpriseServerBuilder.serverOnRandomPorts();

            builder = builder.WithProperty((new BoltConnector("bolt")).type.name(), "BOLT").withProperty((new BoltConnector("bolt")).enabled.name(), "true").withProperty((new BoltConnector("bolt")).encryption_level.name(), OPTIONAL.name()).withProperty(LegacySslPolicyConfig.tls_key_file.name(), NeoInteractionLevel.tempPath("key", ".key")).withProperty(LegacySslPolicyConfig.tls_certificate_file.name(), NeoInteractionLevel.tempPath("cert", ".cert")).withProperty(GraphDatabaseSettings.auth_enabled.name(), Convert.ToString(true));

            foreach (KeyValuePair <string, string> entry in config.SetOfKeyValuePairs())
            {
                builder = builder.WithProperty(entry.Key, entry.Value);
            }
            this.Server = builder.Build();
            this.Server.start();
            _authManager           = this.Server.DependencyResolver.resolveDependency(typeof(EnterpriseAuthManager));
            _connectorPortRegister = Server.DependencyResolver.resolveDependency(typeof(ConnectorPortRegister));
        }
Exemplo n.º 4
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Before public void setup() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void Setup()
        {
            DbRule.withSetting(GraphDatabaseSettings.auth_enabled, "true").withSetting((new BoltConnector("bolt")).type, "BOLT").withSetting((new BoltConnector("bolt")).enabled, "true").withSetting((new BoltConnector("bolt")).encryption_level, OPTIONAL.name()).withSetting((new BoltConnector("bolt")).listen_address, "localhost:0");
            DbRule.withSettings(Settings);
            DbRule.ensureStarted();
            DbRule.resolveDependency(typeof(Procedures)).registerProcedure(typeof(ProcedureInteractionTestBase.ClassWithProcedures));
        }