smiklosovic commented on code in PR #2505:
URL: https://github.com/apache/cassandra/pull/2505#discussion_r1272660839


##########
src/java/org/apache/cassandra/config/DatabaseDescriptor.java:
##########
@@ -1217,6 +1222,35 @@ public static void applySslContext()
         }
     }
 
+    public static void applyCryptoProvider()
+    {
+        if (conf.crypto_provider == null)
+            conf.crypto_provider = new 
ParameterizedClass(DefaultCryptoProvider.class.getName(), null);
+
+        if (conf.crypto_provider.parameters == null)
+            conf.crypto_provider.parameters = new HashMap<>();
+
+        if (conf.crypto_provider.class_name == null)
+            throw new ConfigurationException("Failed to initialize crypto 
provider, class_name cannot be null");
+
+        
conf.crypto_provider.parameters.putIfAbsent(AbstractCryptoProvider.FAIL_ON_MISSING_PROVIDER_KEY,
 "false");
+
+        try
+        {
+            Class<?> cryptoProviderClass = 
Class.forName(conf.crypto_provider.class_name);

Review Comment:
   classForName is fine. I like the fact that people have to use constructor 
with parameters (as map). Otherwise they would not see so easily that it is 
configurable and we are passing some map to some method. Parameters in 
constructors are common pattern in Cassandra configuration on 
ParameterizedClass.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to