IRegionModuleBase.cs 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  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. [TypeExtensionPoint(Path = "/OpenSim/RegionModules", NodeName="RegionModule")]
  34. public interface IRegionModuleBase
  35. {
  36. /// <value>
  37. /// The name of the module
  38. /// </value>
  39. string Name { get; }
  40. /// <summary>
  41. /// If this returns non-null, it is the type of an interface that
  42. /// this module intends to register.
  43. /// This will cause the loader to defer loading of this module
  44. /// until all other modules have been loaded. If no other module
  45. /// has registered the interface by then, this module will be
  46. /// activated, else it will remain inactive, letting the other module
  47. /// take over. This should return non-null ONLY in modules that are
  48. /// intended to be easily replaceable, e.g. stub implementations
  49. /// that the developer expects to be replaced by third party provided
  50. /// modules.
  51. /// </summary>
  52. Type ReplaceableInterface { get; }
  53. /// <summary>
  54. /// This is called to initialize the region module. For shared modules, this is called
  55. /// exactly once, after creating the single (shared) instance. For non-shared modules,
  56. /// this is called once on each instance, after the instace for the region has been created.
  57. /// </summary>
  58. /// <param name="source">
  59. /// A <see cref="IConfigSource"/>
  60. /// </param>
  61. void Initialise(IConfigSource source);
  62. /// <summary>
  63. /// This is the inverse to <see cref="Initialise"/>. After a Close(), this instance won't be usable anymore.
  64. /// </summary>
  65. void Close();
  66. /// <summary>
  67. /// This is called whenever a <see cref="Scene"/> is added. For shared modules, this can happen several times.
  68. /// For non-shared modules, this happens exactly once, after <see cref="Initialise"/> has been called.
  69. /// </summary>
  70. /// <param name="scene">
  71. /// A <see cref="Scene"/>
  72. /// </param>
  73. void AddRegion(Scene scene);
  74. /// <summary>
  75. /// This is called whenever a <see cref="Scene"/> is removed. For shared modules, this can happen several times.
  76. /// For non-shared modules, this happens exactly once, if the scene this instance is associated with is removed.
  77. /// </summary>
  78. /// <param name="scene">
  79. /// A <see cref="Scene"/>
  80. /// </param>
  81. void RemoveRegion(Scene scene);
  82. /// <summary>
  83. /// This will be called once for every scene loaded. In a shared module
  84. /// this will be multiple times in one instance, while a nonshared
  85. /// module instance will only be called once.
  86. /// This method is called after AddRegion has been called in all
  87. /// modules for that scene, providing an opportunity to request
  88. /// another module's interface, or hook an event from another module.
  89. /// </summary>
  90. /// <param name="scene">
  91. /// A <see cref="Scene"/>
  92. /// </param>
  93. void RegionLoaded(Scene scene);
  94. }
  95. }