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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: pkg/analysis_server/lib/src/plugin/server_plugin.dart
diff --git a/pkg/analysis_server/lib/src/plugin/server_plugin.dart b/pkg/analysis_server/lib/src/plugin/server_plugin.dart
new file mode 100644
index 0000000000000000000000000000000000000000..b5a522d15ea7aaf5f895efa63d0a0d44b3e546b9
--- /dev/null
+++ b/pkg/analysis_server/lib/src/plugin/server_plugin.dart
@@ -0,0 +1,59 @@
+// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+library analysis_server.src.plugin.plugin_impl;
+
+import 'package:analysis_server/plugin/plugin.dart';
+import 'package:analysis_server/src/analysis_server.dart';
+import 'package:analysis_server/src/domain_server.dart';
+import 'package:analysis_server/src/protocol.dart';
+
+/**
+ * A function that will create a request handler that can be used by the given
+ * [server].
+ *
+ * TODO(brianwilkerson) Move this into 'protocol.dart'.
+ */
+typedef RequestHandler RequestHandlerFactory(AnalysisServer server);
+
+/**
+ * A plugin that defines the extension points and extensions that are inherently
+ * defined by the analysis server.
+ */
+class ServerPlugin implements Plugin {
+ /**
+ * The simple identifier of the extension point that allows plugins to
+ * register new domains with the server.
+ */
+ static const String DOMAIN_EXTENSION_POINT = 'domain';
+
+ /**
+ * The unique identifier of this plugin.
+ */
+ static const String UNIQUE_IDENTIFIER = 'analysis_server.core';
+
+ /**
+ * Initialize a newly created plugin.
+ */
+ ServerPlugin();
+
+ @override
+ String get uniqueIdentifier => UNIQUE_IDENTIFIER;
+
+ @override
+ void registerExtensionPoints(RegisterExtensionPoint registerExtensionPoint) {
+ registerExtensionPoint(
+ DOMAIN_EXTENSION_POINT,
+ (Object extension) => extension is RequestHandlerFactory);
+ }
+
+ @override
+ void registerExtensions(RegisterExtension registerExtension) {
+ String domainId = Plugin.join(UNIQUE_IDENTIFIER, DOMAIN_EXTENSION_POINT);
+ registerExtension(
+ domainId,
+ (AnalysisServer server) => new ServerDomainHandler(server));
+ // TODO(brianwilkerson) Register the other domains.
+ }
+}
« 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