[Groonga-commit] droonga/fluent-plugin-droonga at aa63bd1 [master] Move plugin repository to LegacyPlugin from HandlerPlugin

Back to archive index

Kouhei Sutou null+****@clear*****
Sun Nov 24 12:04:26 JST 2013


Kouhei Sutou	2013-11-24 12:04:26 +0900 (Sun, 24 Nov 2013)

  New Revision: aa63bd16500fd4b33238c8b8de9767b53173615f
  https://github.com/droonga/fluent-plugin-droonga/commit/aa63bd16500fd4b33238c8b8de9767b53173615f

  Message:
    Move plugin repository to LegacyPlugin from HandlerPlugin
    
    We use HandlerPlugin as a plugin that does only "handle". We don't use
    it for "adapt", "collect" and "distribute".

  Modified files:
    lib/droonga/adapter.rb
    lib/droonga/dispatcher.rb
    lib/droonga/executor.rb
    lib/droonga/legacy_plugin.rb
    lib/droonga/plugin/adapter/groonga.rb
    lib/droonga/plugin/handler/add.rb
    lib/droonga/plugin/handler/collector.rb
    lib/droonga/plugin/handler/forward.rb
    lib/droonga/plugin/handler/groonga.rb
    lib/droonga/plugin/handler/search.rb
    lib/droonga/plugin/handler/watch.rb
    test/unit/test_handler.rb

  Modified: lib/droonga/adapter.rb (+1 -1)
===================================================================
--- lib/droonga/adapter.rb    2013-11-24 11:14:32 +0900 (e4cc57a)
+++ lib/droonga/adapter.rb    2013-11-24 12:04:26 +0900 (a0246bc)
@@ -50,7 +50,7 @@ module Droonga
   end
 
   class BasicAdapter < Adapter
-    Droonga::HandlerPlugin.repository.register("adapter", self)
+    Droonga::LegacyPlugin.repository.register("adapter", self)
 
     command :table_create
     def table_create(request)

  Modified: lib/droonga/dispatcher.rb (+1 -1)
===================================================================
--- lib/droonga/dispatcher.rb    2013-11-24 11:14:32 +0900 (9867b91)
+++ lib/droonga/dispatcher.rb    2013-11-24 12:04:26 +0900 (431c351)
@@ -248,7 +248,7 @@ module Droonga
   end
 
   class DispatcherMessageHandler < Droonga::LegacyPlugin
-    Droonga::HandlerPlugin.repository.register("dispatcher_message", self)
+    Droonga::LegacyPlugin.repository.register("dispatcher_message", self)
     def initialize(*arguments)
       super
       @dispatcher = Droonga::Dispatcher.new(@worker, @worker.name)

  Modified: lib/droonga/executor.rb (+1 -1)
===================================================================
--- lib/droonga/executor.rb    2013-11-24 11:14:32 +0900 (1d3dd1b)
+++ lib/droonga/executor.rb    2013-11-24 12:04:26 +0900 (0e7d53f)
@@ -63,7 +63,7 @@ module Droonga
     end
 
     def add_handler(name)
-      handler = HandlerPlugin.repository.instantiate(name, self)
+      handler = LegacyPlugin.repository.instantiate(name, self)
       @handlers << handler
     end
 

  Modified: lib/droonga/legacy_plugin.rb (+6 -0)
===================================================================
--- lib/droonga/legacy_plugin.rb    2013-11-24 11:14:32 +0900 (287f211)
+++ lib/droonga/legacy_plugin.rb    2013-11-24 12:04:26 +0900 (99abe42)
@@ -21,6 +21,8 @@ require "droonga/logger"
 
 module Droonga
   class LegacyPlugin
+    @@repository = PluginRepository.new
+
     class << self
       def inherited(sub_class)
         super
@@ -38,6 +40,10 @@ module Droonga
       def handlable?(command)
         not method_name(command).nil?
       end
+
+      def repository
+        @@repository
+      end
     end
 
     def initialize(worker)

  Modified: lib/droonga/plugin/adapter/groonga.rb (+1 -1)
===================================================================
--- lib/droonga/plugin/adapter/groonga.rb    2013-11-24 11:14:32 +0900 (130e670)
+++ lib/droonga/plugin/adapter/groonga.rb    2013-11-24 12:04:26 +0900 (635c09e)
@@ -20,7 +20,7 @@ require "droonga/adapter"
 module Droonga
   class GroongaAdapter < Droonga::Adapter
     # TODO: AdapterPlugin or something should be defined to avoid conflicts.
-    Droonga::HandlerPlugin.repository.register("select", self)
+    Droonga::LegacyPlugin.repository.register("select", self)
     command :select
     def select(select_request)
       command = Select.new

  Modified: lib/droonga/plugin/handler/add.rb (+1 -1)
