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

com.ibm.fhir.persistence.jdbc.connection.SchemaNameFromProps Maven / Gradle / Ivy

There is a newer version: 4.11.1
Show newest version
/*
 * (C) Copyright IBM Corp. 2020
 *
 * SPDX-License-Identifier: Apache-2.0
 */

package com.ibm.fhir.persistence.jdbc.connection;

import java.sql.Connection;
import java.util.Properties;

import com.ibm.fhir.persistence.jdbc.exception.FHIRPersistenceDBConnectException;

/**
 * Returns a constant schemaName. Useful for unit test configurations
 */
public class SchemaNameFromProps implements SchemaNameSupplier { 

    // The constant schema name we supply
    private final String schemaName;
 
    /**
     * Public constructor
     * @param configProps should contain the "schemaName" property
     */
    public SchemaNameFromProps(Properties configProps) {
        // get the schema name from the configuration properties
        this.schemaName = configProps.getProperty("schemaName", null);
    }

    /**
     * Public constructor
     * @param schemaName constant
     */
    public SchemaNameFromProps(String schemaName) {
        this.schemaName = schemaName;
    }

    @Override
    public String getSchemaForRequestContext(Connection connection) throws FHIRPersistenceDBConnectException {
        return this.schemaName;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy