use of org.apache.kafka.common.config.ConfigDef.Validator in project connect-utils by jcustenborder.
the class Validators method validKeyStoreType.
/**
* Validator is used to ensure that the KeyStore type specified is valid.
* @return
*/
public static Validator validKeyStoreType() {
return (s, o) -> {
if (!(o instanceof String)) {
throw new ConfigException(s, o, "Must be a string.");
}
String keyStoreType = o.toString();
try {
KeyStore.getInstance(keyStoreType);
} catch (KeyStoreException e) {
ConfigException exception = new ConfigException(s, o, "Invalid KeyStore type");
exception.initCause(e);
throw exception;
}
};
}
use of org.apache.kafka.common.config.ConfigDef.Validator in project connect-utils by jcustenborder.
the class Validators method validKeyManagerFactory.
/**
* Validator is used to ensure that the KeyManagerFactory Algorithm specified is valid.
* @return
*/
public static Validator validKeyManagerFactory() {
return (s, o) -> {
if (!(o instanceof String)) {
throw new ConfigException(s, o, "Must be a string.");
}
String keyStoreType = o.toString();
try {
KeyManagerFactory.getInstance(keyStoreType);
} catch (NoSuchAlgorithmException e) {
ConfigException exception = new ConfigException(s, o, "Invalid Algorithm");
exception.initCause(e);
throw exception;
}
};
}
use of org.apache.kafka.common.config.ConfigDef.Validator in project connect-utils by jcustenborder.
the class Validators method validTrustManagerFactory.
/**
* Validator is used to ensure that the TrustManagerFactory Algorithm specified is valid.
* @return
*/
public static Validator validTrustManagerFactory() {
return (s, o) -> {
if (!(o instanceof String)) {
throw new ConfigException(s, o, "Must be a string.");
}
String keyStoreType = o.toString();
try {
TrustManagerFactory.getInstance(keyStoreType);
} catch (NoSuchAlgorithmException e) {
ConfigException exception = new ConfigException(s, o, "Invalid Algorithm");
exception.initCause(e);
throw exception;
}
};
}
use of org.apache.kafka.common.config.ConfigDef.Validator in project connect-utils by jcustenborder.
the class Validators method validSSLContext.
/**
* Validator is used to ensure that the TrustManagerFactory Algorithm specified is valid.
* @return
*/
public static Validator validSSLContext() {
return (s, o) -> {
if (!(o instanceof String)) {
throw new ConfigException(s, o, "Must be a string.");
}
String keyStoreType = o.toString();
try {
SSLContext.getInstance(keyStoreType);
} catch (NoSuchAlgorithmException e) {
ConfigException exception = new ConfigException(s, o, "Invalid Algorithm");
exception.initCause(e);
throw exception;
}
};
}
Aggregations