com.marklogic.flux.impl.JdbcParams Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of flux-api Show documentation
Show all versions of flux-api Show documentation
Flux API for data movement with MarkLogic
/*
* Copyright © 2024 MarkLogic Corporation. All Rights Reserved.
*/
package com.marklogic.flux.impl;
import com.marklogic.flux.api.JdbcOptions;
import picocli.CommandLine;
import java.util.HashMap;
import java.util.Map;
public class JdbcParams implements JdbcOptions {
@CommandLine.Option(names = "--jdbc-url", required = true, description = "The JDBC URL to connect to.")
private String url;
@CommandLine.Option(names = "--jdbc-driver", description = "The fully qualified Java class name of the JDBC driver to use.")
private String driver;
@CommandLine.Option(names = "--jdbc-user", description = "The user to authenticate as, if not specified in the JDBC URL.")
private String user;
@CommandLine.Option(
names = "--jdbc-password",
description = "The password to use for authentication, if not specified in the JDBC URL.",
interactive = true,
arity = "0..1"
)
private String password;
@CommandLine.Option(
names = "-P",
description = "Specify any Spark JDBC option defined at " +
"%nhttps://spark.apache.org/docs/latest/sql-data-sources-jdbc.html; e.g. -Pfetchsize=100 ."
)
private Map additionalOptions = new HashMap<>();
public Map makeOptions() {
Map options = OptionsUtil.makeOptions(
"url", url,
"driver", driver,
"user", user,
"password", password
);
options.putAll(additionalOptions);
return options;
}
@Override
public T url(String url) {
this.url = url;
return (T) this;
}
@Override
public T driver(String driver) {
this.driver = driver;
return (T) this;
}
@Override
public T user(String user) {
this.user = user;
return (T) this;
}
@Override
public T password(String password) {
this.password = password;
return (T) this;
}
@Override
public T additionalOptions(Map additionalOptions) {
this.additionalOptions = additionalOptions;
return (T) this;
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy