Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

IdentityFactory.java 5.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  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.interfaces.config;
  18. import com.dmdirc.Precondition;
  19. import com.dmdirc.config.ConfigTarget;
  20. import com.dmdirc.config.provider.AggregateConfigProvider;
  21. import com.dmdirc.config.provider.ConfigProvider;
  22. import com.dmdirc.config.provider.ConfigProviderMigrator;
  23. /**
  24. * Defines methods implemented by a factory which can create useful identities.
  25. */
  26. // TODO: Rename this to ConfigFactory or something along those lines.
  27. public interface IdentityFactory {
  28. /**
  29. * Retrieves the config for the specified channel@network. The config is created if it doesn't
  30. * exist.
  31. *
  32. * @param network The name of the network
  33. * @param channel The name of the channel
  34. *
  35. * @return A config provider for the channel
  36. */
  37. @Precondition({"The specified network is non-null and not empty",
  38. "The specified channel is non-null and not empty"})
  39. ConfigProvider createChannelConfig(String network, String channel);
  40. /**
  41. * Retrieves the config for the specified network. The config is created if it doesn't exist.
  42. *
  43. * @param network The name of the network
  44. *
  45. * @return A config provider for the network
  46. */
  47. @Precondition("The specified network is non-null and not empty")
  48. ConfigProvider createNetworkConfig(String network);
  49. /**
  50. * Retrieves the config for the specified server. The config is created if it doesn't exist.
  51. *
  52. * @param server The name of the server
  53. *
  54. * @return A config provider for the server
  55. */
  56. @Precondition("The specified server is non-null and not empty")
  57. ConfigProvider createServerConfig(String server);
  58. /**
  59. * Creates a custom configuration with the specified name and type.
  60. *
  61. * @param name The name of the configuration.
  62. * @param type The custom type of the configuration.
  63. *
  64. * @return A custom config provider.
  65. */
  66. ConfigProvider createCustomConfig(String name, String type);
  67. /**
  68. * Creates a profile configuration with the specified name.
  69. *
  70. * @param name The name of the profile.
  71. *
  72. * @return A custom config provider.
  73. */
  74. ConfigProvider createProfileConfig(String name);
  75. /**
  76. * Creates a configuration for the specified target.
  77. *
  78. * @param target The target of the configuration.
  79. *
  80. * @return A config provider for the specified target.
  81. */
  82. ConfigProvider createConfig(ConfigTarget target);
  83. /**
  84. * Creates a new {@link AggregateConfigProvider} that may be migrated, with the given initial
  85. * configuration.
  86. *
  87. * @param protocol The protocol for the provider
  88. * @param ircd The name of the ircd for the provider
  89. * @param network The name of the network for the provider
  90. * @param server The name of the server for the provider
  91. *
  92. * @return A new {@link ConfigProviderMigrator}.
  93. */
  94. ConfigProviderMigrator createMigratableConfig(String protocol, String ircd, String network,
  95. String server);
  96. /**
  97. * Creates a new {@link AggregateConfigProvider} that may be migrated, with the given initial
  98. * configuration.
  99. *
  100. * @param protocol The protocol for the provider
  101. * @param ircd The name of the ircd for the provider
  102. * @param network The name of the network for the provider
  103. * @param server The name of the server for the provider
  104. * @param channel The name of the channel for the provider
  105. *
  106. * @return A new {@link ConfigProviderMigrator}.
  107. */
  108. ConfigProviderMigrator createMigratableConfig(String protocol, String ircd, String network,
  109. String server, String channel);
  110. /**
  111. * Creates a new aggregate, read-only config.
  112. *
  113. * @param protocol The protocol for this provider.
  114. * @param ircd The name of the ircd for this provider.
  115. * @param network The name of the network for this provider.
  116. * @param server The name of the server for this provider.
  117. *
  118. * @return A new {@link AggregateConfigProvider}.
  119. */
  120. AggregateConfigProvider createAggregateConfig(String protocol, String ircd, String network,
  121. String server);
  122. /**
  123. * Creates a new aggregate, read-only config.
  124. *
  125. * @param protocol The protocol for this provider.
  126. * @param ircd The name of the ircd for this provider.
  127. * @param network The name of the network for this provider.
  128. * @param server The name of the server for this provider.
  129. * @param channel The name of the channel for this provider.
  130. *
  131. * @return A new {@link AggregateConfigProvider}.
  132. */
  133. AggregateConfigProvider createAggregateConfig(String protocol, String ircd, String network,
  134. String server, String channel);
  135. }