1
/* ***** BEGIN LICENSE BLOCK *****
2
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
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/
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
14
* The Original Code is XPCOM.
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.
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.
34
* ***** END LICENSE BLOCK ***** */
37
* The nsIComponentRegistrar interface.
41
#include "nsISupports.idl"
45
interface nsISimpleEnumerator;
47
[scriptable, uuid(2417cbfe-65ad-48a6-b4b6-eb84db174392)]
48
interface nsIComponentRegistrar : nsISupports
53
* Register a component file or all component files in a directory.
55
* Component files must have an associated loader and export the required
56
* symbols which this loader defines. For example, if the given file is a
57
* native library (which is built into XPCOM), it must export the symbol
58
* "NSGetModule". Other loaders may have different semantics.
60
* This method may only be called from the main thread.
62
* @param aSpec : Filename spec for component file's location. If aSpec
63
* is a directory, then every component file in the
64
* directory will be registered.
65
* If the aSpec is null, then the application component's
66
* directory as defined by NS_XPCOM_COMPONENT_DIR will be
67
* registered (see nsIDirectoryService.idl)
69
* @return NS_OK : Registration was successful.
70
* NS_ERROR: Method failure.
72
void autoRegister(in nsIFile aSpec);
77
* Unregister a component file or all component files in a directory.
78
* This method may only be called from the main thread.
80
* @param aSpec : Filename spec for component file's location. If aSpec
81
* is a directory, the every component file in the directory
83
* If aSpec is null, then the application component's
84
* directory as defined by NS_XPCOM_COMPONENT_DIR will be
85
* registered. (see nsIDirectoryService.idl)
87
* @return NS_OK Unregistration was successful.
88
* NS_ERROR* Method failure.
90
void autoUnregister(in nsIFile aSpec);
96
* Register a factory with a given ContractID, CID and Class Name.
98
* @param aClass : CID of object
99
* @param aClassName : Class Name of CID
100
* @param aContractID : ContractID associated with CID aClass
101
* @param aFactory : Factory that will be registered for CID aClass
103
* @return NS_OK Registration was successful.
104
* NS_ERROR* method failure.
106
void registerFactory(in nsCIDRef aClass,
107
in string aClassName,
108
in string aContractID,
109
in nsIFactory aFactory);
114
* Unregister a factory associated with CID aClass.
116
* @param aClass : CID being unregistered
117
* @param aFactory : Factory previously registered to create instances of
120
* @return NS_OK Unregistration was successful.
121
* NS_ERROR* Method failure.
123
void unregisterFactory(in nsCIDRef aClass,
124
in nsIFactory aFactory);
127
* registerFactoryLocation
129
* Register a factory with a given ContractID, CID and Class Name
131
* @param aClass : CID of object
132
* @param aClassName : Class Name of CID
133
* @param aContractID : ContractID associated with CID aClass
134
* @param aFile : Component File. This file must have an associated
135
* loader and export the required symbols which this
137
* @param aLoaderStr : Opaque loader specific string. This value is
138
* passed into the nsIModule's registerSelf
139
* callback and must be fowarded unmodified when
140
* registering factories via their location.
141
* @param aType : Component Type of CID aClass. This value is
142
* passed into the nsIModule's registerSelf
143
* callback and must be fowarded unmodified when
144
* registering factories via their location.
146
* @return NS_OK Registration was successful.
147
* NS_ERROR* Method failure.
149
void registerFactoryLocation(in nsCIDRef aClass,
150
in string aClassName,
151
in string aContractID,
153
in string aLoaderStr,
157
* unregisterFactoryLocation
159
* Unregister a factory associated with CID aClass.
161
* @param aClass : CID being unregistered
162
* @param aFile : Component File previously registered
164
* @return NS_OK Unregistration was successful.
165
* NS_ERROR* Method failure.
167
void unregisterFactoryLocation(in nsCIDRef aClass,
173
* Returns true if a factory is registered for the CID.
175
* @param aClass : CID queried for registeration
176
* @return : true if a factory is registered for CID
179
boolean isCIDRegistered(in nsCIDRef aClass);
182
* isContractIDRegistered
184
* Returns true if a factory is registered for the contract id.
186
* @param aClass : contract id queried for registeration
187
* @return : true if a factory is registered for contract id
190
boolean isContractIDRegistered(in string aContractID);
195
* Enumerate the list of all registered CIDs.
197
* @return : enumerator for CIDs. Elements of the enumeration can be QI'ed
198
* for the nsISupportsID interface. From the nsISupportsID, you
199
* can obtain the actual CID.
201
nsISimpleEnumerator enumerateCIDs();
204
* enumerateContractIDs
206
* Enumerate the list of all registered ContractIDs.
208
* @return : enumerator for ContractIDs. Elements of the enumeration can be
209
* QI'ed for the nsISupportsCString interface. From the
210
* nsISupportsCString interface, you can obtain the actual
211
* Contract ID string.
213
nsISimpleEnumerator enumerateContractIDs();
218
* Returns the Contract ID for a given CID, if one exists and is registered.
220
* @return : Contract ID.
222
string CIDToContractID(in nsCIDRef aClass);
227
* Returns the CID for a given Contract ID, if one exists and is registered.
229
* @return : Contract ID.
231
nsCIDPtr contractIDToCID(in string aContractID);