1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 | var AbstractMethodError = require("./errors").AbstractMethodError;
|
11 | var AbstractClassError = require("./errors").AbstractClassError;
|
12 | var LangUtils = require("./utils").LangUtils;
|
13 |
|
14 |
|
15 |
|
16 |
|
17 |
|
18 |
|
19 |
|
20 | function IApplication(configPath) {
|
21 | if (this.constructor === IApplication.prototype.constructor) {
|
22 | throw new AbstractClassError();
|
23 | }
|
24 | }
|
25 |
|
26 |
|
27 |
|
28 |
|
29 |
|
30 |
|
31 |
|
32 |
|
33 | IApplication.prototype.useStrategy = function(serviceCtor, strategyCtor) {
|
34 | throw new AbstractMethodError();
|
35 | };
|
36 |
|
37 |
|
38 |
|
39 |
|
40 |
|
41 |
|
42 | IApplication.prototype.hasStrategy = function(serviceCtor) {
|
43 | throw new AbstractMethodError();
|
44 | };
|
45 |
|
46 |
|
47 |
|
48 |
|
49 |
|
50 |
|
51 |
|
52 | IApplication.prototype.getStrategy = function(serviceCtor) {
|
53 | throw new AbstractMethodError();
|
54 | };
|
55 |
|
56 |
|
57 |
|
58 | IApplication.prototype.getConfiguration = function() {
|
59 | throw new AbstractMethodError();
|
60 | };
|
61 |
|
62 |
|
63 |
|
64 |
|
65 |
|
66 |
|
67 |
|
68 |
|
69 |
|
70 | function IApplicationService(app) {
|
71 | if (this.constructor === IApplicationService.prototype.constructor) {
|
72 | throw new AbstractClassError();
|
73 | }
|
74 | }
|
75 |
|
76 |
|
77 |
|
78 |
|
79 | IApplicationService.prototype.getApplication = function() {
|
80 | throw new AbstractMethodError();
|
81 | };
|
82 |
|
83 |
|
84 |
|
85 |
|
86 |
|
87 |
|
88 |
|
89 | function ApplicationService(app) {
|
90 | ApplicationService.super_.bind(this)(app);
|
91 | Object.defineProperty(this, 'application', {
|
92 | configurable: false,
|
93 | enumerable: false,
|
94 | writable: false,
|
95 | value: app
|
96 | });
|
97 | }
|
98 | LangUtils.inherits(ApplicationService,IApplicationService);
|
99 |
|
100 |
|
101 |
|
102 | ApplicationService.prototype.getApplication = function() {
|
103 | return this.application;
|
104 | };
|
105 |
|
106 | module.exports.IApplication = IApplication;
|
107 | module.exports.IApplicationService = IApplicationService;
|
108 | module.exports.ApplicationService = ApplicationService;
|