All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.quarkus.jdbc.mariadb.runtime.MariaDBServiceBindingConverter Maven / Gradle / Ivy

There is a newer version: 3.15.0
Show newest version
package io.quarkus.jdbc.mariadb.runtime;

import java.util.List;
import java.util.Optional;

import io.quarkus.kubernetes.service.binding.runtime.DatasourceServiceBindingConfigSourceFactory;
import io.quarkus.kubernetes.service.binding.runtime.ServiceBinding;
import io.quarkus.kubernetes.service.binding.runtime.ServiceBindingConfigSource;
import io.quarkus.kubernetes.service.binding.runtime.ServiceBindingConverter;

public class MariaDBServiceBindingConverter implements ServiceBindingConverter {

    @Override
    public Optional convert(List serviceBindings) {
        return ServiceBinding.singleMatchingByType("mysql", serviceBindings)
                .map(new MariaDBDatasourceServiceBindingConfigSourceFactory());
    }

    private static class MariaDBDatasourceServiceBindingConfigSourceFactory
            extends DatasourceServiceBindingConfigSourceFactory.Jdbc {
        @Override
        protected String formatUrl(String urlFormat, String type, String host, String database, String portPart) {
            return super.formatUrl(urlFormat, "mariadb", host, database, portPart);
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy