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.openflowplugin.applications.old.notification.supplier.impl;
11 import com.google.common.base.Preconditions;
12 import org.opendaylight.controller.md.sal.binding.api.DataBroker;
13 import org.opendaylight.controller.sal.binding.api.NotificationProviderService;
14 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNodeConnector;
15 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNodeConnectorUpdated;
16 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNodeConnectorUpdatedBuilder;
17 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorRef;
18 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorRemoved;
19 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorRemovedBuilder;
20 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorUpdated;
21 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorUpdatedBuilder;
22 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnector;
23 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnectorKey;
24 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
27 * Implementation define a contract between {@link FlowCapableNodeConnector} data object
28 * and {@link NodeConnectorUpdated} and {@link NodeConnectorRemoved} notifications.
30 public class NodeConnectorNotificationSupplierImpl extends
31 AbstractNofitSupplierFoItemRoot<FlowCapableNodeConnector, NodeConnectorUpdated, NodeConnectorRemoved> {
33 private static final InstanceIdentifier<FlowCapableNodeConnector> wildCardedInstanceIdent = getNodeWildII().child(NodeConnector.class).augmentation(FlowCapableNodeConnector.class);
36 * Constructor register supplier as DataChangeLister and create wildCarded InstanceIdentifier.
38 * @param notifProviderService - {@link NotificationProviderService}
39 * @param db - {@link DataBroker}
41 public NodeConnectorNotificationSupplierImpl(final NotificationProviderService notifProviderService, final DataBroker db) {
42 super(notifProviderService, db, FlowCapableNodeConnector.class);
46 public InstanceIdentifier<FlowCapableNodeConnector> getWildCardPath() {
47 return wildCardedInstanceIdent;
51 public NodeConnectorUpdated createNotification(final FlowCapableNodeConnector o,
52 final InstanceIdentifier<FlowCapableNodeConnector> path) {
53 Preconditions.checkArgument(o != null);
54 Preconditions.checkArgument(path != null);
55 final NodeConnectorUpdatedBuilder notifBuilder = new NodeConnectorUpdatedBuilder();
56 final FlowCapableNodeConnectorUpdatedBuilder connNotifBuilder = new FlowCapableNodeConnectorUpdatedBuilder(o);
57 notifBuilder.setId(path.firstKeyOf(NodeConnector.class, NodeConnectorKey.class).getId());
58 notifBuilder.setNodeConnectorRef(new NodeConnectorRef(path));
59 notifBuilder.addAugmentation(FlowCapableNodeConnectorUpdated.class, connNotifBuilder.build());
60 return notifBuilder.build();
64 public NodeConnectorRemoved deleteNotification(final InstanceIdentifier<FlowCapableNodeConnector> path) {
65 Preconditions.checkArgument(path != null);
66 final NodeConnectorRemovedBuilder notifBuilder = new NodeConnectorRemovedBuilder();
67 notifBuilder.setNodeConnectorRef(new NodeConnectorRef(path));
68 return notifBuilder.build();