Skip to content

ServerPropertiesUtils

Creating Instance

ServerPropertiesUtils takes no arguments to be created.

While being created, ServerPropertiesUtils loads server configuration.

ServerPropertiesUtils is created once to be available system-wide.

ServerPropertiesUtils Instance

ServerPropertiesUtils instance

ServerPropertiesUtils is available system-wide as one single instance.

import io.unitycatalog.server.persist.utils.ServerPropertiesUtils
val s3conf = ServerPropertiesUtils.getInstance.getS3Configurations

This ServerPropertiesUtils instance is used when:

Server Properties

ServerPropertiesUtils loads server configuration from etc/conf/server.properties when created.

When there is no etc/conf/server.properties, the server properties are empty.

ServerPropertiesUtils uses the properties for the following:

getGcsConfigurations

Map<String, String> getGcsConfigurations()

getGcsConfigurations collects all non-empty gcs.bucketPath.- and gcs.jsonKeyFilePath.-prefixed configuration properties (from the properties).

getGcsConfigurations does so until there are no more pairs starting from 0.

getGcsConfigurations returns a collection of pairs of gcs.bucketPath.[n] keys and gcs.jsonKeyFilePath.[n] values.


getGcsConfigurations is used when:

getS3Configurations

Map<String, S3StorageConfig> getS3Configurations()

getS3Configurations creates a S3StorageConfig for every collection of n-indexed properties from the server.properties file (with n starting from 0):

  • s3.bucketPath.[n]
  • s3.region.[n]
  • s3.awsRoleArn.[n]
  • s3.accessKey.[n]
  • s3.secretKey.[n]
  • s3.sessionToken.[n]

getS3Configurations returns S3StorageConfigs by their bucketPaths.

Note

getS3Configurations disregards a S3StorageConfig when the following hold true:

  • Any of bucketPath, region and awsRoleArn is undefined
  • Any of accessKey, secretKey, sessionToken is undefined

getS3Configurations is used when:

Load Server Configuration

void loadProperties()

loadProperties loads etc/conf/server.properties file into the Properties.

Note

loadProperties prints out the following ERROR message to the logs when etc/conf/server.properties file could not be found:

Properties file not found: [path]

It is not a fatal error when there is no server configuration file. The server properties are simply empty.

loadProperties prints out the following DEBUG message to the logs:

Properties loaded successfully

Logging

Enable ALL logging level for io.unitycatalog.server.persist.utils.ServerPropertiesUtils logger to see what happens inside.

Add the following line to etc/conf/server.log4j2.properties:

logger.ServerPropertiesUtils.name = io.unitycatalog.server.persist.utils.ServerPropertiesUtils
logger.ServerPropertiesUtils.level = all

Refer to Logging.