This is an automated email from the ASF dual-hosted git repository.
av pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ignite.git
The following commit(s) were added to refs/heads/master by this push:
new c2662daeb90 IGNITE-19339 Get rid of deprecated GridSslContextFactory
at public API (#10660)
c2662daeb90 is described below
commit c2662daeb900034bbaad4e38d43ae31c18b53169
Author: Anton Vinogradov <[email protected]>
AuthorDate: Wed Apr 26 15:37:57 2023 +0300
IGNITE-19339 Get rid of deprecated GridSslContextFactory at public API
(#10660)
---
.../configuration/ConnectorConfiguration.java | 37 ++--------------------
.../org/apache/ignite/internal/IgniteKernal.java | 2 +-
.../internal/client/ssl/GridSslContextFactory.java | 37 ----------------------
.../rest/protocols/tcp/GridTcpRestProtocol.java | 8 +----
.../internal/GridLifecycleAwareSelfTest.java | 9 +++---
5 files changed, 8 insertions(+), 85 deletions(-)
diff --git
a/modules/core/src/main/java/org/apache/ignite/configuration/ConnectorConfiguration.java
b/modules/core/src/main/java/org/apache/ignite/configuration/ConnectorConfiguration.java
index c3000025159..00c5413dd37 100644
---
a/modules/core/src/main/java/org/apache/ignite/configuration/ConnectorConfiguration.java
+++
b/modules/core/src/main/java/org/apache/ignite/configuration/ConnectorConfiguration.java
@@ -21,7 +21,6 @@ import java.net.Socket;
import javax.cache.configuration.Factory;
import javax.net.ssl.SSLContext;
import org.apache.ignite.IgniteSystemProperties;
-import org.apache.ignite.internal.client.ssl.GridSslContextFactory;
import org.apache.ignite.internal.util.tostring.GridToStringExclude;
import org.apache.ignite.internal.util.typedef.internal.S;
import org.apache.ignite.ssl.SslContextFactory;
@@ -113,9 +112,6 @@ public class ConnectorConfiguration {
/** SSL need client auth flag. */
private boolean sslClientAuth;
- /** SSL context factory for rest binary server. */
- private GridSslContextFactory sslCtxFactory;
-
/** SSL context factory for rest binary server. */
private Factory<SSLContext> sslFactory;
@@ -159,7 +155,6 @@ public class ConnectorConfiguration {
sndBufSize = cfg.getSendBufferSize();
sndQueueLimit = cfg.getSendQueueLimit();
sslClientAuth = cfg.isSslClientAuth();
- sslCtxFactory = cfg.getSslContextFactory();
sslEnabled = cfg.isSslEnabled();
sslFactory = cfg.getSslFactory();
idleQryCurTimeout = cfg.getIdleQueryCursorTimeout();
@@ -440,7 +435,7 @@ public class ConnectorConfiguration {
/**
* Whether secure socket layer should be enabled on binary rest server.
* <p>
- * Note that if this flag is set to {@code true}, an instance of {@link
GridSslContextFactory}
+ * Note that if this flag is set to {@code true}, an instance of the ssl
factory
* should be provided, otherwise binary rest protocol will fail to start.
*
* @return {@code True} if SSL should be enabled.
@@ -452,7 +447,7 @@ public class ConnectorConfiguration {
/**
* Sets whether Secure Socket Layer should be enabled for REST TCP binary
protocol.
* <p/>
- * Note that if this flag is set to {@code true}, then a valid instance of
{@link GridSslContextFactory}
+ * Note that if this flag is set to {@code true}, then a valid instance of
the ssl factory
* should be provided in {@link IgniteConfiguration}. Otherwise, TCP
binary protocol will fail to start.
*
* @param sslEnabled {@code True} if SSL should be enabled.
@@ -486,34 +481,6 @@ public class ConnectorConfiguration {
return this;
}
- /**
- * Gets context factory that will be used for creating a secure socket
layer of rest binary server.
- *
- * @return SslContextFactory instance.
- * @see GridSslContextFactory
- * @deprecated Use {@link #getSslFactory()} instead.
- */
- @Deprecated
- public GridSslContextFactory getSslContextFactory() {
- return sslCtxFactory;
- }
-
- /**
- * Sets instance of {@link GridSslContextFactory} that will be used to
create an instance of {@code SSLContext}
- * for Secure Socket Layer on TCP binary protocol. This factory will only
be used if
- * {@link #setSslEnabled(boolean)} is set to {@code true}.
- *
- * @param sslCtxFactory Instance of {@link GridSslContextFactory}
- * @deprecated Use {@link #setSslFactory(Factory)} instead.
- * @return {@code this} for chaining.
- */
- @Deprecated
- public ConnectorConfiguration setSslContextFactory(GridSslContextFactory
sslCtxFactory) {
- this.sslCtxFactory = sslCtxFactory;
-
- return this;
- }
-
/**
* Gets context factory that will be used for creating a secure socket
layer of rest binary server.
*
diff --git
a/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
b/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
index f9015c79c58..39f4ad5be07 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
@@ -2038,7 +2038,7 @@ public class IgniteKernal implements IgniteEx,
Externalizable {
if (cfg.getConnectorConfiguration() != null) {
objs.add(cfg.getConnectorConfiguration().getMessageInterceptor());
- objs.add(cfg.getConnectorConfiguration().getSslContextFactory());
+ objs.add(cfg.getConnectorConfiguration().getSslFactory());
}
objs.add(cfg.getMarshaller());
diff --git
a/modules/core/src/main/java/org/apache/ignite/internal/client/ssl/GridSslContextFactory.java
b/modules/core/src/main/java/org/apache/ignite/internal/client/ssl/GridSslContextFactory.java
deleted file mode 100644
index a149d60a4b4..00000000000
---
a/modules/core/src/main/java/org/apache/ignite/internal/client/ssl/GridSslContextFactory.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.internal.client.ssl;
-
-import javax.cache.configuration.Factory;
-import javax.net.ssl.SSLContext;
-import javax.net.ssl.SSLException;
-
-/**
- * This interface provides creation of SSL context both for server and client
use.
- * @deprecated Use {@link Factory} instead.
- */
-@Deprecated
-public interface GridSslContextFactory {
- /**
- * Creates SSL context based on factory settings.
- *
- * @return Initialized SSL context.
- * @throws SSLException If SSL context could not be created.
- */
- public SSLContext createSslContext() throws SSLException;
-}
diff --git
a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/protocols/tcp/GridTcpRestProtocol.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/protocols/tcp/GridTcpRestProtocol.java
index 8cb71979a85..a1aaa0910dd 100644
---
a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/protocols/tcp/GridTcpRestProtocol.java
+++
b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/protocols/tcp/GridTcpRestProtocol.java
@@ -36,7 +36,6 @@ import
org.apache.ignite.internal.client.marshaller.GridClientMarshaller;
import
org.apache.ignite.internal.client.marshaller.jdk.GridClientJdkMarshaller;
import
org.apache.ignite.internal.client.marshaller.optimized.GridClientOptimizedMarshaller;
import
org.apache.ignite.internal.client.marshaller.optimized.GridClientZipOptimizedMarshaller;
-import org.apache.ignite.internal.client.ssl.GridSslContextFactory;
import org.apache.ignite.internal.processors.rest.GridRestProtocolHandler;
import
org.apache.ignite.internal.processors.rest.client.message.GridClientMessage;
import
org.apache.ignite.internal.processors.rest.protocols.GridRestProtocolAdapter;
@@ -100,17 +99,12 @@ public class GridTcpRestProtocol extends
GridRestProtocolAdapter {
Factory<SSLContext> factory = cfg.getSslFactory();
- // This factory deprecated and will be removed.
- GridSslContextFactory depFactory = cfg.getSslContextFactory();
-
- if (factory == null && depFactory == null && igniteFactory ==
null)
+ if (factory == null && igniteFactory == null)
// Thrown SSL exception instead of IgniteCheckedException
for writing correct warning message into log.
throw new SSLException("SSL is enabled, but SSL context
factory is not specified.");
if (factory != null)
sslCtx = factory.create();
- else if (depFactory != null)
- sslCtx = depFactory.createSslContext();
else
sslCtx = igniteFactory.create();
}
diff --git
a/modules/core/src/test/java/org/apache/ignite/internal/GridLifecycleAwareSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/GridLifecycleAwareSelfTest.java
index 8321a3b3eb9..ea047b372f5 100644
---
a/modules/core/src/test/java/org/apache/ignite/internal/GridLifecycleAwareSelfTest.java
+++
b/modules/core/src/test/java/org/apache/ignite/internal/GridLifecycleAwareSelfTest.java
@@ -17,14 +17,13 @@
package org.apache.ignite.internal;
+import javax.cache.configuration.Factory;
import javax.net.ssl.SSLContext;
-import javax.net.ssl.SSLException;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.configuration.ConnectorConfiguration;
import org.apache.ignite.configuration.ConnectorMessageInterceptor;
import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.internal.binary.BinaryMarshaller;
-import org.apache.ignite.internal.client.ssl.GridSslContextFactory;
import org.apache.ignite.lifecycle.LifecycleAware;
import org.apache.ignite.lifecycle.LifecycleBean;
import org.apache.ignite.lifecycle.LifecycleEventType;
@@ -75,7 +74,7 @@ public class GridLifecycleAwareSelfTest extends
GridAbstractLifecycleAwareSelfTe
/**
*/
- private static class TestContextFactory extends TestLifecycleAware
implements GridSslContextFactory {
+ private static class TestContextFactory extends TestLifecycleAware
implements Factory<SSLContext> {
/**
*/
TestContextFactory() {
@@ -83,7 +82,7 @@ public class GridLifecycleAwareSelfTest extends
GridAbstractLifecycleAwareSelfTe
}
/** {@inheritDoc} */
- @Override public SSLContext createSslContext() throws SSLException {
+ @Override public SSLContext create() {
return null;
}
}
@@ -173,7 +172,7 @@ public class GridLifecycleAwareSelfTest extends
GridAbstractLifecycleAwareSelfTe
TestContextFactory ctxFactory = new TestContextFactory();
- clientCfg.setSslContextFactory(ctxFactory);
+ clientCfg.setSslFactory(ctxFactory);
lifecycleAwares.add(ctxFactory);