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

com.jn.sqlhelper.dialect.urlparser.InformixUrlParser Maven / Gradle / Ivy

package com.jn.sqlhelper.dialect.urlparser;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

public class InformixUrlParser extends CommonUrlParser {
    private static final String URL_PREFIX = "jdbc:informix-sqli:";

    public InformixUrlParser() {

    }

    @Override
    public String getName() {
        return "informix";
    }

    private static final List URL_SCHEMAS = Arrays.asList(new String[]{URL_PREFIX});

    @Override
    public List getUrlSchemas() {
        return URL_SCHEMAS;
    }

    @Override
    protected DatabaseInfo parse0(final String url, String urlPrefix) {
        final StringMaker maker = new StringMaker(url);
        maker.after("jdbc:informix-sqli:");
        final String host = maker.after("//").before('/').value();
        final List hostList = new ArrayList(1);
        hostList.add(host);
        final String databaseId = maker.next().afterLast('/').before(':').value();
        final String normalizedUrl = maker.clear().before(':').value();
        return new DefaultDatabaseInfo(getName(), url, normalizedUrl, hostList, databaseId);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy