Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

ServerFactoryImpl.java 4.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. /*
  2. * Copyright (c) 2006-2014 DMDirc Developers
  3. *
  4. * Permission is hereby granted, free of charge, to any person obtaining a copy
  5. * of this software and associated documentation files (the "Software"), to deal
  6. * in the Software without restriction, including without limitation the rights
  7. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  8. * copies of the Software, and to permit persons to whom the Software is
  9. * furnished to do so, subject to the following conditions:
  10. *
  11. * The above copyright notice and this permission notice shall be included in
  12. * all copies or substantial portions of the Software.
  13. *
  14. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  15. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  16. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  17. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  18. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  19. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  20. * SOFTWARE.
  21. */
  22. package com.dmdirc;
  23. import com.dmdirc.commandparser.parsers.CommandParser;
  24. import com.dmdirc.interfaces.config.ConfigProvider;
  25. import com.dmdirc.interfaces.config.ConfigProviderMigrator;
  26. import com.dmdirc.interfaces.config.IdentityFactory;
  27. import com.dmdirc.messages.MessageSinkManager;
  28. import com.dmdirc.ui.WindowManager;
  29. import com.dmdirc.ui.core.components.StatusBarManager;
  30. import com.dmdirc.ui.input.TabCompleterFactory;
  31. import com.dmdirc.ui.messages.ColourManagerFactory;
  32. import com.dmdirc.util.URLBuilder;
  33. import java.net.URI;
  34. import java.util.concurrent.ScheduledExecutorService;
  35. import javax.inject.Inject;
  36. import javax.inject.Provider;
  37. import javax.inject.Singleton;
  38. /**
  39. * Factory for {@link Server}s
  40. */
  41. @Singleton
  42. public class ServerFactoryImpl {
  43. private final Provider<ServerManager> manager;
  44. private final ParserFactory parserFactory;
  45. private final TabCompleterFactory tabCompleterFactory;
  46. private final IdentityFactory identityFactory;
  47. private final MessageSinkManager messageSinkManager;
  48. private final StatusBarManager statusBarManager;
  49. private final WindowManager windowManager;
  50. private final Provider<ChannelFactory> channelFactory;
  51. private final Provider<QueryFactory> queryFactory;
  52. private final Provider<RawFactory> rawFactory;
  53. private final URLBuilder urlBuilder;
  54. private final DMDircMBassador eventBus;
  55. private final MessageEncoderFactory messageEncoderFactory;
  56. private final ConfigProvider userSettings;
  57. private final ColourManagerFactory colourManagerFactory;
  58. @Inject
  59. public ServerFactoryImpl(
  60. final Provider<ServerManager> manager,
  61. final ParserFactory parserFactory,
  62. final TabCompleterFactory tabCompleterFactory,
  63. final IdentityFactory identityFactory,
  64. final MessageSinkManager messageSinkManager,
  65. final StatusBarManager statusBarManager,
  66. final WindowManager windowManager,
  67. final Provider<ChannelFactory> channelFactory,
  68. final Provider<QueryFactory> queryFactory,
  69. final Provider<RawFactory> rawFactory,
  70. final URLBuilder urlBuilder,
  71. final DMDircMBassador eventBus,
  72. final MessageEncoderFactory messageEncoderFactory,
  73. @ClientModule.UserConfig final ConfigProvider userSettings,
  74. final ColourManagerFactory colourManagerFactory) {
  75. this.manager = manager;
  76. this.parserFactory = parserFactory;
  77. this.tabCompleterFactory = tabCompleterFactory;
  78. this.identityFactory = identityFactory;
  79. this.messageSinkManager = messageSinkManager;
  80. this.statusBarManager = statusBarManager;
  81. this.windowManager = windowManager;
  82. this.channelFactory = channelFactory;
  83. this.queryFactory = queryFactory;
  84. this.rawFactory = rawFactory;
  85. this.urlBuilder = urlBuilder;
  86. this.eventBus = eventBus;
  87. this.messageEncoderFactory = messageEncoderFactory;
  88. this.userSettings = userSettings;
  89. this.colourManagerFactory = colourManagerFactory;
  90. }
  91. public Server getServer(
  92. final ConfigProviderMigrator configMigrator,
  93. final CommandParser commandParser,
  94. final ScheduledExecutorService executorService,
  95. final URI uri,
  96. final ConfigProvider profile) {
  97. return new Server(manager.get(), configMigrator, commandParser, parserFactory,
  98. tabCompleterFactory, identityFactory, messageSinkManager, statusBarManager,
  99. windowManager, channelFactory.get(), queryFactory.get(), rawFactory.get(),
  100. urlBuilder, eventBus, messageEncoderFactory, userSettings, executorService, uri,
  101. profile, colourManagerFactory);
  102. }
  103. }