Merge "Fix raw reference to SessionNegotiatior"
[controller.git] / opendaylight / md-sal / sal-dom-xsql / src / main / java / org / opendaylight / controller / md / sal / dom / xsql / jdbc / JDBCCommand.java
1 package org.opendaylight.controller.md.sal.dom.xsql.jdbc;
2
3 import java.io.Serializable;
4 import java.util.Map;
5
6 import org.opendaylight.controller.md.sal.dom.xsql.XSQLBluePrint;
7
8 public class JDBCCommand implements Serializable {
9     private static final long serialVersionUID = 1L;
10
11     public int type = 0;
12     public static final int TYPE_EXECUTE_QUERY = 1;
13     public static final int TYPE_QUERY_REPLY = 2;
14     public static final int TYPE_QUERY_RECORD = 3;
15     public static final int TYPE_QUERY_FINISH = 4;
16     public static final int TYPE_QUERY_ERROR = 5;
17     public static final int TYPE_METADATA = 6;
18     public static final int TYPE_METADATA_REPLY = 7;
19
20     private JDBCResultSet rs = null;
21     private Map record = null;
22     private int rsID = -1;
23     private Exception err = null;
24     private XSQLBluePrint bluePrint = null;
25
26     public JDBCCommand() {
27
28     }
29
30     public void setType(int t) {
31         this.type = t;
32     }
33
34     public JDBCCommand(Exception _err, int _RSID) {
35         this.type = TYPE_QUERY_ERROR;
36         this.err = _err;
37         this.rsID = _RSID;
38     }
39
40     public JDBCCommand(XSQLBluePrint bl) {
41         this.type = TYPE_METADATA_REPLY;
42         this.bluePrint = bl;
43     }
44
45     public JDBCCommand(JDBCResultSet _rs, int _type) {
46         this.type = TYPE_EXECUTE_QUERY;
47         this.rs = _rs;
48         this.type = _type;
49         this.rsID = rs.getID();
50     }
51
52     public JDBCCommand(Map _record, int _rsID) {
53         this.record = _record;
54         this.rsID = _rsID;
55         this.type = TYPE_QUERY_RECORD;
56     }
57
58     public JDBCCommand(int _rsID) {
59         this.rsID = _rsID;
60         this.type = TYPE_QUERY_FINISH;
61     }
62
63     public int getType() {
64         return this.type;
65     }
66
67     public JDBCResultSet getRS() {
68         return this.rs;
69     }
70
71     public Map getRecord() {
72         return this.record;
73     }
74
75     public int getRSID() {
76         return this.rsID;
77     }
78
79     public Exception getERROR() {
80         return this.err;
81     }
82
83     public XSQLBluePrint getBluePrint() {
84         return this.bluePrint;
85     }
86 }