2016-04-22 19:23:44 +08:00
|
|
|
import {IUserManager} from "./IUserManager";
|
|
|
|
import {IGalleryManager} from "./IGalleryManager";
|
2016-05-05 00:34:54 +08:00
|
|
|
import {ISearchManager} from "./ISearchManager";
|
2016-04-22 19:23:44 +08:00
|
|
|
|
2016-05-09 23:04:56 +08:00
|
|
|
export class ObjectManagerRepository {
|
|
|
|
|
2016-04-22 19:23:44 +08:00
|
|
|
private _galleryManager:IGalleryManager;
|
|
|
|
private _userManager:IUserManager;
|
2016-05-05 00:34:54 +08:00
|
|
|
private _searchManager:ISearchManager;
|
2016-04-22 19:23:44 +08:00
|
|
|
private static _instance:ObjectManagerRepository = null;
|
|
|
|
|
|
|
|
|
2016-05-09 23:04:56 +08:00
|
|
|
public static MemoryMongoManagers() {
|
2016-06-17 06:05:31 +08:00
|
|
|
let GalleryManager = require("./memory/GalleryManager").GalleryManager;
|
|
|
|
let UserManager = require("./memory/UserManager").UserManager;
|
|
|
|
let SearchManager = require("./memory/SearchManager").SearchManager;
|
2016-04-22 19:23:44 +08:00
|
|
|
ObjectManagerRepository.getInstance().setGalleryManager(new GalleryManager());
|
|
|
|
ObjectManagerRepository.getInstance().setUserManager(new UserManager());
|
2016-05-05 00:34:54 +08:00
|
|
|
ObjectManagerRepository.getInstance().setSearchManager(new SearchManager());
|
2016-04-22 19:23:44 +08:00
|
|
|
}
|
2016-05-09 23:04:56 +08:00
|
|
|
|
|
|
|
public static getInstance() {
|
|
|
|
if (this._instance === null) {
|
2016-04-22 19:23:44 +08:00
|
|
|
this._instance = new ObjectManagerRepository();
|
|
|
|
}
|
|
|
|
return this._instance;
|
|
|
|
}
|
|
|
|
|
2016-05-26 02:17:42 +08:00
|
|
|
public static reset() {
|
|
|
|
this._instance = null;
|
|
|
|
}
|
|
|
|
|
2016-04-22 19:23:44 +08: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-05 00:34:54 +08:00
|
|
|
|
|
|
|
getSearchManager():ISearchManager {
|
|
|
|
return this._searchManager;
|
|
|
|
}
|
|
|
|
|
|
|
|
setSearchManager(value:ISearchManager) {
|
|
|
|
this._searchManager = value;
|
|
|
|
}
|
|
|
|
|
2016-04-22 19:23:44 +08:00
|
|
|
}
|