1 | /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ |
---|
2 | /* |
---|
3 | * The contents of this file are subject to the Netscape Public License |
---|
4 | * Version 1.1 (the "NPL"); you may not use this file except in |
---|
5 | * compliance with the NPL. You may obtain a copy of the NPL at |
---|
6 | * http://www.mozilla.org/NPL/ |
---|
7 | * |
---|
8 | * Software distributed under the NPL is distributed on an "AS IS" basis, |
---|
9 | * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL |
---|
10 | * for the specific language governing rights and limitations under the |
---|
11 | * NPL. |
---|
12 | * |
---|
13 | * The Initial Developer of this code under the NPL is Netscape |
---|
14 | * Communications Corporation. Portions created by Netscape are |
---|
15 | * Copyright (C) 1998 Netscape Communications Corporation. All Rights |
---|
16 | * Reserved. |
---|
17 | */ |
---|
18 | |
---|
19 | #include "nsISupports.idl" |
---|
20 | #include "nsIFactory.idl" |
---|
21 | |
---|
22 | interface nsIFile; |
---|
23 | interface nsIEnumerator; |
---|
24 | |
---|
25 | [scriptable, uuid(8458a740-d5dc-11d2-92fb-00e09805570f)] |
---|
26 | interface nsIComponentManagerObsolete : nsISupports |
---|
27 | { |
---|
28 | /** |
---|
29 | * findFactory |
---|
30 | * |
---|
31 | * Returns the factory object that can be used to create instances of |
---|
32 | * CID aClass |
---|
33 | * |
---|
34 | * @param aClass The classid of the factory that is being requested |
---|
35 | */ |
---|
36 | nsIFactory findFactory(in nsCIDRef aClass); |
---|
37 | |
---|
38 | /** |
---|
39 | * getClassObject |
---|
40 | * |
---|
41 | * @param aClass : CID of the class whose class object is requested |
---|
42 | * @param aIID : IID of an interface that the class object is known to |
---|
43 | * to implement. nsISupports and nsIFactory are known to |
---|
44 | * be implemented by the class object. |
---|
45 | */ |
---|
46 | [noscript] voidPtr getClassObject(in nsCIDRef aClass, in nsIIDRef aIID); |
---|
47 | |
---|
48 | /** |
---|
49 | * contractIDToClassID |
---|
50 | * |
---|
51 | * Get the ClassID for a given ContractID. Many ClassIDs may implement a |
---|
52 | * ContractID. In such a situation, this returns the preferred ClassID, which |
---|
53 | * happens to be the last registered ClassID. |
---|
54 | * |
---|
55 | * @param aContractID : Contractid for which ClassID is requested |
---|
56 | * @return aClass : ClassID return |
---|
57 | */ |
---|
58 | [notxpcom] nsresult contractIDToClassID(in string aContractID, out nsCID aClass); |
---|
59 | |
---|
60 | /** |
---|
61 | * classIDToContractid |
---|
62 | * |
---|
63 | * Get the ContractID for a given ClassID. A ClassIDs may implement multiple |
---|
64 | * ContractIDs. This function return the last registered ContractID. |
---|
65 | * |
---|
66 | * @param aClass : ClassID for which ContractID is requested. |
---|
67 | * @return aClassName : returns class name asssociated with aClass |
---|
68 | * @return : ContractID last registered for aClass |
---|
69 | */ |
---|
70 | string CLSIDToContractID(in nsCIDRef aClass, out string aClassName); |
---|
71 | |
---|
72 | /** |
---|
73 | * createInstance |
---|
74 | * |
---|
75 | * Create an instance of the CID aClass and return the interface aIID. |
---|
76 | * |
---|
77 | * @param aClass : ClassID of object instance requested |
---|
78 | * @param aDelegate : Used for aggregation |
---|
79 | * @param aIID : IID of interface requested |
---|
80 | */ |
---|
81 | [noscript] voidPtr createInstance(in nsCIDRef aClass, |
---|
82 | in nsISupports aDelegate, |
---|
83 | in nsIIDRef aIID); |
---|
84 | |
---|
85 | /** |
---|
86 | * createInstanceByContractID |
---|
87 | * |
---|
88 | * Create an instance of the CID that implements aContractID and return the |
---|
89 | * interface aIID. This is a convenience function that effectively does |
---|
90 | * ContractIDToClassID() followed by CreateInstance(). |
---|
91 | * |
---|
92 | * @param aContractID : aContractID of object instance requested |
---|
93 | * @param aDelegate : Used for aggregation |
---|
94 | * @param aIID : IID of interface requested |
---|
95 | */ |
---|
96 | [noscript] voidPtr createInstanceByContractID(in string aContractID, |
---|
97 | in nsISupports aDelegate, |
---|
98 | in nsIIDRef IID); |
---|
99 | /** |
---|
100 | * registryLocationForSpec |
---|
101 | * |
---|
102 | * Given a file specification, return the registry representation of |
---|
103 | * the filename. Files that are found relative to the components |
---|
104 | * directory will have a registry representation |
---|
105 | * "rel:<relative-native-path>" while filenames that are not, will have |
---|
106 | * "abs:<full-native-path>". |
---|
107 | */ |
---|
108 | string registryLocationForSpec(in nsIFile aSpec); |
---|
109 | |
---|
110 | /** |
---|
111 | * specForRegistyLocation |
---|
112 | * |
---|
113 | * Create a file specification for the registry representation (rel:/abs:) |
---|
114 | * got via registryLocationForSpec. |
---|
115 | */ |
---|
116 | nsIFile specForRegistryLocation(in string aLocation); |
---|
117 | |
---|
118 | /** |
---|
119 | * registerFactory |
---|
120 | * |
---|
121 | * Register a factory and ContractID associated with CID aClass |
---|
122 | * |
---|
123 | * @param aClass : CID of object |
---|
124 | * @param aClassName : Class Name of CID |
---|
125 | * @param aContractID : ContractID associated with CID aClass |
---|
126 | * @param aFactory : Factory that will be registered for CID aClass |
---|
127 | * @param aReplace : Boolean that indicates whether to replace a previous |
---|
128 | * registration for the CID aClass. |
---|
129 | */ |
---|
130 | void registerFactory(in nsCIDRef aClass, in string aClassName, |
---|
131 | in string aContractID, in nsIFactory aFactory, |
---|
132 | in boolean aReplace); |
---|
133 | |
---|
134 | /** |
---|
135 | * registerComponent |
---|
136 | * |
---|
137 | * Register a native dll module via its registry representation as returned |
---|
138 | * by registryLocationForSpec() as the container of CID implemenation |
---|
139 | * aClass and associate aContractID and aClassName to the CID aClass. Native |
---|
140 | * dll component type is assumed. |
---|
141 | * |
---|
142 | * @param aClass : CID implemenation contained in module |
---|
143 | * @param aClassName : Class name associated with CID aClass |
---|
144 | * @param aContractID : ContractID associated with CID aClass |
---|
145 | * @param aLocation : Location of module (dll). Format of this is the |
---|
146 | * registry representation as returned by |
---|
147 | * registryLocationForSpec() |
---|
148 | * @param aReplace : Boolean that indicates whether to replace a previous |
---|
149 | * module registration for aClass. |
---|
150 | * @param aPersist : Remember this registration across sessions. |
---|
151 | */ |
---|
152 | void registerComponent(in nsCIDRef aClass, in string aClassName, |
---|
153 | in string aContractID, in string aLocation, |
---|
154 | in boolean aReplace, in boolean aPersist); |
---|
155 | |
---|
156 | /** |
---|
157 | * registerComponentWithType |
---|
158 | * |
---|
159 | * Register a module's location via its registry representation |
---|
160 | * as returned by registryLocationForSpec() as the container of CID implemenation |
---|
161 | * aClass of type aType and associate aContractID and aClassName to the CID aClass. |
---|
162 | * |
---|
163 | * @param aClass : CID implemenation contained in module |
---|
164 | * @param aClassName : Class name associated with CID aClass |
---|
165 | * @param aContractID : ContractID associated with CID aClass |
---|
166 | * @param aSpec : Filename spec for module's location. |
---|
167 | * @param aLocation : Location of module of type aType. Format of this string |
---|
168 | * is the registry representation as returned by |
---|
169 | * registryLocationForSpec() |
---|
170 | * @param aReplace : Boolean that indicates whether to replace a previous |
---|
171 | * loader registration for aClass. |
---|
172 | * @param aPersist : Remember this registration across sessions. |
---|
173 | * @param aType : Component Type of CID aClass. |
---|
174 | */ |
---|
175 | void registerComponentWithType(in nsCIDRef aClass, in string aClassName, |
---|
176 | in string aContractID, in nsIFile aSpec, |
---|
177 | in string aLocation, in boolean aReplace, |
---|
178 | in boolean aPersist, in string aType); |
---|
179 | |
---|
180 | /** |
---|
181 | * registerComponentSpec |
---|
182 | * |
---|
183 | * Register a native dll module via its file specification as the container |
---|
184 | * of CID implemenation aClass and associate aContractID and aClassName to the |
---|
185 | * CID aClass. Native dll component type is assumed. |
---|
186 | * |
---|
187 | * @param aClass : CID implemenation contained in module |
---|
188 | * @param aClassName : Class name associated with CID aClass |
---|
189 | * @param aContractID : ContractID associated with CID aClass |
---|
190 | * @param aLibrary : File specification Location of module (dll). |
---|
191 | * @param aReplace : Boolean that indicates whether to replace a previous |
---|
192 | * module registration for aClass. |
---|
193 | * @param aPersist : Remember this registration across sessions. |
---|
194 | */ |
---|
195 | void registerComponentSpec(in nsCIDRef aClass, in string aClassName, |
---|
196 | in string aContractID, in nsIFile aLibrary, |
---|
197 | in boolean aReplace, in boolean aPersist); |
---|
198 | |
---|
199 | /** |
---|
200 | * registerComponentLib |
---|
201 | * |
---|
202 | * Register a native dll module via its dll name (not full path) as the |
---|
203 | * container of CID implemenation aClass and associate aContractID and aClassName |
---|
204 | * to the CID aClass. Native dll component type is assumed and the system |
---|
205 | * services will be used to load this dll. |
---|
206 | * |
---|
207 | * @param aClass : CID implemenation contained in module |
---|
208 | * @param aClassName : Class name associated with CID aClass |
---|
209 | * @param aContractID : ContractID associated with CID aClass |
---|
210 | * @param aDllNameLocation : Dll name of module. |
---|
211 | * @param aReplace : Boolean that indicates whether to replace a previous |
---|
212 | * module registration for aClass. |
---|
213 | * @param aPersist : Remember this registration across sessions. |
---|
214 | */ |
---|
215 | void registerComponentLib(in nsCIDRef aClass, in string aClassName, |
---|
216 | in string aContractID, in string aDllName, |
---|
217 | in boolean aReplace, in boolean aPersist); |
---|
218 | |
---|
219 | /** |
---|
220 | * unregisterFactory |
---|
221 | * |
---|
222 | * Unregister a factory associated with CID aClass. |
---|
223 | * |
---|
224 | * @param aClass : ClassID being unregistered |
---|
225 | * @param aFactory : Factory previously registered to create instances of |
---|
226 | * ClassID aClass. |
---|
227 | */ |
---|
228 | void unregisterFactory(in nsCIDRef aClass, in nsIFactory aFactory); |
---|
229 | |
---|
230 | /** |
---|
231 | * unregisterComponent |
---|
232 | * |
---|
233 | * Disassociate module aLocation represented as registry location as returned |
---|
234 | * by registryLocationForSpec() as containing ClassID aClass. |
---|
235 | * |
---|
236 | * @param aClass : ClassID being unregistered |
---|
237 | * @param aLocation : Location of module. Format of this is the registry |
---|
238 | * representation as returned by registryLocationForSpec(). |
---|
239 | * Components of any type will be unregistered. |
---|
240 | */ |
---|
241 | void unregisterComponent(in nsCIDRef aClass, in string aLocation); |
---|
242 | |
---|
243 | /** |
---|
244 | * unregisterComponentSpec |
---|
245 | * |
---|
246 | * Disassociate module references by file specification aLibrarySpec as |
---|
247 | * containing ClassID aClass. |
---|
248 | */ |
---|
249 | void unregisterComponentSpec(in nsCIDRef aClass, in nsIFile aLibrarySpec); |
---|
250 | |
---|
251 | /** |
---|
252 | * freeLibraries |
---|
253 | * |
---|
254 | * Enumerates all loaded modules and unloads unused modules. |
---|
255 | */ |
---|
256 | void freeLibraries(); |
---|
257 | |
---|
258 | /** |
---|
259 | * ID values for 'when' |
---|
260 | */ |
---|
261 | const long NS_Startup = 0; |
---|
262 | const long NS_Script = 1; |
---|
263 | const long NS_Timer = 2; |
---|
264 | const long NS_Shutdown = 3; |
---|
265 | |
---|
266 | /** |
---|
267 | * autoRegister |
---|
268 | * |
---|
269 | * Enumerates directory looking for modules of all types and registers |
---|
270 | * modules who have changed (modtime or size) since the last time |
---|
271 | * autoRegister() was invoked. |
---|
272 | * |
---|
273 | * @param when : ID values of when the call is being made. |
---|
274 | * @param directory : Directory the will be enumerated. |
---|
275 | */ |
---|
276 | void autoRegister(in long when, in nsIFile directory); |
---|
277 | |
---|
278 | /** |
---|
279 | * autoRegisterComponent |
---|
280 | * |
---|
281 | * Loads module using appropriate loader and gives it an opportunity to |
---|
282 | * register its CIDs if module's modtime or size changed since the last |
---|
283 | * time this was called. |
---|
284 | * |
---|
285 | * @param when : ID values of when the call is being made. |
---|
286 | * @param aFileLocation : File specification of module. |
---|
287 | */ |
---|
288 | void autoRegisterComponent(in long when, in nsIFile aFileLocation); |
---|
289 | |
---|
290 | /** |
---|
291 | * autoUnregisterComponent |
---|
292 | * |
---|
293 | * Loads module using approriate loader and gives it an opportunity to |
---|
294 | * unregister its CIDs |
---|
295 | */ |
---|
296 | void autoUnregisterComponent(in long when, in nsIFile aFileLocation); |
---|
297 | |
---|
298 | /** |
---|
299 | * isRegistered |
---|
300 | * |
---|
301 | * Returns true if a factory or module is registered for CID aClass. |
---|
302 | * |
---|
303 | * @param aClass : ClassID queried for registeration |
---|
304 | * @return : true if a factory or module is registered for CID aClass. |
---|
305 | * false otherwise. |
---|
306 | */ |
---|
307 | boolean isRegistered(in nsCIDRef aClass); |
---|
308 | |
---|
309 | /** |
---|
310 | * enumerateCLSIDs |
---|
311 | * |
---|
312 | * Enumerate the list of all registered ClassIDs. |
---|
313 | * |
---|
314 | * @return : enumerator for ClassIDs. |
---|
315 | */ |
---|
316 | nsIEnumerator enumerateCLSIDs(); |
---|
317 | |
---|
318 | /** |
---|
319 | * enumerateContractIDs |
---|
320 | * |
---|
321 | * Enumerate the list of all registered ContractIDs. |
---|
322 | * |
---|
323 | * @return : enumerator for ContractIDs. |
---|
324 | */ |
---|
325 | nsIEnumerator enumerateContractIDs(); |
---|
326 | }; |
---|
327 | |
---|
328 | %{ C++ |
---|
329 | /* include after the class def'n, because it needs to see it. */ |
---|
330 | #include "nsComponentManagerUtils.h" |
---|
331 | %} C++ |
---|
332 | |
---|