2 * Copyright (c) 2015 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.topology.example;
11 import java.util.ArrayList;
12 import java.util.Arrays;
13 import javax.annotation.Nonnull;
14 import org.opendaylight.netconf.topology.util.NodeWriter;
15 import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId;
16 import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node;
17 import org.slf4j.Logger;
18 import org.slf4j.LoggerFactory;
20 public class LoggingSalNodeWriter implements NodeWriter{
22 private static final Logger LOG = LoggerFactory.getLogger(LoggingSalNodeWriter.class);
24 private final ArrayList<NodeWriter> delegates;
26 public LoggingSalNodeWriter(final NodeWriter... delegates) {
27 this.delegates = new ArrayList<>(Arrays.asList(delegates));
31 public void init(@Nonnull NodeId id, @Nonnull Node operationalDataNode) {
32 LOG.warn("Init recieved");
33 LOG.warn("NodeId: {}", id.getValue());
34 LOG.warn("Node: {}", operationalDataNode);
35 for (final NodeWriter delegate : delegates) {
36 delegate.init(id, operationalDataNode);
41 public void update(@Nonnull NodeId id, @Nonnull Node operationalDataNode) {
42 LOG.warn("Update recieved");
43 LOG.warn("NodeId: {}", id.getValue());
44 LOG.warn("Node: {}", operationalDataNode);
45 for (final NodeWriter delegate : delegates) {
46 delegate.update(id, operationalDataNode);
51 public void delete(@Nonnull NodeId id) {
52 LOG.warn("Delete recieved");
53 LOG.warn("NodeId: {}", id.getValue());
54 for (final NodeWriter delegate : delegates) {