Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

AutoCommandModule.java 2.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. /*
  2. * Copyright (c) 2006-2017 DMDirc Developers
  3. *
  4. * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
  5. * documentation files (the "Software"), to deal in the Software without restriction, including without limitation the
  6. * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
  7. * permit persons to whom the Software is furnished to do so, subject to the following conditions:
  8. *
  9. * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the
  10. * Software.
  11. *
  12. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
  13. * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS
  14. * OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  15. * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  16. */
  17. package com.dmdirc.commandparser.auto;
  18. import com.dmdirc.util.system.Migrator;
  19. import com.dmdirc.util.system.SystemLifecycleComponent;
  20. import java.nio.file.Path;
  21. import javax.inject.Singleton;
  22. import dagger.Module;
  23. import dagger.Provides;
  24. import static com.dmdirc.commandline.CommandLineOptionsModule.Directory;
  25. import static com.dmdirc.commandline.CommandLineOptionsModule.DirectoryType;
  26. /**
  27. * Dagger module for auto commands.
  28. */
  29. @Module(library = true, complete = false)
  30. public class AutoCommandModule {
  31. @Provides
  32. @Singleton
  33. public AutoCommandStore getAutoCommandStore(
  34. @Directory(DirectoryType.BASE) final Path directory) {
  35. return new YamlAutoCommandStore(directory.resolve("auto-commands.yml"));
  36. }
  37. @Provides(type = Provides.Type.SET)
  38. public SystemLifecycleComponent getLifecycleComponent(
  39. final AutoCommandLifecycleManager manager) {
  40. return manager;
  41. }
  42. @Provides(type = Provides.Type.SET)
  43. public Migrator getServerPerformMigrator(final ActionServerPerformMigrator migrator) {
  44. return migrator;
  45. }
  46. }