nsIComponentRegistrar.idl 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243
  1. /* ***** BEGIN LICENSE BLOCK *****
  2. * Version: MPL 1.1/GPL 2.0/LGPL 2.1
  3. *
  4. * The contents of this file are subject to the Mozilla Public License Version
  5. * 1.1 (the "License"); you may not use this file except in compliance with
  6. * the License. You may obtain a copy of the License at
  7. * http://www.mozilla.org/MPL/
  8. *
  9. * Software distributed under the License is distributed on an "AS IS" basis,
  10. * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
  11. * for the specific language governing rights and limitations under the
  12. * License.
  13. *
  14. * The Original Code is XPCOM.
  15. *
  16. * The Initial Developer of the Original Code is Netscape Communications.
  17. * Portions created by the Initial Developer are Copyright (C) 2001
  18. * the Initial Developer. All Rights Reserved.
  19. *
  20. * Contributor(s):
  21. *
  22. * Alternatively, the contents of this file may be used under the terms of
  23. * either the GNU General Public License Version 2 or later (the "GPL"), or
  24. * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
  25. * in which case the provisions of the GPL or the LGPL are applicable instead
  26. * of those above. If you wish to allow use of your version of this file only
  27. * under the terms of either the GPL or the LGPL, and not to allow others to
  28. * use your version of this file under the terms of the MPL, indicate your
  29. * decision by deleting the provisions above and replace them with the notice
  30. * and other provisions required by the GPL or the LGPL. If you do not delete
  31. * the provisions above, a recipient may use your version of this file under
  32. * the terms of any one of the MPL, the GPL or the LGPL.
  33. *
  34. * ***** END LICENSE BLOCK ***** */
  35. /**
  36. * The nsIComponentRegistrar interface.
  37. * @status FROZEN
  38. */
  39. #include "nsISupports.idl"
  40. interface nsIFile;
  41. interface nsIFactory;
  42. interface nsISimpleEnumerator;
  43. [scriptable, uuid(2417cbfe-65ad-48a6-b4b6-eb84db174392)]
  44. interface nsIComponentRegistrar : nsISupports
  45. {
  46. /**
  47. * autoRegister
  48. *
  49. * Register a component file or all component files in a directory.
  50. *
  51. * Component files must have an associated loader and export the required
  52. * symbols which this loader defines. For example, if the given file is a
  53. * native library (which is built into XPCOM), it must export the symbol
  54. * "NSGetModule". Other loaders may have different semantics.
  55. *
  56. * This method may only be called from the main thread.
  57. *
  58. * @param aSpec : Filename spec for component file's location. If aSpec
  59. * is a directory, then every component file in the
  60. * directory will be registered.
  61. * If the aSpec is null, then the application component's
  62. * directory as defined by NS_XPCOM_COMPONENT_DIR will be
  63. * registered (see nsIDirectoryService.idl)
  64. *
  65. * @return NS_OK : Registration was successful.
  66. * NS_ERROR: Method failure.
  67. */
  68. void autoRegister(in nsIFile aSpec);
  69. /**
  70. * autoUnregister
  71. *
  72. * Unregister a component file or all component files in a directory.
  73. * This method may only be called from the main thread.
  74. *
  75. * @param aSpec : Filename spec for component file's location. If aSpec
  76. * is a directory, the every component file in the directory
  77. * will be registered.
  78. * If aSpec is null, then the application component's
  79. * directory as defined by NS_XPCOM_COMPONENT_DIR will be
  80. * registered. (see nsIDirectoryService.idl)
  81. *
  82. * @return NS_OK Unregistration was successful.
  83. * NS_ERROR* Method failure.
  84. */
  85. void autoUnregister(in nsIFile aSpec);
  86. /**
  87. * registerFactory
  88. *
  89. * Register a factory with a given ContractID, CID and Class Name.
  90. *
  91. * @param aClass : CID of object
  92. * @param aClassName : Class Name of CID
  93. * @param aContractID : ContractID associated with CID aClass
  94. * @param aFactory : Factory that will be registered for CID aClass
  95. *
  96. * @return NS_OK Registration was successful.
  97. * NS_ERROR* method failure.
  98. */
  99. void registerFactory(in nsCIDRef aClass,
  100. in string aClassName,
  101. in string aContractID,
  102. in nsIFactory aFactory);
  103. /**
  104. * unregisterFactory
  105. *
  106. * Unregister a factory associated with CID aClass.
  107. *
  108. * @param aClass : CID being unregistered
  109. * @param aFactory : Factory previously registered to create instances of
  110. * CID aClass.
  111. *
  112. * @return NS_OK Unregistration was successful.
  113. * NS_ERROR* Method failure.
  114. */
  115. void unregisterFactory(in nsCIDRef aClass,
  116. in nsIFactory aFactory);
  117. /**
  118. * registerFactoryLocation
  119. *
  120. * Register a factory with a given ContractID, CID and Class Name
  121. *
  122. * @param aClass : CID of object
  123. * @param aClassName : Class Name of CID
  124. * @param aContractID : ContractID associated with CID aClass
  125. * @param aFile : Component File. This file must have an associated
  126. * loader and export the required symbols which this
  127. * loader specifies.
  128. * @param aLoaderStr : Opaque loader specific string. This value is
  129. * passed into the nsIModule's registerSelf
  130. * callback and must be fowarded unmodified when
  131. * registering factories via their location.
  132. * @param aType : Component Type of CID aClass. This value is
  133. * passed into the nsIModule's registerSelf
  134. * callback and must be fowarded unmodified when
  135. * registering factories via their location.
  136. *
  137. * @return NS_OK Registration was successful.
  138. * NS_ERROR* Method failure.
  139. */
  140. void registerFactoryLocation(in nsCIDRef aClass,
  141. in string aClassName,
  142. in string aContractID,
  143. in nsIFile aFile,
  144. in string aLoaderStr,
  145. in string aType);
  146. /**
  147. * unregisterFactoryLocation
  148. *
  149. * Unregister a factory associated with CID aClass.
  150. *
  151. * @param aClass : CID being unregistered
  152. * @param aFile : Component File previously registered
  153. *
  154. * @return NS_OK Unregistration was successful.
  155. * NS_ERROR* Method failure.
  156. */
  157. void unregisterFactoryLocation(in nsCIDRef aClass,
  158. in nsIFile aFile);
  159. /**
  160. * isCIDRegistered
  161. *
  162. * Returns true if a factory is registered for the CID.
  163. *
  164. * @param aClass : CID queried for registeration
  165. * @return : true if a factory is registered for CID
  166. * false otherwise.
  167. */
  168. boolean isCIDRegistered(in nsCIDRef aClass);
  169. /**
  170. * isContractIDRegistered
  171. *
  172. * Returns true if a factory is registered for the contract id.
  173. *
  174. * @param aClass : contract id queried for registeration
  175. * @return : true if a factory is registered for contract id
  176. * false otherwise.
  177. */
  178. boolean isContractIDRegistered(in string aContractID);
  179. /**
  180. * enumerateCIDs
  181. *
  182. * Enumerate the list of all registered CIDs.
  183. *
  184. * @return : enumerator for CIDs. Elements of the enumeration can be QI'ed
  185. * for the nsISupportsID interface. From the nsISupportsID, you
  186. * can obtain the actual CID.
  187. */
  188. nsISimpleEnumerator enumerateCIDs();
  189. /**
  190. * enumerateContractIDs
  191. *
  192. * Enumerate the list of all registered ContractIDs.
  193. *
  194. * @return : enumerator for ContractIDs. Elements of the enumeration can be
  195. * QI'ed for the nsISupportsCString interface. From the
  196. * nsISupportsCString interface, you can obtain the actual
  197. * Contract ID string.
  198. */
  199. nsISimpleEnumerator enumerateContractIDs();
  200. /**
  201. * CIDToContractID
  202. *
  203. * Returns the Contract ID for a given CID, if one exists and is registered.
  204. *
  205. * @return : Contract ID.
  206. */
  207. string CIDToContractID(in nsCIDRef aClass);
  208. /**
  209. * contractIDToCID
  210. *
  211. * Returns the CID for a given Contract ID, if one exists and is registered.
  212. *
  213. * @return : Contract ID.
  214. */
  215. nsCIDPtr contractIDToCID(in string aContractID);
  216. };