2 * Copyright (c) 2014 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
8 package org.opendaylight.ovsdb.southbound.ovsdb.transact;
10 import java.util.ArrayList;
11 import java.util.List;
13 import org.opendaylight.controller.md.sal.binding.api.DataBroker;
14 import org.opendaylight.controller.md.sal.common.api.data.AsyncDataChangeEvent;
15 import org.opendaylight.ovsdb.lib.operations.TransactionBuilder;
16 import org.opendaylight.yangtools.yang.binding.DataObject;
17 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
19 public class TransactCommandAggregator implements TransactCommand {
21 private List<TransactCommand> commands = new ArrayList<TransactCommand>();
22 private AsyncDataChangeEvent<InstanceIdentifier<?>, DataObject> changes;
23 private DataBroker db;
25 public TransactCommandAggregator(DataBroker db,AsyncDataChangeEvent<InstanceIdentifier<?>,
26 DataObject> changes) {
28 this.changes = changes;
29 commands.add(new BridgeCreateCommand(changes));
30 commands.add(new BridgeRemovedCommand(db,changes));
31 commands.add(new TerminationPointCreateCommand(changes));
32 commands.add(new TerminationPointDeleteCommand(db, changes));
33 commands.add(new OvsdbNodeUpdateCommand(changes));
37 public void execute(TransactionBuilder transaction) {
38 for (TransactCommand command:commands) {
39 command.execute(transaction);