Skip to content

Commit

Permalink
Merge branch 'release/0.3.3' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
hhund committed Jul 6, 2021
2 parents c932d56 + 53ae467 commit 379785a
Show file tree
Hide file tree
Showing 29 changed files with 968 additions and 140 deletions.
2 changes: 1 addition & 1 deletion codex-process-data-transfer/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<parent>
<groupId>de.netzwerk-universitaetsmedizin.codex</groupId>
<artifactId>codex-processes-ap1</artifactId>
<version>0.3.2</version>
<version>0.3.3</version>
</parent>

<properties>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

public class DataTransferProcessPluginDefinition implements ProcessPluginDefinition
{
public static final String VERSION = "0.3.2";
public static final String VERSION = "0.3.3";

@Override
public String getName()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,18 +89,29 @@ public void testConnection()
private final String fttpStudy;
private final String fttpTarget;

private final int connectTimeout;
private final int socketTimeout;
private final int connectionRequestTimeout;

private final String proxySchemeHostPort;
private final String proxyUsername;
private final String proxyPassword;

public FttpClientFactory(Path trustStorePath, Path certificatePath, Path privateKeyPath,
String fttpBasicAuthUsername, String fttpBasicAuthPassword, String fttpServerBase, String fttpApiKey,
String fttpStudy, String fttpTarget, String proxySchemeHostPort, String proxyUsername, String proxyPassword)
private final boolean hapiClientVerbose;

public FttpClientFactory(Path trustStorePath, Path certificatePath, Path privateKeyPath, int connectTimeout,
int socketTimeout, int connectionRequestTimeout, String fttpBasicAuthUsername, String fttpBasicAuthPassword,
String fttpServerBase, String fttpApiKey, String fttpStudy, String fttpTarget, String proxySchemeHostPort,
String proxyUsername, String proxyPassword, boolean hapiClientVerbose)
{
this.trustStorePath = trustStorePath;
this.certificatePath = certificatePath;
this.privateKeyPath = privateKeyPath;

this.connectTimeout = connectTimeout;
this.socketTimeout = socketTimeout;
this.connectionRequestTimeout = connectionRequestTimeout;

this.fttpBasicAuthUsername = fttpBasicAuthUsername;
this.fttpBasicAuthPassword = fttpBasicAuthPassword;

Expand All @@ -112,6 +123,8 @@ public FttpClientFactory(Path trustStorePath, Path certificatePath, Path private
this.proxySchemeHostPort = proxySchemeHostPort;
this.proxyUsername = proxyUsername;
this.proxyPassword = proxyPassword;

this.hapiClientVerbose = hapiClientVerbose;
}

@EventListener({ ContextRefreshedEvent.class })
Expand Down Expand Up @@ -155,8 +168,9 @@ protected FttpClient createFttpClient()
logger.debug("Creating key-store from {} and {}", certificatePath.toString(), privateKeyPath.toString());
KeyStore keyStore = readKeyStore(certificatePath, privateKeyPath, keyStorePassword);

return new FttpClientImpl(trustStore, keyStore, keyStorePassword, fttpBasicAuthUsername, fttpBasicAuthPassword,
fttpServerBase, fttpApiKey, fttpStudy, fttpTarget, proxySchemeHostPort, proxyUsername, proxyPassword);
return new FttpClientImpl(trustStore, keyStore, keyStorePassword, connectTimeout, socketTimeout,
connectionRequestTimeout, fttpBasicAuthUsername, fttpBasicAuthPassword, fttpServerBase, fttpApiKey,
fttpStudy, fttpTarget, proxySchemeHostPort, proxyUsername, proxyPassword, hapiClientVerbose);
}

private KeyStore readTrustStore(Path trustPath)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,15 @@ public class FttpClientImpl implements FttpClient, InitializingBean
private final String proxyUsername;
private final String proxyPassword;

public FttpClientImpl(KeyStore trustStore, KeyStore keyStore, char[] keyStorePassword, String fttpBasicAuthUsername,
String fttpBasicAuthPassword, String fttpServerBase, String fttpApiKey, String fttpStudy, String fttpTarget,
String proxySchemeHostPort, String proxyUsername, String proxyPassword)
{
this.proxySchemeHostPort = proxySchemeHostPort;
this.proxyUsername = proxyUsername;
this.proxyPassword = proxyPassword;
private final boolean hapiClientVerbose;

clientFactory = createClientFactory(trustStore, keyStore, keyStorePassword);
public FttpClientImpl(KeyStore trustStore, KeyStore keyStore, char[] keyStorePassword, int connectTimeout,
int socketTimeout, int connectionRequestTimeout, String fttpBasicAuthUsername, String fttpBasicAuthPassword,
String fttpServerBase, String fttpApiKey, String fttpStudy, String fttpTarget, String proxySchemeHostPort,
String proxyUsername, String proxyPassword, boolean hapiClientVerbose)
{
clientFactory = createClientFactory(trustStore, keyStore, keyStorePassword, connectTimeout, socketTimeout,
connectionRequestTimeout);

this.fttpServerBase = fttpServerBase;
this.fttpBasicAuthUsername = fttpBasicAuthUsername;
Expand All @@ -66,10 +66,16 @@ public FttpClientImpl(KeyStore trustStore, KeyStore keyStore, char[] keyStorePas
this.fttpApiKey = fttpApiKey;
this.fttpStudy = fttpStudy;
this.fttpTarget = fttpTarget;

this.proxySchemeHostPort = proxySchemeHostPort;
this.proxyUsername = proxyUsername;
this.proxyPassword = proxyPassword;

this.hapiClientVerbose = hapiClientVerbose;
}

protected ApacheRestfulClientFactoryWithTlsConfig createClientFactory(KeyStore trustStore, KeyStore keyStore,
char[] keyStorePassword)
char[] keyStorePassword, int connectTimeout, int socketTimeout, int connectionRequestTimeout)
{
Objects.requireNonNull(trustStore, "trustStore");
Objects.requireNonNull(keyStore, "keyStore");
Expand All @@ -81,6 +87,10 @@ protected ApacheRestfulClientFactoryWithTlsConfig createClientFactory(KeyStore t
hapiClientFactory.setServerValidationMode(ServerValidationModeEnum.NEVER);
configureProxy(hapiClientFactory);

hapiClientFactory.setConnectTimeout(connectTimeout);
hapiClientFactory.setSocketTimeout(socketTimeout);
hapiClientFactory.setConnectionRequestTimeout(connectionRequestTimeout);

fhirContext.setRestfulClientFactory(hapiClientFactory);
return hapiClientFactory;
}
Expand Down Expand Up @@ -228,16 +238,26 @@ public void testConnection()
private IGenericClient createGenericClient()
{
IGenericClient client = clientFactory.newGenericClient(fttpServerBase);
client.registerInterceptor(new LoggingInterceptor());

if (configuredWithBasicAuth())
client.registerInterceptor(new BasicAuthInterceptor(fttpBasicAuthUsername, fttpBasicAuthPassword));
configuredWithBasicAuth(client);
configureLoggingInterceptor(client);

return client;
}

private boolean configuredWithBasicAuth()
private void configuredWithBasicAuth(IGenericClient client)
{
return fttpBasicAuthUsername != null && fttpBasicAuthPassword != null;
if (fttpBasicAuthUsername != null && fttpBasicAuthPassword != null)
client.registerInterceptor(new BasicAuthInterceptor(fttpBasicAuthUsername, fttpBasicAuthPassword));
}

private void configureLoggingInterceptor(IGenericClient client)
{
if (hapiClientVerbose)
{
LoggingInterceptor loggingInterceptor = new LoggingInterceptor(true);
loggingInterceptor.setLogger(new HapiClientLogger(logger));
client.registerInterceptor(loggingInterceptor);
}
}
}
Loading

0 comments on commit 379785a

Please sign in to comment.