diff options
Diffstat (limited to 'node_modules/montage/data')
45 files changed, 4391 insertions, 5388 deletions
diff --git a/node_modules/montage/data/blueprint.js b/node_modules/montage/data/blueprint.js index b3a66167..86a99ee7 100755 --- a/node_modules/montage/data/blueprint.js +++ b/node_modules/montage/data/blueprint.js | |||
@@ -4,94 +4,338 @@ | |||
4 | (c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved. | 4 | (c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved. |
5 | </copyright> */ | 5 | </copyright> */ |
6 | /** | 6 | /** |
7 | @module montage/data/blueprint | 7 | @module montage/data/blueprint |
8 | @requires montage/core/core | 8 | @requires montage/core/core |
9 | @requires montage/data/store | 9 | @requires montage/data/store |
10 | @requires montage/data/objectid | 10 | @requires montage/data/object-id |
11 | @requires data/query | 11 | @requires data/query |
12 | @requires core/exception | 12 | @requires core/exception |
13 | @requires data/objectproperty | 13 | @requires data/object-property |
14 | @requires core/promise | 14 | @requires core/promise |
15 | @requires core/logger | 15 | @requires core/logger |
16 | */ | 16 | */ |
17 | var Montage = require("montage").Montage; | 17 | var Montage = require("montage").Montage; |
18 | var Store = require("data/store").Store; | 18 | var MappingFolder = require("data/mapping").MappingFolder; |
19 | var TemporaryObjectId = require("data/objectid").TemporaryObjectId; | 19 | var TemporaryObjectId = require("data/object-id").TemporaryObjectId; |
20 | var Query = require("data/query").Query; | 20 | var Query = require("data/query").Query; |
21 | var Exception = require("core/exception").Exception; | 21 | var ObjectProperty = require("data/object-property").ObjectProperty; |
22 | var ObjectProperty = require("data/objectproperty").ObjectProperty; | ||
23 | var Promise = require("core/promise").Promise; | 22 | var Promise = require("core/promise").Promise; |
23 | var Exception = require("core/exception").Exception; | ||
24 | var logger = require("core/logger").logger("blueprint"); | 24 | var logger = require("core/logger").logger("blueprint"); |
25 | /** | ||
26 | @class module:montage/data/blueprint.BlueprintBinder | ||
27 | @classdesc A blueprint binder is a collection of of blueprints for a specific access type. It also includes the connection information. | ||
28 | @extends module:montage/core/core.Montage | ||
29 | */ | ||
30 | var BlueprintBinder = exports.BlueprintBinder = Montage.create(Montage,/** @lends module:montage/data/blueprint.BlueprintBinder# */ { | ||
31 | 25 | ||
32 | /** | 26 | /** |
33 | Description TODO | 27 | @private |
34 | @private | 28 | */ |
35 | */ | 29 | var _binderManager = null; |
36 | _blueprintForPrototypeTable: { | ||
37 | value: {}, | ||
38 | serializable: false, | ||
39 | distinct: true, | ||
40 | enumerable: false, | ||
41 | writable: false | ||
42 | }, | ||
43 | /** | 30 | /** |
44 | Description TODO | 31 | @class module:montage/data/blueprint.BlueprintBinderManager |
45 | @type {Property} | 32 | @classdesc A blueprint binder manager is a singleton that is responsible for loading and dispaching binders and blueprints. |
46 | @default {Table} {} | 33 | @extends module:montage/core/core.Montage |
47 | */ | 34 | */ |
48 | restrictionsTable: { | 35 | var BlueprintBinderManager = exports.BlueprintBinderManager = Montage.create(Montage, /** @lends module:montage/data/blueprint.BlueprintBinderManager# */ { |
49 | value: {}, | 36 | |
50 | serializable: true, | 37 | /** |
51 | distinct: true, | 38 | Description TODO |
52 | enumerable: false, | 39 | @function |
53 | writable: false | 40 | @returns itself |
41 | */ | ||
42 | init:{ | ||
43 | serializable:false, | ||
44 | enumerable:false, | ||
45 | value:function () { | ||
46 | return this; | ||
47 | } | ||
54 | }, | 48 | }, |
55 | /** | 49 | |
56 | Description TODO | 50 | /** |
57 | @type {Property} | 51 | Description TODO |
58 | @default {String} null | 52 | @type {Property} Function |
59 | */ | 53 | @default {Array} new Array(10) |
60 | name: { | 54 | */ |
61 | value: null, | 55 | blueprintBinders:{ |
62 | serializable: true | 56 | serializable:true, |
57 | writable:false, | ||
58 | distinct:true, | ||
59 | value:new Array(10) | ||
60 | }, | ||
61 | |||
62 | /** | ||
63 | Add a new blueprint binder. | ||
64 | @function | ||
65 | @param {Property} binder TODO | ||
66 | */ | ||
67 | addBlueprintBinder:{ | ||
68 | value:function (binder) { | ||
69 | if (binder !== null) { | ||
70 | var index = this.blueprintBinders.indexOf(binder); | ||
71 | if (index >= 0) { | ||
72 | this.blueprintBinders.splice(index, 1); | ||
73 | } | ||
74 | this.blueprintBinders.push(binder); | ||
75 | } | ||
76 | } | ||
77 | }, | ||
78 | |||
79 | /** | ||
80 | Description TODO | ||
81 | @function | ||
82 | @param {Property} binder TODO | ||
83 | */ | ||
84 | removeBlueprintBinder:{ | ||
85 | value:function (binder) { | ||
86 | if (binder !== null) { | ||
87 | var index = this.blueprintBinders.indexOf(binder); | ||
88 | if (index >= 0) { | ||
89 | this.blueprintBinders.splice(index, 1); | ||
90 | } | ||
91 | } | ||
92 | } | ||
63 | }, | 93 | }, |
94 | |||
95 | /** | ||
96 | Search through the binders for a blueprint that extends that prototype. | ||
97 | @function | ||
98 | @param {Property} prototypeName TODO | ||
99 | @param {Property} moduleId TODO | ||
100 | @returns The requested blueprint or null if this prototype is not managed. | ||
101 | */ | ||
102 | blueprintForPrototype: { | ||
103 | value: function(prototypeName, moduleId) { | ||
104 | var binder, blueprint, index; | ||
105 | for (index = 0; typeof (binder = this.blueprintBinders[index]) !== "undefined"; index++) { | ||
106 | blueprint = binder.blueprintForPrototype(prototypeName, moduleId); | ||
107 | if (blueprint !== null) { | ||
108 | return blueprint; | ||
109 | } | ||
110 | } | ||
111 | return null; | ||
112 | } | ||
113 | } | ||
114 | |||
115 | }); | ||
116 |