IGNITE-7578 Actualized client connector configuration.
authorVasiliy Sisko <vsisko@gridgain.com>
Mon, 12 Feb 2018 13:24:30 +0000 (20:24 +0700)
committerAlexey Kuznetsov <akuznetsov@apache.org>
Mon, 12 Feb 2018 13:24:30 +0000 (20:24 +0700)
modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorClientConnectorConfiguration.java
modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/config/VisorConfigurationCommand.scala
modules/web-console/backend/app/schemas.js
modules/web-console/frontend/app/modules/configuration/generator/ConfigurationGenerator.js
modules/web-console/frontend/app/modules/configuration/generator/defaults/Cluster.service.js
modules/web-console/frontend/app/modules/states/configuration/clusters/client-connector.pug
modules/web-console/frontend/app/services/Version.service.js
modules/web-console/frontend/controllers/clusters-controller.js

index 397b72a..0a1459e 100644 (file)
@@ -26,6 +26,8 @@ import org.apache.ignite.internal.util.typedef.internal.U;
 import org.apache.ignite.internal.visor.VisorDataTransferObject;
 import org.jetbrains.annotations.Nullable;
 
+import static org.apache.ignite.internal.visor.util.VisorTaskUtils.compactClass;
+
 /**
  * Data transfer object for client connector configuration.
  */
