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

Side by Side Diff: pkg/analysis_server/lib/src/plugin/server_plugin.dart

Issue 839833002: Initial plugin API (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Add tests and clean-up server plugin Created 5 years, 11 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 | Annotate | Revision Log
OLDNEW
(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 }
OLDNEW
« no previous file with comments | « pkg/analysis_server/lib/src/plugin/plugin_impl.dart ('k') | pkg/analysis_server/test/operation/test_all.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698