private TreeMap<HandlingPriority, NetconfOperation> getSortedNetconfOperationsWithCanHandle( Document message, NetconfSession session) { TreeMap<HandlingPriority, NetconfOperation> sortedPriority = Maps.newTreeMap(); for (NetconfOperation netconfOperation : allNetconfOperations) { final HandlingPriority handlingPriority = netconfOperation.canHandle(message); if (netconfOperation instanceof DefaultNetconfOperation) { ((DefaultNetconfOperation) netconfOperation).setNetconfSession(session); } if (handlingPriority.equals(HandlingPriority.CANNOT_HANDLE) == false) { Preconditions.checkState( sortedPriority.containsKey(handlingPriority) == false, "Multiple %s available to handle message %s with priority %s", NetconfOperation.class.getName(), message, handlingPriority); sortedPriority.put(handlingPriority, netconfOperation); } } return sortedPriority; }
@Override public Document execute(Document message) throws NetconfDocumentedException { return netconfOperation.handle(message, subsequentExecution); }