blob: 72b64f32bf3bc7c933c0420cc37ddb99dbf2ae05 [file] [log] [blame]
YuanyouZhangd06bb6b2015-08-05 16:59:07 +08001/*
2 * Copyright 2015 Open Networking Laboratory
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16package org.onosproject.ovsdb.controller;
17
18import java.util.concurrent.ConcurrentMap;
19
20import com.google.common.collect.Maps;
21
22/**
23 * The class representing a database data.
24 */
25public class OvsdbTableStore {
26
27 private final ConcurrentMap<String, OvsdbRowStore> tableStore = Maps.newConcurrentMap();
28
29 /**
30 * Gets the ovsdbRowStore.
31 *
BitOhenryea1a8e32015-11-02 19:55:21 +080032 * @param tableName an ovsdb table name
33 * @return OvsdbRowStore the data of table
YuanyouZhangd06bb6b2015-08-05 16:59:07 +080034 */
35 public OvsdbRowStore getRows(String tableName) {
36 return tableStore.get(tableName);
37 }
38
39 /**
BitOhenryea1a8e32015-11-02 19:55:21 +080040 * Creates or updates a value to tableStore.
YuanyouZhangd06bb6b2015-08-05 16:59:07 +080041 *
BitOhenryea1a8e32015-11-02 19:55:21 +080042 * @param tableName key of tableName
43 * @param rowStore a row of table
YuanyouZhangd06bb6b2015-08-05 16:59:07 +080044 */
45 public void createOrUpdateTable(String tableName, OvsdbRowStore rowStore) {
46 tableStore.put(tableName, rowStore);
47 }
48
49 /**
50 * Drops a value to table data.
51 *
BitOhenryea1a8e32015-11-02 19:55:21 +080052 * @param tableName key of tableName
YuanyouZhangd06bb6b2015-08-05 16:59:07 +080053 */
54 public void dropTable(String tableName) {
55 tableStore.remove(tableName);
56 }
57
58 /**
BitOhenryea1a8e32015-11-02 19:55:21 +080059 * Gets tableStore.
YuanyouZhangd06bb6b2015-08-05 16:59:07 +080060 *
61 * @return tableStore
62 */
63 public ConcurrentMap<String, OvsdbRowStore> getTableStore() {
64 return tableStore;
65 }
66
67}