use of org.talend.dataprep.info.Version in project data-prep by Talend.
the class AbstractVersionSupplier method callVersionService.
/**
* Call the version service on the given service: dataset, preparation or transformation.
*
* @param serviceName the name of the service
* @return the version of the called service
*/
protected Version callVersionService(String serviceUrl, String serviceName, String entryPoint) {
HystrixCommand<InputStream> versionCommand = context.getBean(VersionCommand.class, serviceUrl, entryPoint);
try (InputStream content = versionCommand.execute()) {
final Version version = mapper.readerFor(Version.class).readValue(content);
version.setServiceName(serviceName);
return version;
} catch (IOException | TDPException e) {
LOGGER.warn("Unable to get the version of the service {}", serviceName);
return null;
}
}
use of org.talend.dataprep.info.Version in project data-prep by Talend.
the class OSVersionSupplier method getVersions.
@Override
public List<Version> getVersions() {
final List<Version> versions = new ArrayList<>(4);
final Version apiVersion = versionService.version();
apiVersion.setServiceName("API");
versions.add(apiVersion);
versions.add(callVersionService(datasetServiceUrl, "Dataset", VERSION_ENTRY_POINT));
versions.add(callVersionService(preparationServiceUrl, "Preparation", VERSION_ENTRY_POINT));
versions.add(callVersionService(transformationServiceUrl, "Transformation", VERSION_ENTRY_POINT));
return versions;
}
Aggregations