| OLD | NEW |
| (Empty) | |
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file |
| 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. |
| 4 |
| 5 library analysis_server.src.plugin.plugin_impl; |
| 6 |
| 7 import 'package:analysis_server/plugin/plugin.dart'; |
| 8 import 'package:analysis_server/src/analysis_server.dart'; |
| 9 import 'package:analysis_server/src/domain_server.dart'; |
| 10 import 'package:analysis_server/src/protocol.dart'; |
| 11 |
| 12 /** |
| 13 * A function that will create a request handler that can be used by the given |
| 14 * [server]. |
| 15 * |
| 16 * TODO(brianwilkerson) Move this into 'protocol.dart'. |
| 17 */ |
| 18 typedef RequestHandler RequestHandlerFactory(AnalysisServer server); |
| 19 |
| 20 /** |
| 21 * A plugin that defines the extension points and extensions that are inherently |
| 22 * defined by the analysis server. |
| 23 */ |
| 24 class ServerPlugin implements Plugin { |
| 25 /** |
| 26 * The simple identifier of the extension point that allows plugins to |
| 27 * register new domains with the server. |
| 28 */ |
| 29 static const String DOMAIN_EXTENSION_POINT = 'domain'; |
| 30 |
| 31 /** |
| 32 * The unique identifier of this plugin. |
| 33 */ |
| 34 static const String UNIQUE_IDENTIFIER = 'analysis_server.core'; |
| 35 |
| 36 /** |
| 37 * Initialize a newly created plugin. |
| 38 */ |
| 39 ServerPlugin(); |
| 40 |
| 41 @override |
| 42 String get uniqueIdentifier => UNIQUE_IDENTIFIER; |
| 43 |
| 44 @override |
| 45 void registerExtensionPoints(RegisterExtensionPoint registerExtensionPoint) { |
| 46 registerExtensionPoint( |
| 47 DOMAIN_EXTENSION_POINT, |
| 48 (Object extension) => extension is RequestHandlerFactory); |
| 49 } |
| 50 |
| 51 @override |
| 52 void registerExtensions(RegisterExtension registerExtension) { |
| 53 String domainId = Plugin.join(UNIQUE_IDENTIFIER, DOMAIN_EXTENSION_POINT); |
| 54 registerExtension( |
| 55 domainId, |
| 56 (AnalysisServer server) => new ServerDomainHandler(server)); |
| 57 // TODO(brianwilkerson) Register the other domains. |
| 58 } |
| 59 } |
| OLD | NEW |