1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /* ***** BEGIN LICENSE BLOCK *****
3 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
5 * The contents of this file are subject to the Mozilla Public License Version
6 * 1.1 (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
8 * http://www.mozilla.org/MPL/
10 * Software distributed under the License is distributed on an "AS IS" basis,
11 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12 * for the specific language governing rights and limitations under the
15 * The Original Code is mozilla.org Code.
17 * The Initial Developer of the Original Code is
18 * Netscape Communications Corporation.
19 * Portions created by the Initial Developer are Copyright (C) 1998
20 * the Initial Developer. All Rights Reserved.
24 * Alternatively, the contents of this file may be used under the terms of
25 * either of the GNU General Public License Version 2 or later (the "GPL"),
26 * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
27 * in which case the provisions of the GPL or the LGPL are applicable instead
28 * of those above. If you wish to allow use of your version of this file only
29 * under the terms of either the GPL or the LGPL, and not to allow others to
30 * use your version of this file under the terms of the MPL, indicate your
31 * decision by deleting the provisions above and replace them with the notice
32 * and other provisions required by the GPL or the LGPL. If you do not delete
33 * the provisions above, a recipient may use your version of this file under
34 * the terms of any one of the MPL, the GPL or the LGPL.
36 * ***** END LICENSE BLOCK ***** */
38 #include
"nsISupports.idl"
39 #include
"nsIFactory.idl"
42 interface nsIEnumerator
;
44 [scriptable
, uuid(8458a740
-d5dc
-11d2
-92fb
-00e09805570f
)]
45 interface nsIComponentManagerObsolete
: nsISupports
50 * Returns the factory object that can be used to create instances of
53 * @param aClass The classid of the factory that is being requested
55 nsIFactory findFactory
(in nsCIDRef aClass
);
60 * @param aClass : CID of the class whose class object is requested
61 * @param aIID : IID of an interface that the class object is known to
62 * to implement. nsISupports and nsIFactory are known to
63 * be implemented by the class object.
65 [noscript
] voidPtr getClassObject
(in nsCIDRef aClass
, in nsIIDRef aIID
);
70 * Get the ClassID for a given ContractID. Many ClassIDs may implement a
71 * ContractID. In such a situation, this returns the preferred ClassID, which
72 * happens to be the last registered ClassID.
74 * @param aContractID : Contractid for which ClassID is requested
75 * @return aClass : ClassID return
77 [notxpcom
] nsresult contractIDToClassID
(in string aContractID
, out nsCID aClass
);
82 * Get the ContractID for a given ClassID. A ClassIDs may implement multiple
83 * ContractIDs. This function return the last registered ContractID.
85 * @param aClass : ClassID for which ContractID is requested.
86 * @return aClassName : returns class name asssociated with aClass
87 * @return : ContractID last registered for aClass
89 string CLSIDToContractID
(in nsCIDRef aClass
, out string aClassName
);
94 * Create an instance of the CID aClass and return the interface aIID.
96 * @param aClass : ClassID of object instance requested
97 * @param aDelegate : Used for aggregation
98 * @param aIID : IID of interface requested
100 [noscript
] voidPtr createInstance
(in nsCIDRef aClass
,
101 in nsISupports aDelegate
,
105 * createInstanceByContractID
107 * Create an instance of the CID that implements aContractID and return the
108 * interface aIID. This is a convenience function that effectively does
109 * ContractIDToClassID() followed by CreateInstance().
111 * @param aContractID : aContractID of object instance requested
112 * @param aDelegate : Used for aggregation
113 * @param aIID : IID of interface requested
115 [noscript
] voidPtr createInstanceByContractID
(in string aContractID
,
116 in nsISupports aDelegate
,
119 * registryLocationForSpec
121 * Given a file specification, return the registry representation of
122 * the filename. Files that are found relative to the components
123 * directory will have a registry representation
124 * "rel:<relative-native-path>" while filenames that are not, will have
125 * "abs:<full-native-path>".
127 string registryLocationForSpec
(in nsIFile aSpec
);
130 * specForRegistyLocation
132 * Create a file specification for the registry representation (rel:/abs:)
133 * got via registryLocationForSpec.
135 nsIFile specForRegistryLocation
(in string aLocation
);
140 * Register a factory and ContractID associated with CID aClass
142 * @param aClass : CID of object
143 * @param aClassName : Class Name of CID
144 * @param aContractID : ContractID associated with CID aClass
145 * @param aFactory : Factory that will be registered for CID aClass
146 * @param aReplace : Boolean that indicates whether to replace a previous
147 * registration for the CID aClass.
149 void registerFactory
(in nsCIDRef aClass
, in string aClassName
,
150 in string aContractID
, in nsIFactory aFactory
,
151 in boolean aReplace
);
156 * Register a native dll module via its registry representation as returned
157 * by registryLocationForSpec() as the container of CID implemenation
158 * aClass and associate aContractID and aClassName to the CID aClass. Native
159 * dll component type is assumed.
161 * @param aClass : CID implemenation contained in module
162 * @param aClassName : Class name associated with CID aClass
163 * @param aContractID : ContractID associated with CID aClass
164 * @param aLocation : Location of module (dll). Format of this is the
165 * registry representation as returned by
166 * registryLocationForSpec()
167 * @param aReplace : Boolean that indicates whether to replace a previous
168 * module registration for aClass.
169 * @param aPersist : Remember this registration across sessions.
171 void registerComponent
(in nsCIDRef aClass
, in string aClassName
,
172 in string aContractID
, in string aLocation
,
173 in boolean aReplace
, in boolean aPersist
);
176 * registerComponentWithType
178 * Register a module's location via its registry representation
179 * as returned by registryLocationForSpec() as the container of CID implemenation
180 * aClass of type aType and associate aContractID and aClassName to the CID aClass.
182 * @param aClass : CID implemenation contained in module
183 * @param aClassName : Class name associated with CID aClass
184 * @param aContractID : ContractID associated with CID aClass
185 * @param aSpec : Filename spec for module's location.
186 * @param aLocation : Location of module of type aType. Format of this string
187 * is the registry representation as returned by
188 * registryLocationForSpec()
189 * @param aReplace : Boolean that indicates whether to replace a previous
190 * loader registration for aClass.
191 * @param aPersist : Remember this registration across sessions.
192 * @param aType : Component Type of CID aClass.
194 void registerComponentWithType
(in nsCIDRef aClass
, in string aClassName
,
195 in string aContractID
, in nsIFile aSpec
,
196 in string aLocation
, in boolean aReplace
,
197 in boolean aPersist
, in string aType
);
200 * registerComponentSpec
202 * Register a native dll module via its file specification as the container
203 * of CID implemenation aClass and associate aContractID and aClassName to the
204 * CID aClass. Native dll component type is assumed.
206 * @param aClass : CID implemenation contained in module
207 * @param aClassName : Class name associated with CID aClass
208 * @param aContractID : ContractID associated with CID aClass
209 * @param aLibrary : File specification Location of module (dll).
210 * @param aReplace : Boolean that indicates whether to replace a previous
211 * module registration for aClass.
212 * @param aPersist : Remember this registration across sessions.
214 void registerComponentSpec
(in nsCIDRef aClass
, in string aClassName
,
215 in string aContractID
, in nsIFile aLibrary
,
216 in boolean aReplace
, in boolean aPersist
);
219 * registerComponentLib
221 * Register a native dll module via its dll name (not full path) as the
222 * container of CID implemenation aClass and associate aContractID and aClassName
223 * to the CID aClass. Native dll component type is assumed and the system
224 * services will be used to load this dll.
226 * @param aClass : CID implemenation contained in module
227 * @param aClassName : Class name associated with CID aClass
228 * @param aContractID : ContractID associated with CID aClass
229 * @param aDllNameLocation : Dll name of module.
230 * @param aReplace : Boolean that indicates whether to replace a previous
231 * module registration for aClass.
232 * @param aPersist : Remember this registration across sessions.
234 void registerComponentLib
(in nsCIDRef aClass
, in string aClassName
,
235 in string aContractID
, in string aDllName
,
236 in boolean aReplace
, in boolean aPersist
);
241 * Unregister a factory associated with CID aClass.
243 * @param aClass : ClassID being unregistered
244 * @param aFactory : Factory previously registered to create instances of
247 void unregisterFactory
(in nsCIDRef aClass
, in nsIFactory aFactory
);
250 * unregisterComponent
252 * Disassociate module aLocation represented as registry location as returned
253 * by registryLocationForSpec() as containing ClassID aClass.
255 * @param aClass : ClassID being unregistered
256 * @param aLocation : Location of module. Format of this is the registry
257 * representation as returned by registryLocationForSpec().
258 * Components of any type will be unregistered.
260 void unregisterComponent
(in nsCIDRef aClass
, in string aLocation
);
263 * unregisterComponentSpec
265 * Disassociate module references by file specification aLibrarySpec as
266 * containing ClassID aClass.
268 void unregisterComponentSpec
(in nsCIDRef aClass
, in nsIFile aLibrarySpec
);
273 * Enumerates all loaded modules and unloads unused modules.
275 void freeLibraries
();
278 * ID values for 'when'
280 const long NS_Startup
= 0;
281 const long NS_Script
= 1;
282 const long NS_Timer
= 2;
283 const long NS_Shutdown
= 3;
288 * Enumerates directory looking for modules of all types and registers
289 * modules who have changed (modtime or size) since the last time
290 * autoRegister() was invoked.
292 * @param when : ID values of when the call is being made.
293 * @param directory : Directory the will be enumerated.
295 void autoRegister
(in long when
, in nsIFile directory
);
298 * autoRegisterComponent
300 * Loads module using appropriate loader and gives it an opportunity to
301 * register its CIDs if module's modtime or size changed since the last
302 * time this was called.
304 * @param when : ID values of when the call is being made.
305 * @param aFileLocation : File specification of module.
307 void autoRegisterComponent
(in long when
, in nsIFile aFileLocation
);
310 * autoUnregisterComponent
312 * Loads module using approriate loader and gives it an opportunity to
313 * unregister its CIDs
315 void autoUnregisterComponent
(in long when
, in nsIFile aFileLocation
);
320 * Returns true if a factory or module is registered for CID aClass.
322 * @param aClass : ClassID queried for registeration
323 * @return : true if a factory or module is registered for CID aClass.
326 boolean isRegistered
(in nsCIDRef aClass
);
331 * Enumerate the list of all registered ClassIDs.
333 * @return : enumerator for ClassIDs.
335 nsIEnumerator enumerateCLSIDs
();
338 * enumerateContractIDs
340 * Enumerate the list of all registered ContractIDs.
342 * @return : enumerator for ContractIDs.
344 nsIEnumerator enumerateContractIDs
();
348 /* include after the class def'n, because it needs to see it. */
349 #include
"nsComponentManagerUtils.h"