Added device transaction log cli
[ovsdb.git] / hwvtepsouthbound / hwvtepsouthbound-impl / src / main / java / org / opendaylight / ovsdb / hwvtepsouthbound / transactions / md / AbstractTransactionCommand.java
1 /*
2  * Copyright (c) 2015 Ericsson India Global Services Pvt Ltd. and others.  All rights reserved.
3  *
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
7  */
8
9 package org.opendaylight.ovsdb.hwvtepsouthbound.transactions.md;
10
11 import org.opendaylight.controller.md.sal.binding.api.DataBroker;
12 import org.opendaylight.ovsdb.hwvtepsouthbound.HwvtepConnectionInstance;
13 import org.opendaylight.ovsdb.hwvtepsouthbound.HwvtepDeviceInfo;
14 import org.opendaylight.ovsdb.lib.message.TableUpdates;
15 import org.opendaylight.ovsdb.lib.schema.DatabaseSchema;
16 import org.opendaylight.ovsdb.utils.mdsal.utils.TransactionType;
17 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.global.attributes.ConnectionInfo;
18 import org.opendaylight.yangtools.yang.binding.DataObject;
19
20 public abstract class AbstractTransactionCommand<T extends DataObject> implements TransactionCommand {
21
22     private TableUpdates updates;
23     private DatabaseSchema dbSchema;
24     private HwvtepConnectionInstance key;
25
26     public TableUpdates getUpdates() {
27         return updates;
28     }
29
30     public DatabaseSchema getDbSchema() {
31         return dbSchema;
32     }
33
34     public ConnectionInfo getConnectionInfo() {
35         return key.getMDConnectionInfo();
36     }
37
38     public HwvtepConnectionInstance getOvsdbConnectionInstance() {
39         return key;
40     }
41
42     public AbstractTransactionCommand(HwvtepConnectionInstance key,TableUpdates updates, DatabaseSchema dbSchema) {
43         this.updates = updates;
44         this.dbSchema = dbSchema;
45         this.key = key;
46     }
47
48     public HwvtepDeviceInfo getDeviceInfo() {
49         return key.getDeviceInfo();
50     }
51
52     void addToDeviceUpdate(TransactionType transactionType, Object element) {
53         key.getDeviceInfo().addToDeviceUpdate(transactionType, element);
54     }
55 }