use of com.thinkbiganalytics.nifi.rest.client.NifiRestClientConfig in project kylo by Teradata.
the class SpringNifiRestConfiguration method nifiRestClientConfig.
/**
* Gets the configuration for the NiFi REST client.
*
* <p>Looks for {@code thinkbig.nifi.rest} properties first then for {@code nifi.rest} properties.</p>
*
* @return the NiFi REST client configuration
*/
@Bean(name = "nifiRestClientConfig")
@ConfigurationProperties(prefix = "nifi.rest")
public NifiRestClientConfig nifiRestClientConfig() {
final NifiRestClientConfig config = new NifiRestClientConfig();
config.setUsername(env.getProperty("thinkbig.nifi.rest.username"));
config.setPassword(env.getProperty("thinkbig.nifi.rest.password") == null ? null : env.getProperty("thinkbig.nifi.rest.password").toCharArray());
config.setHttps(BooleanUtils.toBoolean(env.getProperty("thinkbig.nifi.rest.https")));
config.setUseConnectionPooling(BooleanUtils.toBoolean(env.getProperty("thinkbig.nifi.rest.useConnectionPooling")));
config.setTruststorePath(env.getProperty("thinkbig.nifi.rest.truststorePath"));
config.setTruststorePassword(env.getProperty("thinkbig.nifi.rest.truststorePassword") == null ? null : env.getProperty("thinkbig.nifi.rest.truststorePassword").toCharArray());
config.setKeystorePassword(env.getProperty("thinkbig.nifi.rest.keystorePassword") == null ? null : env.getProperty("thinkbig.nifi.rest.keystorePassword").toCharArray());
config.setKeystorePath(env.getProperty("thinkbig.nifi.rest.keystorePath"));
config.setTrustStoreType(env.getProperty("thinkbig.nifi.rest.truststoreType"));
config.setKeystoreType(env.getProperty("thinkbig.nifi.rest.keystoreType"));
final String host = env.getProperty("thinkbig.nifi.rest.host");
if (host != null) {
try {
final URL url = new URL(host);
config.setHost(url.getHost());
config.setPort((url.getPort() > -1) ? url.getPort() : 8079);
} catch (final MalformedURLException e) {
throw new IllegalArgumentException("Invalid thinkbig.nifi.rest.host: " + host, e);
}
}
return config;
}
use of com.thinkbiganalytics.nifi.rest.client.NifiRestClientConfig in project kylo by Teradata.
the class NifiRestTest method setupRestClient.
@Before
public void setupRestClient() {
restClient = new LegacyNifiRestClient();
NifiRestClientConfig clientConfig = new NifiRestClientConfig();
// clientConfig.setHost("localhost");
clientConfig.setHost("34.208.236.190");
clientConfig.setPort(8079);
NiFiRestClient c = new NiFiRestClientV1(clientConfig);
restClient.setClient(c);
nifiFlowCache = new NifiFlowCacheImpl();
propertyDescriptorTransform = new NiFiPropertyDescriptorTransformV1();
createFeedBuilderCache = new NiFiObjectCache();
createFeedBuilderCache.setRestClient(restClient);
templateConnectionUtil = new TemplateConnectionUtil();
templateConnectionUtil.setRestClient(restClient);
templateConnectionUtil.setNifiFlowCache(nifiFlowCache);
templateConnectionUtil.setNiFiObjectCache(createFeedBuilderCache);
templateConnectionUtil.setPropertyDescriptorTransform(propertyDescriptorTransform);
}
Aggregations