IRegionModuleBase.cs 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. /*
  2. * Copyright (c) Contributors, http://opensimulator.org/
  3. * See CONTRIBUTORS.TXT for a full list of copyright holders.
  4. *
  5. * Redistribution and use in source and binary forms, with or without
  6. * modification, are permitted provided that the following conditions are met:
  7. * * Redistributions of source code must retain the above copyright
  8. * notice, this list of conditions and the following disclaimer.
  9. * * Redistributions in binary form must reproduce the above copyright
  10. * notice, this list of conditions and the following disclaimer in the
  11. * documentation and/or other materials provided with the distribution.
  12. * * Neither the name of the OpenSimulator Project nor the
  13. * names of its contributors may be used to endorse or promote products
  14. * derived from this software without specific prior written permission.
  15. *
  16. * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
  17. * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  18. * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  19. * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
  20. * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  21. * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  22. * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  23. * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  24. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  25. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  26. */
  27. using System;
  28. using Mono.Addins;
  29. using Nini.Config;
  30. using OpenSim.Region.Framework.Scenes;
  31. namespace OpenSim.Region.Framework.Interfaces
  32. {
  33. public interface IRegionModuleBase
  34. {
  35. /// <value>
  36. /// The name of the module
  37. /// </value>
  38. string Name { get; }
  39. /// <summary>
  40. /// If this returns non-null, it is the type of an interface that
  41. /// this module intends to register.
  42. /// This will cause the loader to defer loading of this module
  43. /// until all other modules have been loaded. If no other module
  44. /// has registered the interface by then, this module will be
  45. /// activated, else it will remain inactive, letting the other module
  46. /// take over. This should return non-null ONLY in modules that are
  47. /// intended to be easily replaceable, e.g. stub implementations
  48. /// that the developer expects to be replaced by third party provided
  49. /// modules.
  50. /// </summary>
  51. Type ReplaceableInterface { get; }
  52. /// <summary>
  53. /// This is called to initialize the region module. For shared modules, this is called
  54. /// exactly once, after creating the single (shared) instance. For non-shared modules,
  55. /// this is called once on each instance, after the instace for the region has been created.
  56. /// </summary>
  57. /// <param name="source">
  58. /// A <see cref="IConfigSource"/>
  59. /// </param>
  60. void Initialise(IConfigSource source);
  61. /// <summary>
  62. /// This is the inverse to <see cref="Initialise"/>. After a Close(), this instance won't be usable anymore.
  63. /// </summary>
  64. void Close();
  65. /// <summary>
  66. /// This is called whenever a <see cref="Scene"/> is added. For shared modules, this can happen several times.
  67. /// For non-shared modules, this happens exactly once, after <see cref="Initialise"/> has been called.
  68. /// </summary>
  69. /// <param name="scene">
  70. /// A <see cref="Scene"/>
  71. /// </param>
  72. void AddRegion(Scene scene);
  73. /// <summary>
  74. /// This is called whenever a <see cref="Scene"/> is removed. For shared modules, this can happen several times.
  75. /// For non-shared modules, this happens exactly once, if the scene this instance is associated with is removed.
  76. /// </summary>
  77. /// <param name="scene">
  78. /// A <see cref="Scene"/>
  79. /// </param>
  80. void RemoveRegion(Scene scene);
  81. /// <summary>
  82. /// This will be called once for every scene loaded. In a shared module
  83. /// this will be multiple times in one instance, while a nonshared
  84. /// module instance will only be called once.
  85. /// This method is called after AddRegion has been called in all
  86. /// modules for that scene, providing an opportunity to request
  87. /// another module's interface, or hook an event from another module.
  88. /// </summary>
  89. /// <param name="scene">
  90. /// A <see cref="Scene"/>
  91. /// </param>
  92. void RegionLoaded(Scene scene);
  93. }
  94. }