@@ -55,7 +57,31 @@ public class VisorClientConnectorConfiguration extends VisorDataTransferObject {
     private boolean tcpNoDelay;
 
     /** Thread pool size. */
-    private int threadPoolSize ;
+    private int threadPoolSize;
+
+    /** Idle timeout. */
+    private long idleTimeout;
+
+    /** JDBC connections enabled flag. */
+    private boolean jdbcEnabled;
+
+    /** ODBC connections enabled flag. */
+    private boolean odbcEnabled;
+
+    /** JDBC connections enabled flag. */
+    private boolean thinCliEnabled;
+
+    /** SSL enable flag, default is disabled. */
+    private boolean sslEnabled;
+
+    /** If to use SSL context factory from Ignite configuration. */
+    private boolean useIgniteSslCtxFactory;
+
+    /** SSL need client auth flag. */
+    private boolean sslClientAuth;
+
+    /** SSL connection factory class name. */
+    private String sslCtxFactory;
 
     /**
      * Default constructor.
@@ -78,6 +104,14 @@ public class VisorClientConnectorConfiguration extends VisorDataTransferObject {
         sockRcvBufSize = cfg.getSocketReceiveBufferSize();
         tcpNoDelay = cfg.isTcpNoDelay();
         threadPoolSize = cfg.getThreadPoolSize();
+        idleTimeout = cfg.getIdleTimeout();
+        jdbcEnabled = cfg.isJdbcEnabled();
+        odbcEnabled = cfg.isOdbcEnabled();
+        thinCliEnabled = cfg.isThinClientEnabled();
+        sslEnabled = cfg.isSslEnabled();
+        useIgniteSslCtxFactory = cfg.isUseIgniteSslContextFactory();
+        sslClientAuth = cfg.isSslClientAuth();
+        sslCtxFactory = compactClass(cfg.getSslContextFactory());
     }
 
     /**
@@ -135,6 +169,66 @@ public class VisorClientConnectorConfiguration extends VisorDataTransferObject {
         return threadPoolSize;
     }
 
+    /**
+     * @return Idle timeout.
+     */
+    public long getIdleTimeout() {
+        return idleTimeout;
+    }
+
+    /**
+     * @return JDBC connections enabled flag.
+     */
+    public boolean isJdbcEnabled() {
+        return jdbcEnabled;
+    }
+
+    /**
+     * @return ODBC connections enabled flag.
+     */
+    public boolean isOdbcEnabled() {
+        return odbcEnabled;
+    }
+
+    /**
+     * @return JDBC connections enabled flag.
+     */
+    public boolean isThinClientEnabled() {
+        return thinCliEnabled;
+    }
+
+    /**
+     * @return SSL enable flag, default is disabled.
+     */
+    public boolean isSslEnabled() {
+        return sslEnabled;
+    }
+
+    /**
+     * @return If to use SSL context factory from Ignite configuration.
+     */
+    public boolean isUseIgniteSslContextFactory() {
+        return useIgniteSslCtxFactory;
+    }
+
+    /**
+     * @return SSL need client auth flag.
+     */
+    public boolean isSslClientAuth() {
+        return sslClientAuth;
+    }
+
+    /**
+     * @return SSL connection factory.
+     */
+    public String getSslContextFactory() {
+        return sslCtxFactory;
+    }
+
+    @Override public byte getProtocolVersion() {
+        return V2;
+    }
+
     /** {@inheritDoc} */
     @Override protected void writeExternalData(ObjectOutput out) throws IOException {
         U.writeString(out, host);
@@ -142,9 +236,17 @@ public class VisorClientConnectorConfiguration extends VisorDataTransferObject {
         out.writeInt(portRange);
         out.writeInt(maxOpenCursorsPerConn);
         out.writeInt(sockSndBufSize);
-        out.writeInt(sockRcvBufSize );
+        out.writeInt(sockRcvBufSize);
         out.writeBoolean(tcpNoDelay);
         out.writeInt(threadPoolSize);
+        out.writeLong(idleTimeout);
+        out.writeBoolean(jdbcEnabled);
+        out.writeBoolean(odbcEnabled);
+        out.writeBoolean(thinCliEnabled);
+        out.writeBoolean(sslEnabled);
+        out.writeBoolean(useIgniteSslCtxFactory);
+        out.writeBoolean(sslClientAuth);
+        U.writeString(out, sslCtxFactory);
     }
 
     /** {@inheritDoc} */
@@ -157,6 +259,17 @@ public class VisorClientConnectorConfiguration extends VisorDataTransferObject {
         sockRcvBufSize = in.readInt();
         tcpNoDelay = in.readBoolean();
         threadPoolSize = in.readInt();
+
+        if (protoVer > V1) {
+            idleTimeout = in.readLong();
+            jdbcEnabled = in.readBoolean();
+            odbcEnabled = in.readBoolean();
+            thinCliEnabled = in.readBoolean();
+            sslEnabled = in.readBoolean();
+            useIgniteSslCtxFactory = in.readBoolean();
+            sslClientAuth = in.readBoolean();
+            sslCtxFactory = U.readString(in);
+        }
     }
 
     /** {@inheritDoc} */
index 67d9c14..1a82381 100644 (file)
@@ -245,7 +245,15 @@ class VisorConfigurationCommand extends VisorConsoleCommand {
             cliConnTbl += ("Socket receive buffer size", formatMemory(cliConnCfg.getSocketReceiveBufferSize))
             cliConnTbl += ("Max connection cursors", cliConnCfg.getMaxOpenCursorsPerConnection)
             cliConnTbl += ("Pool size", cliConnCfg.getThreadPoolSize)
+            cliConnTbl += ("Idle Timeout", cliConnCfg.getIdleTimeout + "ms")
             cliConnTbl += ("TCP_NODELAY", bool2Str(cliConnCfg.isTcpNoDelay))
+            cliConnTbl += ("JDBC Enabled", bool2Str(cliConnCfg.isJdbcEnabled))
+            cliConnTbl += ("ODBC Enabled", bool2Str(cliConnCfg.isOdbcEnabled))
+            cliConnTbl += ("Thin Client Enabled", bool2Str(cliConnCfg.isThinClientEnabled))
+            cliConnTbl += ("SSL Enabled", bool2Str(cliConnCfg.isSslEnabled))
+            cliConnTbl += ("Ssl Client Auth", bool2Str(cliConnCfg.isSslClientAuth))
+            cliConnTbl += ("Use Ignite SSL Context Factory", bool2Str(cliConnCfg.isUseIgniteSslContextFactory))
+            cliConnTbl += ("SSL Context Factory", safe(cliConnCfg.getSslContextFactory))
 
             cliConnTbl.render()
         }
index 0ed85b2..b3d61ac 100644 (file)
@@ -859,7 +859,15 @@ module.exports.factory = function(mongoose) {
             socketReceiveBufferSize: Number,
             tcpNoDelay: {type: Boolean, default: true},
             maxOpenCursorsPerConnection: Number,
-            threadPoolSize: Number
+            threadPoolSize: Number,
+            idleTimeout: Number,
+            jdbcEnabled: {type: Boolean, default: true},
+            odbcEnabled: {type: Boolean, default: true},
+            thinClientEnabled: {type: Boolean, default: true},
+            sslEnabled: Boolean,
+            useIgniteSslContextFactory: {type: Boolean, default: true},
+            sslClientAuth: Boolean,
+            sslContextFactory: String
         },
         loadBalancingSpi: [{
             kind: {type: String, enum: ['RoundRobin', 'Adaptive', 'WeightedRandom', 'Custom']},
index 9269fc9..645e3e3 100644 (file)
@@ -788,6 +788,20 @@ export default class IgniteConfigurationGenerator {
             .intProperty('threadPoolSize')
             .boolProperty('tcpNoDelay');
 
+        if (available('2.4.0')) {
+            bean.longProperty('idleTimeout')
+                .boolProperty('jdbcEnabled')
+                .boolProperty('odbcEnabled')
+                .boolProperty('thinClientEnabled');
+        }
+
+        if (available('2.5.0')) {
+            bean.boolProperty('sslEnabled')
+                .boolProperty('sslClientAuth')
+                .boolProperty('useIgniteSslContextFactory')
+                .emptyBeanProperty('sslContextFactory');
+        }
+
         cfg.beanProperty('clientConnectorConfiguration', bean);
 
         return cfg;
index f636869..b55ed83 100644 (file)
@@ -395,6 +395,21 @@ const DFLT_CLUSTER = {
         socketReceiveBufferSize: 0,
         tcpNoDelay: true,
         maxOpenCursorsPerConnection: 128
+    },
+    clientConnectorConfiguration: {
+        port: 10800,
+        portRange: 100,
+        socketSendBufferSize: 0,
+        socketReceiveBufferSize: 0,
+        tcpNoDelay: true,
+        maxOpenCursorsPerConnection: 128,
+        idleTimeout: 0,
+        jdbcEnabled: true,
+        odbcEnabled: true,
+        thinClientEnabled: true,
+        sslEnabled: false,
+        useIgniteSslContextFactory: true,
+        sslClientAuth: false
     }
 };
 
index dd2fa6d..c90cc45 100644 (file)
@@ -18,8 +18,10 @@ include /app/helpers/jade/mixins
 
 -var form = 'clientConnector'
 -var model = 'backupItem'
--var connectionModel = model + '.clientConnectorConfiguration'
--var connectionEnabled = connectionModel + '.enabled'
+-var connectionModel = `${model}.clientConnectorConfiguration`
+-var connectionEnabled = `${connectionModel}.enabled`
+-var sslEnabled = `${connectionEnabled} && ${connectionModel}.sslEnabled`
+-var sslFactoryEnabled = `${sslEnabled} && !${connectionModel}.useIgniteSslContextFactory`
 
 .panel.panel-default(ng-show='$ctrl.available("2.3.0")' ng-form=form novalidate)
     .panel-heading(bs-collapse-toggle ng-click=`ui.loadPanel('${form}')`)
@@ -41,11 +43,11 @@ include /app/helpers/jade/mixins
                     +number('Port range:', `${connectionModel}.portRange`, '"ClientConnectorPortRange"', connectionEnabled, '100', '0', 'Port range')
                 .settings-row
                     +number('Socket send buffer size:', `${connectionModel}.socketSendBufferSize`, '"ClientConnectorSocketSendBufferSize"', connectionEnabled, '0', '0',
-                        'Socket send buffer size.<br/>\
+                        'Socket send buffer size<br/>\
                         When set to <b>0</b>, operation system default will be used')
                 .settings-row
                     +number('Socket receive buffer size:', `${connectionModel}.socketReceiveBufferSize`, '"ClientConnectorSocketReceiveBufferSize"', connectionEnabled, '0', '0',
-                        'Socket receive buffer size.<br/>\
+                        'Socket receive buffer size<br/>\
                         When set to <b>0</b>, operation system default will be used')
                 .settings-row
                     +number('Max connection cursors:', `${connectionModel}.maxOpenCursorsPerConnection`, '"ClientConnectorMaxOpenCursorsPerConnection"', connectionEnabled, '128', '0',
@@ -53,7 +55,30 @@ include /app/helpers/jade/mixins
                 .settings-row
                     +number('Pool size:', `${connectionModel}.threadPoolSize`, '"ClientConnectorThreadPoolSize"', connectionEnabled, 'max(8, availableProcessors)', '1',
                         'Size of thread pool that is in charge of processing SQL requests')
+                .settings-row(ng-if='$ctrl.available("2.4.0")')
+                    +number('Idle timeout:', `${connectionModel}.idleTimeout`, '"ClientConnectorIdleTimeout"', connectionEnabled, '0', '-1',
+                        'Idle timeout for client connections<br/>\
+                        Zero or negative means no timeout')
+                div(ng-if='$ctrl.available("2.5.0")')
+                    .settings-row
+                        +checkbox-enabled('Enable SSL', `${connectionModel}.sslEnabled`, '"ClientConnectorSslEnabled"', connectionEnabled, 'Enable secure socket layer on client connector')
+                    .settings-row
+                        +checkbox-enabled('Enable SSL client auth', `${connectionModel}.sslClientAuth`, '"ClientConnectorSslClientAuth"', sslEnabled, 'Flag indicating whether or not SSL client authentication is required')
+                    .settings-row
+                        +checkbox-enabled('Use Ignite SSL', `${connectionModel}.useIgniteSslContextFactory`, '"ClientConnectorUseIgniteSslContextFactory"', sslEnabled, 'Use SSL factory Ignite configuration')
+                    .settings-row
+                        +java-class('SSL factory:', `${connectionModel}.sslContextFactory`, '"ClientConnectorSslContextFactory"', sslFactoryEnabled, sslFactoryEnabled,
+                        'If SSL factory specified then replication will be performed through secure SSL channel created with this factory<br/>\
+                        If not present <b>isUseIgniteSslContextFactory()</b> flag will be evaluated<br/>\
+                        If set to <b>true</b> and <b>IgniteConfiguration#getSslContextFactory()</b> exists, then Ignite SSL context factory will be used to establish secure connection')
                 .settings-row
                     +checkbox-enabled('TCP_NODELAY option', `${connectionModel}.tcpNoDelay`, '"ClientConnectorTcpNoDelay"', connectionEnabled, 'Value for TCP_NODELAY socket option')
+                div(ng-if='$ctrl.available("2.4.0")')
+                    .settings-row
+                        +checkbox-enabled('JDBC Enabled', `${connectionModel}.jdbcEnabled`, '"ClientConnectorJdbcEnabled"', connectionEnabled, 'Access through JDBC is enabled')
+                    .settings-row
+                        +checkbox-enabled('ODBC Enabled', `${connectionModel}.odbcEnabled`, '"ClientConnectorOdbcEnabled"', connectionEnabled, 'Access through ODBC is enabled')
+                    .settings-row
+                        +checkbox-enabled('Thin client enabled', `${connectionModel}.thinClientEnabled`, '"ClientConnectorThinCliEnabled"', connectionEnabled, 'Access through thin client is enabled')
             .col-sm-6
                 +preview-xml-java(model, 'clusterClientConnector')
index ece8fcb..6daf3aa 100644 (file)
@@ -77,6 +77,10 @@ export default class IgniteVersion {
 
         this.supportedVersions = [
             {
+                label: 'Ignite 2.5',
+                ignite: '2.5.0'
+            },
+            {
                 label: 'Ignite 2.4',
                 ignite: '2.4.0'
             },
index 2485fa6..7d987dd 100644 (file)
@@ -468,7 +468,14 @@ export default ['$rootScope', '$scope', '$http', '$state', '$timeout', 'IgniteLe
                 failoverSpi: [],
                 logger: {Log4j: { mode: 'Default'}},
                 caches: linkId && _.find($scope.caches, {value: linkId}) ? [linkId] : [],
-                igfss: linkId && _.find($scope.igfss, {value: linkId}) ? [linkId] : []
+                igfss: linkId && _.find($scope.igfss, {value: linkId}) ? [linkId] : [],
+                clientConnectorConfiguration: {
+                    tcpNoDelay: true,
+                    jdbcEnabled: true,
+                    odbcEnabled: true,
+                    thinClientEnabled: true,
+                    useIgniteSslContextFactory: true
+                }
             });
         }