diff options
Diffstat (limited to 'framework/src/onos/protocols/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/notation')
17 files changed, 0 insertions, 1161 deletions
diff --git a/framework/src/onos/protocols/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/notation/Column.java b/framework/src/onos/protocols/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/notation/Column.java deleted file mode 100644 index 60f49442..00000000 --- a/framework/src/onos/protocols/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/notation/Column.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Copyright 2015 Open Networking Laboratory - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onosproject.ovsdb.rfc.notation; - -import static com.google.common.base.MoreObjects.toStringHelper; -import static com.google.common.base.Preconditions.checkNotNull; - -import java.util.Objects; - -/** - * Column is the basic element of the OpenVswitch database. - */ -public final class Column { - private final String columnName; - private final Object data; - - /** - * Column constructor. - * @param columnName the column name - * @param obj the data of the column - */ - public Column(String columnName, Object obj) { - checkNotNull(columnName, "columnName cannot be null"); - checkNotNull(obj, "data cannot be null"); - this.columnName = columnName; - this.data = obj; - } - - /** - * Returns column data. - * @return column data - */ - public Object data() { - return data; - } - - /** - * Returns columnName. - * @return columnName - */ - public String columnName() { - return columnName; - } - - @Override - public int hashCode() { - return Objects.hash(columnName, data); - } - - @Override - public boolean equals(Object obj) { - if (this == obj) { - return true; - } - if (obj instanceof Column) { - final Column other = (Column) obj; - return Objects.equals(this.columnName, other.columnName) - && Objects.equals(this.data, other.data); - } - return false; - } - - @Override - public String toString() { - return toStringHelper(this).add("columnName", columnName) - .add("data", data).toString(); - } -} diff --git a/framework/src/onos/protocols/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/notation/Condition.java b/framework/src/onos/protocols/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/notation/Condition.java deleted file mode 100644 index cbf35424..00000000 --- a/framework/src/onos/protocols/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/notation/Condition.java +++ /dev/null @@ -1,123 +0,0 @@ -/* - * Copyright 2015 Open Networking Laboratory - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onosproject.ovsdb.rfc.notation; - -import static com.google.common.base.MoreObjects.toStringHelper; -import static com.google.common.base.Preconditions.checkNotNull; - -import java.util.Objects; - -import org.onosproject.ovsdb.rfc.notation.json.ConditionSerializer; - -import com.fasterxml.jackson.databind.annotation.JsonSerialize; - -/** - * Condition is a 3-element JSON array of the form [column, function, value] - * that represents a test on a column value. - */ -@JsonSerialize(using = ConditionSerializer.class) -public final class Condition { - /** - * Function of Notation. Refer to RFC 7047 Section 5.1. - */ - public enum Function { - LESS_THAN("<"), LESS_THAN_OR_EQUALS("<="), EQUALS("=="), - NOT_EQUALS("!="), GREATER_THAN(">"), GREATER_THAN_OR_EQUALS(">="), - INCLUDES("includes"), EXCLUDES("excludes"); - - private final String function; - - private Function(String function) { - this.function = function; - } - - /** - * Returns the function for Function. - * @return the function - */ - public String function() { - return function; - } - } - - private final String column; - private final Function function; - private final Object value; - - /** - * Constructs a Condition object. - * @param column the column name - * @param function Function - * @param value column data - */ - public Condition(String column, Function function, Object value) { - checkNotNull(column, "column cannot be null"); - checkNotNull(function, "function cannot be null"); - checkNotNull(value, "value cannot be null"); - this.column = column; - this.function = function; - this.value = value; - } - - /** - * Returns column name. - * @return column name - */ - public String getColumn() { - return column; - } - - /** - * Returns Function. - * @return Function - */ - public Function getFunction() { - return function; - } - - /** - * Returns column data. - * @return column data - */ - public Object getValue() { - return value; - } - - @Override - public int hashCode() { - return Objects.hash(column, function, value); - } - - @Override - public boolean equals(Object obj) { - if (this == obj) { - return true; - } - if (obj instanceof Condition) { - final Condition other = (Condition) obj; - return Objects.equals(this.column, other.column) - && Objects.equals(this.function, other.function) - && Objects.equals(this.value, other.value); - } - return false; - } - - @Override - public String toString() { - return toStringHelper(this).add("column", column) - .add("function", function).add("value", value).toString(); - } -} diff --git a/framework/src/onos/protocols/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/notation/Mutation.java b/framework/src/onos/protocols/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/notation/Mutation.java deleted file mode 100644 index 5b5293c2..00000000 --- a/framework/src/onos/protocols/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/notation/Mutation.java +++ /dev/null @@ -1,124 +0,0 @@ -/* - * Copyright 2015 Open Networking Laboratory - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onosproject.ovsdb.rfc.notation; - -import static com.google.common.base.MoreObjects.toStringHelper; -import static com.google.common.base.Preconditions.checkNotNull; - -import java.util.Objects; - -import org.onosproject.ovsdb.rfc.notation.json.MutationSerializer; - -import com.fasterxml.jackson.databind.annotation.JsonSerialize; - -/** - * Mutation is s 3-element JSON array of the form [column, mutator, value] that - * represents a change to a column value. - */ -@JsonSerialize(using = MutationSerializer.class) -public final class Mutation { - /** - * Mutator must be "+=", "-=", "*=", "/=", or (integer only) "%=". The value - * of column is changed to the sum, difference, product, quotient, or - * remainder, respectively, of column and value. - */ - public enum Mutator { - SUM("+="), DIFFERENCE("-="), PRODUCT("*="), QUOTIENT("/="), - REMAINDER("%="), INSERT("insert"), DELETE("delete"); - - private final String mutator; - - private Mutator(String mutator) { - this.mutator = mutator; - } - - /** - * Returns the mutator for Mutator. - * @return the mutator - */ - public String mutator() { - return mutator; - } - } - - private final String column; - private final Mutator mutator; - private final Object value; - - /** - * Mutation constructor. - * @param column the column name - * @param mutator Mutator - * @param value column data - */ - public Mutation(String column, Mutator mutator, Object value) { - checkNotNull(column, "column cannot be null"); - checkNotNull(mutator, "mutator cannot be null"); - checkNotNull(value, "value cannot be null"); - this.column = column; - this.mutator = mutator; - this.value = value; - } - - /** - * Returns column name. - * @return column name - */ - public String getColumn() { - return column; - } - - /** - * Returns Mutator. - * @return Mutator - */ - public Mutator getMutator() { - return mutator; - } - - /** - * Returns column data. - * @return column data - */ - public Object getValue() { - return value; - } - - @Override - public int hashCode() { - return Objects.hash(column, mutator, value); - } - - @Override - public boolean equals(Object obj) { - if (this == obj) { - return true; - } - if (obj instanceof Mutation) { - final Mutation other = (Mutation) obj; - return Objects.equals(this.column, other.column) - && Objects.equals(this.mutator, other.mutator) - && Objects.equals(this.value, other.value); - } - return false; - } - - @Override - public String toString() { - return toStringHelper(this).add("column", column) - .add("mutator", mutator).add("value", value).toString(); - } -} diff --git a/framework/src/onos/protocols/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/notation/OvsdbMap.java b/framework/src/onos/protocols/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/notation/OvsdbMap.java deleted file mode 100644 index a62ab0db..00000000 --- a/framework/src/onos/protocols/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/notation/OvsdbMap.java +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Copyright 2015 Open Networking Laboratory - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onosproject.ovsdb.rfc.notation; - -import static com.google.common.base.MoreObjects.toStringHelper; -import static com.google.common.base.Preconditions.checkNotNull; - -import java.util.Map; -import java.util.Objects; - -import org.onosproject.ovsdb.rfc.notation.json.OvsdbMapSerializer; - -import com.fasterxml.jackson.databind.annotation.JsonSerialize; - -/** - * OvsdbMap is a 2-element JSON array that represents a database map value. - */ -@JsonSerialize(using = OvsdbMapSerializer.class) -public final class OvsdbMap { - - private final Map map; - - /** - * OvsdbMap constructor. - * @param map java.util.Map - */ - private OvsdbMap(Map map) { - checkNotNull(map, "map cannot be null"); - this.map = map; - } - - /** - * Returns map. - * @return map - */ - public Map map() { - return map; - } - - /** - * convert Map into OvsdbMap. - * @param map java.util.Map - * @return OvsdbMap - */ - public static OvsdbMap ovsdbMap(Map map) { - return new OvsdbMap(map); - } - - @Override - public int hashCode() { - return map.hashCode(); - } - - @Override - public boolean equals(Object obj) { - if (this == obj) { - return true; - } - if (obj instanceof OvsdbMap) { - final OvsdbMap other = (OvsdbMap) obj; - return Objects.equals(this.map, other.map); - } - return false; - } - - @Override - public String toString() { - return toStringHelper(this).add("map", map).toString(); - } -} diff --git a/framework/src/onos/protocols/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/notation/OvsdbSet.java b/framework/src/onos/protocols/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/notation/OvsdbSet.java deleted file mode 100644 index 21f0b72b..00000000 --- a/framework/src/onos/protocols/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/notation/OvsdbSet.java +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Copyright 2015 Open Networking Laboratory - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onosproject.ovsdb.rfc.notation; - -import static com.google.common.base.MoreObjects.toStringHelper; -import static com.google.common.base.Preconditions.checkNotNull; - -import java.util.Objects; -import java.util.Set; - -import org.onosproject.ovsdb.rfc.notation.json.OvsdbSetSerializer; - -import com.fasterxml.jackson.databind.annotation.JsonSerialize; - -/** - * OvsdbSet is either an atom, representing a set with exactly one element, or - * a 2-element JSON array that represents a database set value. - * - */ -@JsonSerialize(using = OvsdbSetSerializer.class) -public final class OvsdbSet { - - private final Set set; - - /** - * OvsdbSet constructor. - * @param set java.util.Set - */ - private OvsdbSet(Set set) { - checkNotNull(set, "set cannot be null"); - this.set = set; - } - - /** - * Returns set. - * @return set - */ - public Set set() { - return set; - } - - /** - * convert Set into OvsdbSet. - * @param set java.util.Set - * @return OvsdbSet - */ - public static OvsdbSet ovsdbSet(Set set) { - return new OvsdbSet(set); - } - - @Override - public int hashCode() { - return set.hashCode(); - } - - @Override - public boolean equals(Object obj) { - if (this == obj) { - return true; - } - if (obj instanceof OvsdbSet) { - final OvsdbSet other = (OvsdbSet) obj; - return Objects.equals(this.set, other.set); - } - return false; - } - - @Override - public String toString() { - return toStringHelper(this).add("set", set).toString(); - } -} diff --git a/framework/src/onos/protocols/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/notation/RefTableRow.java b/framework/src/onos/protocols/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/notation/RefTableRow.java deleted file mode 100644 index 1b22a426..00000000 --- a/framework/src/onos/protocols/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/notation/RefTableRow.java +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Copyright 2015 Open Networking Laboratory - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onosproject.ovsdb.rfc.notation; - -import static com.google.common.base.MoreObjects.toStringHelper; -import static com.google.common.base.Preconditions.checkNotNull; - -import java.util.Objects; - -import com.fasterxml.jackson.databind.JsonNode; - -/** - * The RefTable type that can be expanded to Row. Refer to RFC 7047 Section 3.2. - */ -public final class RefTableRow { - - private final String refTable; - private final JsonNode jsonNode; - - /** - * RefTableRow constructor. - * @param refTable the refTable value of JsonNode - * @param jsonNode JsonNode - */ - public RefTableRow(String refTable, JsonNode jsonNode) { - checkNotNull(refTable, "refTable cannot be null"); - checkNotNull(jsonNode, "jsonNode cannot be null"); - this.refTable = refTable; - this.jsonNode = jsonNode; - } - - /** - * Returns JsonNode. - * @return JsonNode - */ - public JsonNode jsonNode() { - return jsonNode; - } - - /** - * Returns refTable. - * @return refTable - */ - public String refTable() { - return refTable; - } - - @Override - public int hashCode() { - return Objects.hash(refTable, jsonNode); - } - - @Override - public boolean equals(Object obj) { - if (this == obj) { - return true; - } - if (obj instanceof RefTableRow) { - final RefTableRow other = (RefTableRow) obj; - return Objects.equals(this.refTable, other.refTable) - && Objects.equals(this.jsonNode, other.jsonNode); - } - return false; - } - - @Override - public String toString() { - return toStringHelper(this).add("refTable", refTable) - .add("jsonNode", jsonNode).toString(); - } -} diff --git a/framework/src/onos/protocols/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/notation/Row.java b/framework/src/onos/protocols/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/notation/Row.java deleted file mode 100644 index 09088766..00000000 --- a/framework/src/onos/protocols/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/notation/Row.java +++ /dev/null @@ -1,159 +0,0 @@ -/* - * Copyright 2015 Open Networking Laboratory - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onosproject.ovsdb.rfc.notation; - -import com.google.common.collect.Maps; - -import java.util.Collection; -import java.util.Map; -import java.util.Objects; - -import static com.google.common.base.MoreObjects.toStringHelper; -import static com.google.common.base.Preconditions.checkNotNull; - -/** - * Row is the basic element of the OpenVswitch's table. - */ -public final class Row { - private String tableName; - private UUID uuid; - private Map<String, Column> columns; - - /** - * Row constructor. - */ - public Row() { - this.columns = Maps.newHashMap(); - } - - /** - * Row constructor. - * - * @param tableName table name - * @deprecated in Emu Release - */ - @Deprecated - private Row(String tableName) { - checkNotNull(tableName, "tableName cannot be null"); - this.tableName = tableName; - this.columns = Maps.newHashMap(); - } - - /** - * Row constructor. - * - * @param tableName table name - * @param columns Map of Column entity - * @param uuid UUID of the row - */ - public Row(String tableName, UUID uuid, Map<String, Column> columns) { - checkNotNull(tableName, "table name cannot be null"); - checkNotNull(uuid, "uuid cannot be null"); - checkNotNull(columns, "columns cannot be null"); - this.tableName = tableName; - this.uuid = uuid; - this.columns = columns; - } - - /** - * Returns tableName. - * - * @return tableName - */ - public String tableName() { - return tableName; - } - - /** - * Set tableName value. - * - * @param tableName table name - */ - public void setTableName(String tableName) { - this.tableName = tableName; - } - - /** - * Returns uuid. - * - * @return uuid - */ - public UUID uuid() { - return uuid; - } - - /** - * Sets uuid value. - * - * @param uuid new uuid - */ - public void setUuid(UUID uuid) { - this.uuid = uuid; - } - - /** - * Returns Column by ColumnSchema. - * - * @param columnName column name - * @return Column - */ - public Column getColumn(String columnName) { - return columns.get(columnName); - } - - /** - * Returns Collection of Column. - * - * @return Collection of Column - */ - public Collection<Column> getColumns() { - return columns.values(); - } - - /** - * add Column. - * - * @param columnName column name - * @param data Column entity - */ - public void addColumn(String columnName, Column data) { - this.columns.put(columnName, data); - } - - @Override - public int hashCode() { - return Objects.hash(tableName, columns); - } - - @Override - public boolean equals(Object obj) { - if (this == obj) { - return true; - } - if (obj instanceof Row) { - final Row other = (Row) obj; - return Objects.equals(this.tableName, other.tableName) - && Objects.equals(this.columns, other.columns); - } - return false; - } - - @Override - public String toString() { - return toStringHelper(this).add("tableName", tableName) - .add("columns", columns).toString(); - } -} diff --git a/framework/src/onos/protocols/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/notation/UUID.java b/framework/src/onos/protocols/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/notation/UUID.java deleted file mode 100644 index 0177eea3..00000000 --- a/framework/src/onos/protocols/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/notation/UUID.java +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Copyright 2015 Open Networking Laboratory - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onosproject.ovsdb.rfc.notation; - -import static com.google.common.base.MoreObjects.toStringHelper; -import static com.google.common.base.Preconditions.checkNotNull; - -import java.util.Objects; - -import org.onosproject.ovsdb.rfc.notation.json.UUIDConverter; -import org.onosproject.ovsdb.rfc.notation.json.UUIDSerializer; - -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.fasterxml.jackson.databind.annotation.JsonSerialize; - -/** - * Handles both uuid and named-uuid. - */ -@JsonSerialize(using = UUIDSerializer.class) -@JsonDeserialize(converter = UUIDConverter.class) -public final class UUID { - private final String value; - - /** - * UUID constructor. - * @param value UUID value - */ - private UUID(String value) { - checkNotNull(value, "value cannot be null"); - this.value = value; - } - - /** - * Get UUID. - * @param value UUID value - * @return UUID - */ - public static UUID uuid(String value) { - return new UUID(value); - } - - /** - * Returns value. - * @return value - */ - public String value() { - return value; - } - - @Override - public int hashCode() { - return value.hashCode(); - } - - @Override - public boolean equals(Object obj) { - if (this == obj) { - return true; - } - if (obj instanceof UUID) { - final UUID other = (UUID) obj; - return Objects.equals(this.value, other.value); - } - return false; - } - - @Override - public String toString() { - return toStringHelper(this).add("value", value).toString(); - } -} diff --git a/framework/src/onos/protocols/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/notation/json/ConditionSerializer.java b/framework/src/onos/protocols/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/notation/json/ConditionSerializer.java deleted file mode 100644 index 551a66a4..00000000 --- a/framework/src/onos/protocols/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/notation/json/ConditionSerializer.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright 2015 Open Networking Laboratory - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onosproject.ovsdb.rfc.notation.json; - -import java.io.IOException; - -import org.onosproject.ovsdb.rfc.notation.Condition; - -import com.fasterxml.jackson.core.JsonGenerator; -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.JsonSerializer; -import com.fasterxml.jackson.databind.SerializerProvider; - -/** - * Condition Serializer. - */ -public class ConditionSerializer extends JsonSerializer<Condition> { - @Override - public void serialize(Condition condition, JsonGenerator generator, - SerializerProvider provider) - throws IOException, JsonProcessingException { - generator.writeStartArray(); - generator.writeString(condition.getColumn()); - generator.writeString(condition.getFunction().function()); - generator.writeObject(condition.getValue()); - generator.writeEndArray(); - } -} diff --git a/framework/src/onos/protocols/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/notation/json/MutationSerializer.java b/framework/src/onos/protocols/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/notation/json/MutationSerializer.java deleted file mode 100644 index a18b9e72..00000000 --- a/framework/src/onos/protocols/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/notation/json/MutationSerializer.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright 2015 Open Networking Laboratory - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onosproject.ovsdb.rfc.notation.json; - -import java.io.IOException; - -import org.onosproject.ovsdb.rfc.notation.Mutation; - -import com.fasterxml.jackson.core.JsonGenerator; -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.JsonSerializer; -import com.fasterxml.jackson.databind.SerializerProvider; - -/** - * Mutation Serializer. - */ -public class MutationSerializer extends JsonSerializer<Mutation> { - @Override - public void serialize(Mutation condition, JsonGenerator generator, - SerializerProvider provider) - throws IOException, JsonProcessingException { - generator.writeStartArray(); - generator.writeString(condition.getColumn()); - generator.writeString(condition.getMutator().mutator()); - generator.writeObject(condition.getValue()); - generator.writeEndArray(); - } -} diff --git a/framework/src/onos/protocols/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/notation/json/OvsdbMapSerializer.java b/framework/src/onos/protocols/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/notation/json/OvsdbMapSerializer.java deleted file mode 100644 index 60fd3349..00000000 --- a/framework/src/onos/protocols/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/notation/json/OvsdbMapSerializer.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright 2015 Open Networking Laboratory - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onosproject.ovsdb.rfc.notation.json; - -import java.io.IOException; -import java.util.Map; - -import org.onosproject.ovsdb.rfc.notation.OvsdbMap; - -import com.fasterxml.jackson.core.JsonGenerator; -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.JsonSerializer; -import com.fasterxml.jackson.databind.SerializerProvider; - -/** - * OvsdbMap Serializer. - */ -public class OvsdbMapSerializer extends JsonSerializer<OvsdbMap> { - @Override - public void serialize(OvsdbMap map, JsonGenerator generator, - SerializerProvider provider) - throws IOException, JsonProcessingException { - generator.writeStartArray(); - generator.writeString("map"); - generator.writeStartArray(); - Map javaMap = map.map(); - for (Object key : javaMap.keySet()) { - generator.writeStartArray(); - generator.writeObject(key); - generator.writeObject(javaMap.get(key)); - generator.writeEndArray(); - } - generator.writeEndArray(); - generator.writeEndArray(); - } -} diff --git a/framework/src/onos/protocols/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/notation/json/OvsdbSetSerializer.java b/framework/src/onos/protocols/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/notation/json/OvsdbSetSerializer.java deleted file mode 100644 index 509b2c53..00000000 --- a/framework/src/onos/protocols/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/notation/json/OvsdbSetSerializer.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright 2015 Open Networking Laboratory - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onosproject.ovsdb.rfc.notation.json; - -import java.io.IOException; -import java.util.Set; - -import org.onosproject.ovsdb.rfc.notation.OvsdbSet; - -import com.fasterxml.jackson.core.JsonGenerator; -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.JsonSerializer; -import com.fasterxml.jackson.databind.SerializerProvider; - -/** - * OvsdbSet Serializer. - */ -public class OvsdbSetSerializer extends JsonSerializer<OvsdbSet> { - @Override - public void serialize(OvsdbSet set, JsonGenerator generator, - SerializerProvider provider) - throws IOException, JsonProcessingException { - generator.writeStartArray(); - generator.writeString("set"); - generator.writeStartArray(); - Set javaSet = set.set(); - for (Object key : javaSet) { - generator.writeObject(key); - } - generator.writeEndArray(); - generator.writeEndArray(); - } -}
\ No newline at end of file diff --git a/framework/src/onos/protocols/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/notation/json/UUIDConverter.java b/framework/src/onos/protocols/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/notation/json/UUIDConverter.java deleted file mode 100644 index 66a86633..00000000 --- a/framework/src/onos/protocols/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/notation/json/UUIDConverter.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright 2015 Open Networking Laboratory - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onosproject.ovsdb.rfc.notation.json; - -import org.onosproject.ovsdb.rfc.notation.UUID; - -import com.fasterxml.jackson.databind.JsonNode; -import com.fasterxml.jackson.databind.util.StdConverter; - -/** - * UUIDConverter Converter. - */ -public class UUIDConverter extends StdConverter<JsonNode, UUID> { - - @Override - public UUID convert(JsonNode json) { - return UUID.uuid(json.get(1).asText()); - } -} diff --git a/framework/src/onos/protocols/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/notation/json/UUIDSerializer.java b/framework/src/onos/protocols/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/notation/json/UUIDSerializer.java deleted file mode 100644 index 8fb5c49c..00000000 --- a/framework/src/onos/protocols/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/notation/json/UUIDSerializer.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright 2015 Open Networking Laboratory - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onosproject.ovsdb.rfc.notation.json; - -import java.io.IOException; - -import org.onosproject.ovsdb.rfc.notation.UUID; - -import com.fasterxml.jackson.core.JsonGenerator; -import com.fasterxml.jackson.databind.JsonSerializer; -import com.fasterxml.jackson.databind.SerializerProvider; - -/** - * UUID Serializer. - */ -public class UUIDSerializer extends JsonSerializer<UUID> { - @Override - public void serialize(UUID value, JsonGenerator generator, - SerializerProvider provider) throws IOException { - generator.writeStartArray(); - String reg = "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"; - if (value.value().matches(reg)) { - generator.writeString("uuid"); - } else { - generator.writeString("named-uuid"); - } - generator.writeString(value.value()); - generator.writeEndArray(); - } -} diff --git a/framework/src/onos/protocols/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/notation/json/UpdateNotificationConverter.java b/framework/src/onos/protocols/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/notation/json/UpdateNotificationConverter.java deleted file mode 100644 index 2bb1b633..00000000 --- a/framework/src/onos/protocols/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/notation/json/UpdateNotificationConverter.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright 2015 Open Networking Laboratory - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onosproject.ovsdb.rfc.notation.json; - -import org.onosproject.ovsdb.rfc.message.UpdateNotification; - -import com.fasterxml.jackson.databind.JsonNode; -import com.fasterxml.jackson.databind.util.StdConverter; - -/** - * UpdateNotificationDeser Converter. - */ -public class UpdateNotificationConverter - extends StdConverter<JsonNode, UpdateNotification> { - - @Override - public UpdateNotification convert(JsonNode value) { - return deserialize(value); - } - - /** - * JsonNode convert into UpdateNotification. - * @param node the "params" node of UpdateNotification JsonNode - */ - private UpdateNotification deserialize(JsonNode node) { - if (node.isArray()) { - if (node.size() == 2) { - return new UpdateNotification(node.get(0).asText(), node.get(1)); - } - } - return null; - } -} diff --git a/framework/src/onos/protocols/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/notation/json/package-info.java b/framework/src/onos/protocols/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/notation/json/package-info.java deleted file mode 100644 index eb2e7c66..00000000 --- a/framework/src/onos/protocols/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/notation/json/package-info.java +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright 2015 Open Networking Laboratory - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * OVSDB JSON utilities. - */ -package org.onosproject.ovsdb.rfc.notation.json; diff --git a/framework/src/onos/protocols/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/notation/package-info.java b/framework/src/onos/protocols/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/notation/package-info.java deleted file mode 100644 index 1900dfef..00000000 --- a/framework/src/onos/protocols/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/notation/package-info.java +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright 2015 Open Networking Laboratory - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * OVSDB primitives. - */ -package org.onosproject.ovsdb.rfc.notation; |