From a33c2f7880d30ca59a7b83c2bf7153e6b355226b Mon Sep 17 00:00:00 2001 From: fjy Date: Fri, 25 Apr 2014 14:20:02 -0700 Subject: [PATCH] clean up firehose module and introduce parsers module --- .../java/io/druid/guice/FirehoseModule.java | 2 - .../java/io/druid/guice/ParsersModule.java | 51 +++++++++++++++++++ .../druid/initialization/Initialization.java | 4 +- 3 files changed, 54 insertions(+), 3 deletions(-) create mode 100644 server/src/main/java/io/druid/guice/ParsersModule.java diff --git a/server/src/main/java/io/druid/guice/FirehoseModule.java b/server/src/main/java/io/druid/guice/FirehoseModule.java index 5e9530c5534..ac10c297dd4 100644 --- a/server/src/main/java/io/druid/guice/FirehoseModule.java +++ b/server/src/main/java/io/druid/guice/FirehoseModule.java @@ -53,10 +53,8 @@ public class FirehoseModule implements DruidModule new NamedType(TimedShutoffFirehoseFactory.class, "timed"), new NamedType(IrcFirehoseFactory.class, "irc"), new NamedType(LocalFirehoseFactory.class, "local"), - new NamedType(ProtoBufInputRowParser.class, "protobuf"), new NamedType(EventReceiverFirehoseFactory.class, "receiver") ) ); } - } diff --git a/server/src/main/java/io/druid/guice/ParsersModule.java b/server/src/main/java/io/druid/guice/ParsersModule.java new file mode 100644 index 00000000000..7c9d76c30e1 --- /dev/null +++ b/server/src/main/java/io/druid/guice/ParsersModule.java @@ -0,0 +1,51 @@ +/* + * Druid - a distributed column store. + * Copyright (C) 2012, 2013 Metamarkets Group Inc. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +package io.druid.guice; + +import com.fasterxml.jackson.databind.Module; +import com.fasterxml.jackson.databind.jsontype.NamedType; +import com.fasterxml.jackson.databind.module.SimpleModule; +import com.google.inject.Binder; +import io.druid.data.input.ProtoBufInputRowParser; +import io.druid.initialization.DruidModule; + +import java.util.Arrays; +import java.util.List; + +/** + */ +public class ParsersModule implements DruidModule +{ + @Override + public void configure(Binder binder) + { + } + + @Override + public List getJacksonModules() + { + return Arrays.asList( + new SimpleModule("ParsersModule") + .registerSubtypes( + new NamedType(ProtoBufInputRowParser.class, "protobuf") + ) + ); + } +} diff --git a/server/src/main/java/io/druid/initialization/Initialization.java b/server/src/main/java/io/druid/initialization/Initialization.java index 66748fdf5d0..292aa3c95cf 100644 --- a/server/src/main/java/io/druid/initialization/Initialization.java +++ b/server/src/main/java/io/druid/initialization/Initialization.java @@ -47,6 +47,7 @@ import io.druid.guice.JacksonConfigManagerModule; import io.druid.guice.JsonConfigProvider; import io.druid.guice.LifecycleModule; import io.druid.guice.LocalDataStorageDruidModule; +import io.druid.guice.ParsersModule; import io.druid.guice.QueryRunnerFactoryModule; import io.druid.guice.QueryableModule; import io.druid.guice.ServerModule; @@ -327,7 +328,8 @@ public class Initialization new JacksonConfigManagerModule(), new IndexingServiceDiscoveryModule(), new LocalDataStorageDruidModule(), - new FirehoseModule() + new FirehoseModule(), + new ParsersModule() ); ModuleList actualModules = new ModuleList(baseInjector);