2 * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
9 package org.opendaylight.netconf.test.tool.rpc;
11 import com.google.common.base.Optional;
12 import org.opendaylight.netconf.api.xml.XmlElement;
13 import org.opendaylight.netconf.api.xml.XmlNetconfConstants;
14 import org.opendaylight.netconf.api.xml.XmlUtil;
15 import org.opendaylight.netconf.util.mapping.AbstractLastNetconfOperation;
16 import org.w3c.dom.Document;
17 import org.w3c.dom.Element;
19 public class SimulatedGet extends AbstractLastNetconfOperation {
21 private final DataList storage;
23 public SimulatedGet(final String netconfSessionIdForReporting, final DataList storage) {
24 super(netconfSessionIdForReporting);
25 this.storage = storage;
29 protected Element handleWithNoSubsequentOperations(final Document document, final XmlElement operationElement) {
30 final Element element = XmlUtil.createElement(document, XmlNetconfConstants.DATA_KEY, Optional.absent());
32 for (final XmlElement e : storage.getConfigList()) {
33 final Element domElement = e.getDomElement();
34 element.appendChild(element.getOwnerDocument().importNode(domElement, true));
41 protected String getOperationName() {
42 return XmlNetconfConstants.GET;