blob: 05f8fc7c98486d74ee5a5c7fd375edd0222c3889 [file] [log] [blame]
Umesh Krishnaswamy345ee992012-12-13 20:29:48 -08001/**
2* Copyright 2011, Big Switch Networks, Inc.
3* Originally created by David Erickson, Stanford University
4*
5* Licensed under the Apache License, Version 2.0 (the "License"); you may
6* not use this file except in compliance with the License. You may obtain
7* a copy of the License at
8*
9* http://www.apache.org/licenses/LICENSE-2.0
10*
11* Unless required by applicable law or agreed to in writing, software
12* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14* License for the specific language governing permissions and limitations
15* under the License.
16**/
17
18package net.floodlightcontroller.storage.nosql;
19
20import java.util.HashMap;
21import java.util.Map;
22
23import net.floodlightcontroller.storage.IPredicate;
24import net.floodlightcontroller.storage.IQuery;
25import net.floodlightcontroller.storage.RowOrdering;
26
27public class NoSqlQuery implements IQuery {
28
29 private String tableName;
30 private String[] columnNameList;
31 private IPredicate predicate;
32 private RowOrdering rowOrdering;
33 private Map<String,Comparable<?>> parameterMap;
34
35 NoSqlQuery(String className, String[] columnNameList, IPredicate predicate, RowOrdering rowOrdering) {
36 this.tableName = className;
37 this.columnNameList = columnNameList;
38 this.predicate = predicate;
39 this.rowOrdering = rowOrdering;
40 }
41
42 @Override
43 public void setParameter(String name, Object value) {
44 if (parameterMap == null)
45 parameterMap = new HashMap<String,Comparable<?>>();
46 parameterMap.put(name, (Comparable<?>)value);
47 }
48
49 @Override
50 public String getTableName() {
51 return tableName;
52 }
53
54 String[] getColumnNameList() {
55 return columnNameList;
56 }
57
58 IPredicate getPredicate() {
59 return predicate;
60 }
61
62 RowOrdering getRowOrdering() {
63 return rowOrdering;
64 }
65
66 Comparable<?> getParameter(String name) {
67 Comparable<?> value = null;
68 if (parameterMap != null) {
69 value = parameterMap.get(name);
70 }
71 return value;
72 }
73
74 Map<String,Comparable<?>> getParameterMap() {
75 return parameterMap;
76 }
77}