You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

IdentityFactory.java 5.5KB

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