You are currently viewing a snapshot of www.mozilla.org taken on April 21, 2008. Most of this content is highly out of date (some pages haven't been updated since the project began in 1998) and exists for historical purposes only. If there are any pages on this archive site that you think should be added back to www.mozilla.org, please file a bug.


TOC PREV NEXT INDEX

Embedding Gecko API


nsIServiceManager


This interface provides a means to obtain global services (ie, access to a singleton object) in an application. The service manager depends on the registry to find and instantiate factories to obtain services. Users of the service manager must first obtain a pointer to the global service manager by calling NS_GetServiceManager. After that, they can request specific services by calling GetService. When they are finished they should NS_RELEASE the service as usual. A user of a service may keep references to particular services indefinitely and must call Release only when it shuts down. This interface is scriptable.

Method
getService

Returns the object that implements aClass and the interface aIID. This may result in the object being created.

Syntax:

void nsIServiceManager::getService(in nsCIDRef aClass,
	in nsIIDRef aIID,
	[iid_is(aIID),retval] out nsQIResult result) 

Parameters:

aClass: The class ID of the requested class.
aIID : The interface ID of the requested interface.
result: [out] The resulting service.

nsresult:

NS_OK if successful.
getServiceByContractID

Returns the object that implements aContractID and the interface aIID. This may result in the instance being created.

Syntax:

void nsIServiceManager::getServiceByContractID(
	in string aContractID, in nsIIDRef aIID,
	[iid_is(aIID),retval] out nsQIResult result)  

Parameters:

aContractID: The contract ID of the requested class.
aIID : The interface ID of the requested interface.
result: [out] The reference to return.

nsresult:

NS_OK if successful.
isServiceInstantiated

Returns TRUE if the singleton service object has already been created.

Syntax:

boolean nsIServiceManager::isServiceInstantiated(
	in nsCIDRef aClass,in nsIIDRef aIID) 

Parameters:

aClass: The class ID of the requested class.
aIID : The interface ID of the requested interface.

Return:

PR_TRUE if the object has already been created.
PR_FALSE if the object has not been created.
isServiceInstantiatedByContractID

Returns TRUE if the singleton service object has already been created.

Syntax:

boolean nsIServiceManager::isServiceInstantiated(
	 in string aContractID,in nsIIDRef aIID) 

Parameters:

aContractID: The contract ID of the requested class.
aIID : The interface ID of the requested interface.

nsresult:

PR_TRUE if the object has already been created.
PR_FALSE if the object has not been created.

Written by:Ellen Evans | Comments, questions, complaints? Bug 143387
TOC PREV NEXT INDEX