diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/api/Constants.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/api/Constants.java index 8309860af40..5f611868978 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/api/Constants.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/api/Constants.java @@ -206,6 +206,7 @@ public class Constants { */ public static final String TEST_SYSTEM_PROP_VALIDATION_RESOURCE_CACHES_MS = "TEST_SYSTEM_PROP_VALIDATION_RESOURCE_CACHES_MS"; public static final String PARAM_SEARCH_TOTAL_MODE = "_total"; + public static final String CAPABILITYSTATEMENT_WEBSOCKET_URL = "http://hl7.org/fhir/StructureDefinition/capabilitystatement-websocket"; static { CHARSET_UTF8 = Charset.forName(CHARSET_NAME_UTF8); diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/provider/JpaConformanceProviderDstu2.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/provider/JpaConformanceProviderDstu2.java index bb766d2f1a9..6a08e20ac48 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/provider/JpaConformanceProviderDstu2.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/provider/JpaConformanceProviderDstu2.java @@ -30,6 +30,7 @@ import ca.uhn.fhir.jpa.dao.DaoConfig; import ca.uhn.fhir.jpa.dao.IFhirSystemDao; import ca.uhn.fhir.jpa.util.ResourceCountCache; import ca.uhn.fhir.jpa.util.SingleItemLoadingCache; +import ca.uhn.fhir.model.api.ExtensionDt; import ca.uhn.fhir.model.dstu2.composite.MetaDt; import ca.uhn.fhir.model.dstu2.resource.Bundle; import ca.uhn.fhir.model.dstu2.resource.Conformance; @@ -41,12 +42,17 @@ import ca.uhn.fhir.model.dstu2.valueset.ResourceTypeEnum; import ca.uhn.fhir.model.dstu2.valueset.SearchParamTypeEnum; import ca.uhn.fhir.model.primitive.BoundCodeDt; import ca.uhn.fhir.model.primitive.DecimalDt; +import ca.uhn.fhir.model.primitive.UriDt; +import ca.uhn.fhir.rest.api.Constants; import ca.uhn.fhir.rest.server.RestfulServer; import ca.uhn.fhir.rest.server.provider.dstu2.ServerConformanceProvider; import ca.uhn.fhir.util.CoverageIgnore; import ca.uhn.fhir.util.ExtensionConstants; +import org.hl7.fhir.instance.model.Subscription; +import org.hl7.fhir.r4.model.Extension; import static org.apache.commons.lang3.ObjectUtils.defaultIfNull; +import static org.apache.commons.lang3.StringUtils.isNotBlank; public class JpaConformanceProviderDstu2 extends ServerConformanceProvider { @@ -124,6 +130,15 @@ public class JpaConformanceProviderDstu2 extends ServerConformanceProvider { } } + if (myDaoConfig.getSupportedSubscriptionTypes().contains(Subscription.SubscriptionChannelType.WEBSOCKET)) { + if (isNotBlank(myDaoConfig.getWebsocketContextPath())) { + ExtensionDt websocketExtension = new ExtensionDt(); + websocketExtension.setUrl(Constants.CAPABILITYSTATEMENT_WEBSOCKET_URL); + websocketExtension.setValue(new UriDt(myDaoConfig.getWebsocketContextPath())); + retVal.getRestFirstRep().addUndeclaredExtension(websocketExtension); + } + } + retVal.getImplementation().setDescription(myImplementationDescription); myCachedValue = retVal; return retVal; diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/provider/dstu3/JpaConformanceProviderDstu3.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/provider/dstu3/JpaConformanceProviderDstu3.java index d57beccd951..e63b37d72f8 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/provider/dstu3/JpaConformanceProviderDstu3.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/provider/dstu3/JpaConformanceProviderDstu3.java @@ -25,6 +25,9 @@ import ca.uhn.fhir.context.RuntimeSearchParam; import ca.uhn.fhir.jpa.dao.DaoConfig; import ca.uhn.fhir.jpa.dao.IFhirSystemDao; import ca.uhn.fhir.jpa.searchparam.registry.ISearchParamRegistry; +import ca.uhn.fhir.model.api.ExtensionDt; +import ca.uhn.fhir.model.primitive.UriDt; +import ca.uhn.fhir.rest.api.Constants; import ca.uhn.fhir.rest.server.RestfulServer; import ca.uhn.fhir.util.CoverageIgnore; import ca.uhn.fhir.util.ExtensionConstants; @@ -38,6 +41,7 @@ import java.util.Collections; import java.util.Map; import static org.apache.commons.lang3.ObjectUtils.defaultIfNull; +import static org.apache.commons.lang3.StringUtils.isNotBlank; public class JpaConformanceProviderDstu3 extends org.hl7.fhir.dstu3.hapi.rest.server.ServerCapabilityStatementProvider { @@ -150,6 +154,15 @@ public class JpaConformanceProviderDstu3 extends org.hl7.fhir.dstu3.hapi.rest.se massage(retVal); + if (myDaoConfig.getSupportedSubscriptionTypes().contains(org.hl7.fhir.instance.model.Subscription.SubscriptionChannelType.WEBSOCKET)) { + if (isNotBlank(myDaoConfig.getWebsocketContextPath())) { + Extension websocketExtension = new Extension(); + websocketExtension.setUrl(Constants.CAPABILITYSTATEMENT_WEBSOCKET_URL); + websocketExtension.setValue(new UriType(myDaoConfig.getWebsocketContextPath())); + retVal.getRestFirstRep().addExtension(websocketExtension); + } + } + retVal.getImplementation().setDescription(myImplementationDescription); myCachedValue = retVal; return retVal; diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/provider/r4/JpaConformanceProviderR4.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/provider/r4/JpaConformanceProviderR4.java index 38d0ac3cc19..0eb5780d828 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/provider/r4/JpaConformanceProviderR4.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/provider/r4/JpaConformanceProviderR4.java @@ -24,6 +24,7 @@ import java.util.*; import javax.servlet.http.HttpServletRequest; import ca.uhn.fhir.jpa.searchparam.registry.ISearchParamRegistry; +import ca.uhn.fhir.rest.api.Constants; import org.hl7.fhir.r4.model.*; import org.hl7.fhir.r4.model.CapabilityStatement.*; import org.hl7.fhir.r4.model.Enumerations.SearchParamType; @@ -37,6 +38,7 @@ import ca.uhn.fhir.util.CoverageIgnore; import ca.uhn.fhir.util.ExtensionConstants; import static org.apache.commons.lang3.ObjectUtils.defaultIfNull; +import static org.apache.commons.lang3.StringUtils.isNotBlank; public class JpaConformanceProviderR4 extends org.hl7.fhir.r4.hapi.rest.server.ServerCapabilityStatementProvider { @@ -148,6 +150,15 @@ public class JpaConformanceProviderR4 extends org.hl7.fhir.r4.hapi.rest.server.S } } + if (myDaoConfig.getSupportedSubscriptionTypes().contains(org.hl7.fhir.instance.model.Subscription.SubscriptionChannelType.WEBSOCKET)) { + if (isNotBlank(myDaoConfig.getWebsocketContextPath())) { + Extension websocketExtension = new Extension(); + websocketExtension.setUrl(Constants.CAPABILITYSTATEMENT_WEBSOCKET_URL); + websocketExtension.setValue(new org.hl7.fhir.dstu3.model.UriType(myDaoConfig.getWebsocketContextPath())); + retVal.getRestFirstRep().addExtension(websocketExtension); + } + } + massage(retVal); retVal.getImplementation().setDescription(myImplementationDescription); diff --git a/hapi-fhir-jpaserver-uhnfhirtest/src/main/java/ca/uhn/fhirtest/TestRestfulServer.java b/hapi-fhir-jpaserver-uhnfhirtest/src/main/java/ca/uhn/fhirtest/TestRestfulServer.java index 50f06275314..a415ea376da 100644 --- a/hapi-fhir-jpaserver-uhnfhirtest/src/main/java/ca/uhn/fhirtest/TestRestfulServer.java +++ b/hapi-fhir-jpaserver-uhnfhirtest/src/main/java/ca/uhn/fhirtest/TestRestfulServer.java @@ -87,13 +87,8 @@ public class TestRestfulServer extends RestfulServer { myAppCtx = new AnnotationConfigWebApplicationContext(); myAppCtx.setServletConfig(getServletConfig()); myAppCtx.setParent(parentAppCtx); - if ("TDL2".equals(fhirVersionParam.trim().toUpperCase())) { - myAppCtx.register(TdlDstu2Config.class); - baseUrlProperty = FHIR_BASEURL_TDL2; - } else { - myAppCtx.register(TestDstu2Config.class, WebsocketDispatcherConfig.class); - baseUrlProperty = FHIR_BASEURL_DSTU2; - } + myAppCtx.register(TestDstu2Config.class, WebsocketDispatcherConfig.class); + baseUrlProperty = FHIR_BASEURL_DSTU2; myAppCtx.refresh(); setFhirContext(FhirContext.forDstu2()); beans = myAppCtx.getBean("myResourceProvidersDstu2", ResourceProviderFactory.class); @@ -105,18 +100,12 @@ public class TestRestfulServer extends RestfulServer { setServerConformanceProvider(confProvider); break; } - case "TDL3": case "DSTU3": { myAppCtx = new AnnotationConfigWebApplicationContext(); myAppCtx.setServletConfig(getServletConfig()); myAppCtx.setParent(parentAppCtx); - if ("TDL3".equals(fhirVersionParam.trim().toUpperCase())) { - myAppCtx.register(TdlDstu3Config.class); - baseUrlProperty = FHIR_BASEURL_TDL3; - } else { - myAppCtx.register(TestDstu3Config.class, WebsocketDispatcherConfig.class); - baseUrlProperty = FHIR_BASEURL_DSTU3; - } + myAppCtx.register(TestDstu3Config.class, WebsocketDispatcherConfig.class); + baseUrlProperty = FHIR_BASEURL_DSTU3; myAppCtx.refresh(); setFhirContext(FhirContext.forDstu3()); beans = myAppCtx.getBean("myResourceProvidersDstu3", ResourceProviderFactory.class); diff --git a/hapi-fhir-jpaserver-uhnfhirtest/src/main/java/ca/uhn/fhirtest/config/TdlDstu2Config.java b/hapi-fhir-jpaserver-uhnfhirtest/src/main/java/ca/uhn/fhirtest/config/TdlDstu2Config.java deleted file mode 100644 index 907863a8e63..00000000000 --- a/hapi-fhir-jpaserver-uhnfhirtest/src/main/java/ca/uhn/fhirtest/config/TdlDstu2Config.java +++ /dev/null @@ -1,175 +0,0 @@ -package ca.uhn.fhirtest.config; - -import ca.uhn.fhir.jpa.config.BaseJavaConfigDstu2; -import ca.uhn.fhir.jpa.dao.DaoConfig; -import ca.uhn.fhir.jpa.model.entity.ModelConfig; -import ca.uhn.fhir.jpa.search.LuceneSearchMappingFactory; -import ca.uhn.fhir.jpa.util.DerbyTenSevenHapiFhirDialect; -import ca.uhn.fhir.jpa.util.SubscriptionsRequireManualActivationInterceptorDstu2; -import ca.uhn.fhir.rest.api.RestOperationTypeEnum; -import ca.uhn.fhir.rest.server.interceptor.IServerInterceptor; -import ca.uhn.fhir.rest.server.interceptor.RequestValidatingInterceptor; -import ca.uhn.fhir.rest.server.interceptor.ResponseValidatingInterceptor; -import ca.uhn.fhir.validation.ResultSeverityEnum; -import ca.uhn.fhirtest.interceptor.TdlSecurityInterceptor; -import org.apache.commons.dbcp2.BasicDataSource; -import org.apache.commons.lang3.time.DateUtils; -import org.springframework.beans.factory.annotation.Autowire; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.context.annotation.Import; -import org.springframework.context.annotation.Lazy; -import org.springframework.context.support.PropertySourcesPlaceholderConfigurer; -import org.springframework.orm.jpa.JpaTransactionManager; -import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean; -import org.springframework.transaction.annotation.EnableTransactionManagement; - -import javax.persistence.EntityManagerFactory; -import javax.sql.DataSource; -import java.util.Properties; - -@Configuration -@Import(CommonConfig.class) -@EnableTransactionManagement() -public class TdlDstu2Config extends BaseJavaConfigDstu2 { - - public static final String FHIR_LUCENE_LOCATION_DSTU2 = "${fhir.lucene.location.tdl2}"; - public static final String FHIR_DB_LOCATION_DSTU2 = "${fhir.db.location.tdl2}"; - - @Value(FHIR_DB_LOCATION_DSTU2) - private String myFhirDbLocation; - - @Value(FHIR_LUCENE_LOCATION_DSTU2) - private String myFhirLuceneLocation; - - /** - * This lets the "@Value" fields reference properties from the properties file - */ - @Bean - public static PropertySourcesPlaceholderConfigurer propertySourcesPlaceholderConfigurer() { - return new PropertySourcesPlaceholderConfigurer(); - } - - @Bean - public TdlSecurityInterceptor securityInterceptor() { - return new TdlSecurityInterceptor(); - } - - @Bean - public DaoConfig daoConfig() { - DaoConfig retVal = new DaoConfig(); - retVal.setSubscriptionEnabled(true); - retVal.setSubscriptionPollDelay(5000); - retVal.setSubscriptionPurgeInactiveAfterMillis(DateUtils.MILLIS_PER_HOUR); - retVal.setAllowMultipleDelete(true); - retVal.setAllowInlineMatchUrlReferences(true); - retVal.setAllowExternalReferences(true); - retVal.getTreatBaseUrlsAsLocal().add("http://fhirtest.uhn.ca/testDataLibraryDstu2"); - retVal.getTreatBaseUrlsAsLocal().add("https://fhirtest.uhn.ca/testDataLibraryDstu2"); - retVal.setIndexMissingFields(DaoConfig.IndexEnabledEnum.ENABLED); - retVal.setCountSearchResultsUpTo(TestR4Config.COUNT_SEARCH_RESULTS_UP_TO); - return retVal; - } - - @Bean - public ModelConfig modelConfig() { - return daoConfig().getModelConfig(); - } - - @Bean(name = "myPersistenceDataSourceDstu1", destroyMethod = "close") - public DataSource dataSource() { - BasicDataSource retVal = new BasicDataSource(); -// retVal.setDriver(new org.apache.derby.jdbc.ClientDriver()); - // retVal.setUrl("jdbc:derby:directory:" + myFhirDbLocation + ";create=true"); - retVal.setUrl("jdbc:derby://localhost:1527/" + myFhirDbLocation + ";create=true"); - retVal.setUsername("SA"); - retVal.setPassword("SA"); - return retVal; - } - - @Bean - public JpaTransactionManager transactionManager(EntityManagerFactory entityManagerFactory) { - JpaTransactionManager retVal = new JpaTransactionManager(); - retVal.setEntityManagerFactory(entityManagerFactory); - return retVal; - } - - @Override - @Bean - public LocalContainerEntityManagerFactoryBean entityManagerFactory() { - LocalContainerEntityManagerFactoryBean retVal = super.entityManagerFactory(); - retVal.setPersistenceUnitName("PU_HapiFhirJpaDstu2"); - retVal.setDataSource(dataSource()); - retVal.setJpaProperties(jpaProperties()); - return retVal; - } - - private Properties jpaProperties() { - Properties extraProperties = new Properties(); - extraProperties.put("hibernate.dialect", DerbyTenSevenHapiFhirDialect.class.getName()); - extraProperties.put("hibernate.format_sql", "false"); - extraProperties.put("hibernate.show_sql", "false"); - extraProperties.put("hibernate.hbm2ddl.auto", "update"); - extraProperties.put("hibernate.jdbc.batch_size", "20"); - extraProperties.put("hibernate.cache.use_query_cache", "false"); - extraProperties.put("hibernate.cache.use_second_level_cache", "false"); - extraProperties.put("hibernate.cache.use_structured_entries", "false"); - extraProperties.put("hibernate.cache.use_minimal_puts", "false"); - extraProperties.put("hibernate.search.model_mapping", LuceneSearchMappingFactory.class.getName()); - extraProperties.put("hibernate.search.default.directory_provider" ,"filesystem"); - extraProperties.put("hibernate.search.default.indexBase", myFhirLuceneLocation); - extraProperties.put("hibernate.search.lucene_version","LUCENE_CURRENT"); - return extraProperties; - } - - /** - * Bean which validates incoming requests - */ - @Bean - @Lazy - public RequestValidatingInterceptor requestValidatingInterceptor() { - RequestValidatingInterceptor requestValidator = new RequestValidatingInterceptor(); - requestValidator.setFailOnSeverity(null); - requestValidator.setAddResponseHeaderOnSeverity(null); - requestValidator.setAddResponseOutcomeHeaderOnSeverity(ResultSeverityEnum.INFORMATION); - requestValidator.addValidatorModule(instanceValidatorDstu2()); - requestValidator.setIgnoreValidatorExceptions(true); - - return requestValidator; - } - - /** - * Bean which validates outgoing responses - */ - @Bean - @Lazy - public ResponseValidatingInterceptor responseValidatingInterceptor() { - ResponseValidatingInterceptor responseValidator = new ResponseValidatingInterceptor(); - responseValidator.setResponseHeaderValueNoIssues("Validation did not detect any issues"); - responseValidator.setFailOnSeverity(null); - responseValidator.setAddResponseHeaderOnSeverity(null); - responseValidator.setAddResponseOutcomeHeaderOnSeverity(ResultSeverityEnum.INFORMATION); - responseValidator.addExcludeOperationType(RestOperationTypeEnum.METADATA); - responseValidator.addExcludeOperationType(RestOperationTypeEnum.EXTENDED_OPERATION_INSTANCE); - responseValidator.addExcludeOperationType(RestOperationTypeEnum.EXTENDED_OPERATION_SERVER); - responseValidator.addExcludeOperationType(RestOperationTypeEnum.EXTENDED_OPERATION_TYPE); - responseValidator.addExcludeOperationType(RestOperationTypeEnum.GET_PAGE); - responseValidator.addExcludeOperationType(RestOperationTypeEnum.HISTORY_INSTANCE); - responseValidator.addExcludeOperationType(RestOperationTypeEnum.HISTORY_SYSTEM); - responseValidator.addExcludeOperationType(RestOperationTypeEnum.HISTORY_TYPE); - responseValidator.addExcludeOperationType(RestOperationTypeEnum.SEARCH_SYSTEM); - responseValidator.addExcludeOperationType(RestOperationTypeEnum.SEARCH_TYPE); - responseValidator.addValidatorModule(instanceValidatorDstu2()); - responseValidator.setIgnoreValidatorExceptions(true); - - return responseValidator; - } - - @Bean(autowire=Autowire.BY_TYPE) - public IServerInterceptor subscriptionSecurityInterceptor() { - return new SubscriptionsRequireManualActivationInterceptorDstu2(); - } - - -} diff --git a/hapi-fhir-jpaserver-uhnfhirtest/src/main/java/ca/uhn/fhirtest/config/TdlDstu3Config.java b/hapi-fhir-jpaserver-uhnfhirtest/src/main/java/ca/uhn/fhirtest/config/TdlDstu3Config.java deleted file mode 100644 index 96ccd4a239a..00000000000 --- a/hapi-fhir-jpaserver-uhnfhirtest/src/main/java/ca/uhn/fhirtest/config/TdlDstu3Config.java +++ /dev/null @@ -1,173 +0,0 @@ -package ca.uhn.fhirtest.config; - -import ca.uhn.fhir.jpa.config.BaseJavaConfigDstu3; -import ca.uhn.fhir.jpa.dao.DaoConfig; -import ca.uhn.fhir.jpa.model.entity.ModelConfig; -import ca.uhn.fhir.jpa.search.LuceneSearchMappingFactory; -import ca.uhn.fhir.jpa.util.DerbyTenSevenHapiFhirDialect; -import ca.uhn.fhir.jpa.util.SubscriptionsRequireManualActivationInterceptorDstu3; -import ca.uhn.fhir.rest.api.RestOperationTypeEnum; -import ca.uhn.fhir.rest.server.interceptor.IServerInterceptor; -import ca.uhn.fhir.rest.server.interceptor.RequestValidatingInterceptor; -import ca.uhn.fhir.rest.server.interceptor.ResponseValidatingInterceptor; -import ca.uhn.fhir.validation.ResultSeverityEnum; -import ca.uhn.fhirtest.interceptor.TdlSecurityInterceptor; -import org.apache.commons.dbcp2.BasicDataSource; -import org.apache.commons.lang3.time.DateUtils; -import org.springframework.beans.factory.annotation.Autowire; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.context.annotation.Import; -import org.springframework.context.annotation.Lazy; -import org.springframework.context.support.PropertySourcesPlaceholderConfigurer; -import org.springframework.orm.jpa.JpaTransactionManager; -import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean; -import org.springframework.transaction.annotation.EnableTransactionManagement; - -import javax.persistence.EntityManagerFactory; -import javax.sql.DataSource; -import java.util.Properties; - -@Configuration -@Import(CommonConfig.class) -@EnableTransactionManagement() -public class TdlDstu3Config extends BaseJavaConfigDstu3 { - - public static final String FHIR_LUCENE_LOCATION_DSTU3 = "${fhir.lucene.location.tdl3}"; - public static final String FHIR_DB_LOCATION_DSTU3 = "${fhir.db.location.tdl3}"; - - @Value(FHIR_DB_LOCATION_DSTU3) - private String myFhirDbLocation; - - @Value(FHIR_LUCENE_LOCATION_DSTU3) - private String myFhirLuceneLocation; - - @Bean - public DaoConfig daoConfig() { - DaoConfig retVal = new DaoConfig(); - retVal.setSubscriptionEnabled(true); - retVal.setSubscriptionPollDelay(5000); - retVal.setSubscriptionPurgeInactiveAfterMillis(DateUtils.MILLIS_PER_HOUR); - retVal.setAllowMultipleDelete(true); - retVal.setAllowInlineMatchUrlReferences(true); - retVal.setAllowExternalReferences(true); - retVal.getTreatBaseUrlsAsLocal().add("http://fhirtest.uhn.ca/testDataLibraryStu3"); - retVal.getTreatBaseUrlsAsLocal().add("https://fhirtest.uhn.ca/testDataLibraryStu3"); - retVal.setIndexMissingFields(DaoConfig.IndexEnabledEnum.ENABLED); - retVal.setCountSearchResultsUpTo(TestR4Config.COUNT_SEARCH_RESULTS_UP_TO); - return retVal; - } - - @Bean - public ModelConfig modelConfig() { - return daoConfig().getModelConfig(); - } - - @Bean(name = "myPersistenceDataSourceDstu3", destroyMethod = "close") - public DataSource dataSource() { - BasicDataSource retVal = new BasicDataSource(); -// retVal.setDriver(new org.apache.derby.jdbc.ClientDriver()); - // retVal.setUrl("jdbc:derby:directory:" + myFhirDbLocation + ";create=true"); - retVal.setUrl("jdbc:derby://localhost:1527/" + myFhirDbLocation + ";create=true"); - retVal.setUsername("SA"); - retVal.setPassword("SA"); - return retVal; - } - - @Override - @Bean - public LocalContainerEntityManagerFactoryBean entityManagerFactory() { - LocalContainerEntityManagerFactoryBean retVal = super.entityManagerFactory(); - retVal.setPersistenceUnitName("PU_HapiFhirJpaDstu3"); - retVal.setDataSource(dataSource()); - retVal.setJpaProperties(jpaProperties()); - return retVal; - } - - private Properties jpaProperties() { - Properties extraProperties = new Properties(); - extraProperties.put("hibernate.dialect", DerbyTenSevenHapiFhirDialect.class.getName()); - extraProperties.put("hibernate.format_sql", "false"); - extraProperties.put("hibernate.show_sql", "false"); - extraProperties.put("hibernate.hbm2ddl.auto", "update"); - extraProperties.put("hibernate.jdbc.batch_size", "20"); - extraProperties.put("hibernate.cache.use_query_cache", "false"); - extraProperties.put("hibernate.cache.use_second_level_cache", "false"); - extraProperties.put("hibernate.cache.use_structured_entries", "false"); - extraProperties.put("hibernate.cache.use_minimal_puts", "false"); - extraProperties.put("hibernate.search.model_mapping", LuceneSearchMappingFactory.class.getName()); - extraProperties.put("hibernate.search.default.directory_provider", "filesystem"); - extraProperties.put("hibernate.search.default.indexBase", myFhirLuceneLocation); - extraProperties.put("hibernate.search.lucene_version", "LUCENE_CURRENT"); - return extraProperties; - } - - /** - * Bean which validates incoming requests - */ - @Bean - @Lazy - public RequestValidatingInterceptor requestValidatingInterceptor() { - RequestValidatingInterceptor requestValidator = new RequestValidatingInterceptor(); - requestValidator.setFailOnSeverity(null); - requestValidator.setAddResponseHeaderOnSeverity(null); - requestValidator.setAddResponseOutcomeHeaderOnSeverity(ResultSeverityEnum.INFORMATION); - requestValidator.addValidatorModule(instanceValidatorDstu3()); - requestValidator.setIgnoreValidatorExceptions(true); - - return requestValidator; - } - - /** - * Bean which validates outgoing responses - */ - @Bean - @Lazy - public ResponseValidatingInterceptor responseValidatingInterceptor() { - ResponseValidatingInterceptor responseValidator = new ResponseValidatingInterceptor(); - responseValidator.setResponseHeaderValueNoIssues("Validation did not detect any issues"); - responseValidator.setFailOnSeverity(null); - responseValidator.setAddResponseHeaderOnSeverity(null); - responseValidator.setAddResponseOutcomeHeaderOnSeverity(ResultSeverityEnum.INFORMATION); - responseValidator.addExcludeOperationType(RestOperationTypeEnum.METADATA); - responseValidator.addExcludeOperationType(RestOperationTypeEnum.EXTENDED_OPERATION_INSTANCE); - responseValidator.addExcludeOperationType(RestOperationTypeEnum.EXTENDED_OPERATION_SERVER); - responseValidator.addExcludeOperationType(RestOperationTypeEnum.EXTENDED_OPERATION_TYPE); - responseValidator.addExcludeOperationType(RestOperationTypeEnum.GET_PAGE); - responseValidator.addExcludeOperationType(RestOperationTypeEnum.HISTORY_INSTANCE); - responseValidator.addExcludeOperationType(RestOperationTypeEnum.HISTORY_SYSTEM); - responseValidator.addExcludeOperationType(RestOperationTypeEnum.HISTORY_TYPE); - responseValidator.addExcludeOperationType(RestOperationTypeEnum.SEARCH_SYSTEM); - responseValidator.addExcludeOperationType(RestOperationTypeEnum.SEARCH_TYPE); - responseValidator.addValidatorModule(instanceValidatorDstu3()); - responseValidator.setIgnoreValidatorExceptions(true); - - return responseValidator; - } - - @Bean - public TdlSecurityInterceptor securityInterceptor() { - return new TdlSecurityInterceptor(); - } - - @Bean(autowire = Autowire.BY_TYPE) - public IServerInterceptor subscriptionSecurityInterceptor() { - return new SubscriptionsRequireManualActivationInterceptorDstu3(); - } - - @Bean - public JpaTransactionManager transactionManager(EntityManagerFactory entityManagerFactory) { - JpaTransactionManager retVal = new JpaTransactionManager(); - retVal.setEntityManagerFactory(entityManagerFactory); - return retVal; - } - - /** - * This lets the "@Value" fields reference properties from the properties file - */ - @Bean - public static PropertySourcesPlaceholderConfigurer propertySourcesPlaceholderConfigurer() { - return new PropertySourcesPlaceholderConfigurer(); - } -} diff --git a/hapi-fhir-jpaserver-uhnfhirtest/src/main/java/ca/uhn/fhirtest/config/TestDstu2Config.java b/hapi-fhir-jpaserver-uhnfhirtest/src/main/java/ca/uhn/fhirtest/config/TestDstu2Config.java index bd96be45566..930676cf161 100644 --- a/hapi-fhir-jpaserver-uhnfhirtest/src/main/java/ca/uhn/fhirtest/config/TestDstu2Config.java +++ b/hapi-fhir-jpaserver-uhnfhirtest/src/main/java/ca/uhn/fhirtest/config/TestDstu2Config.java @@ -61,6 +61,7 @@ public class TestDstu2Config extends BaseJavaConfigDstu2 { retVal.addSupportedSubscriptionType(Subscription.SubscriptionChannelType.EMAIL); retVal.addSupportedSubscriptionType(Subscription.SubscriptionChannelType.RESTHOOK); retVal.addSupportedSubscriptionType(Subscription.SubscriptionChannelType.WEBSOCKET); + retVal.setWebsocketContextPath("/websocketDstu2"); retVal.setAllowContainsSearches(true); retVal.setAllowMultipleDelete(true); retVal.setAllowInlineMatchUrlReferences(true); @@ -70,6 +71,7 @@ public class TestDstu2Config extends BaseJavaConfigDstu2 { retVal.setCountSearchResultsUpTo(TestR4Config.COUNT_SEARCH_RESULTS_UP_TO); retVal.setIndexMissingFields(DaoConfig.IndexEnabledEnum.ENABLED); retVal.setFetchSizeDefaultMaximum(10000); + retVal.setWebsocketContextPath("/"); return retVal; } diff --git a/hapi-fhir-jpaserver-uhnfhirtest/src/main/java/ca/uhn/fhirtest/config/TestDstu3Config.java b/hapi-fhir-jpaserver-uhnfhirtest/src/main/java/ca/uhn/fhirtest/config/TestDstu3Config.java index bee57f1d85e..9b503545a09 100644 --- a/hapi-fhir-jpaserver-uhnfhirtest/src/main/java/ca/uhn/fhirtest/config/TestDstu3Config.java +++ b/hapi-fhir-jpaserver-uhnfhirtest/src/main/java/ca/uhn/fhirtest/config/TestDstu3Config.java @@ -51,6 +51,7 @@ public class TestDstu3Config extends BaseJavaConfigDstu3 { retVal.addSupportedSubscriptionType(Subscription.SubscriptionChannelType.EMAIL); retVal.addSupportedSubscriptionType(Subscription.SubscriptionChannelType.RESTHOOK); retVal.addSupportedSubscriptionType(Subscription.SubscriptionChannelType.WEBSOCKET); + retVal.setWebsocketContextPath("/websocketDstu3"); retVal.setAllowContainsSearches(true); retVal.setAllowMultipleDelete(true); retVal.setAllowInlineMatchUrlReferences(true); diff --git a/hapi-fhir-jpaserver-uhnfhirtest/src/main/java/ca/uhn/fhirtest/config/TestR4Config.java b/hapi-fhir-jpaserver-uhnfhirtest/src/main/java/ca/uhn/fhirtest/config/TestR4Config.java index 93ef04a912f..bb02247056e 100644 --- a/hapi-fhir-jpaserver-uhnfhirtest/src/main/java/ca/uhn/fhirtest/config/TestR4Config.java +++ b/hapi-fhir-jpaserver-uhnfhirtest/src/main/java/ca/uhn/fhirtest/config/TestR4Config.java @@ -52,6 +52,7 @@ public class TestR4Config extends BaseJavaConfigR4 { retVal.addSupportedSubscriptionType(Subscription.SubscriptionChannelType.EMAIL); retVal.addSupportedSubscriptionType(Subscription.SubscriptionChannelType.RESTHOOK); retVal.addSupportedSubscriptionType(Subscription.SubscriptionChannelType.WEBSOCKET); + retVal.setWebsocketContextPath("/websocketR4"); retVal.setAllowContainsSearches(true); retVal.setAllowMultipleDelete(true); retVal.setAllowInlineMatchUrlReferences(true);