use of org.weasis.dicom.param.AdvancedParams in project karnak by OsiriX-Foundation.
the class GatewaySetUpService method getDefaultAdvancedParameters.
private static AdvancedParams getDefaultAdvancedParameters() {
AdvancedParams params = new AdvancedParams();
ConnectOptions connectOptions = new ConnectOptions();
connectOptions.setConnectTimeout(5000);
connectOptions.setAcceptTimeout(7000);
// Concurrent DICOM operations
connectOptions.setMaxOpsInvoked(50);
connectOptions.setMaxOpsPerformed(50);
params.setConnectOptions(connectOptions);
return params;
}
use of org.weasis.dicom.param.AdvancedParams in project karnak by OsiriX-Foundation.
the class Util method getEchoResponse.
public static boolean getEchoResponse(StringBuilder result, String callingAET, DicomNode calledNode, boolean fontIcon, String format, Integer connectTimeout) {
boolean success = false;
boolean xml = "XML".equalsIgnoreCase(format);
try {
AdvancedParams params = new AdvancedParams();
DicomState state;
if (connectTimeout != null) {
ConnectOptions connectOptions = new ConnectOptions();
connectOptions.setConnectTimeout(connectTimeout);
params.setConnectOptions(connectOptions);
state = Echo.process(params, new DicomNode(callingAET), calledNode);
} else {
state = Echo.process(callingAET, calledNode);
}
success = state.getStatus() == Status.Success;
if (xml) {
result.append("<DcmStatus>");
if (success) {
result.append("Success").append("</DcmStatus>");
result.append("<DcmStatusMessage>").append(state.getMessage()).append("</DcmStatusMessage>");
} else {
result.append("Error ").append(Integer.toHexString(state.getStatus())).append("</DcmStatus>");
result.append("<DcmStatusMessage>").append(state.getMessage()).append("</DcmStatusMessage>");
}
} else {
// "HTML" and anything else
result.append(success ? "<span style=\"color:green\">" + getOKItem(fontIcon) : "<span style=\"color:red\">" + getWarningItem(fontIcon));
result.append("</span> DICOM Status: ");
if (success) {
result.append("Success");
} else {
result.append("error code ");
result.append(Integer.toHexString(state.getStatus()));
}
result.append("<br>DICOM Message: ");
result.append(state.getMessage());
result.append("<br>");
}
} catch (Throwable e) {
if (xml) {
result.append("<DcmStatus>DICOM unexpected error</DcmStatus>");
result.append("<DcmStatusMessage>").append(e.getMessage()).append("</DcmStatusMessage>");
} else {
// "HTML" and anything else
result.append("<span style=\"color:red\">");
result.append(getWarningItem(fontIcon));
result.append(" DICOM unexpected error: ");
result.append(e.getMessage());
result.append("</span><br>");
}
}
return success;
}
use of org.weasis.dicom.param.AdvancedParams in project karnak by OsiriX-Foundation.
the class GatewaySetUpService method getAdvancedParams.
public AdvancedParams getAdvancedParams() {
AdvancedParams options = getDefaultAdvancedParameters();
ConnectOptions connectOptions = options.getConnectOptions();
if (getListenerTLS()) {
TlsOptions tls = new TlsOptions(false, getClientKey(), "JKS", getClientKeyPwd(), getClientKeyPwd(), getTruststore(), "JKS", getTruststorePwd());
options.setTlsOptions(tls);
}
options.setConnectOptions(connectOptions);
return options;
}
use of org.weasis.dicom.param.AdvancedParams in project karnak by OsiriX-Foundation.
the class DicomGatewayService method start.
public synchronized void start(DicomNode scpNode, GatewayParams params) throws Exception {
if (isRunning()) {
throw new IOException("Cannot start a DICOM Gateway because it is already running.");
}
storeScpForwardService.setStatus(0);
storeScpForwardService.getCstoreSCP().setStatus(0);
AdvancedParams options = Objects.requireNonNull(params).getParams();
Connection conn = storeScpForwardService.getConnection();
if (params.isBindCallingAet()) {
options.configureBind(storeScpForwardService.getApplicationEntity(), conn, scpNode);
} else {
options.configureBind(conn, scpNode);
}
// configure
options.configure(conn);
options.configureTLS(conn, null);
// Limit the calling AETs
storeScpForwardService.getApplicationEntity().setAcceptedCallingAETitles(params.getAcceptedCallingAETitles());
URL transferCapabilityFile = params.getTransferCapabilityFile();
if (transferCapabilityFile != null) {
storeScpForwardService.loadDefaultTransferCapability(transferCapabilityFile);
} else {
storeScpForwardService.getApplicationEntity().addTransferCapability(new TransferCapability(null, "*", TransferCapability.Role.SCP, "*"));
}
deviceService.start();
}
use of org.weasis.dicom.param.AdvancedParams in project karnak by OsiriX-Foundation.
the class EchoService method buildEchoProcessParams.
/**
* Build params for echo process call
*
* @param connectTimeout Connect Timeout
* @param acceptTimeout Accept Timeout
* @return parameters built
*/
private AdvancedParams buildEchoProcessParams(int connectTimeout, int acceptTimeout) {
AdvancedParams params = new AdvancedParams();
ConnectOptions connectOptions = new ConnectOptions();
connectOptions.setConnectTimeout(connectTimeout);
connectOptions.setAcceptTimeout(acceptTimeout);
params.setConnectOptions(connectOptions);
return params;
}
Aggregations