public void probeAndSet() {
ProbeTC instance = this;
Device device = new Device(instance.getCallingAET());
Connection conn = new Connection();
device.addConnection(conn);
ApplicationEntity ae = new ApplicationEntity(instance.getCallingAET());
device.addApplicationEntity(ae);
ae.addConnection(conn);
conn.setReceivePDULength(Connection.DEF_MAX_PDU_LENGTH);
conn.setSendPDULength(Connection.DEF_MAX_PDU_LENGTH);
conn.setMaxOpsInvoked(0);
conn.setMaxOpsPerformed(0);
conn.setPackPDV(true);
conn.setConnectTimeout(0);
conn.setRequestTimeout(0);
conn.setAcceptTimeout(0);
conn.setReleaseTimeout(0);
conn.setResponseTimeout(0);
conn.setRetrieveTimeout(0);
conn.setIdleTimeout(0);
conn.setSocketCloseDelay(Connection.DEF_SOCKETDELAY);
conn.setSendBufferSize(0);
conn.setReceiveBufferSize(0);
conn.setTcpNoDelay(true);
// no tls in this implementation (for tls use command line tool)
if (instance.getConfigType().compareToIgnoreCase("ldap") == 0) {
InputStream is = null;
try {
is = new FileInputStream(instance.getLdapConfigurationFile());
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
Properties p = new Properties();
try {
p.load(is);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
try {
LdapDicomConfiguration conf = new LdapDicomConfiguration(p);
LOG.info("Started Loading LDAP configuration");
ApplicationEntity sourceAE = conf
.findApplicationEntity(instance.sourceAET);
ArrayList<TransferCapability> tcs = (ArrayList<TransferCapability>) sourceAE
.getTransferCapabilities();
ArrayList<PresentationContext> pcs = addChunkedPCsandSend(ae,
device, instance, tcs);
// print accepted ones
ArrayList<PresentationContext> acceptedPCs = new ArrayList<PresentationContext>();
for (PresentationContext pc : pcs)
if (pc.isAccepted())
acceptedPCs.add(pc);
ApplicationEntity destinationAE = conf
.findApplicationEntity(instance.destinationAET);
Device toStore = destinationAE.getDevice();
TransferCapability[] TCs = mergeTCs(acceptedPCs);
for (TransferCapability tc : TCs)
toStore.getApplicationEntity(instance.destinationAET)
.addTransferCapability(tc);
conf.merge(toStore);
conf.close();
return;
} catch (ConfigurationException e) {
LOG.error("Configuration backend error - {}", e);
}
} else {
try {
PreferencesDicomConfiguration conf = new PreferencesDicomConfiguration();
LOG.info("Started Loading LDAP configuration");
ApplicationEntity sourceAE = conf
.findApplicationEntity(instance.sourceAET);
ArrayList<TransferCapability> tcs = (ArrayList<TransferCapability>) sourceAE
.getTransferCapabilities();
ArrayList<PresentationContext> pcs = addChunkedPCsandSend(ae,
device, instance, tcs);
// print accepted ones
ArrayList<PresentationContext> acceptedPCs = new ArrayList<PresentationContext>();
for (PresentationContext pc : pcs)
if (pc.isAccepted())
acceptedPCs.add(pc);
ApplicationEntity destinationAE = conf
.findApplicationEntity(instance.destinationAET);
Device toStore = destinationAE.getDevice();
TransferCapability[] TCs = mergeTCs(acceptedPCs);
for (TransferCapability tc : TCs)
toStore.getApplicationEntity(instance.destinationAET)
.addTransferCapability(tc);