Merge "Initial write for bridge."
[ovsdb.git] / southbound / southbound-impl / src / main / java / org / opendaylight / ovsdb / southbound / ovsdb / transact / TransactCommandAggregator.java
1 /*
2  * Copyright (c) 2014 Cisco Systems, Inc. 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 package org.opendaylight.ovsdb.southbound.ovsdb.transact;
9
10 import java.util.ArrayList;
11 import java.util.List;
12
13 import org.opendaylight.controller.md.sal.common.api.data.AsyncDataChangeEvent;
14 import org.opendaylight.ovsdb.lib.operations.TransactionBuilder;
15 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.OvsdbBridgeAugmentation;
16 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
17
18 public class TransactCommandAggregator implements TransactCommand {
19
20     private List<TransactCommand> commands = new ArrayList<TransactCommand>();
21     private AsyncDataChangeEvent<InstanceIdentifier<?>, OvsdbBridgeAugmentation> changes;
22
23     public TransactCommandAggregator(AsyncDataChangeEvent<InstanceIdentifier<?>, OvsdbBridgeAugmentation> changes) {
24         this.changes=changes;
25         commands.add(new BridgeCreateCommand(changes));
26     }
27
28     @Override
29     public void execute(TransactionBuilder transaction) {
30         for(TransactCommand command:commands) {
31             command.execute(transaction);
32         }
33     }
34 }