Kouhei Sutou
null+****@clear*****
Fri Feb 7 14:42:41 JST 2014
Kouhei Sutou 2014-02-07 14:42:41 +0900 (Fri, 07 Feb 2014) New Revision: 901dc8d184288e26ab857775dc712ddcbabafb3a https://github.com/droonga/fluent-plugin-droonga/commit/901dc8d184288e26ab857775dc712ddcbabafb3a Message: Remove needless files for input adapter and output adapter Removed files: lib/droonga/input_adapter.rb lib/droonga/input_adapter_options.rb lib/droonga/input_adapter_plugin.rb lib/droonga/output_adapter.rb lib/droonga/output_adapter_options.rb lib/droonga/output_adapter_plugin.rb Deleted: lib/droonga/input_adapter.rb (+0 -52) 100644 =================================================================== --- lib/droonga/input_adapter.rb 2014-02-07 14:38:21 +0900 (59a875b) +++ /dev/null @@ -1,52 +0,0 @@ -# Copyright (C) 2013-2014 Droonga Project -# -# This library is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License version 2.1 as published by the Free Software Foundation. -# -# This library is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# 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/pluggable" -require "droonga/input_adapter_plugin" -require "droonga/input_adapter_options" -require "droonga/input_message" - -module Droonga - class InputAdapter - include Pluggable - - def initialize(dispatcher, options=nil) - @dispatcher = dispatcher - @options = options || InputAdapterOptions.new({}) - load_plugins(@options.plugins) - end - - def adapt(message) - adapted_message = message - @plugins.each do |plugin| - input_message = InputMessage.new(adapted_message) - command = input_message.command - next unless plugin.processable?(command) - process(command, input_message) - adapted_message = input_message.adapted_message - end - adapted_message - end - - private - def instantiate_plugin(name) - InputAdapterPlugin.repository.instantiate(name, @dispatcher) - end - - def log_tag - "input-adapter" - end - end -end Deleted: lib/droonga/input_adapter_options.rb (+0 -26) 100644 =================================================================== --- lib/droonga/input_adapter_options.rb 2014-02-07 14:38:21 +0900 (04ca8bd) +++ /dev/null @@ -1,26 +0,0 @@ -# Copyright (C) 2014 Droonga Project -# -# This library is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License version 2.1 as published by the Free Software Foundation. -# -# This library is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this library; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -module Droonga - class InputAdapterOptions - def initialize(data) - @data = data || {} - end - - def plugins - @data["plugins"] || [] - end - end -end Deleted: lib/droonga/input_adapter_plugin.rb (+0 -33) 100644 =================================================================== --- lib/droonga/input_adapter_plugin.rb 2014-02-07 14:38:21 +0900 (8f7605f) +++ /dev/null @@ -1,33 +0,0 @@ -# -*- coding: utf-8 -*- -# -# Copyright (C) 2013 Droonga Project -# -# This library is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License version 2.1 as published by the Free Software Foundation. -# -# This library is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# 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/legacy_plugin" - -module Droonga - class InputAdapterPlugin < LegacyPlugin - extend PluginRegisterable - - def initialize(dispatcher) - super() - @dispatcher = dispatcher - end - - def forward(message, destination) - @dispatcher.forward(message, destination) - end - end -end Deleted: lib/droonga/output_adapter.rb (+0 -86) 100644 =================================================================== --- lib/droonga/output_adapter.rb 2014-02-07 14:38:21 +0900 (e286975) +++ /dev/null @@ -1,86 +0,0 @@ -# -*- coding: utf-8 -*- -# -# Copyright (C) 2013-2014 Droonga Project -# -# This library is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License version 2.1 as published by the Free Software Foundation. -# -# This library is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# 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/pluggable" -require "droonga/output_adapter_plugin" -require "droonga/output_adapter_options" -require "droonga/output_message" - -module Droonga - class OutputAdapter - include Pluggable - - def initialize(dispatcher, options=nil) - @dispatcher = dispatcher - @options = options || OutputAdapterOptions - load_plugins(@options.plugins) - end - - def adapt(message) - adapted_message = message - - output_message = OutputMessage.new(adapted_message) - adapt_errors(output_message) - adapted_message = output_message.adapted_message - - @plugins.each do |plugin| - plugin.class.commands.each do |command| - next unless command.match?(adapted_message) - output_message = OutputMessage.new(adapted_message) - plugin.process(command, output_message) - adapted_message = output_message.adapted_message - end - end - - adapted_message - end - - private - #XXX This is just a temporary solution. We should handle errors without "body", for safety. - def adapt_errors(output_message) - if output_message.body.include?("errors") - errors = output_message.body["errors"] - if errors && !errors.empty? - output_message.errors = errors - - status_codes = [] - errors.values.each do |error| - status_codes << error["statusCode"] - end - status_codes = status_codes.uniq - if status_codes.size == 1 - output_message.status_code = status_codes.first - else - output_message.status_code = MessageProcessingError::STATUS_CODE - end - - output_message.body = errors.values.first["body"] - else - output_message.body.delete("errors") - end - end - end - - def instantiate_plugin(name) - OutputAdapterPlugin.repository.instantiate(name, @dispatcher) - end - - def log_tag - "output-adapter" - end - end -end Deleted: lib/droonga/output_adapter_options.rb (+0 -26) 100644 =================================================================== --- lib/droonga/output_adapter_options.rb 2014-02-07 14:38:21 +0900 (2b4b560) +++ /dev/null @@ -1,26 +0,0 @@ -# Copyright (C) 2014 Droonga Project -# -# This library is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License version 2.1 as published by the Free Software Foundation. -# -# This library is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this library; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -module Droonga - class OutputAdapterOptions - def initialize(data) - @data = data || {} - end - - def plugins - @data["plugins"] || [] - end - end -end Deleted: lib/droonga/output_adapter_plugin.rb (+0 -33) 100644 =================================================================== --- lib/droonga/output_adapter_plugin.rb 2014-02-07 14:38:21 +0900 (0195ffe) +++ /dev/null @@ -1,33 +0,0 @@ -# -*- coding: utf-8 -*- -# -# Copyright (C) 2013 Droonga Project -# -# This library is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License version 2.1 as published by the Free Software Foundation. -# -# This library is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# 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/legacy_plugin" - -module Droonga - class OutputAdapterPlugin < LegacyPlugin - extend PluginRegisterable - - def initialize(dispatcher) - super() - @dispatcher = dispatcher - end - - def forward(message, destination) - @dispatcher.forward(message, destination) - end - end -end -------------- next part -------------- HTML����������������������������...Download