+ /**
+ * Helper class for result of transaction commit callback.
+ * @param <T> Type of result
+ */
+ private final class ReadDataResult<T> {
+ T result = null;
+
+ T getResult() {
+ return this.result;
+ }
+
+ void setResult(final T result) {
+ this.result = result;
+ }
+ }
+
+ /**
+ * Set result from transaction commit callback.
+ * @param t Throwable if transaction commit failed
+ * @param datastore Datastore from which data are read
+ * @param path Path from which data are read
+ * @param result Result of read from {@code datastore}
+ * @param readData Result value which will be set
+ * @param <X> Result type
+ */
+ protected final static <X> void handlingCallback(final Throwable t, final LogicalDatastoreType datastore,
+ final YangInstanceIdentifier path, final Optional<X> result,
+ final ReadDataResult<X> readData) {
+ if (t != null) {
+ LOG.warn("Exception by reading {} via Restconf: {}", datastore.name(), path, t);
+ throw new RestconfDocumentedException("Problem to get data from transaction.", t);
+ } else {
+ LOG.debug("Reading result data from transaction.");
+ if (result != null) {
+ if (result.isPresent()) {
+ readData.setResult(result.get());
+ }
+ }
+ }
+ }
+
+ public void registerToListenNotification(final NotificationListenerAdapter listener) {
+ checkPreconditions();
+
+ if (listener.isListening()) {
+ return;
+ }
+
+ final SchemaPath path = listener.getSchemaPath();
+ final ListenerRegistration<DOMNotificationListener> registration = this.domNotification
+ .registerNotificationListener(listener, path);
+
+ listener.setRegistration(registration);
+ }
+
+ private final class PATCHStatusContextHelper {
+ PATCHStatusContext status;
+
+ public PATCHStatusContext getStatus() {
+ return this.status;
+ }
+
+ public void setStatus(final PATCHStatusContext status) {
+ this.status = status;
+ }
+ }
+
+ private void ensureParentsByMerge(final LogicalDatastoreType store, final YangInstanceIdentifier normalizedPath,
+ final DOMDataReadWriteTransaction rwTx, final SchemaContext schemaContext) {