Sho SHIMIZU
Committed by Gerrit Code Review

Use LF as line separator

Change-Id: I41ed7eeefe076ab3f8b09f26d1e091e6d3394846
Showing 21 changed files with 1268 additions and 1268 deletions
1 -/* 1 +/*
2 - * Copyright 2015 Open Networking Laboratory 2 + * Copyright 2015 Open Networking Laboratory
3 - * 3 + *
4 - * Licensed under the Apache License, Version 2.0 (the "License"); 4 + * Licensed under the Apache License, Version 2.0 (the "License");
5 - * you may not use this file except in compliance with 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 6 + * You may obtain a copy of the License at
7 - * 7 + *
8 - * http://www.apache.org/licenses/LICENSE-2.0 8 + * http://www.apache.org/licenses/LICENSE-2.0
9 - * 9 + *
10 - * Unless required by applicable law or agreed to in writing, software 10 + * Unless required by applicable law or agreed to in writing, software
11 - * distributed under the License is distributed on an "AS IS" BASIS, 11 + * distributed under the License is distributed on an "AS IS" BASIS,
12 - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 - * See the License for the specific language governing permissions and 13 + * See the License for the specific language governing permissions and
14 - * limitations under the License. 14 + * limitations under the License.
15 - */ 15 + */
16 -package org.onosproject.ovsdb.rfc.message; 16 +package org.onosproject.ovsdb.rfc.message;
17 - 17 +
18 -import static com.google.common.base.MoreObjects.toStringHelper; 18 +import static com.google.common.base.MoreObjects.toStringHelper;
19 -import static com.google.common.base.Preconditions.checkNotNull; 19 +import static com.google.common.base.Preconditions.checkNotNull;
20 - 20 +
21 -import java.util.Objects; 21 +import java.util.Objects;
22 - 22 +
23 -import org.onosproject.ovsdb.rfc.notation.json.UpdateNotificationConverter; 23 +import org.onosproject.ovsdb.rfc.notation.json.UpdateNotificationConverter;
24 - 24 +
25 -import com.fasterxml.jackson.databind.JsonNode; 25 +import com.fasterxml.jackson.databind.JsonNode;
26 -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; 26 +import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
27 - 27 +
28 -/** 28 +/**
29 - * The "update" notification is sent by the server to the client to report 29 + * The "update" notification is sent by the server to the client to report
30 - * changes in tables that are being monitored following a "monitor" request. The 30 + * changes in tables that are being monitored following a "monitor" request. The
31 - * "params" of the result JsonNode. 31 + * "params" of the result JsonNode.
32 - */ 32 + */
33 -@JsonDeserialize(converter = UpdateNotificationConverter.class) 33 +@JsonDeserialize(converter = UpdateNotificationConverter.class)
34 -public final class UpdateNotification { 34 +public final class UpdateNotification {
35 - private final Object jsonValue; 35 + private final Object jsonValue;
36 - private final JsonNode tbUpdatesJsonNode; 36 + private final JsonNode tbUpdatesJsonNode;
37 - 37 +
38 - /** 38 + /**
39 - * Constructs a UpdateNotification object. 39 + * Constructs a UpdateNotification object.
40 - * @param jsonValue the "json-value" in "params" of the result JsonNode 40 + * @param jsonValue the "json-value" in "params" of the result JsonNode
41 - * @param tbUpdatesJsonNode the "table-updates" in "params" of the result JsonNode 41 + * @param tbUpdatesJsonNode the "table-updates" in "params" of the result JsonNode
42 - */ 42 + */
43 - public UpdateNotification(Object jsonValue, JsonNode tbUpdatesJsonNode) { 43 + public UpdateNotification(Object jsonValue, JsonNode tbUpdatesJsonNode) {
44 - checkNotNull(jsonValue, "jsonValue cannot be null"); 44 + checkNotNull(jsonValue, "jsonValue cannot be null");
45 - checkNotNull(tbUpdatesJsonNode, "tablebUpdates JsonNode cannot be null"); 45 + checkNotNull(tbUpdatesJsonNode, "tablebUpdates JsonNode cannot be null");
46 - this.jsonValue = jsonValue; 46 + this.jsonValue = jsonValue;
47 - this.tbUpdatesJsonNode = tbUpdatesJsonNode; 47 + this.tbUpdatesJsonNode = tbUpdatesJsonNode;
48 - } 48 + }
49 - 49 +
50 - /** 50 + /**
51 - * Return context. 51 + * Return context.
52 - * @return context 52 + * @return context
53 - */ 53 + */
54 - public Object jsonValue() { 54 + public Object jsonValue() {
55 - return jsonValue; 55 + return jsonValue;
56 - } 56 + }
57 - 57 +
58 - /** 58 + /**
59 - * Return tbUpdatesJsonNode. 59 + * Return tbUpdatesJsonNode.
60 - * @return tbUpdatesJsonNode 60 + * @return tbUpdatesJsonNode
61 - */ 61 + */
62 - public JsonNode tbUpdatesJsonNode() { 62 + public JsonNode tbUpdatesJsonNode() {
63 - return tbUpdatesJsonNode; 63 + return tbUpdatesJsonNode;
64 - } 64 + }
65 - 65 +
66 - @Override 66 + @Override
67 - public int hashCode() { 67 + public int hashCode() {
68 - return Objects.hash(jsonValue, tbUpdatesJsonNode); 68 + return Objects.hash(jsonValue, tbUpdatesJsonNode);
69 - } 69 + }
70 - 70 +
71 - @Override 71 + @Override
72 - public boolean equals(Object obj) { 72 + public boolean equals(Object obj) {
73 - if (this == obj) { 73 + if (this == obj) {
74 - return true; 74 + return true;
75 - } 75 + }
76 - if (obj instanceof UpdateNotification) { 76 + if (obj instanceof UpdateNotification) {
77 - final UpdateNotification other = (UpdateNotification) obj; 77 + final UpdateNotification other = (UpdateNotification) obj;
78 - return Objects.equals(this.jsonValue, other.jsonValue) 78 + return Objects.equals(this.jsonValue, other.jsonValue)
79 - && Objects.equals(this.tbUpdatesJsonNode, 79 + && Objects.equals(this.tbUpdatesJsonNode,
80 - other.tbUpdatesJsonNode); 80 + other.tbUpdatesJsonNode);
81 - } 81 + }
82 - return false; 82 + return false;
83 - } 83 + }
84 - 84 +
85 - @Override 85 + @Override
86 - public String toString() { 86 + public String toString() {
87 - return toStringHelper(this).add("jsonValue", jsonValue) 87 + return toStringHelper(this).add("jsonValue", jsonValue)
88 - .add("tbUpdatesJsonNode", tbUpdatesJsonNode).toString(); 88 + .add("tbUpdatesJsonNode", tbUpdatesJsonNode).toString();
89 - } 89 + }
90 -} 90 +}
......
1 -/* 1 +/*
2 - * Copyright 2015 Open Networking Laboratory 2 + * Copyright 2015 Open Networking Laboratory
3 - * 3 + *
4 - * Licensed under the Apache License, Version 2.0 (the "License"); 4 + * Licensed under the Apache License, Version 2.0 (the "License");
5 - * you may not use this file except in compliance with 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 6 + * You may obtain a copy of the License at
7 - * 7 + *
8 - * http://www.apache.org/licenses/LICENSE-2.0 8 + * http://www.apache.org/licenses/LICENSE-2.0
9 - * 9 + *
10 - * Unless required by applicable law or agreed to in writing, software 10 + * Unless required by applicable law or agreed to in writing, software
11 - * distributed under the License is distributed on an "AS IS" BASIS, 11 + * distributed under the License is distributed on an "AS IS" BASIS,
12 - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 - * See the License for the specific language governing permissions and 13 + * See the License for the specific language governing permissions and
14 - * limitations under the License. 14 + * limitations under the License.
15 - */ 15 + */
16 -package org.onosproject.ovsdb.rfc.notation; 16 +package org.onosproject.ovsdb.rfc.notation;
17 - 17 +
18 -import static com.google.common.base.MoreObjects.toStringHelper; 18 +import static com.google.common.base.MoreObjects.toStringHelper;
19 -import static com.google.common.base.Preconditions.checkNotNull; 19 +import static com.google.common.base.Preconditions.checkNotNull;
20 - 20 +
21 -import java.util.Objects; 21 +import java.util.Objects;
22 - 22 +
23 -/** 23 +/**
24 - * Column is the basic element of the OpenVswitch database. 24 + * Column is the basic element of the OpenVswitch database.
25 - */ 25 + */
26 -public final class Column { 26 +public final class Column {
27 - private final String columnName; 27 + private final String columnName;
28 - private final Object data; 28 + private final Object data;
29 - 29 +
30 - /** 30 + /**
31 - * Column constructor. 31 + * Column constructor.
32 - * @param columnName the column name 32 + * @param columnName the column name
33 - * @param obj the data of the column 33 + * @param obj the data of the column
34 - */ 34 + */
35 - public Column(String columnName, Object obj) { 35 + public Column(String columnName, Object obj) {
36 - checkNotNull(columnName, "columnName cannot be null"); 36 + checkNotNull(columnName, "columnName cannot be null");
37 - checkNotNull(obj, "data cannot be null"); 37 + checkNotNull(obj, "data cannot be null");
38 - this.columnName = columnName; 38 + this.columnName = columnName;
39 - this.data = obj; 39 + this.data = obj;
40 - } 40 + }
41 - 41 +
42 - /** 42 + /**
43 - * Returns column data. 43 + * Returns column data.
44 - * @return column data 44 + * @return column data
45 - */ 45 + */
46 - public Object data() { 46 + public Object data() {
47 - return data; 47 + return data;
48 - } 48 + }
49 - 49 +
50 - /** 50 + /**
51 - * Returns columnName. 51 + * Returns columnName.
52 - * @return columnName 52 + * @return columnName
53 - */ 53 + */
54 - public String columnName() { 54 + public String columnName() {
55 - return columnName; 55 + return columnName;
56 - } 56 + }
57 - 57 +
58 - @Override 58 + @Override
59 - public int hashCode() { 59 + public int hashCode() {
60 - return Objects.hash(columnName, data); 60 + return Objects.hash(columnName, data);
61 - } 61 + }
62 - 62 +
63 - @Override 63 + @Override
64 - public boolean equals(Object obj) { 64 + public boolean equals(Object obj) {
65 - if (this == obj) { 65 + if (this == obj) {
66 - return true; 66 + return true;
67 - } 67 + }
68 - if (obj instanceof Column) { 68 + if (obj instanceof Column) {
69 - final Column other = (Column) obj; 69 + final Column other = (Column) obj;
70 - return Objects.equals(this.columnName, other.columnName) 70 + return Objects.equals(this.columnName, other.columnName)
71 - && Objects.equals(this.data, other.data); 71 + && Objects.equals(this.data, other.data);
72 - } 72 + }
73 - return false; 73 + return false;
74 - } 74 + }
75 - 75 +
76 - @Override 76 + @Override
77 - public String toString() { 77 + public String toString() {
78 - return toStringHelper(this).add("columnName", columnName) 78 + return toStringHelper(this).add("columnName", columnName)
79 - .add("data", data).toString(); 79 + .add("data", data).toString();
80 - } 80 + }
81 -} 81 +}
......
1 -/* 1 +/*
2 - * Copyright 2015 Open Networking Laboratory 2 + * Copyright 2015 Open Networking Laboratory
3 - * 3 + *
4 - * Licensed under the Apache License, Version 2.0 (the "License"); 4 + * Licensed under the Apache License, Version 2.0 (the "License");
5 - * you may not use this file except in compliance with 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 6 + * You may obtain a copy of the License at
7 - * 7 + *
8 - * http://www.apache.org/licenses/LICENSE-2.0 8 + * http://www.apache.org/licenses/LICENSE-2.0
9 - * 9 + *
10 - * Unless required by applicable law or agreed to in writing, software 10 + * Unless required by applicable law or agreed to in writing, software
11 - * distributed under the License is distributed on an "AS IS" BASIS, 11 + * distributed under the License is distributed on an "AS IS" BASIS,
12 - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 - * See the License for the specific language governing permissions and 13 + * See the License for the specific language governing permissions and
14 - * limitations under the License. 14 + * limitations under the License.
15 - */ 15 + */
16 -package org.onosproject.ovsdb.rfc.notation; 16 +package org.onosproject.ovsdb.rfc.notation;
17 - 17 +
18 -import static com.google.common.base.MoreObjects.toStringHelper; 18 +import static com.google.common.base.MoreObjects.toStringHelper;
19 -import static com.google.common.base.Preconditions.checkNotNull; 19 +import static com.google.common.base.Preconditions.checkNotNull;
20 - 20 +
21 -import java.util.Collection; 21 +import java.util.Collection;
22 -import java.util.Map; 22 +import java.util.Map;
23 -import java.util.Objects; 23 +import java.util.Objects;
24 - 24 +
25 -import com.google.common.collect.Maps; 25 +import com.google.common.collect.Maps;
26 - 26 +
27 -/** 27 +/**
28 - * Row is the basic element of the OpenVswitch's table. 28 + * Row is the basic element of the OpenVswitch's table.
29 - */ 29 + */
30 -public final class Row { 30 +public final class Row {
31 - private String tableName; 31 + private String tableName;
32 - private Map<String, Column> columns; 32 + private Map<String, Column> columns;
33 - 33 +
34 - /** 34 + /**
35 - * Row constructor. 35 + * Row constructor.
36 - */ 36 + */
37 - public Row() { 37 + public Row() {
38 - this.columns = Maps.newHashMap(); 38 + this.columns = Maps.newHashMap();
39 - } 39 + }
40 - 40 +
41 - /** 41 + /**
42 - * Row constructor. 42 + * Row constructor.
43 - * @param tableName table name 43 + * @param tableName table name
44 - */ 44 + */
45 - public Row(String tableName) { 45 + public Row(String tableName) {
46 - checkNotNull(tableName, "tableName cannot be null"); 46 + checkNotNull(tableName, "tableName cannot be null");
47 - this.tableName = tableName; 47 + this.tableName = tableName;
48 - this.columns = Maps.newHashMap(); 48 + this.columns = Maps.newHashMap();
49 - } 49 + }
50 - 50 +
51 - /** 51 + /**
52 - * Row constructor. 52 + * Row constructor.
53 - * @param tableName table name 53 + * @param tableName table name
54 - * @param columns Map of Column entity 54 + * @param columns Map of Column entity
55 - */ 55 + */
56 - public Row(String tableName, Map<String, Column> columns) { 56 + public Row(String tableName, Map<String, Column> columns) {
57 - checkNotNull(tableName, "table name cannot be null"); 57 + checkNotNull(tableName, "table name cannot be null");
58 - checkNotNull(columns, "columns cannot be null"); 58 + checkNotNull(columns, "columns cannot be null");
59 - this.tableName = tableName; 59 + this.tableName = tableName;
60 - this.columns = columns; 60 + this.columns = columns;
61 - } 61 + }
62 - 62 +
63 - /** 63 + /**
64 - * Returns tableName. 64 + * Returns tableName.
65 - * @return tableName 65 + * @return tableName
66 - */ 66 + */
67 - public String tableName() { 67 + public String tableName() {
68 - return tableName; 68 + return tableName;
69 - } 69 + }
70 - 70 +
71 - /** 71 + /**
72 - * Set tableName value. 72 + * Set tableName value.
73 - * @param tableName table name 73 + * @param tableName table name
74 - */ 74 + */
75 - public void setTableName(String tableName) { 75 + public void setTableName(String tableName) {
76 - this.tableName = tableName; 76 + this.tableName = tableName;
77 - } 77 + }
78 - 78 +
79 - /** 79 + /**
80 - * Returns Column by ColumnSchema. 80 + * Returns Column by ColumnSchema.
81 - * @param columnName column name 81 + * @param columnName column name
82 - * @return Column 82 + * @return Column
83 - */ 83 + */
84 - public Column getColumn(String columnName) { 84 + public Column getColumn(String columnName) {
85 - return columns.get(columnName); 85 + return columns.get(columnName);
86 - } 86 + }
87 - 87 +
88 - /** 88 + /**
89 - * Returns Collection of Column. 89 + * Returns Collection of Column.
90 - * @return Collection of Column 90 + * @return Collection of Column
91 - */ 91 + */
92 - public Collection<Column> getColumns() { 92 + public Collection<Column> getColumns() {
93 - return columns.values(); 93 + return columns.values();
94 - } 94 + }
95 - 95 +
96 - /** 96 + /**
97 - * add Column. 97 + * add Column.
98 - * @param columnName column name 98 + * @param columnName column name
99 - * @param data Column entity 99 + * @param data Column entity
100 - */ 100 + */
101 - public void addColumn(String columnName, Column data) { 101 + public void addColumn(String columnName, Column data) {
102 - this.columns.put(columnName, data); 102 + this.columns.put(columnName, data);
103 - } 103 + }
104 - 104 +
105 - @Override 105 + @Override
106 - public int hashCode() { 106 + public int hashCode() {
107 - return Objects.hash(tableName, columns); 107 + return Objects.hash(tableName, columns);
108 - } 108 + }
109 - 109 +
110 - @Override 110 + @Override
111 - public boolean equals(Object obj) { 111 + public boolean equals(Object obj) {
112 - if (this == obj) { 112 + if (this == obj) {
113 - return true; 113 + return true;
114 - } 114 + }
115 - if (obj instanceof Row) { 115 + if (obj instanceof Row) {
116 - final Row other = (Row) obj; 116 + final Row other = (Row) obj;
117 - return Objects.equals(this.tableName, other.tableName) 117 + return Objects.equals(this.tableName, other.tableName)
118 - && Objects.equals(this.columns, other.columns); 118 + && Objects.equals(this.columns, other.columns);
119 - } 119 + }
120 - return false; 120 + return false;
121 - } 121 + }
122 - 122 +
123 - @Override 123 + @Override
124 - public String toString() { 124 + public String toString() {
125 - return toStringHelper(this).add("tableName", tableName) 125 + return toStringHelper(this).add("tableName", tableName)
126 - .add("columns", columns).toString(); 126 + .add("columns", columns).toString();
127 - } 127 + }
128 -} 128 +}
......
1 -/* 1 +/*
2 - * Copyright 2015 Open Networking Laboratory 2 + * Copyright 2015 Open Networking Laboratory
3 - * 3 + *
4 - * Licensed under the Apache License, Version 2.0 (the "License"); 4 + * Licensed under the Apache License, Version 2.0 (the "License");
5 - * you may not use this file except in compliance with 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 6 + * You may obtain a copy of the License at
7 - * 7 + *
8 - * http://www.apache.org/licenses/LICENSE-2.0 8 + * http://www.apache.org/licenses/LICENSE-2.0
9 - * 9 + *
10 - * Unless required by applicable law or agreed to in writing, software 10 + * Unless required by applicable law or agreed to in writing, software
11 - * distributed under the License is distributed on an "AS IS" BASIS, 11 + * distributed under the License is distributed on an "AS IS" BASIS,
12 - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 - * See the License for the specific language governing permissions and 13 + * See the License for the specific language governing permissions and
14 - * limitations under the License. 14 + * limitations under the License.
15 - */ 15 + */
16 -package org.onosproject.ovsdb.rfc.notation.json; 16 +package org.onosproject.ovsdb.rfc.notation.json;
17 - 17 +
18 -import org.onosproject.ovsdb.rfc.notation.UUID; 18 +import org.onosproject.ovsdb.rfc.notation.UUID;
19 - 19 +
20 -import com.fasterxml.jackson.databind.JsonNode; 20 +import com.fasterxml.jackson.databind.JsonNode;
21 -import com.fasterxml.jackson.databind.util.StdConverter; 21 +import com.fasterxml.jackson.databind.util.StdConverter;
22 - 22 +
23 -/** 23 +/**
24 - * UUIDConverter Converter. 24 + * UUIDConverter Converter.
25 - */ 25 + */
26 -public class UUIDConverter extends StdConverter<JsonNode, UUID> { 26 +public class UUIDConverter extends StdConverter<JsonNode, UUID> {
27 - 27 +
28 - @Override 28 + @Override
29 - public UUID convert(JsonNode json) { 29 + public UUID convert(JsonNode json) {
30 - return UUID.uuid(json.get(1).asText()); 30 + return UUID.uuid(json.get(1).asText());
31 - } 31 + }
32 -} 32 +}
......
1 -/* 1 +/*
2 - * Copyright 2015 Open Networking Laboratory 2 + * Copyright 2015 Open Networking Laboratory
3 - * 3 + *
4 - * Licensed under the Apache License, Version 2.0 (the "License"); 4 + * Licensed under the Apache License, Version 2.0 (the "License");
5 - * you may not use this file except in compliance with 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 6 + * You may obtain a copy of the License at
7 - * 7 + *
8 - * http://www.apache.org/licenses/LICENSE-2.0 8 + * http://www.apache.org/licenses/LICENSE-2.0
9 - * 9 + *
10 - * Unless required by applicable law or agreed to in writing, software 10 + * Unless required by applicable law or agreed to in writing, software
11 - * distributed under the License is distributed on an "AS IS" BASIS, 11 + * distributed under the License is distributed on an "AS IS" BASIS,
12 - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 - * See the License for the specific language governing permissions and 13 + * See the License for the specific language governing permissions and
14 - * limitations under the License. 14 + * limitations under the License.
15 - */ 15 + */
16 -package org.onosproject.ovsdb.rfc.operations; 16 +package org.onosproject.ovsdb.rfc.operations;
17 - 17 +
18 -import static com.google.common.base.Preconditions.checkNotNull; 18 +import static com.google.common.base.Preconditions.checkNotNull;
19 - 19 +
20 -import java.util.List; 20 +import java.util.List;
21 - 21 +
22 -import org.onosproject.ovsdb.rfc.notation.Condition; 22 +import org.onosproject.ovsdb.rfc.notation.Condition;
23 -import org.onosproject.ovsdb.rfc.schema.TableSchema; 23 +import org.onosproject.ovsdb.rfc.schema.TableSchema;
24 - 24 +
25 -import com.fasterxml.jackson.annotation.JsonIgnore; 25 +import com.fasterxml.jackson.annotation.JsonIgnore;
26 -import com.fasterxml.jackson.annotation.JsonProperty; 26 +import com.fasterxml.jackson.annotation.JsonProperty;
27 - 27 +
28 -/** 28 +/**
29 - * delete operation.Refer to RFC 7047 Section 5.2. 29 + * delete operation.Refer to RFC 7047 Section 5.2.
30 - */ 30 + */
31 -public final class Delete implements Operation { 31 +public final class Delete implements Operation {
32 - 32 +
33 - @JsonIgnore 33 + @JsonIgnore
34 - private final TableSchema tableSchema; 34 + private final TableSchema tableSchema;
35 - private final String op; 35 + private final String op;
36 - private final List<Condition> where; 36 + private final List<Condition> where;
37 - 37 +
38 - /** 38 + /**
39 - * Constructs a Delete object. 39 + * Constructs a Delete object.
40 - * @param schema TableSchema entity 40 + * @param schema TableSchema entity
41 - * @param where the List of Condition entity 41 + * @param where the List of Condition entity
42 - */ 42 + */
43 - public Delete(TableSchema schema, List<Condition> where) { 43 + public Delete(TableSchema schema, List<Condition> where) {
44 - checkNotNull(schema, "TableSchema cannot be null"); 44 + checkNotNull(schema, "TableSchema cannot be null");
45 - checkNotNull(where, "where is not null"); 45 + checkNotNull(where, "where is not null");
46 - this.tableSchema = schema; 46 + this.tableSchema = schema;
47 - this.op = Operations.DELETE.op(); 47 + this.op = Operations.DELETE.op();
48 - this.where = where; 48 + this.where = where;
49 - } 49 + }
50 - 50 +
51 - /** 51 + /**
52 - * Returns the where member of delete operation. 52 + * Returns the where member of delete operation.
53 - * @return the where member of delete operation 53 + * @return the where member of delete operation
54 - */ 54 + */
55 - public List<Condition> getWhere() { 55 + public List<Condition> getWhere() {
56 - return where; 56 + return where;
57 - } 57 + }
58 - 58 +
59 - @Override 59 + @Override
60 - public String getOp() { 60 + public String getOp() {
61 - return op; 61 + return op;
62 - } 62 + }
63 - 63 +
64 - @Override 64 + @Override
65 - public TableSchema getTableSchema() { 65 + public TableSchema getTableSchema() {
66 - return tableSchema; 66 + return tableSchema;
67 - } 67 + }
68 - 68 +
69 - /** 69 + /**
70 - * For the use of serialization. 70 + * For the use of serialization.
71 - * @return the table member of update operation 71 + * @return the table member of update operation
72 - */ 72 + */
73 - @JsonProperty 73 + @JsonProperty
74 - public String getTable() { 74 + public String getTable() {
75 - return tableSchema.name(); 75 + return tableSchema.name();
76 - } 76 + }
77 -} 77 +}
......
1 -/* 1 +/*
2 - * Copyright 2015 Open Networking Laboratory 2 + * Copyright 2015 Open Networking Laboratory
3 - * 3 + *
4 - * Licensed under the Apache License, Version 2.0 (the "License"); 4 + * Licensed under the Apache License, Version 2.0 (the "License");
5 - * you may not use this file except in compliance with 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 6 + * You may obtain a copy of the License at
7 - * 7 + *
8 - * http://www.apache.org/licenses/LICENSE-2.0 8 + * http://www.apache.org/licenses/LICENSE-2.0
9 - * 9 + *
10 - * Unless required by applicable law or agreed to in writing, software 10 + * Unless required by applicable law or agreed to in writing, software
11 - * distributed under the License is distributed on an "AS IS" BASIS, 11 + * distributed under the License is distributed on an "AS IS" BASIS,
12 - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 - * See the License for the specific language governing permissions and 13 + * See the License for the specific language governing permissions and
14 - * limitations under the License. 14 + * limitations under the License.
15 - */ 15 + */
16 -package org.onosproject.ovsdb.rfc.operations; 16 +package org.onosproject.ovsdb.rfc.operations;
17 - 17 +
18 -import static com.google.common.base.Preconditions.checkNotNull; 18 +import static com.google.common.base.Preconditions.checkNotNull;
19 - 19 +
20 -import java.util.Collection; 20 +import java.util.Collection;
21 -import java.util.Map; 21 +import java.util.Map;
22 - 22 +
23 -import org.onosproject.ovsdb.rfc.notation.Column; 23 +import org.onosproject.ovsdb.rfc.notation.Column;
24 -import org.onosproject.ovsdb.rfc.notation.Row; 24 +import org.onosproject.ovsdb.rfc.notation.Row;
25 -import org.onosproject.ovsdb.rfc.schema.TableSchema; 25 +import org.onosproject.ovsdb.rfc.schema.TableSchema;
26 -import org.onosproject.ovsdb.rfc.utils.TransValueUtil; 26 +import org.onosproject.ovsdb.rfc.utils.TransValueUtil;
27 - 27 +
28 -import com.fasterxml.jackson.annotation.JsonIgnore; 28 +import com.fasterxml.jackson.annotation.JsonIgnore;
29 -import com.fasterxml.jackson.annotation.JsonProperty; 29 +import com.fasterxml.jackson.annotation.JsonProperty;
30 -import com.google.common.collect.Maps; 30 +import com.google.common.collect.Maps;
31 - 31 +
32 -/** 32 +/**
33 - * insert operation.Refer to RFC 7047 Section 5.2. 33 + * insert operation.Refer to RFC 7047 Section 5.2.
34 - */ 34 + */
35 -public final class Insert implements Operation { 35 +public final class Insert implements Operation {
36 - 36 +
37 - @JsonIgnore 37 + @JsonIgnore
38 - private final TableSchema tableSchema; 38 + private final TableSchema tableSchema;
39 - private final String op; 39 + private final String op;
40 - @JsonProperty("uuid-name") 40 + @JsonProperty("uuid-name")
41 - private final String uuidName; 41 + private final String uuidName;
42 - private final Map<String, Object> row; 42 + private final Map<String, Object> row;
43 - 43 +
44 - /** 44 + /**
45 - * Constructs a Insert object. 45 + * Constructs a Insert object.
46 - * @param schema TableSchema entity 46 + * @param schema TableSchema entity
47 - * @param uuidName uuid-name 47 + * @param uuidName uuid-name
48 - * @param row Row entity 48 + * @param row Row entity
49 - */ 49 + */
50 - public Insert(TableSchema schema, String uuidName, Row row) { 50 + public Insert(TableSchema schema, String uuidName, Row row) {
51 - checkNotNull(schema, "TableSchema cannot be null"); 51 + checkNotNull(schema, "TableSchema cannot be null");
52 - checkNotNull(uuidName, "uuid name cannot be null"); 52 + checkNotNull(uuidName, "uuid name cannot be null");
53 - checkNotNull(row, "row cannot be null"); 53 + checkNotNull(row, "row cannot be null");
54 - this.tableSchema = schema; 54 + this.tableSchema = schema;
55 - this.op = Operations.INSERT.op(); 55 + this.op = Operations.INSERT.op();
56 - this.uuidName = uuidName; 56 + this.uuidName = uuidName;
57 - this.row = Maps.newHashMap(); 57 + this.row = Maps.newHashMap();
58 - generateOperationRow(row); 58 + generateOperationRow(row);
59 - } 59 + }
60 - 60 +
61 - /** 61 + /**
62 - * Row entity convert into the row format of insert operation. Refer to RFC 62 + * Row entity convert into the row format of insert operation. Refer to RFC
63 - * 7047 Section 5.2. 63 + * 7047 Section 5.2.
64 - * @param row Row entity 64 + * @param row Row entity
65 - */ 65 + */
66 - private void generateOperationRow(Row row) { 66 + private void generateOperationRow(Row row) {
67 - Collection<Column> columns = row.getColumns(); 67 + Collection<Column> columns = row.getColumns();
68 - for (Column column : columns) { 68 + for (Column column : columns) {
69 - String columnName = column.columnName(); 69 + String columnName = column.columnName();
70 - Object value = column.data(); 70 + Object value = column.data();
71 - Object formatValue = TransValueUtil.getFormatData(value); 71 + Object formatValue = TransValueUtil.getFormatData(value);
72 - this.row.put(columnName, formatValue); 72 + this.row.put(columnName, formatValue);
73 - } 73 + }
74 - } 74 + }
75 - 75 +
76 - /** 76 + /**
77 - * Returns the uuid-name member of insert operation. 77 + * Returns the uuid-name member of insert operation.
78 - * @return the uuid-name member of insert operation 78 + * @return the uuid-name member of insert operation
79 - */ 79 + */
80 - public String getUuidName() { 80 + public String getUuidName() {
81 - return uuidName; 81 + return uuidName;
82 - } 82 + }
83 - 83 +
84 - /** 84 + /**
85 - * Returns the row member of insert operation. 85 + * Returns the row member of insert operation.
86 - * @return the row member of insert operation 86 + * @return the row member of insert operation
87 - */ 87 + */
88 - public Map<String, Object> getRow() { 88 + public Map<String, Object> getRow() {
89 - return row; 89 + return row;
90 - } 90 + }
91 - 91 +
92 - @Override 92 + @Override
93 - public String getOp() { 93 + public String getOp() {
94 - return op; 94 + return op;
95 - } 95 + }
96 - 96 +
97 - @Override 97 + @Override
98 - public TableSchema getTableSchema() { 98 + public TableSchema getTableSchema() {
99 - return tableSchema; 99 + return tableSchema;
100 - } 100 + }
101 - 101 +
102 - /** 102 + /**
103 - * For the use of serialization. 103 + * For the use of serialization.
104 - * @return the table member of update operation 104 + * @return the table member of update operation
105 - */ 105 + */
106 - @JsonProperty 106 + @JsonProperty
107 - public String getTable() { 107 + public String getTable() {
108 - return tableSchema.name(); 108 + return tableSchema.name();
109 - } 109 + }
110 -} 110 +}
......
1 -/* 1 +/*
2 - * Copyright 2015 Open Networking Laboratory 2 + * Copyright 2015 Open Networking Laboratory
3 - * 3 + *
4 - * Licensed under the Apache License, Version 2.0 (the "License"); 4 + * Licensed under the Apache License, Version 2.0 (the "License");
5 - * you may not use this file except in compliance with 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 6 + * You may obtain a copy of the License at
7 - * 7 + *
8 - * http://www.apache.org/licenses/LICENSE-2.0 8 + * http://www.apache.org/licenses/LICENSE-2.0
9 - * 9 + *
10 - * Unless required by applicable law or agreed to in writing, software 10 + * Unless required by applicable law or agreed to in writing, software
11 - * distributed under the License is distributed on an "AS IS" BASIS, 11 + * distributed under the License is distributed on an "AS IS" BASIS,
12 - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 - * See the License for the specific language governing permissions and 13 + * See the License for the specific language governing permissions and
14 - * limitations under the License. 14 + * limitations under the License.
15 - */ 15 + */
16 -package org.onosproject.ovsdb.rfc.operations; 16 +package org.onosproject.ovsdb.rfc.operations;
17 - 17 +
18 -import static com.google.common.base.Preconditions.checkNotNull; 18 +import static com.google.common.base.Preconditions.checkNotNull;
19 - 19 +
20 -import java.util.List; 20 +import java.util.List;
21 - 21 +
22 -import org.onosproject.ovsdb.rfc.notation.Condition; 22 +import org.onosproject.ovsdb.rfc.notation.Condition;
23 -import org.onosproject.ovsdb.rfc.notation.Mutation; 23 +import org.onosproject.ovsdb.rfc.notation.Mutation;
24 -import org.onosproject.ovsdb.rfc.schema.TableSchema; 24 +import org.onosproject.ovsdb.rfc.schema.TableSchema;
25 - 25 +
26 -import com.fasterxml.jackson.annotation.JsonIgnore; 26 +import com.fasterxml.jackson.annotation.JsonIgnore;
27 -import com.fasterxml.jackson.annotation.JsonProperty; 27 +import com.fasterxml.jackson.annotation.JsonProperty;
28 - 28 +
29 -/** 29 +/**
30 - * mutate operation.Refer to RFC 7047 Section 5.2. 30 + * mutate operation.Refer to RFC 7047 Section 5.2.
31 - */ 31 + */
32 -public final class Mutate implements Operation { 32 +public final class Mutate implements Operation {
33 - 33 +
34 - @JsonIgnore 34 + @JsonIgnore
35 - private final TableSchema tableSchema; 35 + private final TableSchema tableSchema;
36 - private final String op; 36 + private final String op;
37 - private final List<Condition> where; 37 + private final List<Condition> where;
38 - private final List<Mutation> mutations; 38 + private final List<Mutation> mutations;
39 - 39 +
40 - /** 40 + /**
41 - * Constructs a Mutate object. 41 + * Constructs a Mutate object.
42 - * @param schema TableSchema entity 42 + * @param schema TableSchema entity
43 - * @param where the List of Condition entity 43 + * @param where the List of Condition entity
44 - * @param mutations the List of Mutation entity 44 + * @param mutations the List of Mutation entity
45 - */ 45 + */
46 - public Mutate(TableSchema schema, List<Condition> where, 46 + public Mutate(TableSchema schema, List<Condition> where,
47 - List<Mutation> mutations) { 47 + List<Mutation> mutations) {
48 - checkNotNull(schema, "TableSchema cannot be null"); 48 + checkNotNull(schema, "TableSchema cannot be null");
49 - checkNotNull(mutations, "mutations cannot be null"); 49 + checkNotNull(mutations, "mutations cannot be null");
50 - checkNotNull(where, "where cannot be null"); 50 + checkNotNull(where, "where cannot be null");
51 - this.tableSchema = schema; 51 + this.tableSchema = schema;
52 - this.op = Operations.MUTATE.op(); 52 + this.op = Operations.MUTATE.op();
53 - this.where = where; 53 + this.where = where;
54 - this.mutations = mutations; 54 + this.mutations = mutations;
55 - } 55 + }
56 - 56 +
57 - /** 57 + /**
58 - * Returns the mutations member of mutate operation. 58 + * Returns the mutations member of mutate operation.
59 - * @return the mutations member of mutate operation 59 + * @return the mutations member of mutate operation
60 - */ 60 + */
61 - public List<Mutation> getMutations() { 61 + public List<Mutation> getMutations() {
62 - return mutations; 62 + return mutations;
63 - } 63 + }
64 - 64 +
65 - /** 65 + /**
66 - * Returns the where member of mutate operation. 66 + * Returns the where member of mutate operation.
67 - * @return the where member of mutate operation 67 + * @return the where member of mutate operation
68 - */ 68 + */
69 - public List<Condition> getWhere() { 69 + public List<Condition> getWhere() {
70 - return where; 70 + return where;
71 - } 71 + }
72 - 72 +
73 - @Override 73 + @Override
74 - public String getOp() { 74 + public String getOp() {
75 - return op; 75 + return op;
76 - } 76 + }
77 - 77 +
78 - @Override 78 + @Override
79 - public TableSchema getTableSchema() { 79 + public TableSchema getTableSchema() {
80 - return tableSchema; 80 + return tableSchema;
81 - } 81 + }
82 - 82 +
83 - /** 83 + /**
84 - * For the use of serialization. 84 + * For the use of serialization.
85 - * @return the table member of update operation 85 + * @return the table member of update operation
86 - */ 86 + */
87 - @JsonProperty 87 + @JsonProperty
88 - public String getTable() { 88 + public String getTable() {
89 - return tableSchema.name(); 89 + return tableSchema.name();
90 - } 90 + }
91 -} 91 +}
......
1 -/* 1 +/*
2 - * Copyright 2015 Open Networking Laboratory 2 + * Copyright 2015 Open Networking Laboratory
3 - * 3 + *
4 - * Licensed under the Apache License, Version 2.0 (the "License"); 4 + * Licensed under the Apache License, Version 2.0 (the "License");
5 - * you may not use this file except in compliance with 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 6 + * You may obtain a copy of the License at
7 - * 7 + *
8 - * http://www.apache.org/licenses/LICENSE-2.0 8 + * http://www.apache.org/licenses/LICENSE-2.0
9 - * 9 + *
10 - * Unless required by applicable law or agreed to in writing, software 10 + * Unless required by applicable law or agreed to in writing, software
11 - * distributed under the License is distributed on an "AS IS" BASIS, 11 + * distributed under the License is distributed on an "AS IS" BASIS,
12 - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 - * See the License for the specific language governing permissions and 13 + * See the License for the specific language governing permissions and
14 - * limitations under the License. 14 + * limitations under the License.
15 - */ 15 + */
16 -package org.onosproject.ovsdb.rfc.operations; 16 +package org.onosproject.ovsdb.rfc.operations;
17 - 17 +
18 -import static com.google.common.base.Preconditions.checkNotNull; 18 +import static com.google.common.base.Preconditions.checkNotNull;
19 - 19 +
20 -import java.util.List; 20 +import java.util.List;
21 - 21 +
22 -import org.onosproject.ovsdb.rfc.notation.Condition; 22 +import org.onosproject.ovsdb.rfc.notation.Condition;
23 -import org.onosproject.ovsdb.rfc.schema.TableSchema; 23 +import org.onosproject.ovsdb.rfc.schema.TableSchema;
24 - 24 +
25 -import com.fasterxml.jackson.annotation.JsonIgnore; 25 +import com.fasterxml.jackson.annotation.JsonIgnore;
26 -import com.fasterxml.jackson.annotation.JsonProperty; 26 +import com.fasterxml.jackson.annotation.JsonProperty;
27 - 27 +
28 -/** 28 +/**
29 - * select operation.Refer to RFC 7047 Section 5.2. 29 + * select operation.Refer to RFC 7047 Section 5.2.
30 - */ 30 + */
31 -public final class Select implements Operation { 31 +public final class Select implements Operation {
32 - 32 +
33 - @JsonIgnore 33 + @JsonIgnore
34 - private final TableSchema tableSchema; 34 + private final TableSchema tableSchema;
35 - private final String op; 35 + private final String op;
36 - private final List<Condition> where; 36 + private final List<Condition> where;
37 - private final List<String> columns; 37 + private final List<String> columns;
38 - 38 +
39 - /** 39 + /**
40 - * Constructs a Select object. 40 + * Constructs a Select object.
41 - * @param schema TableSchema entity 41 + * @param schema TableSchema entity
42 - * @param where the List of Condition entity 42 + * @param where the List of Condition entity
43 - * @param columns the List of column name 43 + * @param columns the List of column name
44 - */ 44 + */
45 - public Select(TableSchema schema, List<Condition> where, List<String> columns) { 45 + public Select(TableSchema schema, List<Condition> where, List<String> columns) {
46 - checkNotNull(schema, "TableSchema cannot be null"); 46 + checkNotNull(schema, "TableSchema cannot be null");
47 - checkNotNull(where, "where cannot be null"); 47 + checkNotNull(where, "where cannot be null");
48 - checkNotNull(columns, "columns cannot be null"); 48 + checkNotNull(columns, "columns cannot be null");
49 - this.tableSchema = schema; 49 + this.tableSchema = schema;
50 - this.op = Operations.SELECT.op(); 50 + this.op = Operations.SELECT.op();
51 - this.where = where; 51 + this.where = where;
52 - this.columns = columns; 52 + this.columns = columns;
53 - } 53 + }
54 - 54 +
55 - /** 55 + /**
56 - * Returns the columns member of select operation. 56 + * Returns the columns member of select operation.
57 - * @return the columns member of select operation 57 + * @return the columns member of select operation
58 - */ 58 + */
59 - public List<String> getColumns() { 59 + public List<String> getColumns() {
60 - return columns; 60 + return columns;
61 - } 61 + }
62 - 62 +
63 - /** 63 + /**
64 - * Returns the where member of select operation. 64 + * Returns the where member of select operation.
65 - * @return the where member of select operation 65 + * @return the where member of select operation
66 - */ 66 + */
67 - public List<Condition> getWhere() { 67 + public List<Condition> getWhere() {
68 - return where; 68 + return where;
69 - } 69 + }
70 - 70 +
71 - @Override 71 + @Override
72 - public String getOp() { 72 + public String getOp() {
73 - return op; 73 + return op;
74 - } 74 + }
75 - 75 +
76 - @Override 76 + @Override
77 - public TableSchema getTableSchema() { 77 + public TableSchema getTableSchema() {
78 - return tableSchema; 78 + return tableSchema;
79 - } 79 + }
80 - 80 +
81 - /** 81 + /**
82 - * For the use of serialization. 82 + * For the use of serialization.
83 - * @return the table member of update operation 83 + * @return the table member of update operation
84 - */ 84 + */
85 - @JsonProperty 85 + @JsonProperty
86 - public String getTable() { 86 + public String getTable() {
87 - return tableSchema.name(); 87 + return tableSchema.name();
88 - } 88 + }
89 -} 89 +}
......
1 -/* 1 +/*
2 - * Copyright 2015 Open Networking Laboratory 2 + * Copyright 2015 Open Networking Laboratory
3 - * 3 + *
4 - * Licensed under the Apache License, Version 2.0 (the "License"); 4 + * Licensed under the Apache License, Version 2.0 (the "License");
5 - * you may not use this file except in compliance with 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 6 + * You may obtain a copy of the License at
7 - * 7 + *
8 - * http://www.apache.org/licenses/LICENSE-2.0 8 + * http://www.apache.org/licenses/LICENSE-2.0
9 - * 9 + *
10 - * Unless required by applicable law or agreed to in writing, software 10 + * Unless required by applicable law or agreed to in writing, software
11 - * distributed under the License is distributed on an "AS IS" BASIS, 11 + * distributed under the License is distributed on an "AS IS" BASIS,
12 - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 - * See the License for the specific language governing permissions and 13 + * See the License for the specific language governing permissions and
14 - * limitations under the License. 14 + * limitations under the License.
15 - */ 15 + */
16 -package org.onosproject.ovsdb.rfc.operations; 16 +package org.onosproject.ovsdb.rfc.operations;
17 - 17 +
18 -import static com.google.common.base.Preconditions.checkNotNull; 18 +import static com.google.common.base.Preconditions.checkNotNull;
19 - 19 +
20 -import java.util.Collection; 20 +import java.util.Collection;
21 -import java.util.List; 21 +import java.util.List;
22 -import java.util.Map; 22 +import java.util.Map;
23 - 23 +
24 -import org.onosproject.ovsdb.rfc.notation.Column; 24 +import org.onosproject.ovsdb.rfc.notation.Column;
25 -import org.onosproject.ovsdb.rfc.notation.Condition; 25 +import org.onosproject.ovsdb.rfc.notation.Condition;
26 -import org.onosproject.ovsdb.rfc.notation.Row; 26 +import org.onosproject.ovsdb.rfc.notation.Row;
27 -import org.onosproject.ovsdb.rfc.schema.TableSchema; 27 +import org.onosproject.ovsdb.rfc.schema.TableSchema;
28 -import org.onosproject.ovsdb.rfc.utils.TransValueUtil; 28 +import org.onosproject.ovsdb.rfc.utils.TransValueUtil;
29 - 29 +
30 -import com.fasterxml.jackson.annotation.JsonIgnore; 30 +import com.fasterxml.jackson.annotation.JsonIgnore;
31 -import com.fasterxml.jackson.annotation.JsonProperty; 31 +import com.fasterxml.jackson.annotation.JsonProperty;
32 -import com.google.common.collect.Maps; 32 +import com.google.common.collect.Maps;
33 - 33 +
34 -/** 34 +/**
35 - * update operation.Refer to RFC 7047 Section 5.2. 35 + * update operation.Refer to RFC 7047 Section 5.2.
36 - */ 36 + */
37 -public final class Update implements Operation { 37 +public final class Update implements Operation {
38 - 38 +
39 - @JsonIgnore 39 + @JsonIgnore
40 - private final TableSchema tableSchema; 40 + private final TableSchema tableSchema;
41 - private final String op; 41 + private final String op;
42 - private final Map<String, Object> row; 42 + private final Map<String, Object> row;
43 - private final List<Condition> where; 43 + private final List<Condition> where;
44 - 44 +
45 - /** 45 + /**
46 - * Constructs a Update object. 46 + * Constructs a Update object.
47 - * @param schema TableSchema entity 47 + * @param schema TableSchema entity
48 - * @param row Row entity 48 + * @param row Row entity
49 - * @param where the List of Condition entity 49 + * @param where the List of Condition entity
50 - */ 50 + */
51 - public Update(TableSchema schema, Row row, List<Condition> where) { 51 + public Update(TableSchema schema, Row row, List<Condition> where) {
52 - checkNotNull(schema, "TableSchema cannot be null"); 52 + checkNotNull(schema, "TableSchema cannot be null");
53 - checkNotNull(row, "row cannot be null"); 53 + checkNotNull(row, "row cannot be null");
54 - checkNotNull(where, "where cannot be null"); 54 + checkNotNull(where, "where cannot be null");
55 - this.tableSchema = schema; 55 + this.tableSchema = schema;
56 - this.op = Operations.UPDATE.op(); 56 + this.op = Operations.UPDATE.op();
57 - this.row = Maps.newHashMap(); 57 + this.row = Maps.newHashMap();
58 - this.where = where; 58 + this.where = where;
59 - generateOperationRow(row); 59 + generateOperationRow(row);
60 - } 60 + }
61 - 61 +
62 - /** 62 + /**
63 - * Row entity convert into the row format of update operation. Refer to RFC 63 + * Row entity convert into the row format of update operation. Refer to RFC
64 - * 7047 Section 5.2. 64 + * 7047 Section 5.2.
65 - * @param row Row entity 65 + * @param row Row entity
66 - */ 66 + */
67 - private void generateOperationRow(Row row) { 67 + private void generateOperationRow(Row row) {
68 - Collection<Column> columns = row.getColumns(); 68 + Collection<Column> columns = row.getColumns();
69 - for (Column column : columns) { 69 + for (Column column : columns) {
70 - String columnName = column.columnName(); 70 + String columnName = column.columnName();
71 - Object value = column.data(); 71 + Object value = column.data();
72 - Object formatValue = TransValueUtil.getFormatData(value); 72 + Object formatValue = TransValueUtil.getFormatData(value);
73 - this.row.put(columnName, formatValue); 73 + this.row.put(columnName, formatValue);
74 - } 74 + }
75 - } 75 + }
76 - 76 +
77 - /** 77 + /**
78 - * Returns the row member of update operation. 78 + * Returns the row member of update operation.
79 - * @return the row member of update operation 79 + * @return the row member of update operation
80 - */ 80 + */
81 - public Map<String, Object> getRow() { 81 + public Map<String, Object> getRow() {
82 - return row; 82 + return row;
83 - } 83 + }
84 - 84 +
85 - /** 85 + /**
86 - * Returns the where member of update operation. 86 + * Returns the where member of update operation.
87 - * @return the where member of update operation 87 + * @return the where member of update operation
88 - */ 88 + */
89 - public List<Condition> getWhere() { 89 + public List<Condition> getWhere() {
90 - return where; 90 + return where;
91 - } 91 + }
92 - 92 +
93 - @Override 93 + @Override
94 - public String getOp() { 94 + public String getOp() {
95 - return op; 95 + return op;
96 - } 96 + }
97 - 97 +
98 - @Override 98 + @Override
99 - public TableSchema getTableSchema() { 99 + public TableSchema getTableSchema() {
100 - return tableSchema; 100 + return tableSchema;
101 - } 101 + }
102 - 102 +
103 - /** 103 + /**
104 - * For the use of serialization. 104 + * For the use of serialization.
105 - * @return the table member of update operation 105 + * @return the table member of update operation
106 - */ 106 + */
107 - @JsonProperty 107 + @JsonProperty
108 - public String getTable() { 108 + public String getTable() {
109 - return tableSchema.name(); 109 + return tableSchema.name();
110 - } 110 + }
111 -} 111 +}
......
1 -/* 1 +/*
2 - * Copyright 2015 Open Networking Laboratory 2 + * Copyright 2015 Open Networking Laboratory
3 - * 3 + *
4 - * Licensed under the Apache License, Version 2.0 (the "License"); 4 + * Licensed under the Apache License, Version 2.0 (the "License");
5 - * you may not use this file except in compliance with 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 6 + * You may obtain a copy of the License at
7 - * 7 + *
8 - * http://www.apache.org/licenses/LICENSE-2.0 8 + * http://www.apache.org/licenses/LICENSE-2.0
9 - * 9 + *
10 - * Unless required by applicable law or agreed to in writing, software 10 + * Unless required by applicable law or agreed to in writing, software
11 - * distributed under the License is distributed on an "AS IS" BASIS, 11 + * distributed under the License is distributed on an "AS IS" BASIS,
12 - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 - * See the License for the specific language governing permissions and 13 + * See the License for the specific language governing permissions and
14 - * limitations under the License. 14 + * limitations under the License.
15 - */ 15 + */
16 -package org.onosproject.ovsdb.rfc.schema.type; 16 +package org.onosproject.ovsdb.rfc.schema.type;
17 - 17 +
18 -import org.onosproject.ovsdb.rfc.error.AbnormalJsonNodeException; 18 +import org.onosproject.ovsdb.rfc.error.AbnormalJsonNodeException;
19 -import org.onosproject.ovsdb.rfc.utils.ObjectMapperUtil; 19 +import org.onosproject.ovsdb.rfc.utils.ObjectMapperUtil;
20 - 20 +
21 -import com.fasterxml.jackson.databind.JsonNode; 21 +import com.fasterxml.jackson.databind.JsonNode;
22 - 22 +
23 -/** 23 +/**
24 - * ColumnType Factory class. 24 + * ColumnType Factory class.
25 - */ 25 + */
26 -public final class ColumnTypeFactory { 26 +public final class ColumnTypeFactory {
27 - 27 +
28 - /** 28 + /**
29 - * Constructs a ColumnTypeFactory object. This class should not be 29 + * Constructs a ColumnTypeFactory object. This class should not be
30 - * instantiated. 30 + * instantiated.
31 - */ 31 + */
32 - private ColumnTypeFactory() { 32 + private ColumnTypeFactory() {
33 - } 33 + }
34 - 34 +
35 - /** 35 + /**
36 - * Those Json's key/value pairs. 36 + * Those Json's key/value pairs.
37 - */ 37 + */
38 - public enum Type { 38 + public enum Type {
39 - KEY("key"), VALUE("value"); 39 + KEY("key"), VALUE("value");
40 - 40 +
41 - private final String type; 41 + private final String type;
42 - 42 +
43 - private Type(String type) { 43 + private Type(String type) {
44 - this.type = type; 44 + this.type = type;
45 - } 45 + }
46 - 46 +
47 - /** 47 + /**
48 - * Returns the type for Type. 48 + * Returns the type for Type.
49 - * @return the type 49 + * @return the type
50 - */ 50 + */
51 - public String type() { 51 + public String type() {
52 - return type; 52 + return type;
53 - } 53 + }
54 - } 54 + }
55 - 55 +
56 - /** 56 + /**
57 - * JsonNode like 57 + * JsonNode like
58 - * "flow_tables":{"type":{"key":{"maxInteger":254,"minInteger":0,"type": 58 + * "flow_tables":{"type":{"key":{"maxInteger":254,"minInteger":0,"type":
59 - * "integer"},"min":0,"value":{"type":"uuid","refTable":"Flow_Table"},"max": 59 + * "integer"},"min":0,"value":{"type":"uuid","refTable":"Flow_Table"},"max":
60 - * "unlimited"}}. 60 + * "unlimited"}}.
61 - * @param columnTypeJson the ColumnType JsonNode 61 + * @param columnTypeJson the ColumnType JsonNode
62 - * @return ColumnType 62 + * @return ColumnType
63 - */ 63 + */
64 - public static ColumnType getColumnTypeFromJson(JsonNode columnTypeJson) { 64 + public static ColumnType getColumnTypeFromJson(JsonNode columnTypeJson) {
65 - if (!columnTypeJson.isObject() || !columnTypeJson.has(Type.VALUE.type())) { 65 + if (!columnTypeJson.isObject() || !columnTypeJson.has(Type.VALUE.type())) {
66 - return createAtomicColumnType(columnTypeJson); 66 + return createAtomicColumnType(columnTypeJson);
67 - } else if (!columnTypeJson.isValueNode() && columnTypeJson.has(Type.VALUE.type())) { 67 + } else if (!columnTypeJson.isValueNode() && columnTypeJson.has(Type.VALUE.type())) {
68 - return createKeyValuedColumnType(columnTypeJson); 68 + return createKeyValuedColumnType(columnTypeJson);
69 - } 69 + }
70 - String message = "Abnormal ColumnType JsonNode, it should be AtomicColumnType or KeyValuedColumnType" 70 + String message = "Abnormal ColumnType JsonNode, it should be AtomicColumnType or KeyValuedColumnType"
71 - + ObjectMapperUtil.convertToString(columnTypeJson); 71 + + ObjectMapperUtil.convertToString(columnTypeJson);
72 - throw new AbnormalJsonNodeException(message); 72 + throw new AbnormalJsonNodeException(message);
73 - } 73 + }
74 - 74 +
75 - /** 75 + /**
76 - * Create AtomicColumnType entity. 76 + * Create AtomicColumnType entity.
77 - * @param json JsonNode 77 + * @param json JsonNode
78 - * @return AtomicColumnType entity 78 + * @return AtomicColumnType entity
79 - */ 79 + */
80 - private static AtomicColumnType createAtomicColumnType(JsonNode json) { 80 + private static AtomicColumnType createAtomicColumnType(JsonNode json) {
81 - BaseType baseType = BaseTypeFactory.getBaseTypeFromJson(json, Type.KEY.type()); 81 + BaseType baseType = BaseTypeFactory.getBaseTypeFromJson(json, Type.KEY.type());
82 - int min = 1; 82 + int min = 1;
83 - int max = 1; 83 + int max = 1;
84 - JsonNode node = json.get("min"); 84 + JsonNode node = json.get("min");
85 - if (node != null && node.isNumber()) { 85 + if (node != null && node.isNumber()) {
86 - min = node.asInt(); 86 + min = node.asInt();
87 - } 87 + }
88 - node = json.get("max"); 88 + node = json.get("max");
89 - if (node != null) { 89 + if (node != null) {
90 - if (node.isNumber()) { 90 + if (node.isNumber()) {
91 - max = node.asInt(); 91 + max = node.asInt();
92 - } else if (node.isTextual() && "unlimited".equals(node.asText())) { 92 + } else if (node.isTextual() && "unlimited".equals(node.asText())) {
93 - max = Integer.MAX_VALUE; 93 + max = Integer.MAX_VALUE;
94 - } 94 + }
95 - } 95 + }
96 - return new AtomicColumnType(baseType, min, max); 96 + return new AtomicColumnType(baseType, min, max);
97 - } 97 + }
98 - 98 +
99 - /** 99 + /**
100 - * Create KeyValuedColumnType entity. 100 + * Create KeyValuedColumnType entity.
101 - * @param json JsonNode 101 + * @param json JsonNode
102 - * @return KeyValuedColumnType entity 102 + * @return KeyValuedColumnType entity
103 - */ 103 + */
104 - private static KeyValuedColumnType createKeyValuedColumnType(JsonNode json) { 104 + private static KeyValuedColumnType createKeyValuedColumnType(JsonNode json) {
105 - BaseType keyType = BaseTypeFactory.getBaseTypeFromJson(json, Type.KEY.type()); 105 + BaseType keyType = BaseTypeFactory.getBaseTypeFromJson(json, Type.KEY.type());
106 - BaseType valueType = BaseTypeFactory.getBaseTypeFromJson(json, Type.VALUE.type()); 106 + BaseType valueType = BaseTypeFactory.getBaseTypeFromJson(json, Type.VALUE.type());
107 - int min = 1; 107 + int min = 1;
108 - int max = 1; 108 + int max = 1;
109 - JsonNode node = json.get("min"); 109 + JsonNode node = json.get("min");
110 - if (node != null && node.isNumber()) { 110 + if (node != null && node.isNumber()) {
111 - min = node.asInt(); 111 + min = node.asInt();
112 - } 112 + }
113 - node = json.get("max"); 113 + node = json.get("max");
114 - if (node != null) { 114 + if (node != null) {
115 - if (node.isNumber()) { 115 + if (node.isNumber()) {
116 - max = node.asInt(); 116 + max = node.asInt();
117 - } else if (node.isTextual() && "unlimited".equals(node.asText())) { 117 + } else if (node.isTextual() && "unlimited".equals(node.asText())) {
118 - max = Integer.MAX_VALUE; 118 + max = Integer.MAX_VALUE;
119 - } 119 + }
120 - } 120 + }
121 - return new KeyValuedColumnType(keyType, valueType, min, max); 121 + return new KeyValuedColumnType(keyType, valueType, min, max);
122 - } 122 + }
123 -} 123 +}
......
1 -/* 1 +/*
2 - * Copyright 2015 Open Networking Laboratory 2 + * Copyright 2015 Open Networking Laboratory
3 - * 3 + *
4 - * Licensed under the Apache License, Version 2.0 (the "License"); 4 + * Licensed under the Apache License, Version 2.0 (the "License");
5 - * you may not use this file except in compliance with 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 6 + * You may obtain a copy of the License at
7 - * 7 + *
8 - * http://www.apache.org/licenses/LICENSE-2.0 8 + * http://www.apache.org/licenses/LICENSE-2.0
9 - * 9 + *
10 - * Unless required by applicable law or agreed to in writing, software 10 + * Unless required by applicable law or agreed to in writing, software
11 - * distributed under the License is distributed on an "AS IS" BASIS, 11 + * distributed under the License is distributed on an "AS IS" BASIS,
12 - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 - * See the License for the specific language governing permissions and 13 + * See the License for the specific language governing permissions and
14 - * limitations under the License. 14 + * limitations under the License.
15 - */ 15 + */
16 -package org.onosproject.ovsdb.rfc.table; 16 +package org.onosproject.ovsdb.rfc.table;
17 - 17 +
18 -/** 18 +/**
19 - * Ovsdb table name. Refer to RFC7047's Section 9.2. 19 + * Ovsdb table name. Refer to RFC7047's Section 9.2.
20 - */ 20 + */
21 -public enum OvsdbTable { 21 +public enum OvsdbTable {
22 - INTERFACE("Interface"), BRIDGE("Bridge"), CONTROLLER("Controller"), 22 + INTERFACE("Interface"), BRIDGE("Bridge"), CONTROLLER("Controller"),
23 - PORT("Port"), OPENVSWITCH("Open_vSwitch"), FLWTABLE("Flow_Table"), 23 + PORT("Port"), OPENVSWITCH("Open_vSwitch"), FLWTABLE("Flow_Table"),
24 - QOS("Qos"), QUEUE("Queue"), MIRROR("Mirror"), MANAGER("Manager"), 24 + QOS("Qos"), QUEUE("Queue"), MIRROR("Mirror"), MANAGER("Manager"),
25 - NETFLOW("NetFlow"), SSL("SSL"), SFLOW("sFlow"), IPFIX("IPFIX"), 25 + NETFLOW("NetFlow"), SSL("SSL"), SFLOW("sFlow"), IPFIX("IPFIX"),
26 - FLOWSAMPLECOLLECTORSET("Flow_Sample_Collector_Set"); 26 + FLOWSAMPLECOLLECTORSET("Flow_Sample_Collector_Set");
27 - 27 +
28 - private final String tableName; 28 + private final String tableName;
29 - 29 +
30 - private OvsdbTable(String tableName) { 30 + private OvsdbTable(String tableName) {
31 - this.tableName = tableName; 31 + this.tableName = tableName;
32 - } 32 + }
33 - 33 +
34 - /** 34 + /**
35 - * Returns the table name for OvsdbTable. 35 + * Returns the table name for OvsdbTable.
36 - * @return the table name 36 + * @return the table name
37 - */ 37 + */
38 - public String tableName() { 38 + public String tableName() {
39 - return tableName; 39 + return tableName;
40 - } 40 + }
41 -} 41 +}
......
1 -/* 1 +/*
2 - * Copyright 2015 Open Networking Laboratory 2 + * Copyright 2015 Open Networking Laboratory
3 - * 3 + *
4 - * Licensed under the Apache License, Version 2.0 (the "License"); 4 + * Licensed under the Apache License, Version 2.0 (the "License");
5 - * you may not use this file except in compliance with 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 6 + * You may obtain a copy of the License at
7 - * 7 + *
8 - * http://www.apache.org/licenses/LICENSE-2.0 8 + * http://www.apache.org/licenses/LICENSE-2.0
9 - * 9 + *
10 - * Unless required by applicable law or agreed to in writing, software 10 + * Unless required by applicable law or agreed to in writing, software
11 - * distributed under the License is distributed on an "AS IS" BASIS, 11 + * distributed under the License is distributed on an "AS IS" BASIS,
12 - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 - * See the License for the specific language governing permissions and 13 + * See the License for the specific language governing permissions and
14 - * limitations under the License. 14 + * limitations under the License.
15 - */ 15 + */
16 -package org.onosproject.ovsdb.rfc.table; 16 +package org.onosproject.ovsdb.rfc.table;
17 - 17 +
18 -/** 18 +/**
19 - * The version number of tables and columns. 19 + * The version number of tables and columns.
20 - */ 20 + */
21 -public enum VersionNum { 21 +public enum VersionNum {
22 - VERSION100("1.0.0"), VERSION102("1.0.2"), VERSION103("1.0.3"), 22 + VERSION100("1.0.0"), VERSION102("1.0.2"), VERSION103("1.0.3"),
23 - VERSION104("1.0.4"), VERSION106("1.0.6"), VERSION110("1.1.0"), 23 + VERSION104("1.0.4"), VERSION106("1.0.6"), VERSION110("1.1.0"),
24 - VERSION130("1.3.0"), VERSION200("2.0.0"), VERSION300("3.0.0"), 24 + VERSION130("1.3.0"), VERSION200("2.0.0"), VERSION300("3.0.0"),
25 - VERSION330("3.3.0"), VERSION350("3.5.0"), VERSION400("4.0.0"), 25 + VERSION330("3.3.0"), VERSION350("3.5.0"), VERSION400("4.0.0"),
26 - VERSION510("5.1.0"), VERSION520("5.2.0"), VERSION600("6.0.0"), 26 + VERSION510("5.1.0"), VERSION520("5.2.0"), VERSION600("6.0.0"),
27 - VERSION610("6.1.0"), VERSION620("6.2.0"), VERSION630("6.3.0"), 27 + VERSION610("6.1.0"), VERSION620("6.2.0"), VERSION630("6.3.0"),
28 - VERSION640("6.4.0"), VERSION650("6.5.0"), VERSION660("6.6.0"), 28 + VERSION640("6.4.0"), VERSION650("6.5.0"), VERSION660("6.6.0"),
29 - VERSION670("6.7.0"), VERSION680("6.8.0"), VERSION690("6.9.0"), 29 + VERSION670("6.7.0"), VERSION680("6.8.0"), VERSION690("6.9.0"),
30 - VERSION6100("6.10.0"), VERSION6111("6.11.1"), VERSION710("7.1.0"), 30 + VERSION6100("6.10.0"), VERSION6111("6.11.1"), VERSION710("7.1.0"),
31 - VERSION720("7.2.0"), VERSION721("7.2.1"), VERSION730("7.3.0"), 31 + VERSION720("7.2.0"), VERSION721("7.2.1"), VERSION730("7.3.0"),
32 - VERSION740("7.4.0"), VERSION750("7.5.0"), VERSION770("7.7.0"); 32 + VERSION740("7.4.0"), VERSION750("7.5.0"), VERSION770("7.7.0");
33 - 33 +
34 - private final String versionNum; 34 + private final String versionNum;
35 - 35 +
36 - private VersionNum(String versionNum) { 36 + private VersionNum(String versionNum) {
37 - this.versionNum = versionNum; 37 + this.versionNum = versionNum;
38 - } 38 + }
39 - 39 +
40 - /** 40 + /**
41 - * Returns the version number for VersionNum. 41 + * Returns the version number for VersionNum.
42 - * @return the version number 42 + * @return the version number
43 - */ 43 + */
44 - public String versionNum() { 44 + public String versionNum() {
45 - return versionNum; 45 + return versionNum;
46 - } 46 + }
47 -} 47 +}
......
1 -/* 1 +/*
2 - * Copyright 2015 Open Networking Laboratory 2 + * Copyright 2015 Open Networking Laboratory
3 - * 3 + *
4 - * Licensed under the Apache License, Version 2.0 (the "License"); 4 + * Licensed under the Apache License, Version 2.0 (the "License");
5 - * you may not use this file except in compliance with 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 6 + * You may obtain a copy of the License at
7 - * 7 + *
8 - * http://www.apache.org/licenses/LICENSE-2.0 8 + * http://www.apache.org/licenses/LICENSE-2.0
9 - * 9 + *
10 - * Unless required by applicable law or agreed to in writing, software 10 + * Unless required by applicable law or agreed to in writing, software
11 - * distributed under the License is distributed on an "AS IS" BASIS, 11 + * distributed under the License is distributed on an "AS IS" BASIS,
12 - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 - * See the License for the specific language governing permissions and 13 + * See the License for the specific language governing permissions and
14 - * limitations under the License. 14 + * limitations under the License.
15 - */ 15 + */
16 -package org.onosproject.ovsdb.rfc.tableservice; 16 +package org.onosproject.ovsdb.rfc.tableservice;
17 - 17 +
18 -import org.onosproject.ovsdb.rfc.notation.Column; 18 +import org.onosproject.ovsdb.rfc.notation.Column;
19 -import org.onosproject.ovsdb.rfc.notation.UUID; 19 +import org.onosproject.ovsdb.rfc.notation.UUID;
20 - 20 +
21 -/** 21 +/**
22 - * Representation of conversion between Ovsdb table and Row. 22 + * Representation of conversion between Ovsdb table and Row.
23 - */ 23 + */
24 -public interface OvsdbTableService { 24 +public interface OvsdbTableService {
25 - 25 +
26 - /** 26 + /**
27 - * Get Column from row. 27 + * Get Column from row.
28 - * @param columndesc Column description 28 + * @param columndesc Column description
29 - * @return Column 29 + * @return Column
30 - */ 30 + */
31 - public Column getColumnHandler(ColumnDescription columndesc); 31 + public Column getColumnHandler(ColumnDescription columndesc);
32 - 32 +
33 - /** 33 + /**
34 - * Get Data from row. 34 + * Get Data from row.
35 - * @param columndesc Column description 35 + * @param columndesc Column description
36 - * @return Object column data 36 + * @return Object column data
37 - */ 37 + */
38 - public Object getDataHandler(ColumnDescription columndesc); 38 + public Object getDataHandler(ColumnDescription columndesc);
39 - 39 +
40 - /** 40 + /**
41 - * Set column data of row. 41 + * Set column data of row.
42 - * @param columndesc Column description 42 + * @param columndesc Column description
43 - * @param obj column data 43 + * @param obj column data
44 - */ 44 + */
45 - public void setDataHandler(ColumnDescription columndesc, Object obj); 45 + public void setDataHandler(ColumnDescription columndesc, Object obj);
46 - 46 +
47 - /** 47 + /**
48 - * Returns UUID which column name is _uuid. 48 + * Returns UUID which column name is _uuid.
49 - * @return UUID 49 + * @return UUID
50 - */ 50 + */
51 - public UUID getTableUuid(); 51 + public UUID getTableUuid();
52 - 52 +
53 - /** 53 + /**
54 - * Returns UUID Column which column name is _uuid. 54 + * Returns UUID Column which column name is _uuid.
55 - * @return UUID Column 55 + * @return UUID Column
56 - */ 56 + */
57 - public Column getTableUuidColumn(); 57 + public Column getTableUuidColumn();
58 - 58 +
59 - /** 59 + /**
60 - * Returns UUID which column name is _version. 60 + * Returns UUID which column name is _version.
61 - * @return UUID 61 + * @return UUID
62 - */ 62 + */
63 - public UUID getTableVersion(); 63 + public UUID getTableVersion();
64 - 64 +
65 - /** 65 + /**
66 - * Returns UUID Column which column name is _version. 66 + * Returns UUID Column which column name is _version.
67 - * @return UUID Column 67 + * @return UUID Column
68 - */ 68 + */
69 - public Column getTableVersionColumn(); 69 + public Column getTableVersionColumn();
70 -} 70 +}
......
1 -package org.onosproject.ovsdb.rfc.utils; 1 +package org.onosproject.ovsdb.rfc.utils;
2 - 2 +
3 -import org.onosproject.ovsdb.rfc.notation.Mutation; 3 +import org.onosproject.ovsdb.rfc.notation.Mutation;
4 -import org.onosproject.ovsdb.rfc.notation.Mutation.Mutator; 4 +import org.onosproject.ovsdb.rfc.notation.Mutation.Mutator;
5 - 5 +
6 -public final class MutationUtil { 6 +public final class MutationUtil {
7 - 7 +
8 - /** 8 + /**
9 - * Constructs a MutationUtil object. Utility classes should not have a 9 + * Constructs a MutationUtil object. Utility classes should not have a
10 - * public or default constructor, otherwise IDE will compile unsuccessfully. This 10 + * public or default constructor, otherwise IDE will compile unsuccessfully. This
11 - * class should not be instantiated. 11 + * class should not be instantiated.
12 - */ 12 + */
13 - private MutationUtil() { 13 + private MutationUtil() {
14 - } 14 + }
15 - 15 +
16 - /** 16 + /**
17 - * Returns a Mutation that means += . 17 + * Returns a Mutation that means += .
18 - * @param columnName column name 18 + * @param columnName column name
19 - * @param data column value 19 + * @param data column value
20 - * @return Mutation 20 + * @return Mutation
21 - */ 21 + */
22 - public static Mutation sum(String columnName, Object data) { 22 + public static Mutation sum(String columnName, Object data) {
23 - Object value = TransValueUtil.getFormatData(data); 23 + Object value = TransValueUtil.getFormatData(data);
24 - return new Mutation(columnName, Mutator.SUM, value); 24 + return new Mutation(columnName, Mutator.SUM, value);
25 - } 25 + }
26 - 26 +
27 - /** 27 + /**
28 - * Returns a Mutation that means -= . 28 + * Returns a Mutation that means -= .
29 - * @param columnName column name 29 + * @param columnName column name
30 - * @param data column value 30 + * @param data column value
31 - * @return Mutation 31 + * @return Mutation
32 - */ 32 + */
33 - public static Mutation difference(String columnName, Object data) { 33 + public static Mutation difference(String columnName, Object data) {
34 - Object value = TransValueUtil.getFormatData(data); 34 + Object value = TransValueUtil.getFormatData(data);
35 - return new Mutation(columnName, Mutator.DIFFERENCE, value); 35 + return new Mutation(columnName, Mutator.DIFFERENCE, value);
36 - } 36 + }
37 - 37 +
38 - /** 38 + /**
39 - * Returns a Mutation that means *= . 39 + * Returns a Mutation that means *= .
40 - * @param columnName column name 40 + * @param columnName column name
41 - * @param data column value 41 + * @param data column value
42 - * @return Mutation 42 + * @return Mutation
43 - */ 43 + */
44 - public static Mutation product(String columnName, Object data) { 44 + public static Mutation product(String columnName, Object data) {
45 - Object value = TransValueUtil.getFormatData(data); 45 + Object value = TransValueUtil.getFormatData(data);
46 - return new Mutation(columnName, Mutator.PRODUCT, value); 46 + return new Mutation(columnName, Mutator.PRODUCT, value);
47 - } 47 + }
48 - 48 +
49 - /** 49 + /**
50 - * Returns a Mutation that means /= . 50 + * Returns a Mutation that means /= .
51 - * @param columnName column name 51 + * @param columnName column name
52 - * @param data column value 52 + * @param data column value
53 - * @return Mutation 53 + * @return Mutation
54 - */ 54 + */
55 - public static Mutation quotient(String columnName, Object data) { 55 + public static Mutation quotient(String columnName, Object data) {
56 - Object value = TransValueUtil.getFormatData(data); 56 + Object value = TransValueUtil.getFormatData(data);
57 - return new Mutation(columnName, Mutator.QUOTIENT, value); 57 + return new Mutation(columnName, Mutator.QUOTIENT, value);
58 - } 58 + }
59 - 59 +
60 - /** 60 + /**
61 - * Returns a Mutation that means %= . 61 + * Returns a Mutation that means %= .
62 - * @param columnName column name 62 + * @param columnName column name
63 - * @param data column value 63 + * @param data column value
64 - * @return Mutation 64 + * @return Mutation
65 - */ 65 + */
66 - public static Mutation remainder(String columnName, Object data) { 66 + public static Mutation remainder(String columnName, Object data) {
67 - Object value = TransValueUtil.getFormatData(data); 67 + Object value = TransValueUtil.getFormatData(data);
68 - return new Mutation(columnName, Mutator.REMAINDER, value); 68 + return new Mutation(columnName, Mutator.REMAINDER, value);
69 - } 69 + }
70 - 70 +
71 - /** 71 + /**
72 - * Returns a Mutation that means insert . 72 + * Returns a Mutation that means insert .
73 - * @param columnName column name 73 + * @param columnName column name
74 - * @param data column value 74 + * @param data column value
75 - * @return Mutation 75 + * @return Mutation
76 - */ 76 + */
77 - public static Mutation insert(String columnName, Object data) { 77 + public static Mutation insert(String columnName, Object data) {
78 - Object value = TransValueUtil.getFormatData(data); 78 + Object value = TransValueUtil.getFormatData(data);
79 - return new Mutation(columnName, Mutator.INSERT, value); 79 + return new Mutation(columnName, Mutator.INSERT, value);
80 - } 80 + }
81 - 81 +
82 - /** 82 + /**
83 - * Returns a Mutation that means delete . 83 + * Returns a Mutation that means delete .
84 - * @param columnName column name 84 + * @param columnName column name
85 - * @param data column value 85 + * @param data column value
86 - * @return Mutation 86 + * @return Mutation
87 - */ 87 + */
88 - public static Mutation delete(String columnName, Object data) { 88 + public static Mutation delete(String columnName, Object data) {
89 - Object value = TransValueUtil.getFormatData(data); 89 + Object value = TransValueUtil.getFormatData(data);
90 - return new Mutation(columnName, Mutator.DELETE, value); 90 + return new Mutation(columnName, Mutator.DELETE, value);
91 - } 91 + }
92 -} 92 +}
......
1 -/* 1 +/*
2 - * Copyright 2015 Open Networking Laboratory 2 + * Copyright 2015 Open Networking Laboratory
3 - * 3 + *
4 - * Licensed under the Apache License, Version 2.0 (the "License"); 4 + * Licensed under the Apache License, Version 2.0 (the "License");
5 - * you may not use this file except in compliance with 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 6 + * You may obtain a copy of the License at
7 - * 7 + *
8 - * http://www.apache.org/licenses/LICENSE-2.0 8 + * http://www.apache.org/licenses/LICENSE-2.0
9 - * 9 + *
10 - * Unless required by applicable law or agreed to in writing, software 10 + * Unless required by applicable law or agreed to in writing, software
11 - * distributed under the License is distributed on an "AS IS" BASIS, 11 + * distributed under the License is distributed on an "AS IS" BASIS,
12 - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 - * See the License for the specific language governing permissions and 13 + * See the License for the specific language governing permissions and
14 - * limitations under the License. 14 + * limitations under the License.
15 - */ 15 + */
16 -package org.onosproject.ovsdb.rfc.utils; 16 +package org.onosproject.ovsdb.rfc.utils;
17 - 17 +
18 -import java.util.List; 18 +import java.util.List;
19 -import java.util.Map; 19 +import java.util.Map;
20 -import java.util.Set; 20 +import java.util.Set;
21 - 21 +
22 -import org.onosproject.ovsdb.rfc.message.MonitorRequest; 22 +import org.onosproject.ovsdb.rfc.message.MonitorRequest;
23 -import org.onosproject.ovsdb.rfc.message.MonitorSelect; 23 +import org.onosproject.ovsdb.rfc.message.MonitorSelect;
24 -import org.onosproject.ovsdb.rfc.operations.Operation; 24 +import org.onosproject.ovsdb.rfc.operations.Operation;
25 -import org.onosproject.ovsdb.rfc.schema.DatabaseSchema; 25 +import org.onosproject.ovsdb.rfc.schema.DatabaseSchema;
26 -import org.onosproject.ovsdb.rfc.schema.TableSchema; 26 +import org.onosproject.ovsdb.rfc.schema.TableSchema;
27 - 27 +
28 -import com.google.common.collect.Lists; 28 +import com.google.common.collect.Lists;
29 -import com.google.common.collect.Maps; 29 +import com.google.common.collect.Maps;
30 - 30 +
31 -/** 31 +/**
32 - * Params utility class. Params of the request object, refer to RFC7047's 32 + * Params utility class. Params of the request object, refer to RFC7047's
33 - * Section 4.1. 33 + * Section 4.1.
34 - */ 34 + */
35 -public final class ParamUtil { 35 +public final class ParamUtil {
36 - 36 +
37 - /** 37 + /**
38 - * Constructs a ParamUtil object. Utility classes should not have a public 38 + * Constructs a ParamUtil object. Utility classes should not have a public
39 - * or default constructor, otherwise IDE will compile unsuccessfully. This 39 + * or default constructor, otherwise IDE will compile unsuccessfully. This
40 - * class should not be instantiated. 40 + * class should not be instantiated.
41 - */ 41 + */
42 - private ParamUtil() { 42 + private ParamUtil() {
43 - } 43 + }
44 - 44 +
45 - /** 45 + /**
46 - * Returns MonitorRequest, refer to RFC7047's Section 4.1.5. 46 + * Returns MonitorRequest, refer to RFC7047's Section 4.1.5.
47 - * @param tableSchema entity 47 + * @param tableSchema entity
48 - * @return MonitorRequest 48 + * @return MonitorRequest
49 - */ 49 + */
50 - private static MonitorRequest getAllColumnsMonitorRequest(TableSchema tableSchema) { 50 + private static MonitorRequest getAllColumnsMonitorRequest(TableSchema tableSchema) {
51 - String tableName = tableSchema.name(); 51 + String tableName = tableSchema.name();
52 - Set<String> columns = tableSchema.getColumnNames(); 52 + Set<String> columns = tableSchema.getColumnNames();
53 - MonitorSelect select = new MonitorSelect(true, true, true, true); 53 + MonitorSelect select = new MonitorSelect(true, true, true, true);
54 - MonitorRequest monitorRequest = new MonitorRequest(tableName, columns, select); 54 + MonitorRequest monitorRequest = new MonitorRequest(tableName, columns, select);
55 - return monitorRequest; 55 + return monitorRequest;
56 - } 56 + }
57 - 57 +
58 - /** 58 + /**
59 - * Returns params of monitor method, refer to RFC7047's Section 4.1.5. 59 + * Returns params of monitor method, refer to RFC7047's Section 4.1.5.
60 - * @param monotorId json-value, refer to RFC7047's Section 4.1.5. 60 + * @param monotorId json-value, refer to RFC7047's Section 4.1.5.
61 - * @param dbSchema DatabaseSchema entity 61 + * @param dbSchema DatabaseSchema entity
62 - * @return List of Object, the params of monitor request 62 + * @return List of Object, the params of monitor request
63 - */ 63 + */
64 - public static List<Object> getMonitorParams(String monotorId, DatabaseSchema dbSchema) { 64 + public static List<Object> getMonitorParams(String monotorId, DatabaseSchema dbSchema) {
65 - Set<String> tables = dbSchema.getTableNames(); 65 + Set<String> tables = dbSchema.getTableNames();
66 - Map<String, MonitorRequest> mrMap = Maps.newHashMap(); 66 + Map<String, MonitorRequest> mrMap = Maps.newHashMap();
67 - for (String tableName : tables) { 67 + for (String tableName : tables) {
68 - TableSchema tableSchema = dbSchema.getTableSchema(tableName); 68 + TableSchema tableSchema = dbSchema.getTableSchema(tableName);
69 - MonitorRequest monitorRequest = getAllColumnsMonitorRequest(tableSchema); 69 + MonitorRequest monitorRequest = getAllColumnsMonitorRequest(tableSchema);
70 - mrMap.put(tableName, monitorRequest); 70 + mrMap.put(tableName, monitorRequest);
71 - } 71 + }
72 - return Lists.newArrayList(dbSchema.name(), monotorId, mrMap); 72 + return Lists.newArrayList(dbSchema.name(), monotorId, mrMap);
73 - } 73 + }
74 - 74 +
75 - /** 75 + /**
76 - * Returns params of transact method, refer to RFC7047's Section 4.1.3. 76 + * Returns params of transact method, refer to RFC7047's Section 4.1.3.
77 - * @param dbSchema DatabaseSchema entity 77 + * @param dbSchema DatabaseSchema entity
78 - * @param operations operation*, refer to RFC7047's Section 4.1.3. 78 + * @param operations operation*, refer to RFC7047's Section 4.1.3.
79 - * @return List of Object, the params of transact request 79 + * @return List of Object, the params of transact request
80 - */ 80 + */
81 - public static List<Object> getTransactParams(DatabaseSchema dbSchema, List<Operation> operations) { 81 + public static List<Object> getTransactParams(DatabaseSchema dbSchema, List<Operation> operations) {
82 - List<Object> lists = Lists.newArrayList(dbSchema.name()); 82 + List<Object> lists = Lists.newArrayList(dbSchema.name());
83 - lists.addAll(operations); 83 + lists.addAll(operations);
84 - return lists; 84 + return lists;
85 - } 85 + }
86 -} 86 +}
......