/*
 * Copyright (c) OutWit Technologies 2007-2017.
 * All rights reserved.
 */

Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");

var utilsComponent = function owUtils_utilsComponent() {
  /*
  // observer registration (called on application startup)
  const osvr = Components.classes['@mozilla.org/observer-service;1']
      .getService(Components.interfaces.nsIObserverService);
  osvr.addObserver(this, "xpcom-shutdown", false);
  osvr.addObserver(this, "final-ui-startup", false);
  */
  this.wrappedJSObject = this;
}

utilsComponent.prototype = {

  classID: Components.ID("{b56ca830-c9ca-11e2-8b8b-0800200c9a66}"),
  classDescription: "OutWit basic XPCOM Component",  
  contractID:       "@outwit.com/outwit/utils;4",
  QueryInterface: XPCOMUtils.generateQI(),

  getComponentDirLocation : function() {
    return __LOCATION__.parent;
  },

  getDatabaseDirLocation : function() {
    var extensionFile = __LOCATION__.parent.parent;
    extensionFile.append('database');
    return extensionFile;
  }
};

/**
 * entrypoint
 */

if (XPCOMUtils.generateNSGetFactory)
  var NSGetFactory = XPCOMUtils.generateNSGetFactory([utilsComponent]);
else
  var NSGetModule = XPCOMUtils.generateNSGetModule([utilsComponent]);
