]> git.evergreen-ils.org Git - Evergreen.git/blob - Open-ILS/xul/staff_client/components/nsOpenILS.js
I see this too much when debugging
[Evergreen.git] / Open-ILS / xul / staff_client / components / nsOpenILS.js
1 function OpenILS(){}
2
3 OpenILS.prototype = {
4
5     help: function () { 
6         dump("Ah ha!  This xpcom isn't really 'xp'.  We make use of the .wrappedJSObject method to get a truly global place to stick data.\n"); 
7     },
8
9     data: {},
10
11     wrappedJSObject: this,
12
13     QueryInterface: function (iid) {
14         if (!iid.equals(Components.interfaces.nsIOpenILS)
15             && !iid.equals(Components.interfaces.nsISupports))
16         {
17             throw Components.results.NS_ERROR_NO_INTERFACE;
18         }
19         return this;
20     }
21 }
22
23 var Module = {
24     firstTime: true,
25
26     registerSelf: function (compMgr, fileSpec, location, type) {
27         if (this.firstTime) {
28             dump("*** Deferring registration of OpenILS data cache\n");
29             this.firstTime = false;
30             throw Components.results.NS_ERROR_FACTORY_REGISTER_AGAIN;
31         }
32         debug("*** Registering OpenILS data cache\n");
33         compMgr = compMgr.QueryInterface(Components.interfaces.nsIComponentRegistrar);
34         compMgr.registerFactoryLocation(this.myCID,
35                                         "OpenILS data cache",
36                                         this.myProgID,
37                                         fileSpec,
38                                         location,
39                                         type);
40     },
41
42     getClassObject : function (compMgr, cid, iid) {
43         if (!cid.equals(this.myCID))
44         throw Components.results.NS_ERROR_NO_INTERFACE
45         if (!iid.equals(Components.interfaces.nsIFactory))
46         throw Components.results.NS_ERROR_NOT_IMPLEMENTED;
47         return this.myFactory;
48     },
49
50     myCID: Components.ID("{dc3e4b5f-c0f4-4b34-bc57-7b4099c3a5d6}"),
51     myProgID: "@mozilla.org/openils_data_cache;1",
52
53     myFactory: {
54         createInstance: function (outer, iid) {
55             //dump("CI: " + iid + "\n");
56             if (outer != null)
57             throw Components.results.NS_ERROR_NO_AGGREGATION;
58             return (new OpenILS()).QueryInterface(iid);
59         }
60     },
61
62     canUnload: function(compMgr) {
63         dump("****** Unloading: OpenILS data cache! ****** \n");
64         return true;
65     }
66 }; // END Module
67
68 function NSGetModule(compMgr, fileSpec) { return Module; }
69