Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(373)

Side by Side Diff: pkg/analysis_server/lib/plugin/protocol/protocol.dart

Issue 1409353002: Clean up wording of client usage expectations (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 /** 5 /**
6 * Support for client code that needs to interact with the requests, responses 6 * Support for client code that needs to interact with the requests, responses
7 * and notifications that are part of the analysis server's wire protocol. 7 * and notifications that are part of the analysis server's wire protocol.
8 */ 8 */
9 library analysis_server.plugin.protocol.protocol; 9 library analysis_server.plugin.protocol.protocol;
10 10
11 import 'dart:collection'; 11 import 'dart:collection';
12 import 'dart:convert' hide JsonDecoder; 12 import 'dart:convert' hide JsonDecoder;
13 13
14 import 'package:analysis_server/src/protocol/protocol_internal.dart'; 14 import 'package:analysis_server/src/protocol/protocol_internal.dart';
15 15
16 part 'generated_protocol.dart'; 16 part 'generated_protocol.dart';
17 17
18 /** 18 /**
19 * A [RequestHandler] that supports [startup] and [shutdown] methods. 19 * A [RequestHandler] that supports [startup] and [shutdown] methods.
20 * 20 *
21 * Clients are not expected to subtype this class. 21 * Clients may not extend, implement or mix-in this class.
22 */ 22 */
23 abstract class DomainHandler extends RequestHandler { 23 abstract class DomainHandler extends RequestHandler {
24 /** 24 /**
25 * Perform any operations associated with the shutdown of the domain. It is 25 * Perform any operations associated with the shutdown of the domain. It is
26 * not guaranteed that this method will be called. If it is, it will be 26 * not guaranteed that this method will be called. If it is, it will be
27 * called after the last [Request] has been made. 27 * called after the last [Request] has been made.
28 */ 28 */
29 void shutdown() {} 29 void shutdown() {}
30 30
31 /** 31 /**
32 * Perform any operations associated with the startup of the domain. This 32 * Perform any operations associated with the startup of the domain. This
33 * will be called before the first [Request]. 33 * will be called before the first [Request].
34 */ 34 */
35 void startup() {} 35 void startup() {}
36 } 36 }
37 37
38 /** 38 /**
39 * An interface for enumerated types in the protocol. 39 * An interface for enumerated types in the protocol.
40 * 40 *
41 * Clients are not expected to subtype this class. 41 * Clients may not extend, implement or mix-in this class.
42 */ 42 */
43 abstract class Enum { 43 abstract class Enum {
44 /** 44 /**
45 * The name of the enumerated value. This should match the name of the 45 * The name of the enumerated value. This should match the name of the
46 * static getter which provides access to this enumerated value. 46 * static getter which provides access to this enumerated value.
47 */ 47 */
48 String get name; 48 String get name;
49 } 49 }
50 50
51 /** 51 /**
52 * A notification from the server about an event that occurred. 52 * A notification from the server about an event that occurred.
53 * 53 *
54 * Clients are not expected to subtype this class. 54 * Clients may not extend, implement or mix-in this class.
55 */ 55 */
56 class Notification { 56 class Notification {
57 /** 57 /**
58 * The name of the JSON attribute containing the name of the event that 58 * The name of the JSON attribute containing the name of the event that
59 * triggered the notification. 59 * triggered the notification.
60 */ 60 */
61 static const String EVENT = 'event'; 61 static const String EVENT = 'event';
62 62
63 /** 63 /**
64 * The name of the JSON attribute containing the result values. 64 * The name of the JSON attribute containing the result values.
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 if (_params != null) { 101 if (_params != null) {
102 jsonObject[PARAMS] = _params; 102 jsonObject[PARAMS] = _params;
103 } 103 }
104 return jsonObject; 104 return jsonObject;
105 } 105 }
106 } 106 }
107 107
108 /** 108 /**
109 * A request that was received from the client. 109 * A request that was received from the client.
110 * 110 *
111 * Clients are not expected to subtype this class. 111 * Clients may not extend, implement or mix-in this class.
112 */ 112 */
113 class Request { 113 class Request {
114 /** 114 /**
115 * The name of the JSON attribute containing the id of the request. 115 * The name of the JSON attribute containing the id of the request.
116 */ 116 */
117 static const String ID = 'id'; 117 static const String ID = 'id';
118 118
119 /** 119 /**
120 * The name of the JSON attribute containing the name of the request. 120 * The name of the JSON attribute containing the name of the request.
121 */ 121 */
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
247 jsonObject[CLIENT_REQUEST_TIME] = clientRequestTime; 247 jsonObject[CLIENT_REQUEST_TIME] = clientRequestTime;
248 } 248 }
249 return jsonObject; 249 return jsonObject;
250 } 250 }
251 } 251 }
252 252
253 /** 253 /**
254 * An exception that occurred during the handling of a request that requires 254 * An exception that occurred during the handling of a request that requires
255 * that an error be returned to the client. 255 * that an error be returned to the client.
256 * 256 *
257 * Clients are not expected to subtype this class. 257 * Clients may not extend, implement or mix-in this class.
258 */ 258 */
259 class RequestFailure implements Exception { 259 class RequestFailure implements Exception {
260 /** 260 /**
261 * The response to be returned as a result of the failure. 261 * The response to be returned as a result of the failure.
262 */ 262 */
263 final Response response; 263 final Response response;
264 264
265 /** 265 /**
266 * Initialize a newly created exception to return the given reponse. 266 * Initialize a newly created exception to return the given reponse.
267 */ 267 */
268 RequestFailure(this.response); 268 RequestFailure(this.response);
269 } 269 }
270 270
271 /** 271 /**
272 * An object that can handle requests and produce responses for them. 272 * An object that can handle requests and produce responses for them.
273 * 273 *
274 * Clients are not expected to subtype this class. 274 * Clients may not extend, implement or mix-in this class.
275 */ 275 */
276 abstract class RequestHandler { 276 abstract class RequestHandler {
277 /** 277 /**
278 * Attempt to handle the given [request]. If the request is not recognized by 278 * Attempt to handle the given [request]. If the request is not recognized by
279 * this handler, return `null` so that other handlers will be given a chance 279 * this handler, return `null` so that other handlers will be given a chance
280 * to handle it. Otherwise, return the response that should be passed back to 280 * to handle it. Otherwise, return the response that should be passed back to
281 * the client. 281 * the client.
282 */ 282 */
283 Response handleRequest(Request request); 283 Response handleRequest(Request request);
284 } 284 }
285 285
286 /** 286 /**
287 * A response to a request. 287 * A response to a request.
288 * 288 *
289 * Clients are not expected to subtype this class. 289 * Clients may not extend, implement or mix-in this class.
290 */ 290 */
291 class Response { 291 class Response {
292 /** 292 /**
293 * The [Response] instance that is returned when a real [Response] cannot 293 * The [Response] instance that is returned when a real [Response] cannot
294 * be provided at the moment. 294 * be provided at the moment.
295 */ 295 */
296 static final Response DELAYED_RESPONSE = new Response('DELAYED_RESPONSE'); 296 static final Response DELAYED_RESPONSE = new Response('DELAYED_RESPONSE');
297 297
298 /** 298 /**
299 * The name of the JSON attribute containing the id of the request for which 299 * The name of the JSON attribute containing the id of the request for which
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after
556 jsonObject[ID] = id; 556 jsonObject[ID] = id;
557 if (error != null) { 557 if (error != null) {
558 jsonObject[ERROR] = error.toJson(); 558 jsonObject[ERROR] = error.toJson();
559 } 559 }
560 if (_result != null) { 560 if (_result != null) {
561 jsonObject[RESULT] = _result; 561 jsonObject[RESULT] = _result;
562 } 562 }
563 return jsonObject; 563 return jsonObject;
564 } 564 }
565 } 565 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698