BVB Source Codes

che Show WsMasterModule.java Source code

Return Download che: download WsMasterModule.java Source code - Download che Source code - Type:.java
  1. /*******************************************************************************
  2.  * Copyright (c) 2012-2017 Codenvy, S.A.
  3.  * All rights reserved. This program and the accompanying materials
  4.  * are made available under the terms of the Eclipse Public License v1.0
  5.  * which accompanies this distribution, and is available at
  6.  * http://www.eclipse.org/legal/epl-v10.html
  7.  *
  8.  * Contributors:
  9.  *   Codenvy, S.A. - initial API and implementation
  10.  *******************************************************************************/
  11. package org.eclipse.che.api.deploy;
  12.  
  13. import com.google.inject.AbstractModule;
  14. import com.google.inject.multibindings.Multibinder;
  15. import com.google.inject.name.Names;
  16.  
  17. import org.eclipse.che.api.agent.server.launcher.AgentLauncher;
  18. import org.eclipse.che.api.core.rest.CheJsonProvider;
  19. import org.eclipse.che.api.core.rest.MessageBodyAdapter;
  20. import org.eclipse.che.api.core.rest.MessageBodyAdapterInterceptor;
  21. import org.eclipse.che.api.machine.shared.Constants;
  22. import org.eclipse.che.api.user.server.TokenValidator;
  23. import org.eclipse.che.api.workspace.server.WorkspaceConfigMessageBodyAdapter;
  24. import org.eclipse.che.api.workspace.server.WorkspaceMessageBodyAdapter;
  25. import org.eclipse.che.api.workspace.server.stack.StackMessageBodyAdapter;
  26. import org.eclipse.che.core.db.schema.SchemaInitializer;
  27. import org.eclipse.che.inject.DynaModule;
  28. import org.flywaydb.core.internal.util.PlaceholderReplacer;
  29.  
  30. import javax.sql.DataSource;
  31.  
  32. import static com.google.inject.matcher.Matchers.subclassesOf;
  33. import static org.eclipse.che.inject.Matchers.names;
  34.  
  35. /** @author andrew00x */
  36. @DynaModule
  37. public class WsMasterModule extends AbstractModule {
  38.     @Override
  39.     protected void configure() {
  40.         // db related components modules
  41.         install(new com.google.inject.persist.jpa.JpaPersistModule("main"));
  42.         install(new org.eclipse.che.account.api.AccountModule());
  43.         install(new org.eclipse.che.api.user.server.jpa.UserJpaModule());
  44.         install(new org.eclipse.che.api.ssh.server.jpa.SshJpaModule());
  45.         install(new org.eclipse.che.api.machine.server.jpa.MachineJpaModule());
  46.         install(new org.eclipse.che.api.workspace.server.jpa.WorkspaceJpaModule());
  47.  
  48.         // db configuration
  49.         bind(DataSource.class).toProvider(org.eclipse.che.core.db.h2.H2DataSourceProvider.class);
  50.         bind(SchemaInitializer.class).to(org.eclipse.che.core.db.schema.impl.flyway.FlywaySchemaInitializer.class);
  51.         bind(org.eclipse.che.core.db.DBInitializer.class).asEagerSingleton();
  52.         bind(PlaceholderReplacer.class).toProvider(org.eclipse.che.core.db.schema.impl.flyway.PlaceholderReplacerProvider.class);
  53.  
  54.         install(new org.eclipse.che.plugin.docker.compose.ComposeModule());
  55.  
  56.         bind(org.eclipse.che.api.user.server.CheUserCreator.class);
  57.  
  58.         bind(TokenValidator.class).to(org.eclipse.che.api.local.DummyTokenValidator.class);
  59.         bind(org.eclipse.che.api.local.LocalDataMigrator.class).asEagerSingleton();
  60.  
  61.         bind(org.eclipse.che.api.core.rest.ApiInfoService.class);
  62.         bind(org.eclipse.che.api.project.server.template.ProjectTemplateDescriptionLoader.class).asEagerSingleton();
  63.         bind(org.eclipse.che.api.project.server.template.ProjectTemplateRegistry.class);
  64.         bind(org.eclipse.che.api.project.server.template.ProjectTemplateService.class);
  65.         bind(org.eclipse.che.api.ssh.server.SshService.class);
  66.         bind(org.eclipse.che.api.machine.server.recipe.RecipeService.class);
  67.         bind(org.eclipse.che.api.user.server.UserService.class);
  68.         bind(org.eclipse.che.api.user.server.ProfileService.class);
  69.         bind(org.eclipse.che.api.user.server.PreferencesService.class);
  70.         bind(org.eclipse.che.api.workspace.server.stack.StackLoader.class);
  71.         bind(org.eclipse.che.api.workspace.server.stack.StackService.class);
  72.         bind(org.eclipse.che.api.workspace.server.TemporaryWorkspaceRemover.class);
  73.         bind(org.eclipse.che.api.workspace.server.WorkspaceService.class);
  74.         bind(org.eclipse.che.api.workspace.server.event.WorkspaceMessenger.class).asEagerSingleton();
  75.         bind(org.eclipse.che.plugin.docker.machine.ext.DockerMachineExtServerChecker.class);
  76.         bind(org.eclipse.che.plugin.docker.machine.ext.DockerMachineTerminalChecker.class);
  77.         bind(org.eclipse.che.everrest.EverrestDownloadFileResponseFilter.class);
  78.         bind(org.eclipse.che.everrest.ETagResponseFilter.class);
  79.  
  80.         bind(org.eclipse.che.security.oauth.OAuthAuthenticatorProvider.class)
  81.                 .to(org.eclipse.che.security.oauth.OAuthAuthenticatorProviderImpl.class);
  82.         bind(org.eclipse.che.api.auth.oauth.OAuthTokenProvider.class)
  83.                 .to(org.eclipse.che.security.oauth.OAuthAuthenticatorTokenProvider.class);
  84.         bind(org.eclipse.che.security.oauth.OAuthAuthenticationService.class);
  85.  
  86.         bind(org.eclipse.che.api.core.notification.WSocketEventBusServer.class);
  87.         // additional ports for development of extensions
  88.         Multibinder<org.eclipse.che.api.core.model.machine.ServerConf> machineServers = Multibinder.newSetBinder(binder(),
  89.                                                                                    org.eclipse.che.api.core.model.machine.ServerConf.class,
  90.                                                                                    Names.named("machine.docker.dev_machine.machine_servers"));
  91.         machineServers.addBinding().toInstance(
  92.                 new org.eclipse.che.api.machine.server.model.impl.ServerConfImpl(Constants.WSAGENT_DEBUG_REFERENCE, "4403/tcp", "http",
  93.                                                                                  null));
  94.  
  95.         bind(org.eclipse.che.api.agent.server.WsAgentHealthChecker.class)
  96.                 .to(org.eclipse.che.api.agent.server.WsAgentHealthCheckerImpl.class);
  97.  
  98.         bind(org.eclipse.che.api.machine.server.recipe.RecipeLoader.class);
  99.         Multibinder.newSetBinder(binder(), String.class, Names.named("predefined.recipe.path"))
  100.                    .addBinding()
  101.                    .toInstance("predefined-recipes.json");
  102.  
  103.  
  104.         bindConstant().annotatedWith(Names.named("machine.ws_agent.run_command"))
  105.                       .to("export JPDA_ADDRESS=\"4403\" && ~/che/ws-agent/bin/catalina.sh jpda run");
  106.         bindConstant().annotatedWith(Names.named("machine.terminal_agent.run_command"))
  107.                       .to("$HOME/che/terminal/che-websocket-terminal " +
  108.                           "-addr :4411 " +
  109.                           "-cmd ${SHELL_INTERPRETER} " +
  110.                           "-static $HOME/che/terminal/ " +
  111.                           "-logs-dir $HOME/che/exec-agent/logs");
  112.         bind(org.eclipse.che.api.workspace.server.WorkspaceValidator.class)
  113.                 .to(org.eclipse.che.api.workspace.server.DefaultWorkspaceValidator.class);
  114.  
  115.         bind(org.eclipse.che.api.workspace.server.event.MachineStateListener.class).asEagerSingleton();
  116.  
  117.         bind(org.eclipse.che.api.agent.server.AgentRegistry.class)
  118.                 .to(org.eclipse.che.api.agent.server.impl.LocalAgentRegistryImpl.class);
  119.  
  120.         Multibinder<AgentLauncher> agentLaunchers = Multibinder.newSetBinder(binder(), AgentLauncher.class);
  121.         agentLaunchers.addBinding().to(org.eclipse.che.api.workspace.server.launcher.WsAgentLauncherImpl.class);
  122.         agentLaunchers.addBinding().to(org.eclipse.che.api.workspace.server.launcher.TerminalAgentLauncherImpl.class);
  123.         agentLaunchers.addBinding().to(org.eclipse.che.api.workspace.server.launcher.SshAgentLauncherImpl.class);
  124.  
  125.         bind(org.eclipse.che.api.deploy.WsMasterAnalyticsAddresser.class);
  126.  
  127.         Multibinder<org.eclipse.che.api.machine.server.spi.InstanceProvider> machineImageProviderMultibinder =
  128.                 Multibinder.newSetBinder(binder(), org.eclipse.che.api.machine.server.spi.InstanceProvider.class);
  129.         machineImageProviderMultibinder.addBinding().to(org.eclipse.che.plugin.docker.machine.DockerInstanceProvider.class);
  130.  
  131.         bind(org.eclipse.che.api.environment.server.MachineInstanceProvider.class)
  132.                 .to(org.eclipse.che.plugin.docker.machine.MachineProviderImpl.class);
  133.  
  134.         install(new org.eclipse.che.api.core.rest.CoreRestModule());
  135.         install(new org.eclipse.che.api.core.util.FileCleaner.FileCleanerModule());
  136.         install(new org.eclipse.che.plugin.docker.machine.local.LocalDockerModule());
  137.         install(new org.eclipse.che.api.machine.server.MachineModule());
  138.         install(new org.eclipse.che.api.agent.server.AgentModule());
  139.         install(new org.eclipse.che.plugin.docker.machine.ext.DockerExtServerModule());
  140.         install(new org.eclipse.che.plugin.docker.machine.ext.DockerTerminalModule());
  141.         install(new org.eclipse.che.swagger.deploy.DocsModule());
  142.         install(new org.eclipse.che.plugin.machine.ssh.SshMachineModule());
  143.         install(new org.eclipse.che.plugin.docker.machine.proxy.DockerProxyModule());
  144.         install(new org.eclipse.che.commons.schedule.executor.ScheduleModule());
  145.  
  146.         final Multibinder<MessageBodyAdapter> adaptersMultibinder = Multibinder.newSetBinder(binder(), MessageBodyAdapter.class);
  147.         adaptersMultibinder.addBinding().to(WorkspaceConfigMessageBodyAdapter.class);
  148.         adaptersMultibinder.addBinding().to(WorkspaceMessageBodyAdapter.class);
  149.         adaptersMultibinder.addBinding().to(StackMessageBodyAdapter.class);
  150.  
  151.         final MessageBodyAdapterInterceptor interceptor = new MessageBodyAdapterInterceptor();
  152.         requestInjection(interceptor);
  153.         bindInterceptor(subclassesOf(CheJsonProvider.class), names("readFrom"), interceptor);
  154.         bind(org.eclipse.che.api.workspace.server.WorkspaceFilesCleaner.class)
  155.                 .to(org.eclipse.che.plugin.docker.machine.cleaner.LocalWorkspaceFilesCleaner.class);
  156.         bind(org.eclipse.che.api.environment.server.InfrastructureProvisioner.class)
  157.                 .to(org.eclipse.che.plugin.docker.machine.local.LocalCheInfrastructureProvisioner.class);
  158.     }
  159. }
  160.  
