Merge "Bug 1577: Gates access to Shard actor until its initialized"
[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     public int type = 0;
10     public static final int TYPE_EXECUTE_QUERY = 1;
11     public static final int TYPE_QUERY_REPLY = 2;
12     public static final int TYPE_QUERY_RECORD = 3;
13     public static final int TYPE_QUERY_FINISH = 4;
14     public static final int TYPE_QUERY_ERROR = 5;
15     public static final int TYPE_METADATA = 6;
16     public static final int TYPE_METADATA_REPLY = 7;
17
18     private JDBCResultSet rs = null;
19     private Map record = null;
20     private int rsID = -1;
21     private Exception err = null;
22     private XSQLBluePrint bluePrint = null;
23
24     public JDBCCommand() {
25
26     }
27
28     public void setType(int t) {
29         this.type = t;
30     }
31
32     public JDBCCommand(Exception _err, int _RSID) {
33         this.type = TYPE_QUERY_ERROR;
34         this.err = _err;
35         this.rsID = _RSID;
36     }
37
38     public JDBCCommand(XSQLBluePrint bl) {
39         this.type = TYPE_METADATA_REPLY;
40         this.bluePrint = bl;
41     }
42
43     public JDBCCommand(JDBCResultSet _rs, int _type) {
44         this.type = TYPE_EXECUTE_QUERY;
45         this.rs = _rs;
46         this.type = _type;
47         this.rsID = rs.getID();
48     }
49
50     public JDBCCommand(Map _record, int _rsID) {
51         this.record = _record;
52         this.rsID = _rsID;
53         this.type = TYPE_QUERY_RECORD;
54     }
55
56     public JDBCCommand(int _rsID) {
57         this.rsID = _rsID;
58         this.type = TYPE_QUERY_FINISH;
59     }
60
61     public int getType() {
62         return this.type;
63     }
64
65     public JDBCResultSet getRS() {
66         return this.rs;
67     }
68
69     public Map getRecord() {
70         return this.record;
71     }
72
73     public int getRSID() {
74         return this.rsID;
75     }
76
77     public Exception getERROR() {
78         return this.err;
79     }
80
81     public XSQLBluePrint getBluePrint() {
82         return this.bluePrint;
83     }
84 }