Back to index

lightning-sunbird  0.9+nobinonly
Public Member Functions | Public Attributes | Static Private Attributes
xpcom.server.module.Module Class Reference

List of all members.

Public Member Functions

def __init__
def getClassObject
def registerSelf
def unregisterSelf
def canUnload

Public Attributes

 components
 klassFactory

Static Private Attributes

 _com_interfaces_ = components.interfaces.nsIModule

Detailed Description

Definition at line 46 of file module.py.


Constructor & Destructor Documentation

def xpcom.server.module.Module.__init__ (   self,
  comps 
)

Definition at line 48 of file module.py.

00048 
00049     def __init__(self, comps):
00050         # Build a map of classes we can provide factories for.
00051         c = self.components = {}
00052         for klass in comps:
00053             c[components.ID(klass._reg_clsid_)] = klass
00054         self.klassFactory = factory.Factory


Member Function Documentation

def xpcom.server.module.Module.canUnload (   self,
  compMgr 
)

Definition at line 105 of file module.py.

00105 
00106     def canUnload(self, compMgr):
00107         # single bool result
00108         return 0 # we can never unload!
00109 
def xpcom.server.module.Module.getClassObject (   self,
  compMgr,
  clsid,
  iid 
)

Definition at line 55 of file module.py.

00055 
00056     def getClassObject(self, compMgr, clsid, iid):
00057         # Single retval result.
00058         try:
00059             klass = self.components[clsid]
00060         except KeyError:
00061             raise ServerException(nsError.NS_ERROR_FACTORY_NOT_REGISTERED)
00062         
00063         # We can ignore the IID - the auto-wrap process will automatically QI us.
00064         return self.klassFactory(klass)

def xpcom.server.module.Module.registerSelf (   self,
  compMgr,
  location,
  loaderStr,
  componentType 
)

Definition at line 65 of file module.py.

00065 
00066     def registerSelf(self, compMgr, location, loaderStr, componentType):
00067         # void function.
00068         fname = os.path.basename(location.path)
00069         for klass in self.components.values():
00070             reg_contractid = klass._reg_contractid_
00071             print "Registering '%s' (%s)" % (reg_contractid, fname)
00072             reg_desc = getattr(klass, "_reg_desc_", reg_contractid)
00073             compMgr = compMgr.queryInterface(components.interfaces.nsIComponentRegistrar)
00074             compMgr.registerFactoryLocation(klass._reg_clsid_,
00075                                               reg_desc,
00076                                               reg_contractid,
00077                                               location,
00078                                               loaderStr,
00079                                               componentType)
00080 
00081             # See if this class nominates custom register_self
00082             extra_func = getattr(klass, "_reg_registrar_", (None,None))[0]
00083             if extra_func is not None:
00084                 extra_func(klass, compMgr, location, loaderStr, componentType)

def xpcom.server.module.Module.unregisterSelf (   self,
  compMgr,
  location,
  loaderStr 
)

Definition at line 85 of file module.py.

00085 
00086     def unregisterSelf(self, compMgr, location, loaderStr):
00087         # void function.
00088         for klass in self.components.values():
00089             ok = 1
00090             try:
00091                 compMgr.unregisterComponentSpec(klass._reg_clsid_, location)
00092             except Exception:
00093                 ok = 0
00094             # Give the class a bash even if we failed!
00095             extra_func = getattr(klass, "_reg_registrar_", (None,None))[1]
00096             if extra_func is not None:
00097                 try:
00098                     extra_func(klass, compMgr, location, loaderStr)
00099                 except Exception:
00100                     ok = 0
00101             if ok:
00102                 print "Successfully unregistered", klass.__name__
00103             else:
00104                 print "Unregistration of", klass.__name__, "failed. (probably just not already registered)"
        

Member Data Documentation

xpcom.server.module.Module._com_interfaces_ = components.interfaces.nsIModule [static, private]

Definition at line 47 of file module.py.

Definition at line 50 of file module.py.

Definition at line 53 of file module.py.


The documentation for this class was generated from the following file: