Search in sources :

Example 1 with ConfigurationException

use of ca.uhn.fhir.context.ConfigurationException in project drug-formulary-ri by HL7-DaVinci.

the class FhirServerConfigDstu3 method entityManagerFactory.

@Override
@Bean()
public LocalContainerEntityManagerFactoryBean entityManagerFactory() {
    LocalContainerEntityManagerFactoryBean retVal = super.entityManagerFactory();
    retVal.setPersistenceUnitName("HAPI_PU");
    try {
        retVal.setDataSource(myDataSource);
    } catch (Exception e) {
        throw new ConfigurationException("Could not set the data source due to a configuration issue", e);
    }
    retVal.setJpaProperties(HapiProperties.getJpaProperties());
    return retVal;
}
Also used : ConfigurationException(ca.uhn.fhir.context.ConfigurationException) LocalContainerEntityManagerFactoryBean(org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean) ConfigurationException(ca.uhn.fhir.context.ConfigurationException) Bean(org.springframework.context.annotation.Bean) LocalContainerEntityManagerFactoryBean(org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean)

Example 2 with ConfigurationException

use of ca.uhn.fhir.context.ConfigurationException in project drug-formulary-ri by HL7-DaVinci.

the class FhirServerConfigR4 method entityManagerFactory.

@Override
@Bean()
public LocalContainerEntityManagerFactoryBean entityManagerFactory() {
    LocalContainerEntityManagerFactoryBean retVal = super.entityManagerFactory();
    retVal.setPersistenceUnitName("HAPI_PU");
    try {
        retVal.setDataSource(myDataSource);
    } catch (Exception e) {
        throw new ConfigurationException("Could not set the data source due to a configuration issue", e);
    }
    retVal.setJpaProperties(HapiProperties.getJpaProperties());
    return retVal;
}
Also used : ConfigurationException(ca.uhn.fhir.context.ConfigurationException) LocalContainerEntityManagerFactoryBean(org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean) ConfigurationException(ca.uhn.fhir.context.ConfigurationException) Bean(org.springframework.context.annotation.Bean) LocalContainerEntityManagerFactoryBean(org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean)

Example 3 with ConfigurationException

use of ca.uhn.fhir.context.ConfigurationException in project drug-formulary-ri by HL7-DaVinci.

the class HapiProperties method loadProperties.

@NotNull
private static Properties loadProperties() {
    // Load the configurable properties file
    Properties properties;
    try (InputStream in = HapiProperties.class.getClassLoader().getResourceAsStream(HAPI_PROPERTIES)) {
        properties = new Properties();
        properties.load(in);
    } catch (Exception e) {
        throw new ConfigurationException("Could not load HAPI properties", e);
    }
    Properties overrideProps = loadOverrideProperties();
    if (overrideProps != null) {
        properties.putAll(overrideProps);
    }
    return properties;
}
Also used : ConfigurationException(ca.uhn.fhir.context.ConfigurationException) FileInputStream(java.io.FileInputStream) InputStream(java.io.InputStream) Properties(java.util.Properties) ConfigurationException(ca.uhn.fhir.context.ConfigurationException) NotNull(org.jetbrains.annotations.NotNull)

Example 4 with ConfigurationException

use of ca.uhn.fhir.context.ConfigurationException in project drug-formulary-ri by HL7-DaVinci.

the class HapiProperties method loadOverrideProperties.

/**
 * If a configuration file path is explicitly specified via
 * -Dhapi.properties=<path>, the properties there will
 * be used to override the entries in the default hapi.properties file
 * (currently under WEB-INF/classes)
 *
 * @return properties loaded from the explicitly specified configuraiton file if
 *         there is one, or null otherwise.
 */
private static Properties loadOverrideProperties() {
    String confFile = System.getProperty(HAPI_PROPERTIES);
    if (confFile != null) {
        try {
            Properties props = new Properties();
            props.load(new FileInputStream(confFile));
            return props;
        } catch (Exception e) {
            throw new ConfigurationException("Could not load HAPI properties file: " + confFile, e);
        }
    }
    return null;
}
Also used : ConfigurationException(ca.uhn.fhir.context.ConfigurationException) Properties(java.util.Properties) FileInputStream(java.io.FileInputStream) ConfigurationException(ca.uhn.fhir.context.ConfigurationException)

Example 5 with ConfigurationException

use of ca.uhn.fhir.context.ConfigurationException in project drug-formulary-ri by HL7-DaVinci.

the class FhirServerConfigDstu2 method entityManagerFactory.

@Override
@Bean()
public LocalContainerEntityManagerFactoryBean entityManagerFactory() {
    LocalContainerEntityManagerFactoryBean retVal = super.entityManagerFactory();
    retVal.setPersistenceUnitName("HAPI_PU");
    try {
        retVal.setDataSource(myDataSource);
    } catch (Exception e) {
        throw new ConfigurationException("Could not set the data source due to a configuration issue", e);
    }
    retVal.setJpaProperties(HapiProperties.getJpaProperties());
    return retVal;
}
Also used : ConfigurationException(ca.uhn.fhir.context.ConfigurationException) LocalContainerEntityManagerFactoryBean(org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean) ConfigurationException(ca.uhn.fhir.context.ConfigurationException) Bean(org.springframework.context.annotation.Bean) LocalContainerEntityManagerFactoryBean(org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean)

Aggregations

ConfigurationException (ca.uhn.fhir.context.ConfigurationException)13 Bean (org.springframework.context.annotation.Bean)8 LocalContainerEntityManagerFactoryBean (org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean)8 Properties (java.util.Properties)3 FileInputStream (java.io.FileInputStream)2 InputStream (java.io.InputStream)2 TemplateTypeEnum (ca.uhn.fhir.narrative2.TemplateTypeEnum)1 DataFormatException (ca.uhn.fhir.parser.DataFormatException)1 InternalErrorException (ca.uhn.fhir.rest.server.exceptions.InternalErrorException)1 IOException (java.io.IOException)1 InputStreamReader (java.io.InputStreamReader)1 StringReader (java.io.StringReader)1 HashMap (java.util.HashMap)1 HashSet (java.util.HashSet)1 Set (java.util.Set)1 StringUtils (org.apache.commons.lang3.StringUtils)1 FileStatus (org.apache.hadoop.fs.FileStatus)1 FileSystem (org.apache.hadoop.fs.FileSystem)1 Path (org.apache.hadoop.fs.Path)1 PathFilter (org.apache.hadoop.fs.PathFilter)1