OLD | NEW |
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 library domain.server; | 5 library domain.server; |
6 | 6 |
7 import 'package:analysis_server/src/analysis_server.dart'; | 7 import 'package:analysis_server/src/analysis_server.dart'; |
8 import 'package:analysis_server/src/constants.dart'; | 8 import 'package:analysis_server/src/constants.dart'; |
9 import 'package:analysis_server/src/protocol.dart'; | 9 import 'package:analysis_server/src/protocol.dart'; |
10 | 10 |
(...skipping 19 matching lines...) Expand all Loading... |
30 return new ServerGetVersionResult('0.0.1').toResponse(request.id); | 30 return new ServerGetVersionResult('0.0.1').toResponse(request.id); |
31 } | 31 } |
32 | 32 |
33 @override | 33 @override |
34 Response handleRequest(Request request) { | 34 Response handleRequest(Request request) { |
35 try { | 35 try { |
36 String requestName = request.method; | 36 String requestName = request.method; |
37 if (requestName == SERVER_GET_VERSION) { | 37 if (requestName == SERVER_GET_VERSION) { |
38 return getVersion(request); | 38 return getVersion(request); |
39 } else if (requestName == SERVER_SET_SUBSCRIPTIONS) { | 39 } else if (requestName == SERVER_SET_SUBSCRIPTIONS) { |
40 return setSubscriptions(request); | 40 return setSubscriptions(request); |
41 } else if (requestName == SERVER_SHUTDOWN) { | 41 } else if (requestName == SERVER_SHUTDOWN) { |
42 return shutdown(request); | 42 return shutdown(request); |
43 } | 43 } |
44 } on RequestFailure catch (exception) { | 44 } on RequestFailure catch (exception) { |
45 return exception.response; | 45 return exception.response; |
46 } | 46 } |
47 return null; | 47 return null; |
48 } | 48 } |
49 | 49 |
50 /** | 50 /** |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 | 113 |
114 /** | 114 /** |
115 * Cleanly shutdown the analysis server. | 115 * Cleanly shutdown the analysis server. |
116 */ | 116 */ |
117 Response shutdown(Request request) { | 117 Response shutdown(Request request) { |
118 server.shutdown(); | 118 server.shutdown(); |
119 Response response = new ServerShutdownResult().toResponse(request.id); | 119 Response response = new ServerShutdownResult().toResponse(request.id); |
120 return response; | 120 return response; |
121 } | 121 } |
122 } | 122 } |
OLD | NEW |