LOG.error("Configuration backend error - {}", e);
}
} else if (cl.hasOption("prefs")) {
// prefs
try {
PreferencesDicomConfiguration conf = new PreferencesDicomConfiguration();
LOG.info("Started Loading LDAP configuration");
ArrayList<TransferCapability> tcs = null;
if(cl.hasOption("s")){
ApplicationEntity sourceAE = conf
.findApplicationEntity(instance.sourceAET);
tcs = (ArrayList<TransferCapability>) sourceAE
.getTransferCapabilities();
}
else
{
tcs = loadTCFile();
}
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);
LOG.info("Probed the source ae and found the following accepted presentation contexts");
for (PresentationContext pc : acceptedPCs) {
LOG.info("PC[" + pc.getPCID() + "]\tAbstractSyntax:"
+ pc.getAbstractSyntax() + "\n with "
+ " the following Transfer-Syntax:["
+ pc.getTransferSyntax() + "]");
}
LOG.info("finished probing TCs");
if(instance.destinationAET!=null){
LOG.info("Adding Accepted TCs to configuration backend");
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);
logAddedTCs(TCs, destinationAE);
conf.close();
}
System.exit(1);
} catch (ConfigurationException e) {
LOG.error("Configuration backend error - {}", e);
}