diff --git a/.gitignore b/.gitignore
index ca8c581d4..57bcdd065 100755
--- a/.gitignore
+++ b/.gitignore
@@ -86,6 +86,8 @@ dsf-docker-dev-setup-3dic-ttp/secrets/dic2.crt
dsf-docker-dev-setup-3dic-ttp/secrets/dic2.key
dsf-docker-dev-setup-3dic-ttp/secrets/dic3.crt
dsf-docker-dev-setup-3dic-ttp/secrets/dic3.key
+dsf-docker-dev-setup-3dic-ttp/secrets/forward-proxy-tls.chain.crt
+dsf-docker-dev-setup-3dic-ttp/secrets/forward-proxy-tls.key.plain
dsf-docker-dev-setup-3dic-ttp/secrets/issuing_ca.crt
dsf-docker-dev-setup-3dic-ttp/secrets/keycloak.chain.crt
dsf-docker-dev-setup-3dic-ttp/secrets/keycloak.key.plain
diff --git a/dsf-bpe/dsf-bpe-process-api-v1-impl/src/main/java/dev/dsf/bpe/v1/ProcessPluginApiImpl.java b/dsf-bpe/dsf-bpe-process-api-v1-impl/src/main/java/dev/dsf/bpe/v1/ProcessPluginApiImpl.java
index c4ca16ff6..8503b13e9 100644
--- a/dsf-bpe/dsf-bpe-process-api-v1-impl/src/main/java/dev/dsf/bpe/v1/ProcessPluginApiImpl.java
+++ b/dsf-bpe/dsf-bpe-process-api-v1-impl/src/main/java/dev/dsf/bpe/v1/ProcessPluginApiImpl.java
@@ -18,7 +18,6 @@
import java.util.Objects;
import org.operaton.bpm.engine.delegate.DelegateExecution;
-import org.springframework.beans.factory.InitializingBean;
import com.fasterxml.jackson.databind.ObjectMapper;
@@ -35,7 +34,7 @@
import dev.dsf.fhir.authorization.process.ProcessAuthorizationHelper;
import dev.dsf.fhir.authorization.read.ReadAccessHelper;
-public class ProcessPluginApiImpl implements ProcessPluginApi, InitializingBean
+public class ProcessPluginApiImpl implements ProcessPluginApi
{
private final ProxyConfig proxyConfig;
private final EndpointProvider endpointProvider;
@@ -49,6 +48,30 @@ public class ProcessPluginApiImpl implements ProcessPluginApi, InitializingBean
private final ReadAccessHelper readAccessHelper;
private final TaskHelper taskHelper;
+ /**
+ * @param proxyConfig
+ * not null
+ * @param endpointProvider
+ * not null
+ * @param fhirContext
+ * not null
+ * @param fhirWebserviceClientProvider
+ * not null
+ * @param mailService
+ * not null
+ * @param objectMapper
+ * not null
+ * @param organizationProvider
+ * not null
+ * @param processAuthorizationHelper
+ * not null
+ * @param questionnaireResponseHelper
+ * not null
+ * @param readAccessHelper
+ * not null
+ * @param taskHelper
+ * not null
+ */
public ProcessPluginApiImpl(ProxyConfig proxyConfig, EndpointProvider endpointProvider, FhirContext fhirContext,
FhirWebserviceClientProvider fhirWebserviceClientProvider, MailService mailService,
ObjectMapper objectMapper, OrganizationProvider organizationProvider,
@@ -56,33 +79,19 @@ public ProcessPluginApiImpl(ProxyConfig proxyConfig, EndpointProvider endpointPr
QuestionnaireResponseHelper questionnaireResponseHelper, ReadAccessHelper readAccessHelper,
TaskHelper taskHelper)
{
- this.proxyConfig = proxyConfig;
- this.endpointProvider = endpointProvider;
- this.fhirContext = fhirContext;
- this.fhirWebserviceClientProvider = fhirWebserviceClientProvider;
- this.mailService = mailService;
- this.objectMapper = objectMapper;
- this.organizationProvider = organizationProvider;
- this.processAuthorizationHelper = processAuthorizationHelper;
+ this.proxyConfig = Objects.requireNonNull(proxyConfig, "proxyConfig");
+ this.endpointProvider = Objects.requireNonNull(endpointProvider, "endpointProvider");
+ this.fhirContext = Objects.requireNonNull(fhirContext, "fhirContext");
+ this.fhirWebserviceClientProvider = Objects.requireNonNull(fhirWebserviceClientProvider,
+ "fhirWebserviceClientProvider");
+ this.mailService = Objects.requireNonNull(mailService, "mailService");
+ this.objectMapper = Objects.requireNonNull(objectMapper, "objectMapper");
+ this.organizationProvider = Objects.requireNonNull(organizationProvider, "organizationProvider");
+ this.processAuthorizationHelper = Objects.requireNonNull(processAuthorizationHelper,
+ "processAuthorizationHelper");
this.questionnaireResponseHelper = questionnaireResponseHelper;
- this.readAccessHelper = readAccessHelper;
- this.taskHelper = taskHelper;
- }
-
- @Override
- public void afterPropertiesSet() throws Exception
- {
- Objects.requireNonNull(proxyConfig, "proxyConfig");
- Objects.requireNonNull(endpointProvider, "endpointProvider");
- Objects.requireNonNull(fhirContext, "fhirContext");
- Objects.requireNonNull(fhirWebserviceClientProvider, "fhirWebserviceClientProvider");
- Objects.requireNonNull(mailService, "mailService");
- Objects.requireNonNull(objectMapper, "objectMapper");
- Objects.requireNonNull(organizationProvider, "organizationProvider");
- Objects.requireNonNull(processAuthorizationHelper, "processAuthorizationHelper");
- Objects.requireNonNull(questionnaireResponseHelper, "questionnaireResponseHelper");
- Objects.requireNonNull(readAccessHelper, "readAccessHelper");
- Objects.requireNonNull(taskHelper, "taskHelper");
+ this.readAccessHelper = Objects.requireNonNull(readAccessHelper, "readAccessHelper");
+ this.taskHelper = Objects.requireNonNull(taskHelper, "taskHelper");
}
@Override
diff --git a/dsf-bpe/dsf-bpe-process-api-v1-impl/src/main/java/dev/dsf/bpe/v1/listener/AbstractListener.java b/dsf-bpe/dsf-bpe-process-api-v1-impl/src/main/java/dev/dsf/bpe/v1/listener/AbstractListener.java
index 79b6070e7..e6338ded9 100644
--- a/dsf-bpe/dsf-bpe-process-api-v1-impl/src/main/java/dev/dsf/bpe/v1/listener/AbstractListener.java
+++ b/dsf-bpe/dsf-bpe-process-api-v1-impl/src/main/java/dev/dsf/bpe/v1/listener/AbstractListener.java
@@ -28,24 +28,22 @@
import org.hl7.fhir.r4.model.Task.ParameterComponent;
import org.operaton.bpm.engine.delegate.DelegateExecution;
import org.operaton.bpm.engine.delegate.ExecutionListener;
-import org.springframework.beans.factory.InitializingBean;
-public abstract class AbstractListener implements ExecutionListener, InitializingBean
+public abstract class AbstractListener implements ExecutionListener
{
private final String serverBaseUrl;
private final Function variablesFactory;
+ /**
+ * @param serverBaseUrl
+ * not null
+ * @param variablesFactory
+ * not null
+ */
public AbstractListener(String serverBaseUrl, Function variablesFactory)
{
- this.serverBaseUrl = serverBaseUrl;
- this.variablesFactory = variablesFactory;
- }
-
- @Override
- public void afterPropertiesSet() throws Exception
- {
- Objects.requireNonNull(serverBaseUrl, "serverBaseUrl");
- Objects.requireNonNull(variablesFactory, "variablesFactory");
+ this.serverBaseUrl = Objects.requireNonNull(serverBaseUrl, "serverBaseUrl");
+ this.variablesFactory = Objects.requireNonNull(variablesFactory, "variablesFactory");
}
@Override
diff --git a/dsf-bpe/dsf-bpe-process-api-v1-impl/src/main/java/dev/dsf/bpe/v1/listener/EndListener.java b/dsf-bpe/dsf-bpe-process-api-v1-impl/src/main/java/dev/dsf/bpe/v1/listener/EndListener.java
index 418d5b0d4..70c1af2c3 100644
--- a/dsf-bpe/dsf-bpe-process-api-v1-impl/src/main/java/dev/dsf/bpe/v1/listener/EndListener.java
+++ b/dsf-bpe/dsf-bpe-process-api-v1-impl/src/main/java/dev/dsf/bpe/v1/listener/EndListener.java
@@ -35,20 +35,21 @@ public class EndListener extends AbstractListener implements ExecutionListener
private final FhirWebserviceClientProvider fhirWebserviceClientProvider;
+ /**
+ * @param serverBaseUrl
+ * not null
+ * @param variablesFactory
+ * not null
+ * @param fhirWebserviceClientProvider
+ * not null
+ */
public EndListener(String serverBaseUrl, Function variablesFactory,
FhirWebserviceClientProvider fhirWebserviceClientProvider)
{
super(serverBaseUrl, variablesFactory);
- this.fhirWebserviceClientProvider = fhirWebserviceClientProvider;
- }
-
- @Override
- public void afterPropertiesSet() throws Exception
- {
- super.afterPropertiesSet();
-
- Objects.requireNonNull(fhirWebserviceClientProvider, "fhirWebserviceClientProvider");
+ this.fhirWebserviceClientProvider = Objects.requireNonNull(fhirWebserviceClientProvider,
+ "fhirWebserviceClientProvider");
}
@Override
diff --git a/dsf-bpe/dsf-bpe-process-api-v1-impl/src/main/java/dev/dsf/bpe/v1/service/AbstractResourceProvider.java b/dsf-bpe/dsf-bpe-process-api-v1-impl/src/main/java/dev/dsf/bpe/v1/service/AbstractResourceProvider.java
index 1b4ae1dd3..9f978a2dd 100644
--- a/dsf-bpe/dsf-bpe-process-api-v1-impl/src/main/java/dev/dsf/bpe/v1/service/AbstractResourceProvider.java
+++ b/dsf-bpe/dsf-bpe-process-api-v1-impl/src/main/java/dev/dsf/bpe/v1/service/AbstractResourceProvider.java
@@ -30,24 +30,22 @@
import org.hl7.fhir.r4.model.Coding;
import org.hl7.fhir.r4.model.Identifier;
import org.hl7.fhir.r4.model.Resource;
-import org.springframework.beans.factory.InitializingBean;
-public abstract class AbstractResourceProvider implements InitializingBean
+public abstract class AbstractResourceProvider
{
protected final FhirWebserviceClientProvider clientProvider;
protected final String localEndpointAddress;
+ /**
+ * @param clientProvider
+ * not null
+ * @param localEndpointAddress
+ * not null
+ */
public AbstractResourceProvider(FhirWebserviceClientProvider clientProvider, String localEndpointAddress)
{
- this.clientProvider = clientProvider;
- this.localEndpointAddress = localEndpointAddress;
- }
-
- @Override
- public void afterPropertiesSet() throws Exception
- {
- Objects.requireNonNull(clientProvider, "clientProvider");
- Objects.requireNonNull(localEndpointAddress, "localEndpointAddress");
+ this.clientProvider = Objects.requireNonNull(clientProvider, "clientProvider");
+ this.localEndpointAddress = Objects.requireNonNull(localEndpointAddress, "localEndpointAddress");
}
protected final String toSearchParameter(Identifier identifier)
diff --git a/dsf-bpe/dsf-bpe-process-api-v1-impl/src/main/java/dev/dsf/bpe/v1/service/FhirWebserviceClientProviderImpl.java b/dsf-bpe/dsf-bpe-process-api-v1-impl/src/main/java/dev/dsf/bpe/v1/service/FhirWebserviceClientProviderImpl.java
index 9ffaad377..ccb7f85f4 100644
--- a/dsf-bpe/dsf-bpe-process-api-v1-impl/src/main/java/dev/dsf/bpe/v1/service/FhirWebserviceClientProviderImpl.java
+++ b/dsf-bpe/dsf-bpe-process-api-v1-impl/src/main/java/dev/dsf/bpe/v1/service/FhirWebserviceClientProviderImpl.java
@@ -21,8 +21,6 @@
import java.util.Map;
import java.util.Objects;
-import org.springframework.beans.factory.InitializingBean;
-
import ca.uhn.fhir.context.FhirContext;
import dev.dsf.bpe.api.config.BpeProxyConfig;
import dev.dsf.bpe.api.service.BuildInfoProvider;
@@ -30,7 +28,7 @@
import dev.dsf.fhir.client.FhirWebserviceClientJersey;
import dev.dsf.fhir.service.ReferenceCleaner;
-public class FhirWebserviceClientProviderImpl implements FhirWebserviceClientProvider, InitializingBean
+public class FhirWebserviceClientProviderImpl implements FhirWebserviceClientProvider
{
private static final String USER_AGENT_VALUE = "DSF/";
@@ -55,47 +53,58 @@ public class FhirWebserviceClientProviderImpl implements FhirWebserviceClientPro
private final BpeProxyConfig proxyConfig;
private final BuildInfoProvider buildInfoProvider;
+ /**
+ * @param fhirContext
+ * not null
+ * @param referenceCleaner
+ * not null
+ * @param baseUrlLocal
+ * not null
+ * @param readTimeoutLocal
+ * not null, not negative, 0 represents infinity
+ * @param connectTimeoutLocal
+ * not null, not negative, 0 represents infinity
+ * @param logRequestsAndResponsesLocal
+ * @param trustStore
+ * not null
+ * @param keyStore
+ * not null
+ * @param keyStorePassword
+ * not null
+ * @param readTimeoutRemote
+ * not null, not negative, 0 represents infinity
+ * @param connectTimeoutRemote
+ * not null, not negative, 0 represents infinity
+ * @param logRequestsAndResponsesRemote
+ * @param proxyConfig
+ * not null
+ * @param buildInfoProvider
+ * not null
+ */
public FhirWebserviceClientProviderImpl(FhirContext fhirContext, ReferenceCleaner referenceCleaner,
String baseUrlLocal, Duration readTimeoutLocal, Duration connectTimeoutLocal,
boolean logRequestsAndResponsesLocal, KeyStore trustStore, KeyStore keyStore, char[] keyStorePassword,
Duration readTimeoutRemote, Duration connectTimeoutRemote, boolean logRequestsAndResponsesRemote,
BpeProxyConfig proxyConfig, BuildInfoProvider buildInfoProvider)
{
- this.fhirContext = fhirContext;
- this.referenceCleaner = referenceCleaner;
+ this.fhirContext = Objects.requireNonNull(fhirContext, "fhirContext");
+ this.referenceCleaner = Objects.requireNonNull(referenceCleaner, "referenceCleaner");
- this.baseUrlLocal = baseUrlLocal;
- this.readTimeoutLocal = readTimeoutLocal;
- this.connectTimeoutLocal = connectTimeoutLocal;
+ this.baseUrlLocal = Objects.requireNonNull(baseUrlLocal, "baseUrlLocal");
+ this.readTimeoutLocal = Objects.requireNonNull(readTimeoutLocal, "readTimeoutLocal");
+ this.connectTimeoutLocal = Objects.requireNonNull(connectTimeoutLocal, "connectTimeoutLocal");
this.logRequestsAndResponsesLocal = logRequestsAndResponsesLocal;
- this.trustStore = trustStore;
- this.keyStore = keyStore;
- this.keyStorePassword = keyStorePassword;
+ this.trustStore = Objects.requireNonNull(trustStore, "trustStore");
+ this.keyStore = Objects.requireNonNull(keyStore, "keyStore");
+ this.keyStorePassword = Objects.requireNonNull(keyStorePassword, "keyStorePassword");
- this.readTimeoutRemote = readTimeoutRemote;
- this.connectTimeoutRemote = connectTimeoutRemote;
+ this.readTimeoutRemote = Objects.requireNonNull(readTimeoutRemote, "readTimeoutRemote");
+ this.connectTimeoutRemote = Objects.requireNonNull(connectTimeoutRemote, "connectTimeoutRemote");
this.logRequestsAndResponsesRemote = logRequestsAndResponsesRemote;
- this.proxyConfig = proxyConfig;
- this.buildInfoProvider = buildInfoProvider;
- }
-
- @Override
- public void afterPropertiesSet() throws Exception
- {
- Objects.requireNonNull(fhirContext, "fhirContext");
- Objects.requireNonNull(referenceCleaner, "referenceCleaner");
- Objects.requireNonNull(baseUrlLocal, "baseUrlLocal");
- Objects.requireNonNull(readTimeoutLocal, "readTimeoutLocal");
- Objects.requireNonNull(connectTimeoutLocal, "connectTimeoutLocal");
- Objects.requireNonNull(trustStore, "trustStore");
- Objects.requireNonNull(keyStore, "keyStore");
- Objects.requireNonNull(keyStorePassword, "keyStorePassword");
- Objects.requireNonNull(readTimeoutRemote, "readTimeoutRemote");
- Objects.requireNonNull(connectTimeoutRemote, "connectTimeoutRemote");
- Objects.requireNonNull(proxyConfig, "proxyConfig");
- Objects.requireNonNull(buildInfoProvider, "buildInfoReader");
+ this.proxyConfig = Objects.requireNonNull(proxyConfig, "proxyConfig");
+ this.buildInfoProvider = Objects.requireNonNull(buildInfoProvider, "buildInfoProvider");
}
public String getLocalBaseUrl()
diff --git a/dsf-bpe/dsf-bpe-process-api-v1-impl/src/main/java/dev/dsf/bpe/v1/service/MailServiceImpl.java b/dsf-bpe/dsf-bpe-process-api-v1-impl/src/main/java/dev/dsf/bpe/v1/service/MailServiceImpl.java
index a38c366ef..aa7bb54e1 100644
--- a/dsf-bpe/dsf-bpe-process-api-v1-impl/src/main/java/dev/dsf/bpe/v1/service/MailServiceImpl.java
+++ b/dsf-bpe/dsf-bpe-process-api-v1-impl/src/main/java/dev/dsf/bpe/v1/service/MailServiceImpl.java
@@ -21,23 +21,19 @@
import javax.mail.internet.MimeBodyPart;
import javax.mail.internet.MimeMessage;
-import org.springframework.beans.factory.InitializingBean;
-
import dev.dsf.bpe.api.service.BpeMailService;
-public class MailServiceImpl implements MailService, InitializingBean
+public class MailServiceImpl implements MailService
{
private final BpeMailService delegate;
+ /**
+ * @param delegate
+ * not null
+ */
public MailServiceImpl(BpeMailService delegate)
{
- this.delegate = delegate;
- }
-
- @Override
- public void afterPropertiesSet() throws Exception
- {
- Objects.requireNonNull(delegate, "delegate");
+ this.delegate = Objects.requireNonNull(delegate, "delegate");
}
@Override
diff --git a/dsf-bpe/dsf-bpe-process-api-v1-impl/src/main/java/dev/dsf/bpe/v1/variables/FhirResourceSerializer.java b/dsf-bpe/dsf-bpe-process-api-v1-impl/src/main/java/dev/dsf/bpe/v1/variables/FhirResourceSerializer.java
index 8aa5246a7..928c5543d 100644
--- a/dsf-bpe/dsf-bpe-process-api-v1-impl/src/main/java/dev/dsf/bpe/v1/variables/FhirResourceSerializer.java
+++ b/dsf-bpe/dsf-bpe-process-api-v1-impl/src/main/java/dev/dsf/bpe/v1/variables/FhirResourceSerializer.java
@@ -25,30 +25,27 @@
import org.operaton.bpm.engine.variable.impl.value.UntypedValueImpl;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.InitializingBean;
import ca.uhn.fhir.context.FhirContext;
import ca.uhn.fhir.parser.DataFormatException;
import ca.uhn.fhir.parser.IParser;
import dev.dsf.bpe.v1.variables.FhirResourceValues.FhirResourceValue;
-public class FhirResourceSerializer extends PrimitiveValueSerializer implements InitializingBean
+public class FhirResourceSerializer extends PrimitiveValueSerializer
{
private static final Logger logger = LoggerFactory.getLogger(FhirResourceSerializer.class);
private final FhirContext fhirContext;
+ /**
+ * @param fhirContext
+ * not null
+ */
public FhirResourceSerializer(FhirContext fhirContext)
{
super(FhirResourceValues.VALUE_TYPE);
- this.fhirContext = fhirContext;
- }
-
- @Override
- public void afterPropertiesSet() throws Exception
- {
- Objects.requireNonNull(fhirContext, "fhirContext");
+ this.fhirContext = Objects.requireNonNull(fhirContext, "fhirContext");
}
@Override
diff --git a/dsf-bpe/dsf-bpe-process-api-v1-impl/src/main/java/dev/dsf/bpe/v1/variables/FhirResourcesListSerializer.java b/dsf-bpe/dsf-bpe-process-api-v1-impl/src/main/java/dev/dsf/bpe/v1/variables/FhirResourcesListSerializer.java
index b7e8a2927..289496c0d 100644
--- a/dsf-bpe/dsf-bpe-process-api-v1-impl/src/main/java/dev/dsf/bpe/v1/variables/FhirResourcesListSerializer.java
+++ b/dsf-bpe/dsf-bpe-process-api-v1-impl/src/main/java/dev/dsf/bpe/v1/variables/FhirResourcesListSerializer.java
@@ -22,28 +22,24 @@
import org.operaton.bpm.engine.impl.variable.serializer.PrimitiveValueSerializer;
import org.operaton.bpm.engine.impl.variable.serializer.ValueFields;
import org.operaton.bpm.engine.variable.impl.value.UntypedValueImpl;
-import org.springframework.beans.factory.InitializingBean;
import com.fasterxml.jackson.databind.ObjectMapper;
import dev.dsf.bpe.v1.variables.FhirResourcesListValues.FhirResourcesListValue;
public class FhirResourcesListSerializer extends PrimitiveValueSerializer
- implements InitializingBean
{
private final ObjectMapper objectMapper;
+ /**
+ * @param objectMapper
+ * not null
+ */
public FhirResourcesListSerializer(ObjectMapper objectMapper)
{
super(FhirResourcesListValues.VALUE_TYPE);
- this.objectMapper = objectMapper;
- }
-
- @Override
- public void afterPropertiesSet() throws Exception
- {
- Objects.requireNonNull(objectMapper, "objectMapper");
+ this.objectMapper = Objects.requireNonNull(objectMapper, "objectMapper");
}
@Override
diff --git a/dsf-bpe/dsf-bpe-process-api-v1-impl/src/main/java/dev/dsf/bpe/v1/variables/TargetSerializer.java b/dsf-bpe/dsf-bpe-process-api-v1-impl/src/main/java/dev/dsf/bpe/v1/variables/TargetSerializer.java
index 9fad84ed2..ff204263c 100644
--- a/dsf-bpe/dsf-bpe-process-api-v1-impl/src/main/java/dev/dsf/bpe/v1/variables/TargetSerializer.java
+++ b/dsf-bpe/dsf-bpe-process-api-v1-impl/src/main/java/dev/dsf/bpe/v1/variables/TargetSerializer.java
@@ -21,28 +21,25 @@
import org.operaton.bpm.engine.impl.variable.serializer.PrimitiveValueSerializer;
import org.operaton.bpm.engine.impl.variable.serializer.ValueFields;
import org.operaton.bpm.engine.variable.impl.value.UntypedValueImpl;
-import org.springframework.beans.factory.InitializingBean;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import dev.dsf.bpe.v1.variables.TargetValues.TargetValue;
-public class TargetSerializer extends PrimitiveValueSerializer implements InitializingBean
+public class TargetSerializer extends PrimitiveValueSerializer
{
private final ObjectMapper objectMapper;
+ /**
+ * @param objectMapper
+ * not null
+ */
public TargetSerializer(ObjectMapper objectMapper)
{
super(TargetValues.VALUE_TYPE);
- this.objectMapper = objectMapper;
- }
-
- @Override
- public void afterPropertiesSet() throws Exception
- {
- Objects.requireNonNull(objectMapper, "objectMapper");
+ this.objectMapper = Objects.requireNonNull(objectMapper, "objectMapper");
}
@Override
diff --git a/dsf-bpe/dsf-bpe-process-api-v1-impl/src/main/java/dev/dsf/bpe/v1/variables/TargetsSerializer.java b/dsf-bpe/dsf-bpe-process-api-v1-impl/src/main/java/dev/dsf/bpe/v1/variables/TargetsSerializer.java
index ccd88dfc0..69099d34e 100644
--- a/dsf-bpe/dsf-bpe-process-api-v1-impl/src/main/java/dev/dsf/bpe/v1/variables/TargetsSerializer.java
+++ b/dsf-bpe/dsf-bpe-process-api-v1-impl/src/main/java/dev/dsf/bpe/v1/variables/TargetsSerializer.java
@@ -21,28 +21,25 @@
import org.operaton.bpm.engine.impl.variable.serializer.PrimitiveValueSerializer;
import org.operaton.bpm.engine.impl.variable.serializer.ValueFields;
import org.operaton.bpm.engine.variable.impl.value.UntypedValueImpl;
-import org.springframework.beans.factory.InitializingBean;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import dev.dsf.bpe.v1.variables.TargetsValues.TargetsValue;
-public class TargetsSerializer extends PrimitiveValueSerializer implements InitializingBean
+public class TargetsSerializer extends PrimitiveValueSerializer
{
private final ObjectMapper objectMapper;
+ /**
+ * @param objectMapper
+ * not null
+ */
public TargetsSerializer(ObjectMapper objectMapper)
{
super(TargetsValues.VALUE_TYPE);
- this.objectMapper = objectMapper;
- }
-
- @Override
- public void afterPropertiesSet() throws Exception
- {
- Objects.requireNonNull(objectMapper, "objectMapper");
+ this.objectMapper = Objects.requireNonNull(objectMapper, "objectMapper");
}
@Override
diff --git a/dsf-bpe/dsf-bpe-process-api-v1-impl/src/main/java/dev/dsf/fhir/client/AbstractJerseyClient.java b/dsf-bpe/dsf-bpe-process-api-v1-impl/src/main/java/dev/dsf/fhir/client/AbstractJerseyClient.java
index 135bff724..be9437587 100644
--- a/dsf-bpe/dsf-bpe-process-api-v1-impl/src/main/java/dev/dsf/fhir/client/AbstractJerseyClient.java
+++ b/dsf-bpe/dsf-bpe-process-api-v1-impl/src/main/java/dev/dsf/fhir/client/AbstractJerseyClient.java
@@ -52,6 +52,20 @@ public class AbstractJerseyClient
private final Client client;
private final String baseUrl;
+ /**
+ * @param baseUrl
+ * not null
+ * @param trustStore
+ * may be null
+ * @param keyStore
+ * may be null
+ * @param keyStorePassword
+ * may be null
+ * @param objectMapper
+ * may be null
+ * @param componentsToRegister
+ * may be null
+ */
public AbstractJerseyClient(String baseUrl, KeyStore trustStore, KeyStore keyStore, char[] keyStorePassword,
ObjectMapper objectMapper, Collection> componentsToRegister)
{
@@ -59,6 +73,33 @@ public AbstractJerseyClient(String baseUrl, KeyStore trustStore, KeyStore keySto
Duration.ZERO, Duration.ZERO, false, null);
}
+ /**
+ * @param baseUrl
+ * not null
+ * @param trustStore
+ * may be null
+ * @param keyStore
+ * may be null
+ * @param keyStorePassword
+ * may be null
+ * @param objectMapper
+ * may be null
+ * @param componentsToRegister
+ * may be null
+ * @param proxySchemeHostPort
+ * may be null
+ * @param proxyUserName
+ * may be null
+ * @param proxyPassword
+ * may be null
+ * @param connectTimeout
+ * not null, not negative, 0 represents infinity
+ * @param readTimeout
+ * not null, not negative, 0 represents infinity
+ * @param logRequestsAndResponses
+ * @param userAgentValue
+ * may be null
+ */
public AbstractJerseyClient(String baseUrl, KeyStore trustStore, KeyStore keyStore, char[] keyStorePassword,
ObjectMapper objectMapper, Collection> componentsToRegister, String proxySchemeHostPort,
String proxyUserName, char[] proxyPassword, Duration connectTimeout, Duration readTimeout,
diff --git a/dsf-bpe/dsf-bpe-process-api-v1-impl/src/main/java/dev/dsf/fhir/client/FhirWebserviceClientJersey.java b/dsf-bpe/dsf-bpe-process-api-v1-impl/src/main/java/dev/dsf/fhir/client/FhirWebserviceClientJersey.java
index f25ede027..d50e8a6b2 100644
--- a/dsf-bpe/dsf-bpe-process-api-v1-impl/src/main/java/dev/dsf/fhir/client/FhirWebserviceClientJersey.java
+++ b/dsf-bpe/dsf-bpe-process-api-v1-impl/src/main/java/dev/dsf/fhir/client/FhirWebserviceClientJersey.java
@@ -29,7 +29,6 @@
import java.util.stream.Collectors;
import java.util.stream.Stream;
-import org.apache.commons.lang3.StringUtils;
import org.hl7.fhir.r4.model.Binary;
import org.hl7.fhir.r4.model.Bundle;
import org.hl7.fhir.r4.model.CapabilityStatement;
@@ -89,6 +88,35 @@ private static Class> getFhirClass(ResourceType type)
private final PreferReturnMinimalWithRetry preferReturnMinimal;
private final PreferReturnOutcomeWithRetry preferReturnOutcome;
+ /**
+ * @param baseUrl
+ * not null
+ * @param trustStore
+ * may be null
+ * @param keyStore
+ * may be null
+ * @param keyStorePassword
+ * may be null
+ * @param objectMapper
+ * may be null
+ * @param proxySchemeHostPort
+ * may be null
+ * @param proxyUserName
+ * may be null
+ * @param proxyPassword
+ * may be null
+ * @param connectTimeout
+ * not null, not negative, 0 represents infinity
+ * @param readTimeout
+ * not null, not negative, 0 represents infinity
+ * @param logRequestsAndResponses
+ * @param userAgentValue
+ * may be null
+ * @param fhirContext
+ * not null
+ * @param referenceCleaner
+ * not null
+ */
public FhirWebserviceClientJersey(String baseUrl, KeyStore trustStore, KeyStore keyStore, char[] keyStorePassword,
ObjectMapper objectMapper, String proxySchemeHostPort, String proxyUserName, char[] proxyPassword,
Duration connectTimeout, Duration readTimeout, boolean logRequestsAndResponses, String userAgentValue,
@@ -767,7 +795,7 @@ public Bundle history(Class extends Resource> resourceType, String id, int pag
if (resourceType != null)
target = target.path(resourceType.getAnnotation(ResourceDef.class).name());
- if (!StringUtils.isBlank(id))
+ if (id != null && !id.isBlank())
target = target.path(id);
if (page != Integer.MIN_VALUE)
diff --git a/dsf-bpe/dsf-bpe-process-api-v1-impl/src/main/java/dev/dsf/fhir/service/ReferenceCleanerImpl.java b/dsf-bpe/dsf-bpe-process-api-v1-impl/src/main/java/dev/dsf/fhir/service/ReferenceCleanerImpl.java
index 40592c058..2206ff6f1 100644
--- a/dsf-bpe/dsf-bpe-process-api-v1-impl/src/main/java/dev/dsf/fhir/service/ReferenceCleanerImpl.java
+++ b/dsf-bpe/dsf-bpe-process-api-v1-impl/src/main/java/dev/dsf/fhir/service/ReferenceCleanerImpl.java
@@ -25,23 +25,20 @@
import org.hl7.fhir.r4.model.Resource;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.InitializingBean;
-public class ReferenceCleanerImpl implements ReferenceCleaner, InitializingBean
+public class ReferenceCleanerImpl implements ReferenceCleaner
{
private static final Logger logger = LoggerFactory.getLogger(ReferenceCleanerImpl.class);
private final ReferenceExtractor referenceExtractor;
+ /**
+ * @param referenceExtractor
+ * not null
+ */
public ReferenceCleanerImpl(ReferenceExtractor referenceExtractor)
{
- this.referenceExtractor = referenceExtractor;
- }
-
- @Override
- public void afterPropertiesSet() throws Exception
- {
- Objects.requireNonNull(referenceExtractor, "referenceExtractor");
+ this.referenceExtractor = Objects.requireNonNull(referenceExtractor, "referenceExtractor");
}
@Override
diff --git a/dsf-bpe/dsf-bpe-process-api-v1-operaton/src/main/java/dev/dsf/bpe/v1/activity/AbstractTaskMessageSend.java b/dsf-bpe/dsf-bpe-process-api-v1-operaton/src/main/java/dev/dsf/bpe/v1/activity/AbstractTaskMessageSend.java
index dfe03d0e3..b129cbab3 100644
--- a/dsf-bpe/dsf-bpe-process-api-v1-operaton/src/main/java/dev/dsf/bpe/v1/activity/AbstractTaskMessageSend.java
+++ b/dsf-bpe/dsf-bpe-process-api-v1-operaton/src/main/java/dev/dsf/bpe/v1/activity/AbstractTaskMessageSend.java
@@ -40,7 +40,6 @@
import org.operaton.bpm.model.bpmn.instance.SendTask;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.InitializingBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@@ -75,7 +74,7 @@
*
* @see ProcessPluginDefinition#getSpringConfigurations()
*/
-public abstract class AbstractTaskMessageSend implements JavaDelegate, InitializingBean
+public abstract class AbstractTaskMessageSend implements JavaDelegate
{
private static final Logger logger = LoggerFactory.getLogger(AbstractTaskMessageSend.class);
@@ -92,13 +91,7 @@ public abstract class AbstractTaskMessageSend implements JavaDelegate, Initializ
*/
public AbstractTaskMessageSend(ProcessPluginApi api)
{
- this.api = api;
- }
-
- @Override
- public void afterPropertiesSet() throws Exception
- {
- Objects.requireNonNull(api, "api");
+ this.api = Objects.requireNonNull(api, "api");
}
/**
@@ -390,7 +383,7 @@ protected Stream getAdditionalInputParameters(DelegateExecut
* Stream<ParameterComponent> additionalInputParameters)
* {
* String alternativeBusinesKey = createAndSaveAlternativeBusinessKey();
- * super.sendTask(execution, target, instantiatesUri, messageName, alternativeBusinesKey, profile,
+ * super.sendTask(execution, target, instantiatesCanonical, messageName, alternativeBusinesKey, profile,
* additionalInputParameters);
* }
*
diff --git a/dsf-bpe/dsf-bpe-process-api-v1-operaton/src/main/java/dev/dsf/bpe/v1/activity/DefaultUserTaskListener.java b/dsf-bpe/dsf-bpe-process-api-v1-operaton/src/main/java/dev/dsf/bpe/v1/activity/DefaultUserTaskListener.java
index 04b9c7e49..c30e08a20 100644
--- a/dsf-bpe/dsf-bpe-process-api-v1-operaton/src/main/java/dev/dsf/bpe/v1/activity/DefaultUserTaskListener.java
+++ b/dsf-bpe/dsf-bpe-process-api-v1-operaton/src/main/java/dev/dsf/bpe/v1/activity/DefaultUserTaskListener.java
@@ -37,7 +37,6 @@
import org.operaton.bpm.engine.delegate.TaskListener;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.InitializingBean;
import org.springframework.context.annotation.Bean;
import dev.dsf.bpe.v1.ProcessPluginApi;
@@ -56,7 +55,7 @@
* {@link QuestionnaireResponse}, extend this class, register it as a prototype {@link Bean} and specify the class name
* as a task listener with event type 'create' in the BPMN.
*/
-public class DefaultUserTaskListener implements TaskListener, InitializingBean
+public class DefaultUserTaskListener implements TaskListener
{
private static final Logger logger = LoggerFactory.getLogger(DefaultUserTaskListener.class);
@@ -68,13 +67,7 @@ public class DefaultUserTaskListener implements TaskListener, InitializingBean
*/
public DefaultUserTaskListener(ProcessPluginApi api)
{
- this.api = api;
- }
-
- @Override
- public void afterPropertiesSet() throws Exception
- {
- Objects.requireNonNull(api, "api");
+ this.api = Objects.requireNonNull(api, "api");
}
@Override
diff --git a/dsf-bpe/dsf-bpe-process-api-v1/src/main/java/dev/dsf/bpe/v1/activity/AbstractTaskMessageSend.java b/dsf-bpe/dsf-bpe-process-api-v1/src/main/java/dev/dsf/bpe/v1/activity/AbstractTaskMessageSend.java
index 7d562b8d9..fc2b3a598 100644
--- a/dsf-bpe/dsf-bpe-process-api-v1/src/main/java/dev/dsf/bpe/v1/activity/AbstractTaskMessageSend.java
+++ b/dsf-bpe/dsf-bpe-process-api-v1/src/main/java/dev/dsf/bpe/v1/activity/AbstractTaskMessageSend.java
@@ -390,7 +390,7 @@ protected Stream getAdditionalInputParameters(DelegateExecut
* Stream<ParameterComponent> additionalInputParameters)
* {
* String alternativeBusinesKey = createAndSaveAlternativeBusinessKey();
- * super.sendTask(execution, target, instantiatesUri, messageName, alternativeBusinesKey, profile,
+ * super.sendTask(execution, target, instantiatesCanonical, messageName, alternativeBusinesKey, profile,
* additionalInputParameters);
* }
*
diff --git a/dsf-bpe/dsf-bpe-process-api-v2-impl/src/main/java/dev/dsf/bpe/v2/ProcessPluginApiImpl.java b/dsf-bpe/dsf-bpe-process-api-v2-impl/src/main/java/dev/dsf/bpe/v2/ProcessPluginApiImpl.java
index 62d20f43a..0d8971682 100644
--- a/dsf-bpe/dsf-bpe-process-api-v2-impl/src/main/java/dev/dsf/bpe/v2/ProcessPluginApiImpl.java
+++ b/dsf-bpe/dsf-bpe-process-api-v2-impl/src/main/java/dev/dsf/bpe/v2/ProcessPluginApiImpl.java
@@ -17,8 +17,6 @@
import java.util.Objects;
-import org.springframework.beans.factory.InitializingBean;
-
import com.fasterxml.jackson.databind.ObjectMapper;
import ca.uhn.fhir.context.FhirContext;
@@ -41,7 +39,7 @@
import dev.dsf.bpe.v2.service.ValidationServiceProvider;
import dev.dsf.bpe.v2.service.process.ProcessAuthorizationHelper;
-public class ProcessPluginApiImpl implements ProcessPluginApi, InitializingBean
+public class ProcessPluginApiImpl implements ProcessPluginApi
{
private final ProcessPluginDefinition processPluginDefinition;
private final ProxyConfig proxyConfig;
@@ -65,6 +63,50 @@ public class ProcessPluginApiImpl implements ProcessPluginApi, InitializingBean
private final DataLogger dataLogger;
private final ValidationServiceProvider validationServiceProvider;
+ /**
+ * @param processPluginDefinition
+ * not null
+ * @param proxyConfig
+ * not null
+ * @param endpointProvider
+ * not null
+ * @param fhirContext
+ * not null
+ * @param dsfClientProvider
+ * not null
+ * @param fhirClientProvider
+ * not null
+ * @param fhirClientConfigProvider
+ * not null
+ * @param oidcClientProvider
+ * not null
+ * @param mailService
+ * not null
+ * @param mimeTypeService
+ * not null
+ * @param objectMapper
+ * not null
+ * @param organizationProvider
+ * not null
+ * @param processAuthorizationHelper
+ * not null
+ * @param questionnaireResponseHelper
+ * not null
+ * @param readAccessHelper
+ * not null
+ * @param taskHelper
+ * not null
+ * @param compressionService
+ * not null
+ * @param cryptoService
+ * not null
+ * @param targetProvider
+ * not null
+ * @param dataLogger
+ * not null
+ * @param validationServiceProvider
+ * not nullO
+ */
public ProcessPluginApiImpl(ProcessPluginDefinition processPluginDefinition, ProxyConfig proxyConfig,
EndpointProvider endpointProvider, FhirContext fhirContext, DsfClientProvider dsfClientProvider,
FhirClientProvider fhirClientProvider, ClientConfigProvider fhirClientConfigProvider,
@@ -75,53 +117,28 @@ public ProcessPluginApiImpl(ProcessPluginDefinition processPluginDefinition, Pro
TaskHelper taskHelper, CompressionService compressionService, CryptoService cryptoService,
TargetProvider targetProvider, DataLogger dataLogger, ValidationServiceProvider validationServiceProvider)
{
- this.processPluginDefinition = processPluginDefinition;
- this.proxyConfig = proxyConfig;
- this.endpointProvider = endpointProvider;
- this.fhirContext = fhirContext;
- this.dsfClientProvider = dsfClientProvider;
- this.fhirClientProvider = fhirClientProvider;
- this.fhirClientConfigProvider = fhirClientConfigProvider;
- this.oidcClientProvider = oidcClientProvider;
- this.mailService = mailService;
- this.mimeTypeService = mimeTypeService;
- this.objectMapper = objectMapper;
- this.organizationProvider = organizationProvider;
- this.processAuthorizationHelper = processAuthorizationHelper;
+ this.processPluginDefinition = Objects.requireNonNull(processPluginDefinition, "processPluginDefinition");
+ this.proxyConfig = Objects.requireNonNull(proxyConfig, "proxyConfig");
+ this.endpointProvider = Objects.requireNonNull(endpointProvider, "endpointProvider");
+ this.fhirContext = Objects.requireNonNull(fhirContext, "fhirContext");
+ this.dsfClientProvider = Objects.requireNonNull(dsfClientProvider, "dsfClientProvider");
+ this.fhirClientProvider = Objects.requireNonNull(fhirClientProvider, "fhirClientProvider");
+ this.fhirClientConfigProvider = Objects.requireNonNull(fhirClientConfigProvider, "fhirClientConfigProvider");
+ this.oidcClientProvider = Objects.requireNonNull(oidcClientProvider, "oidcClientProvider");
+ this.mailService = Objects.requireNonNull(mailService, "mailService");
+ this.mimeTypeService = Objects.requireNonNull(mimeTypeService, "mimeTypeService");
+ this.objectMapper = Objects.requireNonNull(objectMapper, "objectMapper");
+ this.organizationProvider = Objects.requireNonNull(organizationProvider, "organizationProvider");
+ this.processAuthorizationHelper = Objects.requireNonNull(processAuthorizationHelper,
+ "processAuthorizationHelper");
this.questionnaireResponseHelper = questionnaireResponseHelper;
- this.readAccessHelper = readAccessHelper;
- this.taskHelper = taskHelper;
- this.compressionService = compressionService;
- this.cryptoService = cryptoService;
- this.targetProvider = targetProvider;
- this.dataLogger = dataLogger;
- this.validationServiceProvider = validationServiceProvider;
- }
-
- @Override
- public void afterPropertiesSet() throws Exception
- {
- Objects.requireNonNull(processPluginDefinition, "processPluginDefinition");
- Objects.requireNonNull(proxyConfig, "proxyConfig");
- Objects.requireNonNull(endpointProvider, "endpointProvider");
- Objects.requireNonNull(fhirContext, "fhirContext");
- Objects.requireNonNull(dsfClientProvider, "dsfClientProvider");
- Objects.requireNonNull(fhirClientProvider, "fhirClientProvider");
- Objects.requireNonNull(fhirClientConfigProvider, "fhirClientConfigProvider");
- Objects.requireNonNull(oidcClientProvider, "oidcClientProvider");
- Objects.requireNonNull(mailService, "mailService");
- Objects.requireNonNull(mimeTypeService, "mimeTypeService");
- Objects.requireNonNull(objectMapper, "objectMapper");
- Objects.requireNonNull(organizationProvider, "organizationProvider");
- Objects.requireNonNull(processAuthorizationHelper, "processAuthorizationHelper");
- Objects.requireNonNull(questionnaireResponseHelper, "questionnaireResponseHelper");
- Objects.requireNonNull(readAccessHelper, "readAccessHelper");
- Objects.requireNonNull(taskHelper, "taskHelper");
- Objects.requireNonNull(compressionService, "compressionService");
- Objects.requireNonNull(cryptoService, "cryptoService");
- Objects.requireNonNull(targetProvider, "targetProvider");
- Objects.requireNonNull(dataLogger, "dataLogger");
- Objects.requireNonNull(validationServiceProvider, "validationServiceProvider");
+ this.readAccessHelper = Objects.requireNonNull(readAccessHelper, "readAccessHelper");
+ this.taskHelper = Objects.requireNonNull(taskHelper, "taskHelper");
+ this.compressionService = Objects.requireNonNull(compressionService, "compressionService");
+ this.cryptoService = Objects.requireNonNull(cryptoService, "cryptoService");
+ this.targetProvider = Objects.requireNonNull(targetProvider, "targetProvider");
+ this.dataLogger = Objects.requireNonNull(dataLogger, "dataLogger");
+ this.validationServiceProvider = Objects.requireNonNull(validationServiceProvider, "validationServiceProvider");
}
@Override
diff --git a/dsf-bpe/dsf-bpe-process-api-v2-impl/src/main/java/dev/dsf/bpe/v2/client/dsf/DsfClientJersey.java b/dsf-bpe/dsf-bpe-process-api-v2-impl/src/main/java/dev/dsf/bpe/v2/client/dsf/DsfClientJersey.java
index e678e05e2..0cc03caed 100644
--- a/dsf-bpe/dsf-bpe-process-api-v2-impl/src/main/java/dev/dsf/bpe/v2/client/dsf/DsfClientJersey.java
+++ b/dsf-bpe/dsf-bpe-process-api-v2-impl/src/main/java/dev/dsf/bpe/v2/client/dsf/DsfClientJersey.java
@@ -45,7 +45,6 @@
import javax.net.ssl.SSLContext;
-import org.apache.commons.lang3.StringUtils;
import org.glassfish.jersey.SslConfigurator;
import org.glassfish.jersey.apache5.connector.Apache5ConnectorProvider;
import org.glassfish.jersey.client.ClientConfig;
@@ -1406,7 +1405,7 @@ public Bundle history(Class extends Resource> resourceType, String id, int pag
if (resourceType != null)
target = target.path(resourceType.getAnnotation(ResourceDef.class).name());
- if (!StringUtils.isBlank(id))
+ if (id != null && !id.isBlank())
target = target.path(id);
if (page != Integer.MIN_VALUE)
diff --git a/dsf-bpe/dsf-bpe-process-api-v2-impl/src/main/java/dev/dsf/bpe/v2/client/dsf/ReferenceCleanerImpl.java b/dsf-bpe/dsf-bpe-process-api-v2-impl/src/main/java/dev/dsf/bpe/v2/client/dsf/ReferenceCleanerImpl.java
index 524487d0f..feae4b43a 100644
--- a/dsf-bpe/dsf-bpe-process-api-v2-impl/src/main/java/dev/dsf/bpe/v2/client/dsf/ReferenceCleanerImpl.java
+++ b/dsf-bpe/dsf-bpe-process-api-v2-impl/src/main/java/dev/dsf/bpe/v2/client/dsf/ReferenceCleanerImpl.java
@@ -25,23 +25,20 @@
import org.hl7.fhir.r4.model.Resource;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.InitializingBean;
-public class ReferenceCleanerImpl implements ReferenceCleaner, InitializingBean
+public class ReferenceCleanerImpl implements ReferenceCleaner
{
private static final Logger logger = LoggerFactory.getLogger(ReferenceCleanerImpl.class);
private final ReferenceExtractor referenceExtractor;
+ /**
+ * @param referenceExtractor
+ * not null
+ */
public ReferenceCleanerImpl(ReferenceExtractor referenceExtractor)
{
- this.referenceExtractor = referenceExtractor;
- }
-
- @Override
- public void afterPropertiesSet() throws Exception
- {
- Objects.requireNonNull(referenceExtractor, "referenceExtractor");
+ this.referenceExtractor = Objects.requireNonNull(referenceExtractor, "referenceExtractor");
}
@Override
diff --git a/dsf-bpe/dsf-bpe-process-api-v2-impl/src/main/java/dev/dsf/bpe/v2/listener/AbstractListener.java b/dsf-bpe/dsf-bpe-process-api-v2-impl/src/main/java/dev/dsf/bpe/v2/listener/AbstractListener.java
index 0db72fcce..137a266a6 100644
--- a/dsf-bpe/dsf-bpe-process-api-v2-impl/src/main/java/dev/dsf/bpe/v2/listener/AbstractListener.java
+++ b/dsf-bpe/dsf-bpe-process-api-v2-impl/src/main/java/dev/dsf/bpe/v2/listener/AbstractListener.java
@@ -28,24 +28,22 @@
import org.hl7.fhir.r4.model.Task.ParameterComponent;
import org.operaton.bpm.engine.delegate.DelegateExecution;
import org.operaton.bpm.engine.delegate.ExecutionListener;
-import org.springframework.beans.factory.InitializingBean;
-public abstract class AbstractListener implements ExecutionListener, InitializingBean
+public abstract class AbstractListener implements ExecutionListener
{
private final String serverBaseUrl;
private final Function variablesFactory;
+ /**
+ * @param serverBaseUrl
+ * not null
+ * @param variablesFactory
+ * not null
+ */
public AbstractListener(String serverBaseUrl, Function variablesFactory)
{
- this.serverBaseUrl = serverBaseUrl;
- this.variablesFactory = variablesFactory;
- }
-
- @Override
- public void afterPropertiesSet() throws Exception
- {
- Objects.requireNonNull(serverBaseUrl, "serverBaseUrl");
- Objects.requireNonNull(variablesFactory, "variablesFactory");
+ this.serverBaseUrl = Objects.requireNonNull(serverBaseUrl, "serverBaseUrl");
+ this.variablesFactory = Objects.requireNonNull(variablesFactory, "variablesFactory");
}
@Override
diff --git a/dsf-bpe/dsf-bpe-process-api-v2-impl/src/main/java/dev/dsf/bpe/v2/listener/EndListener.java b/dsf-bpe/dsf-bpe-process-api-v2-impl/src/main/java/dev/dsf/bpe/v2/listener/EndListener.java
index 87039edc7..6c341d1bc 100644
--- a/dsf-bpe/dsf-bpe-process-api-v2-impl/src/main/java/dev/dsf/bpe/v2/listener/EndListener.java
+++ b/dsf-bpe/dsf-bpe-process-api-v2-impl/src/main/java/dev/dsf/bpe/v2/listener/EndListener.java
@@ -35,20 +35,20 @@ public class EndListener extends AbstractListener implements ExecutionListener
private final DsfClientProvider dsfClientProvider;
+ /**
+ * @param serverBaseUrl
+ * not null
+ * @param variablesFactory
+ * not null
+ * @param dsfClientProvider
+ * not null
+ */
public EndListener(String serverBaseUrl, Function variablesFactory,
DsfClientProvider dsfClientProvider)
{
super(serverBaseUrl, variablesFactory);
- this.dsfClientProvider = dsfClientProvider;
- }
-
- @Override
- public void afterPropertiesSet() throws Exception
- {
- super.afterPropertiesSet();
-
- Objects.requireNonNull(dsfClientProvider, "dsfClientProvider");
+ this.dsfClientProvider = Objects.requireNonNull(dsfClientProvider, "dsfClientProvider");
}
@Override
diff --git a/dsf-bpe/dsf-bpe-process-api-v2-impl/src/main/java/dev/dsf/bpe/v2/service/AbstractResourceProvider.java b/dsf-bpe/dsf-bpe-process-api-v2-impl/src/main/java/dev/dsf/bpe/v2/service/AbstractResourceProvider.java
index 9de0fc429..6868a99a5 100644
--- a/dsf-bpe/dsf-bpe-process-api-v2-impl/src/main/java/dev/dsf/bpe/v2/service/AbstractResourceProvider.java
+++ b/dsf-bpe/dsf-bpe-process-api-v2-impl/src/main/java/dev/dsf/bpe/v2/service/AbstractResourceProvider.java
@@ -33,26 +33,24 @@
import org.hl7.fhir.r4.model.Coding;
import org.hl7.fhir.r4.model.Identifier;
import org.hl7.fhir.r4.model.Resource;
-import org.springframework.beans.factory.InitializingBean;
import dev.dsf.bpe.v2.client.dsf.DsfClient;
-public abstract class AbstractResourceProvider implements InitializingBean
+public abstract class AbstractResourceProvider
{
protected final Supplier localDsfClient;
protected final String localEndpointAddress;
+ /**
+ * @param localDsfClient
+ * not null
+ * @param localEndpointAddress
+ * not null
+ */
public AbstractResourceProvider(Supplier localDsfClient, String localEndpointAddress)
{
- this.localDsfClient = localDsfClient;
- this.localEndpointAddress = localEndpointAddress;
- }
-
- @Override
- public void afterPropertiesSet() throws Exception
- {
- Objects.requireNonNull(localDsfClient, "localDsfClient");
- Objects.requireNonNull(localEndpointAddress, "localEndpointAddress");
+ this.localDsfClient = Objects.requireNonNull(localDsfClient, "localDsfClient");
+ this.localEndpointAddress = Objects.requireNonNull(localEndpointAddress, "localEndpointAddress");
}
protected final String toSearchParameter(Identifier identifier)
diff --git a/dsf-bpe/dsf-bpe-process-api-v2-impl/src/main/java/dev/dsf/bpe/v2/service/ClientConfigProviderImpl.java b/dsf-bpe/dsf-bpe-process-api-v2-impl/src/main/java/dev/dsf/bpe/v2/service/ClientConfigProviderImpl.java
index 7a35c7dee..f735a5a08 100644
--- a/dsf-bpe/dsf-bpe-process-api-v2-impl/src/main/java/dev/dsf/bpe/v2/service/ClientConfigProviderImpl.java
+++ b/dsf-bpe/dsf-bpe-process-api-v2-impl/src/main/java/dev/dsf/bpe/v2/service/ClientConfigProviderImpl.java
@@ -34,32 +34,30 @@
import javax.net.ssl.SSLContext;
-import org.springframework.beans.factory.InitializingBean;
-
import de.hsheilbronn.mi.utils.crypto.context.SSLContextFactory;
import dev.dsf.bpe.v2.client.fhir.ClientConfig;
import dev.dsf.bpe.v2.client.fhir.ClientConfigs;
-public class ClientConfigProviderImpl implements ClientConfigProvider, InitializingBean
+public class ClientConfigProviderImpl implements ClientConfigProvider
{
private final Map clientConfigsByFhirServerId = new HashMap<>();
private final KeyStore defaultTrustStore;
+ /**
+ * @param defaultTrustStore
+ * not null
+ * @param clientConfigs
+ * may be null
+ */
public ClientConfigProviderImpl(KeyStore defaultTrustStore, ClientConfigs clientConfigs)
{
- this.defaultTrustStore = defaultTrustStore;
+ this.defaultTrustStore = Objects.requireNonNull(defaultTrustStore, "defaultTrustStore");
if (clientConfigs != null)
clientConfigsByFhirServerId.putAll(clientConfigs.getConfigs().stream()
.collect(Collectors.toMap(ClientConfig::getFhirServerId, Function.identity())));
}
- @Override
- public void afterPropertiesSet() throws Exception
- {
- Objects.requireNonNull(defaultTrustStore, "defaultTrustStore");
- }
-
@Override
public SSLContext createDefaultSslContext()
{
diff --git a/dsf-bpe/dsf-bpe-process-api-v2-impl/src/main/java/dev/dsf/bpe/v2/service/CompressionServiceImpl.java b/dsf-bpe/dsf-bpe-process-api-v2-impl/src/main/java/dev/dsf/bpe/v2/service/CompressionServiceImpl.java
index f00b8e3c8..49d57bddd 100644
--- a/dsf-bpe/dsf-bpe-process-api-v2-impl/src/main/java/dev/dsf/bpe/v2/service/CompressionServiceImpl.java
+++ b/dsf-bpe/dsf-bpe-process-api-v2-impl/src/main/java/dev/dsf/bpe/v2/service/CompressionServiceImpl.java
@@ -92,7 +92,8 @@ private InputStream to(InputStream in, Compressor compressor) throws IOException
PipedInputStream pipedIn = new PipedInputStream(pipedOut, BUFFER_SIZE);
List capturedExceptions = new ArrayList<>();
- Thread worker = new Thread(() ->
+
+ Thread.ofPlatform().name("compressor-pipe-deamon").daemon().start(() ->
{
try (in; OutputStream out = compressor.withCompression(pipedOut))
{
@@ -106,8 +107,6 @@ private InputStream to(InputStream in, Compressor compressor) throws IOException
capturedExceptions.add(e);
}
});
- worker.setDaemon(true);
- worker.start();
if (!capturedExceptions.isEmpty())
{
diff --git a/dsf-bpe/dsf-bpe-process-api-v2-impl/src/main/java/dev/dsf/bpe/v2/service/DsfClientProviderImpl.java b/dsf-bpe/dsf-bpe-process-api-v2-impl/src/main/java/dev/dsf/bpe/v2/service/DsfClientProviderImpl.java
index a22df0f38..74e811090 100644
--- a/dsf-bpe/dsf-bpe-process-api-v2-impl/src/main/java/dev/dsf/bpe/v2/service/DsfClientProviderImpl.java
+++ b/dsf-bpe/dsf-bpe-process-api-v2-impl/src/main/java/dev/dsf/bpe/v2/service/DsfClientProviderImpl.java
@@ -26,7 +26,6 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.DisposableBean;
-import org.springframework.beans.factory.InitializingBean;
import ca.uhn.fhir.context.FhirContext;
import dev.dsf.bpe.api.config.BpeProxyConfig;
@@ -37,7 +36,7 @@
import dev.dsf.bpe.v2.client.dsf.ReferenceCleaner;
import dev.dsf.bpe.v2.client.fhir.ClientConfig;
-public class DsfClientProviderImpl implements DsfClientProvider, InitializingBean, DisposableBean
+public class DsfClientProviderImpl implements DsfClientProvider, DisposableBean
{
private static final Logger logger = LoggerFactory.getLogger(DsfClientProviderImpl.class);
@@ -52,31 +51,35 @@ public class DsfClientProviderImpl implements DsfClientProvider, InitializingBea
private final ClientConfigProvider configProvider;
private final ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(8,
- r -> new Thread(r, "dsf-client-async-scheduler"));
-
+ Thread.ofPlatform().name("dsf-client-async-scheduler-", 0).factory());
+
+ /**
+ * @param fhirContext
+ * not null
+ * @param referenceCleaner
+ * not null
+ * @param dsfClientConfig
+ * not null
+ * @param proxyConfig
+ * not null
+ * @param oidcClientProvider
+ * not null
+ * @param userAgent
+ * not null
+ * @param configProvider
+ * not null
+ */
public DsfClientProviderImpl(FhirContext fhirContext, ReferenceCleaner referenceCleaner,
DsfClientConfig dsfClientConfig, BpeProxyConfig proxyConfig, OidcClientProvider oidcClientProvider,
String userAgent, ClientConfigProvider configProvider)
{
- this.fhirContext = fhirContext;
- this.referenceCleaner = referenceCleaner;
- this.dsfClientConfig = dsfClientConfig;
- this.proxyConfig = proxyConfig;
- this.oidcClientProvider = oidcClientProvider;
- this.userAgent = userAgent;
- this.configProvider = configProvider;
- }
-
- @Override
- public void afterPropertiesSet() throws Exception
- {
- Objects.requireNonNull(fhirContext, "fhirContext");
- Objects.requireNonNull(referenceCleaner, "referenceCleaner");
- Objects.requireNonNull(dsfClientConfig, "dsfClientConfig");
- Objects.requireNonNull(proxyConfig, "proxyConfig");
- Objects.requireNonNull(oidcClientProvider, "oidcClientProvider");
- Objects.requireNonNull(userAgent, "userAgent");
- Objects.requireNonNull(configProvider, "configProvider");
+ this.fhirContext = Objects.requireNonNull(fhirContext, "fhirContext");
+ this.referenceCleaner = Objects.requireNonNull(referenceCleaner, "referenceCleaner");
+ this.dsfClientConfig = Objects.requireNonNull(dsfClientConfig, "dsfClientConfig");
+ this.proxyConfig = Objects.requireNonNull(proxyConfig, "proxyConfig");
+ this.oidcClientProvider = Objects.requireNonNull(oidcClientProvider, "oidcClientProvider");
+ this.userAgent = Objects.requireNonNull(userAgent, "userAgent");
+ this.configProvider = Objects.requireNonNull(configProvider, "configProvider");
}
@Override
diff --git a/dsf-bpe/dsf-bpe-process-api-v2-impl/src/main/java/dev/dsf/bpe/v2/service/FhirClientProviderImpl.java b/dsf-bpe/dsf-bpe-process-api-v2-impl/src/main/java/dev/dsf/bpe/v2/service/FhirClientProviderImpl.java
index 4573134bf..e5b0e1767 100644
--- a/dsf-bpe/dsf-bpe-process-api-v2-impl/src/main/java/dev/dsf/bpe/v2/service/FhirClientProviderImpl.java
+++ b/dsf-bpe/dsf-bpe-process-api-v2-impl/src/main/java/dev/dsf/bpe/v2/service/FhirClientProviderImpl.java
@@ -20,18 +20,14 @@
import java.util.Objects;
import java.util.Optional;
-import org.springframework.beans.factory.InitializingBean;
-
import ca.uhn.fhir.context.FhirContext;
import ca.uhn.fhir.rest.client.api.IGenericClient;
import dev.dsf.bpe.v2.client.fhir.ClientConfig;
import dev.dsf.bpe.v2.client.fhir.FhirClientFactory;
-import dev.dsf.bpe.v2.config.ProxyConfig;
-public class FhirClientProviderImpl implements FhirClientProvider, InitializingBean
+public class FhirClientProviderImpl implements FhirClientProvider
{
private final FhirContext fhirContext;
- private final ProxyConfig proxyConfig;
private final OidcClientProvider oidcClientProvider;
private final String userAgent;
private final ClientConfigProvider configProvider;
@@ -41,8 +37,6 @@ public class FhirClientProviderImpl implements FhirClientProvider, InitializingB
/**
* @param fhirContext
* not null
- * @param proxyConfig
- * not null
* @param oidcClientProvider
* not null
* @param userAgent
@@ -50,24 +44,13 @@ public class FhirClientProviderImpl implements FhirClientProvider, InitializingB
* @param configProvider
* not null
*/
- public FhirClientProviderImpl(FhirContext fhirContext, ProxyConfig proxyConfig,
- OidcClientProvider oidcClientProvider, String userAgent, ClientConfigProvider configProvider)
- {
- this.fhirContext = fhirContext;
- this.proxyConfig = proxyConfig;
- this.oidcClientProvider = oidcClientProvider;
- this.userAgent = userAgent;
- this.configProvider = configProvider;
- }
-
- @Override
- public void afterPropertiesSet() throws Exception
+ public FhirClientProviderImpl(FhirContext fhirContext, OidcClientProvider oidcClientProvider, String userAgent,
+ ClientConfigProvider configProvider)
{
- Objects.requireNonNull(fhirContext, "fhirContext");
- Objects.requireNonNull(proxyConfig, "proxyConfig");
- Objects.requireNonNull(oidcClientProvider, "oidcClientProvider");
- Objects.requireNonNull(userAgent, "userAgent");
- Objects.requireNonNull(configProvider, "configProvider");
+ this.fhirContext = Objects.requireNonNull(fhirContext, "fhirContext");
+ this.oidcClientProvider = Objects.requireNonNull(oidcClientProvider, "oidcClientProvider");
+ this.userAgent = Objects.requireNonNull(userAgent, "userAgent");
+ this.configProvider = Objects.requireNonNull(configProvider, "configProvider");
}
private Optional doGetById(ClientConfig clientConfig)
diff --git a/dsf-bpe/dsf-bpe-process-api-v2-impl/src/main/java/dev/dsf/bpe/v2/service/MailServiceDelegate.java b/dsf-bpe/dsf-bpe-process-api-v2-impl/src/main/java/dev/dsf/bpe/v2/service/MailServiceDelegate.java
index 35cbfc83b..85befc0c9 100644
--- a/dsf-bpe/dsf-bpe-process-api-v2-impl/src/main/java/dev/dsf/bpe/v2/service/MailServiceDelegate.java
+++ b/dsf-bpe/dsf-bpe-process-api-v2-impl/src/main/java/dev/dsf/bpe/v2/service/MailServiceDelegate.java
@@ -21,23 +21,19 @@
import javax.mail.internet.MimeBodyPart;
import javax.mail.internet.MimeMessage;
-import org.springframework.beans.factory.InitializingBean;
-
import dev.dsf.bpe.api.service.BpeMailService;
-public class MailServiceDelegate implements MailService, InitializingBean
+public class MailServiceDelegate implements MailService
{
private final BpeMailService delegate;
+ /**
+ * @param delegate
+ * not null
+ */
public MailServiceDelegate(BpeMailService delegate)
{
- this.delegate = delegate;
- }
-
- @Override
- public void afterPropertiesSet() throws Exception
- {
- Objects.requireNonNull(delegate, "delegate");
+ this.delegate = Objects.requireNonNull(delegate, "delegate");
}
@Override
diff --git a/dsf-bpe/dsf-bpe-process-api-v2-impl/src/main/java/dev/dsf/bpe/v2/service/MimeTypeServiceImpl.java b/dsf-bpe/dsf-bpe-process-api-v2-impl/src/main/java/dev/dsf/bpe/v2/service/MimeTypeServiceImpl.java
index de32b3e31..0d799f37c 100644
--- a/dsf-bpe/dsf-bpe-process-api-v2-impl/src/main/java/dev/dsf/bpe/v2/service/MimeTypeServiceImpl.java
+++ b/dsf-bpe/dsf-bpe-process-api-v2-impl/src/main/java/dev/dsf/bpe/v2/service/MimeTypeServiceImpl.java
@@ -23,21 +23,18 @@
import org.apache.tika.io.TikaInputStream;
import org.apache.tika.metadata.Metadata;
import org.apache.tika.mime.MediaType;
-import org.springframework.beans.factory.InitializingBean;
-public class MimeTypeServiceImpl implements MimeTypeService, InitializingBean
+public class MimeTypeServiceImpl implements MimeTypeService
{
private final Detector detector;
+ /**
+ * @param detector
+ * not null
+ */
public MimeTypeServiceImpl(Detector detector)
{
- this.detector = detector;
- }
-
- @Override
- public void afterPropertiesSet() throws Exception
- {
- Objects.requireNonNull(detector, "detector");
+ this.detector = Objects.requireNonNull(detector, "detector");
}
@Override
diff --git a/dsf-bpe/dsf-bpe-process-api-v2-impl/src/main/java/dev/dsf/bpe/v2/service/ValidationServiceProviderImpl.java b/dsf-bpe/dsf-bpe-process-api-v2-impl/src/main/java/dev/dsf/bpe/v2/service/ValidationServiceProviderImpl.java
index a00b23a1c..c69bfc0ab 100644
--- a/dsf-bpe/dsf-bpe-process-api-v2-impl/src/main/java/dev/dsf/bpe/v2/service/ValidationServiceProviderImpl.java
+++ b/dsf-bpe/dsf-bpe-process-api-v2-impl/src/main/java/dev/dsf/bpe/v2/service/ValidationServiceProviderImpl.java
@@ -24,30 +24,28 @@
import org.hl7.fhir.r4.model.Resource;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.InitializingBean;
import ca.uhn.fhir.context.FhirContext;
import ca.uhn.fhir.validation.ValidationResult;
import dev.dsf.bpe.v2.service.validation.FhirPackageIdentifier;
import dev.dsf.bpe.v2.service.validation.ValidationService;
-public class ValidationServiceProviderImpl implements ValidationServiceProvider, InitializingBean
+public class ValidationServiceProviderImpl implements ValidationServiceProvider
{
private static final Logger logger = LoggerFactory.getLogger(ValidationServiceProviderImpl.class);
private final boolean enabled;
private final FhirContext fhirContext;
+ /**
+ * @param enabled
+ * @param fhirContext
+ * not null
+ */
public ValidationServiceProviderImpl(boolean enabled, FhirContext fhirContext)
{
this.enabled = enabled;
- this.fhirContext = fhirContext;
- }
-
- @Override
- public void afterPropertiesSet() throws Exception
- {
- Objects.requireNonNull(fhirContext, "fhirContext");
+ this.fhirContext = Objects.requireNonNull(fhirContext, "fhirContext");
}
@Override
diff --git a/dsf-bpe/dsf-bpe-process-api-v2-impl/src/main/java/dev/dsf/bpe/v2/spring/ApiServiceConfig.java b/dsf-bpe/dsf-bpe-process-api-v2-impl/src/main/java/dev/dsf/bpe/v2/spring/ApiServiceConfig.java
index 113633a14..6adbfa62b 100644
--- a/dsf-bpe/dsf-bpe-process-api-v2-impl/src/main/java/dev/dsf/bpe/v2/spring/ApiServiceConfig.java
+++ b/dsf-bpe/dsf-bpe-process-api-v2-impl/src/main/java/dev/dsf/bpe/v2/spring/ApiServiceConfig.java
@@ -169,8 +169,8 @@ public DsfClientProvider dsfClientProvider()
@Bean
public FhirClientProvider fhirClientProvider()
{
- return new FhirClientProviderImpl(fhirContext(), proxyConfigDelegate(), oidcClientProvider(),
- buildInfoProvider.getUserAgentValue(), fhirClientConfigProvider());
+ return new FhirClientProviderImpl(fhirContext(), oidcClientProvider(), buildInfoProvider.getUserAgentValue(),
+ fhirClientConfigProvider());
}
@Bean
diff --git a/dsf-bpe/dsf-bpe-process-api-v2-impl/src/main/java/dev/dsf/bpe/v2/variables/FhirResourceSerializer.java b/dsf-bpe/dsf-bpe-process-api-v2-impl/src/main/java/dev/dsf/bpe/v2/variables/FhirResourceSerializer.java
index cd69c3851..5b5013051 100644
--- a/dsf-bpe/dsf-bpe-process-api-v2-impl/src/main/java/dev/dsf/bpe/v2/variables/FhirResourceSerializer.java
+++ b/dsf-bpe/dsf-bpe-process-api-v2-impl/src/main/java/dev/dsf/bpe/v2/variables/FhirResourceSerializer.java
@@ -28,29 +28,26 @@
import org.operaton.bpm.engine.variable.impl.value.UntypedValueImpl;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.InitializingBean;
import ca.uhn.fhir.context.FhirContext;
import ca.uhn.fhir.parser.IParser;
import dev.dsf.bpe.v2.variables.FhirResourceValues.FhirResourceValue;
-public class FhirResourceSerializer extends PrimitiveValueSerializer implements InitializingBean
+public class FhirResourceSerializer extends PrimitiveValueSerializer
{
private static final Logger logger = LoggerFactory.getLogger(FhirResourceSerializer.class);
private final FhirContext fhirContext;
+ /**
+ * @param fhirContext
+ * not null
+ */
public FhirResourceSerializer(FhirContext fhirContext)
{
super(FhirResourceValues.VALUE_TYPE);
- this.fhirContext = fhirContext;
- }
-
- @Override
- public void afterPropertiesSet() throws Exception
- {
- Objects.requireNonNull(fhirContext, "fhirContext");
+ this.fhirContext = Objects.requireNonNull(fhirContext, "fhirContext");
}
@Override
diff --git a/dsf-bpe/dsf-bpe-process-api-v2-impl/src/main/java/dev/dsf/bpe/v2/variables/FhirResourcesListSerializer.java b/dsf-bpe/dsf-bpe-process-api-v2-impl/src/main/java/dev/dsf/bpe/v2/variables/FhirResourcesListSerializer.java
index d991b03f9..04ab804f0 100644
--- a/dsf-bpe/dsf-bpe-process-api-v2-impl/src/main/java/dev/dsf/bpe/v2/variables/FhirResourcesListSerializer.java
+++ b/dsf-bpe/dsf-bpe-process-api-v2-impl/src/main/java/dev/dsf/bpe/v2/variables/FhirResourcesListSerializer.java
@@ -22,28 +22,24 @@
import org.operaton.bpm.engine.impl.variable.serializer.PrimitiveValueSerializer;
import org.operaton.bpm.engine.impl.variable.serializer.ValueFields;
import org.operaton.bpm.engine.variable.impl.value.UntypedValueImpl;
-import org.springframework.beans.factory.InitializingBean;
import com.fasterxml.jackson.databind.ObjectMapper;
import dev.dsf.bpe.v2.variables.FhirResourcesListValues.FhirResourcesListValue;
public class FhirResourcesListSerializer extends PrimitiveValueSerializer
- implements InitializingBean
{
private final ObjectMapper objectMapper;
+ /**
+ * @param objectMapper
+ * not null
+ */
public FhirResourcesListSerializer(ObjectMapper objectMapper)
{
super(FhirResourcesListValues.VALUE_TYPE);
- this.objectMapper = objectMapper;
- }
-
- @Override
- public void afterPropertiesSet() throws Exception
- {
- Objects.requireNonNull(objectMapper, "objectMapper");
+ this.objectMapper = Objects.requireNonNull(objectMapper, "objectMapper");
}
@Override
diff --git a/dsf-bpe/dsf-bpe-process-api-v2-impl/src/main/java/dev/dsf/bpe/v2/variables/TargetSerializer.java b/dsf-bpe/dsf-bpe-process-api-v2-impl/src/main/java/dev/dsf/bpe/v2/variables/TargetSerializer.java
index 3f1e3103a..0d8bba982 100644
--- a/dsf-bpe/dsf-bpe-process-api-v2-impl/src/main/java/dev/dsf/bpe/v2/variables/TargetSerializer.java
+++ b/dsf-bpe/dsf-bpe-process-api-v2-impl/src/main/java/dev/dsf/bpe/v2/variables/TargetSerializer.java
@@ -21,28 +21,25 @@
import org.operaton.bpm.engine.impl.variable.serializer.PrimitiveValueSerializer;
import org.operaton.bpm.engine.impl.variable.serializer.ValueFields;
import org.operaton.bpm.engine.variable.impl.value.UntypedValueImpl;
-import org.springframework.beans.factory.InitializingBean;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import dev.dsf.bpe.v2.variables.TargetValues.TargetValue;
-public class TargetSerializer extends PrimitiveValueSerializer implements InitializingBean
+public class TargetSerializer extends PrimitiveValueSerializer
{
private final ObjectMapper objectMapper;
+ /**
+ * @param objectMapper
+ * not null
+ */
public TargetSerializer(ObjectMapper objectMapper)
{
super(TargetValues.VALUE_TYPE);
- this.objectMapper = objectMapper;
- }
-
- @Override
- public void afterPropertiesSet() throws Exception
- {
- Objects.requireNonNull(objectMapper, "objectMapper");
+ this.objectMapper = Objects.requireNonNull(objectMapper, "objectMapper");
}
@Override
diff --git a/dsf-bpe/dsf-bpe-process-api-v2-impl/src/main/java/dev/dsf/bpe/v2/variables/TargetsSerializer.java b/dsf-bpe/dsf-bpe-process-api-v2-impl/src/main/java/dev/dsf/bpe/v2/variables/TargetsSerializer.java
index b00dee3b4..852498fec 100644
--- a/dsf-bpe/dsf-bpe-process-api-v2-impl/src/main/java/dev/dsf/bpe/v2/variables/TargetsSerializer.java
+++ b/dsf-bpe/dsf-bpe-process-api-v2-impl/src/main/java/dev/dsf/bpe/v2/variables/TargetsSerializer.java
@@ -21,28 +21,25 @@
import org.operaton.bpm.engine.impl.variable.serializer.PrimitiveValueSerializer;
import org.operaton.bpm.engine.impl.variable.serializer.ValueFields;
import org.operaton.bpm.engine.variable.impl.value.UntypedValueImpl;
-import org.springframework.beans.factory.InitializingBean;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import dev.dsf.bpe.v2.variables.TargetsValues.TargetsValue;
-public class TargetsSerializer extends PrimitiveValueSerializer implements InitializingBean
+public class TargetsSerializer extends PrimitiveValueSerializer
{
private final ObjectMapper objectMapper;
+ /**
+ * @param objectMapper
+ * not null
+ */
public TargetsSerializer(ObjectMapper objectMapper)
{
super(TargetsValues.VALUE_TYPE);
- this.objectMapper = objectMapper;
- }
-
- @Override
- public void afterPropertiesSet() throws Exception
- {
- Objects.requireNonNull(objectMapper, "objectMapper");
+ this.objectMapper = Objects.requireNonNull(objectMapper, "objectMapper");
}
@Override
diff --git a/dsf-bpe/dsf-bpe-process-api/src/main/java/dev/dsf/bpe/api/plugin/AbstractProcessPluginFactory.java b/dsf-bpe/dsf-bpe-process-api/src/main/java/dev/dsf/bpe/api/plugin/AbstractProcessPluginFactory.java
index 4d6ffadca..a36d0ffaa 100644
--- a/dsf-bpe/dsf-bpe-process-api/src/main/java/dev/dsf/bpe/api/plugin/AbstractProcessPluginFactory.java
+++ b/dsf-bpe/dsf-bpe-process-api/src/main/java/dev/dsf/bpe/api/plugin/AbstractProcessPluginFactory.java
@@ -28,11 +28,10 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.InitializingBean;
import org.springframework.context.ApplicationContext;
import org.springframework.core.env.ConfigurableEnvironment;
-public abstract class AbstractProcessPluginFactory implements ProcessPluginFactory, InitializingBean
+public abstract class AbstractProcessPluginFactory implements ProcessPluginFactory
{
private static final Logger logger = LoggerFactory.getLogger(AbstractProcessPluginFactory.class);
@@ -47,26 +46,30 @@ public abstract class AbstractProcessPluginFactory implements ProcessPluginFacto
protected final String serverBaseUrl;
private final Class> processPluginDefinitionType;
+ /**
+ * @param apiVersion
+ * @param apiClassLoader
+ * not null
+ * @param apiApplicationContext
+ * not null
+ * @param environment
+ * not null
+ * @param serverBaseUrl
+ * not null
+ * @param processPluginDefinitionType
+ * not null
+ */
public AbstractProcessPluginFactory(int apiVersion, ClassLoader apiClassLoader,
ApplicationContext apiApplicationContext, ConfigurableEnvironment environment, String serverBaseUrl,
Class> processPluginDefinitionType)
{
this.apiVersion = apiVersion;
- this.apiClassLoader = apiClassLoader;
- this.apiApplicationContext = apiApplicationContext;
- this.environment = environment;
- this.serverBaseUrl = serverBaseUrl;
- this.processPluginDefinitionType = processPluginDefinitionType;
- }
-
- @Override
- public void afterPropertiesSet() throws Exception
- {
- Objects.requireNonNull(apiClassLoader, "apiClassLoader");
- Objects.requireNonNull(apiApplicationContext, "apiApplicationContext");
- Objects.requireNonNull(environment, "environment");
- Objects.requireNonNull(serverBaseUrl, "serverBaseUrl");
- Objects.requireNonNull(processPluginDefinitionType, "processPluginDefinitionType");
+ this.apiClassLoader = Objects.requireNonNull(apiClassLoader, "apiClassLoader");
+ this.apiApplicationContext = Objects.requireNonNull(apiApplicationContext, "apiApplicationContext");
+ this.environment = Objects.requireNonNull(environment, "environment");
+ this.serverBaseUrl = Objects.requireNonNull(serverBaseUrl, "serverBaseUrl");
+ this.processPluginDefinitionType = Objects.requireNonNull(processPluginDefinitionType,
+ "processPluginDefinitionType");
}
@Override
diff --git a/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/authentication/IdentityProviderImpl.java b/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/authentication/IdentityProviderImpl.java
index 6ec39be4a..1d9a5e80a 100644
--- a/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/authentication/IdentityProviderImpl.java
+++ b/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/authentication/IdentityProviderImpl.java
@@ -24,7 +24,6 @@
import org.hl7.fhir.r4.model.Practitioner;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.InitializingBean;
import dev.dsf.bpe.service.LocalOrganizationAndEndpointProvider;
import dev.dsf.common.auth.conf.AbstractIdentityProvider;
@@ -34,27 +33,25 @@
import dev.dsf.common.auth.conf.RoleConfig;
import dev.dsf.common.auth.conf.X509CertificateWrapper;
-public class IdentityProviderImpl extends AbstractIdentityProvider
- implements IdentityProvider, InitializingBean
+public class IdentityProviderImpl extends AbstractIdentityProvider implements IdentityProvider
{
private static final Logger logger = LoggerFactory.getLogger(IdentityProviderImpl.class);
private final LocalOrganizationAndEndpointProvider organizationAndEndpointProvider;
+ /**
+ * @param roleConfig
+ * not null
+ * @param organizationAndEndpointProvider
+ * not null
+ */
public IdentityProviderImpl(RoleConfig roleConfig,
LocalOrganizationAndEndpointProvider organizationAndEndpointProvider)
{
super(roleConfig);
- this.organizationAndEndpointProvider = organizationAndEndpointProvider;
- }
-
- @Override
- public void afterPropertiesSet() throws Exception
- {
- super.afterPropertiesSet();
-
- Objects.requireNonNull(organizationAndEndpointProvider, "organizationAndEndpointProvider");
+ this.organizationAndEndpointProvider = Objects.requireNonNull(organizationAndEndpointProvider,
+ "organizationAndEndpointProvider");
}
@Override
diff --git a/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/client/dsf/ClientProvider.java b/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/client/dsf/ClientProvider.java
index 8cf3b20c5..2a517cc62 100644
--- a/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/client/dsf/ClientProvider.java
+++ b/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/client/dsf/ClientProvider.java
@@ -17,15 +17,14 @@
import java.security.KeyStore;
+import dev.dsf.fhir.client.Endpoint;
import dev.dsf.fhir.client.WebsocketClient;
public interface ClientProvider
{
WebserviceClient getWebserviceClient();
- WebsocketClient getWebsocketClient(Runnable reconnector, String subscriptionId);
-
- void disconnectAll();
+ WebsocketClient createWebsocketClient(Endpoint endpoint, String resourceType);
char[] getWebserviceKeyStorePassword();
diff --git a/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/client/dsf/ClientProviderImpl.java b/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/client/dsf/ClientProviderImpl.java
index 75b61900c..afcf568bb 100644
--- a/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/client/dsf/ClientProviderImpl.java
+++ b/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/client/dsf/ClientProviderImpl.java
@@ -18,28 +18,25 @@
import java.net.URI;
import java.security.KeyStore;
import java.time.Duration;
-import java.util.HashMap;
-import java.util.Map;
import java.util.Objects;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.InitializingBean;
+import javax.net.ssl.SSLContext;
+
+import org.glassfish.jersey.SslConfigurator;
import ca.uhn.fhir.context.FhirContext;
import dev.dsf.common.config.ProxyConfig;
+import dev.dsf.fhir.client.Endpoint;
import dev.dsf.fhir.client.WebsocketClient;
-import dev.dsf.fhir.client.WebsocketClientTyrus;
+import dev.dsf.fhir.client.WebsocketClientJetty;
+import dev.dsf.fhir.client.WebsocketClientJetty.TimeConfig;
-public class ClientProviderImpl implements ClientProvider, InitializingBean
+public class ClientProviderImpl implements ClientProvider
{
- private static final Logger logger = LoggerFactory.getLogger(ClientProviderImpl.class);
-
- private final Map websocketClientsBySubscriptionId = new HashMap<>();
-
private final String baseUrl;
private final String websocketUrl;
+ private final TimeConfig websocketTimeConfig;
private final KeyStore websocketTrustStore;
private final KeyStore websocketKeyStore;
private final char[] websocketKeyStorePassword;
@@ -53,30 +50,59 @@ public class ClientProviderImpl implements ClientProvider, InitializingBean
private final KeyStore webserviceKeyStore;
private final char[] webserviceKeyStorePassword;
+ /**
+ * @param fhirContext
+ * not null
+ * @param baseUrl
+ * not null
+ * @param readTimeout
+ * not null
+ * @param connectTimeout
+ * not null
+ * @param logRequestsAndResponses
+ * @param webserviceTrustStore
+ * not null
+ * @param webserviceKeyStore
+ * not null
+ * @param webserviceKeyStorePassword
+ * not null
+ * @param websocketUrl
+ * not null
+ * @param websocketTrustStore
+ * not null
+ * @param websocketKeyStore
+ * not null
+ * @param websocketKeyStorePassword
+ * not null
+ * @param proxyConfig
+ * not null
+ * @param userAgent
+ * not null
+ */
public ClientProviderImpl(FhirContext fhirContext, String baseUrl, Duration readTimeout, Duration connectTimeout,
boolean logRequestsAndResponses, KeyStore webserviceTrustStore, KeyStore webserviceKeyStore,
- char[] webserviceKeyStorePassword, String websocketUrl, KeyStore websocketTrustStore,
- KeyStore websocketKeyStore, char[] websocketKeyStorePassword, ProxyConfig proxyConfig, String userAgent)
+ char[] webserviceKeyStorePassword, String websocketUrl, TimeConfig websocketTimeConfig,
+ KeyStore websocketTrustStore, KeyStore websocketKeyStore, char[] websocketKeyStorePassword,
+ ProxyConfig proxyConfig, String userAgent)
{
Objects.requireNonNull(fhirContext, "fhirContext");
Objects.requireNonNull(baseUrl, "baseUrl");
- Objects.requireNonNull(readTimeout, "readTimeout");
Objects.requireNonNull(connectTimeout, "connectTimeout");
+ Objects.requireNonNull(readTimeout, "readTimeout");
+ Objects.requireNonNull(websocketTimeConfig, "websocketTimeConfig");
Objects.requireNonNull(webserviceTrustStore, "webserviceTrustStore");
Objects.requireNonNull(webserviceKeyStore, "webserviceKeyStore");
Objects.requireNonNull(webserviceKeyStorePassword, "webserviceKeyStorePassword");
- Objects.requireNonNull(proxyConfig, "proxyConfig");
- Objects.requireNonNull(userAgent, "userAgent");
this.baseUrl = baseUrl;
- this.websocketUrl = websocketUrl;
- this.websocketTrustStore = websocketTrustStore;
- this.websocketKeyStore = websocketKeyStore;
- this.websocketKeyStorePassword = websocketKeyStorePassword;
-
- this.proxyConfig = proxyConfig;
- this.userAgent = userAgent;
+ this.websocketUrl = Objects.requireNonNull(websocketUrl, "websocketUrl");
+ this.websocketTimeConfig = Objects.requireNonNull(websocketTimeConfig, "websocketTimeConfig");
+ this.websocketTrustStore = Objects.requireNonNull(websocketTrustStore, "websocketTrustStore");
+ this.websocketKeyStore = Objects.requireNonNull(websocketKeyStore, "websocketKeyStore");
+ this.websocketKeyStorePassword = Objects.requireNonNull(websocketKeyStorePassword, "websocketKeyStorePassword");
+ this.proxyConfig = Objects.requireNonNull(proxyConfig, "proxyConfig");
+ this.userAgent = Objects.requireNonNull(userAgent, "userAgent");
String proxyUrl = proxyConfig.isEnabled(baseUrl) ? proxyConfig.getUrl() : null;
String proxyUsername = proxyConfig.isEnabled(baseUrl) ? proxyConfig.getUsername() : null;
@@ -91,15 +117,6 @@ public ClientProviderImpl(FhirContext fhirContext, String baseUrl, Duration read
this.webserviceKeyStorePassword = webserviceKeyStorePassword;
}
- @Override
- public void afterPropertiesSet() throws Exception
- {
- Objects.requireNonNull(websocketUrl, "websocketUrl");
- Objects.requireNonNull(websocketTrustStore, "websocketTrustStore");
- Objects.requireNonNull(websocketKeyStore, "websocketKeyStore");
- Objects.requireNonNull(websocketKeyStorePassword, "websocketKeyStorePassword");
- }
-
public String getBaseUrl()
{
return baseUrl;
@@ -112,42 +129,24 @@ public WebserviceClient getWebserviceClient()
}
@Override
- public WebsocketClient getWebsocketClient(Runnable reconnector, String subscriptionId)
- {
- if (!websocketClientsBySubscriptionId.containsKey(subscriptionId))
- {
- WebsocketClientTyrus client = createWebsocketClient(reconnector, subscriptionId);
- websocketClientsBySubscriptionId.put(subscriptionId, client);
- return client;
- }
-
- return websocketClientsBySubscriptionId.get(subscriptionId);
- }
-
- protected WebsocketClientTyrus createWebsocketClient(Runnable reconnector, String subscriptionId)
- {
- return new WebsocketClientTyrus(reconnector, URI.create(websocketUrl), websocketTrustStore, websocketKeyStore,
- websocketKeyStorePassword, proxyConfig.isEnabled(websocketUrl) ? proxyConfig.getUrl() : null,
- proxyConfig.isEnabled(websocketUrl) ? proxyConfig.getUsername() : null,
- proxyConfig.isEnabled(websocketUrl) ? proxyConfig.getPassword() : null, userAgent, subscriptionId);
- }
-
- @Override
- public void disconnectAll()
+ public WebsocketClient createWebsocketClient(Endpoint endpoint, String resourceType)
{
- for (WebsocketClient c : websocketClientsBySubscriptionId.values())
- {
- try
- {
- c.disconnect();
- }
- catch (Exception e)
- {
- logger.debug("Error while disconnecting websocket client", e);
- logger.warn("Error while disconnecting websocket client: {} - {}", e.getClass().getName(),
- e.getMessage());
- }
- }
+ SSLContext sslContext;
+ if (websocketTrustStore != null && websocketKeyStore == null && websocketKeyStorePassword == null)
+ sslContext = SslConfigurator.newInstance().trustStore(websocketTrustStore).createSSLContext();
+ else if (websocketTrustStore != null && websocketKeyStore != null && websocketKeyStorePassword != null)
+ sslContext = SslConfigurator.newInstance().trustStore(websocketTrustStore).keyStore(websocketKeyStore)
+ .keyStorePassword(websocketKeyStorePassword).createSSLContext();
+ else
+ sslContext = SslConfigurator.getDefaultContext();
+
+ WebsocketClientJetty.ProxyConfig proxyConfig = null;
+ if (this.proxyConfig.isEnabled(websocketUrl))
+ proxyConfig = new WebsocketClientJetty.ProxyConfig(URI.create(this.proxyConfig.getUrl()),
+ this.proxyConfig.getUsername(), this.proxyConfig.getPassword());
+
+ return new WebsocketClientJetty(URI.create(websocketUrl), endpoint, userAgent, resourceType,
+ websocketTimeConfig, sslContext, proxyConfig);
}
@Override
diff --git a/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/client/dsf/WebserviceClientJersey.java b/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/client/dsf/WebserviceClientJersey.java
index ef44e7918..0e7794c8c 100644
--- a/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/client/dsf/WebserviceClientJersey.java
+++ b/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/client/dsf/WebserviceClientJersey.java
@@ -15,7 +15,6 @@
*/
package dev.dsf.bpe.client.dsf;
-import java.io.InputStream;
import java.security.KeyStore;
import java.time.Duration;
import java.util.List;
@@ -32,7 +31,6 @@
import org.glassfish.jersey.client.ClientProperties;
import org.glassfish.jersey.logging.LoggingFeature;
import org.glassfish.jersey.logging.LoggingFeature.Verbosity;
-import org.hl7.fhir.r4.model.Binary;
import org.hl7.fhir.r4.model.Bundle;
import org.hl7.fhir.r4.model.OperationOutcome;
import org.hl7.fhir.r4.model.OperationOutcome.OperationOutcomeIssueComponent;
@@ -53,7 +51,6 @@
import jakarta.ws.rs.client.WebTarget;
import jakarta.ws.rs.core.EntityTag;
import jakarta.ws.rs.core.HttpHeaders;
-import jakarta.ws.rs.core.MediaType;
import jakarta.ws.rs.core.Response;
import jakarta.ws.rs.core.Response.Status;
@@ -173,64 +170,6 @@ public PreferReturnMinimalWithRetry withMinimalReturn()
return preferReturnMinimal;
}
- PreferReturn create(PreferReturnType returnType, Resource resource)
- {
- Objects.requireNonNull(returnType, "returnType");
- Objects.requireNonNull(resource, "resource");
-
- Response response = getResource().path(resource.getClass().getAnnotation(ResourceDef.class).name()).request()
- .header(Constants.HEADER_PREFER, returnType.getHeaderValue()).accept(Constants.CT_FHIR_JSON_NEW)
- .post(Entity.entity(resource, Constants.CT_FHIR_JSON_NEW));
-
- logStatusAndHeaders(response);
-
- if (Status.CREATED.getStatusCode() == response.getStatus())
- return toPreferReturn(returnType, resource.getClass(), response);
- else
- throw handleError(response);
- }
-
- PreferReturn createConditionally(PreferReturnType returnType, Resource resource, String ifNoneExistCriteria)
- {
- Objects.requireNonNull(returnType, "returnType");
- Objects.requireNonNull(resource, "resource");
- Objects.requireNonNull(ifNoneExistCriteria, "ifNoneExistCriteria");
-
- Response response = getResource().path(resource.getClass().getAnnotation(ResourceDef.class).name()).request()
- .header(Constants.HEADER_PREFER, returnType.getHeaderValue())
- .header(Constants.HEADER_IF_NONE_EXIST, ifNoneExistCriteria).accept(Constants.CT_FHIR_JSON_NEW)
- .post(Entity.entity(resource, Constants.CT_FHIR_JSON_NEW));
-
- logStatusAndHeaders(response);
-
- if (Status.CREATED.getStatusCode() == response.getStatus())
- return toPreferReturn(returnType, resource.getClass(), response);
- else
- throw handleError(response);
- }
-
- PreferReturn createBinary(PreferReturnType returnType, InputStream in, MediaType mediaType,
- String securityContextReference)
- {
- Objects.requireNonNull(returnType, "returnType");
- Objects.requireNonNull(in, "in");
- Objects.requireNonNull(mediaType, "mediaType");
- // securityContextReference may be null
-
- Builder request = getResource().path("Binary").request().header(Constants.HEADER_PREFER,
- returnType.getHeaderValue());
- if (securityContextReference != null && !securityContextReference.isBlank())
- request = request.header(Constants.HEADER_X_SECURITY_CONTEXT, securityContextReference);
- Response response = request.accept(Constants.CT_FHIR_JSON_NEW).post(Entity.entity(in, mediaType));
-
- logStatusAndHeaders(response);
-
- if (Status.CREATED.getStatusCode() == response.getStatus())
- return toPreferReturn(returnType, Binary.class, response);
- else
- throw handleError(response);
- }
-
PreferReturn update(PreferReturnType returnType, Resource resource)
{
Objects.requireNonNull(returnType, "returnType");
@@ -253,58 +192,6 @@ PreferReturn update(PreferReturnType returnType, Resource resource)
throw handleError(response);
}
- PreferReturn updateConditionally(PreferReturnType returnType, Resource resource, Map> criteria)
- {
- Objects.requireNonNull(returnType, "returnType");
- Objects.requireNonNull(resource, "resource");
- Objects.requireNonNull(criteria, "criteria");
- if (criteria.isEmpty())
- throw new IllegalArgumentException("criteria map empty");
-
- WebTarget target = getResource().path(resource.getClass().getAnnotation(ResourceDef.class).name());
-
- for (Entry> entry : criteria.entrySet())
- target = target.queryParam(entry.getKey(), entry.getValue().toArray());
-
- Builder builder = target.request().accept(Constants.CT_FHIR_JSON_NEW).header(Constants.HEADER_PREFER,
- returnType.getHeaderValue());
-
- if (resource.getMeta().hasVersionId())
- builder.header(Constants.HEADER_IF_MATCH, new EntityTag(resource.getMeta().getVersionId(), true));
-
- Response response = builder.put(Entity.entity(resource, Constants.CT_FHIR_JSON_NEW));
-
- logStatusAndHeaders(response);
-
- if (Status.CREATED.getStatusCode() == response.getStatus() || Status.OK.getStatusCode() == response.getStatus())
- return toPreferReturn(returnType, resource.getClass(), response);
- else
- throw handleError(response);
- }
-
- PreferReturn updateBinary(PreferReturnType returnType, String id, InputStream in, MediaType mediaType,
- String securityContextReference)
- {
- Objects.requireNonNull(returnType, "returnType");
- Objects.requireNonNull(id, "id");
- Objects.requireNonNull(in, "in");
- Objects.requireNonNull(mediaType, "mediaType");
- // securityContextReference may be null
-
- Builder request = getResource().path("Binary").path(id).request().header(Constants.HEADER_PREFER,
- returnType.getHeaderValue());
- if (securityContextReference != null && !securityContextReference.isBlank())
- request = request.header(Constants.HEADER_X_SECURITY_CONTEXT, securityContextReference);
- Response response = request.accept(Constants.CT_FHIR_JSON_NEW).put(Entity.entity(in, mediaType));
-
- logStatusAndHeaders(response);
-
- if (Status.CREATED.getStatusCode() == response.getStatus())
- return toPreferReturn(returnType, Binary.class, response);
- else
- throw handleError(response);
- }
-
Bundle postBundle(PreferReturnType returnType, Bundle bundle)
{
Objects.requireNonNull(bundle, "bundle");
diff --git a/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/client/oidc/OidcClientJersey.java b/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/client/oidc/OidcClientJersey.java
index 7f96d9c16..918cb70e3 100644
--- a/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/client/oidc/OidcClientJersey.java
+++ b/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/client/oidc/OidcClientJersey.java
@@ -95,9 +95,9 @@ public class OidcClientJersey extends BaseOidcClientJersey
* @param userAgentValue
* may be null
* @param connectTimeout
- * not null
+ * not null, not negative, 0 represents infinity
* @param readTimeout
- * not null
+ * not null, not negative, 0 represents infinity
* @param logRequestsAndResponses
* @param notBeforeIssuedAtExpiresAtLeewaySeconds
* not null
diff --git a/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/client/oidc/OidcClientProviderImpl.java b/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/client/oidc/OidcClientProviderImpl.java
index 64e0ef210..c51cdc72f 100644
--- a/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/client/oidc/OidcClientProviderImpl.java
+++ b/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/client/oidc/OidcClientProviderImpl.java
@@ -20,14 +20,12 @@
import java.util.List;
import java.util.Objects;
-import org.springframework.beans.factory.InitializingBean;
-
import dev.dsf.bpe.api.client.oidc.OidcClient;
import dev.dsf.bpe.api.config.FhirClientConfig.OidcAuthentication;
import dev.dsf.bpe.api.service.BpeOidcClientProvider;
import dev.dsf.common.config.ProxyConfig;
-public class OidcClientProviderImpl implements BpeOidcClientProvider, InitializingBean
+public class OidcClientProviderImpl implements BpeOidcClientProvider
{
private final ProxyConfig proxyConfig;
private final String defaultDiscoveryPath;
@@ -43,51 +41,65 @@ public class OidcClientProviderImpl implements BpeOidcClientProvider, Initializi
private final Duration notBeforeIssuedAtExpiresAtLeeway;
private final boolean defaultVerifyAuthorizedParty;
+ /**
+ * @param proxyConfig
+ * not null
+ * @param defaultDiscoveryPath
+ * not null
+ * @param defaultConnectTimeout
+ * not null, not negative, 0 represents infinity
+ * @param defaultReadTimeout
+ * not null, not negative, 0 represents infinity
+ * @param defaultTrustedStore
+ * not null
+ * @param defaultEnableDebugLogging
+ * @param userAgent
+ * not null
+ * @param cacheEnabled
+ * @param cacheTimeoutConfigurationResource
+ * not null, not negative
+ * @param cacheTimeoutJwksResource
+ * not null, not negative
+ * @param cacheTimeoutAccessTokenBeforeExpiration
+ * not null, not negative
+ * @param notBeforeIssuedAtExpiresAtLeeway
+ * not null, not negative
+ * @param defaultVerifyAuthorizedParty
+ */
public OidcClientProviderImpl(ProxyConfig proxyConfig, String defaultDiscoveryPath, Duration defaultConnectTimeout,
Duration defaultReadTimeout, KeyStore defaultTrustedStore, boolean defaultEnableDebugLogging,
String userAgent, boolean cacheEnabled, Duration cacheTimeoutConfigurationResource,
Duration cacheTimeoutJwksResource, Duration cacheTimeoutAccessTokenBeforeExpiration,
Duration notBeforeIssuedAtExpiresAtLeeway, boolean defaultVerifyAuthorizedParty)
{
- this.proxyConfig = proxyConfig;
- this.defaultDiscoveryPath = defaultDiscoveryPath;
- this.defaultConnectTimeout = defaultConnectTimeout;
- this.defaultReadTimeout = defaultReadTimeout;
- this.defaultTrustedStore = defaultTrustedStore;
+ this.proxyConfig = Objects.requireNonNull(proxyConfig, "proxyConfig");
+ this.defaultDiscoveryPath = Objects.requireNonNull(defaultDiscoveryPath, "defaultDiscoveryPath");
+ this.defaultConnectTimeout = Objects.requireNonNull(defaultConnectTimeout, "defaultConnectTimeout");
+ if (defaultConnectTimeout.isNegative())
+ throw new IllegalArgumentException("defaultConnectTimeout negative");
+ this.defaultReadTimeout = Objects.requireNonNull(defaultReadTimeout, "defaultReadTimeout");
+ if (defaultReadTimeout.isNegative())
+ throw new IllegalArgumentException("defaultReadTimeout negative");
+ this.defaultTrustedStore = Objects.requireNonNull(defaultTrustedStore, "defaultTrustedStore");
this.defaultEnableDebugLogging = defaultEnableDebugLogging;
- this.userAgent = userAgent;
+ this.userAgent = Objects.requireNonNull(userAgent, "userAgent");
this.cacheEnabled = cacheEnabled;
- this.cacheTimeoutConfigurationResource = cacheTimeoutConfigurationResource;
- this.cacheTimeoutJwksResource = cacheTimeoutJwksResource;
- this.cacheTimeoutAccessTokenBeforeExpiration = cacheTimeoutAccessTokenBeforeExpiration;
- this.notBeforeIssuedAtExpiresAtLeeway = notBeforeIssuedAtExpiresAtLeeway;
- this.defaultVerifyAuthorizedParty = defaultVerifyAuthorizedParty;
- }
-
- @Override
- public void afterPropertiesSet() throws Exception
- {
- Objects.requireNonNull(proxyConfig, "proxyConfig");
- Objects.requireNonNull(defaultConnectTimeout, "defaultConnectTimeout");
- Objects.requireNonNull(defaultReadTimeout, "defaultReadTimeout");
- Objects.requireNonNull(defaultTrustedStore, "defaultTrustedStore");
- Objects.requireNonNull(userAgent, "userAgent");
-
- Objects.requireNonNull(cacheTimeoutConfigurationResource, "cacheTimeoutConfigurationResource");
+ this.cacheTimeoutConfigurationResource = Objects.requireNonNull(cacheTimeoutConfigurationResource,
+ "cacheTimeoutConfigurationResource");
if (cacheTimeoutConfigurationResource.isNegative())
throw new IllegalArgumentException("cacheTimeoutConfigurationResource negative");
-
- Objects.requireNonNull(cacheTimeoutJwksResource, "cacheTimeoutJwksResource");
+ this.cacheTimeoutJwksResource = Objects.requireNonNull(cacheTimeoutJwksResource, "cacheTimeoutJwksResource");
if (cacheTimeoutJwksResource.isNegative())
throw new IllegalArgumentException("cacheTimeoutJwksResource negative");
-
- Objects.requireNonNull(cacheTimeoutAccessTokenBeforeExpiration, "cacheTimeoutAccessTokenBeforeExpiration");
+ this.cacheTimeoutAccessTokenBeforeExpiration = Objects.requireNonNull(cacheTimeoutAccessTokenBeforeExpiration,
+ "cacheTimeoutAccessTokenBeforeExpiration");
if (cacheTimeoutAccessTokenBeforeExpiration.isNegative())
throw new IllegalArgumentException("cacheTimeoutAccessTokenBeforeExpiration negative");
-
- Objects.requireNonNull(notBeforeIssuedAtExpiresAtLeeway, "notBeforeIssuedAtExpiresAtLeeway");
+ this.notBeforeIssuedAtExpiresAtLeeway = Objects.requireNonNull(notBeforeIssuedAtExpiresAtLeeway,
+ "notBeforeIssuedAtExpiresAtLeeway");
if (notBeforeIssuedAtExpiresAtLeeway.isNegative())
throw new IllegalArgumentException("notBeforeIssuedAtExpiresAtLeeway negative");
+ this.defaultVerifyAuthorizedParty = defaultVerifyAuthorizedParty;
}
@Override
diff --git a/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/config/FhirClientConfigYamlReaderImpl.java b/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/config/FhirClientConfigYamlReaderImpl.java
index ee612acc4..bdeaa3966 100644
--- a/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/config/FhirClientConfigYamlReaderImpl.java
+++ b/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/config/FhirClientConfigYamlReaderImpl.java
@@ -28,8 +28,6 @@
import java.util.stream.Collectors;
import java.util.stream.Stream;
-import org.springframework.beans.factory.InitializingBean;
-
import com.fasterxml.jackson.dataformat.yaml.YAMLMapper;
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
@@ -48,7 +46,7 @@
import dev.dsf.bpe.config.FhirClientConfigYaml.CertificateAuth;
import dev.dsf.bpe.config.FhirClientConfigYaml.OidcAuth;
-public class FhirClientConfigYamlReaderImpl implements InitializingBean, FhirClientConfigYamlReader
+public class FhirClientConfigYamlReaderImpl implements FhirClientConfigYamlReader
{
@FunctionalInterface
private static interface SupplierWithIOException
@@ -82,30 +80,36 @@ public IOException getCause()
private final String defaultOidcDiscoveryPath;
private final boolean defaultOidcVerifyAuthorizedParty;
+ /**
+ * @param defaultTestConnectionOnStartup
+ * not null
+ * @param defaultEnableDebugLogging
+ * not null
+ * @param defaultConnectTimeout
+ * not null
+ * @param defaultReadTimeout
+ * not null
+ * @param defaultTrustStore
+ * not null
+ * @param defaultOidcDiscoveryPath
+ * not null
+ * @param defaultOidcVerifyAuthorizedParty
+ */
public FhirClientConfigYamlReaderImpl(boolean defaultTestConnectionOnStartup, boolean defaultEnableDebugLogging,
Duration defaultConnectTimeout, Duration defaultReadTimeout, KeyStore defaultTrustStore,
String defaultOidcDiscoveryPath, boolean defaultOidcVerifyAuthorizedParty)
{
this.defaultTestConnectionOnStartup = defaultTestConnectionOnStartup;
this.defaultEnableDebugLogging = defaultEnableDebugLogging;
- this.defaultConnectTimeout = defaultConnectTimeout;
- this.defaultReadTimeout = defaultReadTimeout;
- this.defaultTrustStore = defaultTrustStore;
- this.defaultOidcDiscoveryPath = defaultOidcDiscoveryPath != null && !defaultOidcDiscoveryPath.startsWith("/")
- ? ("/" + defaultOidcDiscoveryPath)
+ this.defaultConnectTimeout = Objects.requireNonNull(defaultConnectTimeout, "defaultConnectTimeout");
+ this.defaultReadTimeout = Objects.requireNonNull(defaultReadTimeout, "defaultReadTimeout");
+ this.defaultTrustStore = Objects.requireNonNull(defaultTrustStore, "defaultTrustStore");
+ Objects.requireNonNull(defaultOidcDiscoveryPath, "defaultOidcDiscoveryPath");
+ this.defaultOidcDiscoveryPath = !defaultOidcDiscoveryPath.startsWith("/") ? ("/" + defaultOidcDiscoveryPath)
: defaultOidcDiscoveryPath;
this.defaultOidcVerifyAuthorizedParty = defaultOidcVerifyAuthorizedParty;
}
- @Override
- public void afterPropertiesSet() throws Exception
- {
- Objects.requireNonNull(defaultConnectTimeout, "defaultConnectTimeout");
- Objects.requireNonNull(defaultReadTimeout, "defaultReadTimeout");
- Objects.requireNonNull(defaultTrustStore, "defaultTrustStore");
- Objects.requireNonNull(defaultOidcDiscoveryPath, "defaultOidcDiscoveryPath");
- }
-
@Override
public FhirClientConfigs readConfigs(String yaml) throws IOException, ConfigInvalidException
{
diff --git a/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/dao/AbstractDaoJdbc.java b/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/dao/AbstractDaoJdbc.java
index 5a134bb4a..d8f7123d0 100644
--- a/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/dao/AbstractDaoJdbc.java
+++ b/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/dao/AbstractDaoJdbc.java
@@ -19,20 +19,16 @@
import javax.sql.DataSource;
-import org.springframework.beans.factory.InitializingBean;
-
-public abstract class AbstractDaoJdbc implements InitializingBean
+public abstract class AbstractDaoJdbc
{
protected final DataSource dataSource;
+ /**
+ * @param dataSource
+ * not null
+ */
public AbstractDaoJdbc(DataSource dataSource)
{
- this.dataSource = dataSource;
- }
-
- @Override
- public void afterPropertiesSet() throws Exception
- {
- Objects.requireNonNull(dataSource, "dataSource");
+ this.dataSource = Objects.requireNonNull(dataSource, "dataSource");
}
}
diff --git a/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/dao/LastEventTimeDaoJdbc.java b/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/dao/LastEventTimeDaoJdbc.java
index 36f003512..cb16197cc 100644
--- a/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/dao/LastEventTimeDaoJdbc.java
+++ b/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/dao/LastEventTimeDaoJdbc.java
@@ -27,25 +27,21 @@
import javax.sql.DataSource;
-import org.springframework.beans.factory.InitializingBean;
-
-public class LastEventTimeDaoJdbc extends AbstractDaoJdbc implements LastEventTimeDao, InitializingBean
+public class LastEventTimeDaoJdbc extends AbstractDaoJdbc implements LastEventTimeDao
{
private final String type;
+ /**
+ * @param dataSource
+ * not null
+ * @param type
+ * not null, not blank
+ */
public LastEventTimeDaoJdbc(DataSource dataSource, String type)
{
super(dataSource);
- this.type = type;
- }
-
- @Override
- public void afterPropertiesSet() throws Exception
- {
- super.afterPropertiesSet();
-
- Objects.requireNonNull(type, "type");
+ this.type = Objects.requireNonNull(type, "type");
if (type.isBlank())
throw new IllegalArgumentException("type is blank");
}
diff --git a/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/engine/DelegateProviderImpl.java b/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/engine/DelegateProviderImpl.java
index 2609d7223..ace3e2754 100644
--- a/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/engine/DelegateProviderImpl.java
+++ b/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/engine/DelegateProviderImpl.java
@@ -44,38 +44,27 @@
import org.operaton.bpm.engine.impl.bpmn.parser.FieldDeclaration;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.InitializingBean;
-import org.springframework.context.ApplicationContext;
import dev.dsf.bpe.api.Constants;
import dev.dsf.bpe.api.plugin.ProcessIdAndVersion;
import dev.dsf.bpe.api.plugin.ProcessPlugin;
import dev.dsf.bpe.client.dsf.WebserviceClient;
-public class DelegateProviderImpl implements DelegateProvider, InitializingBean
+public class DelegateProviderImpl implements DelegateProvider
{
private static final Logger logger = LoggerFactory.getLogger(DelegateProviderImpl.class);
- private final ClassLoader defaultClassLoader;
- private final ApplicationContext defaultApplicationContext;
private final WebserviceClient webserviceClient;
private final Map processPluginsByProcessIdAndVersion = new HashMap<>();
- public DelegateProviderImpl(ClassLoader mainClassLoader, ApplicationContext mainApplicationContext,
- WebserviceClient webserviceClient)
- {
- this.defaultClassLoader = mainClassLoader;
- this.defaultApplicationContext = mainApplicationContext;
- this.webserviceClient = webserviceClient;
- }
-
- @Override
- public void afterPropertiesSet() throws Exception
+ /**
+ * @param webserviceClient
+ * not null
+ */
+ public DelegateProviderImpl(WebserviceClient webserviceClient)
{
- Objects.requireNonNull(defaultClassLoader, "defaultClassLoader");
- Objects.requireNonNull(defaultApplicationContext, "defaultApplicationContext");
- Objects.requireNonNull(webserviceClient, "webserviceClient");
+ this.webserviceClient = Objects.requireNonNull(webserviceClient, "webserviceClient");
}
@Override
diff --git a/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/engine/EngineJobExecutor.java b/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/engine/EngineJobExecutor.java
new file mode 100644
index 000000000..c515115ed
--- /dev/null
+++ b/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/engine/EngineJobExecutor.java
@@ -0,0 +1,39 @@
+/*
+ * Copyright 2018-2025 Heilbronn University of Applied Sciences
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package dev.dsf.bpe.engine;
+
+import java.util.concurrent.ArrayBlockingQueue;
+import java.util.concurrent.ThreadPoolExecutor;
+import java.util.concurrent.TimeUnit;
+
+import org.operaton.bpm.engine.impl.jobexecutor.DefaultJobExecutor;
+
+public class EngineJobExecutor extends DefaultJobExecutor
+{
+ @Override
+ protected void startExecutingJobs()
+ {
+ if (threadPoolExecutor == null || threadPoolExecutor.isShutdown())
+ {
+ threadPoolExecutor = new ThreadPoolExecutor(getCorePoolSize(), getMaxPoolSize(), 0L, TimeUnit.MILLISECONDS,
+ new ArrayBlockingQueue<>(getQueueSize()),
+ Thread.ofPlatform().name("process-engine-job-executor-", 0).factory());
+ threadPoolExecutor.setRejectedExecutionHandler(new ThreadPoolExecutor.AbortPolicy());
+ }
+
+ super.startExecutingJobs();
+ }
+}
diff --git a/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/health/WebsocketHealthCheck.java b/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/health/WebsocketHealthCheck.java
new file mode 100644
index 000000000..1f81dd16c
--- /dev/null
+++ b/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/health/WebsocketHealthCheck.java
@@ -0,0 +1,48 @@
+/*
+ * Copyright 2018-2025 Heilbronn University of Applied Sciences
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package dev.dsf.bpe.health;
+
+import java.util.Objects;
+
+import dev.dsf.bpe.subscription.FhirSubscriptionConnector;
+import dev.dsf.common.status.health.HealthCheck;
+import dev.dsf.common.status.health.HealthStatus;
+
+public class WebsocketHealthCheck implements HealthCheck
+{
+ private final String component;
+ private final FhirSubscriptionConnector connector;
+
+ /**
+ * @param component
+ * not null
+ * @param connector
+ * not null
+ */
+ public WebsocketHealthCheck(String component, FhirSubscriptionConnector connector)
+ {
+ this.component = Objects.requireNonNull(component, "component");
+ this.connector = Objects.requireNonNull(connector, "connector");
+ }
+
+ @Override
+ public HealthStatus check()
+ {
+ boolean connected = connector.isConnected();
+
+ return new HealthStatus(component + " Websocket", connected, connected ? "Connected" : "Not connected");
+ }
+}
diff --git a/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/mail/SmtpMailService.java b/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/mail/SmtpMailService.java
index 451a1fd53..5b82b424e 100644
--- a/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/mail/SmtpMailService.java
+++ b/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/mail/SmtpMailService.java
@@ -80,12 +80,11 @@
import org.bouncycastle.operator.OperatorCreationException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.InitializingBean;
import de.hsheilbronn.mi.utils.crypto.context.SSLContextFactory;
import dev.dsf.bpe.api.service.BpeMailService;
-public class SmtpMailService implements BpeMailService, InitializingBean
+public class SmtpMailService implements BpeMailService
{
private static final Logger logger = LoggerFactory.getLogger(SmtpMailService.class);
@@ -227,7 +226,7 @@ public SmtpMailService(String fromAddress, List toAddresses, String mail
/**
* @param fromAddress
- * not null
+ * not null, not blank
* @param toAddresses
* not null, at least one
* @param toAddressesCc
@@ -280,6 +279,11 @@ public SmtpMailService(String fromAddress, List toAddresses, List toInternetAddress(String fromAddress)
@@ -301,15 +305,6 @@ private Optional toInternetAddress(String fromAddress)
}
}
- @Override
- public void afterPropertiesSet() throws Exception
- {
- if (fromAddress == null)
- throw new IllegalArgumentException("no valid from address configured");
- if (toAddresses.length == 0)
- throw new IllegalArgumentException("no valid to addresses configured");
- }
-
private Session createSession(boolean useSmtps, String mailServerHostname, int mailServerPort,
String mailServerUsername, char[] mailServerPassword, KeyStore trustStore, KeyStore keyStore,
char[] keyStorePassword)
diff --git a/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/plugin/BpmnProcessStateChangeServiceImpl.java b/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/plugin/BpmnProcessStateChangeServiceImpl.java
index eea7327a9..19e4dc37a 100644
--- a/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/plugin/BpmnProcessStateChangeServiceImpl.java
+++ b/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/plugin/BpmnProcessStateChangeServiceImpl.java
@@ -47,11 +47,21 @@ public class BpmnProcessStateChangeServiceImpl implements BpmnProcessStateChange
private final Set excluded = new HashSet<>();
private final Set retired = new HashSet<>();
+ /**
+ * @param repositoryService
+ * not null
+ * @param processStateDao
+ * not null
+ * @param excluded
+ * may be null
+ * @param retired
+ * may be null
+ */
public BpmnProcessStateChangeServiceImpl(RepositoryService repositoryService, ProcessStateDao processStateDao,
List excluded, List retired)
{
- this.repositoryService = repositoryService;
- this.processStateDao = processStateDao;
+ this.repositoryService = Objects.requireNonNull(repositoryService, "repositoryService");
+ this.processStateDao = Objects.requireNonNull(processStateDao, "processStateDao");
if (excluded != null)
this.excluded.addAll(excluded);
@@ -62,9 +72,6 @@ public BpmnProcessStateChangeServiceImpl(RepositoryService repositoryService, Pr
@Override
public void afterPropertiesSet() throws Exception
{
- Objects.requireNonNull(repositoryService, "repositoryService");
- Objects.requireNonNull(processStateDao, "processStateDao");
-
logger.info("Excluded processes: {}", excluded);
logger.info("Retired processes: {}", retired);
}
diff --git a/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/plugin/FhirResourceHandlerImpl.java b/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/plugin/FhirResourceHandlerImpl.java
index aa3fa4055..1b5d85308 100644
--- a/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/plugin/FhirResourceHandlerImpl.java
+++ b/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/plugin/FhirResourceHandlerImpl.java
@@ -36,7 +36,6 @@
import org.hl7.fhir.r4.model.ResourceType;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.InitializingBean;
import ca.uhn.fhir.context.FhirContext;
import ca.uhn.fhir.parser.IParser;
@@ -46,7 +45,7 @@
import dev.dsf.bpe.client.dsf.WebserviceClient;
import dev.dsf.bpe.dao.ProcessPluginResourcesDao;
-public class FhirResourceHandlerImpl implements FhirResourceHandler, InitializingBean
+public class FhirResourceHandlerImpl implements FhirResourceHandler
{
private static final Logger logger = LoggerFactory.getLogger(FhirResourceHandlerImpl.class);
@@ -56,25 +55,28 @@ public class FhirResourceHandlerImpl implements FhirResourceHandler, Initializin
private final int fhirServerRequestMaxRetries;
private final Duration fhirServerRetryDelay;
+ /**
+ * @param localWebserviceClient
+ * not null
+ * @param dao
+ * not null
+ * @param fhirContext
+ * not null
+ * @param fhirServerRequestMaxRetries
+ * >= -1
+ * @param fhirServerRetryDelay
+ * not null
+ */
public FhirResourceHandlerImpl(WebserviceClient localWebserviceClient, ProcessPluginResourcesDao dao,
FhirContext fhirContext, int fhirServerRequestMaxRetries, Duration fhirServerRetryDelay)
{
- this.localWebserviceClient = localWebserviceClient;
- this.dao = dao;
- this.fhirContext = fhirContext;
- this.fhirServerRequestMaxRetries = fhirServerRequestMaxRetries;
- this.fhirServerRetryDelay = fhirServerRetryDelay;
- }
-
- @Override
- public void afterPropertiesSet() throws Exception
- {
- Objects.requireNonNull(localWebserviceClient, "localWebserviceClient");
- Objects.requireNonNull(dao, "dao");
- Objects.requireNonNull(fhirContext, "fhirContext");
+ this.localWebserviceClient = Objects.requireNonNull(localWebserviceClient, "localWebserviceClient");
+ this.dao = Objects.requireNonNull(dao, "dao");
+ this.fhirContext = Objects.requireNonNull(fhirContext, "fhirContext");
if (fhirServerRequestMaxRetries < -1)
throw new IllegalArgumentException("fhirServerRequestMaxRetries < -1");
- Objects.requireNonNull(fhirServerRetryDelay, "fhirServerRetryDelay");
+ this.fhirServerRequestMaxRetries = fhirServerRequestMaxRetries;
+ this.fhirServerRetryDelay = Objects.requireNonNull(fhirServerRetryDelay, "fhirServerRetryDelay");
}
private PreferReturnMinimal minimalReturnRetryClient()
diff --git a/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/plugin/ProcessPluginApiClassLoaderFactory.java b/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/plugin/ProcessPluginApiClassLoaderFactory.java
index 341fc2642..76c8e8fb1 100644
--- a/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/plugin/ProcessPluginApiClassLoaderFactory.java
+++ b/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/plugin/ProcessPluginApiClassLoaderFactory.java
@@ -35,9 +35,8 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.InitializingBean;
-public class ProcessPluginApiClassLoaderFactory implements InitializingBean
+public class ProcessPluginApiClassLoaderFactory
{
private static final Logger logger = LoggerFactory.getLogger(ProcessPluginApiClassLoaderFactory.class);
@@ -51,10 +50,20 @@ public class ProcessPluginApiClassLoaderFactory implements InitializingBean
private final Map resourcesWithPriority = new HashMap<>();
private final Map allowedBpeResources = new HashMap<>();
+ /**
+ * @param apiClassPathBaseDirectory
+ * not null
+ * @param allowedBpeClasses
+ * may be null
+ * @param resourcesWithPriority
+ * may be null
+ * @param allowedBpeResources
+ * may be null
+ */
public ProcessPluginApiClassLoaderFactory(Path apiClassPathBaseDirectory, Map allowedBpeClasses,
Map resourcesWithPriority, Map allowedBpeResources)
{
- this.apiClassPathBaseDirectory = apiClassPathBaseDirectory;
+ this.apiClassPathBaseDirectory = Objects.requireNonNull(apiClassPathBaseDirectory, "apiClassPathBaseDirectory");
if (allowedBpeClasses != null)
this.allowedBpeClasses.putAll(allowedBpeClasses);
@@ -64,13 +73,6 @@ public ProcessPluginApiClassLoaderFactory(Path apiClassPathBaseDirectory, Map getApiClassPath(int apiVersion)
{
Path apiClassPathDirectory = apiClassPathBaseDirectory.resolve("v" + apiVersion);
diff --git a/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/plugin/ProcessPluginApiFactory.java b/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/plugin/ProcessPluginApiFactory.java
index 95b0b7ad9..036743827 100644
--- a/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/plugin/ProcessPluginApiFactory.java
+++ b/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/plugin/ProcessPluginApiFactory.java
@@ -24,7 +24,6 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeansException;
-import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.support.DefaultListableBeanFactory;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
@@ -40,7 +39,7 @@
import dev.dsf.bpe.api.service.BpeOidcClientProvider;
import dev.dsf.bpe.api.service.BuildInfoProvider;
-public class ProcessPluginApiFactory implements InitializingBean
+public class ProcessPluginApiFactory
{
private static final Logger logger = LoggerFactory.getLogger(ProcessPluginApiFactory.class);
@@ -60,37 +59,44 @@ public class ProcessPluginApiFactory implements InitializingBean
private final ProcessPluginApiClassLoaderFactory classLoaderFactory;
private final String serverBaseUrl;
+ /**
+ * @param environment
+ * not null
+ * @param dsfClientConfig
+ * not null
+ * @param fhirClientConfigs
+ * not null
+ * @param bpeProxyConfig
+ * not null
+ * @param fhirValidationConfig
+ * not null
+ * @param buildInfoProvider
+ * not null
+ * @param bpeMailService
+ * not null
+ * @param bpeOidcClientProvider
+ * not null
+ * @param classLoaderFactory
+ * not null
+ * @param serverBaseUrl
+ * not null
+ */
public ProcessPluginApiFactory(ConfigurableEnvironment environment, DsfClientConfig dsfClientConfig,
FhirClientConfigs fhirClientConfigs, BpeProxyConfig bpeProxyConfig,
FhirValidationConfig fhirValidationConfig, BuildInfoProvider buildInfoProvider,
BpeMailService bpeMailService, BpeOidcClientProvider bpeOidcClientProvider,
ProcessPluginApiClassLoaderFactory classLoaderFactory, String serverBaseUrl)
{
- this.environment = environment;
- this.dsfClientConfig = dsfClientConfig;
- this.fhirClientConfigs = fhirClientConfigs;
- this.bpeProxyConfig = bpeProxyConfig;
- this.fhirValidationConfig = fhirValidationConfig;
- this.buildInfoProvider = buildInfoProvider;
- this.bpeMailService = bpeMailService;
- this.bpeOidcClientProvider = bpeOidcClientProvider;
- this.classLoaderFactory = classLoaderFactory;
- this.serverBaseUrl = serverBaseUrl;
- }
-
- @Override
- public void afterPropertiesSet() throws Exception
- {
- Objects.requireNonNull(environment, "environment");
- Objects.requireNonNull(dsfClientConfig, "dsfClientConfig");
- Objects.requireNonNull(fhirClientConfigs, "fhirClientConfigs");
- Objects.requireNonNull(bpeProxyConfig, "bpeProxyConfig");
- Objects.requireNonNull(fhirValidationConfig, "fhirValidationConfig");
- Objects.requireNonNull(buildInfoProvider, "buildInfoProvider");
- Objects.requireNonNull(bpeMailService, "bpeMailService");
- Objects.requireNonNull(bpeOidcClientProvider, "bpeOidcClientProvider");
- Objects.requireNonNull(classLoaderFactory, "classLoaderFactory");
- Objects.requireNonNull(serverBaseUrl, "serverBaseUrl");
+ this.environment = Objects.requireNonNull(environment, "environment");
+ this.dsfClientConfig = Objects.requireNonNull(dsfClientConfig, "dsfClientConfig");
+ this.fhirClientConfigs = Objects.requireNonNull(fhirClientConfigs, "fhirClientConfigs");
+ this.bpeProxyConfig = Objects.requireNonNull(bpeProxyConfig, "bpeProxyConfig");
+ this.fhirValidationConfig = Objects.requireNonNull(fhirValidationConfig, "fhirValidationConfig");
+ this.buildInfoProvider = Objects.requireNonNull(buildInfoProvider, "buildInfoProvider");
+ this.bpeMailService = Objects.requireNonNull(bpeMailService, "bpeMailService");
+ this.bpeOidcClientProvider = Objects.requireNonNull(bpeOidcClientProvider, "bpeOidcClientProvider");
+ this.classLoaderFactory = Objects.requireNonNull(classLoaderFactory, "classLoaderFactory");
+ this.serverBaseUrl = Objects.requireNonNull(serverBaseUrl, "serverBaseUrl");
}
public List initialize()
diff --git a/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/plugin/ProcessPluginLoaderImpl.java b/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/plugin/ProcessPluginLoaderImpl.java
index 1789a2daa..a090cf80e 100644
--- a/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/plugin/ProcessPluginLoaderImpl.java
+++ b/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/plugin/ProcessPluginLoaderImpl.java
@@ -28,12 +28,11 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.InitializingBean;
import dev.dsf.bpe.api.plugin.ProcessPlugin;
import dev.dsf.bpe.api.plugin.ProcessPluginFactory;
-public class ProcessPluginLoaderImpl implements ProcessPluginLoader, InitializingBean
+public class ProcessPluginLoaderImpl implements ProcessPluginLoader
{
private static final Logger logger = LoggerFactory.getLogger(ProcessPluginLoaderImpl.class);
@@ -42,6 +41,14 @@ public class ProcessPluginLoaderImpl implements ProcessPluginLoader, Initializin
private final Path pluginDirectory;
private final List explodedPluginDirectories = new ArrayList<>();
+ /**
+ * @param processPluginFactories
+ * may be null
+ * @param pluginDirectory
+ * not null
+ * @param explodedPluginDirectories
+ * may be null
+ */
public ProcessPluginLoaderImpl(Collection extends ProcessPluginFactory> processPluginFactories,
Path pluginDirectory, Collection extends Path> explodedPluginDirectories)
{
@@ -51,17 +58,11 @@ public ProcessPluginLoaderImpl(Collection extends ProcessPluginFactory> proces
this.processPluginFactories.sort(Comparator.comparingInt(ProcessPluginFactory::getApiVersion).reversed());
}
- this.pluginDirectory = pluginDirectory;
+ this.pluginDirectory = Objects.requireNonNull(pluginDirectory, "pluginDirectory");
if (explodedPluginDirectories != null)
this.explodedPluginDirectories.addAll(explodedPluginDirectories);
}
- @Override
- public void afterPropertiesSet() throws Exception
- {
- Objects.requireNonNull(pluginDirectory, "pluginDirectory");
- }
-
@Override
public List loadPlugins()
{
diff --git a/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/plugin/ProcessPluginManagerImpl.java b/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/plugin/ProcessPluginManagerImpl.java
index 2c67ac65b..2db4af328 100644
--- a/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/plugin/ProcessPluginManagerImpl.java
+++ b/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/plugin/ProcessPluginManagerImpl.java
@@ -39,7 +39,6 @@
import org.hl7.fhir.r4.model.Organization;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.InitializingBean;
import dev.dsf.bpe.api.plugin.BpmnFileAndModel;
import dev.dsf.bpe.api.plugin.ProcessIdAndVersion;
@@ -48,7 +47,7 @@
import dev.dsf.bpe.client.dsf.WebserviceClient;
import dev.dsf.bpe.engine.ProcessPluginConsumer;
-public class ProcessPluginManagerImpl implements ProcessPluginManager, InitializingBean
+public class ProcessPluginManagerImpl implements ProcessPluginManager
{
private static final Logger logger = LoggerFactory.getLogger(ProcessPluginManagerImpl.class);
@@ -71,6 +70,24 @@ private static record ProcessByIdAndVersion(ProcessIdAndVersion idAndVersion, Pr
private Map pluginsByProcessIdAndVersion;
+ /**
+ * @param processPluginConsumers
+ * may be null
+ * @param processPluginLoader
+ * not null
+ * @param bpmnProcessStateChangeService
+ * not null
+ * @param fhirResourceHandler
+ * not null
+ * @param localEndpointAddress
+ * not null
+ * @param localWebserviceClient
+ * not null
+ * @param fhirServerRequestMaxRetries
+ * >= -1
+ * @param fhirServerRetryDelay
+ * not null
+ */
public ProcessPluginManagerImpl(List processPluginConsumers,
ProcessPluginLoader processPluginLoader, BpmnProcessStateChangeService bpmnProcessStateChangeService,
FhirResourceHandler fhirResourceHandler, String localEndpointAddress,
@@ -79,29 +96,17 @@ public ProcessPluginManagerImpl(List processPluginConsume
if (processPluginConsumers != null)
this.processPluginConsumers.addAll(processPluginConsumers);
- this.processPluginLoader = processPluginLoader;
- this.bpmnProcessStateChangeService = bpmnProcessStateChangeService;
- this.fhirResourceHandler = fhirResourceHandler;
-
- this.localEndpointAddress = localEndpointAddress;
- this.localWebserviceClient = localWebserviceClient;
- this.fhirServerRequestMaxRetries = fhirServerRequestMaxRetries;
- this.fhirServerRetryDelay = fhirServerRetryDelay;
- }
-
- @Override
- public void afterPropertiesSet() throws Exception
- {
- Objects.requireNonNull(processPluginLoader, "processPluginLoader");
- Objects.requireNonNull(bpmnProcessStateChangeService, "bpmnProcessStateChangeService");
- Objects.requireNonNull(fhirResourceHandler, "fhirResourceHandler");
-
- Objects.requireNonNull(localEndpointAddress, "localEndpointAddress");
- Objects.requireNonNull(localWebserviceClient, "localWebserviceClient");
+ this.processPluginLoader = Objects.requireNonNull(processPluginLoader, "processPluginLoader");
+ this.bpmnProcessStateChangeService = Objects.requireNonNull(bpmnProcessStateChangeService,
+ "bpmnProcessStateChangeService");
+ this.fhirResourceHandler = Objects.requireNonNull(fhirResourceHandler, "fhirResourceHandler");
+ this.localEndpointAddress = Objects.requireNonNull(localEndpointAddress, "localEndpointAddress");
+ this.localWebserviceClient = Objects.requireNonNull(localWebserviceClient, "localWebserviceClient");
if (fhirServerRequestMaxRetries < -1)
throw new IllegalArgumentException("fhirServerRequestMaxRetries < -1");
- Objects.requireNonNull(fhirServerRetryDelay, "fhirServerRetryDelay");
+ this.fhirServerRequestMaxRetries = fhirServerRequestMaxRetries;
+ this.fhirServerRetryDelay = Objects.requireNonNull(fhirServerRetryDelay, "fhirServerRetryDelay");
}
@Override
diff --git a/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/service/LocalOrganizationAndEndpointProviderImpl.java b/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/service/LocalOrganizationAndEndpointProviderImpl.java
index 51431819c..4e859ab94 100644
--- a/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/service/LocalOrganizationAndEndpointProviderImpl.java
+++ b/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/service/LocalOrganizationAndEndpointProviderImpl.java
@@ -28,11 +28,10 @@
import org.hl7.fhir.r4.model.Organization;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.InitializingBean;
import dev.dsf.bpe.client.dsf.ClientProvider;
-public class LocalOrganizationAndEndpointProviderImpl implements LocalOrganizationAndEndpointProvider, InitializingBean
+public class LocalOrganizationAndEndpointProviderImpl implements LocalOrganizationAndEndpointProvider
{
private static final Logger logger = LoggerFactory.getLogger(LocalOrganizationAndEndpointProviderImpl.class);
@@ -53,17 +52,9 @@ private record Entry(Optional organizationAndEndpoint,
public LocalOrganizationAndEndpointProviderImpl(TemporalAmount cacheTimeout, ClientProvider clientProvider,
String localEndpointAddress)
{
- this.cacheTimeout = cacheTimeout;
- this.clientProvider = clientProvider;
- this.localEndpointAddress = localEndpointAddress;
- }
-
- @Override
- public void afterPropertiesSet() throws Exception
- {
- Objects.requireNonNull(cacheTimeout, "cacheTimeout");
- Objects.requireNonNull(clientProvider, "clientProvider");
- Objects.requireNonNull(localEndpointAddress, "localEndpointAddress");
+ this.cacheTimeout = Objects.requireNonNull(cacheTimeout, "cacheTimeout");
+ this.clientProvider = Objects.requireNonNull(clientProvider, "clientProvider");
+ this.localEndpointAddress = Objects.requireNonNull(localEndpointAddress, "localEndpointAddress");
}
@Override
diff --git a/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/spring/config/DsfClientConfig.java b/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/spring/config/DsfClientConfig.java
index 0104577ce..ec833a9fa 100644
--- a/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/spring/config/DsfClientConfig.java
+++ b/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/spring/config/DsfClientConfig.java
@@ -60,13 +60,13 @@ public void afterPropertiesSet() throws Exception
: "disabled");
logger.info(
"Local DSF websocket client config: {trustStorePath: {}, certificatePath: {}, privateKeyPath: {}, privateKeyPassword: {},"
- + " url: {}, proxy: {}}",
+ + " url: {}, proxy: {}, timeConfig: {}}",
propertiesConfig.getDsfClientTrustedServerCasFileOrFolder(),
propertiesConfig.getDsfClientCertificateFile(),
propertiesConfig.getDsfClientCertificatePrivateKeyFile(),
propertiesConfig.getDsfClientCertificatePrivateKeyFilePassword() != null ? "***" : "null",
- getWebsocketUrl(),
- propertiesConfig.proxyConfig().isEnabled(getWebsocketUrl()) ? "enabled" : "disabled");
+ getWebsocketUrl(), propertiesConfig.proxyConfig().isEnabled(getWebsocketUrl()) ? "enabled" : "disabled",
+ propertiesConfig.getWebsocketTimeConfig().toString());
logger.info(
"Remote DSF webservice client config: {trustStorePath: {}, certificatePath: {}, privateKeyPath: {}, privateKeyPassword: {},"
@@ -96,8 +96,8 @@ public ClientProvider clientProvider()
return new ClientProviderImpl(fhirConfig.fhirContext(), propertiesConfig.getDsfServerBaseUrl(),
propertiesConfig.getDsfClientReadTimeoutLocal(), propertiesConfig.getDsfClientConnectTimeoutLocal(),
propertiesConfig.getDsfClientVerboseLocal(), trustStore, keyStore, keyStorePassword, getWebsocketUrl(),
- trustStore, keyStore, keyStorePassword, propertiesConfig.proxyConfig(),
- buildInfoReaderConfig.buildInfoReader().getUserAgentValue());
+ propertiesConfig.getWebsocketTimeConfig(), trustStore, keyStore, keyStorePassword,
+ propertiesConfig.proxyConfig(), buildInfoReaderConfig.buildInfoReader().getUserAgentValue());
}
private String getWebsocketUrl()
diff --git a/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/spring/config/OperatonConfig.java b/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/spring/config/OperatonConfig.java
index 8df72c79c..8c28d7369 100755
--- a/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/spring/config/OperatonConfig.java
+++ b/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/spring/config/OperatonConfig.java
@@ -22,13 +22,11 @@
import org.apache.commons.dbcp2.BasicDataSource;
import org.operaton.bpm.engine.ProcessEngine;
-import org.operaton.bpm.engine.impl.jobexecutor.DefaultJobExecutor;
import org.operaton.bpm.engine.impl.persistence.StrongUuidGenerator;
import org.operaton.bpm.engine.spring.ProcessEngineFactoryBean;
import org.operaton.bpm.engine.spring.SpringProcessEngineConfiguration;
import org.postgresql.Driver;
import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.jdbc.datasource.DataSourceTransactionManager;
@@ -38,6 +36,7 @@
import dev.dsf.bpe.api.plugin.ProcessPluginFactory;
import dev.dsf.bpe.engine.DelegateProvider;
import dev.dsf.bpe.engine.DelegateProviderImpl;
+import dev.dsf.bpe.engine.EngineJobExecutor;
import dev.dsf.bpe.engine.FallbackSerializerFactory;
import dev.dsf.bpe.engine.FallbackSerializerFactoryImpl;
import dev.dsf.bpe.engine.MultiVersionSpringProcessEngineConfiguration;
@@ -51,9 +50,6 @@ public class OperatonConfig
@Autowired
private PropertiesConfig propertiesConfig;
- @Autowired
- private ApplicationContext applicationContext;
-
@Autowired
private List processPluginFactories;
@@ -131,7 +127,7 @@ public SpringProcessEngineConfiguration processEngineConfiguration()
processPluginFactories.stream().flatMap(ProcessPluginFactory::getSerializer).toList());
c.setFallbackSerializerFactory(fallbackSerializerFactory());
- DefaultJobExecutor jobExecutor = new DefaultJobExecutor();
+ EngineJobExecutor jobExecutor = new EngineJobExecutor();
jobExecutor.setCorePoolSize(propertiesConfig.getProcessEngineJobExecutorCorePoolSize());
jobExecutor.setQueueSize(propertiesConfig.getProcessEngineJobExecutorQueueSize());
jobExecutor.setMaxPoolSize(propertiesConfig.getProcessEngineJobExecutorMaxPoolSize());
@@ -151,8 +147,7 @@ public FallbackSerializerFactory fallbackSerializerFactory()
@Bean
public DelegateProvider delegateProvider()
{
- return new DelegateProviderImpl(ClassLoader.getSystemClassLoader(), applicationContext,
- dsfClientConfig.clientProvider().getWebserviceClient());
+ return new DelegateProviderImpl(dsfClientConfig.clientProvider().getWebserviceClient());
}
@Bean
diff --git a/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/spring/config/PostStartupConfig.java b/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/spring/config/PostStartupConfig.java
index 319ff655d..d159b557f 100644
--- a/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/spring/config/PostStartupConfig.java
+++ b/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/spring/config/PostStartupConfig.java
@@ -43,12 +43,12 @@ public void onContextRefreshedEvent()
pluginConfig.processPluginManager().loadAndDeployPlugins();
logger.info("Deploying process plugins [Done]");
- logger.info("Starting process engine ...");
+ logger.info("Starting process engine JobExecutor ...");
operatonConfig.processEngineConfiguration().getJobExecutor().start();
- logger.info("Starting process engine [Done]");
+ logger.info("Starting process engine JobExecutor [Done]");
- fhirConfig.fhirConnectorTask().connect();
- fhirConfig.fhirConnectorQuestionnaireResponse().connect();
+ fhirConfig.taskFhirConnector().connect();
+ fhirConfig.questionnaireResponseFhirConnector().connect();
// websocket connect is an async operation
}
}
diff --git a/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/spring/config/PropertiesConfig.java b/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/spring/config/PropertiesConfig.java
index 2336cb024..8763e341a 100644
--- a/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/spring/config/PropertiesConfig.java
+++ b/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/spring/config/PropertiesConfig.java
@@ -56,6 +56,7 @@
import dev.dsf.common.docker.secrets.DockerSecretsPropertySourceFactory;
import dev.dsf.common.documentation.Documentation;
import dev.dsf.common.ui.theme.Theme;
+import dev.dsf.fhir.client.WebsocketClientJetty.TimeConfig;
@Configuration
@PropertySource(value = "file:conf/config.properties", encoding = "UTF-8", ignoreResourceNotFound = true)
@@ -118,11 +119,11 @@ public class PropertiesConfig extends AbstractCertificateAndProxyConfig implemen
@Value("${dev.dsf.bpe.fhir.client.certificate.private.key.password:#{null}}")
private char[] dsfClientCertificatePrivateKeyFilePassword;
- @Documentation(description = "Timeout until a reading a resource from a remote DSF FHIR server is aborted", recommendation = "Change default value only if timeout exceptions occur")
+ @Documentation(description = "Timeout until a reading a resource from a remote DSF FHIR server is aborted, not negative, 0 represents infinity", recommendation = "Change default value only if timeout exceptions occur")
@Value("${dev.dsf.bpe.fhir.client.remote.timeout.read:PT60S}")
private String dsfClientReadTimeoutRemote;
- @Documentation(description = "Timeout until a connection is established with a remote DSF FHIR server", recommendation = "Change default value only if timeout exceptions occur")
+ @Documentation(description = "Timeout until a connection is established with a remote DSF FHIR server, not negative, 0 represents infinity", recommendation = "Change default value only if timeout exceptions occur")
@Value("${dev.dsf.bpe.fhir.client.remote.timeout.connect:PT5S}")
private String dsfClientConnectTimeoutRemote;
@@ -130,11 +131,11 @@ public class PropertiesConfig extends AbstractCertificateAndProxyConfig implemen
@Value("${dev.dsf.bpe.fhir.client.remote.verbose:false}")
private boolean dsfClientVerboseRemote;
- @Documentation(description = "Timeout until reading a resource from the local DSF FHIR server is aborted", recommendation = "Change default value only if timeout exceptions occur")
+ @Documentation(description = "Timeout until reading a resource from the local DSF FHIR server is aborted, not negative, 0 represents infinity", recommendation = "Change default value only if timeout exceptions occur")
@Value("${dev.dsf.bpe.fhir.client.local.timeout.read:PT60S}")
private String dsfClientReadTimeoutLocal;
- @Documentation(description = "Timeout until a connection is established with the local DSF FHIR server", recommendation = "Change default value only if timeout exceptions occur")
+ @Documentation(description = "Timeout until a connection is established with the local DSF FHIR server, not negative, 0 represents infinity", recommendation = "Change default value only if timeout exceptions occur")
@Value("${dev.dsf.bpe.fhir.client.local.timeout.connect:PT2S}")
private String dsfClientConnectTimeoutLocal;
@@ -162,11 +163,11 @@ public class PropertiesConfig extends AbstractCertificateAndProxyConfig implemen
@Value("${dev.dsf.bpe.fhir.client.connections.config.default.oidc.verify.authorized.party:true}")
private boolean fhirClientConnectionsConfigDefaultOidcVerifyAuthorizedParty;
- @Documentation(description = "FHIR server connections YAML: Default value for properties `connect-timeout` and `oidc-auth.connect-timeout`")
+ @Documentation(description = "FHIR server connections YAML: Default value for properties `connect-timeout` and `oidc-auth.connect-timeout`, not negative, 0 represents infinity")
@Value("${dev.dsf.bpe.fhir.client.connections.config.default.timeout.connect:PT2S}")
private String fhirClientConnectionsConfigDefaultConnectTimeout;
- @Documentation(description = "FHIR server connections YAML: Default value for properties `read-timeout` and `oidc-auth.read-timeout`")
+ @Documentation(description = "FHIR server connections YAML: Default value for properties `read-timeout` and `oidc-auth.read-timeout`, not negative, 0 represents infinity")
@Value("${dev.dsf.bpe.fhir.client.connections.config.default.timeout.read:PT10M}")
private String fhirClientConnectionsConfigDefaultReadTimeout;
@@ -182,37 +183,57 @@ public class PropertiesConfig extends AbstractCertificateAndProxyConfig implemen
@Value("${dev.dsf.bpe.fhir.client.connections.config.oidc.cache:true}")
private boolean fhirClientConnectionsConfigOidcClientCacheEnabled;
- @Documentation(description = "OIDC 'Client Credentials Grant' client cache timeout of the 'openid-configuration' discovery resource")
+ @Documentation(description = "OIDC 'Client Credentials Grant' client cache timeout of the 'openid-configuration' discovery resource, not negative")
@Value("${dev.dsf.bpe.fhir.client.connections.config.oidc.cache.timeout.configuration.resource:PT1H}")
private String fhirClientConnectionsConfigOidcClientCacheConfigurationResourceTimeout;
- @Documentation(description = "OIDC 'Client Credentials Grant' client cache timeout of the jwks resource")
+ @Documentation(description = "OIDC 'Client Credentials Grant' client cache timeout of the jwks resource, not negative")
@Value("${dev.dsf.bpe.fhir.client.connections.config.oidc.cache.timeout.jwks.resource:PT1H}")
private String fhirClientConnectionsConfigOidcClientCacheJwksResourceTimeout;
- @Documentation(description = "OIDC 'Client Credentials Grant' client cache timeout of access tokens before they expire, duration is subtracted from the expires at value of the access token")
+ @Documentation(description = "OIDC 'Client Credentials Grant' client cache timeout of access tokens before they expire, duration is subtracted from the expires at value of the access token, not negative")
@Value("${dev.dsf.bpe.fhir.client.connections.config.oidc.cache.timeout.access.token:PT10S}")
private String fhirClientConnectionsConfigOidcClientCacheAccessTokenBeforeExpirationTimeout;
- @Documentation(description = "OIDC 'Client Credentials Grant' client access token time validation leeway for 'Not Before', 'Issued At' and 'Expires At' values")
+ @Documentation(description = "OIDC 'Client Credentials Grant' client access token time validation leeway for 'Not Before', 'Issued At' and 'Expires At' values, not negative")
@Value("${dev.dsf.bpe.fhir.client.connections.config.oidc.time.validation.leeway:PT10S}")
private String fhirClientConnectionsConfigOidcClientNotBeforeIssuedAtExpiresAtLeeway;
@Documentation(description = "Subscription to receive notifications about task resources from the DSF FHIR server")
- @Value("${dev.dsf.bpe.fhir.task.subscription.search.parameter:?criteria:exact=Task%3Fstatus%3Drequested&status=active&type=websocket&payload=application/fhir%2Bjson}")
+ @Value("${dev.dsf.bpe.fhir.subscription.task.search.parameter:?criteria:exact=Task%3Fstatus%3Drequested&status=active&type=websocket&payload=application/fhir%2Bjson}")
private String taskSubscriptionSearchParameter;
@Documentation(description = "Subscription to receive notifications about questionnaire response resources from the DSF FHIR server")
- @Value("${dev.dsf.bpe.fhir.questionnaire.response.subscription.search.parameter:?criteria:exact=QuestionnaireResponse%3Fstatus%3Dcompleted&status=active&type=websocket&payload=application/fhir%2Bjson}")
+ @Value("${dev.dsf.bpe.fhir.subscription.questionnaireresponse.search.parameter:?criteria:exact=QuestionnaireResponse%3Fstatus%3Dcompleted&status=active&type=websocket&payload=application/fhir%2Bjson}")
private String questionnaireResponseSubscriptionSearchParameter;
- @Documentation(description = "Number of retries until a websocket connection can be established with the DSF FHIR server, `-1` means infinite number of retries")
- @Value("${dev.dsf.bpe.fhir.task.subscription.retry.max:-1}")
- private int websocketMaxRetries;
+ @Documentation(description = "Time between sending websocket ping frames to the DSF FHIR server")
+ @Value("${dev.dsf.bpe.fhir.subscription.ping.frame.interval:PT20S}")
+ private String websocketPingInterval;
- @Documentation(description = "Time between two retries to establish a websocket connection with the DSF FHIR server")
- @Value("${dev.dsf.bpe.fhir.task.subscription.retry.sleep:PT5S}")
- private String websocketRetrySleep;
+ @Documentation(description = "Timeout until a websocket pong frame is considered missing, and a reconnect is being initiated")
+ @Value("${dev.dsf.bpe.fhir.subscription.pong.frame.timeout:PT2S}")
+ private String websocketPongTimeout;
+
+ @Documentation(description = "Initial reconnect delay before a websocket connection is reestablished")
+ @Value("${dev.dsf.bpe.fhir.subscription.reconnect.delay.initial:PT1S}")
+ private String websocketReconnectDelayInitial;
+
+ @Documentation(description = "Linear increase applied to the initial reconnect delay for each subsequent attempt")
+ @Value("${dev.dsf.bpe.fhir.subscription.reconnect.delay.increment:PT0.250S}")
+ private String websocketReconnectIncrement;
+
+ @Documentation(description = "Maximal reconnect delay between consecutive websocket reconnect attempts")
+ @Value("${dev.dsf.bpe.fhir.subscription.reconnect.delay.max:PT20S}")
+ private String websocketReconnectDelayMax;
+
+ @Documentation(description = "Timeout used for the nominal websocket connection shutdown")
+ @Value("${dev.dsf.bpe.fhir.subscription.close.timeout:PT2S}")
+ private String websocketCloseTimeout;
+
+ @Documentation(description = "Set to `false` to exclude WebSocket connection checks from the status webservice (e.g., Docker health checks)")
+ @Value("${dev.dsf.bpe.fhir.subscription.health.check:true}")
+ private boolean websocketHealthCheck;
@Documentation(description = "Directory containing the DSF BPE process plugins for deployment on startup of the DSF BPE server", recommendation = "Change only if you don't use the provided directory structure from the installation guide or made changes to tit")
@Value("${dev.dsf.bpe.process.plugin.directory:process}")
@@ -712,14 +733,9 @@ public String getQuestionnaireResponseSubscriptionSearchParameter()
return questionnaireResponseSubscriptionSearchParameter;
}
- public Duration getWebsocketRetrySleepMillis()
+ public boolean getWebsocketHealthCheck()
{
- return Duration.parse(websocketRetrySleep);
- }
-
- public int getWebsocketMaxRetries()
- {
- return websocketMaxRetries;
+ return websocketHealthCheck;
}
public Path getProcessPluginDirectory()
@@ -1003,4 +1019,12 @@ public boolean getFhirValidationEnabled()
{
return fhirValidationEnabled;
}
+
+ public TimeConfig getWebsocketTimeConfig()
+ {
+ return new TimeConfig(getDsfClientConnectTimeoutLocal(), getDsfClientReadTimeoutLocal(),
+ Duration.parse(websocketPingInterval), Duration.parse(websocketPongTimeout),
+ Duration.parse(websocketReconnectDelayInitial), Duration.parse(websocketReconnectIncrement),
+ Duration.parse(websocketReconnectDelayMax), Duration.parse(websocketCloseTimeout));
+ }
}
diff --git a/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/spring/config/WebserviceConfig.java b/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/spring/config/WebserviceConfig.java
index ef0519239..7e192d690 100755
--- a/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/spring/config/WebserviceConfig.java
+++ b/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/spring/config/WebserviceConfig.java
@@ -17,6 +17,7 @@
import java.nio.file.Files;
import java.nio.file.Paths;
+import java.util.List;
import org.operaton.bpm.engine.ProcessEngine;
import org.springframework.beans.factory.annotation.Autowired;
@@ -28,6 +29,8 @@
import dev.dsf.bpe.webservice.ProcessService;
import dev.dsf.bpe.webservice.RootService;
import dev.dsf.common.auth.logout.LogoutService;
+import dev.dsf.common.db.health.DatabaseHealthCheck;
+import dev.dsf.common.status.health.HealthCheck;
import dev.dsf.common.status.webservice.StatusService;
import dev.dsf.common.ui.webservice.StaticResourcesService;
@@ -43,6 +46,9 @@ public class WebserviceConfig
@Autowired
private PropertiesConfig propertiesConfig;
+ @Autowired
+ private WebsocketConfig websocketConfig;
+
@Bean
public ThymeleafTemplateService thymeleafTemplateService()
{
@@ -83,6 +89,11 @@ public StaticResourcesService staticResourcesService()
@Bean
public StatusService statusService()
{
- return new StatusService(daoConfig.dataSource(), propertiesConfig.getJettyStatusConnectorPort());
+ List healthChecks = propertiesConfig.getWebsocketHealthCheck()
+ ? List.of(new DatabaseHealthCheck(daoConfig.dataSource()), websocketConfig.taskWebsocketHealthCheck(),
+ websocketConfig.questionnaireResponseWebsocketHealthCheck())
+ : List.of(new DatabaseHealthCheck(daoConfig.dataSource()));
+
+ return new StatusService(propertiesConfig.getJettyStatusConnectorPort(), healthChecks);
}
}
diff --git a/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/spring/config/WebsocketConfig.java b/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/spring/config/WebsocketConfig.java
index c9f1b8c7e..5e33b9d25 100644
--- a/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/spring/config/WebsocketConfig.java
+++ b/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/spring/config/WebsocketConfig.java
@@ -15,25 +15,37 @@
*/
package dev.dsf.bpe.spring.config;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.LinkedBlockingQueue;
+import java.util.concurrent.ThreadPoolExecutor;
+import java.util.concurrent.TimeUnit;
+
import org.hl7.fhir.r4.model.QuestionnaireResponse;
import org.hl7.fhir.r4.model.Task;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.config.ConfigurableBeanFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
+import org.springframework.context.annotation.Scope;
-import dev.dsf.bpe.subscription.ConcurrentSubscriptionHandlerFactory;
-import dev.dsf.bpe.subscription.LocalFhirConnector;
-import dev.dsf.bpe.subscription.LocalFhirConnectorImpl;
+import dev.dsf.bpe.health.WebsocketHealthCheck;
+import dev.dsf.bpe.subscription.FhirSubscriptionConnector;
+import dev.dsf.bpe.subscription.FhirSubscriptionConnectorImpl;
import dev.dsf.bpe.subscription.QuestionnaireResponseHandler;
import dev.dsf.bpe.subscription.QuestionnaireResponseSubscriptionHandlerFactory;
import dev.dsf.bpe.subscription.ResourceHandler;
import dev.dsf.bpe.subscription.SubscriptionHandlerFactory;
import dev.dsf.bpe.subscription.TaskHandler;
import dev.dsf.bpe.subscription.TaskSubscriptionHandlerFactory;
+import dev.dsf.common.status.health.HealthCheck;
@Configuration
public class WebsocketConfig
{
+ private static final Logger logger = LoggerFactory.getLogger(WebsocketConfig.class);
+
@Autowired
private PropertiesConfig propertiesConfig;
@@ -52,6 +64,22 @@ public class WebsocketConfig
@Autowired
private PluginConfig pluginConfig;
+
+ @Bean
+ @Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
+ public ExecutorService resourceExecutor(String resource)
+ {
+ int corePoolSize = propertiesConfig.getProcessStartOrContinueThreads();
+
+ ThreadPoolExecutor executor = new ThreadPoolExecutor(corePoolSize, corePoolSize, 30, TimeUnit.MINUTES,
+ new LinkedBlockingQueue<>(),
+ Thread.ofPlatform().name("resource-executor-" + resource + "-", 0).factory(),
+ (_, _) -> logger.error("Unable to handle {} - execution rejected", resource));
+ executor.allowCoreThreadTimeOut(true);
+
+ return executor;
+ }
+
@Bean
public ResourceHandler taskHandler()
{
@@ -64,17 +92,21 @@ public ResourceHandler taskHandler()
@Bean
public SubscriptionHandlerFactory taskSubscriptionHandlerFactory()
{
- return new ConcurrentSubscriptionHandlerFactory<>(propertiesConfig.getProcessStartOrContinueThreads(),
- new TaskSubscriptionHandlerFactory(taskHandler(), daoConfig.lastEventTimeDaoTask()));
+ return new TaskSubscriptionHandlerFactory(taskHandler(), daoConfig.lastEventTimeDaoTask());
}
@Bean
- public LocalFhirConnector fhirConnectorTask()
+ public FhirSubscriptionConnector taskFhirConnector()
{
- return new LocalFhirConnectorImpl<>(Task.class, dsfClientConfig.clientProvider(),
- taskSubscriptionHandlerFactory(), fhirConfig.fhirContext(),
- propertiesConfig.getTaskSubscriptionSearchParameter(), propertiesConfig.getWebsocketRetrySleepMillis(),
- propertiesConfig.getWebsocketMaxRetries());
+ return new FhirSubscriptionConnectorImpl<>(fhirConfig.fhirContext(), Task.class, resourceExecutor("task"),
+ dsfClientConfig.clientProvider(), taskSubscriptionHandlerFactory(),
+ propertiesConfig.getTaskSubscriptionSearchParameter());
+ }
+
+ @Bean
+ public HealthCheck taskWebsocketHealthCheck()
+ {
+ return new WebsocketHealthCheck("Task", taskFhirConnector());
}
@Bean
@@ -89,17 +121,22 @@ public ResourceHandler questionnaireResponseHandler()
@Bean
public SubscriptionHandlerFactory questionnaireResponseSubscriptionHandlerFactory()
{
- return new ConcurrentSubscriptionHandlerFactory<>(propertiesConfig.getProcessStartOrContinueThreads(),
- new QuestionnaireResponseSubscriptionHandlerFactory(questionnaireResponseHandler(),
- daoConfig.lastEventTimeDaoQuestionnaireResponse()));
+ return new QuestionnaireResponseSubscriptionHandlerFactory(questionnaireResponseHandler(),
+ daoConfig.lastEventTimeDaoQuestionnaireResponse());
+ }
+
+ @Bean
+ public FhirSubscriptionConnector questionnaireResponseFhirConnector()
+ {
+ return new FhirSubscriptionConnectorImpl<>(fhirConfig.fhirContext(), QuestionnaireResponse.class,
+ resourceExecutor("questionnaire-response"), dsfClientConfig.clientProvider(),
+ questionnaireResponseSubscriptionHandlerFactory(),
+ propertiesConfig.getQuestionnaireResponseSubscriptionSearchParameter());
}
@Bean
- public LocalFhirConnector fhirConnectorQuestionnaireResponse()
+ public HealthCheck questionnaireResponseWebsocketHealthCheck()
{
- return new LocalFhirConnectorImpl<>(QuestionnaireResponse.class, dsfClientConfig.clientProvider(),
- questionnaireResponseSubscriptionHandlerFactory(), fhirConfig.fhirContext(),
- propertiesConfig.getQuestionnaireResponseSubscriptionSearchParameter(),
- propertiesConfig.getWebsocketRetrySleepMillis(), propertiesConfig.getWebsocketMaxRetries());
+ return new WebsocketHealthCheck("QuestionnaireResponse", questionnaireResponseFhirConnector());
}
}
diff --git a/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/subscription/AbstractResourceHandler.java b/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/subscription/AbstractResourceHandler.java
index d60e8ad39..be4294149 100644
--- a/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/subscription/AbstractResourceHandler.java
+++ b/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/subscription/AbstractResourceHandler.java
@@ -20,7 +20,6 @@
import org.operaton.bpm.engine.RepositoryService;
import org.operaton.bpm.engine.repository.ProcessDefinition;
-import org.springframework.beans.factory.InitializingBean;
import ca.uhn.fhir.context.FhirContext;
import ca.uhn.fhir.parser.IParser;
@@ -28,27 +27,27 @@
import dev.dsf.bpe.api.plugin.ProcessPlugin;
import dev.dsf.bpe.plugin.ProcessPluginManager;
-public abstract class AbstractResourceHandler implements InitializingBean
+public abstract class AbstractResourceHandler
{
protected final RepositoryService repositoryService;
private final ProcessPluginManager processPluginManager;
private final FhirContext fhirContext;
+ /**
+ * @param repositoryService
+ * not null
+ * @param processPluginManager
+ * not null
+ * @param fhirContext
+ * not null
+ */
public AbstractResourceHandler(RepositoryService repositoryService, ProcessPluginManager processPluginManager,
FhirContext fhirContext)
{
- this.repositoryService = repositoryService;
- this.processPluginManager = processPluginManager;
- this.fhirContext = fhirContext;
- }
-
- @Override
- public void afterPropertiesSet() throws Exception
- {
- Objects.requireNonNull(repositoryService, "repositoryService");
- Objects.requireNonNull(processPluginManager, "processPluginManager");
- Objects.requireNonNull(fhirContext, "fhirContext");
+ this.repositoryService = Objects.requireNonNull(repositoryService, "repositoryService");
+ this.processPluginManager = Objects.requireNonNull(processPluginManager, "processPluginManager");
+ this.fhirContext = Objects.requireNonNull(fhirContext, "fhirContext");
}
protected final IParser newJsonParser()
diff --git a/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/subscription/ConcurrentSubscriptionHandlerFactory.java b/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/subscription/ConcurrentSubscriptionHandlerFactory.java
deleted file mode 100644
index 21aeccbfd..000000000
--- a/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/subscription/ConcurrentSubscriptionHandlerFactory.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * Copyright 2018-2025 Heilbronn University of Applied Sciences
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package dev.dsf.bpe.subscription;
-
-import java.util.Objects;
-import java.util.concurrent.LinkedBlockingQueue;
-import java.util.concurrent.ThreadPoolExecutor;
-import java.util.concurrent.TimeUnit;
-
-import org.hl7.fhir.r4.model.Resource;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.InitializingBean;
-
-import dev.dsf.bpe.client.dsf.WebserviceClient;
-
-public class ConcurrentSubscriptionHandlerFactory
- implements SubscriptionHandlerFactory, InitializingBean
-{
- private static final Logger logger = LoggerFactory.getLogger(ConcurrentSubscriptionHandlerFactory.class);
-
- private final SubscriptionHandlerFactory delegate;
- private final ThreadPoolExecutor executor;
-
- /**
- * @param corePoolSize
- * > 0
- * @param delegate
- * not null
- */
- public ConcurrentSubscriptionHandlerFactory(int corePoolSize, SubscriptionHandlerFactory delegate)
- {
- if (corePoolSize <= 0)
- throw new IllegalArgumentException("corePoolSize <= 0");
-
- this.delegate = delegate;
-
- executor = new ThreadPoolExecutor(corePoolSize, corePoolSize, 30, TimeUnit.MINUTES, new LinkedBlockingQueue<>(),
- (_, _) -> logger.error("Unable to handle Task - execution rejected"));
- executor.allowCoreThreadTimeOut(true);
- }
-
- @Override
- public void afterPropertiesSet() throws Exception
- {
- Objects.requireNonNull(delegate, "delegate");
- }
-
- @Override
- public ExistingResourceLoader createExistingResourceLoader(WebserviceClient client)
- {
- return delegate.createExistingResourceLoader(client);
- }
-
- @Override
- public EventResourceHandler createEventResourceHandler()
- {
- final EventResourceHandler delegateHandler = delegate.createEventResourceHandler();
- return resource -> executor.submit(() ->
- {
- logger.debug("executing onResource for {} with id: {}", resource.getResourceType().name(),
- resource.getIdElement().getValue());
- delegateHandler.onResource(resource);
- });
- }
-
- @Override
- public PingEventResourceHandler createPingEventResourceHandler(ExistingResourceLoader existingResourceLoader)
- {
- final PingEventResourceHandler delegateHandler = delegate
- .createPingEventResourceHandler(existingResourceLoader);
- return (ping, subscriptionIdPart, searchCriteriaQueryParameters) -> executor
- .submit(() -> delegateHandler.onPing(ping, subscriptionIdPart, searchCriteriaQueryParameters));
- }
-}
diff --git a/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/subscription/EventResourceHandlerImpl.java b/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/subscription/EventResourceHandlerImpl.java
index 81c4144f7..c4da19dbd 100644
--- a/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/subscription/EventResourceHandlerImpl.java
+++ b/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/subscription/EventResourceHandlerImpl.java
@@ -17,6 +17,7 @@
import java.sql.SQLException;
import java.util.Date;
+import java.util.Objects;
import org.hl7.fhir.r4.model.Resource;
import org.slf4j.Logger;
@@ -33,12 +34,20 @@ public class EventResourceHandlerImpl implements EventResour
private final ResourceHandler handler;
private final Class resourceClass;
+ /**
+ * @param lastEventTimeDao
+ * not null
+ * @param handler
+ * not null
+ * @param resourceClass
+ * not null
+ */
public EventResourceHandlerImpl(LastEventTimeDao lastEventTimeDao, ResourceHandler handler,
Class resourceClass)
{
- this.lastEventTimeDao = lastEventTimeDao;
- this.handler = handler;
- this.resourceClass = resourceClass;
+ this.lastEventTimeDao = Objects.requireNonNull(lastEventTimeDao, "lastEventTimeDao");
+ this.handler = Objects.requireNonNull(handler, "handler");
+ this.resourceClass = Objects.requireNonNull(resourceClass, "resourceClass");
}
@Override
diff --git a/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/subscription/EventType.java b/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/subscription/EventType.java
index ab9900c64..3af312f90 100644
--- a/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/subscription/EventType.java
+++ b/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/subscription/EventType.java
@@ -15,32 +15,33 @@
*/
package dev.dsf.bpe.subscription;
+import java.util.Objects;
+
+import org.hl7.fhir.r4.model.Subscription;
+
+import ca.uhn.fhir.rest.api.Constants;
+
public enum EventType
{
- XML("application/fhir+xml"), JSON("application/fhir+json"), PING("ping");
+ XML, JSON, PING;
- private final String value;
-
- EventType(String value)
+ public static EventType fromSubscription(Subscription subscription)
{
- this.value = value;
- }
+ Objects.requireNonNull(subscription, "subscription");
+ if (!subscription.hasChannel())
+ throw new IllegalArgumentException("subscription has no channel");
- public static EventType fromString(String value)
- {
- return switch (value.toLowerCase())
+ String payload = subscription.getChannel().getPayload();
+
+ if (payload == null)
+ return EventType.PING;
+
+ return switch (payload)
{
- case "application/fhir+xml", "xml" -> XML;
- case "application/fhir+json", "json" -> JSON;
- case "ping" -> PING;
+ case Constants.CT_FHIR_JSON, Constants.CT_FHIR_JSON_NEW -> EventType.JSON;
+ case Constants.CT_FHIR_XML, Constants.CT_FHIR_XML_NEW -> EventType.XML;
- default -> throw new IllegalArgumentException("EvenType for " + value + " not implemented");
+ default -> throw new RuntimeException("Unsupported subscription.payload " + payload);
};
}
-
- @Override
- public String toString()
- {
- return value;
- }
}
diff --git a/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/subscription/ExistingResourceLoader.java b/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/subscription/ExistingResourceLoader.java
index e6eb7f178..66b84cc01 100644
--- a/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/subscription/ExistingResourceLoader.java
+++ b/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/subscription/ExistingResourceLoader.java
@@ -15,12 +15,9 @@
*/
package dev.dsf.bpe.subscription;
-import java.util.List;
-import java.util.Map;
-
import org.hl7.fhir.r4.model.Resource;
public interface ExistingResourceLoader
{
- void readExistingResources(Map> searchCriteriaQueryParameters);
+ void readExistingResources();
}
diff --git a/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/subscription/ExistingResourceLoaderImpl.java b/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/subscription/ExistingResourceLoaderImpl.java
index 41ddfd290..a48af25d0 100644
--- a/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/subscription/ExistingResourceLoaderImpl.java
+++ b/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/subscription/ExistingResourceLoaderImpl.java
@@ -50,26 +50,31 @@ public class ExistingResourceLoaderImpl implements ExistingR
private final ResourceHandler handler;
private final String resourceName;
private final Class resourceClass;
+ private final Map> searchCriteriaQueryParameters = new HashMap<>();
public ExistingResourceLoaderImpl(LastEventTimeDao lastEventTimeDao, ResourceHandler handler,
- WebserviceClient webserviceClient, String resourceName, Class resourceClass)
+ WebserviceClient webserviceClient, String resourceName, Class resourceClass,
+ Map> searchCriteriaQueryParameters)
{
this.lastEventTimeDao = lastEventTimeDao;
this.handler = handler;
this.webserviceClient = webserviceClient;
this.resourceName = resourceName;
this.resourceClass = resourceClass;
+
+ if (searchCriteriaQueryParameters != null)
+ searchCriteriaQueryParameters.forEach((k, v) -> this.searchCriteriaQueryParameters.put(k, List.copyOf(v)));
}
@Override
- public void readExistingResources(Map> searchCriteriaQueryParameters)
+ public void readExistingResources()
{
// executing search until call results in no more found tasks
- while (doReadExistingResources(searchCriteriaQueryParameters))
+ while (doReadExistingResources())
;
}
- private boolean doReadExistingResources(Map> searchCriteriaQueryParameters)
+ private boolean doReadExistingResources()
{
Map> queryParams = new HashMap<>(searchCriteriaQueryParameters);
Optional readLastEventTime = readLastEventTime();
diff --git a/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/subscription/FhirSubscriptionConnector.java b/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/subscription/FhirSubscriptionConnector.java
new file mode 100644
index 000000000..734cb2330
--- /dev/null
+++ b/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/subscription/FhirSubscriptionConnector.java
@@ -0,0 +1,30 @@
+/*
+ * Copyright 2018-2025 Heilbronn University of Applied Sciences
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package dev.dsf.bpe.subscription;
+
+import java.util.List;
+
+public interface FhirSubscriptionConnector extends AutoCloseable
+{
+ void connect();
+
+ boolean isConnected();
+
+ /**
+ * Returns the last 10 websocket ping/pong frame turnaround times in milliseconds, oldest first
+ */
+ List getWebsocketLatency();
+}
\ No newline at end of file
diff --git a/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/subscription/FhirSubscriptionConnectorImpl.java b/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/subscription/FhirSubscriptionConnectorImpl.java
new file mode 100644
index 000000000..e19c05dfe
--- /dev/null
+++ b/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/subscription/FhirSubscriptionConnectorImpl.java
@@ -0,0 +1,276 @@
+/*
+ * Copyright 2018-2025 Heilbronn University of Applied Sciences
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package dev.dsf.bpe.subscription;
+
+import java.net.SocketException;
+import java.net.UnknownHostException;
+import java.net.http.HttpConnectTimeoutException;
+import java.net.http.WebSocketHandshakeException;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+import java.util.Objects;
+import java.util.concurrent.CompletableFuture;
+import java.util.concurrent.CompletionException;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.Executor;
+import java.util.function.Consumer;
+
+import org.eclipse.jetty.websocket.core.exception.UpgradeException;
+import org.hl7.fhir.r4.model.Bundle;
+import org.hl7.fhir.r4.model.Resource;
+import org.hl7.fhir.r4.model.Subscription;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.web.util.UriComponents;
+import org.springframework.web.util.UriComponentsBuilder;
+
+import ca.uhn.fhir.context.FhirContext;
+import ca.uhn.fhir.model.api.annotation.ResourceDef;
+import ca.uhn.fhir.parser.IParser;
+import dev.dsf.bpe.client.dsf.ClientProvider;
+import dev.dsf.bpe.client.dsf.WebserviceClient;
+import dev.dsf.fhir.client.Endpoint;
+import dev.dsf.fhir.client.WebsocketClient;
+import jakarta.ws.rs.ProcessingException;
+import jakarta.ws.rs.WebApplicationException;
+import jakarta.ws.rs.core.Response.Status;
+
+public class FhirSubscriptionConnectorImpl implements Endpoint, FhirSubscriptionConnector
+{
+ private static final Logger logger = LoggerFactory.getLogger(FhirSubscriptionConnectorImpl.class);
+
+ private final FhirContext fhirContext;
+ private final Class resourceType;
+ private final String resourceTypeName;
+ private final Executor executor;
+ private final SubscriptionHandlerFactory subscriptionHandlerFactory;
+ private final Map> subscriptionSearchParameter;
+ private final WebsocketClient websocketClient;
+ private final WebserviceClient webserviceClient;
+
+ private volatile Consumer handler;
+
+ public FhirSubscriptionConnectorImpl(FhirContext fhirContext, Class resourceType, Executor executor,
+ ClientProvider clientProvider, SubscriptionHandlerFactory subscriptionHandlerFactory,
+ String subscriptionSearchParameter)
+ {
+ this.fhirContext = Objects.requireNonNull(fhirContext, "fhirContext");
+ this.resourceType = Objects.requireNonNull(resourceType, "resourceType");
+ this.resourceTypeName = resourceType.getAnnotation(ResourceDef.class).name();
+ this.executor = Objects.requireNonNull(executor, "executor");
+ this.subscriptionHandlerFactory = Objects.requireNonNull(subscriptionHandlerFactory,
+ "subscriptionHandlerFactory");
+ this.subscriptionSearchParameter = parseSubscriptionSearchParameter(subscriptionSearchParameter);
+
+ websocketClient = clientProvider.createWebsocketClient(this, toKebabCase(resourceTypeName));
+ webserviceClient = clientProvider.getWebserviceClient();
+ }
+
+ private Map> parseSubscriptionSearchParameter(String queryParameters)
+ {
+ Objects.requireNonNull(queryParameters, "queryParameters");
+
+ return UriComponentsBuilder
+ .fromUriString(queryParameters.startsWith("?") ? queryParameters : "?" + queryParameters).build()
+ .getQueryParams();
+ }
+
+ @Override
+ public void connect()
+ {
+ websocketClient.connect();
+ }
+
+ private static String toKebabCase(String input)
+ {
+ return input.replaceAll("([a-z0-9])([A-Z])", "$1-$2").toLowerCase(Locale.ENGLISH);
+ }
+
+ @Override
+ public boolean isConnected()
+ {
+ return websocketClient.isConnected();
+ }
+
+ @Override
+ public List getWebsocketLatency()
+ {
+ return websocketClient.getPingHistory();
+ }
+
+ @Override
+ public void close() throws Exception
+ {
+ websocketClient.close();
+ }
+
+ @Override
+ public Subscription getSubscription()
+ {
+ logger.debug("Retrieving {} websocket subscription ...", resourceTypeName);
+
+ Bundle bundle = webserviceClient.searchWithStrictHandling(Subscription.class, subscriptionSearchParameter);
+
+ if (!Bundle.BundleType.SEARCHSET.equals(bundle.getType()))
+ throw new RuntimeException("Could not retrieve searchset for subscription search query "
+ + subscriptionSearchParameter + ", but got " + bundle.getType());
+ if (bundle.getTotal() != 1)
+ throw new RuntimeException("Could not retrieve exactly one result for subscription search query "
+ + subscriptionSearchParameter);
+ if (!(bundle.getEntryFirstRep().getResource() instanceof Subscription))
+ throw new RuntimeException("Could not retrieve exactly one Subscription for subscription search query "
+ + subscriptionSearchParameter + ", but got "
+ + bundle.getEntryFirstRep().getResource().getResourceType());
+
+ Subscription subscription = (Subscription) bundle.getEntryFirstRep().getResource();
+
+ logger.debug("{} subscription with id {} found", resourceTypeName, subscription.getIdElement().getIdPart());
+
+ return subscription;
+ }
+
+ @Override
+ public void beforeConnect(Subscription subscription)
+ {
+ ExistingResourceLoader existingResourceLoader = subscriptionHandlerFactory.createExistingResourceLoader(
+ webserviceClient, parseSubscriptionCriteria(subscription.getCriteria(), resourceTypeName));
+
+ try
+ {
+ logger.debug("Reading existing {} resources", resourceTypeName);
+ existingResourceLoader.readExistingResources();
+ }
+ catch (Exception e)
+ {
+ logger.debug("Unable to read existing {} resources: {} - {}", resourceTypeName, e.getClass().getName(),
+ e.getMessage());
+ throw e;
+ }
+
+ EventType eventType = EventType.fromSubscription(subscription);
+ if (EventType.PING.equals(eventType))
+ {
+ PingEventResourceHandler pingEventResourceHandler = subscriptionHandlerFactory
+ .createPingEventResourceHandler(existingResourceLoader);
+ handler = message -> pingEventResourceHandler.onPing(message, subscription.getIdElement().getIdPart());
+ }
+ else
+ {
+ EventResourceHandler eventResourceHandler = subscriptionHandlerFactory.createEventResourceHandler();
+ handler = message -> eventResourceHandler
+ .onResource(createParser(eventType).parseResource(resourceType, message));
+ }
+ }
+
+ private Map> parseSubscriptionCriteria(String queryParameters, String expectedPath)
+ {
+ Objects.requireNonNull(queryParameters, "queryParameters");
+
+ if (expectedPath != null && !expectedPath.isBlank())
+ {
+ UriComponents components = UriComponentsBuilder.fromUriString(queryParameters).build();
+ if (!expectedPath.equals(components.getPath()))
+ throw new RuntimeException("Unexpected query parameters format '" + queryParameters + "'");
+ else
+ return components.getQueryParams();
+ }
+ else
+ {
+ UriComponents components = UriComponentsBuilder
+ .fromUriString(queryParameters.startsWith("?") ? queryParameters : "?" + queryParameters).build();
+
+ return components.getQueryParams();
+ }
+ }
+
+ @Override
+ public CompletableFuture onMessage(Subscription subscription, String message)
+ {
+ Objects.requireNonNull(subscription, "subscription");
+ Objects.requireNonNull(message, "message");
+
+ if (handler == null)
+ throw new IllegalStateException("No handler set");
+
+ return CompletableFuture.supplyAsync(() ->
+ {
+ handler.accept(message);
+ return null;
+ }, executor);
+ }
+
+ private IParser createParser(EventType eventType)
+ {
+ return switch (eventType)
+ {
+ case XML -> configureParser(fhirContext.newXmlParser());
+ case JSON -> configureParser(fhirContext.newJsonParser());
+
+ default -> throw new RuntimeException("EventType " + eventType + " not supported");
+ };
+ }
+
+ private IParser configureParser(IParser p)
+ {
+ p.setStripVersionsFromReferences(false);
+ p.setOverrideResourceIdWithBundleEntryFullUrl(false);
+ return p;
+ }
+
+ @Override
+ public void onOpen()
+ {
+ logger.info("{} websocket connected", resourceTypeName);
+ }
+
+ @Override
+ public void onDisconnect()
+ {
+ logger.info("{} websocket disconnected", resourceTypeName);
+ handler = null;
+ }
+
+ @Override
+ public boolean isRetryableException(Throwable e)
+ {
+ Throwable u = unwrapException(e);
+
+ if (u instanceof WebApplicationException w
+ && Status.Family.SERVER_ERROR.equals(w.getResponse().getStatusInfo().getFamily()))
+ return true;
+ if (u instanceof HttpConnectTimeoutException)
+ return true;
+ if (u instanceof SocketException)
+ return true;
+ if (u instanceof WebSocketHandshakeException)
+ return true;
+ // TODO outside a docker environment this usually is not a transient error, remove ?
+ if (u instanceof UnknownHostException)
+ return true;
+
+ return false;
+ }
+
+ private Throwable unwrapException(Throwable e)
+ {
+ while ((e instanceof ProcessingException || e instanceof CompletionException || e instanceof ExecutionException
+ || e instanceof UpgradeException) && e.getCause() != null)
+ e = e.getCause();
+
+ return e;
+ }
+}
diff --git a/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/subscription/LocalFhirConnectorImpl.java b/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/subscription/LocalFhirConnectorImpl.java
deleted file mode 100644
index 6ccd7f743..000000000
--- a/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/subscription/LocalFhirConnectorImpl.java
+++ /dev/null
@@ -1,352 +0,0 @@
-/*
- * Copyright 2018-2025 Heilbronn University of Applied Sciences
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package dev.dsf.bpe.subscription;
-
-import java.time.Duration;
-import java.util.List;
-import java.util.Map;
-import java.util.Objects;
-import java.util.concurrent.CompletableFuture;
-import java.util.concurrent.Executors;
-import java.util.function.Supplier;
-
-import org.hl7.fhir.r4.model.Bundle;
-import org.hl7.fhir.r4.model.Resource;
-import org.hl7.fhir.r4.model.Subscription;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.InitializingBean;
-import org.springframework.context.event.ContextClosedEvent;
-import org.springframework.context.event.EventListener;
-import org.springframework.web.util.UriComponents;
-import org.springframework.web.util.UriComponentsBuilder;
-
-import ca.uhn.fhir.context.FhirContext;
-import ca.uhn.fhir.model.api.annotation.ResourceDef;
-import ca.uhn.fhir.parser.IParser;
-import ca.uhn.fhir.rest.api.Constants;
-import dev.dsf.bpe.client.dsf.ClientProvider;
-import dev.dsf.bpe.client.dsf.WebserviceClient;
-import dev.dsf.fhir.client.WebsocketClient;
-
-public class LocalFhirConnectorImpl implements LocalFhirConnector, InitializingBean
-{
- private static final Logger logger = LoggerFactory.getLogger(LocalFhirConnectorImpl.class);
-
- private final Class resourceType;
- private final String resourceName;
- private final ClientProvider clientProvider;
- private final FhirContext fhirContext;
- private final SubscriptionHandlerFactory subscriptionHandlerFactory;
- private final Duration retrySleep;
- private final int maxRetries;
- private final Map> subscriptionSearchParameter;
-
- public LocalFhirConnectorImpl(Class resourceType, ClientProvider clientProvider,
- SubscriptionHandlerFactory subscriptionHandlerFactory, FhirContext fhirContext,
- String subscriptionSearchParameter, Duration retrySleep, int maxRetries)
- {
- this.resourceType = resourceType;
- this.resourceName = resourceType == null ? null : resourceType.getAnnotation(ResourceDef.class).name();
- this.clientProvider = clientProvider;
- this.subscriptionHandlerFactory = subscriptionHandlerFactory;
- this.fhirContext = fhirContext;
- this.subscriptionSearchParameter = parse(subscriptionSearchParameter, null);
- this.retrySleep = retrySleep;
- this.maxRetries = maxRetries;
- }
-
- private Map> parse(String queryParameters, String expectedPath)
- {
- if (expectedPath != null && !expectedPath.isBlank())
- {
- UriComponents components = UriComponentsBuilder.fromUriString(queryParameters).build();
- if (!expectedPath.equals(components.getPath()))
- throw new RuntimeException("Unexpected query parameters format '" + queryParameters + "'");
- else
- return components.getQueryParams();
- }
- else
- {
- UriComponents components = UriComponentsBuilder
- .fromUriString(queryParameters.startsWith("?") ? queryParameters : "?" + queryParameters).build();
-
- return components.getQueryParams();
- }
- }
-
- @Override
- public void afterPropertiesSet() throws Exception
- {
- Objects.requireNonNull(resourceType, "resourceType");
- Objects.requireNonNull(clientProvider, "clientProvider");
- Objects.requireNonNull(subscriptionHandlerFactory, "subscriptionHandlerFactory");
- Objects.requireNonNull(fhirContext, "fhirContext");
- Objects.requireNonNull(subscriptionSearchParameter, "subscriptionSearchParameter");
-
- if (retrySleep.isNegative())
- throw new IllegalArgumentException("retrySleepMillis negative");
-
- // maxRetries < 0 => retry forever
- }
-
- @Override
- public void connect()
- {
- logger.debug("Retrieving Subscription and connecting to websocket");
-
- CompletableFuture.supplyAsync(this::retrieveWebsocketSubscription, Executors.newSingleThreadExecutor())
- .thenApply(this::loadNewResources).thenAccept(this::connectWebsocket).exceptionally(this::onError);
- }
-
- private Subscription retrieveWebsocketSubscription()
- {
- try
- {
- if (maxRetries >= 0)
- return retry(this::doRetrieveWebsocketSubscription);
- else
- return retryForever(this::doRetrieveWebsocketSubscription);
- }
- catch (Exception e)
- {
- logger.debug("Error while retrieving {} websocket subscription", resourceName, e);
- logger.warn("Error while retrieving {} websocket subscription: {} - {}", resourceName,
- e.getClass().getName(), e.getMessage());
-
- throw e;
- }
- }
-
- private Subscription retry(Supplier supplier)
- {
- RuntimeException lastException = null;
- for (int retryCounter = 0; retryCounter <= maxRetries; retryCounter++)
- {
- try
- {
- return supplier.get();
- }
- catch (RuntimeException e)
- {
- if (retryCounter < maxRetries)
- {
- logger.warn(
- "Error while retrieving {} websocket subscription ({}), trying again in {}s (retry {} of {})",
- resourceName, e.getMessage(), retrySleep.toSeconds(), retryCounter + 1, maxRetries);
- try
- {
- Thread.sleep(retrySleep);
- }
- catch (InterruptedException e1)
- {
- logger.warn("Thread interrupted; not trying again");
- Thread.currentThread().interrupt();
- e.addSuppressed(e1);
- throw e;
- }
- }
-
- lastException = e;
- }
- }
-
- logger.warn("Error while retrieving {} websocket subscription ({}), giving up", resourceName,
- lastException.getMessage());
-
- throw lastException;
- }
-
- private Subscription retryForever(Supplier supplier)
- {
- for (int retryCounter = 1; true; retryCounter++)
- {
- try
- {
- return supplier.get();
- }
- catch (RuntimeException e)
- {
- logger.warn("Error while retrieving {} websocket subscription ({}), trying again in {}s (retry {})",
- resourceName, e.getMessage(), retrySleep.toSeconds(), retryCounter);
- try
- {
- Thread.sleep(retrySleep);
- }
- catch (InterruptedException e1)
- {
- logger.warn("Thread interrupted; not trying again");
- Thread.currentThread().interrupt();
- e.addSuppressed(e1);
- throw e;
- }
- }
- }
- }
-
- private Subscription doRetrieveWebsocketSubscription()
- {
- logger.debug("Retrieving {} websocket subscription ...", resourceName);
-
- Bundle bundle = clientProvider.getWebserviceClient().searchWithStrictHandling(Subscription.class,
- subscriptionSearchParameter);
-
- if (!Bundle.BundleType.SEARCHSET.equals(bundle.getType()))
- throw new RuntimeException("Could not retrieve searchset for subscription search query "
- + subscriptionSearchParameter + ", but got " + bundle.getType());
- if (bundle.getTotal() != 1)
- throw new RuntimeException("Could not retrieve exactly one result for subscription search query "
- + subscriptionSearchParameter);
- if (!(bundle.getEntryFirstRep().getResource() instanceof Subscription))
- throw new RuntimeException("Could not retrieve exactly one Subscription for subscription search query "
- + subscriptionSearchParameter + ", but got "
- + bundle.getEntryFirstRep().getResource().getResourceType());
-
- Subscription subscription = (Subscription) bundle.getEntryFirstRep().getResource();
- logger.debug("Subscription with id {} found", subscription.getIdElement().getIdPart());
-
- return subscription;
- }
-
- private Subscription loadNewResources(Subscription subscription)
- {
- try
- {
- logger.info("Downloading new {} resources ...", resourceName);
-
- WebserviceClient client = clientProvider.getWebserviceClient();
- ExistingResourceLoader existingResourceLoader = subscriptionHandlerFactory
- .createExistingResourceLoader(client);
- Map> subscriptionCriteria = parse(subscription.getCriteria(),
- resourceType.getAnnotation(ResourceDef.class).name());
- existingResourceLoader.readExistingResources(subscriptionCriteria);
-
- logger.info("Downloading new {} resources [Done]", resourceName);
-
- return subscription;
- }
- catch (Exception e)
- {
- logger.debug("Error while downloading new {} resources", resourceName, e);
- logger.warn("Error while downloading new {} resources: {} - {}", resourceName, e.getClass().getName(),
- e.getMessage());
-
- throw e;
- }
- }
-
- private void connectWebsocket(Subscription subscription)
- {
- try
- {
- WebsocketClient client = clientProvider.getWebsocketClient(this::connect,
- subscription.getIdElement().getIdPart());
-
- EventType eventType = toEventType(subscription.getChannel().getPayload());
- if (EventType.PING.equals(eventType))
- {
- Map> subscriptionCriteria = parse(subscription.getCriteria(),
- resourceType.getAnnotation(ResourceDef.class).name());
- setPingEventHandler(client, subscription.getIdElement().getIdPart(), subscriptionCriteria);
- }
- else
- setResourceEventHandler(client, eventType);
-
- logger.info("Connecting {} websocket to local DSF FHIR server, subscription: {} ...", resourceName,
- subscription.getIdElement().getIdPart());
-
- client.connect();
- }
- catch (Exception e)
- {
- logger.debug("Unable to connect {} websocket to local DSF FHIR server", resourceName, e);
- logger.warn("Unable to connect {} websocket to local DSF FHIR server: {} - {}", resourceName,
- e.getClass().getName(), e.getMessage());
-
- throw e;
- }
- }
-
- private Void onError(Throwable t)
- {
- // no debug log, exception previously logged by retrieveWebsocketSubscription, loadNewResources and
- // connectWebsocket methods
- logger.error("Error loading existing {} resources and connecting websocket: {} - {}", resourceName,
- t.getClass().getName(), t.getMessage());
-
- return null;
- }
-
- private EventType toEventType(String payload)
- {
- if (payload == null)
- return EventType.PING;
-
- return switch (payload)
- {
- case Constants.CT_FHIR_JSON, Constants.CT_FHIR_JSON_NEW -> EventType.JSON;
- case Constants.CT_FHIR_XML, Constants.CT_FHIR_XML_NEW -> EventType.XML;
-
- default -> throw new RuntimeException("Unsupported subscription.payload " + payload);
- };
- }
-
- @EventListener({ ContextClosedEvent.class })
- public void onContextClosedEvent()
- {
- clientProvider.disconnectAll();
- }
-
- private void setPingEventHandler(WebsocketClient client, String subscriptionIdPart,
- Map> searchCriteriaQueryParameters)
- {
- WebserviceClient webserviceClient = clientProvider.getWebserviceClient();
- ExistingResourceLoader existingResourceLoader = subscriptionHandlerFactory
- .createExistingResourceLoader(webserviceClient);
- PingEventResourceHandler pingHandler = subscriptionHandlerFactory
- .createPingEventResourceHandler(existingResourceLoader);
- client.setPingHandler(ping -> pingHandler.onPing(ping, subscriptionIdPart, searchCriteriaQueryParameters));
- }
-
- private void setResourceEventHandler(WebsocketClient client, EventType eventType)
- {
- EventResourceHandler eventHandler = subscriptionHandlerFactory.createEventResourceHandler();
- client.setResourceHandler(r -> eventHandler.onResource(resourceType.cast(r)), createParserFactory(eventType));
- }
-
- private Supplier createParserFactory(EventType eventType)
- {
- return switch (eventType)
- {
- case XML -> configureParser(fhirContext::newXmlParser);
- case JSON -> configureParser(fhirContext::newJsonParser);
-
- default -> throw new RuntimeException("EventType " + eventType + " not supported");
- };
- }
-
- private Supplier configureParser(Supplier supplier)
- {
- return () ->
- {
- IParser p = supplier.get();
- p.setStripVersionsFromReferences(false);
- p.setOverrideResourceIdWithBundleEntryFullUrl(false);
-
- return p;
- };
- }
-}
diff --git a/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/subscription/PingEventResourceHandler.java b/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/subscription/PingEventResourceHandler.java
index f2ab9b4dc..820fda75a 100644
--- a/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/subscription/PingEventResourceHandler.java
+++ b/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/subscription/PingEventResourceHandler.java
@@ -15,12 +15,9 @@
*/
package dev.dsf.bpe.subscription;
-import java.util.List;
-import java.util.Map;
-
import org.hl7.fhir.r4.model.Resource;
public interface PingEventResourceHandler
{
- void onPing(String ping, String subscriptionIdPart, Map> searchCriteriaQueryParameters);
+ void onPing(String ping, String subscriptionIdPart);
}
\ No newline at end of file
diff --git a/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/subscription/PingEventResourceHandlerImpl.java b/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/subscription/PingEventResourceHandlerImpl.java
index 0bf1d4175..92d351602 100644
--- a/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/subscription/PingEventResourceHandlerImpl.java
+++ b/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/subscription/PingEventResourceHandlerImpl.java
@@ -15,8 +15,7 @@
*/
package dev.dsf.bpe.subscription;
-import java.util.List;
-import java.util.Map;
+import java.util.Objects;
import org.hl7.fhir.r4.model.Resource;
import org.slf4j.Logger;
@@ -28,13 +27,17 @@ public class PingEventResourceHandlerImpl implements PingEve
private final ExistingResourceLoader loader;
+ /**
+ * @param loader
+ * not null
+ */
public PingEventResourceHandlerImpl(ExistingResourceLoader loader)
{
- this.loader = loader;
+ this.loader = Objects.requireNonNull(loader, "loader");
}
@Override
- public void onPing(String ping, String subscriptionIdPart, Map> searchCriteriaQueryParameters)
+ public void onPing(String ping, String subscriptionIdPart)
{
logger.trace("Ping for subscription {} received", ping);
if (!subscriptionIdPart.equals(ping))
@@ -44,6 +47,6 @@ public void onPing(String ping, String subscriptionIdPart, Map, InitializingBean
+ implements ResourceHandler
{
private static final Logger logger = LoggerFactory.getLogger(QuestionnaireResponseHandler.class);
private final TaskService userTaskService;
private final WebserviceClient webserviceClient;
+ /**
+ * @param repositoryService
+ * not null
+ * @param processPluginManager
+ * not null
+ * @param fhirContext
+ * not null
+ * @param userTaskService
+ * not null
+ * @param webserviceClient
+ * not null
+ */
public QuestionnaireResponseHandler(RepositoryService repositoryService, ProcessPluginManager processPluginManager,
FhirContext fhirContext, TaskService userTaskService, WebserviceClient webserviceClient)
{
super(repositoryService, processPluginManager, fhirContext);
- this.userTaskService = userTaskService;
- this.webserviceClient = webserviceClient;
- }
-
- @Override
- public void afterPropertiesSet() throws Exception
- {
- super.afterPropertiesSet();
-
- Objects.requireNonNull(userTaskService, "userTaskService");
- Objects.requireNonNull(webserviceClient, "webserviceClient");
+ this.userTaskService = Objects.requireNonNull(userTaskService, "userTaskService");
+ this.webserviceClient = Objects.requireNonNull(webserviceClient, "webserviceClient");
}
@Override
diff --git a/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/subscription/QuestionnaireResponseSubscriptionHandlerFactory.java b/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/subscription/QuestionnaireResponseSubscriptionHandlerFactory.java
index bec14474a..af44e7420 100644
--- a/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/subscription/QuestionnaireResponseSubscriptionHandlerFactory.java
+++ b/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/subscription/QuestionnaireResponseSubscriptionHandlerFactory.java
@@ -15,39 +15,40 @@
*/
package dev.dsf.bpe.subscription;
+import java.util.List;
+import java.util.Map;
import java.util.Objects;
import org.hl7.fhir.r4.model.QuestionnaireResponse;
-import org.springframework.beans.factory.InitializingBean;
import dev.dsf.bpe.client.dsf.WebserviceClient;
import dev.dsf.bpe.dao.LastEventTimeDao;
public class QuestionnaireResponseSubscriptionHandlerFactory
- implements SubscriptionHandlerFactory, InitializingBean
+ implements SubscriptionHandlerFactory
{
private final ResourceHandler resourceHandler;
private final LastEventTimeDao lastEventTimeDao;
+ /**
+ * @param resourceHandler
+ * not null
+ * @param lastEventTimeDao
+ * not null
+ */
public QuestionnaireResponseSubscriptionHandlerFactory(ResourceHandler resourceHandler,
LastEventTimeDao lastEventTimeDao)
{
- this.resourceHandler = resourceHandler;
- this.lastEventTimeDao = lastEventTimeDao;
+ this.resourceHandler = Objects.requireNonNull(resourceHandler, "resourceHandler");
+ this.lastEventTimeDao = Objects.requireNonNull(lastEventTimeDao, "lastEventTimeDao");
}
@Override
- public void afterPropertiesSet() throws Exception
- {
- Objects.requireNonNull(resourceHandler, "resourceHandler");
- Objects.requireNonNull(lastEventTimeDao, "lastEventTimeDao");
- }
-
- @Override
- public ExistingResourceLoader createExistingResourceLoader(WebserviceClient client)
+ public ExistingResourceLoader createExistingResourceLoader(WebserviceClient client,
+ Map> subscriptionCriteria)
{
return new ExistingResourceLoaderImpl<>(lastEventTimeDao, resourceHandler, client, "QuestionnaireResponse",
- QuestionnaireResponse.class);
+ QuestionnaireResponse.class, subscriptionCriteria);
}
@Override
diff --git a/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/subscription/SubscriptionHandlerFactory.java b/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/subscription/SubscriptionHandlerFactory.java
index 98059c85b..485a08a95 100644
--- a/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/subscription/SubscriptionHandlerFactory.java
+++ b/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/subscription/SubscriptionHandlerFactory.java
@@ -15,13 +15,17 @@
*/
package dev.dsf.bpe.subscription;
+import java.util.List;
+import java.util.Map;
+
import org.hl7.fhir.r4.model.Resource;
import dev.dsf.bpe.client.dsf.WebserviceClient;
public interface SubscriptionHandlerFactory
{
- ExistingResourceLoader createExistingResourceLoader(WebserviceClient client);
+ ExistingResourceLoader createExistingResourceLoader(WebserviceClient client,
+ Map> subscriptionCriteria);
EventResourceHandler createEventResourceHandler();
diff --git a/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/subscription/TaskHandler.java b/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/subscription/TaskHandler.java
index 01718752e..f9a006c86 100644
--- a/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/subscription/TaskHandler.java
+++ b/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/subscription/TaskHandler.java
@@ -47,7 +47,6 @@
import org.operaton.bpm.model.bpmn.instance.StartEvent;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.InitializingBean;
import ca.uhn.fhir.context.FhirContext;
import dev.dsf.bpe.api.Constants;
@@ -55,7 +54,7 @@
import dev.dsf.bpe.client.dsf.WebserviceClient;
import dev.dsf.bpe.plugin.ProcessPluginManager;
-public class TaskHandler extends AbstractResourceHandler implements ResourceHandler, InitializingBean
+public class TaskHandler extends AbstractResourceHandler implements ResourceHandler
{
private static final Logger logger = LoggerFactory.getLogger(TaskHandler.class);
@@ -114,22 +113,25 @@ String getShortMessage()
private final RuntimeService runtimeService;
private final WebserviceClient webserviceClient;
+ /**
+ * @param repositoryService
+ * not null
+ * @param processPluginManager
+ * not null
+ * @param fhirContext
+ * not null
+ * @param runtimeService
+ * not null
+ * @param webserviceClient
+ * not null
+ */
public TaskHandler(RepositoryService repositoryService, ProcessPluginManager processPluginManager,
FhirContext fhirContext, RuntimeService runtimeService, WebserviceClient webserviceClient)
{
super(repositoryService, processPluginManager, fhirContext);
- this.runtimeService = runtimeService;
- this.webserviceClient = webserviceClient;
- }
-
- @Override
- public void afterPropertiesSet() throws Exception
- {
- super.afterPropertiesSet();
-
- Objects.requireNonNull(runtimeService, "runtimeService");
- Objects.requireNonNull(webserviceClient, "webserviceClient");
+ this.runtimeService = Objects.requireNonNull(runtimeService, "runtimeService");
+ this.webserviceClient = Objects.requireNonNull(webserviceClient, "webserviceClient");
}
@Override
diff --git a/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/subscription/TaskSubscriptionHandlerFactory.java b/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/subscription/TaskSubscriptionHandlerFactory.java
index 7771c0b2b..831295e1e 100644
--- a/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/subscription/TaskSubscriptionHandlerFactory.java
+++ b/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/subscription/TaskSubscriptionHandlerFactory.java
@@ -15,36 +15,38 @@
*/
package dev.dsf.bpe.subscription;
+import java.util.List;
+import java.util.Map;
import java.util.Objects;
import org.hl7.fhir.r4.model.Task;
-import org.springframework.beans.factory.InitializingBean;
import dev.dsf.bpe.client.dsf.WebserviceClient;
import dev.dsf.bpe.dao.LastEventTimeDao;
-public class TaskSubscriptionHandlerFactory implements SubscriptionHandlerFactory, InitializingBean
+public class TaskSubscriptionHandlerFactory implements SubscriptionHandlerFactory
{
private final ResourceHandler resourceHandler;
private final LastEventTimeDao lastEventTimeDao;
+ /**
+ * @param resourceHandler
+ * not null
+ * @param lastEventTimeDao
+ * not null
+ */
public TaskSubscriptionHandlerFactory(ResourceHandler resourceHandler, LastEventTimeDao lastEventTimeDao)
{
- this.resourceHandler = resourceHandler;
- this.lastEventTimeDao = lastEventTimeDao;
+ this.resourceHandler = Objects.requireNonNull(resourceHandler, "resourceHandler");
+ this.lastEventTimeDao = Objects.requireNonNull(lastEventTimeDao, "lastEventTimeDao");
}
@Override
- public void afterPropertiesSet() throws Exception
+ public ExistingResourceLoader createExistingResourceLoader(WebserviceClient client,
+ Map> subscriptionCriteria)
{
- Objects.requireNonNull(resourceHandler, "resourceHandler");
- Objects.requireNonNull(lastEventTimeDao, "lastEventTimeDao");
- }
-
- @Override
- public ExistingResourceLoader createExistingResourceLoader(WebserviceClient client)
- {
- return new ExistingResourceLoaderImpl<>(lastEventTimeDao, resourceHandler, client, "Task", Task.class);
+ return new ExistingResourceLoaderImpl<>(lastEventTimeDao, resourceHandler, client, "Task", Task.class,
+ subscriptionCriteria);
}
@Override
diff --git a/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/ui/ThymeleafTemplateServiceImpl.java b/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/ui/ThymeleafTemplateServiceImpl.java
index 251ec24f7..32a660693 100644
--- a/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/ui/ThymeleafTemplateServiceImpl.java
+++ b/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/ui/ThymeleafTemplateServiceImpl.java
@@ -19,7 +19,6 @@
import java.net.URI;
import java.util.Objects;
-import org.springframework.beans.factory.InitializingBean;
import org.thymeleaf.TemplateEngine;
import org.thymeleaf.context.Context;
import org.thymeleaf.templatemode.TemplateMode;
@@ -28,7 +27,7 @@
import dev.dsf.common.ui.theme.Theme;
import jakarta.ws.rs.core.StreamingOutput;
-public class ThymeleafTemplateServiceImpl implements ThymeleafTemplateService, InitializingBean
+public class ThymeleafTemplateServiceImpl implements ThymeleafTemplateService
{
private final String serverBaseUrl;
private final Theme theme;
@@ -47,7 +46,7 @@ public class ThymeleafTemplateServiceImpl implements ThymeleafTemplateService, I
*/
public ThymeleafTemplateServiceImpl(String serverBaseUrl, Theme theme, boolean cacheEnabled, boolean modCssExists)
{
- this.serverBaseUrl = serverBaseUrl;
+ this.serverBaseUrl = Objects.requireNonNull(serverBaseUrl, "serverBaseUrl");
this.theme = theme;
this.cacheEnabled = cacheEnabled;
this.modCssExists = modCssExists;
@@ -61,12 +60,6 @@ public ThymeleafTemplateServiceImpl(String serverBaseUrl, Theme theme, boolean c
templateEngine.setTemplateResolver(resolver);
}
- @Override
- public void afterPropertiesSet() throws Exception
- {
- Objects.requireNonNull(serverBaseUrl, "serverBaseUrl");
- }
-
@Override
public StreamingOutput write(Context context, MainValues mainValues)
{
diff --git a/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/webservice/AbstractService.java b/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/webservice/AbstractService.java
index 2a51bfd8f..d389e7a1a 100644
--- a/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/webservice/AbstractService.java
+++ b/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/webservice/AbstractService.java
@@ -19,7 +19,6 @@
import java.util.Objects;
import java.util.function.Consumer;
-import org.springframework.beans.factory.InitializingBean;
import org.thymeleaf.context.Context;
import dev.dsf.bpe.ui.ThymeleafTemplateService;
@@ -28,7 +27,7 @@
import jakarta.ws.rs.core.SecurityContext;
import jakarta.ws.rs.core.StreamingOutput;
-public abstract class AbstractService implements InitializingBean
+public abstract class AbstractService
{
@jakarta.ws.rs.core.Context
private volatile SecurityContext securityContext;
@@ -36,17 +35,16 @@ public abstract class AbstractService implements InitializingBean
private final ThymeleafTemplateService templateService;
private final String htmlFragment;
+ /**
+ * @param templateService
+ * not null
+ * @param htmlFragment
+ * not null
+ */
public AbstractService(ThymeleafTemplateService templateService, String htmlFragment)
{
- this.templateService = templateService;
- this.htmlFragment = htmlFragment;
- }
-
- @Override
- public void afterPropertiesSet() throws Exception
- {
- Objects.requireNonNull(templateService, "templateService");
- Objects.requireNonNull(htmlFragment, "htmlFragment");
+ this.templateService = Objects.requireNonNull(templateService, "templateService");
+ this.htmlFragment = Objects.requireNonNull(htmlFragment, "htmlFragment");
}
protected StreamingOutput write(String title, String heading, Consumer setValues)
diff --git a/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/webservice/ProcessService.java b/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/webservice/ProcessService.java
index 099c08bce..2d78d72c0 100755
--- a/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/webservice/ProcessService.java
+++ b/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/webservice/ProcessService.java
@@ -35,7 +35,6 @@
import org.operaton.bpm.engine.repository.Deployment;
import org.operaton.bpm.engine.repository.ProcessDefinition;
import org.operaton.bpm.model.bpmn.BpmnModelInstance;
-import org.springframework.beans.factory.InitializingBean;
import org.thymeleaf.context.Context;
import dev.dsf.bpe.ui.ThymeleafTemplateService;
@@ -51,18 +50,24 @@
@RolesAllowed("ADMIN")
@Path(ProcessService.PATH)
-public class ProcessService extends AbstractService implements InitializingBean
+public class ProcessService extends AbstractService
{
public static final String PATH = "Process";
private final RepositoryService repositoryService;
private final TransformerFactory transformerFactory;
+ /**
+ * @param templateService
+ * not null
+ * @param repositoryService
+ * not null
+ */
public ProcessService(ThymeleafTemplateService templateService, RepositoryService repositoryService)
{
super(templateService, "Process");
- this.repositoryService = repositoryService;
+ this.repositoryService = Objects.requireNonNull(repositoryService, "repositoryService");
transformerFactory = TransformerFactory.newInstance();
transformerFactory.setAttribute(XMLConstants.ACCESS_EXTERNAL_DTD, "");
@@ -78,14 +83,6 @@ public ProcessService(ThymeleafTemplateService templateService, RepositoryServic
}
}
- @Override
- public void afterPropertiesSet() throws Exception
- {
- super.afterPropertiesSet();
-
- Objects.requireNonNull(repositoryService, "repositoryService");
- }
-
@GET
@Path("/{key}")
@Produces({ MediaType.TEXT_HTML })
diff --git a/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/webservice/RootService.java b/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/webservice/RootService.java
index ebbbde152..12d31ff57 100644
--- a/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/webservice/RootService.java
+++ b/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/webservice/RootService.java
@@ -26,7 +26,6 @@
import org.operaton.bpm.engine.repository.ProcessDefinition;
import org.operaton.bpm.engine.runtime.ActivityInstance;
import org.operaton.bpm.engine.runtime.ProcessInstance;
-import org.springframework.beans.factory.InitializingBean;
import org.thymeleaf.context.Context;
import dev.dsf.bpe.ui.ThymeleafTemplateService;
@@ -40,29 +39,28 @@
@RolesAllowed("ADMIN")
@Path(RootService.PATH)
-public class RootService extends AbstractService implements InitializingBean
+public class RootService extends AbstractService
{
public static final String PATH = "";
private final RepositoryService repositoryService;
private final RuntimeService runtimeService;
+ /**
+ * @param templateService
+ * not null
+ * @param repositoryService
+ * not null
+ * @param runtimeService
+ * not null
+ */
public RootService(ThymeleafTemplateService templateService, RepositoryService repositoryService,
RuntimeService runtimeService)
{
super(templateService, "root");
- this.repositoryService = repositoryService;
- this.runtimeService = runtimeService;
- }
-
- @Override
- public void afterPropertiesSet() throws Exception
- {
- super.afterPropertiesSet();
-
- Objects.requireNonNull(repositoryService, "repositoryService");
- Objects.requireNonNull(runtimeService, "runtimeService");
+ this.repositoryService = Objects.requireNonNull(repositoryService, "repositoryService");
+ this.runtimeService = Objects.requireNonNull(runtimeService, "runtimeService");
}
@GET
diff --git a/dsf-bpe/dsf-bpe-server/src/test/java/dev/dsf/bpe/integration/AbstractIntegrationTest.java b/dsf-bpe/dsf-bpe-server/src/test/java/dev/dsf/bpe/integration/AbstractIntegrationTest.java
index e6d700d22..1d5d96d1f 100644
--- a/dsf-bpe/dsf-bpe-server/src/test/java/dev/dsf/bpe/integration/AbstractIntegrationTest.java
+++ b/dsf-bpe/dsf-bpe-server/src/test/java/dev/dsf/bpe/integration/AbstractIntegrationTest.java
@@ -15,12 +15,7 @@
*/
package dev.dsf.bpe.integration;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-
import java.io.IOException;
-import java.net.URI;
import java.nio.channels.ServerSocketChannel;
import java.nio.charset.StandardCharsets;
import java.nio.file.FileVisitResult;
@@ -37,7 +32,9 @@
import java.util.List;
import java.util.Map;
import java.util.UUID;
+import java.util.concurrent.CompletableFuture;
import java.util.function.BiConsumer;
+import java.util.function.Consumer;
import java.util.function.Function;
import java.util.function.Supplier;
import java.util.regex.Matcher;
@@ -55,6 +52,7 @@
import org.glassfish.jersey.servlet.init.JerseyServletContainerInitializer;
import org.hl7.fhir.r4.model.Bundle;
import org.hl7.fhir.r4.model.Subscription;
+import org.hl7.fhir.r4.model.Task;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.ClassRule;
@@ -69,10 +67,10 @@
import com.icegreen.greenmail.util.ServerSetupTest;
import ca.uhn.fhir.context.FhirContext;
-import ca.uhn.fhir.parser.IParser;
import de.hsheilbronn.mi.utils.crypto.keystore.KeyStoreCreator;
import de.hsheilbronn.mi.utils.test.PostgreSqlContainerLiquibaseTemplateClassRule;
import de.hsheilbronn.mi.utils.test.PostgresTemplateRule;
+import dev.dsf.bpe.client.dsf.ClientProvider;
import dev.dsf.bpe.dao.AbstractDbTest;
import dev.dsf.common.auth.ClientCertificateAuthenticator;
import dev.dsf.common.auth.DelegatingAuthenticator;
@@ -80,10 +78,10 @@
import dev.dsf.common.auth.DsfSecurityHandler;
import dev.dsf.common.auth.StatusPortAuthenticator;
import dev.dsf.common.jetty.JettyServer;
+import dev.dsf.fhir.client.Endpoint;
import dev.dsf.fhir.client.FhirWebserviceClient;
import dev.dsf.fhir.client.FhirWebserviceClientJersey;
import dev.dsf.fhir.client.WebsocketClient;
-import dev.dsf.fhir.client.WebsocketClientTyrus;
import dev.dsf.fhir.service.ReferenceCleaner;
import dev.dsf.fhir.service.ReferenceCleanerImpl;
import dev.dsf.fhir.service.ReferenceExtractorImpl;
@@ -216,47 +214,34 @@ protected static FhirWebserviceClient getWebserviceClient()
return webserviceClient;
}
- protected static WebsocketClient getWebsocketClient()
+ protected static WebsocketClient createTaskWebsocketClient(Consumer onResource)
{
- Bundle bundle = getWebserviceClient().searchWithStrictHandling(Subscription.class,
- Map.of("criteria:exact",
- List.of("Task?_profile:below=http://dsf.dev/fhir/StructureDefinition/task-test"), "status",
- List.of("active"), "type", List.of("websocket"), "payload", List.of("application/fhir+json")));
-
- assertNotNull(bundle);
- assertEquals(1, bundle.getTotal());
- assertNotNull(bundle.getEntryFirstRep());
- assertTrue(bundle.getEntryFirstRep().getResource() instanceof Subscription);
-
- Subscription subscription = (Subscription) bundle.getEntryFirstRep().getResource();
- assertNotNull(subscription.getIdElement());
- assertNotNull(subscription.getIdElement().getIdPart());
-
- return createWebsocketClient(fhirServer.getApiPort(), certificates.getClientCertificate().trustStore(),
- certificates.getClientCertificate().keyStore(), certificates.getClientCertificate().keyStorePassword(),
- subscription.getIdElement().getIdPart());
- }
+ Endpoint endpoint = new Endpoint()
+ {
+ @Override
+ public Subscription getSubscription()
+ {
+ Bundle bundle = getWebserviceClient().searchWithStrictHandling(Subscription.class,
+ Map.of("criteria:exact",
+ List.of("Task?_profile:below=http://dsf.dev/fhir/StructureDefinition/task-test"),
+ "status", List.of("active"), "type", List.of("websocket"), "payload",
+ List.of("application/fhir+json")));
+ return (Subscription) bundle.getEntryFirstRep().getResource();
+ }
- private static WebsocketClient createWebsocketClient(int fhirApiPort, KeyStore trustStore, KeyStore keyStore,
- char[] keyStorePassword, String subscriptionIdPart)
- {
- return new WebsocketClientTyrus(() ->
- {}, URI.create("wss://localhost:" + fhirApiPort + FHIR_CONTEXT_PATH + "/ws"), trustStore, keyStore,
- keyStorePassword, null, null, null, "Integration Test Client", subscriptionIdPart);
- }
+ @Override
+ public CompletableFuture onMessage(Subscription subscription, String message)
+ {
+ Task resource = fhirContext.newJsonParser().parseResource(Task.class, message);
+ if (onResource != null)
+ onResource.accept(resource);
- protected static IParser newJsonParser()
- {
- return newParser(fhirContext::newJsonParser);
- }
+ return CompletableFuture.completedFuture(null);
+ }
+ };
- private static IParser newParser(Supplier supplier)
- {
- IParser p = supplier.get();
- p.setStripVersionsFromReferences(false);
- p.setOverrideResourceIdWithBundleEntryFullUrl(false);
- p.setPrettyPrint(true);
- return p;
+ ClientProvider clientProvider = getBpeSpringWebApplicationContext().getBean(ClientProvider.class);
+ return clientProvider.createWebsocketClient(endpoint, "test-task");
}
private static JettyServer startFhirServer(ServerSocketChannel statusConnectorChannel,
diff --git a/dsf-bpe/dsf-bpe-server/src/test/java/dev/dsf/bpe/integration/AbstractPluginIntegrationTest.java b/dsf-bpe/dsf-bpe-server/src/test/java/dev/dsf/bpe/integration/AbstractPluginIntegrationTest.java
index c8bc74f0b..33fe56cb1 100644
--- a/dsf-bpe/dsf-bpe-server/src/test/java/dev/dsf/bpe/integration/AbstractPluginIntegrationTest.java
+++ b/dsf-bpe/dsf-bpe-server/src/test/java/dev/dsf/bpe/integration/AbstractPluginIntegrationTest.java
@@ -100,8 +100,7 @@ protected static void verifyProcessPluginResourcesExistForVersion(String version
protected final void executePluginTest(Task task) throws InterruptedException
{
BlockingDeque events = new LinkedBlockingDeque<>();
- WebsocketClient websocketClient = getWebsocketClient();
- websocketClient.setResourceHandler(events::add, PluginV1IntegrationTest::newJsonParser);
+ WebsocketClient websocketClient = createTaskWebsocketClient(events::add);
websocketClient.connect();
try
@@ -159,7 +158,7 @@ protected final void executePluginTest(Task task) throws InterruptedException
Thread.sleep(Duration.ofMillis(500));
if (websocketClient != null)
- websocketClient.disconnect();
+ websocketClient.close();
}
}
diff --git a/dsf-bpe/dsf-bpe-test-plugin-v1/src/main/java/dev/dsf/bpe/test/service/AbstractTest.java b/dsf-bpe/dsf-bpe-test-plugin-v1/src/main/java/dev/dsf/bpe/test/service/AbstractTest.java
index 168c0c754..ec93a4741 100644
--- a/dsf-bpe/dsf-bpe-test-plugin-v1/src/main/java/dev/dsf/bpe/test/service/AbstractTest.java
+++ b/dsf-bpe/dsf-bpe-test-plugin-v1/src/main/java/dev/dsf/bpe/test/service/AbstractTest.java
@@ -28,6 +28,10 @@
public abstract class AbstractTest extends AbstractServiceDelegate
{
+ /**
+ * @param api
+ * not null
+ */
public AbstractTest(ProcessPluginApi api)
{
super(api);
diff --git a/dsf-bpe/dsf-bpe-test-plugin-v1/src/main/java/dev/dsf/bpe/test/service/EnvironmentVariableTest.java b/dsf-bpe/dsf-bpe-test-plugin-v1/src/main/java/dev/dsf/bpe/test/service/EnvironmentVariableTest.java
index 6a53cf675..350273162 100644
--- a/dsf-bpe/dsf-bpe-test-plugin-v1/src/main/java/dev/dsf/bpe/test/service/EnvironmentVariableTest.java
+++ b/dsf-bpe/dsf-bpe-test-plugin-v1/src/main/java/dev/dsf/bpe/test/service/EnvironmentVariableTest.java
@@ -20,33 +20,33 @@
import java.util.Objects;
-import org.springframework.beans.factory.InitializingBean;
-
import dev.dsf.bpe.test.PluginTest;
import dev.dsf.bpe.v1.ProcessPluginApi;
-public class EnvironmentVariableTest extends AbstractTest implements InitializingBean
+public class EnvironmentVariableTest extends AbstractTest
{
private final String envVariableMandatory;
private final String envVariableOptional;
private final String envVariableProxyUrl;
+ /**
+ * @param api
+ * not null
+ * @param envVariableMandatory
+ * not null
+ * @param envVariableOptional
+ * not null
+ * @param envVariableProxyUrl
+ * not null
+ */
public EnvironmentVariableTest(ProcessPluginApi api, String envVariableMandatory, String envVariableOptional,
String envVariableProxyUrl)
{
super(api);
- this.envVariableMandatory = envVariableMandatory;
- this.envVariableOptional = envVariableOptional;
- this.envVariableProxyUrl = envVariableProxyUrl;
- }
-
- @Override
- public void afterPropertiesSet() throws Exception
- {
- Objects.requireNonNull(envVariableMandatory, "envVariableMandatory");
- Objects.requireNonNull(envVariableOptional, "envVariableOptional");
- Objects.requireNonNull(envVariableProxyUrl, "envVariableProxyUrl");
+ this.envVariableMandatory = Objects.requireNonNull(envVariableMandatory, "envVariableMandatory");
+ this.envVariableOptional = Objects.requireNonNull(envVariableOptional, "envVariableOptional");
+ this.envVariableProxyUrl = Objects.requireNonNull(envVariableProxyUrl, "envVariableProxyUrl");
}
@PluginTest
diff --git a/dsf-bpe/dsf-bpe-test-plugin-v2/src/main/java/dev/dsf/bpe/test/service/EnvironmentVariableTest.java b/dsf-bpe/dsf-bpe-test-plugin-v2/src/main/java/dev/dsf/bpe/test/service/EnvironmentVariableTest.java
index 3d1aa9b0c..8f4e2be36 100644
--- a/dsf-bpe/dsf-bpe-test-plugin-v2/src/main/java/dev/dsf/bpe/test/service/EnvironmentVariableTest.java
+++ b/dsf-bpe/dsf-bpe-test-plugin-v2/src/main/java/dev/dsf/bpe/test/service/EnvironmentVariableTest.java
@@ -20,8 +20,6 @@
import java.util.Objects;
-import org.springframework.beans.factory.InitializingBean;
-
import dev.dsf.bpe.test.AbstractTest;
import dev.dsf.bpe.test.PluginTest;
import dev.dsf.bpe.v2.ProcessPluginApi;
@@ -29,25 +27,25 @@
import dev.dsf.bpe.v2.error.ErrorBoundaryEvent;
import dev.dsf.bpe.v2.variables.Variables;
-public class EnvironmentVariableTest extends AbstractTest implements ServiceTask, InitializingBean
+public class EnvironmentVariableTest extends AbstractTest implements ServiceTask
{
private final String envVariableMandatory;
private final String envVariableOptional;
private final String envVariableProxyUrl;
+ /**
+ * @param envVariableMandatory
+ * not null
+ * @param envVariableOptional
+ * not null
+ * @param envVariableProxyUrl
+ * not null
+ */
public EnvironmentVariableTest(String envVariableMandatory, String envVariableOptional, String envVariableProxyUrl)
{
- this.envVariableMandatory = envVariableMandatory;
- this.envVariableOptional = envVariableOptional;
- this.envVariableProxyUrl = envVariableProxyUrl;
- }
-
- @Override
- public void afterPropertiesSet() throws Exception
- {
- Objects.requireNonNull(envVariableMandatory, "envVariableMandatory");
- Objects.requireNonNull(envVariableOptional, "envVariableOptional");
- Objects.requireNonNull(envVariableProxyUrl, "envVariableProxyUrl");
+ this.envVariableMandatory = Objects.requireNonNull(envVariableMandatory, "envVariableMandatory");
+ this.envVariableOptional = Objects.requireNonNull(envVariableOptional, "envVariableOptional");
+ this.envVariableProxyUrl = Objects.requireNonNull(envVariableProxyUrl, "envVariableProxyUrl");
}
@Override
diff --git a/dsf-common/dsf-common-auth/src/main/java/dev/dsf/common/auth/conf/AbstractIdentityProvider.java b/dsf-common/dsf-common-auth/src/main/java/dev/dsf/common/auth/conf/AbstractIdentityProvider.java
index ec4098791..61c6b4f1e 100644
--- a/dsf-common/dsf-common-auth/src/main/java/dev/dsf/common/auth/conf/AbstractIdentityProvider.java
+++ b/dsf-common/dsf-common-auth/src/main/java/dev/dsf/common/auth/conf/AbstractIdentityProvider.java
@@ -44,12 +44,11 @@
import org.hl7.fhir.r4.model.Practitioner;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.InitializingBean;
import dev.dsf.common.auth.DsfOpenIdCredentials;
import dev.dsf.common.auth.conf.RoleConfig.Mapping;
-public abstract class AbstractIdentityProvider implements IdentityProvider, InitializingBean
+public abstract class AbstractIdentityProvider implements IdentityProvider
{
private static final Logger logger = LoggerFactory.getLogger(AbstractIdentityProvider.class);
@@ -64,7 +63,7 @@ public abstract class AbstractIdentityProvider implements Ide
*/
public AbstractIdentityProvider(RoleConfig roleConfig)
{
- this.roleConfig = roleConfig;
+ this.roleConfig = Objects.requireNonNull(roleConfig, "roleConfig");
thumbprints = roleConfig.getEntries().stream().map(Mapping::getThumbprints).flatMap(List::stream).distinct()
.collect(Collectors.toUnmodifiableSet());
@@ -82,12 +81,6 @@ private String getHost(String serverBaseUrl)
}
}
- @Override
- public void afterPropertiesSet() throws Exception
- {
- Objects.requireNonNull(roleConfig, "roleConfig");
- }
-
@Override
public final Identity getIdentity(DsfOpenIdCredentials credentials)
{
diff --git a/dsf-common/dsf-common-db/pom.xml b/dsf-common/dsf-common-db/pom.xml
index 1eba894af..ad4cbca23 100644
--- a/dsf-common/dsf-common-db/pom.xml
+++ b/dsf-common/dsf-common-db/pom.xml
@@ -33,6 +33,10 @@
DSF Common DB
+
+ dev.dsf
+ dsf-common-status
+
org.postgresql
postgresql
diff --git a/dsf-common/dsf-common-db/src/main/java/dev/dsf/common/db/health/DatabaseHealthCheck.java b/dsf-common/dsf-common-db/src/main/java/dev/dsf/common/db/health/DatabaseHealthCheck.java
new file mode 100644
index 000000000..b42ea5219
--- /dev/null
+++ b/dsf-common/dsf-common-db/src/main/java/dev/dsf/common/db/health/DatabaseHealthCheck.java
@@ -0,0 +1,52 @@
+/*
+ * Copyright 2018-2025 Heilbronn University of Applied Sciences
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package dev.dsf.common.db.health;
+
+import java.sql.Connection;
+import java.sql.SQLException;
+import java.util.Objects;
+
+import javax.sql.DataSource;
+
+import dev.dsf.common.status.health.HealthCheck;
+import dev.dsf.common.status.health.HealthStatus;
+
+public class DatabaseHealthCheck implements HealthCheck
+{
+ private final DataSource dataSource;
+
+ /**
+ * @param dataSource
+ * not null
+ */
+ public DatabaseHealthCheck(DataSource dataSource)
+ {
+ this.dataSource = Objects.requireNonNull(dataSource, "dataSource");
+ }
+
+ @Override
+ public HealthStatus check()
+ {
+ try (Connection _ = dataSource.getConnection())
+ {
+ return new HealthStatus("Database", true, "Connection is healthy");
+ }
+ catch (SQLException e)
+ {
+ return new HealthStatus("Database", false, "Connection failed - " + e.getSQLState());
+ }
+ }
+}
diff --git a/dsf-common/dsf-common-jetty/src/main/java/dev/dsf/common/config/AbstractJettyConfig.java b/dsf-common/dsf-common-jetty/src/main/java/dev/dsf/common/config/AbstractJettyConfig.java
index 7fae8b6a5..bfb5ddd4a 100644
--- a/dsf-common/dsf-common-jetty/src/main/java/dev/dsf/common/config/AbstractJettyConfig.java
+++ b/dsf-common/dsf-common-jetty/src/main/java/dev/dsf/common/config/AbstractJettyConfig.java
@@ -16,10 +16,7 @@
package dev.dsf.common.config;
import java.io.IOException;
-import java.net.MalformedURLException;
import java.net.URI;
-import java.net.URISyntaxException;
-import java.net.URL;
import java.nio.file.Path;
import java.security.KeyStore;
import java.security.PrivateKey;
@@ -35,10 +32,11 @@
import java.util.function.Supplier;
import java.util.stream.Collectors;
+import org.eclipse.jetty.client.Authentication;
+import org.eclipse.jetty.client.BasicAuthentication;
import org.eclipse.jetty.client.HttpClient;
import org.eclipse.jetty.client.HttpProxy;
import org.eclipse.jetty.client.Origin.Address;
-import org.eclipse.jetty.client.ProxyConfiguration.Proxy;
import org.eclipse.jetty.client.transport.HttpClientTransportOverHTTP;
import org.eclipse.jetty.ee11.servlet.SessionHandler;
import org.eclipse.jetty.ee11.webapp.WebAppContext;
@@ -52,6 +50,8 @@
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.server.ServerConnector;
import org.eclipse.jetty.util.ssl.SslContextFactory;
+import org.eclipse.jetty.util.thread.ScheduledExecutorScheduler;
+import org.eclipse.jetty.util.thread.VirtualThreadPool;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
@@ -526,28 +526,6 @@ private Duration assertPositive(Duration duration)
return duration;
}
- private Proxy oidcClientProxy()
- {
- ProxyConfig config = proxyConfig();
- if (config.isEnabled(oidcProviderRealmBaseUrl))
- {
- try
- {
- URL proxyUrl = new URI(config.getUrl()).toURL();
-
- Address address = new Address(proxyUrl.getHost(),
- proxyUrl.getPort() < 0 ? proxyUrl.getDefaultPort() : proxyUrl.getPort());
- return new HttpProxy(address, "https".equals(proxyUrl.getProtocol()));
- }
- catch (MalformedURLException | URISyntaxException e)
- {
- throw new RuntimeException(e);
- }
- }
- else
- return null;
- }
-
@Bean
@Lazy
public ProxyConfig proxyConfig()
@@ -597,20 +575,48 @@ private HttpClient createOidcClient()
sslContextFactory.setKeyStorePassword(String.valueOf(oidcClientKeyStorePassword));
}
+ VirtualThreadPool threadPool = new VirtualThreadPool();
+ threadPool.setMaxConcurrentTasks(200);
+ threadPool.setName("oidc-client-pool-");
+
ClientConnector connector = new ClientConnector();
+ connector.setExecutor(threadPool);
+ connector.setScheduler(new ScheduledExecutorScheduler("oidc-client-scheduler", true));
connector.setSslContextFactory(sslContextFactory);
- connector.setIdleTimeout(oidcProviderClientTimeoutRead());
connector.setConnectTimeout(oidcProviderClientTimeoutConnect());
+ connector.setIdleTimeout(oidcProviderClientTimeoutRead());
HttpClient httpClient = new HttpClientWithGetRetry(new HttpClientTransportOverHTTP(connector), 5);
- if (oidcClientProxy() != null)
- httpClient.getProxyConfiguration().addProxy(oidcClientProxy());
-
httpClient.setUserAgentField(new HttpField(HttpHeader.USER_AGENT, buildInfoReader().getUserAgentValue()));
+ if (proxyConfig().isEnabled(oidcProviderRealmBaseUrl))
+ {
+ httpClient.getProxyConfiguration().addProxy(getProxy(sslContextFactory));
+ if (proxyConfig().getUsername() != null && proxyConfig().getPassword() != null)
+ httpClient.getAuthenticationStore().addAuthentication(getProxyAuthentication());
+ }
+
+
return httpClient;
}
+ private HttpProxy getProxy(SslContextFactory.Client sslFactory)
+ {
+ ProxyConfig proxyConfig = proxyConfig();
+ URI uri = URI.create(proxyConfig.getUrl());
+
+ return new HttpProxy(new Address(uri.getHost(), uri.getPort()),
+ "https".equals(uri.getScheme()) ? sslFactory : null);
+ }
+
+ private BasicAuthentication getProxyAuthentication()
+ {
+ ProxyConfig proxyConfig = proxyConfig();
+
+ return new BasicAuthentication(URI.create(proxyConfig.getUrl()), Authentication.ANY_REALM,
+ proxyConfig.getUsername(), new String(proxyConfig.getPassword()));
+ }
+
@Bean
public BuildInfoReader buildInfoReader()
{
diff --git a/dsf-common/dsf-common-jetty/src/main/java/dev/dsf/common/jetty/JettyServer.java b/dsf-common/dsf-common-jetty/src/main/java/dev/dsf/common/jetty/JettyServer.java
index 08e3375ad..6340fdac3 100644
--- a/dsf-common/dsf-common-jetty/src/main/java/dev/dsf/common/jetty/JettyServer.java
+++ b/dsf-common/dsf-common-jetty/src/main/java/dev/dsf/common/jetty/JettyServer.java
@@ -50,7 +50,8 @@
import org.eclipse.jetty.util.resource.PathResourceFactory;
import org.eclipse.jetty.util.resource.Resource;
import org.eclipse.jetty.util.ssl.SslContextFactory;
-import org.eclipse.jetty.util.thread.QueuedThreadPool;
+import org.eclipse.jetty.util.thread.ScheduledExecutorScheduler;
+import org.eclipse.jetty.util.thread.VirtualThreadPool;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -264,7 +265,12 @@ public JettyServer(Function apiConnectorProvider,
List> servletContainerInitializers,
Map initParameters, BiConsumer> securityHandlerConfigurer)
{
- server = new Server(threadPool());
+ VirtualThreadPool virtualThreadPool = new VirtualThreadPool(200);
+ virtualThreadPool.setName("jetty-virtual-");
+
+ ScheduledExecutorScheduler scheduler = new ScheduledExecutorScheduler("jetty-scheduler", false);
+
+ server = new Server(virtualThreadPool, scheduler, null);
apiConnector = apiConnectorProvider.apply(server);
server.addConnector(apiConnector);
statusConnector = statusConnectorProvider.apply(server);
@@ -278,13 +284,6 @@ public JettyServer(Function apiConnectorProvider,
server.setErrorHandler(statusCodeOnlyErrorHandler());
}
- private QueuedThreadPool threadPool()
- {
- QueuedThreadPool threadPool = new QueuedThreadPool();
- threadPool.setName("jetty-server");
- return threadPool;
- }
-
private WebAppContext webAppContext(String serverMavenModuleName, String contextPath,
List> initializers, Map initParameters)
{
@@ -336,7 +335,7 @@ private ErrorHandler statusCodeOnlyErrorHandler()
protected void generateResponse(Request request, Response response, int code, String message,
Throwable cause, Callback callback) throws IOException
{
- logger.info("Error {}: {}", code, message);
+ logger.debug("Error respone status {}: {}", code, message);
callback.succeeded();
}
};
@@ -369,7 +368,7 @@ public void start()
public void addShutdownHook()
{
- Runtime.getRuntime().addShutdownHook(new Thread(this::stop));
+ Runtime.getRuntime().addShutdownHook(Thread.ofPlatform().name("jetty-shutdown").unstarted(this::stop));
}
public void stop()
diff --git a/dsf-common/dsf-common-oidc/src/main/java/dev/dsf/common/oidc/BaseOidcClientJersey.java b/dsf-common/dsf-common-oidc/src/main/java/dev/dsf/common/oidc/BaseOidcClientJersey.java
index 05a199254..712812dbc 100644
--- a/dsf-common/dsf-common-oidc/src/main/java/dev/dsf/common/oidc/BaseOidcClientJersey.java
+++ b/dsf-common/dsf-common-oidc/src/main/java/dev/dsf/common/oidc/BaseOidcClientJersey.java
@@ -76,9 +76,9 @@ public class BaseOidcClientJersey implements BaseOidcClient
* @param userAgentValue
* may be null
* @param connectTimeout
- * not null
+ * not null, not negative, 0 represents infinity
* @param readTimeout
- * not null
+ * not null, not negative, 0 represents infinity
* @param logRequestsAndResponses
*/
public BaseOidcClientJersey(String baseUrl, String discoveryPath, KeyStore trustStore, KeyStore keyStore,
diff --git a/dsf-common/dsf-common-status/pom.xml b/dsf-common/dsf-common-status/pom.xml
index 01f3f0855..fb68bb973 100644
--- a/dsf-common/dsf-common-status/pom.xml
+++ b/dsf-common/dsf-common-status/pom.xml
@@ -47,29 +47,5 @@
jakarta.annotation-api
${jakarta.annotation.api.version}
-
- org.springframework
- spring-context
-
-
- commons-logging
- commons-logging
-
-
-
-
- org.apache.commons
- commons-dbcp2
-
-
- commons-logging
- commons-logging
-
-
-
-
- org.slf4j
- jcl-over-slf4j
-
\ No newline at end of file
diff --git a/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/subscription/LocalFhirConnector.java b/dsf-common/dsf-common-status/src/main/java/dev/dsf/common/status/health/HealthCheck.java
similarity index 87%
rename from dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/subscription/LocalFhirConnector.java
rename to dsf-common/dsf-common-status/src/main/java/dev/dsf/common/status/health/HealthCheck.java
index 8834b685d..41b8022d3 100644
--- a/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/subscription/LocalFhirConnector.java
+++ b/dsf-common/dsf-common-status/src/main/java/dev/dsf/common/status/health/HealthCheck.java
@@ -13,9 +13,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package dev.dsf.bpe.subscription;
+package dev.dsf.common.status.health;
-public interface LocalFhirConnector
+public interface HealthCheck
{
- void connect();
-}
\ No newline at end of file
+ HealthStatus check();
+}
diff --git a/dsf-common/dsf-common-status/src/main/java/dev/dsf/common/status/health/HealthStatus.java b/dsf-common/dsf-common-status/src/main/java/dev/dsf/common/status/health/HealthStatus.java
new file mode 100644
index 000000000..45fb42343
--- /dev/null
+++ b/dsf-common/dsf-common-status/src/main/java/dev/dsf/common/status/health/HealthStatus.java
@@ -0,0 +1,20 @@
+/*
+ * Copyright 2018-2025 Heilbronn University of Applied Sciences
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package dev.dsf.common.status.health;
+
+public record HealthStatus(String component, boolean ok, String message)
+{
+}
diff --git a/dsf-common/dsf-common-status/src/main/java/dev/dsf/common/status/webservice/StatusService.java b/dsf-common/dsf-common-status/src/main/java/dev/dsf/common/status/webservice/StatusService.java
index 37c3a3613..3158832fa 100644
--- a/dsf-common/dsf-common-status/src/main/java/dev/dsf/common/status/webservice/StatusService.java
+++ b/dsf-common/dsf-common-status/src/main/java/dev/dsf/common/status/webservice/StatusService.java
@@ -15,16 +15,14 @@
*/
package dev.dsf.common.status.webservice;
-import java.sql.Connection;
-import java.sql.SQLException;
-import java.util.Objects;
-
-import javax.sql.DataSource;
+import java.util.List;
+import java.util.function.Predicate;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.InitializingBean;
+import dev.dsf.common.status.health.HealthCheck;
+import dev.dsf.common.status.health.HealthStatus;
import jakarta.annotation.security.RolesAllowed;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.ws.rs.GET;
@@ -40,25 +38,19 @@
@Path(StatusService.PATH)
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
@RolesAllowed("STATUS_PORT_ROLE")
-public class StatusService implements InitializingBean
+public class StatusService
{
public static final String PATH = "status";
private static final Logger logger = LoggerFactory.getLogger(StatusService.class);
- private final DataSource dataSource;
private final int statusConnectorPort;
+ private final List healthChecks;
- public StatusService(DataSource dataSource, int statusConnectorPort)
+ public StatusService(int statusConnectorPort, List healthChecks)
{
- this.dataSource = dataSource;
this.statusConnectorPort = statusConnectorPort;
- }
-
- @Override
- public void afterPropertiesSet() throws Exception
- {
- Objects.requireNonNull(dataSource, "dataSource");
+ this.healthChecks = healthChecks == null ? List.of() : List.copyOf(healthChecks);
}
@GET
@@ -70,40 +62,14 @@ public Response status(@Context UriInfo uri, @Context HttpHeaders headers, @Cont
return Response.status(Status.UNAUTHORIZED).build();
}
- try (Connection _ = dataSource.getConnection())
- {
+ if (healthChecks.stream().map(HealthCheck::check).allMatch(HealthStatus::ok))
return Response.ok().build();
- }
- catch (SQLException e)
+ else
{
- String errorMessage = getErrorMessage(e);
+ healthChecks.stream().map(HealthCheck::check).filter(Predicate.not(HealthStatus::ok))
+ .forEach(s -> logger.debug("{}: {}", s.component(), s.message()));
- logger.debug("Error while accessing DB", e);
- logger.error("Error while accessing DB: {} - {}", e.getClass().getName(), errorMessage);
-
- return Response.serverError().build();
+ return Response.status(Status.SERVICE_UNAVAILABLE).build();
}
}
-
- private String getErrorMessage(Throwable e)
- {
- StringBuilder b = new StringBuilder();
-
- while (true)
- {
- b.append(e.getClass().getSimpleName());
- b.append(": ");
- b.append(e.getMessage());
-
- if (e.getCause() != null)
- {
- b.append(" -> ");
- e = e.getCause();
- }
- else
- break;
- }
-
- return b.toString();
- }
}
diff --git a/dsf-docker-dev-setup-3dic-ttp/docker-compose.yml b/dsf-docker-dev-setup-3dic-ttp/docker-compose.yml
index e08a8bb91..7076164df 100644
--- a/dsf-docker-dev-setup-3dic-ttp/docker-compose.yml
+++ b/dsf-docker-dev-setup-3dic-ttp/docker-compose.yml
@@ -104,28 +104,31 @@ services:
- 127.0.0.1:8443:8443
environment:
TZ: Europe/Berlin
- KEYCLOAK_ADMIN: admin
- KEYCLOAK_ADMIN_PASSWORD: admin
+ KC_BOOTSTRAP_ADMIN_USERNAME: admin
+ KC_BOOTSTRAP_ADMIN_PASSWORD: admin
+ KC_DB: dev-file
+ KC_HOSTNAME: keycloak
+ KC_HTTPS_CERTIFICATE_FILE: /run/secrets/keycloak.chain.crt
+ KC_HTTPS_CERTIFICATE_KEY_FILE: /run/secrets/keycloak.key.plain
+ KC_TRUSTSTORE_PATHS: /run/secrets/root_ca.crt
+ KC_FEATURES_DISABLED: admin-fine-grained-authz,authorization,ciba,client-auth-federated,client-policies,client-secret-rotation,device-flow,dpop,identity-brokering-api,impersonation,jwt-authorization-grant,kerberos,kubernetes-service-accounts,log-mdc,opentelemetry,organization,par,passkeys,recovery-codes,scim-api,step-up-authentication,step-up-authentication-saml,token-exchange-standard,twitter-broker,update-email,user-event-metrics,web-authn,workflows
+ KC_SPI_STICKY_SESSION_ENCODER__INFINISPAN__SHOULD_ATTACH_ROUTE: 'false'
secrets:
- keycloak.chain.crt
- keycloak.key.plain
- - keycloak_trust_store.jks
+ - root_ca.crt
volumes:
- type: bind
- source: ./keycloak
+ source: ./keycloak/realms
target: /opt/keycloak/data/import
+ read_only: true
+ - type: bind
+ source: ./keycloak/themes
+ target: /opt/keycloak/themes
+ read_only: true
networks:
- internet
- command: >-
- start
- --db dev-file
- --hostname keycloak
- --import-realm
- --https-certificate-file=/run/secrets/keycloak.chain.crt
- --https-certificate-key-file=/run/secrets/keycloak.key.plain
- --spi-truststore-file-file=/run/secrets/keycloak_trust_store.jks
- --spi-truststore-file-password=password
- --features-disabled=twitter-broker,identity-brokering-api
+ command: start --import-realm
forward-proxy:
build: ./forward-proxy
@@ -136,6 +139,19 @@ services:
forward-proxy:
internet:
+ forward-proxy-tls:
+ build: ./forward-proxy-tls
+ restart: "no"
+ secrets:
+ - forward-proxy-tls.chain.crt
+ - forward-proxy-tls.key.plain
+ environment:
+ TZ: Europe/Berlin
+ networks:
+ - forward-proxy
+ depends_on:
+ - forward-proxy
+
dic1-fhir:
build: ../dsf-fhir/dsf-fhir-server-jetty/docker
image: datasharingframework/fhir
@@ -207,7 +223,7 @@ services:
DEV_DSF_SERVER_AUTH_OIDC_AUTHORIZATION_CODE_FLOW: 'true'
DEV_DSF_SERVER_AUTH_OIDC_BACK_CHANNEL_LOGOUT: 'true'
DEV_DSF_SERVER_AUTH_OIDC_BEARER_TOKEN: 'true'
- DEV_DSF_SERVER_AUTH_OIDC_BEARER_TOKEN_AUDIENCE: 'account'
+ DEV_DSF_SERVER_AUTH_OIDC_BEARER_TOKEN_AUDIENCE: 'dic1-fhir'
DEV_DSF_SERVER_AUTH_OIDC_PROVIDER_REALM_BASE_URL: https://keycloak:8443/realms/dic1
DEV_DSF_SERVER_AUTH_OIDC_PROVIDER_CLIENT_TRUST_SERVER_CERTIFICATE_CAS: /run/secrets/root_ca.crt
DEV_DSF_SERVER_AUTH_OIDC_CLIENT_ID: dic1-fhir
@@ -552,10 +568,9 @@ services:
DEV_DSF_SERVER_AUTH_OIDC_CLIENT_ID: dic1-bpe
DEV_DSF_SERVER_AUTH_OIDC_CLIENT_SECRET_FILE: /run/secrets/oidc_client_dic1_bpe.secret
DEV_DSF_SERVER_AUTH_TRUST_REVERSE_PROXY: 172.20.0.66
- DEV_DSF_PROXY_URL: http://forward-proxy:8080
+ DEV_DSF_PROXY_URL: https://forward-proxy-tls:8443
DEV_DSF_PROXY_USERNAME: proxy_user
DEV_DSF_PROXY_PASSWORD: proxy_password
- DEV_DSF_PROXY_NOPROXY: keycloak
DEV_DSF_BPE_FHIR_CLIENT_CONNECTIONS_CONFIG: |
ttp-fhir-cert-auth:
base-url: https://ttp/fhir
@@ -579,7 +594,7 @@ services:
test-connection-on-startup: yes
client-id: dic1-bpe
client-secret-file: /run/secrets/oidc_client_dic1_bpe.secret
- required-audience: account
+ required-audience: dic1-fhir
DEV_DSF_BPE_FHIR_CLIENT_CONNECTIONS_CONFIG_DEFAULT_TRUST_SERVER_CERTIFICATE_CAS: /run/secrets/root_ca.crt
networks:
dic1-bpe-frontend:
@@ -592,7 +607,7 @@ services:
- dic1-fhir
- mailhog
- keycloak
- - forward-proxy
+ - forward-proxy-tls
dic2-bpe:
build: ../dsf-bpe/dsf-bpe-server-jetty/docker
@@ -673,16 +688,21 @@ services:
DEV_DSF_SERVER_AUTH_OIDC_CLIENT_ID: dic2-bpe
DEV_DSF_SERVER_AUTH_OIDC_CLIENT_SECRET_FILE: /run/secrets/oidc_client_dic2_bpe.secret
DEV_DSF_SERVER_AUTH_TRUST_REVERSE_PROXY: 172.20.0.82
+ DEV_DSF_PROXY_URL: http://forward-proxy:8080
+ DEV_DSF_PROXY_USERNAME: proxy_user
+ DEV_DSF_PROXY_PASSWORD: proxy_password
networks:
dic2-bpe-frontend:
ipv4_address: 172.20.0.83
dic2-bpe-backend:
internet:
+ forward-proxy:
depends_on:
- db
- dic2-fhir
- mailhog
- keycloak
+ - forward-proxy
dic3-bpe:
build: ../dsf-bpe/dsf-bpe-server-jetty/docker
@@ -905,6 +925,11 @@ secrets:
ttp.key.password:
file: ./secrets/ttp.key.password
+ forward-proxy-tls.chain.crt:
+ file: ./secrets/forward-proxy-tls.chain.crt
+ forward-proxy-tls.key.plain:
+ file: ./secrets/forward-proxy-tls.key.plain
+
root_ca.crt:
file: ./secrets/root_ca.crt
issuing_ca.crt:
diff --git a/dsf-docker-dev-setup-3dic-ttp/forward-proxy-tls/Dockerfile b/dsf-docker-dev-setup-3dic-ttp/forward-proxy-tls/Dockerfile
new file mode 100644
index 000000000..aa7caa61c
--- /dev/null
+++ b/dsf-docker-dev-setup-3dic-ttp/forward-proxy-tls/Dockerfile
@@ -0,0 +1,22 @@
+#
+# Copyright 2018-2025 Heilbronn University of Applied Sciences
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+FROM alpine:3.24
+RUN apk add --no-cache stunnel
+COPY --chmod=0444 stunnel.conf /etc/stunnel/stunnel.conf
+USER nobody
+ENTRYPOINT ["stunnel"]
+CMD ["/etc/stunnel/stunnel.conf"]
\ No newline at end of file
diff --git a/dsf-docker-dev-setup-3dic-ttp/forward-proxy-tls/stunnel.conf b/dsf-docker-dev-setup-3dic-ttp/forward-proxy-tls/stunnel.conf
new file mode 100644
index 000000000..b369109d6
--- /dev/null
+++ b/dsf-docker-dev-setup-3dic-ttp/forward-proxy-tls/stunnel.conf
@@ -0,0 +1,27 @@
+#
+# Copyright 2018-2025 Heilbronn University of Applied Sciences
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+foreground = yes
+debug = info
+
+[tinyproxy]
+accept = 8443
+connect = forward-proxy:8080
+
+cert = /run/secrets/forward-proxy-tls.chain.crt
+key = /run/secrets/forward-proxy-tls.key.plain
+
+sslVersionMin = TLSv1.2
\ No newline at end of file
diff --git a/dsf-docker-dev-setup-3dic-ttp/forward-proxy/Dockerfile b/dsf-docker-dev-setup-3dic-ttp/forward-proxy/Dockerfile
index 2349786fa..138080418 100644
--- a/dsf-docker-dev-setup-3dic-ttp/forward-proxy/Dockerfile
+++ b/dsf-docker-dev-setup-3dic-ttp/forward-proxy/Dockerfile
@@ -16,5 +16,7 @@
FROM alpine:3.24
RUN apk add --no-cache tinyproxy
-COPY tinyproxy.conf /etc/tinyproxy/tinyproxy.conf
-CMD ["tinyproxy", "-d"]
\ No newline at end of file
+COPY --chmod=0444 tinyproxy.conf /etc/tinyproxy/tinyproxy.conf
+USER nobody
+ENTRYPOINT ["tinyproxy"]
+CMD ["-d"]
\ No newline at end of file
diff --git a/dsf-docker-dev-setup-3dic-ttp/keycloak/dic1.json b/dsf-docker-dev-setup-3dic-ttp/keycloak/realms/dic1.json
similarity index 98%
rename from dsf-docker-dev-setup-3dic-ttp/keycloak/dic1.json
rename to dsf-docker-dev-setup-3dic-ttp/keycloak/realms/dic1.json
index 4472b6ca7..c70a8e942 100644
--- a/dsf-docker-dev-setup-3dic-ttp/keycloak/dic1.json
+++ b/dsf-docker-dev-setup-3dic-ttp/keycloak/realms/dic1.json
@@ -26,6 +26,7 @@
"oauth2DeviceCodeLifespan" : 600,
"oauth2DevicePollingInterval" : 5,
"enabled" : true,
+ "loginTheme": "dsf",
"sslRequired" : "external",
"registrationAllowed" : false,
"registrationEmailAsUsername" : false,
@@ -404,8 +405,36 @@
"realmRoles" : [ "default-roles-dic1", "admin" ],
"notBefore" : 0,
"groups" : [ ]
- } ],
+ }, {
+ "id": "d93594e2-000f-40db-9652-bff9d7b9274d",
+ "username": "service-account-dic1-bpe",
+ "emailVerified": false,
+ "enabled": true,
+ "createdTimestamp": 1794960797689,
+ "totp": false,
+ "serviceAccountClientId": "dic1-bpe",
+ "disableableCredentialTypes": [],
+ "requiredActions": [],
+ "realmRoles": [
+ "default-roles-dic1",
+ "admin"
+ ],
+ "notBefore": 0,
+ "groups": []
+ } ],
"scopeMappings" : [ {
+ "client": "dic1-bpe",
+ "roles": [
+ "admin"
+ ]
+ },
+ {
+ "client": "dic1-fhir",
+ "roles": [
+ "admin"
+ ]
+ },
+ {
"clientScope" : "offline_access",
"roles" : [ "offline_access" ]
} ],
@@ -433,7 +462,6 @@
"standardFlowEnabled" : true,
"implicitFlowEnabled" : false,
"directAccessGrantsEnabled" : false,
- "serviceAccountsEnabled" : false,
"publicClient" : true,
"frontchannelLogout" : false,
"protocol" : "openid-connect",
@@ -572,8 +600,24 @@
"backchannel.logout.revoke.offline.tokens" : "false"
},
"authenticationFlowBindingOverrides" : { },
- "fullScopeAllowed" : true,
+ "fullScopeAllowed" : false,
"nodeReRegistrationTimeout" : -1,
+ "protocolMappers": [
+ {
+ "id": "55c4b861-ec4b-4aa9-b414-37f2710bbf84",
+ "name": "aud",
+ "protocol": "openid-connect",
+ "protocolMapper": "oidc-audience-mapper",
+ "consentRequired": false,
+ "config": {
+ "included.client.audience": "dic1-fhir",
+ "id.token.claim": "false",
+ "lightweight.claim": "false",
+ "access.token.claim": "true",
+ "introspection.token.claim": "true"
+ }
+ }
+ ],
"defaultClientScopes" : [ "web-origins", "acr", "profile", "roles", "email" ],
"optionalClientScopes" : [ "address", "phone", "offline_access", "microprofile-jwt" ]
}, {
@@ -1846,7 +1890,7 @@
"alias" : "webauthn-register",
"name" : "Webauthn Register",
"providerId" : "webauthn-register",
- "enabled" : true,
+ "enabled" : false,
"defaultAction" : false,
"priority" : 70,
"config" : { }
@@ -1854,7 +1898,7 @@
"alias" : "webauthn-register-passwordless",
"name" : "Webauthn Register Passwordless",
"providerId" : "webauthn-register-passwordless",
- "enabled" : true,
+ "enabled" : false,
"defaultAction" : false,
"priority" : 80,
"config" : { }
diff --git a/dsf-docker-dev-setup-3dic-ttp/keycloak/dic2.json b/dsf-docker-dev-setup-3dic-ttp/keycloak/realms/dic2.json
similarity index 99%
rename from dsf-docker-dev-setup-3dic-ttp/keycloak/dic2.json
rename to dsf-docker-dev-setup-3dic-ttp/keycloak/realms/dic2.json
index 359ca64e9..a86c87188 100644
--- a/dsf-docker-dev-setup-3dic-ttp/keycloak/dic2.json
+++ b/dsf-docker-dev-setup-3dic-ttp/keycloak/realms/dic2.json
@@ -26,6 +26,7 @@
"oauth2DeviceCodeLifespan" : 600,
"oauth2DevicePollingInterval" : 5,
"enabled" : true,
+ "loginTheme": "dsf",
"sslRequired" : "external",
"registrationAllowed" : false,
"registrationEmailAsUsername" : false,
diff --git a/dsf-docker-dev-setup-3dic-ttp/keycloak/dic3.json b/dsf-docker-dev-setup-3dic-ttp/keycloak/realms/dic3.json
similarity index 99%
rename from dsf-docker-dev-setup-3dic-ttp/keycloak/dic3.json
rename to dsf-docker-dev-setup-3dic-ttp/keycloak/realms/dic3.json
index beda897c4..09e8a078d 100644
--- a/dsf-docker-dev-setup-3dic-ttp/keycloak/dic3.json
+++ b/dsf-docker-dev-setup-3dic-ttp/keycloak/realms/dic3.json
@@ -26,6 +26,7 @@
"oauth2DeviceCodeLifespan" : 600,
"oauth2DevicePollingInterval" : 5,
"enabled" : true,
+ "loginTheme": "dsf",
"sslRequired" : "external",
"registrationAllowed" : false,
"registrationEmailAsUsername" : false,
diff --git a/dsf-docker-dev-setup-3dic-ttp/keycloak/ttp.json b/dsf-docker-dev-setup-3dic-ttp/keycloak/realms/ttp.json
similarity index 99%
rename from dsf-docker-dev-setup-3dic-ttp/keycloak/ttp.json
rename to dsf-docker-dev-setup-3dic-ttp/keycloak/realms/ttp.json
index 54e295124..06828718b 100644
--- a/dsf-docker-dev-setup-3dic-ttp/keycloak/ttp.json
+++ b/dsf-docker-dev-setup-3dic-ttp/keycloak/realms/ttp.json
@@ -26,6 +26,7 @@
"oauth2DeviceCodeLifespan" : 600,
"oauth2DevicePollingInterval" : 5,
"enabled" : true,
+ "loginTheme": "dsf",
"sslRequired" : "external",
"registrationAllowed" : false,
"registrationEmailAsUsername" : false,
diff --git a/dsf-docker-dev-setup-3dic-ttp/keycloak/themes/dsf/login/resources/css/custom.css b/dsf-docker-dev-setup-3dic-ttp/keycloak/themes/dsf/login/resources/css/custom.css
new file mode 100644
index 000000000..9209563e4
--- /dev/null
+++ b/dsf-docker-dev-setup-3dic-ttp/keycloak/themes/dsf/login/resources/css/custom.css
@@ -0,0 +1,44 @@
+/**
+ * Copyright 2018-2025 Heilbronn University of Applied Sciences
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+:root {
+ --pf-v5-global--primary-color--100: #326f95;
+ --pf-v5-global--primary-color--200: #326f95;
+ --pf-v5-global--link--Color: #326f95;
+ --keycloak-card-top-color: #326f95;
+}
+
+body, .login-pf, .login-pf-page {
+ background: #ffffff !important;
+}
+
+.pf-v5-c-form-control {
+ --pf-v5-c-form-control--focus--after--BorderBottomColor: #326f95;
+ --pf-v5-c-form-control--hover--after--BorderBottomColor: #326f95;
+}
+
+#kc-header-wrapper {
+ display: none !important;
+}
+
+#kc-header {
+ background-image: url("../img/logo.svg");
+ background-repeat: no-repeat;
+ background-position: center;
+ background-size: contain;
+ height: 8em;
+ margin-block-start: 0;
+ margin-bottom: 3em;
+}
\ No newline at end of file
diff --git a/dsf-docker-dev-setup-3dic-ttp/keycloak/themes/dsf/login/resources/img/logo.svg b/dsf-docker-dev-setup-3dic-ttp/keycloak/themes/dsf/login/resources/img/logo.svg
new file mode 100644
index 000000000..eb6b28ef6
--- /dev/null
+++ b/dsf-docker-dev-setup-3dic-ttp/keycloak/themes/dsf/login/resources/img/logo.svg
@@ -0,0 +1,228 @@
+
+
+
diff --git a/dsf-docker-dev-setup-3dic-ttp/keycloak/themes/dsf/login/theme.properties b/dsf-docker-dev-setup-3dic-ttp/keycloak/themes/dsf/login/theme.properties
new file mode 100644
index 000000000..a7d998f08
--- /dev/null
+++ b/dsf-docker-dev-setup-3dic-ttp/keycloak/themes/dsf/login/theme.properties
@@ -0,0 +1,18 @@
+#
+# Copyright 2018-2025 Heilbronn University of Applied Sciences
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+parent=keycloak.v2
+styles=css/styles.css css/custom.css
\ No newline at end of file
diff --git a/dsf-docker-dev-setup-3dic-ttp/proxy/conf.d/localhost.conf b/dsf-docker-dev-setup-3dic-ttp/proxy/conf.d/localhost.conf
index 0ef58e453..4cbcec7b5 100644
--- a/dsf-docker-dev-setup-3dic-ttp/proxy/conf.d/localhost.conf
+++ b/dsf-docker-dev-setup-3dic-ttp/proxy/conf.d/localhost.conf
@@ -25,4 +25,6 @@ server {
location / {
try_files /index.html =404;
}
+
+ ssl_verify_client off;
}
\ No newline at end of file
diff --git a/dsf-fhir/dsf-fhir-rest-adapter/src/main/java/dev/dsf/fhir/adapter/FhirAdapter.java b/dsf-fhir/dsf-fhir-rest-adapter/src/main/java/dev/dsf/fhir/adapter/FhirAdapter.java
index 93035d624..96228240c 100755
--- a/dsf-fhir/dsf-fhir-rest-adapter/src/main/java/dev/dsf/fhir/adapter/FhirAdapter.java
+++ b/dsf-fhir/dsf-fhir-rest-adapter/src/main/java/dev/dsf/fhir/adapter/FhirAdapter.java
@@ -64,10 +64,16 @@ public class FhirAdapter implements MessageBodyReader, MessageBody
private final FhirContext fhirContext;
private final ReferenceCleaner referenceCleaner;
+ /**
+ * @param fhirContext
+ * not null
+ * @param referenceCleaner
+ * not null
+ */
public FhirAdapter(FhirContext fhirContext, ReferenceCleaner referenceCleaner)
{
- this.fhirContext = fhirContext;
- this.referenceCleaner = referenceCleaner;
+ this.fhirContext = Objects.requireNonNull(fhirContext, "fhirContext");
+ this.referenceCleaner = Objects.requireNonNull(referenceCleaner, "referenceCleaner");
}
private IParser getParser(MediaType mediaType, Supplier parserFactor)
diff --git a/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/adapter/ResourceOperationOutcome.java b/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/adapter/ResourceOperationOutcome.java
index 1407b904d..8f4cf5289 100644
--- a/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/adapter/ResourceOperationOutcome.java
+++ b/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/adapter/ResourceOperationOutcome.java
@@ -25,7 +25,6 @@
import org.hl7.fhir.r4.model.OperationOutcome;
import org.hl7.fhir.r4.model.Resource;
import org.hl7.fhir.r4.model.ResourceType;
-import org.springframework.beans.factory.InitializingBean;
import dev.dsf.common.auth.conf.OrganizationIdentity;
import dev.dsf.common.auth.conf.PractitionerIdentity;
@@ -35,7 +34,7 @@
import dev.dsf.fhir.help.ExceptionHandler;
import dev.dsf.fhir.webservice.impl.RootServiceImpl;
-public class ResourceOperationOutcome extends AbstractThymeleafContext implements ThymeleafContext, InitializingBean
+public class ResourceOperationOutcome extends AbstractThymeleafContext implements ThymeleafContext
{
private record Element(String status, Boolean active, String type, String title, String subtitle, String unit,
String value, String link)
@@ -52,20 +51,20 @@ private record ByteSize(double value, String unit)
private final StatisticsDao statisticsDao;
private final ExceptionHandler exceptionHandler;
+ /**
+ * @param buildInfoReader
+ * not null
+ * @param statisticsDao
+ * not null
+ * @param exceptionHandler
+ * not null
+ */
public ResourceOperationOutcome(BuildInfoReader buildInfoReader, StatisticsDao statisticsDao,
ExceptionHandler exceptionHandler)
{
- this.buildInfoReader = buildInfoReader;
- this.statisticsDao = statisticsDao;
- this.exceptionHandler = exceptionHandler;
- }
-
- @Override
- public void afterPropertiesSet() throws Exception
- {
- Objects.requireNonNull(buildInfoReader, "buildInfoReader");
- Objects.requireNonNull(statisticsDao, "statisticsDao");
- Objects.requireNonNull(exceptionHandler, "exceptionHandler");
+ this.buildInfoReader = Objects.requireNonNull(buildInfoReader, "buildInfoReader");
+ this.statisticsDao = Objects.requireNonNull(statisticsDao, "statisticsDao");
+ this.exceptionHandler = Objects.requireNonNull(exceptionHandler, "exceptionHandler");
}
@Override
diff --git a/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/adapter/ThymeleafAdapter.java b/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/adapter/ThymeleafAdapter.java
index 94aeded9d..a7c78bb13 100644
--- a/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/adapter/ThymeleafAdapter.java
+++ b/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/adapter/ThymeleafAdapter.java
@@ -27,7 +27,6 @@
import org.hl7.fhir.r4.model.Bundle.BundleType;
import org.hl7.fhir.r4.model.Coding;
import org.hl7.fhir.r4.model.Resource;
-import org.springframework.beans.factory.InitializingBean;
import jakarta.ws.rs.Produces;
import jakarta.ws.rs.WebApplicationException;
@@ -41,7 +40,7 @@
@Provider
@Produces(MediaType.TEXT_HTML)
-public class ThymeleafAdapter implements MessageBodyWriter, InitializingBean
+public class ThymeleafAdapter implements MessageBodyWriter
{
@Context
private volatile UriInfo uriInfo;
@@ -51,15 +50,13 @@ public class ThymeleafAdapter implements MessageBodyWriter, Initializi
private final ThymeleafTemplateService thymeleafTemplateService;
+ /**
+ * @param thymeleafTemplateService
+ * not null
+ */
public ThymeleafAdapter(ThymeleafTemplateService thymeleafTemplateService)
{
- this.thymeleafTemplateService = thymeleafTemplateService;
- }
-
- @Override
- public void afterPropertiesSet() throws Exception
- {
- Objects.requireNonNull(thymeleafTemplateService, "thymeleafTemplateService");
+ this.thymeleafTemplateService = Objects.requireNonNull(thymeleafTemplateService, "thymeleafTemplateService");
}
@Override
diff --git a/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/adapter/ThymeleafTemplateServiceImpl.java b/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/adapter/ThymeleafTemplateServiceImpl.java
index c5dd2958b..fd7e8a521 100644
--- a/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/adapter/ThymeleafTemplateServiceImpl.java
+++ b/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/adapter/ThymeleafTemplateServiceImpl.java
@@ -48,7 +48,6 @@
import org.hl7.fhir.r4.model.Bundle.BundleLinkComponent;
import org.hl7.fhir.r4.model.IdType;
import org.hl7.fhir.r4.model.Resource;
-import org.springframework.beans.factory.InitializingBean;
import org.springframework.web.util.HtmlUtils;
import org.thymeleaf.TemplateEngine;
import org.thymeleaf.context.Context;
@@ -66,7 +65,7 @@
import jakarta.ws.rs.core.SecurityContext;
import jakarta.ws.rs.core.UriInfo;
-public class ThymeleafTemplateServiceImpl implements ThymeleafTemplateService, InitializingBean
+public class ThymeleafTemplateServiceImpl implements ThymeleafTemplateService
{
private static final String RESOURCE_NAMES = "Account|ActivityDefinition|AdverseEvent|AllergyIntolerance|Appointment|AppointmentResponse|AuditEvent|Basic|Binary"
+ "|BiologicallyDerivedProduct|BodyStructure|Bundle|CapabilityStatement|CarePlan|CareTeam|CatalogEntry|ChargeItem|ChargeItemDefinition|Claim|ClaimResponse"
@@ -130,9 +129,9 @@ private static record Heading(String href, String title, String text)
public ThymeleafTemplateServiceImpl(String serverBaseUrl, Theme theme, FhirContext fhirContext,
List extends ThymeleafContext> contexts, boolean cacheEnabled, boolean modCssExists)
{
- this.serverBaseUrl = serverBaseUrl;
+ this.serverBaseUrl = Objects.requireNonNull(serverBaseUrl, "serverBaseUrl");
this.theme = theme;
- this.fhirContext = fhirContext;
+ this.fhirContext = Objects.requireNonNull(fhirContext, "fhirContext");
this.modCssExists = modCssExists;
contextsByResourceType = contexts == null ? Map.of()
@@ -160,14 +159,6 @@ public ThymeleafTemplateServiceImpl(String serverBaseUrl, Theme theme, FhirConte
}
}
- @Override
- public void afterPropertiesSet() throws Exception
- {
- Objects.requireNonNull(serverBaseUrl, "serverBaseUrl");
- Objects.requireNonNull(fhirContext, "fhirContext");
- // theme may be null
- }
-
@Override
public void writeTo(Resource resource, Class> type, MediaType mediaType, UriInfo uriInfo,
SecurityContext securityContext, OutputStream outputStream) throws IOException
diff --git a/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/authentication/EndpointProviderImpl.java b/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/authentication/EndpointProviderImpl.java
index da5b9cff9..76e6afcbe 100644
--- a/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/authentication/EndpointProviderImpl.java
+++ b/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/authentication/EndpointProviderImpl.java
@@ -24,30 +24,29 @@
import org.hl7.fhir.r4.model.Identifier;
import org.hl7.fhir.r4.model.Organization;
import org.hl7.fhir.r4.model.Reference;
-import org.springframework.beans.factory.InitializingBean;
import dev.dsf.fhir.dao.EndpointDao;
import dev.dsf.fhir.help.ExceptionHandler;
-public class EndpointProviderImpl implements EndpointProvider, InitializingBean
+public class EndpointProviderImpl implements EndpointProvider
{
private final ExceptionHandler exceptionHandler;
private final EndpointDao dao;
private final String serverBaseUrl;
+ /**
+ * @param exceptionHandler
+ * not null
+ * @param dao
+ * not null
+ * @param serverBaseUrl
+ * not null
+ */
public EndpointProviderImpl(ExceptionHandler exceptionHandler, EndpointDao dao, String serverBaseUrl)
{
- this.exceptionHandler = exceptionHandler;
- this.dao = dao;
- this.serverBaseUrl = serverBaseUrl;
- }
-
- @Override
- public void afterPropertiesSet() throws Exception
- {
- Objects.requireNonNull(exceptionHandler, "exceptionHandler");
- Objects.requireNonNull(dao, "dao");
- Objects.requireNonNull(serverBaseUrl, "serverBaseUrl");
+ this.exceptionHandler = Objects.requireNonNull(exceptionHandler, "exceptionHandler");
+ this.dao = Objects.requireNonNull(dao, "dao");
+ this.serverBaseUrl = Objects.requireNonNull(serverBaseUrl, "serverBaseUrl");
}
@Override
diff --git a/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/authentication/IdentityProviderImpl.java b/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/authentication/IdentityProviderImpl.java
index 7164c8a7a..be8a4b63c 100644
--- a/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/authentication/IdentityProviderImpl.java
+++ b/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/authentication/IdentityProviderImpl.java
@@ -25,7 +25,6 @@
import org.hl7.fhir.r4.model.Practitioner;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.InitializingBean;
import dev.dsf.common.auth.conf.AbstractIdentityProvider;
import dev.dsf.common.auth.conf.Identity;
@@ -35,8 +34,7 @@
import dev.dsf.common.auth.conf.RoleConfig;
import dev.dsf.common.auth.conf.X509CertificateWrapper;
-public class IdentityProviderImpl extends AbstractIdentityProvider
- implements IdentityProvider, InitializingBean
+public class IdentityProviderImpl extends AbstractIdentityProvider implements IdentityProvider
{
private static final Logger logger = LoggerFactory.getLogger(IdentityProviderImpl.class);
@@ -44,22 +42,25 @@ public class IdentityProviderImpl extends AbstractIdentityProvidernull
+ * @param organizationProvider
+ * not null
+ * @param endpointProvider
+ * not null
+ * @param localOrganizationIdentifierValue
+ * not null
+ */
public IdentityProviderImpl(RoleConfig roleConfig, OrganizationProvider organizationProvider,
EndpointProvider endpointProvider, String localOrganizationIdentifierValue)
{
super(roleConfig);
- this.organizationProvider = organizationProvider;
- this.endpointProvider = endpointProvider;
- this.localOrganizationIdentifierValue = localOrganizationIdentifierValue;
- }
-
- @Override
- public void afterPropertiesSet() throws Exception
- {
- Objects.requireNonNull(organizationProvider, "organizationProvider");
- Objects.requireNonNull(endpointProvider, "endpointProvider");
- Objects.requireNonNull(localOrganizationIdentifierValue, "localOrganizationIdentifierValue");
+ this.organizationProvider = Objects.requireNonNull(organizationProvider, "organizationProvider");
+ this.endpointProvider = Objects.requireNonNull(endpointProvider, "endpointProvider");
+ this.localOrganizationIdentifierValue = Objects.requireNonNull(localOrganizationIdentifierValue,
+ "localOrganizationIdentifierValue");
}
@Override
diff --git a/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/authentication/OrganizationProviderImpl.java b/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/authentication/OrganizationProviderImpl.java
index 27af9ad20..b709ad056 100644
--- a/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/authentication/OrganizationProviderImpl.java
+++ b/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/authentication/OrganizationProviderImpl.java
@@ -20,32 +20,33 @@
import java.util.Optional;
import org.hl7.fhir.r4.model.Organization;
-import org.springframework.beans.factory.InitializingBean;
import dev.dsf.common.auth.conf.Identity;
import dev.dsf.common.auth.conf.OrganizationIdentityImpl;
import dev.dsf.fhir.dao.OrganizationDao;
import dev.dsf.fhir.help.ExceptionHandler;
-public class OrganizationProviderImpl implements OrganizationProvider, InitializingBean
+public class OrganizationProviderImpl implements OrganizationProvider
{
private final ExceptionHandler exceptionHandler;
private final OrganizationDao dao;
private final String localOrganizationIdentifierValue;
+ /**
+ * @param exceptionHandler
+ * not null
+ * @param dao
+ * not null
+ * @param localOrganizationIdentifierValue
+ * not null
+ */
public OrganizationProviderImpl(ExceptionHandler exceptionHandler, OrganizationDao dao,
String localOrganizationIdentifierValue)
{
- this.exceptionHandler = exceptionHandler;
- this.dao = dao;
- this.localOrganizationIdentifierValue = localOrganizationIdentifierValue;
- }
-
- @Override
- public void afterPropertiesSet() throws Exception
- {
- Objects.requireNonNull(dao, "dao");
- Objects.requireNonNull(localOrganizationIdentifierValue, "localOrganizationIdentifierValue");
+ this.exceptionHandler = Objects.requireNonNull(exceptionHandler, "exceptionHandler");
+ this.dao = Objects.requireNonNull(dao, "dao");
+ this.localOrganizationIdentifierValue = Objects.requireNonNull(localOrganizationIdentifierValue,
+ "localOrganizationIdentifierValue");
}
@Override
diff --git a/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/authorization/AbstractAuthorizationRule.java b/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/authorization/AbstractAuthorizationRule.java
index 5abcebe1c..de438732b 100644
--- a/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/authorization/AbstractAuthorizationRule.java
+++ b/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/authorization/AbstractAuthorizationRule.java
@@ -32,7 +32,6 @@
import org.hl7.fhir.r4.model.Resource;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.InitializingBean;
import ca.uhn.fhir.model.api.annotation.ResourceDef;
import dev.dsf.common.auth.conf.Identity;
@@ -56,7 +55,7 @@
import dev.dsf.fhir.service.ResourceReference.ReferenceType;
public abstract class AbstractAuthorizationRule>
- implements AuthorizationRule, InitializingBean
+ implements AuthorizationRule
{
private static final Logger logger = LoggerFactory.getLogger(AbstractAuthorizationRule.class);
@@ -79,17 +78,33 @@ public abstract class AbstractAuthorizationRulenull
+ * @param daoProvider
+ * not null
+ * @param serverBase
+ * not null
+ * @param referenceResolver
+ * not null
+ * @param organizationProvider
+ * not null
+ * @param readAccessHelper
+ * not null
+ * @param parameterConverter
+ * not null
+ */
public AbstractAuthorizationRule(Class resourceType, DaoProvider daoProvider, String serverBase,
ReferenceResolver referenceResolver, OrganizationProvider organizationProvider,
ReadAccessHelper readAccessHelper, ParameterConverter parameterConverter)
{
- this.resourceType = resourceType;
- this.daoProvider = daoProvider;
- this.serverBase = serverBase;
- this.referenceResolver = referenceResolver;
- this.organizationProvider = organizationProvider;
- this.readAccessHelper = readAccessHelper;
- this.parameterConverter = parameterConverter;
+ this.resourceType = Objects.requireNonNull(resourceType, "resourceType");
+ this.daoProvider = Objects.requireNonNull(daoProvider, "daoProvider");
+ this.serverBase = Objects.requireNonNull(serverBase, "serverBase");
+ this.referenceResolver = Objects.requireNonNull(referenceResolver, "referenceResolver");
+ this.organizationProvider = Objects.requireNonNull(organizationProvider, "organizationProvider");
+ this.readAccessHelper = Objects.requireNonNull(readAccessHelper, "readAccessHelper");
+ this.parameterConverter = Objects.requireNonNull(parameterConverter, "parameterConverter");
createRole = FhirServerRoleImpl.create(resourceType);
readRole = FhirServerRoleImpl.read(resourceType);
@@ -101,18 +116,6 @@ public AbstractAuthorizationRule(Class resourceType, DaoProvider daoProvider,
websocketRole = FhirServerRoleImpl.websocket(resourceType);
}
- @Override
- public void afterPropertiesSet() throws Exception
- {
- Objects.requireNonNull(resourceType, "resourceType");
- Objects.requireNonNull(daoProvider, "daoProvider");
- Objects.requireNonNull(serverBase, "serverBase");
- Objects.requireNonNull(referenceResolver, "referenceResolver");
- Objects.requireNonNull(organizationProvider, "organizationProvider");
- Objects.requireNonNull(readAccessHelper, "readAccessHelper");
- Objects.requireNonNull(parameterConverter, "parameterConverter");
- }
-
@Override
public Class getResourceType()
{
diff --git a/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/authorization/AbstractMetaTagAuthorizationRule.java b/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/authorization/AbstractMetaTagAuthorizationRule.java
index 8ff61fbf0..49f2acf83 100644
--- a/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/authorization/AbstractMetaTagAuthorizationRule.java
+++ b/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/authorization/AbstractMetaTagAuthorizationRule.java
@@ -42,6 +42,22 @@ public abstract class AbstractMetaTagAuthorizationRulenull
+ * @param daoProvider
+ * not null
+ * @param serverBase
+ * not null
+ * @param referenceResolver
+ * not null
+ * @param organizationProvider
+ * not null
+ * @param readAccessHelper
+ * not null
+ * @param parameterConverter
+ * not null
+ */
public AbstractMetaTagAuthorizationRule(Class resourceType, DaoProvider daoProvider, String serverBase,
ReferenceResolver referenceResolver, OrganizationProvider organizationProvider,
ReadAccessHelper readAccessHelper, ParameterConverter parameterConverter)
diff --git a/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/authorization/ActivityDefinitionAuthorizationRule.java b/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/authorization/ActivityDefinitionAuthorizationRule.java
index cff828252..e4fac5da6 100644
--- a/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/authorization/ActivityDefinitionAuthorizationRule.java
+++ b/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/authorization/ActivityDefinitionAuthorizationRule.java
@@ -45,6 +45,22 @@ public class ActivityDefinitionAuthorizationRule
private final ProcessAuthorizationHelper processAuthorizationHelper;
+ /**
+ * @param daoProvider
+ * not null
+ * @param serverBase
+ * not null
+ * @param referenceResolver
+ * not null
+ * @param organizationProvider
+ * not null
+ * @param readAccessHelper
+ * not null
+ * @param parameterConverter
+ * not null
+ * @param processAuthorizationHelper
+ * not null
+ */
public ActivityDefinitionAuthorizationRule(DaoProvider daoProvider, String serverBase,
ReferenceResolver referenceResolver, OrganizationProvider organizationProvider,
ReadAccessHelper readAccessHelper, ParameterConverter parameterConverter,
@@ -53,15 +69,8 @@ public ActivityDefinitionAuthorizationRule(DaoProvider daoProvider, String serve
super(ActivityDefinition.class, daoProvider, serverBase, referenceResolver, organizationProvider,
readAccessHelper, parameterConverter);
- this.processAuthorizationHelper = processAuthorizationHelper;
- }
-
- @Override
- public void afterPropertiesSet() throws Exception
- {
- super.afterPropertiesSet();
-
- Objects.requireNonNull(processAuthorizationHelper, "processAuthorizationHelper");
+ this.processAuthorizationHelper = Objects.requireNonNull(processAuthorizationHelper,
+ "processAuthorizationHelper");
}
@Override
diff --git a/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/authorization/TaskAuthorizationRule.java b/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/authorization/TaskAuthorizationRule.java
index 0b790a5df..9cb98d5c5 100644
--- a/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/authorization/TaskAuthorizationRule.java
+++ b/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/authorization/TaskAuthorizationRule.java
@@ -82,6 +82,26 @@ public class TaskAuthorizationRule extends AbstractAuthorizationRulenull
+ * @param serverBase
+ * not null
+ * @param referenceResolver
+ * not null
+ * @param organizationProvider
+ * not null
+ * @param readAccessHelper
+ * not null
+ * @param parameterConverter
+ * not null
+ * @param processAuthorizationHelper
+ * not null
+ * @param fhirContext
+ * not null
+ * @param endpointProvider
+ * not null
+ */
public TaskAuthorizationRule(DaoProvider daoProvider, String serverBase, ReferenceResolver referenceResolver,
OrganizationProvider organizationProvider, ReadAccessHelper readAccessHelper,
ParameterConverter parameterConverter, ProcessAuthorizationHelper processAuthorizationHelper,
@@ -90,19 +110,10 @@ public TaskAuthorizationRule(DaoProvider daoProvider, String serverBase, Referen
super(Task.class, daoProvider, serverBase, referenceResolver, organizationProvider, readAccessHelper,
parameterConverter);
- this.processAuthorizationHelper = processAuthorizationHelper;
- this.fhirContext = fhirContext;
- this.endpointProvider = endpointProvider;
- }
-
- @Override
- public void afterPropertiesSet() throws Exception
- {
- super.afterPropertiesSet();
-
- Objects.requireNonNull(processAuthorizationHelper, "processAuthorizationHelper");
- Objects.requireNonNull(fhirContext, "fhirContext");
- Objects.requireNonNull(endpointProvider, "endpointProvider");
+ this.processAuthorizationHelper = Objects.requireNonNull(processAuthorizationHelper,
+ "processAuthorizationHelper");
+ this.fhirContext = Objects.requireNonNull(fhirContext, "fhirContext");
+ this.endpointProvider = Objects.requireNonNull(endpointProvider, "endpointProvider");
}
private boolean isLocalOrganization(Organization organization)
diff --git a/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/client/ClientProviderImpl.java b/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/client/ClientProviderImpl.java
index 9708f10fd..071d8be8c 100755
--- a/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/client/ClientProviderImpl.java
+++ b/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/client/ClientProviderImpl.java
@@ -22,7 +22,6 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.InitializingBean;
import ca.uhn.fhir.context.FhirContext;
import dev.dsf.common.buildinfo.BuildInfoReader;
@@ -31,7 +30,7 @@
import dev.dsf.fhir.help.ExceptionHandler;
import dev.dsf.fhir.service.ReferenceCleaner;
-public class ClientProviderImpl implements ClientProvider, InitializingBean
+public class ClientProviderImpl implements ClientProvider
{
private static final Logger logger = LoggerFactory.getLogger(ClientProviderImpl.class);
private static final String USER_AGENT_VALUE = "DSF/";
@@ -50,37 +49,53 @@ public class ClientProviderImpl implements ClientProvider, InitializingBean
private final ExceptionHandler exceptionHandler;
private final BuildInfoReader buildInfoReader;
+ /**
+ * @param webserviceTrustStore
+ * not null
+ * @param webserviceKeyStore
+ * not null
+ * @param webserviceKeyStorePassword
+ * not null
+ * @param remoteReadTimeout
+ * not null, not negative, 0 represents infinity
+ * @param remoteConnectTimeout
+ * not null, not negative, 0 represents infinity
+ * @param proxyConfig
+ * not null
+ * @param logRequests
+ * @param fhirContext
+ * not null
+ * @param referenceCleaner
+ * not null
+ * @param endpointDao
+ * not null
+ * @param exceptionHandler
+ * not null
+ * @param buildInfoReader
+ * not null
+ */
public ClientProviderImpl(KeyStore webserviceTrustStore, KeyStore webserviceKeyStore,
char[] webserviceKeyStorePassword, Duration remoteReadTimeout, Duration remoteConnectTimeout,
ProxyConfig proxyConfig, boolean logRequests, FhirContext fhirContext, ReferenceCleaner referenceCleaner,
EndpointDao endpointDao, ExceptionHandler exceptionHandler, BuildInfoReader buildInfoReader)
{
- this.webserviceTrustStore = webserviceTrustStore;
- this.webserviceKeyStore = webserviceKeyStore;
- this.webserviceKeyStorePassword = webserviceKeyStorePassword;
- this.remoteReadTimeout = remoteReadTimeout;
- this.remoteConnectTimeout = remoteConnectTimeout;
- this.proxyConfig = proxyConfig;
+ this.webserviceTrustStore = Objects.requireNonNull(webserviceTrustStore, "webserviceTrustStore");
+ this.webserviceKeyStore = Objects.requireNonNull(webserviceKeyStore, "webserviceKeyStore");
+ this.webserviceKeyStorePassword = Objects.requireNonNull(webserviceKeyStorePassword,
+ "webserviceKeyStorePassword");
+ this.remoteReadTimeout = Objects.requireNonNull(remoteReadTimeout, "remoteReadTimeout");
+ if (remoteReadTimeout.isNegative())
+ throw new IllegalArgumentException("remoteReadTimeout negative");
+ this.remoteConnectTimeout = Objects.requireNonNull(remoteConnectTimeout, "remoteConnectTimeout");
+ if (remoteConnectTimeout.isNegative())
+ throw new IllegalArgumentException("remoteConnectTimeout negative");
+ this.proxyConfig = Objects.requireNonNull(proxyConfig, "proxyConfig");
this.logRequests = logRequests;
- this.fhirContext = fhirContext;
- this.referenceCleaner = referenceCleaner;
- this.endpointDao = endpointDao;
- this.exceptionHandler = exceptionHandler;
- this.buildInfoReader = buildInfoReader;
- }
-
- @Override
- public void afterPropertiesSet() throws Exception
- {
- Objects.requireNonNull(webserviceTrustStore, "webserviceTrustStore");
- Objects.requireNonNull(webserviceKeyStore, "webserviceKeyStore");
- Objects.requireNonNull(webserviceKeyStorePassword, "webserviceKeyStorePassword");
- Objects.requireNonNull(proxyConfig, "proxyConfig");
- Objects.requireNonNull(fhirContext, "fhirContext");
- Objects.requireNonNull(referenceCleaner, "referenceCleaner");
- Objects.requireNonNull(endpointDao, "endpointDao");
- Objects.requireNonNull(exceptionHandler, "exceptionHandler");
- Objects.requireNonNull(buildInfoReader, "buildInfoReader");
+ this.fhirContext = Objects.requireNonNull(fhirContext, "fhirContext");
+ this.referenceCleaner = Objects.requireNonNull(referenceCleaner, "referenceCleaner");
+ this.endpointDao = Objects.requireNonNull(endpointDao, "endpointDao");
+ this.exceptionHandler = Objects.requireNonNull(exceptionHandler, "exceptionHandler");
+ this.buildInfoReader = Objects.requireNonNull(buildInfoReader, "buildInfoReader");
}
@Override
diff --git a/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/dao/command/AbstractCommand.java b/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/dao/command/AbstractCommand.java
index 440a28f36..465202aab 100755
--- a/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/dao/command/AbstractCommand.java
+++ b/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/dao/command/AbstractCommand.java
@@ -15,6 +15,8 @@
*/
package dev.dsf.fhir.dao.command;
+import java.util.Objects;
+
import org.hl7.fhir.r4.model.Bundle;
import org.hl7.fhir.r4.model.Bundle.BundleEntryComponent;
import org.slf4j.Logger;
@@ -40,6 +42,22 @@ public abstract class AbstractCommand implements Command
protected final AuthorizationHelper authorizationHelper;
+ /**
+ * @param transactionPriority
+ * @param index
+ * @param identity
+ * not null
+ * @param returnType
+ * not null
+ * @param bundle
+ * not null
+ * @param entry
+ * not null
+ * @param serverBase
+ * not null
+ * @param authorizationHelper
+ * not null
+ */
public AbstractCommand(int transactionPriority, int index, Identity identity, PreferReturnType returnType,
Bundle bundle, BundleEntryComponent entry, String serverBase, AuthorizationHelper authorizationHelper)
{
@@ -47,13 +65,13 @@ public AbstractCommand(int transactionPriority, int index, Identity identity, Pr
this.index = index;
- this.identity = identity;
- this.returnType = returnType;
- this.bundle = bundle;
- this.entry = entry;
- this.serverBase = serverBase;
+ this.identity = Objects.requireNonNull(identity, "identity");
+ this.returnType = Objects.requireNonNull(returnType, "returnType");
+ this.bundle = Objects.requireNonNull(bundle, "bundle");
+ this.entry = Objects.requireNonNull(entry, "entry");
+ this.serverBase = Objects.requireNonNull(serverBase, "serverBase");
- this.authorizationHelper = authorizationHelper;
+ this.authorizationHelper = Objects.requireNonNull(authorizationHelper, "authorizationHelper");
}
@Override
diff --git a/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/dao/command/AbstractCommandList.java b/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/dao/command/AbstractCommandList.java
index 3bb4ea121..c87b984cf 100644
--- a/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/dao/command/AbstractCommandList.java
+++ b/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/dao/command/AbstractCommandList.java
@@ -143,13 +143,25 @@ private BundleEntryComponent toEntry(Exception exception,
protected final boolean hasModifyingCommands;
protected final boolean hasBinaryModifyingCommands;
+ /**
+ * @param dataSource
+ * not null
+ * @param permanentDeleteDataSource
+ * not null
+ * @param dbUsersGroup
+ * not null
+ * @param exceptionHandler
+ * not null
+ * @param commands
+ * may be null
+ */
protected AbstractCommandList(DataSource dataSource, DataSource permanentDeleteDataSource, String dbUsersGroup,
ExceptionHandler exceptionHandler, List extends Command> commands, Comparator sortOrder)
{
- this.dataSource = dataSource;
- this.permanentDeleteDataSource = permanentDeleteDataSource;
- this.dbUsersGroup = dbUsersGroup;
- this.exceptionHandler = exceptionHandler;
+ this.dataSource = Objects.requireNonNull(dataSource, "dataSource");
+ this.permanentDeleteDataSource = Objects.requireNonNull(permanentDeleteDataSource, "permanentDeleteDataSource");
+ this.dbUsersGroup = Objects.requireNonNull(dbUsersGroup, "dbUsersGroup");
+ this.exceptionHandler = Objects.requireNonNull(exceptionHandler, "exceptionHandler");
this.commands = commands == null ? List.of()
: commands.stream().sorted(sortOrder).map(CommandResult::new).toList();
diff --git a/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/dao/command/AbstractCommandWithResource.java b/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/dao/command/AbstractCommandWithResource.java
index ff80a1aa8..121b405cf 100755
--- a/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/dao/command/AbstractCommandWithResource.java
+++ b/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/dao/command/AbstractCommandWithResource.java
@@ -15,6 +15,8 @@
*/
package dev.dsf.fhir.dao.command;
+import java.util.Objects;
+
import org.hl7.fhir.r4.model.Bundle;
import org.hl7.fhir.r4.model.Bundle.BundleEntryComponent;
import org.hl7.fhir.r4.model.Resource;
@@ -39,6 +41,36 @@ public abstract class AbstractCommandWithResource referencesHelper;
+ /**
+ * @param transactionPriority
+ * @param index
+ * @param identity
+ * not null
+ * @param returnType
+ * not null
+ * @param bundle
+ * not null
+ * @param entry
+ * not null
+ * @param serverBase
+ * not null
+ * @param authorizationHelper
+ * not null
+ * @param resource
+ * not null
+ * @param dao
+ * not null
+ * @param exceptionHandler
+ * not null
+ * @param parameterConverter
+ * not null
+ * @param responseGenerator
+ * not null
+ * @param referenceExtractor
+ * not null
+ * @param referenceResolver
+ * not null
+ */
public AbstractCommandWithResource(int transactionPriority, int index, Identity identity,
PreferReturnType returnType, Bundle bundle, BundleEntryComponent entry, String serverBase,
AuthorizationHelper authorizationHelper, R resource, D dao, ExceptionHandler exceptionHandler,
@@ -47,11 +79,11 @@ public AbstractCommandWithResource(int transactionPriority, int index, Identity
{
super(transactionPriority, index, identity, returnType, bundle, entry, serverBase, authorizationHelper);
- this.resource = resource;
- this.dao = dao;
- this.exceptionHandler = exceptionHandler;
- this.parameterConverter = parameterConverter;
- this.validationRules = validationRules;
+ this.resource = Objects.requireNonNull(resource, "resource");
+ this.dao = Objects.requireNonNull(dao, "dao");
+ this.exceptionHandler = Objects.requireNonNull(exceptionHandler, "exceptionHandler");
+ this.parameterConverter = Objects.requireNonNull(parameterConverter, "parameterConverter");
+ this.validationRules = Objects.requireNonNull(validationRules, "validationRules");
referencesHelper = new ReferencesHelperImpl<>(index, resource, serverBase, referenceExtractor,
referenceResolver, responseGenerator);
diff --git a/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/dao/command/BatchCommandList.java b/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/dao/command/BatchCommandList.java
index 657a8f441..522357dfc 100755
--- a/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/dao/command/BatchCommandList.java
+++ b/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/dao/command/BatchCommandList.java
@@ -21,6 +21,7 @@
import java.util.HashSet;
import java.util.List;
import java.util.Map;
+import java.util.Objects;
import java.util.Set;
import java.util.function.Predicate;
@@ -50,16 +51,36 @@ public class BatchCommandList extends AbstractCommandList implements CommandList
private final EventHandler eventHandler;
private final ResponseGenerator responseGenerator;
- public BatchCommandList(DataSource dataSource, DataSource permanentDeleteDataSource, String selectUpdateUser,
+ /**
+ * @param dataSource
+ * not null
+ * @param permanentDeleteDataSource
+ * not null
+ * @param dbUsersGroup
+ * not null
+ * @param exceptionHandler
+ * not null
+ * @param commands
+ * not null
+ * @param validationHelper
+ * not null
+ * @param snapshotGenerator
+ * not null
+ * @param eventHandler
+ * not null
+ * @param responseGenerator
+ * not null
+ */
+ public BatchCommandList(DataSource dataSource, DataSource permanentDeleteDataSource, String dbUsersGroup,
ExceptionHandler exceptionHandler, List extends Command> commands, ValidationHelper validationHelper,
SnapshotGenerator snapshotGenerator, EventHandler eventHandler, ResponseGenerator responseGenerator)
{
- super(dataSource, permanentDeleteDataSource, selectUpdateUser, exceptionHandler, commands, (_, _) -> 0);
+ super(dataSource, permanentDeleteDataSource, dbUsersGroup, exceptionHandler, commands, (_, _) -> 0);
- this.validationHelper = validationHelper;
- this.snapshotGenerator = snapshotGenerator;
- this.eventHandler = eventHandler;
- this.responseGenerator = responseGenerator;
+ this.validationHelper = Objects.requireNonNull(validationHelper, "validationHelper");
+ this.snapshotGenerator = Objects.requireNonNull(snapshotGenerator, "snapshotGenerator");
+ this.eventHandler = Objects.requireNonNull(eventHandler, "eventHandler");
+ this.responseGenerator = Objects.requireNonNull(responseGenerator, "responseGenerator");
}
@Override
diff --git a/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/dao/command/CommandFactoryImpl.java b/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/dao/command/CommandFactoryImpl.java
index bcefeadbe..7a76f6046 100755
--- a/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/dao/command/CommandFactoryImpl.java
+++ b/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/dao/command/CommandFactoryImpl.java
@@ -31,7 +31,6 @@
import org.hl7.fhir.r4.model.StructureDefinition;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.InitializingBean;
import dev.dsf.common.auth.conf.Identity;
import dev.dsf.fhir.dao.ResourceDao;
@@ -52,7 +51,7 @@
import dev.dsf.fhir.validation.SnapshotGenerator;
import dev.dsf.fhir.validation.ValidationRules;
-public class CommandFactoryImpl implements InitializingBean, CommandFactory
+public class CommandFactoryImpl implements CommandFactory
{
private static final Logger logger = LoggerFactory.getLogger(CommandFactoryImpl.class);
@@ -77,6 +76,48 @@ public class CommandFactoryImpl implements InitializingBean, CommandFactory
private final DefaultProfileProvider defaultProfileProvider;
private final Function transactionResourcesFactory;
+ /**
+ * @param serverBase
+ * not null
+ * @param defaultPageCount
+ * >= 0
+ * @param dataSource
+ * not null
+ * @param permanentDeleteDataSource
+ * not null
+ * @param dbUsersGroup
+ * not null
+ * @param daoProvider
+ * not null
+ * @param referenceExtractor
+ * not null
+ * @param referenceResolver
+ * not null
+ * @param referenceCleaner
+ * not null
+ * @param responseGenerator
+ * not null
+ * @param exceptionHandler
+ * not null
+ * @param parameterConverter
+ * not null
+ * @param eventHandler
+ * not null
+ * @param eventGenerator
+ * not null
+ * @param authorizationHelper
+ * not null
+ * @param validationHelper
+ * not null
+ * @param snapshotGenerator
+ * not null
+ * @param validationRules
+ * not null
+ * @param defaultProfileProvider
+ * not null
+ * @param transactionResourcesFactory
+ * not null
+ */
public CommandFactoryImpl(String serverBase, int defaultPageCount, DataSource dataSource,
DataSource permanentDeleteDataSource, String dbUsersGroup, DaoProvider daoProvider,
ReferenceExtractor referenceExtractor, ReferenceResolver referenceResolver,
@@ -87,49 +128,29 @@ public CommandFactoryImpl(String serverBase, int defaultPageCount, DataSource da
DefaultProfileProvider defaultProfileProvider,
Function transactionResourcesFactory)
{
- this.serverBase = serverBase;
+ this.serverBase = Objects.requireNonNull(serverBase, "serverBase");
+ if (defaultPageCount < 0)
+ throw new IllegalArgumentException("defaultPageCount < 0");
this.defaultPageCount = defaultPageCount;
- this.dataSource = dataSource;
- this.permanentDeleteDataSource = permanentDeleteDataSource;
- this.dbUsersGroup = dbUsersGroup;
- this.daoProvider = daoProvider;
- this.referenceExtractor = referenceExtractor;
- this.referenceResolver = referenceResolver;
- this.referenceCleaner = referenceCleaner;
- this.responseGenerator = responseGenerator;
- this.exceptionHandler = exceptionHandler;
- this.parameterConverter = parameterConverter;
- this.eventHandler = eventHandler;
- this.eventGenerator = eventGenerator;
+ this.dataSource = Objects.requireNonNull(dataSource, "dataSource");
+ this.permanentDeleteDataSource = Objects.requireNonNull(permanentDeleteDataSource, "permanentDeleteDataSource");
+ this.dbUsersGroup = Objects.requireNonNull(dbUsersGroup, "dbUsersGroup");
+ this.daoProvider = Objects.requireNonNull(daoProvider, "daoProvider");
+ this.referenceExtractor = Objects.requireNonNull(referenceExtractor, "referenceExtractor");
+ this.referenceResolver = Objects.requireNonNull(referenceResolver, "referenceResolver");
+ this.referenceCleaner = Objects.requireNonNull(referenceCleaner, "referenceCleaner");
+ this.responseGenerator = Objects.requireNonNull(responseGenerator, "responseGenerator");
+ this.exceptionHandler = Objects.requireNonNull(exceptionHandler, "exceptionHandler");
+ this.parameterConverter = Objects.requireNonNull(parameterConverter, "parameterConverter");
+ this.eventHandler = Objects.requireNonNull(eventHandler, "eventHandler");
+ this.eventGenerator = Objects.requireNonNull(eventGenerator, "eventGenerator");
this.authorizationHelper = authorizationHelper;
- this.validationHelper = validationHelper;
- this.snapshotGenerator = snapshotGenerator;
- this.validationRules = validationRules;
- this.defaultProfileProvider = defaultProfileProvider;
- this.transactionResourcesFactory = transactionResourcesFactory;
- }
-
- @Override
- public void afterPropertiesSet() throws Exception
- {
- Objects.requireNonNull(serverBase, "serverBase");
- Objects.requireNonNull(dataSource, "dataSource");
- Objects.requireNonNull(permanentDeleteDataSource, "permanentDeleteDataSource");
-
- Objects.requireNonNull(daoProvider, "daoProvider");
- Objects.requireNonNull(referenceExtractor, "referenceExtractor");
- Objects.requireNonNull(referenceResolver, "referenceResolver");
- Objects.requireNonNull(referenceCleaner, "referenceCleaner");
- Objects.requireNonNull(responseGenerator, "responseGenerator");
- Objects.requireNonNull(exceptionHandler, "exceptionHandler");
- Objects.requireNonNull(parameterConverter, "parameterConverter");
- Objects.requireNonNull(eventHandler, "eventHandler");
- Objects.requireNonNull(eventGenerator, "eventGenerator");
- Objects.requireNonNull(authorizationHelper, "authorizationHelper");
- Objects.requireNonNull(validationHelper, "validationHelper");
- Objects.requireNonNull(snapshotGenerator, "snapshotGenerator");
- Objects.requireNonNull(validationRules, "validationRules");
- Objects.requireNonNull(transactionResourcesFactory, "transactionResourcesFactory");
+ this.validationHelper = Objects.requireNonNull(validationHelper, "validationHelper");
+ this.snapshotGenerator = Objects.requireNonNull(snapshotGenerator, "snapshotGenerator");
+ this.validationRules = Objects.requireNonNull(validationRules, "validationRules");
+ this.defaultProfileProvider = Objects.requireNonNull(defaultProfileProvider, "defaultProfileProvider");
+ this.transactionResourcesFactory = Objects.requireNonNull(transactionResourcesFactory,
+ "transactionResourcesFactory");
}
// head
diff --git a/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/dao/command/CreateCommand.java b/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/dao/command/CreateCommand.java
index 1bcf6f20b..a37a097b5 100755
--- a/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/dao/command/CreateCommand.java
+++ b/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/dao/command/CreateCommand.java
@@ -21,6 +21,7 @@
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
+import java.util.Objects;
import java.util.Optional;
import java.util.UUID;
import java.util.stream.Collectors;
@@ -81,6 +82,41 @@ public class CreateCommand> extends
protected Response responseResult;
protected ValidationResult validationResult;
+ /**
+ * @param index
+ * @param identity
+ * @param returnType
+ * not null
+ * @param bundle
+ * not null
+ * @param entry
+ * not null
+ * @param serverBase
+ * not null
+ * @param authorizationHelper
+ * not null
+ * @param resource
+ * not null
+ * @param dao
+ * not null
+ * @param exceptionHandler
+ * not null
+ * @param parameterConverter
+ * not null
+ * @param responseGenerator
+ * not null
+ * @param referenceExtractor
+ * not null
+ * @param referenceResolver
+ * not null
+ * @param referenceCleaner
+ * not null
+ * @param eventGenerator
+ * not null
+ * @param defaultProfileProvider
+ * not null
+ * @param enableValidation
+ */
public CreateCommand(int index, Identity identity, PreferReturnType returnType, Bundle bundle,
BundleEntryComponent entry, String serverBase, AuthorizationHelper authorizationHelper, R resource, D dao,
ExceptionHandler exceptionHandler, ParameterConverter parameterConverter, ValidationRules validationRules,
@@ -92,11 +128,11 @@ public CreateCommand(int index, Identity identity, PreferReturnType returnType,
exceptionHandler, parameterConverter, validationRules, responseGenerator, referenceExtractor,
referenceResolver);
- this.responseGenerator = responseGenerator;
- this.referenceCleaner = referenceCleaner;
+ this.responseGenerator = Objects.requireNonNull(responseGenerator, "responseGenerator");
+ this.referenceCleaner = Objects.requireNonNull(referenceCleaner, "referenceCleaner");
- this.eventGenerator = eventGenerator;
- this.defaultProfileProvider = defaultProfileProvider;
+ this.eventGenerator = Objects.requireNonNull(eventGenerator, "eventGenerator");
+ this.defaultProfileProvider = Objects.requireNonNull(defaultProfileProvider, "defaultProfileProvider");
this.enableValidation = enableValidation;
if (PreferReturnType.OPERATION_OUTCOME.equals(returnType) && !enableValidation)
diff --git a/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/dao/command/CreateStructureDefinitionCommand.java b/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/dao/command/CreateStructureDefinitionCommand.java
index 028836787..f70f227b4 100755
--- a/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/dao/command/CreateStructureDefinitionCommand.java
+++ b/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/dao/command/CreateStructureDefinitionCommand.java
@@ -56,6 +56,44 @@ public class CreateStructureDefinitionCommand extends CreateCommandnull
+ * @param returnType
+ * not null
+ * @param bundle
+ * not null
+ * @param entry
+ * not null
+ * @param serverBase
+ * not null
+ * @param authorizationHelper
+ * not null
+ * @param resource
+ * not null
+ * @param dao
+ * not null
+ * @param exceptionHandler
+ * not null
+ * @param parameterConverter
+ * not null
+ * @param responseGenerator
+ * not null
+ * @param referenceExtractor
+ * not null
+ * @param referenceResolver
+ * not null
+ * @param referenceCleaner
+ * not null
+ * @param eventGenerator
+ * not null
+ * @param defaultProfileProvider
+ * not null
+ * @param enableValidation
+ * @param snapshotDao
+ * not null
+ */
public CreateStructureDefinitionCommand(int index, Identity identity, PreferReturnType returnType, Bundle bundle,
BundleEntryComponent entry, String serverBase, AuthorizationHelper authorizationHelper,
StructureDefinition resource, StructureDefinitionDao dao, ExceptionHandler exceptionHandler,
diff --git a/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/dao/command/DeleteCommand.java b/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/dao/command/DeleteCommand.java
index 5d3c344cb..c4482ce20 100755
--- a/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/dao/command/DeleteCommand.java
+++ b/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/dao/command/DeleteCommand.java
@@ -21,6 +21,7 @@
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
+import java.util.Objects;
import java.util.Optional;
import java.util.UUID;
import java.util.stream.Collectors;
@@ -70,6 +71,30 @@ public class DeleteCommand extends AbstractCommand implements ModifyingCommand
private Class extends Resource> resourceType;
private String id;
+ /**
+ * @param index
+ * @param identity
+ * @param returnType
+ * not null
+ * @param bundle
+ * not null
+ * @param entry
+ * not null
+ * @param serverBase
+ * not null
+ * @param authorizationHelper
+ * not null
+ * @param responseGenerator
+ * not null
+ * @param daoProvider
+ * not null
+ * @param exceptionHandler
+ * not null
+ * @param parameterConverter
+ * not null
+ * @param eventGenerator
+ * not null
+ */
public DeleteCommand(int index, Identity identity, PreferReturnType returnType, Bundle bundle,
BundleEntryComponent entry, String serverBase, AuthorizationHelper authorizationHelper,
ResponseGenerator responseGenerator, DaoProvider daoProvider, ExceptionHandler exceptionHandler,
@@ -77,11 +102,11 @@ public DeleteCommand(int index, Identity identity, PreferReturnType returnType,
{
super(1, index, identity, returnType, bundle, entry, serverBase, authorizationHelper);
- this.responseGenerator = responseGenerator;
- this.daoProvider = daoProvider;
- this.exceptionHandler = exceptionHandler;
- this.parameterConverter = parameterConverter;
- this.eventGenerator = eventGenerator;
+ this.responseGenerator = Objects.requireNonNull(responseGenerator, "responseGenerator");
+ this.daoProvider = Objects.requireNonNull(daoProvider, "daoProvider");
+ this.exceptionHandler = Objects.requireNonNull(exceptionHandler, "exceptionHandler");
+ this.parameterConverter = Objects.requireNonNull(parameterConverter, "parameterConverter");
+ this.eventGenerator = Objects.requireNonNull(eventGenerator, "eventGenerator");
}
@Override
diff --git a/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/dao/command/DeleteStructureDefinitionCommand.java b/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/dao/command/DeleteStructureDefinitionCommand.java
index fd3e430d7..8519b28cc 100644
--- a/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/dao/command/DeleteStructureDefinitionCommand.java
+++ b/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/dao/command/DeleteStructureDefinitionCommand.java
@@ -41,6 +41,30 @@ public class DeleteStructureDefinitionCommand extends DeleteCommand
private final StructureDefinitionDao snapshotDao;
+ /**
+ * @param index
+ * @param identity
+ * @param returnType
+ * not null
+ * @param bundle
+ * not null
+ * @param entry
+ * not null
+ * @param serverBase
+ * not null
+ * @param authorizationHelper
+ * not null
+ * @param responseGenerator
+ * not null
+ * @param daoProvider
+ * not null
+ * @param exceptionHandler
+ * not null
+ * @param parameterConverter
+ * not null
+ * @param eventGenerator
+ * not null
+ */
public DeleteStructureDefinitionCommand(int index, Identity identity, PreferReturnType returnType, Bundle bundle,
BundleEntryComponent entry, String serverBase, AuthorizationHelper authorizationHelper,
ResponseGenerator responseGenerator, DaoProvider daoProvider, ExceptionHandler exceptionHandler,
diff --git a/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/dao/command/ReadCommand.java b/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/dao/command/ReadCommand.java
index 5a36b8386..7528fee4b 100755
--- a/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/dao/command/ReadCommand.java
+++ b/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/dao/command/ReadCommand.java
@@ -20,6 +20,7 @@
import java.util.Date;
import java.util.List;
import java.util.Map;
+import java.util.Objects;
import java.util.Optional;
import java.util.UUID;
@@ -79,6 +80,34 @@ public class ReadCommand extends AbstractCommand implements Command
private Response responseResult;
private boolean search;
+ /**
+ * @param index
+ * @param identity
+ * @param returnType
+ * not null
+ * @param bundle
+ * not null
+ * @param entry
+ * not null
+ * @param serverBase
+ * not null
+ * @param authorizationHelper
+ * not null
+ * @param defaultPageCount
+ * >= 0
+ * @param daoProvider
+ * not null
+ * @param parameterConverter
+ * not null
+ * @param responseGenerator
+ * not null
+ * @param exceptionHandler
+ * not null
+ * @param referenceCleaner
+ * not null
+ * @param handlingType
+ * not null
+ */
public ReadCommand(int index, Identity identity, PreferReturnType returnType, Bundle bundle,
BundleEntryComponent entry, String serverBase, AuthorizationHelper authorizationHelper,
int defaultPageCount, DaoProvider daoProvider, ParameterConverter parameterConverter,
@@ -87,14 +116,16 @@ public ReadCommand(int index, Identity identity, PreferReturnType returnType, Bu
{
super(5, index, identity, returnType, bundle, entry, serverBase, authorizationHelper);
+ if (defaultPageCount < 0)
+ throw new IllegalArgumentException("defaultPageCount < 0");
this.defaultPageCount = defaultPageCount;
- this.daoProvider = daoProvider;
- this.parameterConverter = parameterConverter;
- this.responseGenerator = responseGenerator;
- this.exceptionHandler = exceptionHandler;
- this.referenceCleaner = referenceCleaner;
- this.handlingType = handlingType;
+ this.daoProvider = Objects.requireNonNull(daoProvider, "daoProvider");
+ this.parameterConverter = Objects.requireNonNull(parameterConverter, "parameterConverter");
+ this.responseGenerator = Objects.requireNonNull(responseGenerator, "responseGenerator");
+ this.exceptionHandler = Objects.requireNonNull(exceptionHandler, "exceptionHandler");
+ this.referenceCleaner = Objects.requireNonNull(referenceCleaner, "referenceCleaner");
+ this.handlingType = Objects.requireNonNull(handlingType, "handlingType");
}
@Override
diff --git a/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/dao/command/ReferencesHelperImpl.java b/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/dao/command/ReferencesHelperImpl.java
index ac9d0098c..1539ea9ae 100644
--- a/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/dao/command/ReferencesHelperImpl.java
+++ b/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/dao/command/ReferencesHelperImpl.java
@@ -17,6 +17,7 @@
import java.sql.Connection;
import java.util.Map;
+import java.util.Objects;
import java.util.Optional;
import java.util.function.BiConsumer;
import java.util.function.Consumer;
@@ -49,15 +50,28 @@ public final class ReferencesHelperImpl implements Reference
private final ReferenceResolver referenceResolver;
private final ResponseGenerator responseGenerator;
+ /**
+ * @param index
+ * @param resource
+ * not null
+ * @param serverBase
+ * not null
+ * @param referenceExtractor
+ * not null
+ * @param referenceResolver
+ * not null
+ * @param responseGenerator
+ * not null
+ */
public ReferencesHelperImpl(int index, R resource, String serverBase, ReferenceExtractor referenceExtractor,
ReferenceResolver referenceResolver, ResponseGenerator responseGenerator)
{
this.index = index;
- this.resource = resource;
- this.serverBase = serverBase;
- this.referenceExtractor = referenceExtractor;
- this.referenceResolver = referenceResolver;
- this.responseGenerator = responseGenerator;
+ this.resource = Objects.requireNonNull(resource, "resource");
+ this.serverBase = Objects.requireNonNull(serverBase, "serverBase");
+ this.referenceExtractor = Objects.requireNonNull(referenceExtractor, "referenceExtractor");
+ this.referenceResolver = Objects.requireNonNull(referenceResolver, "referenceResolver");
+ this.responseGenerator = Objects.requireNonNull(responseGenerator, "responseGenerator");
}
@Override
diff --git a/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/dao/command/TransactionCommandList.java b/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/dao/command/TransactionCommandList.java
index 1957b16bb..55acd7c29 100755
--- a/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/dao/command/TransactionCommandList.java
+++ b/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/dao/command/TransactionCommandList.java
@@ -21,6 +21,7 @@
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import java.util.Objects;
import java.util.function.Function;
import javax.sql.DataSource;
@@ -50,6 +51,22 @@ public class TransactionCommandList extends AbstractCommandList implements Comma
private final Function transactionResourceFactory;
private final ResponseGenerator responseGenerator;
+ /**
+ * @param dataSource
+ * not null
+ * @param permanentDeleteDataSource
+ * not null
+ * @param dbUsersGroup
+ * not null
+ * @param exceptionHandler
+ * not null
+ * @param commands
+ * may be null
+ * @param transactionResourceFactory
+ * not null
+ * @param responseGenerator
+ * not null
+ */
public TransactionCommandList(DataSource dataSource, DataSource permanentDeleteDataSource, String dbUsersGroup,
ExceptionHandler exceptionHandler, List extends Command> commands,
Function transactionResourceFactory, ResponseGenerator responseGenerator)
@@ -57,8 +74,9 @@ public TransactionCommandList(DataSource dataSource, DataSource permanentDeleteD
super(dataSource, permanentDeleteDataSource, dbUsersGroup, exceptionHandler, commands,
Comparator.comparing(Command::getTransactionPriority).thenComparing(Command::getIndex));
- this.transactionResourceFactory = transactionResourceFactory;
- this.responseGenerator = responseGenerator;
+ this.transactionResourceFactory = Objects.requireNonNull(transactionResourceFactory,
+ "transactionResourceFactory");
+ this.responseGenerator = Objects.requireNonNull(responseGenerator, "responseGenerator");
}
@Override
diff --git a/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/dao/command/UpdateCommand.java b/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/dao/command/UpdateCommand.java
index a75f1c9f9..ae5663986 100755
--- a/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/dao/command/UpdateCommand.java
+++ b/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/dao/command/UpdateCommand.java
@@ -83,6 +83,41 @@ public class UpdateCommand> extends
protected R updatedResource;
protected ValidationResult validationResult;
+ /**
+ * @param index
+ * @param identity
+ * @param returnType
+ * not null
+ * @param bundle
+ * not null
+ * @param entry
+ * not null
+ * @param serverBase
+ * not null
+ * @param authorizationHelper
+ * not null
+ * @param resource
+ * not null
+ * @param dao
+ * not null
+ * @param exceptionHandler
+ * not null
+ * @param parameterConverter
+ * not null
+ * @param responseGenerator
+ * not null
+ * @param referenceExtractor
+ * not null
+ * @param referenceResolver
+ * not null
+ * @param referenceCleaner
+ * not null
+ * @param eventGenerator
+ * not null
+ * @param defaultProfileProvider
+ * not null
+ * @param enableValidation
+ */
public UpdateCommand(int index, Identity identity, PreferReturnType returnType, Bundle bundle,
BundleEntryComponent entry, String serverBase, AuthorizationHelper authorizationHelper, R resource, D dao,
ExceptionHandler exceptionHandler, ParameterConverter parameterConverter, ValidationRules validationRules,
@@ -94,11 +129,11 @@ public UpdateCommand(int index, Identity identity, PreferReturnType returnType,
exceptionHandler, parameterConverter, validationRules, responseGenerator, referenceExtractor,
referenceResolver);
- this.responseGenerator = responseGenerator;
- this.referenceCleaner = referenceCleaner;
+ this.responseGenerator = Objects.requireNonNull(responseGenerator, "responseGenerator");
+ this.referenceCleaner = Objects.requireNonNull(referenceCleaner, "referenceCleaner");
- this.eventGenerator = eventGenerator;
- this.defaultProfileProvider = defaultProfileProvider;
+ this.eventGenerator = Objects.requireNonNull(eventGenerator, "eventGenerator");
+ this.defaultProfileProvider = Objects.requireNonNull(defaultProfileProvider, "defaultProfileProvider");
this.enableValidation = enableValidation;
if (PreferReturnType.OPERATION_OUTCOME.equals(returnType) && !enableValidation)
diff --git a/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/dao/command/UpdateStructureDefinitionCommand.java b/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/dao/command/UpdateStructureDefinitionCommand.java
index b2a9cb2b7..fad6d11c0 100755
--- a/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/dao/command/UpdateStructureDefinitionCommand.java
+++ b/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/dao/command/UpdateStructureDefinitionCommand.java
@@ -60,6 +60,43 @@ public class UpdateStructureDefinitionCommand extends UpdateCommandnull
+ * @param bundle
+ * not null
+ * @param entry
+ * not null
+ * @param serverBase
+ * not null
+ * @param authorizationHelper
+ * not null
+ * @param resource
+ * not null
+ * @param dao
+ * not null
+ * @param exceptionHandler
+ * not null
+ * @param parameterConverter
+ * not null
+ * @param responseGenerator
+ * not null
+ * @param referenceExtractor
+ * not null
+ * @param referenceResolver
+ * not null
+ * @param referenceCleaner
+ * not null
+ * @param eventGenerator
+ * not null
+ * @param defaultProfileProvider
+ * not null
+ * @param enableValidation
+ * @param snapshotDao
+ * not null
+ */
public UpdateStructureDefinitionCommand(int index, Identity identity, PreferReturnType returnType, Bundle bundle,
BundleEntryComponent entry, String serverBase, AuthorizationHelper authorizationHelper,
StructureDefinition resource, StructureDefinitionDao dao, ExceptionHandler exceptionHandler,
diff --git a/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/dao/jdbc/AbstractPreparedStatementFactory.java b/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/dao/jdbc/AbstractPreparedStatementFactory.java
index d413b2e68..a94413e44 100755
--- a/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/dao/jdbc/AbstractPreparedStatementFactory.java
+++ b/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/dao/jdbc/AbstractPreparedStatementFactory.java
@@ -33,6 +33,22 @@ abstract class AbstractPreparedStatementFactory extends PgOb
private final String readByIdAndVersionSql;
private final String updateSql;
+ /**
+ * @param fhirContext
+ * not null
+ * @param objectMapper
+ * not null
+ * @param resourceType
+ * not null
+ * @param createSql
+ * not null
+ * @param readByIdSql
+ * not null
+ * @param readByIdAndVersionSql
+ * not null
+ * @param updateSql
+ * not null
+ */
protected AbstractPreparedStatementFactory(FhirContext fhirContext, ObjectMapper objectMapper,
Class resourceType, String createSql, String readByIdSql, String readByIdAndVersionSql, String updateSql)
{
diff --git a/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/dao/jdbc/AbstractResourceDaoJdbc.java b/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/dao/jdbc/AbstractResourceDaoJdbc.java
index 8db9e7a7a..2038a6a45 100755
--- a/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/dao/jdbc/AbstractResourceDaoJdbc.java
+++ b/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/dao/jdbc/AbstractResourceDaoJdbc.java
@@ -40,7 +40,6 @@
import org.hl7.fhir.r4.model.Resource;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.InitializingBean;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.google.gson.JsonArray;
@@ -70,7 +69,7 @@
import dev.dsf.fhir.search.parameters.ResourceLastUpdated;
import dev.dsf.fhir.search.parameters.ResourceProfile;
-abstract class AbstractResourceDaoJdbc implements ResourceDao, InitializingBean
+abstract class AbstractResourceDaoJdbc implements ResourceDao
{
private static final Logger logger = LoggerFactory.getLogger(AbstractResourceDaoJdbc.class);
@@ -168,6 +167,30 @@ protected static SearchQueryParameterFactory factory(Str
return new SearchQueryParameterFactory<>(parameterName, supplier, nameModifiers, null, null);
}
+ /**
+ * @param dataSource
+ * not null
+ * @param permanentDeleteDataSource
+ * not null
+ * @param fhirContext
+ * not null
+ * @param objectMapper
+ * not null
+ * @param resourceType
+ * not null
+ * @param resourceTable
+ * not null, not blank
+ * @param resourceColumn
+ * not null, not blank
+ * @param resourceIdColumn
+ * not null, not blank
+ * @param userFilter
+ * not null
+ * @param searchParameterFactories
+ * may be null
+ * @param searchRevIncludeParameterFactories
+ * may be null
+ */
AbstractResourceDaoJdbc(DataSource dataSource, DataSource permanentDeleteDataSource, FhirContext fhirContext,
ObjectMapper objectMapper, Class resourceType, String resourceTable, String resourceColumn,
String resourceIdColumn, Function userFilter,
@@ -180,25 +203,47 @@ protected static SearchQueryParameterFactory factory(Str
userFilter, searchParameterFactories, searchRevIncludeParameterFactories);
}
+ /**
+ * @param dataSource
+ * not null
+ * @param permanentDeleteDataSource
+ * not null
+ * @param resourceType
+ * not null
+ * @param resourceTable
+ * not null
+ * @param resourceColumn
+ * not null
+ * @param resourceIdColumn
+ * not null
+ * @param preparedStatementFactory
+ * not null
+ * @param identityFilter
+ * not null
+ * @param searchParameterFactories
+ * may be null
+ * @param searchRevIncludeParameterFactories
+ * may be null
+ */
AbstractResourceDaoJdbc(DataSource dataSource, DataSource permanentDeleteDataSource, Class resourceType,
String resourceTable, String resourceColumn, String resourceIdColumn,
PreparedStatementFactory preparedStatementFactory,
- Function userFilter,
+ Function identityFilter,
List> searchParameterFactories,
List searchRevIncludeParameterFactories)
{
- this.dataSource = dataSource;
- this.permanentDeleteDataSource = permanentDeleteDataSource;
- this.resourceType = resourceType;
- resourceTypeName = Objects.requireNonNull(resourceType, "resourceType").getAnnotation(ResourceDef.class).name();
+ this.dataSource = Objects.requireNonNull(dataSource, "dataSource");
+ this.permanentDeleteDataSource = Objects.requireNonNull(permanentDeleteDataSource, "permanentDeleteDataSource");
+ this.resourceType = Objects.requireNonNull(resourceType, "resourceType");
+ resourceTypeName = resourceType.getAnnotation(ResourceDef.class).name();
- this.resourceTable = resourceTable;
- this.resourceColumn = resourceColumn;
- this.resourceIdColumn = resourceIdColumn;
+ this.resourceTable = Objects.requireNonNull(resourceTable, "resourceTable");
+ this.resourceColumn = Objects.requireNonNull(resourceColumn, "resourceColumn");
+ this.resourceIdColumn = Objects.requireNonNull(resourceIdColumn, "resourceIdColumn");
- this.preparedStatementFactory = preparedStatementFactory;
+ this.preparedStatementFactory = Objects.requireNonNull(preparedStatementFactory, "preparedStatementFactory");
- this.identityFilter = userFilter;
+ this.identityFilter = Objects.requireNonNull(identityFilter, "identityFilter");
if (searchParameterFactories != null)
this.searchParameterFactories.addAll(searchParameterFactories);
@@ -213,19 +258,6 @@ protected static SearchQueryParameterFactory factory(Str
() -> new ResourceProfile<>(resourceType, resourceColumn), ResourceProfile.getNameModifiers());
}
- @Override
- public void afterPropertiesSet() throws Exception
- {
- Objects.requireNonNull(dataSource, "dataSource");
- Objects.requireNonNull(permanentDeleteDataSource, "permanentDeleteDataSource");
- Objects.requireNonNull(resourceType, "resourceType");
- Objects.requireNonNull(resourceTable, "resourceTable");
- Objects.requireNonNull(resourceColumn, "resourceColumn");
- Objects.requireNonNull(resourceIdColumn, "resourceIdColumn");
- Objects.requireNonNull(preparedStatementFactory, "preparedStatementFactory");
- Objects.requireNonNull(identityFilter, "userFilter");
- }
-
protected DataSource getDataSource()
{
return dataSource;
diff --git a/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/dao/jdbc/BinaryDaoJdbc.java b/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/dao/jdbc/BinaryDaoJdbc.java
index a045d138f..78770b46f 100755
--- a/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/dao/jdbc/BinaryDaoJdbc.java
+++ b/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/dao/jdbc/BinaryDaoJdbc.java
@@ -67,15 +67,8 @@ public BinaryDaoJdbc(DataSource dataSource, DataSource permanentDeleteDataSource
this.selectUpdateUser = selectUpdateUser;
- loUnlinker = Executors.newFixedThreadPool(1, r -> new Thread(r, "binaries-large-object-unlinker"));
- }
-
- @Override
- public void afterPropertiesSet() throws Exception
- {
- super.afterPropertiesSet();
-
- executeLargeObjectUnlink();
+ loUnlinker = Executors.newFixedThreadPool(1,
+ Thread.ofPlatform().name("binaries-large-object-unlinker").factory());
}
@Override
diff --git a/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/dao/jdbc/HistoryDaoJdbc.java b/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/dao/jdbc/HistoryDaoJdbc.java
index 9388874eb..37a4e2097 100644
--- a/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/dao/jdbc/HistoryDaoJdbc.java
+++ b/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/dao/jdbc/HistoryDaoJdbc.java
@@ -31,9 +31,7 @@
import org.hl7.fhir.r4.model.Binary;
import org.hl7.fhir.r4.model.Resource;
-import org.springframework.beans.factory.InitializingBean;
-import ca.uhn.fhir.context.FhirContext;
import ca.uhn.fhir.model.api.annotation.ResourceDef;
import dev.dsf.fhir.dao.HistoryDao;
import dev.dsf.fhir.history.AtParameter;
@@ -44,29 +42,25 @@
import dev.dsf.fhir.search.PageAndCount;
import dev.dsf.fhir.search.SearchQueryParameter;
-public class HistoryDaoJdbc implements HistoryDao, InitializingBean
+public class HistoryDaoJdbc implements HistoryDao
{
private final DataSource dataSource;
- private final FhirContext fhirContext;
private final BinaryDaoJdbc binaryDao;
private final PgObjectFactory pgObjectFactory;
- public HistoryDaoJdbc(DataSource dataSource, FhirContext fhirContext, BinaryDaoJdbc binaryDao,
- PgObjectFactory pgObjectFactory)
+ /**
+ * @param dataSource
+ * not null
+ * @param binaryDao
+ * not null
+ * @param pgObjectFactory
+ * not null
+ */
+ public HistoryDaoJdbc(DataSource dataSource, BinaryDaoJdbc binaryDao, PgObjectFactory pgObjectFactory)
{
- this.dataSource = dataSource;
- this.fhirContext = fhirContext;
- this.binaryDao = binaryDao;
- this.pgObjectFactory = pgObjectFactory;
- }
-
- @Override
- public void afterPropertiesSet() throws Exception
- {
- Objects.requireNonNull(dataSource, "dataSource");
- Objects.requireNonNull(fhirContext, "fhirContext");
- Objects.requireNonNull(binaryDao, "binaryDao");
- Objects.requireNonNull(pgObjectFactory, "pgObjectFactory");
+ this.dataSource = Objects.requireNonNull(dataSource, "dataSource");
+ this.binaryDao = Objects.requireNonNull(binaryDao, "binaryDao");
+ this.pgObjectFactory = Objects.requireNonNull(pgObjectFactory, "pgObjectFactory");
}
@Override
diff --git a/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/dao/jdbc/LargeObjectManagerJdbc.java b/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/dao/jdbc/LargeObjectManagerJdbc.java
index 465bebb08..14376510b 100644
--- a/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/dao/jdbc/LargeObjectManagerJdbc.java
+++ b/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/dao/jdbc/LargeObjectManagerJdbc.java
@@ -49,6 +49,14 @@ public class LargeObjectManagerJdbc implements LargeObjectManager
private final List createdOids = new ArrayList<>();
+ /**
+ * @param permanentDeleteDataSource
+ * not null
+ * @param dbUsersGroup
+ * not null
+ * @param connection
+ * not null
+ */
public LargeObjectManagerJdbc(DataSource permanentDeleteDataSource, String dbUsersGroup, Connection connection)
{
this.permanentDeleteDataSource = Objects.requireNonNull(permanentDeleteDataSource, "permanentDeleteDataSource");
diff --git a/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/dao/jdbc/PgObjectFactoryImpl.java b/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/dao/jdbc/PgObjectFactoryImpl.java
index cea7ed1c6..61b8c6b28 100644
--- a/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/dao/jdbc/PgObjectFactoryImpl.java
+++ b/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/dao/jdbc/PgObjectFactoryImpl.java
@@ -21,7 +21,6 @@
import org.hl7.fhir.r4.model.Resource;
import org.postgresql.util.PGobject;
-import org.springframework.beans.factory.InitializingBean;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
@@ -30,22 +29,21 @@
import ca.uhn.fhir.parser.DataFormatException;
import ca.uhn.fhir.parser.IParser;
-public class PgObjectFactoryImpl implements PgObjectFactory, InitializingBean
+public class PgObjectFactoryImpl implements PgObjectFactory
{
private final FhirContext fhirContext;
private final ObjectMapper objectMapper;
+ /**
+ * @param fhirContext
+ * not null
+ * @param objectMapper
+ * not null
+ */
public PgObjectFactoryImpl(FhirContext fhirContext, ObjectMapper objectMapper)
{
- this.fhirContext = fhirContext;
- this.objectMapper = objectMapper;
- }
-
- @Override
- public void afterPropertiesSet() throws Exception
- {
- Objects.requireNonNull(fhirContext, "fhirContext");
- Objects.requireNonNull(objectMapper, "objectMapper");
+ this.fhirContext = Objects.requireNonNull(fhirContext, "fhirContext");
+ this.objectMapper = Objects.requireNonNull(objectMapper, "objectMapper");
}
@Override
diff --git a/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/dao/jdbc/PreparedStatementFactoryDefault.java b/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/dao/jdbc/PreparedStatementFactoryDefault.java
index bce4a88b4..16f12a7ae 100755
--- a/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/dao/jdbc/PreparedStatementFactoryDefault.java
+++ b/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/dao/jdbc/PreparedStatementFactoryDefault.java
@@ -20,6 +20,7 @@
import java.sql.SQLException;
import java.sql.Timestamp;
import java.time.LocalDateTime;
+import java.util.Objects;
import java.util.UUID;
import org.hl7.fhir.r4.model.Resource;
@@ -30,9 +31,33 @@
class PreparedStatementFactoryDefault extends AbstractPreparedStatementFactory
{
+ /**
+ * @param fhirContext
+ * not null
+ * @param objectMapper
+ * not null
+ * @param resourceType
+ * not null
+ * @param resourceTable
+ * not null, not blank
+ * @param resourceIdColumn
+ * not null, not blank
+ * @param resourceColumn
+ * not null, not blank
+ */
PreparedStatementFactoryDefault(FhirContext fhirContext, ObjectMapper objectMapper, Class resourceType,
String resourceTable, String resourceIdColumn, String resourceColumn)
{
+ Objects.requireNonNull(resourceTable, "resourceTable");
+ if (resourceTable.isBlank())
+ throw new IllegalArgumentException("resourceTable blank");
+ Objects.requireNonNull(resourceIdColumn, "resourceIdColumn");
+ if (resourceIdColumn.isBlank())
+ throw new IllegalArgumentException("resourceIdColumn blank");
+ Objects.requireNonNull(resourceColumn, "resourceColumn");
+ if (resourceColumn.isBlank())
+ throw new IllegalArgumentException("resourceColumn blank");
+
super(fhirContext, objectMapper, resourceType, createSql(resourceTable, resourceIdColumn, resourceColumn),
readByIdSql(resourceTable, resourceIdColumn, resourceColumn),
readByIdAndVersionSql(resourceTable, resourceIdColumn, resourceColumn),
diff --git a/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/dao/jdbc/ReadAccessDaoJdbc.java b/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/dao/jdbc/ReadAccessDaoJdbc.java
index d6f081b0e..1b52fa264 100644
--- a/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/dao/jdbc/ReadAccessDaoJdbc.java
+++ b/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/dao/jdbc/ReadAccessDaoJdbc.java
@@ -24,29 +24,13 @@
import java.util.Objects;
import java.util.UUID;
-import javax.sql.DataSource;
-
import org.postgresql.util.PGobject;
-import org.springframework.beans.factory.InitializingBean;
import ca.uhn.fhir.parser.DataFormatException;
import dev.dsf.fhir.dao.ReadAccessDao;
-public class ReadAccessDaoJdbc implements ReadAccessDao, InitializingBean
+public class ReadAccessDaoJdbc implements ReadAccessDao
{
- private final DataSource dataSource;
-
- public ReadAccessDaoJdbc(DataSource dataSource)
- {
- this.dataSource = dataSource;
- }
-
- @Override
- public void afterPropertiesSet() throws Exception
- {
- Objects.requireNonNull(dataSource, "dataSource");
- }
-
@Override
public List getAccessTypes(Connection connection, UUID resourceId, long version, boolean localIdentity,
UUID organizationId) throws SQLException
diff --git a/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/dao/jdbc/StatisticsDaoJdbc.java b/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/dao/jdbc/StatisticsDaoJdbc.java
index 564f39435..3d929220c 100644
--- a/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/dao/jdbc/StatisticsDaoJdbc.java
+++ b/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/dao/jdbc/StatisticsDaoJdbc.java
@@ -23,11 +23,9 @@
import javax.sql.DataSource;
-import org.springframework.beans.factory.InitializingBean;
-
import dev.dsf.fhir.dao.StatisticsDao;
-public class StatisticsDaoJdbc implements StatisticsDao, InitializingBean
+public class StatisticsDaoJdbc implements StatisticsDao
{
private static final String QUERY = """
SELECT
@@ -63,15 +61,13 @@ public class StatisticsDaoJdbc implements StatisticsDao, InitializingBean
private final DataSource dataSource;
+ /**
+ * @param dataSource
+ * not null
+ */
public StatisticsDaoJdbc(DataSource dataSource)
{
- this.dataSource = dataSource;
- }
-
- @Override
- public void afterPropertiesSet() throws Exception
- {
- Objects.requireNonNull(dataSource, "dataSource");
+ this.dataSource = Objects.requireNonNull(dataSource, "dataSource");
}
@Override
diff --git a/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/dao/provider/DaoProviderImpl.java b/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/dao/provider/DaoProviderImpl.java
index f4f2457c7..c3e125084 100755
--- a/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/dao/provider/DaoProviderImpl.java
+++ b/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/dao/provider/DaoProviderImpl.java
@@ -51,7 +51,6 @@
import org.hl7.fhir.r4.model.Subscription;
import org.hl7.fhir.r4.model.Task;
import org.hl7.fhir.r4.model.ValueSet;
-import org.springframework.beans.factory.InitializingBean;
import ca.uhn.fhir.model.api.annotation.ResourceDef;
import dev.dsf.fhir.dao.ActivityDefinitionDao;
@@ -83,7 +82,7 @@
import dev.dsf.fhir.dao.TaskDao;
import dev.dsf.fhir.dao.ValueSetDao;
-public class DaoProviderImpl implements DaoProvider, InitializingBean
+public class DaoProviderImpl implements DaoProvider
{
private final DataSource dataSource;
private final ActivityDefinitionDao activityDefinitionDao;
@@ -119,6 +118,66 @@ public class DaoProviderImpl implements DaoProvider, InitializingBean
private final Map, ResourceDao>> daosByResourceClass = new HashMap<>();
private final Map> daosByResourceTypeName = new HashMap<>();
+ /**
+ * @param dataSource
+ * not null
+ * @param activityDefinitionDao
+ * not null
+ * @param binaryDao
+ * not null
+ * @param bundleDao
+ * not null
+ * @param codeSystemDao
+ * not null
+ * @param documentReferenceDao
+ * not null
+ * @param endpointDao
+ * not null
+ * @param groupDao
+ * not null
+ * @param healthcareServiceDao
+ * not null
+ * @param libraryDao
+ * not null
+ * @param locationDao
+ * not null
+ * @param measureDao
+ * not null
+ * @param measureReportDao
+ * not null
+ * @param namingSystemDao
+ * not null
+ * @param organizationDao
+ * not null
+ * @param organizationAffiliationDao
+ * not null
+ * @param patientDao
+ * not null
+ * @param practitionerDao
+ * not null
+ * @param practitionerRoleDao
+ * not null
+ * @param provenanceDao
+ * not null
+ * @param questionnaireDao
+ * not null
+ * @param questionnaireResponseDao
+ * not null
+ * @param researchStudyDao
+ * not null
+ * @param structureDefinitionDao
+ * not null
+ * @param structureDefinitionSnapshotDao
+ * not null
+ * @param subscriptionDao
+ * not null
+ * @param taskDao
+ * not null
+ * @param valueSetDao
+ * not null
+ * @param readAccessDao
+ * not null
+ */
public DaoProviderImpl(DataSource dataSource, ActivityDefinitionDao activityDefinitionDao, BinaryDao binaryDao,
BundleDao bundleDao, CodeSystemDao codeSystemDao, DocumentReferenceDao documentReferenceDao,
EndpointDao endpointDao, GroupDao groupDao, HealthcareServiceDao healthcareServiceDao,
@@ -131,36 +190,38 @@ public DaoProviderImpl(DataSource dataSource, ActivityDefinitionDao activityDefi
StructureDefinitionDao structureDefinitionSnapshotDao, SubscriptionDao subscriptionDao, TaskDao taskDao,
ValueSetDao valueSetDao, ReadAccessDao readAccessDao)
{
- this.dataSource = dataSource;
- this.activityDefinitionDao = activityDefinitionDao;
- this.binaryDao = binaryDao;
- this.bundleDao = bundleDao;
- this.codeSystemDao = codeSystemDao;
- this.documentReferenceDao = documentReferenceDao;
- this.endpointDao = endpointDao;
- this.groupDao = groupDao;
- this.healthcareServiceDao = healthcareServiceDao;
- this.libraryDao = libraryDao;
- this.locationDao = locationDao;
- this.measureDao = measureDao;
- this.measureReportDao = measureReportDao;
- this.namingSystemDao = namingSystemDao;
- this.organizationDao = organizationDao;
- this.organizationAffiliationDao = organizationAffiliationDao;
- this.patientDao = patientDao;
- this.practitionerDao = practitionerDao;
- this.practitionerRoleDao = practitionerRoleDao;
- this.provenanceDao = provenanceDao;
- this.questionnaireDao = questionnaireDao;
- this.questionnaireResponseDao = questionnaireResponseDao;
- this.researchStudyDao = researchStudyDao;
- this.structureDefinitionDao = structureDefinitionDao;
- this.structureDefinitionSnapshotDao = structureDefinitionSnapshotDao;
- this.subscriptionDao = subscriptionDao;
- this.taskDao = taskDao;
- this.valueSetDao = valueSetDao;
-
- this.readAccessDao = readAccessDao;
+ this.dataSource = Objects.requireNonNull(dataSource, "dataSource");
+ this.activityDefinitionDao = Objects.requireNonNull(activityDefinitionDao, "activityDefinitionDao");
+ this.binaryDao = Objects.requireNonNull(binaryDao, "binaryDao");
+ this.bundleDao = Objects.requireNonNull(bundleDao, "bundleDao");
+ this.codeSystemDao = Objects.requireNonNull(codeSystemDao, "codeSystemDao");
+ this.documentReferenceDao = Objects.requireNonNull(documentReferenceDao, "documentReferenceDao");
+ this.endpointDao = Objects.requireNonNull(endpointDao, "endpointDao");
+ this.groupDao = Objects.requireNonNull(groupDao, "groupDao");
+ this.healthcareServiceDao = Objects.requireNonNull(healthcareServiceDao, "healthcareServiceDao");
+ this.libraryDao = Objects.requireNonNull(libraryDao, "libraryDao");
+ this.locationDao = Objects.requireNonNull(locationDao, "locationDao");
+ this.measureDao = Objects.requireNonNull(measureDao, "measureDao");
+ this.measureReportDao = Objects.requireNonNull(measureReportDao, "measureReportDao");
+ this.namingSystemDao = Objects.requireNonNull(namingSystemDao, "namingSystemDao");
+ this.organizationDao = Objects.requireNonNull(organizationDao, "organizationDao");
+ this.organizationAffiliationDao = Objects.requireNonNull(organizationAffiliationDao,
+ "organizationAffiliationDao");
+ this.patientDao = Objects.requireNonNull(patientDao, "patientDao");
+ this.practitionerDao = Objects.requireNonNull(practitionerDao, "practitionerDao");
+ this.practitionerRoleDao = Objects.requireNonNull(practitionerRoleDao, "practitionerRoleDao");
+ this.provenanceDao = Objects.requireNonNull(provenanceDao, "provenanceDao");
+ this.questionnaireDao = Objects.requireNonNull(questionnaireDao, "questionnaireDao");
+ this.questionnaireResponseDao = Objects.requireNonNull(questionnaireResponseDao, "questionnaireResponseDao");
+ this.researchStudyDao = Objects.requireNonNull(researchStudyDao, "researchStudyDao");
+ this.structureDefinitionDao = Objects.requireNonNull(structureDefinitionDao, "structureDefinitionDao");
+ this.structureDefinitionSnapshotDao = Objects.requireNonNull(structureDefinitionSnapshotDao,
+ "structureDefinitionSnapshotDao");
+ this.subscriptionDao = Objects.requireNonNull(subscriptionDao, "subscriptionDao");
+ this.taskDao = Objects.requireNonNull(taskDao, "taskDao");
+ this.valueSetDao = Objects.requireNonNull(valueSetDao, "valueSetDao");
+
+ this.readAccessDao = Objects.requireNonNull(readAccessDao, "readAccessDao");
daosByResourceClass.put(ActivityDefinition.class, activityDefinitionDao);
daosByResourceClass.put(Binary.class, binaryDao);
@@ -192,38 +253,6 @@ public DaoProviderImpl(DataSource dataSource, ActivityDefinitionDao activityDefi
daosByResourceClass.forEach((k, v) -> daosByResourceTypeName.put(k.getAnnotation(ResourceDef.class).name(), v));
}
- @Override
- public void afterPropertiesSet() throws Exception
- {
- Objects.requireNonNull(activityDefinitionDao, "activityDefinitionDao");
- Objects.requireNonNull(binaryDao, "binaryDao");
- Objects.requireNonNull(bundleDao, "bundleDao");
- Objects.requireNonNull(codeSystemDao, "codeSystemDao");
- Objects.requireNonNull(documentReferenceDao, "documentReferenceDao");
- Objects.requireNonNull(endpointDao, "endpointDao");
- Objects.requireNonNull(groupDao, "groupDao");
- Objects.requireNonNull(healthcareServiceDao, "healthcareServiceDao");
- Objects.requireNonNull(libraryDao, "libraryDao");
- Objects.requireNonNull(locationDao, "locationDao");
- Objects.requireNonNull(measureDao, "measureDao");
- Objects.requireNonNull(measureReportDao, "measureReportDao");
- Objects.requireNonNull(namingSystemDao, "namingSystemDao");
- Objects.requireNonNull(organizationDao, "organizationDao");
- Objects.requireNonNull(organizationAffiliationDao, "organizationAffiliationDao");
- Objects.requireNonNull(patientDao, "patientDao");
- Objects.requireNonNull(practitionerDao, "practitionerDao");
- Objects.requireNonNull(practitionerRoleDao, "practitionerRoleDao");
- Objects.requireNonNull(provenanceDao, "provenanceDao");
- Objects.requireNonNull(questionnaireDao, "questionnaireDao");
- Objects.requireNonNull(questionnaireResponseDao, "questionnaireResponseDao");
- Objects.requireNonNull(researchStudyDao, "researchStudyDao");
- Objects.requireNonNull(structureDefinitionDao, "structureDefinitionDao");
- Objects.requireNonNull(structureDefinitionSnapshotDao, "structureDefinitionSnapshotDao");
- Objects.requireNonNull(subscriptionDao, "subscriptionDao");
- Objects.requireNonNull(taskDao, "taskDao");
- Objects.requireNonNull(valueSetDao, "valueSetDao");
- }
-
@Override
public Connection newReadOnlyAutoCommitTransaction() throws SQLException
{
diff --git a/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/exception/DataFormatExceptionHandler.java b/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/exception/DataFormatExceptionHandler.java
index 61279bd56..04804d76e 100644
--- a/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/exception/DataFormatExceptionHandler.java
+++ b/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/exception/DataFormatExceptionHandler.java
@@ -22,7 +22,6 @@
import org.hl7.fhir.r4.model.OperationOutcome.IssueType;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.InitializingBean;
import ca.uhn.fhir.parser.DataFormatException;
import dev.dsf.fhir.help.ResponseGenerator;
@@ -32,21 +31,19 @@
import jakarta.ws.rs.ext.Provider;
@Provider
-public class DataFormatExceptionHandler implements ExceptionMapper, InitializingBean
+public class DataFormatExceptionHandler implements ExceptionMapper
{
private static final Logger logger = LoggerFactory.getLogger(DataFormatExceptionHandler.class);
private final ResponseGenerator responseGenerator;
+ /**
+ * @param responseGenerator
+ * not null
+ */
public DataFormatExceptionHandler(ResponseGenerator responseGenerator)
{
- this.responseGenerator = responseGenerator;
- }
-
- @Override
- public void afterPropertiesSet() throws Exception
- {
- Objects.requireNonNull(responseGenerator, "responseGenerator");
+ this.responseGenerator = Objects.requireNonNull(responseGenerator, "responseGenerator");
}
@Override
diff --git a/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/history/HistoryServiceImpl.java b/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/history/HistoryServiceImpl.java
index 82cbf894c..07e1df4ac 100644
--- a/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/history/HistoryServiceImpl.java
+++ b/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/history/HistoryServiceImpl.java
@@ -23,7 +23,6 @@
import org.hl7.fhir.r4.model.Bundle;
import org.hl7.fhir.r4.model.Bundle.BundleEntryComponent;
import org.hl7.fhir.r4.model.Resource;
-import org.springframework.beans.factory.InitializingBean;
import ca.uhn.fhir.model.api.annotation.ResourceDef;
import dev.dsf.common.auth.conf.Identity;
@@ -47,7 +46,7 @@
import jakarta.ws.rs.core.UriBuilder;
import jakarta.ws.rs.core.UriInfo;
-public class HistoryServiceImpl implements HistoryService, InitializingBean
+public class HistoryServiceImpl implements HistoryService
{
private final String serverBase;
private final int defaultPageCount;
@@ -58,30 +57,38 @@ public class HistoryServiceImpl implements HistoryService, InitializingBean
private final HistoryDao historyDao;
private final HistoryIdentityFilterFactory historyUserFilterFactory;
+ /**
+ * @param serverBase
+ * not null
+ * @param defaultPageCount
+ * >= 0
+ * @param parameterConverter
+ * not null
+ * @param exceptionHandler
+ * not null
+ * @param responseGenerator
+ * not null
+ * @param referenceCleaner
+ * not null
+ * @param historyDao
+ * not null
+ * @param historyUserFilterFactory
+ * not null
+ */
public HistoryServiceImpl(String serverBase, int defaultPageCount, ParameterConverter parameterConverter,
ExceptionHandler exceptionHandler, ResponseGenerator responseGenerator, ReferenceCleaner referenceCleaner,
HistoryDao historyDao, HistoryIdentityFilterFactory historyUserFilterFactory)
{
- this.serverBase = serverBase;
- this.defaultPageCount = defaultPageCount;
- this.parameterConverter = parameterConverter;
- this.exceptionHandler = exceptionHandler;
- this.responseGenerator = responseGenerator;
- this.referenceCleaner = referenceCleaner;
- this.historyDao = historyDao;
- this.historyUserFilterFactory = historyUserFilterFactory;
- }
-
- @Override
- public void afterPropertiesSet() throws Exception
- {
- Objects.requireNonNull(serverBase, "serverBase");
- Objects.requireNonNull(parameterConverter, "parameterConverter");
- Objects.requireNonNull(exceptionHandler, "exceptionHandler");
- Objects.requireNonNull(responseGenerator, "responseGenerator");
- Objects.requireNonNull(referenceCleaner, "referenceCleaner");
- Objects.requireNonNull(historyDao, "historyDao");
- Objects.requireNonNull(historyUserFilterFactory, "historyUserFilterFactory");
+ this.serverBase = Objects.requireNonNull(serverBase, "serverBase");
+ if (defaultPageCount < 0)
+ throw new IllegalArgumentException("defaultPageCount < 0");
+ this.defaultPageCount = Objects.requireNonNull(defaultPageCount, "defaultPageCount");
+ this.parameterConverter = Objects.requireNonNull(parameterConverter, "parameterConverter");
+ this.exceptionHandler = Objects.requireNonNull(exceptionHandler, "exceptionHandler");
+ this.responseGenerator = Objects.requireNonNull(responseGenerator, "responseGenerator");
+ this.referenceCleaner = Objects.requireNonNull(referenceCleaner, "referenceCleaner");
+ this.historyDao = Objects.requireNonNull(historyDao, "historyDao");
+ this.historyUserFilterFactory = Objects.requireNonNull(historyUserFilterFactory, "historyUserFilterFactory");
}
@Override
diff --git a/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/search/PageAndCount.java b/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/search/PageAndCount.java
index 6a2f79a5f..0f03b3597 100755
--- a/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/search/PageAndCount.java
+++ b/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/search/PageAndCount.java
@@ -17,6 +17,7 @@
import java.util.List;
import java.util.Map;
+import java.util.Objects;
public class PageAndCount
{
@@ -33,6 +34,13 @@ public static PageAndCount exists()
return EXISTS;
}
+ /**
+ * @param queryParameters
+ * not null
+ * @param defaultPageCount
+ * >= 0
+ * @return
+ */
public static PageAndCount from(Map> queryParameters, int defaultPageCount)
{
Integer page = getFirstInt(queryParameters, SearchQuery.PARAMETER_PAGE);
@@ -43,6 +51,9 @@ public static PageAndCount from(Map> queryParameters, int d
private static Integer getFirstInt(Map> queryParameters, String key)
{
+ Objects.requireNonNull(queryParameters, "queryParameters");
+ Objects.requireNonNull(key, "key");
+
List values = queryParameters.getOrDefault(key, List.of());
if (values.isEmpty())
return null;
@@ -75,12 +86,22 @@ public static PageAndCount from(int page, int count)
return new PageAndCount(page, count, count);
}
-
private final int page;
private final int count;
+ /**
+ * @param page
+ * may be null
+ * @param count
+ * may be null
+ * @param defaultPageCount
+ * >= 0
+ */
private PageAndCount(Integer page, Integer count, int defaultPageCount)
{
+ if (defaultPageCount < 0)
+ throw new IllegalArgumentException("defaultPageCount < 0");
+
int effectivePage = page == null ? 1 : page < 0 ? 0 : page;
int effectiveCount = count == null ? defaultPageCount : count < 0 ? 0 : count;
diff --git a/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/service/InitialDataLoaderImpl.java b/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/service/InitialDataLoaderImpl.java
index e51b68165..ed9a73382 100644
--- a/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/service/InitialDataLoaderImpl.java
+++ b/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/service/InitialDataLoaderImpl.java
@@ -22,9 +22,7 @@
import org.hl7.fhir.r4.model.Organization;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.InitializingBean;
-import ca.uhn.fhir.context.FhirContext;
import dev.dsf.common.auth.conf.Identity;
import dev.dsf.common.auth.conf.OrganizationIdentityImpl;
import dev.dsf.fhir.authentication.FhirServerRoleImpl;
@@ -34,7 +32,7 @@
import dev.dsf.fhir.prefer.PreferHandlingType;
import dev.dsf.fhir.prefer.PreferReturnType;
-public class InitialDataLoaderImpl implements InitialDataLoader, InitializingBean
+public class InitialDataLoaderImpl implements InitialDataLoader
{
private static final Identity INITIAL_DATA_LOADER;
static
@@ -56,19 +54,14 @@ public boolean isNotExpired()
private static final Logger logger = LoggerFactory.getLogger(InitialDataLoaderImpl.class);
private final CommandFactory commandFactory;
- private final FhirContext fhirContext;
- public InitialDataLoaderImpl(CommandFactory commandFactory, FhirContext fhirContext)
+ /**
+ * @param commandFactory
+ * not null
+ */
+ public InitialDataLoaderImpl(CommandFactory commandFactory)
{
- this.commandFactory = commandFactory;
- this.fhirContext = fhirContext;
- }
-
- @Override
- public void afterPropertiesSet() throws Exception
- {
- Objects.requireNonNull(commandFactory, "commandFactory");
- Objects.requireNonNull(fhirContext, "fhirContext");
+ this.commandFactory = Objects.requireNonNull(commandFactory, "commandFactory");
}
@Override
diff --git a/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/service/ReferenceResolverImpl.java b/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/service/ReferenceResolverImpl.java
index e169bdd9b..7dab26181 100755
--- a/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/service/ReferenceResolverImpl.java
+++ b/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/service/ReferenceResolverImpl.java
@@ -32,7 +32,6 @@
import org.hl7.fhir.r4.model.Resource;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.InitializingBean;
import org.springframework.util.CollectionUtils;
import org.springframework.web.util.UriComponents;
import org.springframework.web.util.UriComponentsBuilder;
@@ -50,7 +49,7 @@
import dev.dsf.fhir.search.SearchQueryParameterError;
import dev.dsf.fhir.service.ResourceReference.ReferenceType;
-public class ReferenceResolverImpl implements ReferenceResolver, InitializingBean
+public class ReferenceResolverImpl implements ReferenceResolver
{
private static final Logger logger = LoggerFactory.getLogger(ReferenceResolverImpl.class);
@@ -64,26 +63,29 @@ public class ReferenceResolverImpl implements ReferenceResolver, InitializingBea
private final ClientProvider clientProvider;
private final ParameterConverter parameterConverter;
+ /**
+ * @param serverBase
+ * not null
+ * @param daoProvider
+ * not null
+ * @param responseGenerator
+ * not null
+ * @param exceptionHandler
+ * not null
+ * @param clientProvider
+ * not null
+ * @param parameterConverter
+ * not nullo
+ */
public ReferenceResolverImpl(String serverBase, DaoProvider daoProvider, ResponseGenerator responseGenerator,
ExceptionHandler exceptionHandler, ClientProvider clientProvider, ParameterConverter parameterConverter)
{
- this.serverBase = serverBase;
- this.daoProvider = daoProvider;
- this.responseGenerator = responseGenerator;
- this.exceptionHandler = exceptionHandler;
- this.clientProvider = clientProvider;
- this.parameterConverter = parameterConverter;
- }
-
- @Override
- public void afterPropertiesSet() throws Exception
- {
- Objects.requireNonNull(serverBase, "serverBase");
- Objects.requireNonNull(daoProvider, "daoProvider");
- Objects.requireNonNull(responseGenerator, "responseGenerator");
- Objects.requireNonNull(exceptionHandler, "exceptionHandler");
- Objects.requireNonNull(clientProvider, "clientProvider");
- Objects.requireNonNull(parameterConverter, "parameterConverter");
+ this.serverBase = Objects.requireNonNull(serverBase, "serverBase");
+ this.daoProvider = Objects.requireNonNull(daoProvider, "daoProvider");
+ this.responseGenerator = Objects.requireNonNull(responseGenerator, "responseGenerator");
+ this.exceptionHandler = Objects.requireNonNull(exceptionHandler, "exceptionHandler");
+ this.clientProvider = Objects.requireNonNull(clientProvider, "clientProvider");
+ this.parameterConverter = Objects.requireNonNull(parameterConverter, "parameterConverter");
}
@Override
diff --git a/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/service/ValidationSupportWithFetchFromDb.java b/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/service/ValidationSupportWithFetchFromDb.java
index abbd83deb..7cb4e9951 100644
--- a/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/service/ValidationSupportWithFetchFromDb.java
+++ b/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/service/ValidationSupportWithFetchFromDb.java
@@ -33,7 +33,6 @@
import org.hl7.fhir.r4.model.ValueSet;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.InitializingBean;
import ca.uhn.fhir.context.FhirContext;
import ca.uhn.fhir.context.support.IValidationSupport;
@@ -44,7 +43,7 @@
import dev.dsf.fhir.dao.ValueSetDao;
import dev.dsf.fhir.function.SupplierWithSqlException;
-public class ValidationSupportWithFetchFromDb implements IValidationSupport, InitializingBean
+public class ValidationSupportWithFetchFromDb implements IValidationSupport
{
private static final Logger logger = LoggerFactory.getLogger(ValidationSupportWithFetchFromDb.class);
@@ -57,29 +56,35 @@ public class ValidationSupportWithFetchFromDb implements IValidationSupport, Ini
private final MeasureDao measureDao;
private final QuestionnaireDao questionnaireDao;
+ /**
+ * @param context
+ * not null
+ * @param structureDefinitionDao
+ * not null
+ * @param structureDefinitionSnapshotDao
+ * not null
+ * @param codeSystemDao
+ * not null
+ * @param valueSetDao
+ * not null
+ * @param measureDao
+ * not null
+ * @param questionnaireDao
+ * not null
+ */
public ValidationSupportWithFetchFromDb(FhirContext context, StructureDefinitionDao structureDefinitionDao,
StructureDefinitionDao structureDefinitionSnapshotDao, CodeSystemDao codeSystemDao, ValueSetDao valueSetDao,
MeasureDao measureDao, QuestionnaireDao questionnaireDao)
{
- this.context = context;
-
- this.structureDefinitionDao = structureDefinitionDao;
- this.structureDefinitionSnapshotDao = structureDefinitionSnapshotDao;
- this.codeSystemDao = codeSystemDao;
- this.valueSetDao = valueSetDao;
- this.measureDao = measureDao;
- this.questionnaireDao = questionnaireDao;
- }
-
- @Override
- public void afterPropertiesSet() throws Exception
- {
- Objects.requireNonNull(structureDefinitionDao, "structureDefinitionDao");
- Objects.requireNonNull(structureDefinitionSnapshotDao, "structureDefinitionSnapshotDao");
- Objects.requireNonNull(codeSystemDao, "codeSystemDao");
- Objects.requireNonNull(valueSetDao, "valueSetDao");
- Objects.requireNonNull(measureDao, "measureDao");
- Objects.requireNonNull(questionnaireDao, "questionnaireDao");
+ this.context = Objects.requireNonNull(context, "context");
+
+ this.structureDefinitionDao = Objects.requireNonNull(structureDefinitionDao, "structureDefinitionDao");
+ this.structureDefinitionSnapshotDao = Objects.requireNonNull(structureDefinitionSnapshotDao,
+ "structureDefinitionSnapshotDao");
+ this.codeSystemDao = Objects.requireNonNull(codeSystemDao, "codeSystemDao");
+ this.valueSetDao = Objects.requireNonNull(valueSetDao, "valueSetDao");
+ this.measureDao = Objects.requireNonNull(measureDao, "measureDao");
+ this.questionnaireDao = Objects.requireNonNull(questionnaireDao, "questionnaireDao");
}
@Override
diff --git a/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/service/ValidationSupportWithFetchFromDbWithTransaction.java b/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/service/ValidationSupportWithFetchFromDbWithTransaction.java
index 8cfe29b93..e7763bc8b 100644
--- a/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/service/ValidationSupportWithFetchFromDbWithTransaction.java
+++ b/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/service/ValidationSupportWithFetchFromDbWithTransaction.java
@@ -34,7 +34,6 @@
import org.hl7.fhir.r4.model.ValueSet;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.InitializingBean;
import ca.uhn.fhir.context.FhirContext;
import ca.uhn.fhir.context.support.IValidationSupport;
@@ -45,7 +44,7 @@
import dev.dsf.fhir.dao.ValueSetDao;
import dev.dsf.fhir.function.SupplierWithSqlException;
-public class ValidationSupportWithFetchFromDbWithTransaction implements IValidationSupport, InitializingBean
+public class ValidationSupportWithFetchFromDbWithTransaction implements IValidationSupport
{
private static final Logger logger = LoggerFactory.getLogger(ValidationSupportWithFetchFromDbWithTransaction.class);
@@ -60,32 +59,40 @@ public class ValidationSupportWithFetchFromDbWithTransaction implements IValidat
private final Connection connection;
+ /**
+ * @param context
+ * not null
+ * @param structureDefinitionDao
+ * not null
+ * @param structureDefinitionSnapshotDao
+ * not null
+ * @param codeSystemDao
+ * not null
+ * @param valueSetDao
+ * not null
+ * @param measureDao
+ * not null
+ * @param questionnaireDao
+ * not null
+ * @param connection
+ * not null
+ */
public ValidationSupportWithFetchFromDbWithTransaction(FhirContext context,
StructureDefinitionDao structureDefinitionDao, StructureDefinitionDao structureDefinitionSnapshotDao,
CodeSystemDao codeSystemDao, ValueSetDao valueSetDao, MeasureDao measureDao,
QuestionnaireDao questionnaireDao, Connection connection)
{
- this.context = context;
+ this.context = Objects.requireNonNull(context, "context");
- this.structureDefinitionDao = structureDefinitionDao;
- this.structureDefinitionSnapshotDao = structureDefinitionSnapshotDao;
- this.codeSystemDao = codeSystemDao;
- this.valueSetDao = valueSetDao;
- this.measureDao = measureDao;
- this.questionnaireDao = questionnaireDao;
+ this.structureDefinitionDao = Objects.requireNonNull(structureDefinitionDao, "structureDefinitionDao");
+ this.structureDefinitionSnapshotDao = Objects.requireNonNull(structureDefinitionSnapshotDao,
+ "structureDefinitionSnapshotDao");
+ this.codeSystemDao = Objects.requireNonNull(codeSystemDao, "codeSystemDao");
+ this.valueSetDao = Objects.requireNonNull(valueSetDao, "valueSetDao");
+ this.measureDao = Objects.requireNonNull(measureDao, "measureDao");
+ this.questionnaireDao = Objects.requireNonNull(questionnaireDao, "questionnaireDao");
- this.connection = connection;
- }
-
- @Override
- public void afterPropertiesSet() throws Exception
- {
- Objects.requireNonNull(structureDefinitionDao, "structureDefinitionDao");
- Objects.requireNonNull(structureDefinitionSnapshotDao, "structureDefinitionSnapshotDao");
- Objects.requireNonNull(codeSystemDao, "codeSystemDao");
- Objects.requireNonNull(valueSetDao, "valueSetDao");
- Objects.requireNonNull(measureDao, "measureDao");
- Objects.requireNonNull(questionnaireDao, "questionnaireDao");
+ this.connection = Objects.requireNonNull(connection, "connection");
}
@Override
diff --git a/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/service/migration/QuestionnairesMigrationJob.java b/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/service/migration/QuestionnairesMigrationJob.java
index a8593b2e9..33d3eb768 100644
--- a/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/service/migration/QuestionnairesMigrationJob.java
+++ b/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/service/migration/QuestionnairesMigrationJob.java
@@ -26,13 +26,12 @@
import org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.InitializingBean;
import dev.dsf.fhir.dao.QuestionnaireDao;
import dev.dsf.fhir.event.EventGenerator;
import dev.dsf.fhir.event.EventHandler;
-public class QuestionnairesMigrationJob implements MigrationJob, InitializingBean
+public class QuestionnairesMigrationJob implements MigrationJob
{
private static final Logger logger = LoggerFactory.getLogger(QuestionnairesMigrationJob.class);
@@ -54,17 +53,9 @@ public class QuestionnairesMigrationJob implements MigrationJob, InitializingBea
*/
public QuestionnairesMigrationJob(QuestionnaireDao dao, EventHandler eventHandler, EventGenerator eventGenerator)
{
- this.dao = dao;
- this.eventHandler = eventHandler;
- this.eventGenerator = eventGenerator;
- }
-
- @Override
- public void afterPropertiesSet() throws Exception
- {
- Objects.requireNonNull(dao, "dao");
- Objects.requireNonNull(eventHandler, "eventHandler");
- Objects.requireNonNull(eventGenerator, "eventGenerator");
+ this.dao = Objects.requireNonNull(dao, "dao");
+ this.eventHandler = Objects.requireNonNull(eventHandler, "eventHandler");
+ this.eventGenerator = Objects.requireNonNull(eventGenerator, "eventGenerator");
}
@Override
diff --git a/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/service/migration/StructureDefinitionTaskProfileMigrationJob.java b/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/service/migration/StructureDefinitionTaskProfileMigrationJob.java
index 90f861495..574e2712c 100644
--- a/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/service/migration/StructureDefinitionTaskProfileMigrationJob.java
+++ b/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/service/migration/StructureDefinitionTaskProfileMigrationJob.java
@@ -26,7 +26,6 @@
import org.hl7.fhir.r4.model.StructureDefinition;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.InitializingBean;
import dev.dsf.fhir.dao.StructureDefinitionDao;
import dev.dsf.fhir.event.EventGenerator;
@@ -35,7 +34,7 @@
import dev.dsf.fhir.validation.SnapshotGenerator;
import dev.dsf.fhir.validation.SnapshotGenerator.SnapshotWithValidationMessages;
-public class StructureDefinitionTaskProfileMigrationJob implements MigrationJob, InitializingBean
+public class StructureDefinitionTaskProfileMigrationJob implements MigrationJob
{
private static final Logger logger = LoggerFactory.getLogger(StructureDefinitionTaskProfileMigrationJob.class);
@@ -69,23 +68,12 @@ public StructureDefinitionTaskProfileMigrationJob(StructureDefinitionDao dao, St
SnapshotGenerator snapshotGenerator, ExceptionHandler exceptionHandler, EventHandler eventHandler,
EventGenerator eventGenerator)
{
- this.dao = dao;
- this.snapshotDao = snapshotDao;
- this.snapshotGenerator = snapshotGenerator;
- this.exceptionHandler = exceptionHandler;
- this.eventHandler = eventHandler;
- this.eventGenerator = eventGenerator;
- }
-
- @Override
- public void afterPropertiesSet() throws Exception
- {
- Objects.requireNonNull(dao, "dao");
- Objects.requireNonNull(snapshotDao, "snapshotDao");
- Objects.requireNonNull(snapshotGenerator, "snapshotGenerator");
- Objects.requireNonNull(exceptionHandler, "exceptionHandler");
- Objects.requireNonNull(eventHandler, "eventHandler");
- Objects.requireNonNull(eventGenerator, "eventGenerator");
+ this.dao = Objects.requireNonNull(dao, "dao");
+ this.snapshotDao = Objects.requireNonNull(snapshotDao, "snapshotDao");
+ this.snapshotGenerator = Objects.requireNonNull(snapshotGenerator, "snapshotGenerator");
+ this.exceptionHandler = Objects.requireNonNull(exceptionHandler, "exceptionHandler");
+ this.eventHandler = Objects.requireNonNull(eventHandler, "eventHandler");
+ this.eventGenerator = Objects.requireNonNull(eventGenerator, "eventGenerator");
}
@Override
diff --git a/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/spring/config/DaoConfig.java b/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/spring/config/DaoConfig.java
index 7180a0022..22cb36d2e 100755
--- a/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/spring/config/DaoConfig.java
+++ b/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/spring/config/DaoConfig.java
@@ -158,7 +158,7 @@ public ActivityDefinitionDao activityDefinitionDao()
jsonConfig.objectMapper(), readByUrlDaoFactory());
}
- @Bean(destroyMethod = "stopLargeObjectUnlinker")
+ @Bean(initMethod = "executeLargeObjectUnlink", destroyMethod = "stopLargeObjectUnlinker")
public BinaryDao binaryDao()
{
return new BinaryDaoJdbc(dataSource(), permanentDeleteDataSource(), fhirConfig.fhirContext(),
@@ -357,14 +357,14 @@ public DaoProvider daoProvider()
@Bean
public HistoryDao historyDao()
{
- return new HistoryDaoJdbc(dataSource(), fhirConfig.fhirContext(), (BinaryDaoJdbc) binaryDao(),
+ return new HistoryDaoJdbc(dataSource(), (BinaryDaoJdbc) binaryDao(),
new PgObjectFactoryImpl(fhirConfig.fhirContext(), jsonConfig.objectMapper()));
}
@Bean
public ReadAccessDao readAccessDao()
{
- return new ReadAccessDaoJdbc(dataSource());
+ return new ReadAccessDaoJdbc();
}
@Bean
diff --git a/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/spring/config/EventConfig.java b/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/spring/config/EventConfig.java
index c696e9e35..2ab0f5842 100755
--- a/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/spring/config/EventConfig.java
+++ b/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/spring/config/EventConfig.java
@@ -41,9 +41,6 @@ public class EventConfig
@Autowired
private DaoConfig daoConfig;
- @Autowired
- private HelperConfig helperConfig;
-
@Autowired
private FhirConfig fhirConfig;
@@ -106,8 +103,8 @@ public EventManager eventManager()
@Bean
public WebSocketSubscriptionManager webSocketSubscriptionManager()
{
- return new WebSocketSubscriptionManagerImpl(daoConfig.daoProvider(), helperConfig.exceptionHandler(),
- matcherFactory(), fhirConfig.fhirContext(), authorizationConfig.authorizationRuleProvider());
+ return new WebSocketSubscriptionManagerImpl(daoConfig.daoProvider(), matcherFactory(), fhirConfig.fhirContext(),
+ authorizationConfig.authorizationRuleProvider());
}
@Bean
diff --git a/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/spring/config/InitialDataLoaderConfig.java b/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/spring/config/InitialDataLoaderConfig.java
index 749fe2bfe..258396349 100755
--- a/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/spring/config/InitialDataLoaderConfig.java
+++ b/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/spring/config/InitialDataLoaderConfig.java
@@ -60,7 +60,7 @@ public class InitialDataLoaderConfig
@Bean
public InitialDataLoader initialDataLoader()
{
- return new InitialDataLoaderImpl(commandConfig.commandFactory(), fhirConfig.fhirContext());
+ return new InitialDataLoaderImpl(commandConfig.commandFactory());
}
@Order(HIGHEST_PRECEDENCE)
diff --git a/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/spring/config/PropertiesConfig.java b/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/spring/config/PropertiesConfig.java
index c0a52ca96..6089f27b1 100644
--- a/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/spring/config/PropertiesConfig.java
+++ b/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/spring/config/PropertiesConfig.java
@@ -89,7 +89,7 @@ public class PropertiesConfig extends AbstractCertificateAndProxyConfig implemen
@Value("${dev.dsf.fhir.server.base.url}")
private String serverBaseUrl;
- @Documentation(description = "Page size returned by the DSF FHIR server when reading/searching fhir resources")
+ @Documentation(description = "Page size returned by the DSF FHIR server when reading/searching fhir resources, >= 0")
@Value("${dev.dsf.fhir.server.page.count:20}")
private int defaultPageCount;
@@ -125,11 +125,11 @@ public class PropertiesConfig extends AbstractCertificateAndProxyConfig implemen
@Value("${dev.dsf.fhir.client.certificate.private.key.password:#{null}}")
private char[] dsfClientCertificatePrivateKeyFilePassword;
- @Documentation(description = "Timeout until a reading a resource from a remote DSF FHIR server is aborted", recommendation = "Change default value only if timeout exceptions occur")
+ @Documentation(description = "Timeout until a reading a resource from a remote DSF FHIR server is aborted, not negative, 0 represents infinity", recommendation = "Change default value only if timeout exceptions occur")
@Value("${dev.dsf.fhir.client.timeout.read:PT10S}")
private String dsfClientReadTimeout;
- @Documentation(description = "Timeout until a connection is established between this DSF FHIR server and a remote DSF FHIR server", recommendation = "Change default value only if timeout exceptions occur")
+ @Documentation(description = "Timeout until a connection is established between this DSF FHIR server and a remote DSF FHIR server, not negative, 0 represents infinity", recommendation = "Change default value only if timeout exceptions occur")
@Value("${dev.dsf.fhir.client.timeout.connect:PT2S}")
private String dsfClientConnectTimeout;
diff --git a/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/spring/config/WebserviceConfig.java b/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/spring/config/WebserviceConfig.java
index ae649842a..1a63d42e2 100755
--- a/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/spring/config/WebserviceConfig.java
+++ b/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/spring/config/WebserviceConfig.java
@@ -15,11 +15,14 @@
*/
package dev.dsf.fhir.spring.config;
+import java.util.List;
+
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import dev.dsf.common.auth.logout.LogoutService;
+import dev.dsf.common.db.health.DatabaseHealthCheck;
import dev.dsf.common.status.webservice.StatusService;
import dev.dsf.common.ui.webservice.StaticResourcesService;
import dev.dsf.fhir.exception.DataFormatExceptionHandler;
@@ -966,6 +969,7 @@ public StaticResourcesService staticResourcesService()
@Bean
public StatusService statusService()
{
- return new StatusService(daoConfig.dataSource(), propertiesConfig.getJettyStatusConnectorPort());
+ return new StatusService(propertiesConfig.getJettyStatusConnectorPort(),
+ List.of(new DatabaseHealthCheck(daoConfig.dataSource())));
}
}
diff --git a/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/spring/config/WebsocketConfig.java b/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/spring/config/WebsocketConfig.java
index 9563a2e03..ea60f0a30 100644
--- a/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/spring/config/WebsocketConfig.java
+++ b/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/spring/config/WebsocketConfig.java
@@ -41,8 +41,8 @@ public ServerEndpoint subscriptionEndpoint()
@Bean
public ServerEndpointRegistration subscriptionEndpointRegistration()
{
- return new ServerEndpointRegistrationForAuthentication(containerDefaultConfigurator(), ServerEndpoint.PATH,
- subscriptionEndpoint());
+ return new ServerEndpointRegistrationForAuthentication(ServerEndpoint.PATH, subscriptionEndpoint(),
+ containerDefaultConfigurator());
}
@Bean
diff --git a/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/subscription/WebSocketSubscriptionManagerImpl.java b/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/subscription/WebSocketSubscriptionManagerImpl.java
index 87855b525..6bdae6582 100755
--- a/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/subscription/WebSocketSubscriptionManagerImpl.java
+++ b/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/subscription/WebSocketSubscriptionManagerImpl.java
@@ -38,7 +38,6 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.DisposableBean;
-import org.springframework.beans.factory.InitializingBean;
import ca.uhn.fhir.context.FhirContext;
import ca.uhn.fhir.model.api.annotation.ResourceDef;
@@ -51,15 +50,13 @@
import dev.dsf.fhir.dao.provider.DaoProvider;
import dev.dsf.fhir.event.Event;
import dev.dsf.fhir.event.EventHandler;
-import dev.dsf.fhir.help.ExceptionHandler;
import dev.dsf.fhir.search.Matcher;
import jakarta.websocket.CloseReason;
import jakarta.websocket.CloseReason.CloseCodes;
import jakarta.websocket.RemoteEndpoint.Async;
import jakarta.websocket.Session;
-public class WebSocketSubscriptionManagerImpl
- implements WebSocketSubscriptionManager, EventHandler, InitializingBean, DisposableBean
+public class WebSocketSubscriptionManagerImpl implements WebSocketSubscriptionManager, EventHandler, DisposableBean
{
private static final Logger logger = LoggerFactory.getLogger(WebSocketSubscriptionManagerImpl.class);
@@ -149,11 +146,11 @@ void closeCredentialsExpired()
}
}
- private final ExecutorService executor = Executors.newCachedThreadPool();
+ private final ExecutorService executor = Executors
+ .newCachedThreadPool(Thread.ofPlatform().name("websocket-subscription-manager-", 0).factory());
private final DaoProvider daoProvider;
private final SubscriptionDao subscriptionDao;
- private final ExceptionHandler exceptionHandler;
private final MatcherFactory matcherFactory;
private final FhirContext fhirContext;
private final AuthorizationRuleProvider authorizationRuleProvider;
@@ -163,26 +160,24 @@ void closeCredentialsExpired()
private final ReadWriteMap, List> matchersByResource = new ReadWriteMap<>();
private final ReadWriteMap> asyncRemotesBySubscriptionIdPart = new ReadWriteMap<>();
- public WebSocketSubscriptionManagerImpl(DaoProvider daoProvider, ExceptionHandler exceptionHandler,
- MatcherFactory matcherFactory, FhirContext fhirContext, AuthorizationRuleProvider authorizationRuleProvider)
+ /**
+ * @param daoProvider
+ * not null
+ * @param matcherFactory
+ * not null
+ * @param fhirContext
+ * not null
+ * @param authorizationRuleProvider
+ * not null
+ */
+ public WebSocketSubscriptionManagerImpl(DaoProvider daoProvider, MatcherFactory matcherFactory,
+ FhirContext fhirContext, AuthorizationRuleProvider authorizationRuleProvider)
{
- this.daoProvider = daoProvider;
+ this.daoProvider = Objects.requireNonNull(daoProvider, "daoProvider");
this.subscriptionDao = daoProvider.getSubscriptionDao();
- this.exceptionHandler = exceptionHandler;
- this.matcherFactory = matcherFactory;
- this.fhirContext = fhirContext;
- this.authorizationRuleProvider = authorizationRuleProvider;
- }
-
- @Override
- public void afterPropertiesSet() throws Exception
- {
- Objects.requireNonNull(daoProvider, "daoProvider");
- Objects.requireNonNull(subscriptionDao, "subscriptionDao");
- Objects.requireNonNull(exceptionHandler, "exceptionHandler");
- Objects.requireNonNull(matcherFactory, "matcherFactory");
- Objects.requireNonNull(fhirContext, "fhirContext");
- Objects.requireNonNull(authorizationRuleProvider, "authorizationRuleProvider");
+ this.matcherFactory = Objects.requireNonNull(matcherFactory, "matcherFactory");
+ this.fhirContext = Objects.requireNonNull(fhirContext, "fhirContext");
+ this.authorizationRuleProvider = Objects.requireNonNull(authorizationRuleProvider, "authorizationRuleProvider");
}
private void refreshMatchers()
diff --git a/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/webservice/base/AbstractDelegatingBasicService.java b/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/webservice/base/AbstractDelegatingBasicService.java
index 43b0d920d..0fbb15872 100644
--- a/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/webservice/base/AbstractDelegatingBasicService.java
+++ b/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/webservice/base/AbstractDelegatingBasicService.java
@@ -17,24 +17,19 @@
import java.util.Objects;
-import org.springframework.beans.factory.InitializingBean;
-
import dev.dsf.fhir.authentication.CurrentIdentityProvider;
-public class AbstractDelegatingBasicService extends AbstractBasicService
- implements BasicService, InitializingBean
+public class AbstractDelegatingBasicService extends AbstractBasicService implements BasicService
{
protected final S delegate;
+ /**
+ * @param delegate
+ * not null
+ */
public AbstractDelegatingBasicService(S delegate)
{
- this.delegate = delegate;
- }
-
- @Override
- public void afterPropertiesSet() throws Exception
- {
- Objects.requireNonNull(delegate, "delegate");
+ this.delegate = Objects.requireNonNull(delegate, "delegate");
}
@Override
diff --git a/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/webservice/jaxrs/AbstractServiceJaxrs.java b/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/webservice/jaxrs/AbstractServiceJaxrs.java
index b19fc2e8d..ee9d5ce85 100644
--- a/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/webservice/jaxrs/AbstractServiceJaxrs.java
+++ b/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/webservice/jaxrs/AbstractServiceJaxrs.java
@@ -60,8 +60,6 @@ private Identity doGetCurrentIdentity()
@Override
public void afterPropertiesSet() throws Exception
{
- super.afterPropertiesSet();
-
setCurrentIdentityProvider(this::doGetCurrentIdentity);
}
}
diff --git a/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/webservice/secure/AbstractResourceServiceSecure.java b/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/webservice/secure/AbstractResourceServiceSecure.java
index f73ea9297..5ef29fbf6 100755
--- a/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/webservice/secure/AbstractResourceServiceSecure.java
+++ b/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/webservice/secure/AbstractResourceServiceSecure.java
@@ -31,7 +31,6 @@
import org.hl7.fhir.r4.model.Resource;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.InitializingBean;
import org.springframework.util.CollectionUtils;
import org.springframework.web.util.UriComponentsBuilder;
@@ -66,7 +65,7 @@
import jakarta.ws.rs.core.UriInfo;
public abstract class AbstractResourceServiceSecure, R extends Resource, S extends BasicResourceService>
- extends AbstractServiceSecure implements BasicResourceService, InitializingBean
+ extends AbstractServiceSecure implements BasicResourceService
{
private static final Logger logger = LoggerFactory.getLogger(AbstractResourceServiceSecure.class);
@@ -82,6 +81,36 @@ public abstract class AbstractResourceServiceSecure, R
protected final ValidationRules validationRules;
protected final DefaultProfileProvider defaultProfileProvider;
+ /**
+ * @param delegate
+ * not null
+ * @param serverBase
+ * not null
+ * @param responseGenerator
+ * not null
+ * @param referenceResolver
+ * not null
+ * @param referenceCleaner
+ * not null
+ * @param referenceExtractor
+ * not null
+ * @param resourceType
+ * not null
+ * @param dao
+ * not null
+ * @param exceptionHandler
+ * not null
+ * @param parameterConverter
+ * not null
+ * @param authorizationRule
+ * not null
+ * @param resourceValidator
+ * not null
+ * @param validationRules
+ * not null
+ * @param defaultProfileProvider
+ * not null
+ */
public AbstractResourceServiceSecure(S delegate, String serverBase, ResponseGenerator responseGenerator,
ReferenceResolver referenceResolver, ReferenceCleaner referenceCleaner,
ReferenceExtractor referenceExtractor, Class resourceType, D dao, ExceptionHandler exceptionHandler,
@@ -91,35 +120,17 @@ public AbstractResourceServiceSecure(S delegate, String serverBase, ResponseGene
{
super(delegate, serverBase, responseGenerator, referenceResolver);
- this.referenceCleaner = referenceCleaner;
- this.referenceExtractor = referenceExtractor;
- this.resourceType = resourceType;
+ this.referenceCleaner = Objects.requireNonNull(referenceCleaner, "referenceCleaner");
+ this.referenceExtractor = Objects.requireNonNull(referenceExtractor, "referenceExtractor");
+ this.resourceType = Objects.requireNonNull(resourceType, "resourceType");
this.resourceTypeName = resourceType.getAnnotation(ResourceDef.class).name();
- this.dao = dao;
- this.exceptionHandler = exceptionHandler;
- this.parameterConverter = parameterConverter;
- this.authorizationRule = authorizationRule;
- this.resourceValidator = resourceValidator;
- this.validationRules = validationRules;
- this.defaultProfileProvider = defaultProfileProvider;
- }
-
- @Override
- public void afterPropertiesSet() throws Exception
- {
- super.afterPropertiesSet();
-
- Objects.requireNonNull(referenceCleaner, "referenceCleaner");
- Objects.requireNonNull(referenceExtractor, "referenceExtractor");
- Objects.requireNonNull(resourceType, "resourceType");
- Objects.requireNonNull(resourceTypeName, "resourceTypeName");
- Objects.requireNonNull(dao, "dao");
- Objects.requireNonNull(exceptionHandler, "exceptionHandler");
- Objects.requireNonNull(parameterConverter, "parameterConverter");
- Objects.requireNonNull(authorizationRule, "authorizationRule");
- Objects.requireNonNull(resourceValidator, "resourceValidator");
- Objects.requireNonNull(validationRules, "validationRules");
- Objects.requireNonNull(defaultProfileProvider, "defaultProfileProvider");
+ this.dao = Objects.requireNonNull(dao, "dao");
+ this.exceptionHandler = Objects.requireNonNull(exceptionHandler, "exceptionHandler");
+ this.parameterConverter = Objects.requireNonNull(parameterConverter, "parameterConverter");
+ this.authorizationRule = Objects.requireNonNull(authorizationRule, "authorizationRule");
+ this.resourceValidator = Objects.requireNonNull(resourceValidator, "resourceValidator");
+ this.validationRules = Objects.requireNonNull(validationRules, "validationRules");
+ this.defaultProfileProvider = Objects.requireNonNull(defaultProfileProvider, "defaultProfileProvider");
}
private String toValidationLogMessage(ValidationResult validationResult)
diff --git a/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/webservice/secure/AbstractServiceSecure.java b/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/webservice/secure/AbstractServiceSecure.java
index 9d426566e..1a5d39d26 100644
--- a/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/webservice/secure/AbstractServiceSecure.java
+++ b/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/webservice/secure/AbstractServiceSecure.java
@@ -19,7 +19,6 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.InitializingBean;
import dev.dsf.fhir.help.ResponseGenerator;
import dev.dsf.fhir.service.ReferenceResolver;
@@ -28,7 +27,6 @@
import jakarta.ws.rs.core.Response;
public abstract class AbstractServiceSecure extends AbstractDelegatingBasicService
- implements InitializingBean
{
protected static final Logger audit = LoggerFactory.getLogger("dsf-audit-logger");
@@ -36,24 +34,24 @@ public abstract class AbstractServiceSecure extends Abst
protected final ResponseGenerator responseGenerator;
protected final ReferenceResolver referenceResolver;
+ /**
+ * @param delegate
+ * not null
+ * @param serverBase
+ * not null
+ * @param responseGenerator
+ * not null
+ * @param referenceResolver
+ * not null
+ */
public AbstractServiceSecure(S delegate, String serverBase, ResponseGenerator responseGenerator,
ReferenceResolver referenceResolver)
{
super(delegate);
- this.serverBase = serverBase;
- this.referenceResolver = referenceResolver;
- this.responseGenerator = responseGenerator;
- }
-
- @Override
- public void afterPropertiesSet() throws Exception
- {
- super.afterPropertiesSet();
-
- Objects.requireNonNull(serverBase, "serverBase");
- Objects.requireNonNull(responseGenerator, "responseGenerator");
- Objects.requireNonNull(referenceResolver, "referenceResolver");
+ this.serverBase = Objects.requireNonNull(serverBase, "serverBase");
+ this.referenceResolver = Objects.requireNonNull(referenceResolver, "referenceResolver");
+ this.responseGenerator = Objects.requireNonNull(responseGenerator, "responseGenerator");
}
protected final Response forbidden(String operation)
diff --git a/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/webservice/secure/RootServiceSecure.java b/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/webservice/secure/RootServiceSecure.java
index 618c47111..912207f73 100755
--- a/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/webservice/secure/RootServiceSecure.java
+++ b/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/webservice/secure/RootServiceSecure.java
@@ -38,20 +38,24 @@ public class RootServiceSecure extends AbstractServiceSecure implem
private final AuthorizationRule authorizationRule;
+ /**
+ * @param delegate
+ * not null
+ * @param serverBase
+ * not null
+ * @param responseGenerator
+ * not null
+ * @param referenceResolver
+ * not null
+ * @param authorizationRule
+ * not null
+ */
public RootServiceSecure(RootService delegate, String serverBase, ResponseGenerator responseGenerator,
ReferenceResolver referenceResolver, AuthorizationRule authorizationRule)
{
super(delegate, serverBase, responseGenerator, referenceResolver);
- this.authorizationRule = authorizationRule;
- }
-
- @Override
- public void afterPropertiesSet() throws Exception
- {
- super.afterPropertiesSet();
-
- Objects.requireNonNull(authorizationRule, "authorizationRule");
+ this.authorizationRule = Objects.requireNonNull(authorizationRule, "authorizationRule");
}
@Override
diff --git a/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/websocket/ServerEndpoint.java b/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/websocket/ServerEndpoint.java
index 01d60b182..4bd859091 100755
--- a/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/websocket/ServerEndpoint.java
+++ b/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/websocket/ServerEndpoint.java
@@ -17,6 +17,7 @@
import java.io.IOException;
import java.nio.ByteBuffer;
+import java.nio.channels.ClosedChannelException;
import java.security.Principal;
import java.util.Arrays;
import java.util.Objects;
@@ -31,7 +32,6 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.DisposableBean;
-import org.springframework.beans.factory.InitializingBean;
import dev.dsf.common.auth.conf.DsfRole;
import dev.dsf.common.auth.conf.Identity;
@@ -46,7 +46,7 @@
import jakarta.websocket.PongMessage;
import jakarta.websocket.Session;
-public class ServerEndpoint extends Endpoint implements InitializingBean, DisposableBean
+public class ServerEndpoint extends Endpoint implements DisposableBean
{
private static final Logger logger = LoggerFactory.getLogger(ServerEndpoint.class);
@@ -56,19 +56,17 @@ public class ServerEndpoint extends Endpoint implements InitializingBean, Dispos
private static final String BIND_MESSAGE_START = "bind ";
private final ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(2,
- r -> new Thread(r, "websocket-server-endpoint-scheduler"));
+ Thread.ofPlatform().name("websocket-server-endpoint-scheduler-", 0).factory());
private final WebSocketSubscriptionManager subscriptionManager;
+ /**
+ * @param subscriptionManager
+ * not null
+ */
public ServerEndpoint(WebSocketSubscriptionManager subscriptionManager)
{
- this.subscriptionManager = subscriptionManager;
- }
-
- @Override
- public void afterPropertiesSet() throws Exception
- {
- Objects.requireNonNull(subscriptionManager, "subscriptionManager");
+ this.subscriptionManager = Objects.requireNonNull(subscriptionManager, "subscriptionManager");
}
@Override
@@ -170,6 +168,8 @@ public void onError(Session session, Throwable throwable)
{
if (throwable == null)
logger.info("Websocket closed with error, session {}: unknown error", session.getId());
+ else if (throwable instanceof ClosedChannelException)
+ logger.debug("Websocket closed");
else if (throwable instanceof CloseException close)
{
String status = String.valueOf(close.getStatusCode());
@@ -177,7 +177,7 @@ else if (throwable instanceof CloseException close)
if (c instanceof CloseCodes cc)
status += " - " + cc.name();
- logger.info("Websocket closed with status {}, session {}", status, session.getId());
+ logger.debug("Websocket closed with status {}, session {}", status, session.getId());
}
else
{
diff --git a/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/websocket/ServerEndpointRegistrationForAuthentication.java b/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/websocket/ServerEndpointRegistrationForAuthentication.java
index 88663b537..4459a638d 100755
--- a/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/websocket/ServerEndpointRegistrationForAuthentication.java
+++ b/dsf-fhir/dsf-fhir-server/src/main/java/dev/dsf/fhir/websocket/ServerEndpointRegistrationForAuthentication.java
@@ -17,27 +17,29 @@
import java.util.Objects;
-import org.springframework.beans.factory.InitializingBean;
import org.springframework.web.socket.server.standard.ServerEndpointRegistration;
import jakarta.websocket.Endpoint;
-public class ServerEndpointRegistrationForAuthentication extends ServerEndpointRegistration implements InitializingBean
+public class ServerEndpointRegistrationForAuthentication extends ServerEndpointRegistration
{
private final Configurator containerDefaultConfigurator;
- public ServerEndpointRegistrationForAuthentication(Configurator containerDefaultConfigurator, String path,
- Endpoint endpoint)
+ /**
+ * @param path
+ * not null, not blank
+ * @param endpoint
+ * not null
+ * @param containerDefaultConfigurator
+ * not null
+ */
+ public ServerEndpointRegistrationForAuthentication(String path, Endpoint endpoint,
+ Configurator containerDefaultConfigurator)
{
super(path, endpoint);
- this.containerDefaultConfigurator = containerDefaultConfigurator;
- }
-
- @Override
- public void afterPropertiesSet() throws Exception
- {
- Objects.requireNonNull(containerDefaultConfigurator, "containerDefaultConfigurator");
+ this.containerDefaultConfigurator = Objects.requireNonNull(containerDefaultConfigurator,
+ "containerDefaultConfigurator");
}
@Override
diff --git a/dsf-fhir/dsf-fhir-server/src/test/java/dev/dsf/fhir/authorization/AbstractAuthorizationRuleTest.java b/dsf-fhir/dsf-fhir-server/src/test/java/dev/dsf/fhir/authorization/AbstractAuthorizationRuleTest.java
index e454d8e13..e27cd75f4 100644
--- a/dsf-fhir/dsf-fhir-server/src/test/java/dev/dsf/fhir/authorization/AbstractAuthorizationRuleTest.java
+++ b/dsf-fhir/dsf-fhir-server/src/test/java/dev/dsf/fhir/authorization/AbstractAuthorizationRuleTest.java
@@ -92,12 +92,6 @@ public void getResourceTypeMatchesExpected()
assertEquals(expectedResourceType(), rule.getResourceType());
}
- @Test
- public void afterPropertiesSetSucceedsWithAllDependencies() throws Exception
- {
- rule.afterPropertiesSet();
- }
-
@Test
public void searchAllowedWhenIdentityHasSearchRole()
{
diff --git a/dsf-fhir/dsf-fhir-server/src/test/java/dev/dsf/fhir/authorization/TaskAuthorizationRuleTest.java b/dsf-fhir/dsf-fhir-server/src/test/java/dev/dsf/fhir/authorization/TaskAuthorizationRuleTest.java
index c0abdce2d..ca3df846c 100644
--- a/dsf-fhir/dsf-fhir-server/src/test/java/dev/dsf/fhir/authorization/TaskAuthorizationRuleTest.java
+++ b/dsf-fhir/dsf-fhir-server/src/test/java/dev/dsf/fhir/authorization/TaskAuthorizationRuleTest.java
@@ -15,7 +15,6 @@
*/
package dev.dsf.fhir.authorization;
-import static org.junit.Assert.assertThrows;
import static org.junit.Assert.assertTrue;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.mock;
@@ -82,20 +81,6 @@ private static OrganizationIdentity localOrganizationIdentity()
return identity;
}
- @Test
- public void afterPropertiesSetThrowsWhenProcessAuthorizationHelperNull()
- {
- TaskAuthorizationRule ruleWithNull = newRule(null, endpointProvider);
- assertThrows(NullPointerException.class, ruleWithNull::afterPropertiesSet);
- }
-
- @Test
- public void afterPropertiesSetThrowsWhenEndpointProviderNull()
- {
- TaskAuthorizationRule ruleWithNull = newRule(processAuthorizationHelper, null);
- assertThrows(NullPointerException.class, ruleWithNull::afterPropertiesSet);
- }
-
@Test
public void createDeniedWhenIdentityHasNoCreateRole()
{
diff --git a/dsf-fhir/dsf-fhir-server/src/test/java/dev/dsf/fhir/dao/HistoryDaoTest.java b/dsf-fhir/dsf-fhir-server/src/test/java/dev/dsf/fhir/dao/HistoryDaoTest.java
index 414b17e31..75a70cb1a 100644
--- a/dsf-fhir/dsf-fhir-server/src/test/java/dev/dsf/fhir/dao/HistoryDaoTest.java
+++ b/dsf-fhir/dsf-fhir-server/src/test/java/dev/dsf/fhir/dao/HistoryDaoTest.java
@@ -92,9 +92,8 @@ public static void afterClass() throws Exception
.disable(Feature.AUTO_CLOSE_TARGET).build();
private final OrganizationDao orgDao = new OrganizationDaoJdbc(defaultDataSource, permanentDeleteDataSource,
fhirContext, objectMapper);
- private final HistoryDao dao = new HistoryDaoJdbc(defaultDataSource, fhirContext,
- new BinaryDaoJdbc(defaultDataSource, permanentDeleteDataSource, fhirContext, objectMapper,
- DATABASE_USERS_GROUP),
+ private final HistoryDao dao = new HistoryDaoJdbc(defaultDataSource, new BinaryDaoJdbc(defaultDataSource,
+ permanentDeleteDataSource, fhirContext, objectMapper, DATABASE_USERS_GROUP),
new PgObjectFactoryImpl(fhirContext, objectMapper));
private final HistoryIdentityFilterFactory filterFactory = new HistoryIdentityFilterFactoryImpl();
diff --git a/dsf-fhir/dsf-fhir-server/src/test/java/dev/dsf/fhir/hapi/BinaryTest.java b/dsf-fhir/dsf-fhir-server/src/test/java/dev/dsf/fhir/hapi/BinaryTest.java
index bddd4975d..8d208698f 100755
--- a/dsf-fhir/dsf-fhir-server/src/test/java/dev/dsf/fhir/hapi/BinaryTest.java
+++ b/dsf-fhir/dsf-fhir-server/src/test/java/dev/dsf/fhir/hapi/BinaryTest.java
@@ -18,7 +18,6 @@
import java.util.Date;
import java.util.UUID;
-import org.apache.commons.lang3.StringUtils;
import org.hl7.fhir.instance.model.api.IBaseResource;
import org.hl7.fhir.r4.model.Binary;
import org.hl7.fhir.r4.model.Bundle;
@@ -129,11 +128,11 @@ public void testJsonParserE() throws Exception
IBaseResource elem = new Patient();
String resourceName = "";
String versionId = elem.getMeta().getVersionId();
- if (StringUtils.isBlank(elem.getIdElement().getIdPart()))
+ if (elem.getIdElement().getIdPart() == null || elem.getIdElement().getIdPart().isBlank())
{
// Resource has no ID
}
- else if (StringUtils.isNotBlank(versionId))
+ else if (!versionId.isBlank())
{
elem.getIdElement()
.setValue(resourceName + "/" + elem.getIdElement().getIdPart() + "/_history/" + versionId);
diff --git a/dsf-fhir/dsf-fhir-server/src/test/java/dev/dsf/fhir/integration/AbstractIntegrationTest.java b/dsf-fhir/dsf-fhir-server/src/test/java/dev/dsf/fhir/integration/AbstractIntegrationTest.java
index df286d35d..cfd270aa8 100644
--- a/dsf-fhir/dsf-fhir-server/src/test/java/dev/dsf/fhir/integration/AbstractIntegrationTest.java
+++ b/dsf-fhir/dsf-fhir-server/src/test/java/dev/dsf/fhir/integration/AbstractIntegrationTest.java
@@ -16,13 +16,10 @@
package dev.dsf.fhir.integration;
import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import java.io.IOException;
import java.io.InputStream;
-import java.net.URI;
import java.nio.channels.ServerSocketChannel;
import java.nio.file.Files;
import java.nio.file.Path;
@@ -46,7 +43,6 @@
import org.eclipse.jetty.server.ServerConnector;
import org.glassfish.jersey.servlet.init.JerseyServletContainerInitializer;
import org.hl7.fhir.r4.model.Bundle;
-import org.hl7.fhir.r4.model.Subscription;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.ClassRule;
@@ -75,8 +71,6 @@
import dev.dsf.fhir.authorization.read.ReadAccessHelperImpl;
import dev.dsf.fhir.client.FhirWebserviceClient;
import dev.dsf.fhir.client.FhirWebserviceClientJersey;
-import dev.dsf.fhir.client.WebsocketClient;
-import dev.dsf.fhir.client.WebsocketClientTyrus;
import dev.dsf.fhir.dao.AbstractDbTest;
import dev.dsf.fhir.service.ReferenceCleaner;
import dev.dsf.fhir.service.ReferenceCleanerImpl;
@@ -177,14 +171,6 @@ private static FhirWebserviceClient createWebserviceClient(int apiPort, KeyStore
"DSF Integration Test Client", fhirContext, referenceCleaner);
}
- private static WebsocketClient createWebsocketClient(int apiPort, KeyStore trustStore, KeyStore keyStore,
- char[] keyStorePassword, String subscriptionIdPart)
- {
- return new WebsocketClientTyrus(() ->
- {}, URI.create("wss://localhost:" + apiPort + CONTEXT_PATH + "/ws"), trustStore, keyStore, keyStorePassword,
- null, null, null, "Integration Test Client", subscriptionIdPart);
- }
-
private static JettyServer startFhirServer(ServerSocketChannel statusConnectorChannel,
ServerSocketChannel apiConnectorChannel, String baseUrl) throws Exception
{
@@ -381,26 +367,6 @@ protected static FhirWebserviceClient getMinimalWebserviceClient()
return minimalWebserviceClient;
}
- protected static WebsocketClient getWebsocketClient()
- {
- Bundle bundle = getWebserviceClient().searchWithStrictHandling(Subscription.class,
- Map.of("criteria", List.of("Task?status=requested"), "status", List.of("active"), "type",
- List.of("websocket"), "payload", List.of("application/fhir+json")));
-
- assertNotNull(bundle);
- assertEquals(1, bundle.getTotal());
- assertNotNull(bundle.getEntryFirstRep());
- assertTrue(bundle.getEntryFirstRep().getResource() instanceof Subscription);
-
- Subscription subscription = (Subscription) bundle.getEntryFirstRep().getResource();
- assertNotNull(subscription.getIdElement());
- assertNotNull(subscription.getIdElement().getIdPart());
-
- return createWebsocketClient(fhirServer.getApiPort(), certificates.getClientCertificate().trustStore(),
- certificates.getClientCertificate().keyStore(), certificates.getClientCertificate().keyStorePassword(),
- subscription.getIdElement().getIdPart());
- }
-
protected static final ReadAccessHelper getReadAccessHelper()
{
return readAccessHelper;
diff --git a/dsf-fhir/dsf-fhir-server/src/test/java/dev/dsf/fhir/integration/ResearchStudyIntegrationTest.java b/dsf-fhir/dsf-fhir-server/src/test/java/dev/dsf/fhir/integration/ResearchStudyIntegrationTest.java
index 21b8f4a38..f92c68251 100644
--- a/dsf-fhir/dsf-fhir-server/src/test/java/dev/dsf/fhir/integration/ResearchStudyIntegrationTest.java
+++ b/dsf-fhir/dsf-fhir-server/src/test/java/dev/dsf/fhir/integration/ResearchStudyIntegrationTest.java
@@ -24,7 +24,6 @@
import java.util.Optional;
import java.util.UUID;
-import org.apache.commons.lang3.StringUtils;
import org.hl7.fhir.r4.model.Binary;
import org.hl7.fhir.r4.model.Bundle;
import org.hl7.fhir.r4.model.Bundle.BundleType;
@@ -517,7 +516,7 @@ private ResearchStudy getResearchStudy(String url)
researchStudy.addExtension().setUrl("http://dsf.dev/fhir/StructureDefinition/extension-participating-ttp")
.setValue(new Reference().setType("Organization").setIdentifier(new Identifier()
.setSystem("http://dsf.dev/sid/organization-identifier").setValue("Test_Organization")));
- if (!StringUtils.isBlank(url))
+ if (url != null && !url.isBlank())
researchStudy.addRelatedArtifact().setType(RelatedArtifactType.DOCUMENTATION).setUrl(url);
researchStudy.addExtension().setUrl("http://dsf.dev/fhir/StructureDefinition/extension-participating-dic")
diff --git a/dsf-fhir/dsf-fhir-server/src/test/java/dev/dsf/fhir/webservice/secure/AbstractResourceServiceSecureTest.java b/dsf-fhir/dsf-fhir-server/src/test/java/dev/dsf/fhir/webservice/secure/AbstractResourceServiceSecureTest.java
index b7f303051..8ca1c669b 100644
--- a/dsf-fhir/dsf-fhir-server/src/test/java/dev/dsf/fhir/webservice/secure/AbstractResourceServiceSecureTest.java
+++ b/dsf-fhir/dsf-fhir-server/src/test/java/dev/dsf/fhir/webservice/secure/AbstractResourceServiceSecureTest.java
@@ -29,7 +29,6 @@
import static org.mockito.Mockito.verifyNoMoreInteractions;
import static org.mockito.Mockito.when;
-import java.lang.reflect.Method;
import java.util.List;
import java.util.Optional;
import java.util.UUID;
@@ -133,9 +132,6 @@ public void before() throws Exception
resourceServiceSecure = createResourceServiceSecure();
resourceServiceSecure.setCurrentIdentityProvider(currentIdentityProvider);
- Method afterPropertiesSet = resourceServiceSecure.getClass().getMethod("afterPropertiesSet");
- afterPropertiesSet.invoke(resourceServiceSecure);
-
Identity identity = mock(Identity.class);
when(identity.getName()).thenReturn("Test Identity");
when(currentIdentityProvider.getCurrentIdentity()).thenReturn(identity);
diff --git a/dsf-fhir/dsf-fhir-server/src/test/java/dev/dsf/fhir/webservice/secure/RootServiceSecureTest.java b/dsf-fhir/dsf-fhir-server/src/test/java/dev/dsf/fhir/webservice/secure/RootServiceSecureTest.java
index 907607f65..76271d0e5 100644
--- a/dsf-fhir/dsf-fhir-server/src/test/java/dev/dsf/fhir/webservice/secure/RootServiceSecureTest.java
+++ b/dsf-fhir/dsf-fhir-server/src/test/java/dev/dsf/fhir/webservice/secure/RootServiceSecureTest.java
@@ -61,7 +61,6 @@ public void before() throws Exception
{
rootServiceSecure = new RootServiceSecure(delegate, SERVER_BASE, new ResponseGenerator(SERVER_BASE),
mock(ReferenceResolver.class), authorizationRule);
- rootServiceSecure.afterPropertiesSet();
rootServiceSecure.setCurrentIdentityProvider(currentIdentityProvider);
diff --git a/dsf-fhir/dsf-fhir-webservice-client/src/main/java/dev/dsf/fhir/client/AbstractJerseyClient.java b/dsf-fhir/dsf-fhir-webservice-client/src/main/java/dev/dsf/fhir/client/AbstractJerseyClient.java
index 39fdb95ae..e79cb2ed4 100644
--- a/dsf-fhir/dsf-fhir-webservice-client/src/main/java/dev/dsf/fhir/client/AbstractJerseyClient.java
+++ b/dsf-fhir/dsf-fhir-webservice-client/src/main/java/dev/dsf/fhir/client/AbstractJerseyClient.java
@@ -59,6 +59,33 @@ public AbstractJerseyClient(String baseUrl, KeyStore trustStore, KeyStore keySto
Duration.ZERO, Duration.ZERO, false, null);
}
+ /**
+ * @param baseUrl
+ * not null
+ * @param trustStore
+ * may be null
+ * @param keyStore
+ * may be null
+ * @param keyStorePassword
+ * may be null
+ * @param objectMapper
+ * may be null
+ * @param componentsToRegister
+ * may be null
+ * @param proxySchemeHostPort
+ * may be null
+ * @param proxyUserName
+ * may be null
+ * @param proxyPassword
+ * may be null
+ * @param connectTimeout
+ * not null, not negative, 0 represents infinity
+ * @param readTimeout
+ * not null, not negative, 0 represents infinity
+ * @param logRequests
+ * @param userAgentValue
+ * may be null
+ */
public AbstractJerseyClient(String baseUrl, KeyStore trustStore, KeyStore keyStore, char[] keyStorePassword,
ObjectMapper objectMapper, Collection> componentsToRegister, String proxySchemeHostPort,
String proxyUserName, char[] proxyPassword, Duration connectTimeout, Duration readTimeout,
diff --git a/dsf-fhir/dsf-fhir-webservice-client/src/main/java/dev/dsf/fhir/client/FhirWebserviceClientJersey.java b/dsf-fhir/dsf-fhir-webservice-client/src/main/java/dev/dsf/fhir/client/FhirWebserviceClientJersey.java
index b0e2a6713..d2b126455 100755
--- a/dsf-fhir/dsf-fhir-webservice-client/src/main/java/dev/dsf/fhir/client/FhirWebserviceClientJersey.java
+++ b/dsf-fhir/dsf-fhir-webservice-client/src/main/java/dev/dsf/fhir/client/FhirWebserviceClientJersey.java
@@ -31,7 +31,6 @@
import java.util.stream.Collectors;
import java.util.stream.Stream;
-import org.apache.commons.lang3.StringUtils;
import org.hl7.fhir.r4.model.Binary;
import org.hl7.fhir.r4.model.Bundle;
import org.hl7.fhir.r4.model.CapabilityStatement;
@@ -94,6 +93,35 @@ private static Class> getFhirClass(ResourceType type)
private final PreferReturnMinimalWithRetry preferReturnMinimal;
private final PreferReturnOutcomeWithRetry preferReturnOutcome;
+ /**
+ * @param baseUrl
+ * not null
+ * @param trustStore
+ * may be null
+ * @param keyStore
+ * may be null
+ * @param keyStorePassword
+ * may be null
+ * @param objectMapper
+ * may be null
+ * @param proxySchemeHostPort
+ * may be null
+ * @param proxyUserName
+ * may be null
+ * @param proxyPassword
+ * may be null
+ * @param connectTimeout
+ * not null, not negative, 0 represents infinity
+ * @param readTimeout
+ * not null, not negative, 0 represents infinity
+ * @param logRequests
+ * @param userAgentValue
+ * may be null
+ * @param fhirContext
+ * not null
+ * @param referenceCleaner
+ * not null
+ */
public FhirWebserviceClientJersey(String baseUrl, KeyStore trustStore, KeyStore keyStore, char[] keyStorePassword,
ObjectMapper objectMapper, String proxySchemeHostPort, String proxyUserName, char[] proxyPassword,
Duration connectTimeout, Duration readTimeout, boolean logRequests, String userAgentValue,
@@ -917,7 +945,7 @@ public Bundle history(Class extends Resource> resourceType, String id, int pag
if (resourceType != null)
target = target.path(resourceType.getAnnotation(ResourceDef.class).name());
- if (!StringUtils.isBlank(id))
+ if (id != null && !id.isBlank())
target = target.path(id);
if (page != Integer.MIN_VALUE)
diff --git a/dsf-fhir/dsf-fhir-websocket-client/pom.xml b/dsf-fhir/dsf-fhir-websocket-client/pom.xml
index d772246e9..aec4339f6 100755
--- a/dsf-fhir/dsf-fhir-websocket-client/pom.xml
+++ b/dsf-fhir/dsf-fhir-websocket-client/pom.xml
@@ -38,19 +38,9 @@
hapi-fhir-structures-r4
${hapi.fhir.version}
-
-
- org.glassfish.jersey.core
- jersey-common
- ${jersey.version}
-
-
- org.glassfish.tyrus
- tyrus-client
-
- org.glassfish.tyrus
- tyrus-container-grizzly-client
+ org.eclipse.jetty.websocket
+ jetty-websocket-jetty-client
diff --git a/dsf-fhir/dsf-fhir-websocket-client/src/main/java/dev/dsf/fhir/client/ClientEndpoint.java b/dsf-fhir/dsf-fhir-websocket-client/src/main/java/dev/dsf/fhir/client/ClientEndpoint.java
deleted file mode 100755
index 263fedf92..000000000
--- a/dsf-fhir/dsf-fhir-websocket-client/src/main/java/dev/dsf/fhir/client/ClientEndpoint.java
+++ /dev/null
@@ -1,133 +0,0 @@
-/*
- * Copyright 2018-2025 Heilbronn University of Applied Sciences
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package dev.dsf.fhir.client;
-
-import java.util.EnumSet;
-import java.util.function.Consumer;
-import java.util.function.Supplier;
-
-import org.hl7.fhir.r4.model.Resource;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import ca.uhn.fhir.parser.IParser;
-import jakarta.websocket.CloseReason;
-import jakarta.websocket.Endpoint;
-import jakarta.websocket.EndpointConfig;
-import jakarta.websocket.MessageHandler;
-import jakarta.websocket.Session;
-
-public class ClientEndpoint extends Endpoint
-{
- private static final Logger logger = LoggerFactory.getLogger(ClientEndpoint.class);
-
- private final Runnable reconnector;
- private final String subscriptionIdPart;
-
- public ClientEndpoint(Runnable reconnector, String subscriptionIdPart)
- {
- this.reconnector = reconnector;
- this.subscriptionIdPart = subscriptionIdPart;
- }
-
- private Supplier parserFactory;
- private Consumer domainResourceHandler;
- private Consumer pingHandler;
-
- @Override
- public void onOpen(Session session, EndpointConfig config)
- {
- logger.info("Websocket open, session {}", session.getId());
-
- session.addMessageHandler(new MessageHandler.Whole() // don't use lambda
- {
- private boolean boundReceived;
-
- @Override
- public void onMessage(String message)
- {
- logger.debug("Websocket message received, session {}: {}", session.getId(), message);
-
- if (("bound " + subscriptionIdPart).equals(message))
- {
- logger.debug("Bound received");
- boundReceived = true;
- return;
- }
-
- if (boundReceived)
- {
- try
- {
- if (pingHandler != null && ("ping " + subscriptionIdPart).equals(message))
- pingHandler.accept(message);
- else if (domainResourceHandler != null && parserFactory != null)
- domainResourceHandler.accept((Resource) parserFactory.get().parseResource(message));
- }
- catch (Throwable e)
- {
- logger.debug("Error while handling message, session {}", session.getId(), e);
- logger.error("Error while handling message, session {}: {} - {}", session.getId(),
- e.getClass().getName(), e.getMessage());
- }
- }
- }
- });
-
- session.getAsyncRemote().sendText("bind " + subscriptionIdPart);
- }
-
- @Override
- public void onClose(Session session, CloseReason closeReason)
- {
- logger.warn("Websocket closed, session {}: {} - {}", session.getId(), closeReason.getCloseCode().getCode(),
- closeReason.getReasonPhrase());
-
- if (EnumSet.of(CloseReason.CloseCodes.CANNOT_ACCEPT, CloseReason.CloseCodes.CLOSED_ABNORMALLY)
- .contains(closeReason.getCloseCode()))
- {
- logger.info("Trying to reconnect websocket");
- reconnector.run();
- }
- }
-
- @Override
- public void onError(Session session, Throwable throwable)
- {
- if (throwable == null)
- logger.info("Websocket closed with error, session {}: unknown error", session.getId());
- else
- {
- logger.debug("Websocket closed with error, session {}", session.getId(), throwable);
- logger.warn("Websocket closed with error, session {}: {} - {}", session.getId(),
- throwable.getClass().getName(), throwable.getMessage());
- }
- }
-
- public void setResourceHandler(Consumer handler, Supplier