1
0
mirror of https://github.com/xuthus83/pigallery2.git synced 2025-01-14 14:43:17 +08:00
pigallery2/backend/model/ObjectManagerRepository.ts

60 lines
1.7 KiB
TypeScript
Raw Normal View History

2016-05-26 12:05:10 +02:00
///<reference path="../../typings/index.d.ts"/>
2016-04-22 13:23:44 +02:00
import {IUserManager} from "./IUserManager";
import {IGalleryManager} from "./IGalleryManager";
2016-05-04 18:34:54 +02:00
import {ISearchManager} from "./ISearchManager";
2016-04-22 13:23:44 +02:00
2016-05-09 17:04:56 +02:00
export class ObjectManagerRepository {
2016-04-22 13:23:44 +02:00
private _galleryManager:IGalleryManager;
private _userManager:IUserManager;
2016-05-04 18:34:54 +02:00
private _searchManager:ISearchManager;
2016-04-22 13:23:44 +02:00
private static _instance:ObjectManagerRepository = null;
2016-05-09 17:04:56 +02:00
public static MemoryMongoManagers() {
2016-06-17 00:05:31 +02:00
let GalleryManager = require("./memory/GalleryManager").GalleryManager;
let UserManager = require("./memory/UserManager").UserManager;
let SearchManager = require("./memory/SearchManager").SearchManager;
2016-04-22 13:23:44 +02:00
ObjectManagerRepository.getInstance().setGalleryManager(new GalleryManager());
ObjectManagerRepository.getInstance().setUserManager(new UserManager());
2016-05-04 18:34:54 +02:00
ObjectManagerRepository.getInstance().setSearchManager(new SearchManager());
2016-04-22 13:23:44 +02:00
}
2016-05-09 17:04:56 +02:00
public static getInstance() {
if (this._instance === null) {
2016-04-22 13:23:44 +02:00
this._instance = new ObjectManagerRepository();
}
return this._instance;
}
2016-05-25 20:17:42 +02:00
public static reset() {
this._instance = null;
}
2016-04-22 13:23:44 +02:00
getGalleryManager():IGalleryManager {
return this._galleryManager;
}
setGalleryManager(value:IGalleryManager) {
this._galleryManager = value;
}
getUserManager():IUserManager {
return this._userManager;
}
setUserManager(value:IUserManager) {
this._userManager = value;
}
2016-05-04 18:34:54 +02:00
getSearchManager():ISearchManager {
return this._searchManager;
}
setSearchManager(value:ISearchManager) {
this._searchManager = value;
}
2016-04-22 13:23:44 +02:00
}