|
1 <!DOCTYPE html> |
|
2 <html><head> |
|
3 <title>Plugin_Refactoring_Rope.RefactoringRope.JsonClient</title> |
|
4 <meta charset="UTF-8"> |
|
5 <style> |
|
6 body { |
|
7 background: #EDECE6; |
|
8 margin: 0em 1em 10em 1em; |
|
9 color: black; |
|
10 } |
|
11 |
|
12 h1 { color: white; background: #85774A; } |
|
13 h2 { color: white; background: #85774A; } |
|
14 h3 { color: white; background: #9D936E; } |
|
15 h4 { color: white; background: #9D936E; } |
|
16 |
|
17 a { color: #BA6D36; } |
|
18 |
|
19 </style> |
|
20 </head> |
|
21 <body><a NAME="top" ID="top"></a> |
|
22 <h1>Plugin_Refactoring_Rope.RefactoringRope.JsonClient</h1> |
|
23 <p> |
|
24 Module implementing the JSON based client base class. |
|
25 </p> |
|
26 <h3>Global Attributes</h3> |
|
27 <table> |
|
28 <tr><td>None</td></tr> |
|
29 </table> |
|
30 <h3>Classes</h3> |
|
31 <table> |
|
32 <tr> |
|
33 <td><a href="#JsonClient">JsonClient</a></td> |
|
34 <td>Class implementing the JSON based client base class.</td> |
|
35 </tr> |
|
36 </table> |
|
37 <h3>Functions</h3> |
|
38 <table> |
|
39 <tr><td>None</td></tr> |
|
40 </table> |
|
41 <hr /><hr /> |
|
42 <a NAME="JsonClient" ID="JsonClient"></a> |
|
43 <h2>JsonClient</h2> |
|
44 <p> |
|
45 Class implementing the JSON based client base class. |
|
46 </p> |
|
47 <h3>Derived from</h3> |
|
48 object |
|
49 <h3>Class Attributes</h3> |
|
50 <table> |
|
51 <tr><td>None</td></tr> |
|
52 </table> |
|
53 <h3>Class Methods</h3> |
|
54 <table> |
|
55 <tr><td>None</td></tr> |
|
56 </table> |
|
57 <h3>Methods</h3> |
|
58 <table> |
|
59 <tr> |
|
60 <td><a href="#JsonClient.__init__">JsonClient</a></td> |
|
61 <td>Constructor</td> |
|
62 </tr><tr> |
|
63 <td><a href="#JsonClient.__receiveJson">__receiveJson</a></td> |
|
64 <td>Private method to receive a JSON encode command and data from the server.</td> |
|
65 </tr><tr> |
|
66 <td><a href="#JsonClient.handleCall">handleCall</a></td> |
|
67 <td>Public method to handle a method call from the server.</td> |
|
68 </tr><tr> |
|
69 <td><a href="#JsonClient.poll">poll</a></td> |
|
70 <td>Public method to check and receive one message (if available).</td> |
|
71 </tr><tr> |
|
72 <td><a href="#JsonClient.run">run</a></td> |
|
73 <td>Public method implementing the main loop of the client.</td> |
|
74 </tr><tr> |
|
75 <td><a href="#JsonClient.sendJson">sendJson</a></td> |
|
76 <td>Public method to send a single refactoring command to the server.</td> |
|
77 </tr> |
|
78 </table> |
|
79 <h3>Static Methods</h3> |
|
80 <table> |
|
81 <tr><td>None</td></tr> |
|
82 </table> |
|
83 <a NAME="JsonClient.__init__" ID="JsonClient.__init__"></a> |
|
84 <h4>JsonClient (Constructor)</h4> |
|
85 <b>JsonClient</b>(<i>host, port, idString=""</i>) |
|
86 <p> |
|
87 Constructor |
|
88 </p><dl> |
|
89 <dt><i>host</i> (str)</dt> |
|
90 <dd> |
|
91 ip address the background service is listening |
|
92 </dd><dt><i>port</i> (int)</dt> |
|
93 <dd> |
|
94 port of the background service |
|
95 </dd><dt><i>idString</i> (str)</dt> |
|
96 <dd> |
|
97 assigned client id to be sent back to the server in |
|
98 order to identify the connection |
|
99 </dd> |
|
100 </dl><a NAME="JsonClient.__receiveJson" ID="JsonClient.__receiveJson"></a> |
|
101 <h4>JsonClient.__receiveJson</h4> |
|
102 <b>__receiveJson</b>(<i></i>) |
|
103 <p> |
|
104 Private method to receive a JSON encode command and data from the |
|
105 server. |
|
106 </p><dl> |
|
107 <dt>Returns:</dt> |
|
108 <dd> |
|
109 tuple containing the received command and a dictionary |
|
110 containing the associated data |
|
111 </dd> |
|
112 </dl><dl> |
|
113 <dt>Return Type:</dt> |
|
114 <dd> |
|
115 tuple of (str, dict) |
|
116 </dd> |
|
117 </dl><a NAME="JsonClient.handleCall" ID="JsonClient.handleCall"></a> |
|
118 <h4>JsonClient.handleCall</h4> |
|
119 <b>handleCall</b>(<i>method, params</i>) |
|
120 <p> |
|
121 Public method to handle a method call from the server. |
|
122 </p><p> |
|
123 Note: This is an empty implementation that must be overridden in |
|
124 derived classes. |
|
125 </p><dl> |
|
126 <dt><i>method</i> (str)</dt> |
|
127 <dd> |
|
128 requested method name |
|
129 </dd><dt><i>params</i> (dict)</dt> |
|
130 <dd> |
|
131 dictionary with method specific parameters |
|
132 </dd> |
|
133 </dl><a NAME="JsonClient.poll" ID="JsonClient.poll"></a> |
|
134 <h4>JsonClient.poll</h4> |
|
135 <b>poll</b>(<i>waitMethod=""</i>) |
|
136 <p> |
|
137 Public method to check and receive one message (if available). |
|
138 </p><dl> |
|
139 <dt><i>waitMethod</i> (str)</dt> |
|
140 <dd> |
|
141 name of a method to wait for |
|
142 </dd> |
|
143 </dl><dl> |
|
144 <dt>Returns:</dt> |
|
145 <dd> |
|
146 dictionary containing the data of the waited for method |
|
147 </dd> |
|
148 </dl><dl> |
|
149 <dt>Return Type:</dt> |
|
150 <dd> |
|
151 dict |
|
152 </dd> |
|
153 </dl><a NAME="JsonClient.run" ID="JsonClient.run"></a> |
|
154 <h4>JsonClient.run</h4> |
|
155 <b>run</b>(<i></i>) |
|
156 <p> |
|
157 Public method implementing the main loop of the client. |
|
158 </p><a NAME="JsonClient.sendJson" ID="JsonClient.sendJson"></a> |
|
159 <h4>JsonClient.sendJson</h4> |
|
160 <b>sendJson</b>(<i>command, params</i>) |
|
161 <p> |
|
162 Public method to send a single refactoring command to the server. |
|
163 </p><dl> |
|
164 <dt><i>command</i> (str)</dt> |
|
165 <dd> |
|
166 command name to be sent |
|
167 </dd><dt><i>params</i> (dict)</dt> |
|
168 <dd> |
|
169 dictionary of named parameters for the command |
|
170 </dd> |
|
171 </dl> |
|
172 <div align="right"><a href="#top">Up</a></div> |
|
173 <hr /> |
|
174 </body></html> |