Skip to content

Commit

Permalink
IHE RAD-68: Provide and Register Imaging Document Set #566
Browse files Browse the repository at this point in the history
  • Loading branch information
gunterze committed Mar 9, 2017
1 parent 54af477 commit 2708eb3
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -993,6 +993,7 @@ dcmQueueName: Export3
dcmExporterID: XDS-I
dicomAETitle: DCM4CHEE
objectClass: dcmExporter
dcmProperty: TLS.disableCNCheck=true
dcmProperty: XDSSubmissionSet.contentType=(DICOM KON TYPECODE, 1.3.6.1.4.1.21367.100.1, "DICOM Key Object Note Type Code")
dcmProperty: DocumentEntry.languageCode=en-us
dcmProperty: DocumentEntry.typeCode=(DICOM KON TYPECODE, 1.3.6.1.4.1.21367.100.1, "DICOM Key Object Note Type Code")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1412,6 +1412,7 @@ private static void addArchiveDeviceExtension(Device device, Device unknown, Con
xdsiExportDescriptor.setAETitle("DCM4CHEE");
xdsiExportDescriptor.setRetrieveAETitles("DCM4CHEE");
xdsiExportDescriptor.setRetrieveLocationUID(XDSI_SOURCE_ID);
xdsiExportDescriptor.setProperty("TLS.disableCNCheck", "true");
xdsiExportDescriptor.setProperty("Manifest.title", XDSI_MANIFEST_TITLE.toString());
xdsiExportDescriptor.setProperty("AssigningAuthority.patientId", XDSI_ASSIGNING_AUTHORITY);
xdsiExportDescriptor.setProperty("AssigningAuthority.accessionNumber", XDSI_ASSIGNING_AUTHORITY);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ public class XDSiExporter extends AbstractExporter {
private final Device device;
private final Event<ExportContext> exportEvent;

private boolean disableCNCheck;
private final String sourceId;
private final String assigningAuthorityOfPatientID;
private final String assigningAuthorityOfAccessionNumber;
Expand Down Expand Up @@ -147,6 +148,7 @@ public XDSiExporter(ExporterDescriptor descriptor, DocumentRepositoryService ser
this.device = device;
this.exportEvent = exportEvent;
this.repositoryURL = descriptor.getExportURI().getSchemeSpecificPart();
this.disableCNCheck = Boolean.parseBoolean(descriptor.getProperty("TLS.disableCNCheck", null));
this.manifestTitle = getCodeProperty("Manifest.title", DEFAULT_MANIFEST_TITLE);
this.manifestSeriesNumber = Integer.parseInt(descriptor.getProperty("Manifest.seriesNumber", "0"));
this.manifestInstanceNumber = Integer.parseInt(descriptor.getProperty("Manifest.instanceNumber", "0"));
Expand Down Expand Up @@ -267,7 +269,9 @@ private DocumentRepositoryPortType port() throws Exception {
new AddressingFeature(true, true),
new MTOMFeature());
XDSUtils.ensureMustUnderstandHandler(port);
XDSUtils.setEndpointAddress(port, repositoryURL, device);
XDSUtils.setEndpointAddress(port, repositoryURL);
if (repositoryURL.startsWith("https"))
XDSUtils.setTlsClientParameters(port, device.sslContext().getSocketFactory(), disableCNCheck);
return port;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,9 @@

package org.dcm4chee.arc.xdsi;

import org.dcm4che3.data.DatePrecision;
import org.dcm4che3.util.DateUtils;

import java.util.*;
import java.util.Collection;
import java.util.Collections;
import java.util.Date;

/**
* @author Gunter Zeilinger <gunterze@gmail.com>
Expand Down Expand Up @@ -73,7 +72,7 @@ public SlotBuilder valueList(Collection<String> values) {
}

public SlotBuilder valueDTM(Date date) {
return valueList(DateUtils.formatDT(TimeZone.getTimeZone("UTC"), date, new DatePrecision(Calendar.SECOND)));
return valueList(XDSUtils.formatDTM(date));
}

public SlotBuilder slotType(String value) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,15 @@
import org.apache.cxf.endpoint.Client;
import org.apache.cxf.frontend.ClientProxy;
import org.apache.cxf.transport.http.HTTPConduit;
import org.dcm4che3.data.DatePrecision;
import org.dcm4che3.net.Device;
import org.dcm4che3.util.DateUtils;

import javax.net.ssl.SSLSocketFactory;
import javax.xml.ws.BindingProvider;
import java.io.IOException;
import java.security.GeneralSecurityException;
import java.util.Collections;
import java.util.Map;
import java.util.*;

/**
* @author Gunter Zeilinger <gunterze@gmail.com>
Expand All @@ -61,28 +63,31 @@ public static void ensureMustUnderstandHandler(Object port) {
bindingProvider.getBinding().setHandlerChain(Collections.singletonList(new EnsureMustUnderstandHandler()));
}

public static void setEndpointAddress(Object port, String url, Device device)
public static void setEndpointAddress(Object port, String url)
throws GeneralSecurityException, IOException {
BindingProvider bindingProvider = (BindingProvider) port;
bindingProvider.getBinding().setHandlerChain(Collections.singletonList(new EnsureMustUnderstandHandler()));
Map<String, Object> reqCtx = bindingProvider.getRequestContext();
reqCtx.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, url);
if (url.startsWith("https"))
setTlsClientParameters(port, device);
}

public static void setTlsClientParameters(Object port, Device device)
public static void setTlsClientParameters(Object port, SSLSocketFactory factory, boolean disableCNCheck)
throws GeneralSecurityException, IOException {
Client client = ClientProxy.getClient(port);
HTTPConduit conduit = (HTTPConduit) client.getConduit();
conduit.setTlsClientParameters(tlsClientParametersOf(device));
conduit.setTlsClientParameters(tlsClientParametersOf(factory, disableCNCheck));
}

private static TLSClientParameters tlsClientParametersOf(Device device)
private static TLSClientParameters tlsClientParametersOf(SSLSocketFactory factory, boolean disableCNCheck)
throws GeneralSecurityException, IOException {
TLSClientParameters params = new TLSClientParameters();
params.setSSLSocketFactory(device.sslContext().getSocketFactory());
params.setSSLSocketFactory(factory);
params.setDisableCNCheck(disableCNCheck);
return params;
}

public static String formatDTM(Date date) {
return DateUtils.formatDT(TimeZone.getTimeZone("UTC"), date, new DatePrecision(Calendar.SECOND));
}

}

0 comments on commit 2708eb3

Please sign in to comment.