blob: d120cab8170606cdb4b28169eabae55f07d6b149 [file] [log] [blame]
lishuai2ddc4692015-07-31 15:15:16 +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.rfc.tableservice;
17
18import static com.google.common.base.Preconditions.checkNotNull;
19
20import org.onosproject.ovsdb.rfc.table.OvsdbTable;
21import org.onosproject.ovsdb.rfc.table.VersionNum;
22import org.onosproject.ovsdb.rfc.utils.VersionUtil;
23
24/**
25 * Table description.
26 */
27public class TableDescription {
28
29 // The table name
30 private final String name;
31 // The database name
32 private final String database = "Open_vSwitch";
33 // The initial version
34 private final String fromVersion;
35 // The end of the version
36 private final String untilVersion;
37
38 /**
39 * Constructs a MonitorRequest object.
40 * @param table OvsdbTable entity
41 */
42 public TableDescription(OvsdbTable table) {
43 checkNotNull(table, "table cannot be null");
44 this.name = table.tableName();
45 this.fromVersion = VersionUtil.DEFAULT_VERSION_STRING;
46 this.untilVersion = VersionUtil.DEFAULT_VERSION_STRING;
47 }
48
49 /**
50 * Constructs a MonitorRequest object.
51 * @param table OvsdbTable entity
52 * @param fromVersion the initial version
53 */
54 public TableDescription(OvsdbTable table, VersionNum fromVersion) {
55 checkNotNull(table, "table cannot be null");
56 checkNotNull(fromVersion, "the initial version cannot be null");
57 this.name = table.tableName();
58 this.fromVersion = fromVersion.versionNum();
59 this.untilVersion = VersionUtil.DEFAULT_VERSION_STRING;
60 }
61
62 /**
63 * Constructs a MonitorRequest object.
64 * @param table OvsdbTable entity
65 * @param fromVersion the initial version
66 * @param untilVersion the end of the version
67 */
68 public TableDescription(OvsdbTable table, VersionNum fromVersion, VersionNum untilVersion) {
69 checkNotNull(table, "table cannot be null");
70 checkNotNull(fromVersion, "the initial version cannot be null");
71 checkNotNull(untilVersion, "the end of the version cannot be null");
72 this.name = table.tableName();
73 this.fromVersion = fromVersion.versionNum();
74 this.untilVersion = untilVersion.versionNum();
75 }
76
77 /**
78 * Returns the column name.
79 * @return the column name
80 */
81 public String name() {
82 return name;
83 }
84
85 /**
86 * Returns the database name.
87 * @return the database name
88 */
89 public String database() {
90 return database;
91 }
92
93 /**
94 * Returns the initial version.
95 * @return the initial version
96 */
97 public String fromVersion() {
98 return fromVersion;
99 }
100
101 /**
102 * Returns the end of the version.
103 * @return the end of the version
104 */
105 public String untilVersion() {
106 return untilVersion;
107 }
108}