Skip to content

Commit ec1c2c4

Browse files
authored
Remove AbstractComponent usage in x-pack core (#35187)
This change removes the use of AbstractComponent in the security module. The classes now declare their own loggers. Relates #34488
1 parent b3da3ea commit ec1c2c4

File tree

3 files changed

+14
-6
lines changed

3 files changed

+14
-6
lines changed

x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ssl/SSLConfigurationReloader.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
*/
66
package org.elasticsearch.xpack.core.ssl;
77

8-
import org.elasticsearch.common.component.AbstractComponent;
8+
import org.apache.logging.log4j.LogManager;
9+
import org.apache.logging.log4j.Logger;
910
import org.elasticsearch.env.Environment;
1011
import org.elasticsearch.watcher.FileChangesListener;
1112
import org.elasticsearch.watcher.FileWatcher;
@@ -27,7 +28,9 @@
2728
* Ensures that the files backing an {@link SSLConfiguration} are monitored for changes and the underlying key/trust material is reloaded
2829
* and the {@link SSLContext} has existing sessions invalidated to force the use of the new key/trust material
2930
*/
30-
public class SSLConfigurationReloader extends AbstractComponent {
31+
public class SSLConfigurationReloader {
32+
33+
private static final Logger logger = LogManager.getLogger(SSLConfigurationReloader.class);
3134

3235
private final ConcurrentHashMap<Path, ChangeListener> pathToChangeListenerMap = new ConcurrentHashMap<>();
3336
private final Environment environment;

x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ssl/SSLService.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,12 @@
77

88
import org.apache.http.conn.ssl.NoopHostnameVerifier;
99
import org.apache.http.nio.conn.ssl.SSLIOSessionStrategy;
10+
import org.apache.logging.log4j.LogManager;
11+
import org.apache.logging.log4j.Logger;
1012
import org.apache.lucene.util.SetOnce;
1113
import org.elasticsearch.ElasticsearchException;
1214
import org.elasticsearch.common.CheckedSupplier;
1315
import org.elasticsearch.common.Strings;
14-
import org.elasticsearch.common.component.AbstractComponent;
1516
import org.elasticsearch.common.settings.Settings;
1617
import org.elasticsearch.env.Environment;
1718
import org.elasticsearch.xpack.core.XPackSettings;
@@ -58,7 +59,9 @@
5859
* Provides access to {@link SSLEngine} and {@link SSLSocketFactory} objects based on a provided configuration. All
5960
* configurations loaded by this service must be configured on construction.
6061
*/
61-
public class SSLService extends AbstractComponent {
62+
public class SSLService {
63+
64+
private static final Logger logger = LogManager.getLogger(SSLService.class);
6265

6366
private final Settings settings;
6467

x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/watcher/crypto/CryptoService.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@
55
*/
66
package org.elasticsearch.xpack.core.watcher.crypto;
77

8+
import org.apache.logging.log4j.LogManager;
9+
import org.apache.logging.log4j.Logger;
810
import org.elasticsearch.ElasticsearchException;
9-
import org.elasticsearch.common.component.AbstractComponent;
1011
import org.elasticsearch.common.io.Streams;
1112
import org.elasticsearch.common.settings.Setting;
1213
import org.elasticsearch.common.settings.Setting.Property;
@@ -34,7 +35,7 @@
3435
/**
3536
* Service that provides cryptographic methods based on a shared system key
3637
*/
37-
public class CryptoService extends AbstractComponent {
38+
public class CryptoService {
3839

3940
public static final String KEY_ALGO = "HmacSHA512";
4041
public static final int KEY_SIZE = 1024;
@@ -58,6 +59,7 @@ public class CryptoService extends AbstractComponent {
5859
Setting.intSetting(SecurityField.setting("encryption_key.length"), DEFAULT_KEY_LENGTH, Property.NodeScope);
5960
private static final Setting<String> ENCRYPTION_KEY_ALGO_SETTING =
6061
new Setting<>(SecurityField.setting("encryption_key.algorithm"), DEFAULT_KEY_ALGORITH, s -> s, Property.NodeScope);
62+
private static final Logger logger = LogManager.getLogger(CryptoService.class);
6163

6264
private final SecureRandom secureRandom = new SecureRandom();
6365
private final String encryptionAlgorithm;

0 commit comments

Comments
 (0)