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

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: Convert interfaces to typedefs 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..e7f557270bb84c4ab5a71a61b101104b538df2f4
--- /dev/null
+++ b/pkg/analysis_server/lib/src/plugin/server_plugin.dart
@@ -0,0 +1,50 @@
+// 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/domain_server.dart';
+import 'package:analysis_server/src/protocol.dart';
+
+/**
+ * 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 RequestHandler);
+ }
+
+ @override
+ void registerExtensions(RegisterExtension registerExtension) {
+ String domainId = Plugin.join(UNIQUE_IDENTIFIER, DOMAIN_EXTENSION_POINT);
+ // TODO(brianwilkerson) Either figure out how to get access to the server
+ // (to pass it to the constructor), or rework the request handlers so that
+ // we can pass the server in later.
+ registerExtension(domainId, new ServerDomainHandler(null));
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698