Search in sources :

Example 6 with Version

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;
    }
}
Also used : TDPException(org.talend.dataprep.exception.TDPException) Version(org.talend.dataprep.info.Version) InputStream(java.io.InputStream) IOException(java.io.IOException)

Example 7 with Version

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;
}
Also used : Version(org.talend.dataprep.info.Version) ArrayList(java.util.ArrayList)

Aggregations

Version (org.talend.dataprep.info.Version)7 Test (org.junit.Test)4 ManifestInfo (org.talend.dataprep.info.ManifestInfo)4 ManifestInfoProvider (org.talend.dataprep.info.ManifestInfoProvider)4 ArrayList (java.util.ArrayList)2 ApiOperation (io.swagger.annotations.ApiOperation)1 IOException (java.io.IOException)1 InputStream (java.io.InputStream)1 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)1 VersionsSupplier (org.talend.dataprep.api.service.version.VersionsSupplier)1 TDPException (org.talend.dataprep.exception.TDPException)1 BuildDetails (org.talend.dataprep.info.BuildDetails)1 Timed (org.talend.dataprep.metrics.Timed)1 PublicAPI (org.talend.dataprep.security.PublicAPI)1