123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146 |
- "use strict";
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- var _react = _interopRequireDefault(require("react"));
- var _Logger = _interopRequireDefault(require("./Logger"));
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
- function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
- var Systems =
- /*#__PURE__*/
- function () {
- function Systems() {
- _classCallCheck(this, Systems);
- this.CoreSystem = null;
- this.subSystems = {
- core: null
- };
- this.modules = {};
- this.services = {};
- }
- _createClass(Systems, [{
- key: "setCore",
- value: function setCore(core) {
- this.subSystems.core = core;
- this.CoreSystem = core;
- core.LinkManager.disableCore();
- this.decorate('core', core.ModuleSystem);
- this.decorate('core', core.ServiceSystem);
- this.decorate('core', core.LinkManager);
- this.decorate('core', core.RoutingSystem);
- return core;
- }
- }, {
- key: "getCore",
- value: function getCore() {
- return this.CoreSystem;
- }
- }, {
- key: "addSystem",
- value: function addSystem(core) {
- var id = core.id;
- if (!id) {
- _Logger.default.error("Cannot addSystem core.id is not defined!", core, id);
- return;
- }
- this.subSystems[id] = core;
- this.decorate(id, core.ModuleSystem);
- this.decorate(id, core.ServiceSystem);
- this.decorate(id, core.LinkManager);
- this.decorate(id, core.RoutingSystem);
- }
- }, {
- key: "getSystem",
- value: function getSystem(id) {
- return this.subSystems[id];
- }
- }, {
- key: "decorate",
- value: function decorate(id, obj) {
- obj.CoreSystem = this.subSystems[id];
- obj.ModuleSystem = this.subSystems[id].ModuleSystem;
- obj.ServiceSystem = this.subSystems[id].ServiceSystem;
- obj.RoutingSystem = this.subSystems[id].RoutingSystem;
- obj.LinkManager = this.subSystems[id].LinkManager;
- }
- }, {
- key: "systemAdmin",
- value: function systemAdmin(id) {
- // ?
- var LM = this.subSystems[id].LinkManager;
- }
- }, {
- key: "addService",
- value: function addService(ser) {
- this.services[(ser.Namespace || 'General') + (ser.Category || 'Uncategorized') + ser.name] = ser;
- }
- }, {
- key: "addModule",
- value: function addModule(mod) {
- this.modules[(mod.Namespace || 'General') + (mod.Category || 'Uncategorized') + mod.name] = mod;
- }
- }, {
- key: "addServices",
- value: function addServices(sers) {
- for (var i in sers) {
- this.addService(sers[i]);
- }
- }
- }, {
- key: "addModules",
- value: function addModules(mods) {
- console.log("Adding Modules");
- for (var i in mods) {
- console.log(mods[i]);
- this.addModule(mods[i]);
- }
- }
- }, {
- key: "getModule",
- value: function getModule(name) {
- var Category = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'Uncategorized';
- var Namespace = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'General';
- return this.modules[Namespace + Category + name];
- }
- }, {
- key: "getService",
- value: function getService(name) {
- var Category = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'Uncategorized';
- var Namespace = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'General';
- return this.services[Namespace + Category + name];
- }
- }, {
- key: "getModules",
- value: function getModules() {
- return this.modules;
- }
- }, {
- key: "getServices",
- value: function getServices() {
- return this.services;
- }
- }]);
- return Systems;
- }();
- var _default = new Systems();
- exports.default = _default;
|