mirror of https://github.com/apache/druid.git
1) remove duplicate package initialization.initialization
This commit is contained in:
parent
dadd9bc5ce
commit
6c9a107356
|
@ -19,7 +19,7 @@
|
|||
|
||||
package io.druid.indexing.common.config;
|
||||
|
||||
import io.druid.server.initialization.initialization.ZkPathsConfig;
|
||||
import io.druid.server.initialization.ZkPathsConfig;
|
||||
import org.skife.config.Config;
|
||||
import org.skife.config.Default;
|
||||
|
||||
|
|
|
@ -50,7 +50,7 @@ import io.druid.indexing.coordinator.config.RemoteTaskRunnerConfig;
|
|||
import io.druid.indexing.coordinator.setup.WorkerSetupData;
|
||||
import io.druid.indexing.worker.TaskAnnouncement;
|
||||
import io.druid.indexing.worker.Worker;
|
||||
import io.druid.server.initialization.initialization.ZkPathsConfig;
|
||||
import io.druid.server.initialization.ZkPathsConfig;
|
||||
import org.apache.curator.framework.CuratorFramework;
|
||||
import org.apache.curator.framework.recipes.cache.ChildData;
|
||||
import org.apache.curator.framework.recipes.cache.PathChildrenCache;
|
||||
|
|
|
@ -27,7 +27,7 @@ import io.druid.curator.cache.SimplePathChildrenCacheFactory;
|
|||
import io.druid.guice.annotations.Global;
|
||||
import io.druid.indexing.coordinator.config.RemoteTaskRunnerConfig;
|
||||
import io.druid.indexing.coordinator.setup.WorkerSetupData;
|
||||
import io.druid.server.initialization.initialization.ZkPathsConfig;
|
||||
import io.druid.server.initialization.ZkPathsConfig;
|
||||
import org.apache.curator.framework.CuratorFramework;
|
||||
|
||||
/**
|
||||
|
|
|
@ -36,7 +36,7 @@ import io.druid.indexing.coordinator.exec.TaskConsumer;
|
|||
import io.druid.indexing.coordinator.scaling.ResourceManagementScheduler;
|
||||
import io.druid.indexing.coordinator.scaling.ResourceManagementSchedulerFactory;
|
||||
import io.druid.server.DruidNode;
|
||||
import io.druid.server.initialization.initialization.ZkPathsConfig;
|
||||
import io.druid.server.initialization.ZkPathsConfig;
|
||||
import org.apache.curator.framework.CuratorFramework;
|
||||
import org.apache.curator.framework.recipes.leader.LeaderSelector;
|
||||
import org.apache.curator.framework.recipes.leader.LeaderSelectorListener;
|
||||
|
|
|
@ -21,7 +21,7 @@ package io.druid.indexing.coordinator.config;
|
|||
|
||||
import com.google.common.base.Splitter;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import io.druid.server.initialization.initialization.ZkPathsConfig;
|
||||
import io.druid.server.initialization.ZkPathsConfig;
|
||||
import org.skife.config.Config;
|
||||
import org.skife.config.Default;
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ import com.metamx.common.lifecycle.LifecycleStop;
|
|||
import com.metamx.common.logger.Logger;
|
||||
import io.druid.curator.announcement.Announcer;
|
||||
import io.druid.indexing.coordinator.config.RemoteTaskRunnerConfig;
|
||||
import io.druid.server.initialization.initialization.ZkPathsConfig;
|
||||
import io.druid.server.initialization.ZkPathsConfig;
|
||||
import org.apache.curator.framework.CuratorFramework;
|
||||
import org.apache.zookeeper.CreateMode;
|
||||
import org.joda.time.DateTime;
|
||||
|
|
|
@ -49,7 +49,7 @@ import io.druid.indexing.worker.WorkerTaskMonitor;
|
|||
import io.druid.indexing.worker.config.WorkerConfig;
|
||||
import io.druid.jackson.DefaultObjectMapper;
|
||||
import io.druid.query.aggregation.AggregatorFactory;
|
||||
import io.druid.server.initialization.initialization.ZkPathsConfig;
|
||||
import io.druid.server.initialization.ZkPathsConfig;
|
||||
import io.druid.timeline.DataSegment;
|
||||
import org.apache.curator.framework.CuratorFramework;
|
||||
import org.apache.curator.framework.CuratorFrameworkFactory;
|
||||
|
|
|
@ -27,7 +27,7 @@ import com.google.inject.Inject;
|
|||
import com.metamx.common.ISE;
|
||||
import com.metamx.emitter.EmittingLogger;
|
||||
import io.druid.guice.ManageLifecycle;
|
||||
import io.druid.server.initialization.initialization.ZkPathsConfig;
|
||||
import io.druid.server.initialization.ZkPathsConfig;
|
||||
import io.druid.timeline.DataSegment;
|
||||
import org.apache.curator.framework.CuratorFramework;
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ package io.druid.client;
|
|||
|
||||
import com.fasterxml.jackson.annotation.JacksonInject;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import io.druid.server.initialization.initialization.ZkPathsConfig;
|
||||
import io.druid.server.initialization.ZkPathsConfig;
|
||||
import org.apache.curator.framework.CuratorFramework;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
|
|
@ -21,7 +21,7 @@ package io.druid.client;
|
|||
|
||||
import com.fasterxml.jackson.annotation.JacksonInject;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import io.druid.server.initialization.initialization.ZkPathsConfig;
|
||||
import io.druid.server.initialization.ZkPathsConfig;
|
||||
import org.apache.curator.framework.CuratorFramework;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
|
|
@ -24,7 +24,7 @@ import com.fasterxml.jackson.databind.ObjectMapper;
|
|||
import com.google.inject.Inject;
|
||||
import com.metamx.emitter.EmittingLogger;
|
||||
import io.druid.guice.ManageLifecycle;
|
||||
import io.druid.server.initialization.initialization.ZkPathsConfig;
|
||||
import io.druid.server.initialization.ZkPathsConfig;
|
||||
import io.druid.timeline.DataSegment;
|
||||
import org.apache.curator.framework.CuratorFramework;
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@ import com.metamx.common.lifecycle.Lifecycle;
|
|||
import io.druid.guice.JsonConfigProvider;
|
||||
import io.druid.guice.LazySingleton;
|
||||
import io.druid.server.DruidNode;
|
||||
import io.druid.server.initialization.initialization.CuratorDiscoveryConfig;
|
||||
import io.druid.server.initialization.CuratorDiscoveryConfig;
|
||||
import org.apache.curator.framework.CuratorFramework;
|
||||
import org.apache.curator.x.discovery.ServiceDiscovery;
|
||||
import org.apache.curator.x.discovery.ServiceDiscoveryBuilder;
|
||||
|
|
|
@ -28,7 +28,7 @@ import io.druid.server.coordination.BatchDataSegmentAnnouncer;
|
|||
import io.druid.server.coordination.DataSegmentAnnouncer;
|
||||
import io.druid.server.coordination.DataSegmentAnnouncerProvider;
|
||||
import io.druid.server.coordination.SingleDataSegmentAnnouncer;
|
||||
import io.druid.server.initialization.initialization.BatchDataSegmentAnnouncerConfig;
|
||||
import io.druid.server.initialization.BatchDataSegmentAnnouncerConfig;
|
||||
import org.apache.curator.framework.CuratorFramework;
|
||||
|
||||
/**
|
||||
|
|
|
@ -28,7 +28,7 @@ import io.druid.query.QueryToolChest;
|
|||
|
||||
/**
|
||||
*/
|
||||
public class Binders
|
||||
public class DruidBinders
|
||||
{
|
||||
public static MapBinder<Class<? extends Query>, QueryRunnerFactory> queryRunnerFactoryBinder(Binder binder)
|
||||
{
|
|
@ -56,7 +56,7 @@ public class QueryRunnerFactoryModule extends QueryToolChestModule
|
|||
{
|
||||
super.configure(binder);
|
||||
|
||||
final MapBinder<Class<? extends Query>, QueryRunnerFactory> queryFactoryBinder = Binders.queryRunnerFactoryBinder(
|
||||
final MapBinder<Class<? extends Query>, QueryRunnerFactory> queryFactoryBinder = DruidBinders.queryRunnerFactoryBinder(
|
||||
binder
|
||||
);
|
||||
|
||||
|
|
|
@ -56,7 +56,7 @@ public class QueryToolChestModule implements Module
|
|||
@Override
|
||||
public void configure(Binder binder)
|
||||
{
|
||||
MapBinder<Class<? extends Query>, QueryToolChest> toolChests = Binders.queryToolChestBinder(binder);
|
||||
MapBinder<Class<? extends Query>, QueryToolChest> toolChests = DruidBinders.queryToolChestBinder(binder);
|
||||
|
||||
for (Map.Entry<Class<? extends Query>, Class<? extends QueryToolChest>> entry : mappings.entrySet()) {
|
||||
toolChests.addBinding(entry.getKey()).to(entry.getValue());
|
||||
|
|
|
@ -29,7 +29,7 @@ import com.metamx.common.lifecycle.Lifecycle;
|
|||
import io.druid.guice.annotations.Self;
|
||||
import io.druid.initialization.DruidModule;
|
||||
import io.druid.server.DruidNode;
|
||||
import io.druid.server.initialization.initialization.ZkPathsConfig;
|
||||
import io.druid.server.initialization.ZkPathsConfig;
|
||||
import io.druid.timeline.partition.LinearShardSpec;
|
||||
import io.druid.timeline.partition.NumberedShardSpec;
|
||||
import io.druid.timeline.partition.SingleDimensionShardSpec;
|
||||
|
|
|
@ -26,7 +26,7 @@ import com.metamx.common.lifecycle.LifecycleStart;
|
|||
import com.metamx.common.lifecycle.LifecycleStop;
|
||||
import com.metamx.common.logger.Logger;
|
||||
import io.druid.curator.announcement.Announcer;
|
||||
import io.druid.server.initialization.initialization.ZkPathsConfig;
|
||||
import io.druid.server.initialization.ZkPathsConfig;
|
||||
import org.apache.curator.utils.ZKPaths;
|
||||
|
||||
/**
|
||||
|
|
|
@ -28,8 +28,8 @@ import com.google.inject.Inject;
|
|||
import com.metamx.common.ISE;
|
||||
import com.metamx.common.logger.Logger;
|
||||
import io.druid.curator.announcement.Announcer;
|
||||
import io.druid.server.initialization.initialization.BatchDataSegmentAnnouncerConfig;
|
||||
import io.druid.server.initialization.initialization.ZkPathsConfig;
|
||||
import io.druid.server.initialization.BatchDataSegmentAnnouncerConfig;
|
||||
import io.druid.server.initialization.ZkPathsConfig;
|
||||
import io.druid.timeline.DataSegment;
|
||||
import org.apache.curator.utils.ZKPaths;
|
||||
import org.joda.time.DateTime;
|
||||
|
|
|
@ -23,7 +23,7 @@ import com.fasterxml.jackson.databind.ObjectMapper;
|
|||
import com.google.inject.Inject;
|
||||
import com.metamx.common.logger.Logger;
|
||||
import io.druid.curator.announcement.Announcer;
|
||||
import io.druid.server.initialization.initialization.ZkPathsConfig;
|
||||
import io.druid.server.initialization.ZkPathsConfig;
|
||||
import io.druid.timeline.DataSegment;
|
||||
import org.apache.curator.utils.ZKPaths;
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@ import com.metamx.common.lifecycle.LifecycleStop;
|
|||
import com.metamx.emitter.EmittingLogger;
|
||||
import io.druid.segment.loading.SegmentLoaderConfig;
|
||||
import io.druid.segment.loading.SegmentLoadingException;
|
||||
import io.druid.server.initialization.initialization.ZkPathsConfig;
|
||||
import io.druid.server.initialization.ZkPathsConfig;
|
||||
import io.druid.timeline.DataSegment;
|
||||
import org.apache.curator.framework.CuratorFramework;
|
||||
import org.apache.curator.framework.recipes.cache.ChildData;
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
package io.druid.server.initialization.initialization;
|
||||
package io.druid.server.initialization;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
|
@ -17,7 +17,7 @@
|
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
package io.druid.server.initialization.initialization;
|
||||
package io.druid.server.initialization;
|
||||
|
||||
import com.google.inject.Binder;
|
||||
import com.google.inject.Module;
|
|
@ -17,7 +17,7 @@
|
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
package io.druid.server.initialization.initialization;
|
||||
package io.druid.server.initialization;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
|
@ -17,7 +17,7 @@
|
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
package io.druid.server.initialization.initialization;
|
||||
package io.druid.server.initialization;
|
||||
|
||||
import com.google.common.base.Supplier;
|
||||
import com.google.common.collect.Lists;
|
|
@ -0,0 +1,61 @@
|
|||
/*
|
||||
* 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.server.initialization;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*/
|
||||
public class ExtensionsConfig
|
||||
{
|
||||
@JsonProperty
|
||||
@NotNull
|
||||
private List<String> coordinates = ImmutableList.of();
|
||||
|
||||
@JsonProperty
|
||||
@NotNull
|
||||
private String localRepository = String.format("%s/%s", System.getProperty("user.home"), ".m2/repository");
|
||||
|
||||
@JsonProperty
|
||||
@NotNull
|
||||
private List<String> remoteRepositories = ImmutableList.of(
|
||||
"http://repo1.maven.org/maven2/",
|
||||
"https://metamx.artifactoryonline.com/metamx/pub-libs-releases-local"
|
||||
);
|
||||
|
||||
public List<String> getCoordinates()
|
||||
{
|
||||
return coordinates;
|
||||
}
|
||||
|
||||
public String getLocalRepository()
|
||||
{
|
||||
return localRepository;
|
||||
}
|
||||
|
||||
public List<String> getRemoteRepositories()
|
||||
{
|
||||
return remoteRepositories;
|
||||
}
|
||||
}
|
|
@ -17,7 +17,7 @@
|
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
package io.druid.server.initialization.initialization;
|
||||
package io.druid.server.initialization;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import org.joda.time.Period;
|
|
@ -17,7 +17,7 @@
|
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
package io.druid.server.initialization.initialization;
|
||||
package io.druid.server.initialization;
|
||||
|
||||
import com.google.common.base.Supplier;
|
||||
import com.google.inject.Binder;
|
|
@ -17,11 +17,12 @@
|
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
package io.druid.server.initialization.initialization;
|
||||
package io.druid.server.initialization;
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.google.common.base.Throwables;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.io.ByteStreams;
|
||||
import com.google.inject.Binder;
|
||||
import com.google.inject.Guice;
|
||||
import com.google.inject.Injector;
|
||||
|
@ -31,18 +32,22 @@ import com.metamx.common.ISE;
|
|||
import com.metamx.common.logger.Logger;
|
||||
import io.druid.guice.DruidGuiceExtensions;
|
||||
import io.druid.guice.DruidSecondaryModule;
|
||||
import io.druid.guice.JsonConfigProvider;
|
||||
import io.druid.guice.annotations.Json;
|
||||
import io.druid.guice.annotations.Smile;
|
||||
import io.druid.initialization.DruidModule;
|
||||
import io.druid.jackson.JacksonModule;
|
||||
import io.tesla.aether.TeslaAether;
|
||||
import io.tesla.aether.internal.DefaultTeslaAether;
|
||||
import org.eclipse.aether.artifact.Artifact;
|
||||
|
||||
import java.io.PrintStream;
|
||||
import java.net.URL;
|
||||
import java.net.URLClassLoader;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.ServiceLoader;
|
||||
|
||||
/**
|
||||
*/
|
||||
|
@ -58,36 +63,6 @@ public class Initialization
|
|||
|
||||
public static Injector makeInjector(final Object... modules)
|
||||
{
|
||||
final List<Class<?>> externalModules = Lists.newArrayList();
|
||||
final DefaultTeslaAether aether = new DefaultTeslaAether();
|
||||
try {
|
||||
final List<Artifact> artifacts = aether.resolveArtifacts(
|
||||
"com.metamx.druid-extensions-mmx:druid-extensions:0.4.18-SNAPSHOT"
|
||||
);
|
||||
List<URL> urls = Lists.newArrayListWithExpectedSize(artifacts.size());
|
||||
for (Artifact artifact : artifacts) {
|
||||
if (!exclusions.contains(artifact.getGroupId())) {
|
||||
urls.add(artifact.getFile().toURI().toURL());
|
||||
}
|
||||
else {
|
||||
log.error("Skipped Artifact[%s]", artifact);
|
||||
}
|
||||
}
|
||||
|
||||
for (URL url : urls) {
|
||||
log.error("Added URL[%s]", url);
|
||||
}
|
||||
|
||||
ClassLoader loader = new URLClassLoader(
|
||||
urls.toArray(new URL[urls.size()]), Initialization.class.getClassLoader()
|
||||
);
|
||||
|
||||
externalModules.add(loader.loadClass("com.metamx.druid.extensions.query.topn.TopNQueryDruidModule"));
|
||||
}
|
||||
catch (Exception e) {
|
||||
throw Throwables.propagate(e);
|
||||
}
|
||||
|
||||
final Injector baseInjector = Guice.createInjector(
|
||||
new DruidGuiceExtensions(),
|
||||
new JacksonModule(),
|
||||
|
@ -99,34 +74,94 @@ public class Initialization
|
|||
public void configure(Binder binder)
|
||||
{
|
||||
binder.bind(DruidSecondaryModule.class);
|
||||
JsonConfigProvider.bind(binder, "druid.extensions", ExtensionsConfig.class);
|
||||
|
||||
for (Object module : modules) {
|
||||
if (module instanceof Class) {
|
||||
binder.bind((Class) module);
|
||||
}
|
||||
}
|
||||
|
||||
for (Class<?> externalModule : externalModules) {
|
||||
binder.bind(externalModule);
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
ModuleList actualModules = new ModuleList(baseInjector);
|
||||
actualModules.addModule(DruidSecondaryModule.class);
|
||||
for (Object module : modules) {
|
||||
actualModules.addModule(module);
|
||||
}
|
||||
|
||||
for (Class<?> externalModule : externalModules) {
|
||||
actualModules.addModule(externalModule);
|
||||
}
|
||||
addExtensionModules(baseInjector.getInstance(ExtensionsConfig.class), actualModules);
|
||||
|
||||
return Guice.createInjector(actualModules.getModules());
|
||||
}
|
||||
|
||||
private static void addExtensionModules(ExtensionsConfig config, ModuleList actualModules)
|
||||
{
|
||||
final TeslaAether aether = getAetherClient(config);
|
||||
|
||||
for (String coordinate : config.getCoordinates()) {
|
||||
log.info("Loading extension[%s]", coordinate);
|
||||
try {
|
||||
final List<Artifact> artifacts = aether.resolveArtifacts(coordinate);
|
||||
List<URL> urls = Lists.newArrayListWithExpectedSize(artifacts.size());
|
||||
for (Artifact artifact : artifacts) {
|
||||
if (!exclusions.contains(artifact.getGroupId())) {
|
||||
urls.add(artifact.getFile().toURI().toURL());
|
||||
}
|
||||
else {
|
||||
log.debug("Skipped Artifact[%s]", artifact);
|
||||
}
|
||||
}
|
||||
|
||||
for (URL url : urls) {
|
||||
log.debug("Added URL[%s]", url);
|
||||
}
|
||||
|
||||
ClassLoader loader = new URLClassLoader(
|
||||
urls.toArray(new URL[urls.size()]), Initialization.class.getClassLoader()
|
||||
);
|
||||
|
||||
final ServiceLoader<DruidModule> serviceLoader = ServiceLoader.load(DruidModule.class, loader);
|
||||
|
||||
for (DruidModule module : serviceLoader) {
|
||||
log.info("Adding extension module[%s]", module.getClass());
|
||||
actualModules.addModule(module);
|
||||
}
|
||||
}
|
||||
catch (Exception e) {
|
||||
throw Throwables.propagate(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static DefaultTeslaAether getAetherClient(ExtensionsConfig config)
|
||||
{
|
||||
/*
|
||||
DefaultTeslaAether logs a bunch of stuff to System.out, which is annoying. We choose to disable that
|
||||
unless debug logging is turned on. "Disabling" it, however, is kinda bass-ackwards. We copy out a reference
|
||||
to the current System.out, and set System.out to a noop output stream. Then after DefaultTeslaAether has pulled
|
||||
The reference we swap things back.
|
||||
|
||||
This has implications for other things that are running in parallel to this. Namely, if anything else also grabs
|
||||
a reference to System.out or tries to log to it while we have things adjusted like this, then they will also log
|
||||
to nothingness. Fortunately, the code that calls this is single-threaded and shouldn't hopefully be running
|
||||
alongside anything else that's grabbing System.out. But who knows.
|
||||
*/
|
||||
if (log.isTraceEnabled() || log.isDebugEnabled()) {
|
||||
return new DefaultTeslaAether(config.getLocalRepository(), config.getRemoteRepositories());
|
||||
}
|
||||
|
||||
PrintStream oldOut = System.out;
|
||||
try {
|
||||
System.setOut(new PrintStream(ByteStreams.nullOutputStream()));
|
||||
return new DefaultTeslaAether(config.getLocalRepository(), config.getRemoteRepositories());
|
||||
}
|
||||
finally {
|
||||
System.setOut(oldOut);
|
||||
}
|
||||
}
|
||||
|
||||
private static class ModuleList
|
||||
{
|
||||
private final Injector baseInjector;
|
|
@ -17,7 +17,7 @@
|
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
package io.druid.server.initialization.initialization;
|
||||
package io.druid.server.initialization;
|
||||
|
||||
import com.google.inject.Injector;
|
||||
import org.eclipse.jetty.server.Server;
|
|
@ -17,10 +17,8 @@
|
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
package io.druid.server.initialization.initialization;
|
||||
package io.druid.server.initialization;
|
||||
|
||||
import com.google.common.base.Throwables;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.common.collect.Iterables;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.primitives.Ints;
|
||||
|
@ -32,8 +30,6 @@ import com.google.inject.Key;
|
|||
import com.google.inject.Provides;
|
||||
import com.google.inject.ProvisionException;
|
||||
import com.google.inject.Scopes;
|
||||
import com.google.inject.TypeLiteral;
|
||||
import com.google.inject.name.Named;
|
||||
import com.google.inject.name.Names;
|
||||
import com.metamx.common.lifecycle.Lifecycle;
|
||||
import com.metamx.common.logger.Logger;
|
||||
|
@ -42,8 +38,10 @@ import com.sun.jersey.api.core.ResourceConfig;
|
|||
import com.sun.jersey.guice.JerseyServletModule;
|
||||
import com.sun.jersey.guice.spi.container.servlet.GuiceContainer;
|
||||
import com.sun.jersey.spi.container.servlet.WebConfig;
|
||||
import io.druid.guice.Jerseys;
|
||||
import io.druid.guice.JsonConfigProvider;
|
||||
import io.druid.guice.LazySingleton;
|
||||
import io.druid.guice.annotations.JSR311Resource;
|
||||
import io.druid.guice.annotations.Self;
|
||||
import io.druid.server.DruidNode;
|
||||
import org.eclipse.jetty.server.Connector;
|
||||
|
@ -85,26 +83,12 @@ public class JettyServerModule extends JerseyServletModule
|
|||
|
||||
JsonConfigProvider.bind(binder, "druid.server.http", ServerConfig.class);
|
||||
|
||||
// The Guice servlet extension doesn't actually like requiring explicit bindings, so we do its job for it here.
|
||||
try {
|
||||
final Class<?> classToBind = Class.forName(
|
||||
"com.google.inject.servlet.InternalServletModule$BackwardsCompatibleServletContextProvider"
|
||||
);
|
||||
binder.bind(classToBind);
|
||||
}
|
||||
catch (ClassNotFoundException e) {
|
||||
throw Throwables.propagate(e);
|
||||
}
|
||||
|
||||
binder.bind(GuiceContainer.class).to(DruidGuiceContainer.class);
|
||||
binder.bind(DruidGuiceContainer.class).in(Scopes.SINGLETON);
|
||||
serve("/*").with(DruidGuiceContainer.class);
|
||||
|
||||
final ImmutableSet<Class<?>> theResources = ImmutableSet.copyOf(resources);
|
||||
binder.bind(new TypeLiteral<Set<Class<?>>>(){})
|
||||
.annotatedWith(Names.named("resourceClasses"))
|
||||
.toInstance(theResources);
|
||||
for (Class<?> resource : theResources) {
|
||||
for (Class<?> resource : resources) {
|
||||
Jerseys.addResource(binder, resource);
|
||||
binder.bind(resource).in(LazySingleton.class);
|
||||
}
|
||||
|
||||
|
@ -118,7 +102,7 @@ public class JettyServerModule extends JerseyServletModule
|
|||
@Inject
|
||||
public DruidGuiceContainer(
|
||||
Injector injector,
|
||||
@Named("resourceClasses") Set<Class<?>> resources
|
||||
@JSR311Resource Set<Class<?>> resources
|
||||
)
|
||||
{
|
||||
super(injector);
|
|
@ -17,7 +17,7 @@
|
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
package io.druid.server.initialization.initialization;
|
||||
package io.druid.server.initialization;
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.google.common.base.Supplier;
|
|
@ -17,7 +17,7 @@
|
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
package io.druid.server.initialization.initialization;
|
||||
package io.druid.server.initialization;
|
||||
|
||||
import com.google.common.base.Throwables;
|
||||
import com.google.common.io.Closeables;
|
|
@ -17,7 +17,7 @@
|
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
package io.druid.server.initialization.initialization;
|
||||
package io.druid.server.initialization;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import org.joda.time.Period;
|
|
@ -17,7 +17,7 @@
|
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
package io.druid.server.initialization.initialization;
|
||||
package io.druid.server.initialization;
|
||||
|
||||
import org.apache.curator.utils.ZKPaths;
|
||||
import org.skife.config.Config;
|
|
@ -50,7 +50,7 @@ import io.druid.db.DatabaseRuleManager;
|
|||
import io.druid.db.DatabaseSegmentManager;
|
||||
import io.druid.guice.ManageLifecycle;
|
||||
import io.druid.segment.IndexIO;
|
||||
import io.druid.server.initialization.initialization.ZkPathsConfig;
|
||||
import io.druid.server.initialization.ZkPathsConfig;
|
||||
import io.druid.timeline.DataSegment;
|
||||
import org.apache.curator.framework.CuratorFramework;
|
||||
import org.apache.curator.framework.recipes.leader.LeaderLatch;
|
||||
|
|
|
@ -33,8 +33,8 @@ import io.druid.curator.announcement.Announcer;
|
|||
import io.druid.jackson.DefaultObjectMapper;
|
||||
import io.druid.server.coordination.BatchDataSegmentAnnouncer;
|
||||
import io.druid.server.coordination.DruidServerMetadata;
|
||||
import io.druid.server.initialization.initialization.BatchDataSegmentAnnouncerConfig;
|
||||
import io.druid.server.initialization.initialization.ZkPathsConfig;
|
||||
import io.druid.server.initialization.BatchDataSegmentAnnouncerConfig;
|
||||
import io.druid.server.initialization.ZkPathsConfig;
|
||||
import io.druid.timeline.DataSegment;
|
||||
import junit.framework.Assert;
|
||||
import org.apache.curator.framework.CuratorFramework;
|
||||
|
|
|
@ -32,7 +32,7 @@ import io.druid.query.NoopQueryRunnerFactoryConglomerate;
|
|||
import io.druid.segment.IndexIO;
|
||||
import io.druid.segment.loading.CacheTestSegmentLoader;
|
||||
import io.druid.segment.loading.SegmentLoaderConfig;
|
||||
import io.druid.server.initialization.initialization.ZkPathsConfig;
|
||||
import io.druid.server.initialization.ZkPathsConfig;
|
||||
import io.druid.server.metrics.NoopServiceEmitter;
|
||||
import io.druid.timeline.DataSegment;
|
||||
import io.druid.timeline.partition.NoneShardSpec;
|
||||
|
|
|
@ -30,8 +30,8 @@ import io.druid.curator.announcement.Announcer;
|
|||
import io.druid.jackson.DefaultObjectMapper;
|
||||
import io.druid.server.coordination.BatchDataSegmentAnnouncer;
|
||||
import io.druid.server.coordination.DruidServerMetadata;
|
||||
import io.druid.server.initialization.initialization.BatchDataSegmentAnnouncerConfig;
|
||||
import io.druid.server.initialization.initialization.ZkPathsConfig;
|
||||
import io.druid.server.initialization.BatchDataSegmentAnnouncerConfig;
|
||||
import io.druid.server.initialization.ZkPathsConfig;
|
||||
import io.druid.timeline.DataSegment;
|
||||
import junit.framework.Assert;
|
||||
import org.apache.curator.framework.CuratorFramework;
|
||||
|
|
|
@ -25,7 +25,7 @@ import io.druid.client.DruidServer;
|
|||
import io.druid.client.SingleServerInventoryView;
|
||||
import io.druid.curator.inventory.InventoryManagerConfig;
|
||||
import io.druid.db.DatabaseSegmentManager;
|
||||
import io.druid.server.initialization.initialization.ZkPathsConfig;
|
||||
import io.druid.server.initialization.ZkPathsConfig;
|
||||
import io.druid.server.metrics.NoopServiceEmitter;
|
||||
import io.druid.timeline.DataSegment;
|
||||
import org.apache.curator.framework.CuratorFramework;
|
||||
|
|
|
@ -34,9 +34,9 @@ import io.druid.guice.ServerViewModule;
|
|||
import io.druid.guice.annotations.Client;
|
||||
import io.druid.server.ClientQuerySegmentWalker;
|
||||
import io.druid.server.StatusResource;
|
||||
import io.druid.server.initialization.initialization.EmitterModule;
|
||||
import io.druid.server.initialization.initialization.Initialization;
|
||||
import io.druid.server.initialization.initialization.JettyServerModule;
|
||||
import io.druid.server.initialization.EmitterModule;
|
||||
import io.druid.server.initialization.Initialization;
|
||||
import io.druid.server.initialization.JettyServerModule;
|
||||
import io.druid.server.metrics.MetricsModule;
|
||||
|
||||
/**
|
||||
|
|
|
@ -38,10 +38,10 @@ import io.druid.server.StatusResource;
|
|||
import io.druid.server.http.InfoResource;
|
||||
import io.druid.server.http.MasterResource;
|
||||
import io.druid.server.http.RedirectFilter;
|
||||
import io.druid.server.initialization.initialization.EmitterModule;
|
||||
import io.druid.server.initialization.initialization.Initialization;
|
||||
import io.druid.server.initialization.initialization.JettyServerInitializer;
|
||||
import io.druid.server.initialization.initialization.JettyServerModule;
|
||||
import io.druid.server.initialization.EmitterModule;
|
||||
import io.druid.server.initialization.Initialization;
|
||||
import io.druid.server.initialization.JettyServerInitializer;
|
||||
import io.druid.server.initialization.JettyServerModule;
|
||||
import io.druid.server.master.DruidMaster;
|
||||
import io.druid.server.metrics.MetricsModule;
|
||||
import org.eclipse.jetty.server.Handler;
|
||||
|
|
|
@ -37,9 +37,9 @@ import io.druid.guice.StorageNodeModule;
|
|||
import io.druid.server.StatusResource;
|
||||
import io.druid.server.coordination.ServerManager;
|
||||
import io.druid.server.coordination.ZkCoordinator;
|
||||
import io.druid.server.initialization.initialization.EmitterModule;
|
||||
import io.druid.server.initialization.initialization.Initialization;
|
||||
import io.druid.server.initialization.initialization.JettyServerModule;
|
||||
import io.druid.server.initialization.EmitterModule;
|
||||
import io.druid.server.initialization.Initialization;
|
||||
import io.druid.server.initialization.JettyServerModule;
|
||||
import io.druid.server.metrics.MetricsModule;
|
||||
import io.druid.server.metrics.ServerMonitor;
|
||||
|
||||
|
|
|
@ -33,10 +33,10 @@ import io.druid.guice.TaskLogsModule;
|
|||
import io.druid.indexing.worker.WorkerTaskMonitor;
|
||||
import io.druid.indexing.worker.http.WorkerResource;
|
||||
import io.druid.server.StatusResource;
|
||||
import io.druid.server.initialization.initialization.EmitterModule;
|
||||
import io.druid.server.initialization.initialization.Initialization;
|
||||
import io.druid.server.initialization.initialization.JettyServerInitializer;
|
||||
import io.druid.server.initialization.initialization.JettyServerModule;
|
||||
import io.druid.server.initialization.EmitterModule;
|
||||
import io.druid.server.initialization.Initialization;
|
||||
import io.druid.server.initialization.JettyServerInitializer;
|
||||
import io.druid.server.initialization.JettyServerModule;
|
||||
import io.druid.server.metrics.MetricsModule;
|
||||
import org.eclipse.jetty.server.Handler;
|
||||
import org.eclipse.jetty.server.Server;
|
||||
|
|
|
@ -37,10 +37,10 @@ import io.druid.indexing.coordinator.TaskMaster;
|
|||
import io.druid.indexing.coordinator.http.IndexerCoordinatorResource;
|
||||
import io.druid.server.StatusResource;
|
||||
import io.druid.server.http.RedirectFilter;
|
||||
import io.druid.server.initialization.initialization.EmitterModule;
|
||||
import io.druid.server.initialization.initialization.Initialization;
|
||||
import io.druid.server.initialization.initialization.JettyServerInitializer;
|
||||
import io.druid.server.initialization.initialization.JettyServerModule;
|
||||
import io.druid.server.initialization.EmitterModule;
|
||||
import io.druid.server.initialization.Initialization;
|
||||
import io.druid.server.initialization.JettyServerInitializer;
|
||||
import io.druid.server.initialization.JettyServerModule;
|
||||
import io.druid.server.metrics.MetricsModule;
|
||||
import org.eclipse.jetty.server.Handler;
|
||||
import org.eclipse.jetty.server.Server;
|
||||
|
|
|
@ -47,9 +47,9 @@ import io.druid.indexing.worker.executor.ExecutorLifecycle;
|
|||
import io.druid.indexing.worker.executor.ExecutorLifecycleConfig;
|
||||
import io.druid.initialization.LogLevelAdjuster;
|
||||
import io.druid.server.StatusResource;
|
||||
import io.druid.server.initialization.initialization.EmitterModule;
|
||||
import io.druid.server.initialization.initialization.Initialization;
|
||||
import io.druid.server.initialization.initialization.JettyServerModule;
|
||||
import io.druid.server.initialization.EmitterModule;
|
||||
import io.druid.server.initialization.Initialization;
|
||||
import io.druid.server.initialization.JettyServerModule;
|
||||
import io.druid.server.metrics.MetricsModule;
|
||||
|
||||
import java.io.File;
|
||||
|
|
|
@ -38,9 +38,9 @@ import io.druid.guice.ServerViewModule;
|
|||
import io.druid.guice.StorageNodeModule;
|
||||
import io.druid.segment.realtime.RealtimeManager;
|
||||
import io.druid.server.StatusResource;
|
||||
import io.druid.server.initialization.initialization.EmitterModule;
|
||||
import io.druid.server.initialization.initialization.Initialization;
|
||||
import io.druid.server.initialization.initialization.JettyServerModule;
|
||||
import io.druid.server.initialization.EmitterModule;
|
||||
import io.druid.server.initialization.Initialization;
|
||||
import io.druid.server.initialization.JettyServerModule;
|
||||
import io.druid.server.metrics.MetricsModule;
|
||||
|
||||
/**
|
||||
|
|
|
@ -31,9 +31,9 @@ import io.druid.guice.ServerModule;
|
|||
import io.druid.guice.StorageNodeModule;
|
||||
import io.druid.segment.realtime.RealtimeManager;
|
||||
import io.druid.server.StatusResource;
|
||||
import io.druid.server.initialization.initialization.EmitterModule;
|
||||
import io.druid.server.initialization.initialization.Initialization;
|
||||
import io.druid.server.initialization.initialization.JettyServerModule;
|
||||
import io.druid.server.initialization.EmitterModule;
|
||||
import io.druid.server.initialization.Initialization;
|
||||
import io.druid.server.initialization.JettyServerModule;
|
||||
|
||||
/**
|
||||
*/
|
||||
|
|
|
@ -22,7 +22,7 @@ package io.druid.cli;
|
|||
import com.google.inject.Injector;
|
||||
import com.google.inject.servlet.GuiceFilter;
|
||||
import io.druid.server.QueryServlet;
|
||||
import io.druid.server.initialization.initialization.JettyServerInitializer;
|
||||
import io.druid.server.initialization.JettyServerInitializer;
|
||||
import org.eclipse.jetty.server.Handler;
|
||||
import org.eclipse.jetty.server.Server;
|
||||
import org.eclipse.jetty.server.handler.DefaultHandler;
|
||||
|
|
Loading…
Reference in New Issue