===================================================================
--- lib/droonga/plugin/handler/add.rb    2013-11-24 11:14:32 +0900 (0512213)
+++ lib/droonga/plugin/handler/add.rb    2013-11-24 12:04:26 +0900 (672074b)
@@ -21,7 +21,7 @@ require "droonga/legacy_plugin"
 
 module Droonga
   class AddHandler < Droonga::LegacyPlugin
-    Droonga::HandlerPlugin.repository.register("add", self)
+    Droonga::LegacyPlugin.repository.register("add", self)
 
     command :add
     def add(request)

  Modified: lib/droonga/plugin/handler/collector.rb (+1 -1)
===================================================================
--- lib/droonga/plugin/handler/collector.rb    2013-11-24 11:14:32 +0900 (e38963e)
+++ lib/droonga/plugin/handler/collector.rb    2013-11-24 12:04:26 +0900 (c5716af)
@@ -20,7 +20,7 @@ require "droonga/searcher"
 
 module Droonga
   class BasicCollectorHandler < Droonga::CollectorHandler
-    Droonga::HandlerPlugin.repository.register("collector", self)
+    Droonga::LegacyPlugin.repository.register("collector", self)
 
     command :collector_gather
     def collector_gather(request)

  Modified: lib/droonga/plugin/handler/forward.rb (+1 -1)
===================================================================
--- lib/droonga/plugin/handler/forward.rb    2013-11-24 11:14:32 +0900 (f2fb970)
+++ lib/droonga/plugin/handler/forward.rb    2013-11-24 12:04:26 +0900 (22b58c2)
@@ -20,7 +20,7 @@ require "droonga/logger"
 
 module Droonga
   class MergeHandler < Droonga::LegacyPlugin
-    Droonga::HandlerPlugin.repository.register("forward", self)
+    Droonga::LegacyPlugin.repository.register("forward", self)
 
     CONFIG_FILE_PATH = 'config.json'
 

  Modified: lib/droonga/plugin/handler/groonga.rb (+1 -1)
===================================================================
--- lib/droonga/plugin/handler/groonga.rb    2013-11-24 11:14:32 +0900 (3ab57d6)
+++ lib/droonga/plugin/handler/groonga.rb    2013-11-24 12:04:26 +0900 (d48efde)
@@ -21,7 +21,7 @@ require "droonga/legacy_plugin"
 
 module Droonga
   class GroongaHandler < Droonga::LegacyPlugin
-    Droonga::HandlerPlugin.repository.register("groonga", self)
+    Droonga::LegacyPlugin.repository.register("groonga", self)
 
     command :table_create
     def table_create(request)

  Modified: lib/droonga/plugin/handler/search.rb (+1 -1)
===================================================================
--- lib/droonga/plugin/handler/search.rb    2013-11-24 11:14:32 +0900 (73562d1)
+++ lib/droonga/plugin/handler/search.rb    2013-11-24 12:04:26 +0900 (210a58a)
@@ -20,7 +20,7 @@ require "droonga/searcher"
 
 module Droonga
   class SearchHandler < Droonga::LegacyPlugin
-    Droonga::HandlerPlugin.repository.register("search", self)
+    Droonga::LegacyPlugin.repository.register("search", self)
 
     command :search
     def search(request)

  Modified: lib/droonga/plugin/handler/watch.rb (+1 -1)
===================================================================
--- lib/droonga/plugin/handler/watch.rb    2013-11-24 11:14:32 +0900 (eddfd88)
+++ lib/droonga/plugin/handler/watch.rb    2013-11-24 12:04:26 +0900 (8afc91a)
@@ -22,7 +22,7 @@ require "droonga/legacy_plugin"
 
 module Droonga
   class WatchHandler < Droonga::LegacyPlugin
-    Droonga::HandlerPlugin.repository.register("watch", self)
+    Droonga::LegacyPlugin.repository.register("watch", self)
 
     def initialize(*args)
       super

  Modified: test/unit/test_handler.rb (+4 -3)
===================================================================
--- test/unit/test_handler.rb    2013-11-24 11:14:32 +0900 (e86464a)
+++ test/unit/test_handler.rb    2013-11-24 12:04:26 +0900 (c024ea6)
@@ -13,18 +13,19 @@
 # License along with this library; if not, write to the Free Software
 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
-require "droonga/handler"
+# TODO: Rename to test_plugin
+require "droonga/legacy_plugin"
 
 class HandlerTest < Test::Unit::TestCase
   class HandlableTest < self
-    class SearchHandler < Droonga::Handler
+    class SearchHandler < Droonga::LegacyPlugin
       command :search
       def search(request)
         :search_response
       end
     end
 
-    class StatusHandler < Droonga::Handler
+    class StatusHandler < Droonga::LegacyPlugin
       command :status
       def status(request)
         :status_response
-------------- next part --------------
HTML����������������������������...
Download 



More information about the Groonga-commit mailing list
Back to archive index