downloadWsMasterModule.java Source code - Download che Source code
Related Source Codes/Software:
Gource - oftware version control visualization ... 2017-01-10
FDFullscreenPopGesture - A UINavigationController's category to enable full... 2017-01-10
node-style-guide - A guide for styling your node.js / JavaScript code... 2017-01-09
ImageOptim - GUI image optimizer for Mac htt... 2017-01-09
falcon - Falcon is a low-level, high-performance Python fra... 2017-01-09
notepad-plus-plus - Notepad++ official repository h... 2017-01-10
waterline - An adapter-based ORM for Node.js with support for ... 2017-01-10
Workerman - An asynchronous event driven PHP framework for eas... 2017-01-10
structor - An advanced visual editor for React components ... 2017-01-10
golearn - Machine Learning for Go 2017-01-10
mongo-express - Web-based MongoDB admin interface, written with No... 2017-05-17
XCL-Charts - Android charting libraries (XCL-Charts is a free c... 2017-05-17
scrollMonitor - A simple and fast API to monitor elements as you s... 2017-05-16
XCDYouTubeKit - YouTube video player for iOS, tvOS and macOS 2017-05-16
rails-erd - Generate Entity-Relationship Diagrams for Rails ap... 2017-05-16
np - A better `npm publish` 2017-05-16
android - Smartisan open source code for full build.(repo ma... 2017-05-16
word_cloud - A little word cloud generator in Pytho 2017-05-16
mobileplayer-ios - 2017-05-16
Destroy-Windows-10-Spying - Destroy Windows Spying tool ... 2017-05-15

 Back to top