Switch to command pattern and using transaction chains
[ovsdb.git] / southbound / southbound-impl / src / main / java / org / opendaylight / ovsdb / southbound / transactions / md / OvsdbOperationalCommandAggregator.java
1 package org.opendaylight.ovsdb.southbound.transactions.md;
2
3 import java.util.ArrayList;
4 import java.util.List;
5
6 import org.opendaylight.controller.md.sal.binding.api.ReadWriteTransaction;
7 import org.opendaylight.ovsdb.lib.message.TableUpdates;
8 import org.opendaylight.ovsdb.lib.schema.DatabaseSchema;
9 import org.opendaylight.ovsdb.southbound.OvsdbClientKey;
10
11 public class OvsdbOperationalCommandAggregator implements TransactionCommand {
12
13
14     private List<TransactionCommand> commands = new ArrayList<TransactionCommand>();
15
16     public OvsdbOperationalCommandAggregator(OvsdbClientKey key,TableUpdates updates, DatabaseSchema dbSchema) {
17         commands.add(new OvsdbBridgeUpdateCommand(key, updates,  dbSchema));
18     }
19
20     @Override
21     public void execute(ReadWriteTransaction transaction) {
22         for(TransactionCommand command: commands) {
23             command.execute(transaction);
24         }
25     }
26 }