diff options
author | Jose Antonio Marquez | 2012-06-20 16:47:37 -0700 |
---|---|---|
committer | Jose Antonio Marquez | 2012-06-20 16:47:37 -0700 |
commit | 313a62245400e6c8cfa6d2f02c603cc7f01ddfc6 (patch) | |
tree | c207d1290be0e894a57b03098bbb7bbe5f2aee86 /node_modules/montage/data/store.js | |
parent | 2496e0d0b0ac5f8c53b12de77f0feda69ce4a2f4 (diff) | |
parent | 392a559e90357d48c910a07617261483b2b45476 (diff) | |
download | ninja-313a62245400e6c8cfa6d2f02c603cc7f01ddfc6.tar.gz |
Merge branch 'refs/heads/Ninja-Internal' into Document
Diffstat (limited to 'node_modules/montage/data/store.js')
-rwxr-xr-x | node_modules/montage/data/store.js | 1421 |
1 files changed, 705 insertions, 716 deletions
diff --git a/node_modules/montage/data/store.js b/node_modules/montage/data/store.js index 5057826d..6a713758 100755 --- a/node_modules/montage/data/store.js +++ b/node_modules/montage/data/store.js | |||
@@ -1,192 +1,158 @@ | |||
1 | /* <copyright> | 1 | /* <copyright> |
2 | This file contains proprietary software owned by Motorola Mobility, Inc.<br/> | 2 | This file contains proprietary software owned by Motorola Mobility, Inc.<br/> |
3 | No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.<br/> | 3 | No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.<br/> |
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/store | 7 | @module montage/data/store |
8 | @requires montage/core/core | 8 | @requires montage/core/core |
9 | @requires montage/data/blueprint | 9 | @requires montage/data/blueprint |
10 | @requires montage/data/query | 10 | @requires montage/data/mapping |
11 | @requires montage/data/restriction | 11 | @requires montage/data/query |
12 | @requires montage/data/transactionid | 12 | @requires montage/data/restriction |
13 | @requires montage/data/objectid | 13 | @requires montage/data/transaction-id |
14 | @requires montage/data/controllistener | 14 | @requires montage/data/object-id |
15 | @requires montage/core/serializer | 15 | @requires montage/data/control-listener |
16 | @requires montage/core/deserializer | 16 | @requires montage/core/serializer |
17 | @requires montage/core/promise | 17 | @requires montage/core/deserializer |
18 | @requires montage/core/logger | 18 | @requires montage/core/promise |
19 | */ | 19 | @requires montage/core/logger |
20 | */ | ||
20 | var Montage = require("montage").Montage; | 21 | var Montage = require("montage").Montage; |
21 | var Blueprint = require("data/blueprint").Blueprint; | 22 | var Blueprint = require("data/blueprint").Blueprint; |
22 | var BlueprintBinder = require("data/blueprint").BlueprintBinder; | 23 | var BlueprintBinder = require("data/blueprint").BlueprintBinder; |
24 | var BinderMapping = require("data/mapping").BinderMapping; | ||
25 | var BlueprintMapping = require("data/mapping").BlueprintMapping; | ||
26 | var AttributeMapping = require("data/mapping").AttributeMapping; | ||
27 | var AssociationMapping = require("data/mapping").AssociationMapping; | ||
28 | var StoreConnectionInformation = require("data/store-connection-information").StoreConnectionInformation; | ||
23 | var Query = require("data/query").Query; | 29 | var Query = require("data/query").Query; |
24 | var Restriction = require("data/restriction").Restriction; | 30 | var Restriction = require("data/restriction").Restriction; |
25 | var TransactionId = require("data/transactionid").TransactionId; | 31 | var TransactionId = require("data/transaction-id").TransactionId; |
26 | var ObjectId = require("data/objectid").ObjectId; | 32 | var ObjectId = require("data/object-id").ObjectId; |
27 | var TemporaryObjectId = require("data/objectid").TemporaryObjectId; | 33 | var TemporaryObjectId = require("data/object-id").TemporaryObjectId; |
28 | var ControlListener = require("data/controllistener").ControlListener; | ||
29 | var Serializer = require("core/serializer").Serializer; | 34 | var Serializer = require("core/serializer").Serializer; |
30 | var Deserializer = require("core/deserializer").Deserializer; | 35 | var Deserializer = require("core/deserializer").Deserializer; |
31 | var Promise = require("core/promise").Promise; | 36 | var Promise = require("core/promise").Promise; |
32 | var logger = require("core/logger").logger("store"); | 37 | var logger = require("core/logger").logger("store"); |
33 | /** | 38 | /** |
34 | Description TODO | 39 | Description TODO |
35 | @private | 40 | @private |
36 | */ | 41 | */ |
37 | var _defaultStoreManager = null; | 42 | var _defaultStoreManager = null; |
38 | /** | 43 | /** |
39 | @class module:montage/data/store.Store | 44 | @class module:montage/data/store.Store |
40 | @extends module:montage/core/core.Montage | 45 | @extends module:montage/core/core.Montage |
41 | */ | 46 | */ |
42 | var Store = exports.Store = Montage.create(Montage,/** @lends module:montage/data/store.Store# */ { | 47 | var Store = exports.Store = Montage.create(Montage, /** @lends module:montage/data/store.Store# */ { |
43 | /** | 48 | |
44 | Description TODO | 49 | /* |
45 | @type {Property} Function | 50 | * @private |
46 | @default {Array} new Array(10) | 51 | */ |
47 | */ | 52 | _connectionInfo:{ |
48 | blueprintBinders: { | 53 | serializable:true, |
49 | serializable: true, | 54 | enumerable:false, |
50 | writable: false, | 55 | value:null |
51 | distinct: true, | ||
52 | value: new Array(10) | ||
53 | }, | ||
54 | /** | ||
55 | Description TODO | ||
56 | @function | ||
57 | @param {Property} binder TODO | ||
58 | */ | ||
59 | addBlueprintBinder: { | ||
60 | value: function(binder) { | ||
61 | if (binder !== null) { | ||
62 | var index = this.blueprintBinders.indexOf(binder); | ||
63 | if (index < 0) { | ||
64 | this.blueprintBinders.push(binder); | ||
65 | } | ||
66 | } | ||
67 | } | ||
68 | }, | ||
69 | /** | ||
70 | Description TODO | ||
71 | @function | ||
72 | @param {Property} binder TODO | ||
73 | */ | ||
74 | removeBlueprintBinder: { | ||
75 | value: function(binder) { | ||
76 | if (binder !== null) { | ||
77 | var index = this.blueprintBinders.indexOf(binder); | ||
78 | if (index >= 0) { | ||
79 | this.blueprintBinders.splice(index, 1); | ||
80 | } | ||
81 | } | ||
82 | } | ||
83 | }, | 56 | }, |
84 | /** | 57 | |
85 | Description TODO | 58 | /* |
86 | @function | 59 | * Connection information for the store |
87 | @param {Property} name TODO | 60 | */ |
88 | @returns null | 61 | connectionInfo:{ |
89 | */ | 62 | get:function () { |
90 | blueprintBinderForName: { | 63 | return this._connectionInfo; |
91 | value: function(name) { | 64 | }, |
92 | var binder, index; | 65 | set:function (info) { |
93 | for (index = 0; typeof (binder = this.blueprintBinders[index]) !== "undefined"; index++) { | 66 | // TODO [PJYF May 15 2012] We need to check that the connection info is valid for this store. |
94 | if (binder.name === name) { | 67 | this._connectionInfo = info; |
95 | return binder; | ||
96 | } | ||
97 | } | ||
98 | return null; | ||
99 | } | 68 | } |
100 | }, | 69 | }, |
101 | /** | 70 | |
102 | Description TODO | 71 | /** |
103 | @type {Property} | 72 | Description TODO |
104 | @default {Array} new Array(10) | 73 | @type {Property} |
105 | */ | 74 | @default {Array} new Array(10) |
106 | restrictions: { | 75 | */ |
107 | serializable: true, | 76 | restrictions:{ |
108 | writable: false, | 77 | serializable:true, |
109 | distinct: true, | 78 | writable:false, |
110 | value: new Array(10) | 79 | distinct:true, |
80 | value:new Array(10) | ||
111 | }, | 81 | }, |
112 | /** | 82 | |
113 | Description TODO | 83 | /** |
114 | @private | 84 | @private |
115 | */ | 85 | */ |
116 | _parent: { | 86 | _parent:{ |
117 | serializable: true, | 87 | serializable:true, |
118 | enumerable: false, | 88 | enumerable:false, |
119 | value: null | 89 | value:null |
120 | }, | 90 | }, |
121 | 91 | ||
122 | /** | 92 | /** |
123 | Returns the parent store. | 93 | Returns the parent store. |
124 | @function | 94 | @function |
125 | @returns this._parent | 95 | @returns this._parent |
126 | */ | 96 | */ |
127 | parent: { | 97 | parent:{ |
128 | get: function() { | 98 | get:function () { |
129 | return this._parent; | 99 | return this._parent; |
130 | } | 100 | } |
131 | }, | 101 | }, |
132 | 102 | ||
133 | 103 | /** | |
134 | /* | 104 | Returns the default store manager.<br> |
135 | * | 105 | If none is defined it will create one that will then be reused for subsequent calls. |
136 | * | 106 | @function |
107 | @returns _defaultStoreManager | ||
137 | */ | 108 | */ |
138 | 109 | defaultManager:{ | |
139 | /** | 110 | get:function () { |
140 | Returns the default store manager.<br> | ||
141 | If none is defined it will create one that will then be reused for subsequent calls. | ||
142 | @function | ||
143 | @returns _defaultStoreManager | ||
144 | */ | ||
145 | defaultManager: { | ||
146 | get: function() { | ||
147 | if (_defaultStoreManager === null) { | 111 | if (_defaultStoreManager === null) { |
148 | _defaultStoreManager = StoreManager.create().init(); | 112 | _defaultStoreManager = StoreManager.create().init(); |
149 | } | 113 | } |
150 | return _defaultStoreManager; | 114 | return _defaultStoreManager; |
151 | }, | 115 | }, |
152 | // This is used only for testing. | 116 | // This is used only for testing. |
153 | set: function(storeManager) { | 117 | set:function (storeManager) { |
154 | _defaultStoreManager = storeManager; | 118 | _defaultStoreManager = storeManager; |
155 | } | 119 | } |
156 | }, | 120 | }, |
157 | /** | 121 | |
158 | @function | 122 | /** |