Class OptionsMetadata (0.27.1)

public class OptionsMetadata

Metadata extractor for CLI.

Inheritance

java.lang.Object > OptionsMetadata

Static Fields

DEFAULT_SERVER_VERSION

public static final String DEFAULT_SERVER_VERSION
Field Value
Type Description
String

Static Methods

isJava8()

public static boolean isJava8()

Returns true if the current JVM is Java 8.

Returns
Type Description
boolean

newBuilder()

public static OptionsMetadata.Builder newBuilder()

Creates a Builder for an OptionsMetadata instance.

Returns
Type Description
OptionsMetadata.Builder

toServerVersionNum(String version)

public static String toServerVersionNum(String version)
Parameter
Name Description
version String
Returns
Type Description
String

Constructors

OptionsMetadata(String defaultConnectionUrl, int proxyPort, OptionsMetadata.TextFormat textFormat, boolean forceBinary, boolean authenticate, boolean requiresMatcher, boolean replaceJdbcMetadataQueries, JSONObject commandMetadata) (deprecated)

public OptionsMetadata(String defaultConnectionUrl, int proxyPort, OptionsMetadata.TextFormat textFormat, boolean forceBinary, boolean authenticate, boolean requiresMatcher, boolean replaceJdbcMetadataQueries, JSONObject commandMetadata)

Deprecated. Use #newBuilder() to create an options builder, and then call Builder#build() instead of using this constructor.

Parameters
Name Description
defaultConnectionUrl String
proxyPort int
textFormat OptionsMetadata.TextFormat
forceBinary boolean
authenticate boolean
requiresMatcher boolean
replaceJdbcMetadataQueries boolean
commandMetadata org.json.simple.JSONObject

OptionsMetadata(String[] args)

public OptionsMetadata(String[] args)

Creates a new instance of OptionsMetadata from the given arguments.

It is recommended to use #newBuilder() to create an options Builder instead of calling this method directly.

Parameter
Name Description
args String[]

Methods

buildConnectionURL(String database)

public String buildConnectionURL(String database)

Takes user inputs and builds a JDBC connection string from them.

Parameter
Name Description
database String
Returns
Type Description
String

The parsed JDBC connection string.

buildCredentialsFile()

public String buildCredentialsFile()

Get credential file path from either command line or application default. If neither are set, then throw an error.

Returns
Type Description
String

The absolute path of the credentials file.

disableLocalhostCheck()

public boolean disableLocalhostCheck()
Returns
Type Description
boolean

getCommandMetadataJSON()

public JSONObject getCommandMetadataJSON()
Returns
Type Description
org.json.simple.JSONObject

getConnectionURL() (deprecated)

public String getConnectionURL()
Returns
Type Description
String

the default connection URL that is used by the server.

getCredentials()

public Credentials getCredentials()

Returns the Credentials instance that has been set for this OptionsMetadata. This overrides both any credentials file and any default credentials in the current runtime environment.

Returns
Type Description
com.google.auth.Credentials

getDatabaseName(String database)

public DatabaseName getDatabaseName(String database)

Returns the fully qualified database name based on the given database id or name.

Parameter
Name Description
database String
Returns
Type Description
com.google.spanner.v1.DatabaseName

getDdlTransactionMode()

public OptionsMetadata.DdlTransactionMode getDdlTransactionMode()
Returns
Type Description
OptionsMetadata.DdlTransactionMode

getDefaultConnectionUrl()

public String getDefaultConnectionUrl()

Returns the default connection URL that is used by the server. If a default connection URL has been set, the database parameter in a connection request will be ignored, and the database in this connection URL will be used instead.

Returns
Type Description
String

the default connection URL that is used by the server.

getDefaultDatabaseId()

public DatabaseId getDefaultDatabaseId()

Returns the id of the default database or null if no default has been selected.

Returns
Type Description
com.google.cloud.spanner.DatabaseId

getDefaultInstanceId()

public InstanceId getDefaultInstanceId()

Returns the id of the default instance or null if no default has been selected.

Returns
Type Description
com.google.cloud.spanner.InstanceId

getMaxBacklog()

public int getMaxBacklog()
Returns
Type Description
int

getOpenTelemetryTraceRatio()

public Double getOpenTelemetryTraceRatio()
Returns
Type Description
Double

getPropertyMap()

public Map<String,String> getPropertyMap()
Returns
Type Description
Map<String,String>

getProxyPort()

public int getProxyPort()
Returns
Type Description
int

getServerVersion()

public String getServerVersion()
Returns
Type Description
String

getServerVersionNum()

public String getServerVersionNum()
Returns
Type Description
String

getSessionPoolOptions()

public SessionPoolOptions getSessionPoolOptions()

Returns the SessionPoolOptions that has been set for this OptionsMetadata.

Returns
Type Description
com.google.cloud.spanner.SessionPoolOptions

getSocketFile(int localPort)

public String getSocketFile(int localPort)
Parameter
Name Description
localPort int
Returns
Type Description
String

getSslMode()

public OptionsMetadata.SslMode getSslMode()
Returns
Type Description
OptionsMetadata.SslMode

getTelemetryCredentials()

public Credentials getTelemetryCredentials()
Returns
Type Description
com.google.auth.Credentials
Exceptions
Type Description
IOException

getTelemetryProjectId()

public String getTelemetryProjectId()
Returns
Type Description
String

getTextFormat()

public OptionsMetadata.TextFormat getTextFormat()
Returns
Type Description
OptionsMetadata.TextFormat

hasDefaultConnectionUrl()

public boolean hasDefaultConnectionUrl()
Returns
Type Description
boolean

true if the server uses a default connection URL and ignores the database in a connection request

hasDefaultInstanceId()

public boolean hasDefaultInstanceId()

Returns true if these options contain a default instance id.

Returns
Type Description
boolean

isBinaryFormat()

public boolean isBinaryFormat()
Returns
Type Description
boolean

isDebugMode()

public boolean isDebugMode()
Returns
Type Description
boolean

isDomainSocketEnabled()

public boolean isDomainSocketEnabled()
Returns
Type Description
boolean

isEnableOpenTelemetry()

public boolean isEnableOpenTelemetry()
Returns
Type Description
boolean

isReplaceJdbcMetadataQueries()

public boolean isReplaceJdbcMetadataQueries()
Returns
Type Description
boolean

isWindows()

public boolean isWindows()

Returns true if the OS is Windows.

Returns
Type Description
boolean

replacePgCatalogTables()

public boolean replacePgCatalogTables()
Returns
Type Description
boolean

requiresMatcher()

public boolean requiresMatcher()
Returns
Type Description
boolean

shouldAuthenticate()

public boolean shouldAuthenticate()
Returns
Type Description
boolean

shouldAutoDetectClient()

public boolean shouldAutoDetectClient()
Returns
Type Description
boolean

useDefaultLocalStatements()

public boolean useDefaultLocalStatements()
Returns
Type Description
boolean