Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   *     http://www.apache.org/licenses/LICENSE-2.0
   *
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
 package com.facebook.presto.server;
 
 
 import static com.google.inject.multibindings.MapBinder.newMapBinder;
 import static io.airlift.configuration.ConfigurationModule.bindConfig;
 import static io.airlift.discovery.client.DiscoveryBinder.discoveryBinder;
 import static io.airlift.http.client.HttpClientBinder.httpClientBinder;
 import static io.airlift.http.server.HttpServerBinder.httpServerBinder;
 import static org.weakref.jmx.guice.ExportBinder.newExporter;
 
 public class CoordinatorModule
         extends AbstractConfigurationAwareModule
 {
     @Override
     protected void setup(Binder binder)
     {
         // TODO: currently, this module is ALWAYS installed (even for non-coordinators)
 
         httpServerBinder(binder).bindResource("/""webapp").withWelcomeFile("index.html");
 
         discoveryBinder(binder).bindSelector("presto");
 
         // query manager
         binder.bind(QueryResource.class).in(.);
         binder.bind(StageResource.class).in(.);
         binder.bind(QueryIdGenerator.class).in(.);
         binder.bind(QueryManager.class).to(SqlQueryManager.class).in(.);
         newExporter(binder).export(QueryManager.class).withGeneratedName();
         bindConfig(binder).to(QueryManagerConfig.class);
 
         // analyzer
         bindConfig(binder).to(FeaturesConfig.class);
 
         // native
         binder.bind(NativeConnectorId.class).toInstance(new NativeConnectorId("default"));
         binder.bind(NativeMetadata.class).in(.);
         binder.bind(NativeSplitManager.class).in(.);
         binder.bind(NativeDataStreamProvider.class).in(.);
         binder.bind(NativeRecordSinkProvider.class).in(.);
 
         // split manager
         binder.bind(SplitManager.class).in(.);
 
         // node scheduler
        binder.bind(InternalNodeManager.class).to(DiscoveryNodeManager.class).in(.);
        binder.bind(NodeManager.class).to(Key.get(InternalNodeManager.class)).in(.);
        bindConfig(binder).to(NodeSchedulerConfig.class);
        binder.bind(NodeScheduler.class).in(.);
        newExporter(binder).export(NodeScheduler.class).withGeneratedName();
        // shard management
        binder.bind(ShardManager.class).to(DatabaseShardManager.class).in(.);
        bindConfig(binder).to(ShardCleanerConfig.class);
        binder.bind(ShardCleaner.class).in(.);
        httpClientBinder(binder).bindHttpClient("shard-cleaner"ForShardCleaner.class);
        binder.bind(ShardResource.class).in(.);
        // query execution
        MapBinder<Class<? extends Statement>, QueryExecution.QueryExecutionFactory<?>> executionBinder = newMapBinder(binder,
                new TypeLiteral<Class<? extends Statement>>() {},
                new TypeLiteral<QueryExecution.QueryExecutionFactory<?>>() {}
        );
        executionBinder.addBinding(Query.class).to(SqlQueryExecution.SqlQueryExecutionFactory.class).in(.);
        executionBinder.addBinding(Explain.class).to(SqlQueryExecution.SqlQueryExecutionFactory.class).in(.);
    }
New to GrepCode? Check out our FAQ X