| 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 import 'package:analysis_server/src/protocol2.dart'; | |
| 11 | 10 |
| 12 /** | 11 /** |
| 13 * Instances of the class [ServerDomainHandler] implement a [RequestHandler] | 12 * Instances of the class [ServerDomainHandler] implement a [RequestHandler] |
| 14 * that handles requests in the server domain. | 13 * that handles requests in the server domain. |
| 15 */ | 14 */ |
| 16 class ServerDomainHandler implements RequestHandler { | 15 class ServerDomainHandler implements RequestHandler { |
| 17 /** | 16 /** |
| 18 * The analysis server that is using this handler to process requests. | 17 * The analysis server that is using this handler to process requests. |
| 19 */ | 18 */ |
| 20 final AnalysisServer server; | 19 final AnalysisServer server; |
| (...skipping 28 matching lines...) Expand all Loading... |
| 49 } | 48 } |
| 50 | 49 |
| 51 /** | 50 /** |
| 52 * Subscribe for services. | 51 * Subscribe for services. |
| 53 * | 52 * |
| 54 * All previous subscriptions are replaced by the given set of subscriptions. | 53 * All previous subscriptions are replaced by the given set of subscriptions. |
| 55 */ | 54 */ |
| 56 Response setSubscriptions(Request request) { | 55 Response setSubscriptions(Request request) { |
| 57 server.serverServices = | 56 server.serverServices = |
| 58 new ServerSetSubscriptionsParams.fromRequest(request).subscriptions.toSe
t(); | 57 new ServerSetSubscriptionsParams.fromRequest(request).subscriptions.toSe
t(); |
| 59 return new Response(request.id); | 58 return new ServerSetSubscriptionsResult().toResponse(request.id); |
| 60 } | 59 } |
| 61 | 60 |
| 62 // TODO(scheglov) remove or move to the 'analysis' domain | 61 // TODO(scheglov) remove or move to the 'analysis' domain |
| 63 // /** | 62 // /** |
| 64 // * Create a new context in which analysis can be performed. The context that | 63 // * Create a new context in which analysis can be performed. The context that |
| 65 // * is created will persist until server.deleteContext is used to delete it. | 64 // * is created will persist until server.deleteContext is used to delete it. |
| 66 // * Clients, therefore, are responsible for managing the lifetime of contexts
. | 65 // * Clients, therefore, are responsible for managing the lifetime of contexts
. |
| 67 // */ | 66 // */ |
| 68 // Response createContext(Request request) { | 67 // Response createContext(Request request) { |
| 69 // String sdkDirectory = request.getRequiredParameter(SDK_DIRECTORY_PARAM).as
String(); | 68 // String sdkDirectory = request.getRequiredParameter(SDK_DIRECTORY_PARAM).as
String(); |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 // server.contextIdMap.remove(removedContext); | 109 // server.contextIdMap.remove(removedContext); |
| 111 // Response response = new Response(request.id); | 110 // Response response = new Response(request.id); |
| 112 // return response; | 111 // return response; |
| 113 // } | 112 // } |
| 114 | 113 |
| 115 /** | 114 /** |
| 116 * Cleanly shutdown the analysis server. | 115 * Cleanly shutdown the analysis server. |
| 117 */ | 116 */ |
| 118 Response shutdown(Request request) { | 117 Response shutdown(Request request) { |
| 119 server.shutdown(); | 118 server.shutdown(); |
| 120 Response response = new Response(request.id); | 119 Response response = new ServerShutdownResult().toResponse(request.id); |
| 121 return response; | 120 return response; |
| 122 } | 121 } |
| 123 } | 122 } |
| OLD | NEW |