use of com.thinkbiganalytics.metadata.rest.client.MetadataClient in project kylo by Teradata.
the class MetadataProviderSelectorService method onConfigured.
@OnEnabled
public void onConfigured(final ConfigurationContext context) {
PropertyValue impl = context.getProperty(IMPLEMENTATION);
if (impl.getValue().equalsIgnoreCase("REMOTE")) {
URI uri = URI.create(context.getProperty(CLIENT_URL).getValue());
String user = context.getProperty(CLIENT_USERNAME).getValue();
String password = context.getProperty(CLIENT_PASSWORD).getValue();
MetadataClient client;
SSLContext sslContext = null;
if (context.getProperty(SSL_CONTEXT_SERVICE) != null && context.getProperty(SSL_CONTEXT_SERVICE).isSet()) {
this.sslContextService = context.getProperty(SSL_CONTEXT_SERVICE).asControllerService(SSLContextService.class);
sslContext = this.sslContextService.createSSLContext(SSLContextService.ClientAuth.REQUIRED);
}
if (StringUtils.isEmpty(user)) {
client = new MetadataClient(uri, sslContext);
} else {
client = new MetadataClient(uri, user, password, sslContext);
}
this.provider = new MetadataClientProvider(client);
this.recorder = new MetadataClientRecorder(client);
this.kyloProvenanceClientProvider = new KyloProvenanceClientProvider(client);
getSpringContextService(context).ifPresent(springService -> {
CancelActiveWaterMarkEventConsumer waterMarkConsumer = springService.getBean(CancelActiveWaterMarkEventConsumer.class);
waterMarkConsumer.addMetadataRecorder(this.recorder);
FeedInitializationChangeEventConsumer initChangeConsumer = springService.getBean(FeedInitializationChangeEventConsumer.class);
initChangeConsumer.addMetadataRecorder(this.recorder);
});
} else {
throw new UnsupportedOperationException("Provider implementations not currently supported: " + impl.getValue());
}
}
Aggregations