Modified:
websites/staging/olingo/trunk/content/doc/javascript/apidoc/memory-MemoryStore.html
==============================================================================
---
websites/staging/olingo/trunk/content/doc/javascript/apidoc/memory-MemoryStore.html
(original)
+++
websites/staging/olingo/trunk/content/doc/javascript/apidoc/memory-MemoryStore.html
Thu Apr 9 09:03:51 2015
@@ -132,7 +132,7 @@
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
- <a href="memory.js.html">store/memory.js</a>, <a
href="memory.js.html#line34">line 34</a>
+ <a href="memory.js.html">store/memory.js</a>, <a
href="memory.js.html#line35">line 35</a>
</li></ul></dd>
@@ -212,7 +212,7 @@
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
- <a href="memory.js.html">store/memory.js</a>, <a
href="memory.js.html#line242">line 242</a>
+ <a href="memory.js.html">store/memory.js</a>, <a
href="memory.js.html#line243">line 243</a>
</li></ul></dd>
@@ -239,6 +239,8 @@
<h4 class="name" id="add"><span class="type-signature"></span>add<span
class="signature">(key, value, success, error)</span><span
class="type-signature"></span></h4>
+ <p class="summary">Adds a new value identified by a key to the store.</p>
+
</dt>
<dd>
@@ -335,7 +337,7 @@
- <td class="description last">Callback for a successful add
operation.</param></td>
+ <td class="description last">Callback for a successful add
operation.</td>
</tr>
@@ -358,7 +360,7 @@
- <td class="description last">Callback for handling errors. If not
specified then store.defaultError is invoked.</param></td>
+ <td class="description last">Callback for handling errors. If not
specified then store.defaultError is invoked.</td>
</tr>
@@ -389,7 +391,7 @@
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
- <a href="memory.js.html">store/memory.js</a>, <a
href="memory.js.html#line70">line 70</a>
+ <a href="memory.js.html">store/memory.js</a>, <a
href="memory.js.html#line71">line 71</a>
</li></ul></dd>
@@ -544,7 +546,7 @@
- <td class="description last">Callback for a successful add or
update operation.</param></td>
+ <td class="description last">Callback for a successful add or
update operation.</td>
</tr>
@@ -577,7 +579,7 @@
- <td class="description last">Callback for handling errors. If not
specified then store.defaultError is invoked.</param></td>
+ <td class="description last">Callback for handling errors. If not
specified then store.defaultError is invoked.</td>
</tr>
@@ -608,7 +610,7 @@
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
- <a href="memory.js.html">store/memory.js</a>, <a
href="memory.js.html#line90">line 90</a>
+ <a href="memory.js.html">store/memory.js</a>, <a
href="memory.js.html#line91">line 91</a>
</li></ul></dd>
@@ -636,7 +638,7 @@
<dt>
- <h4 class="name" id="clear"><span class="type-signature"></span>clear<span
class="signature">(success>Callback)</span><span
class="type-signature"></span></h4>
+ <h4 class="name" id="clear"><span class="type-signature"></span>clear<span
class="signature">(success)</span><span class="type-signature"></span></h4>
</dt>
@@ -678,7 +680,7 @@
<tr>
- <td class="name"><code>success>Callback</code></td>
+ <td class="name"><code>success</code></td>
<td class="type">
@@ -694,7 +696,7 @@
- <td class="description last">for a successful clear operation.</td>
+ <td class="description last">Callback for a successful clear
operation.</td>
</tr>
@@ -725,7 +727,7 @@
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
- <a href="memory.js.html">store/memory.js</a>, <a
href="memory.js.html#line117">line 117</a>
+ <a href="memory.js.html">store/memory.js</a>, <a
href="memory.js.html#line118">line 118</a>
</li></ul></dd>
@@ -794,7 +796,7 @@
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
- <a href="memory.js.html">store/memory.js</a>, <a
href="memory.js.html#line235">line 235</a>
+ <a href="memory.js.html">store/memory.js</a>, <a
href="memory.js.html#line236">line 236</a>
</li></ul></dd>
@@ -893,7 +895,7 @@
<td class="type">
-<span class="param-type">Funktion</span>
+<span class="param-type">function</span>
@@ -903,7 +905,7 @@
- <td class="description last">Callback indicating whether the store
contains the key or not.</param></td>
+ <td class="description last">Callback indicating whether the store
contains the key or not.</td>
</tr>
@@ -934,7 +936,7 @@
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
- <a href="memory.js.html">store/memory.js</a>, <a
href="memory.js.html#line128">line 128</a>
+ <a href="memory.js.html">store/memory.js</a>, <a
href="memory.js.html#line129">line 129</a>
</li></ul></dd>
@@ -1020,7 +1022,7 @@
- <td class="description last">Callback for a successful get
operation.</param></td>
+ <td class="description last">Callback for a successful get
operation.</td>
</tr>
@@ -1051,7 +1053,7 @@
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
- <a href="memory.js.html">store/memory.js</a>, <a
href="memory.js.html#line138">line 138</a>
+ <a href="memory.js.html">store/memory.js</a>, <a
href="memory.js.html#line139">line 139</a>
</li></ul></dd>
@@ -1079,7 +1081,7 @@
<dt>
- <h4 class="name" id="read"><span class="type-signature"></span>read<span
class="signature">(key, Function, {Function{}Function)</span><span
class="type-signature"></span></h4>
+ <h4 class="name" id="read"><span class="type-signature"></span>read<span
class="signature">(key, success, error)</span><span
class="type-signature"></span></h4>
</dt>
@@ -1144,7 +1146,7 @@
<tr>
- <td class="name"><code>Function</code></td>
+ <td class="name"><code>success</code></td>
<td class="type">
@@ -1160,25 +1162,30 @@
- <td class="description last">Callback for a successful reads
operation.</param></td>
+ <td class="description last">Callback for a successful reads
operation.</td>
</tr>
<tr>
- <td class="name"><code>{Function{}Function</code></td>
+ <td class="name"><code>error</code></td>
<td class="type">
+
+<span class="param-type">function</span>
+
+
+
</td>
- <td class="description last">Callback for handling errors. If not
specified then store.defaultError is invoked.</param></td>
+ <td class="description last">Callback for handling errors. If not
specified then store.defaultError is invoked.</td>
</tr>
@@ -1209,7 +1216,7 @@
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
- <a href="memory.js.html">store/memory.js</a>, <a
href="memory.js.html#line151">line 151</a>
+ <a href="memory.js.html">store/memory.js</a>, <a
href="memory.js.html#line152">line 152</a>
</li></ul></dd>
@@ -1336,7 +1343,7 @@
- <td class="description last">Callback for a successful remove
operation.</param></td>
+ <td class="description last">Callback for a successful remove
operation.</td>
</tr>
@@ -1369,7 +1376,7 @@
- <td class="description last">Callback for handling errors. If not
specified then store.defaultError is invoked.</param></td>
+ <td class="description last">Callback for handling errors. If not
specified then store.defaultError is invoked.</td>
</tr>
@@ -1400,7 +1407,7 @@
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
- <a href="memory.js.html">store/memory.js</a>, <a
href="memory.js.html#line166">line 166</a>
+ <a href="memory.js.html">store/memory.js</a>, <a
href="memory.js.html#line167">line 167</a>
</li></ul></dd>
@@ -1553,7 +1560,7 @@
- <td class="description last">Callback for a successful update
operation.</param></td>
+ <td class="description last">Callback for a successful update
operation.</td>
</tr>
@@ -1586,8 +1593,7 @@
- <td class="description last">Callback for handling errors. If not
specified then store.defaultError is invoked.</param>
-This method errors out if the specified key is not found in the store.</td>
+ <td class="description last">Callback for handling errors. If not
specified then store.defaultError is invoked.
This method errors out if the specified key is not found in the store.</td>
</tr>
@@ -1618,7 +1624,7 @@ This method errors out if the specified
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
- <a href="memory.js.html">store/memory.js</a>, <a
href="memory.js.html#line196">line 196</a>
+ <a href="memory.js.html">store/memory.js</a>, <a
href="memory.js.html#line197">line 197</a>
</li></ul></dd>
@@ -1753,7 +1759,7 @@ This method errors out if the specified
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
- <a href="memory.js.html">store/memory.js</a>, <a
href="memory.js.html#line51">line 51</a>
+ <a href="memory.js.html">store/memory.js</a>, <a
href="memory.js.html#line52">line 52</a>
</li></ul></dd>
@@ -1816,13 +1822,13 @@ This method errors out if the specified
</div>
<nav>
- <h2><a href="index.html">Index</a></h2><h3>Modules</h3><ul><li><a
href="module-cache.html">cache</a></li><li><a
href="source.html">cache/source</a></li><li><a
href="module-datajs.html">datajs</a></li><li><a
href="deferred.html">datajs/deferred</a></li><li><a
href="utils.html">datajs/utils</a></li><li><a
href="xml.html">datajs/xml</a></li><li><a
href="module-odata.html">odata</a></li><li><a
href="batch.html">odata/batch</a></li><li><a
href="handler.html">odata/handler</a></li><li><a
href="json.html">odata/json</a></li><li><a
href="metadata.html">odata/metadata</a></li><li><a
href="net.html">odata/net</a></li><li><a
href="utils_.html">odata/utils</a></li><li><a
href="module-store.html">store</a></li><li><a
href="dom.html">store/dom</a></li><li><a
href="indexeddb.html">store/indexeddb</a></li><li><a
href="memory.html">store/memory</a></li></ul><h3>Classes</h3><ul><li><a
href="DataCache.html">DataCache</a></li><li><a
href="DataCacheOperation.html">DataCacheOperation</a></li><li><a h
ref="DjsDeferred.html">DjsDeferred</a></li><li><a
href="dom-DomStore.html">DomStore</a></li><li><a
href="indexeddb-IndexedDBStore.html">IndexedDBStore</a></li><li><a
href="memory-MemoryStore.html">MemoryStore</a></li><li><a
href="ODataCacheSource.html">ODataCacheSource</a></li></ul><h3><a
href="global.html">Global</a></h3>
+ <h2><a href="index.html">Index</a></h2><h3>Modules</h3><ul><li><a
href="module-cache.html">cache</a></li><li><a
href="source.html">cache/source</a></li><li><a
href="module-odata.html">odata</a></li><li><a
href="batch.html">odata/batch</a></li><li><a
href="handler.html">odata/handler</a></li><li><a
href="json.html">odata/json</a></li><li><a
href="metadata.html">odata/metadata</a></li><li><a
href="net.html">odata/net</a></li><li><a
href="utils.html">odata/utils</a></li><li><a
href="deferred.html">odatajs/deferred</a></li><li><a
href="utils_.html">odatajs/utils</a></li><li><a
href="xml.html">odatajs/xml</a></li><li><a
href="module-store.html">store</a></li><li><a
href="dom.html">store/dom</a></li><li><a
href="indexeddb.html">store/indexeddb</a></li><li><a
href="memory.html">store/memory</a></li></ul><h3>Classes</h3><ul><li><a
href="DataCache.html">DataCache</a></li><li><a
href="DataCacheOperation.html">DataCacheOperation</a></li><li><a
href="DjsDeferred.html">DjsDeferred</a></li><l
i><a href="dom-DomStore.html">DomStore</a></li><li><a
href="indexeddb-IndexedDBStore.html">IndexedDBStore</a></li><li><a
href="memory-MemoryStore.html">MemoryStore</a></li><li><a
href="ODataCacheSource.html">ODataCacheSource</a></li></ul><h3><a
href="global.html">Global</a></h3>
</nav>
<br clear="both">
<footer>
- Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc
3.2.2</a> on Mon Sep 15 2014 13:08:02 GMT+0200 (MESZ)
+ Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc
3.2.2</a> on Thu Apr 09 2015 08:31:27 GMT+0200 (MESZ)
</footer>
<script> prettyPrint(); </script>
Modified:
websites/staging/olingo/trunk/content/doc/javascript/apidoc/memory.html
==============================================================================
--- websites/staging/olingo/trunk/content/doc/javascript/apidoc/memory.html
(original)
+++ websites/staging/olingo/trunk/content/doc/javascript/apidoc/memory.html Thu
Apr 9 09:03:51 2015
@@ -62,7 +62,7 @@
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
- <a href="memory.js.html">store/memory.js</a>, <a
href="memory.js.html#line3">line 3</a>
+ <a href="memory.js.html">store/memory.js</a>, <a
href="memory.js.html#line21">line 21</a>
</li></ul></dd>
@@ -112,13 +112,13 @@
</div>
<nav>
- <h2><a href="index.html">Index</a></h2><h3>Modules</h3><ul><li><a
href="module-cache.html">cache</a></li><li><a
href="source.html">cache/source</a></li><li><a
href="module-datajs.html">datajs</a></li><li><a
href="deferred.html">datajs/deferred</a></li><li><a
href="utils.html">datajs/utils</a></li><li><a
href="xml.html">datajs/xml</a></li><li><a
href="module-odata.html">odata</a></li><li><a
href="batch.html">odata/batch</a></li><li><a
href="handler.html">odata/handler</a></li><li><a
href="json.html">odata/json</a></li><li><a
href="metadata.html">odata/metadata</a></li><li><a
href="net.html">odata/net</a></li><li><a
href="utils_.html">odata/utils</a></li><li><a
href="module-store.html">store</a></li><li><a
href="dom.html">store/dom</a></li><li><a
href="indexeddb.html">store/indexeddb</a></li><li><a
href="memory.html">store/memory</a></li></ul><h3>Classes</h3><ul><li><a
href="DataCache.html">DataCache</a></li><li><a
href="DataCacheOperation.html">DataCacheOperation</a></li><li><a h
ref="DjsDeferred.html">DjsDeferred</a></li><li><a
href="dom-DomStore.html">DomStore</a></li><li><a
href="indexeddb-IndexedDBStore.html">IndexedDBStore</a></li><li><a
href="memory-MemoryStore.html">MemoryStore</a></li><li><a
href="ODataCacheSource.html">ODataCacheSource</a></li></ul><h3><a
href="global.html">Global</a></h3>
+ <h2><a href="index.html">Index</a></h2><h3>Modules</h3><ul><li><a
href="module-cache.html">cache</a></li><li><a
href="source.html">cache/source</a></li><li><a
href="module-odata.html">odata</a></li><li><a
href="batch.html">odata/batch</a></li><li><a
href="handler.html">odata/handler</a></li><li><a
href="json.html">odata/json</a></li><li><a
href="metadata.html">odata/metadata</a></li><li><a
href="net.html">odata/net</a></li><li><a
href="utils.html">odata/utils</a></li><li><a
href="deferred.html">odatajs/deferred</a></li><li><a
href="utils_.html">odatajs/utils</a></li><li><a
href="xml.html">odatajs/xml</a></li><li><a
href="module-store.html">store</a></li><li><a
href="dom.html">store/dom</a></li><li><a
href="indexeddb.html">store/indexeddb</a></li><li><a
href="memory.html">store/memory</a></li></ul><h3>Classes</h3><ul><li><a
href="DataCache.html">DataCache</a></li><li><a
href="DataCacheOperation.html">DataCacheOperation</a></li><li><a
href="DjsDeferred.html">DjsDeferred</a></li><l
i><a href="dom-DomStore.html">DomStore</a></li><li><a
href="indexeddb-IndexedDBStore.html">IndexedDBStore</a></li><li><a
href="memory-MemoryStore.html">MemoryStore</a></li><li><a
href="ODataCacheSource.html">ODataCacheSource</a></li></ul><h3><a
href="global.html">Global</a></h3>
</nav>
<br clear="both">
<footer>
- Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc
3.2.2</a> on Mon Sep 15 2014 13:08:02 GMT+0200 (MESZ)
+ Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc
3.2.2</a> on Thu Apr 09 2015 08:31:27 GMT+0200 (MESZ)
</footer>
<script> prettyPrint(); </script>
Modified:
websites/staging/olingo/trunk/content/doc/javascript/apidoc/memory.js.html
==============================================================================
--- websites/staging/olingo/trunk/content/doc/javascript/apidoc/memory.js.html
(original)
+++ websites/staging/olingo/trunk/content/doc/javascript/apidoc/memory.js.html
Thu Apr 9 09:03:51 2015
@@ -25,251 +25,252 @@
<section>
<article>
- <pre class="prettyprint source"><code>/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/** @module store/memory */
-
-
-var utils = require('./../odatajs.js').utils;
-
-// Imports.
-var throwErrorCallback = utils.throwErrorCallback;
-var delay = utils.delay;
-
-/** Constructor for store objects that use a sorted array as the underlying
mechanism.
- * @class MemoryStore
- * @constructor
- * @param {String} name - Store name.
- */
-function MemoryStore(name) {
-
- var holes = [];
- var items = [];
- var keys = {};
-
- this.name = name;
-
- var getErrorCallback = function (error) {
- return error || this.defaultError;
- };
-
- /** Validates that the specified key is not undefined, not null, and not
an array
- * @param key - Key value.
- * @param {Function} error - Error callback.
- * @returns {Boolean} True if the key is valid. False if the key is
invalid and the error callback has been queued for execution.
- */
- function validateKeyInput(key, error) {
-
- var messageString;
-
- if (key instanceof Array) {
- messageString = "Array of keys not supported";
- }
-
- if (key === undefined || key === null) {
- messageString = "Invalid key";
- }
-
- if (messageString) {
- delay(error, { message: messageString });
- return false;
- }
- return true;
- }
-
- /** This method errors out if the store already contains the specified key.
- * @summery Adds a new value identified by a key to the store.
- * @method module:store/memory~MemoryStore#add
- * @param {String} key - Key string.
- * @param value - Value that is going to be added to the store.
- * @param {Function} success - Callback for a successful add
operation.</param>
- * @param {Function} error - Callback for handling errors. If not
specified then store.defaultError is invoked.</param>
- */
- this.add = function (key, value, success, error) {
- error = getErrorCallback(error);
-
- if (validateKeyInput(key, error)) {
- if (!keys.hasOwnProperty(key)) {
- this.addOrUpdate(key, value, success, error);
- } else {
- error({ message: "key already exists", key: key });
- }
- }
- };
-
- /** This method will overwrite the key's current value if it already
exists in the store; otherwise it simply adds the new key and value.
- * @summary Adds or updates a value identified by a key to the store.
- * @method module:store/memory~MemoryStore#addOrUpdate
- * @param {String} key - Key string.
- * @param value - Value that is going to be added or updated to the store.
- * @param {Function} success - Callback for a successful add or update
operation.</param>
- * @param {Function} [error] - Callback for handling errors. If not
specified then store.defaultError is invoked.</param>
- */
- this.addOrUpdate = function (key, value, success, error) {
-
- error = getErrorCallback(error);
-
- if (validateKeyInput(key, error)) {
- var index = keys[key];
- if (index === undefined) {
- if (holes.length > 0) {
- index = holes.splice(0, 1);
- } else {
- index = items.length;
- }
- }
- items[index] = value;
- keys[key] = index;
- delay(success, key, value);
- }
- };
-
- /** Removes all the data associated with this store object.
- * @method module:store/memory~MemoryStore#clear
- * @param {Function} success>Callback for a successful clear operation.
- */
- this.clear = function (success) {
- items = [];
- keys = {};
- holes = [];
- delay(success);
- };
-
- /** Checks whether a key exists in the store.
- * @method module:store/memory~MemoryStore#contains
- * @param {String} key - Key string.
- * @param {Funktion} success - Callback indicating whether the store
contains the key or not.</param>
- */
- this.contains = function (key, success) {
- var contained = keys.hasOwnProperty(key);
- delay(success, contained);
- };
-
- /** Gets all the keys that exist in the store.
- * @method module:store/memory~MemoryStore#getAllKeys
- * @param {Function} success - Callback for a successful get
operation.</param>
- */
- this.getAllKeys = function (success) {
-
- var results = [];
- for (var name in keys) {
- results.push(name);
- }
- delay(success, results);
- };
-
- /** Reads the value associated to a key in the store.
- * @method module:store/memory~MemoryStore#read
- * @param {String} key - Key string.
- * @param {Function} Function - Callback for a successful reads
operation.</param>
- * @param {Function{}Function - Callback for handling errors. If not
specified then store.defaultError is invoked.</param>
- */
- this.read = function (key, success, error) {
- error = getErrorCallback(error);
-
- if (validateKeyInput(key, error)) {
- var index = keys[key];
- delay(success, key, items[index]);
- }
- };
-
- /** Removes a key and its value from the store.
- * @method module:store/memory~MemoryStore#remove
- * @param {String} key - Key string.
- * @param {Function} success - Callback for a successful remove
operation.</param>
- * @param {Function} [error] - Callback for handling errors. If not
specified then store.defaultError is invoked.</param>
- */
- this.remove = function (key, success, error) {
- error = getErrorCallback(error);
-
- if (validateKeyInput(key, error)) {
- var index = keys[key];
- if (index !== undefined) {
- if (index === items.length - 1) {
- items.pop();
- } else {
- items[index] = undefined;
- holes.push(index);
- }
- delete keys[key];
-
- // The last item was removed, no need to keep track of any
holes in the array.
- if (items.length === 0) {
- holes = [];
- }
- }
-
- delay(success);
- }
- };
-
- /** Updates the value associated to a key in the store.
- * @method module:store/memory~MemoryStore#update
- * @param {String} key - Key string.
- * @param value - New value.
- * @param {Function} success - Callback for a successful update
operation.</param>
- * @param {Function} [error] - Callback for handling errors. If not
specified then store.defaultError is invoked.</param>
- * This method errors out if the specified key is not found in the store.
- */
- this.update = function (key, value, success, error) {
- error = getErrorCallback(error);
- if (validateKeyInput(key, error)) {
- if (keys.hasOwnProperty(key)) {
- this.addOrUpdate(key, value, success, error);
- } else {
- error({ message: "key not found", key: key });
- }
- }
- };
-}
-
-/** Creates a store object that uses memory storage as its underlying
mechanism.
- * @method MemoryStore.create
- * @param {String} name - Store name.
- * @returns {Object} Store object.
- */
-MemoryStore.create = function (name) {
- return new MemoryStore(name);
-};
-
-/** Checks whether the underlying mechanism for this kind of store objects is
supported by the browser.
- * @method MemoryStore.isSupported
- * @returns {Boolean} True if the mechanism is supported by the browser;
otherwise false.
- */
-MemoryStore.isSupported = function () {
- return true;
-};
-
-/** This function does nothing in MemoryStore as it does not have a connection
model.
-*/
-MemoryStore.prototype.close = function () {
-};
-
-MemoryStore.prototype.defaultError = throwErrorCallback;
-
-/** Identifies the underlying mechanism used by the store.
-*/
-MemoryStore.prototype.mechanism = "memory";
-
-
-/** MemoryStore (see {@link MemoryStore}) */
+ <pre class="prettyprint source"><code>/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+'use strict';
+
+/** @module store/memory */
+
+
+var utils = require('./../utils.js');
+
+// Imports.
+var throwErrorCallback = utils.throwErrorCallback;
+var delay = utils.delay;
+
+/** Constructor for store objects that use a sorted array as the underlying
mechanism.
+ * @class MemoryStore
+ * @constructor
+ * @param {String} name - Store name.
+ */
+function MemoryStore(name) {
+
+ var holes = [];
+ var items = [];
+ var keys = {};
+
+ this.name = name;
+
+ var getErrorCallback = function (error) {
+ return error || this.defaultError;
+ };
+
+ /** Validates that the specified key is not undefined, not null, and not
an array
+ * @param key - Key value.
+ * @param {Function} error - Error callback.
+ * @returns {Boolean} True if the key is valid. False if the key is
invalid and the error callback has been queued for execution.
+ */
+ function validateKeyInput(key, error) {
+
+ var messageString;
+
+ if (key instanceof Array) {
+ messageString = "Array of keys not supported";
+ }
+
+ if (key === undefined || key === null) {
+ messageString = "Invalid key";
+ }
+
+ if (messageString) {
+ delay(error, { message: messageString });
+ return false;
+ }
+ return true;
+ }
+
+ /** This method errors out if the store already contains the specified key.
+ * @summary Adds a new value identified by a key to the store.
+ * @method module:store/memory~MemoryStore#add
+ * @param {String} key - Key string.
+ * @param value - Value that is going to be added to the store.
+ * @param {Function} success - Callback for a successful add operation.
+ * @param {Function} error - Callback for handling errors. If not
specified then store.defaultError is invoked.
+ */
+ this.add = function (key, value, success, error) {
+ error = getErrorCallback(error);
+
+ if (validateKeyInput(key, error)) {
+ if (!keys.hasOwnProperty(key)) {
+ this.addOrUpdate(key, value, success, error);
+ } else {
+ error({ message: "key already exists", key: key });
+ }
+ }
+ };
+
+ /** This method will overwrite the key's current value if it already
exists in the store; otherwise it simply adds the new key and value.
+ * @summary Adds or updates a value identified by a key to the store.
+ * @method module:store/memory~MemoryStore#addOrUpdate
+ * @param {String} key - Key string.
+ * @param value - Value that is going to be added or updated to the store.
+ * @param {Function} success - Callback for a successful add or update
operation.
+ * @param {Function} [error] - Callback for handling errors. If not
specified then store.defaultError is invoked.
+ */
+ this.addOrUpdate = function (key, value, success, error) {
+
+ error = getErrorCallback(error);
+
+ if (validateKeyInput(key, error)) {
+ var index = keys[key];
+ if (index === undefined) {
+ if (holes.length > 0) {
+ index = holes.splice(0, 1);
+ } else {
+ index = items.length;
+ }
+ }
+ items[index] = value;
+ keys[key] = index;
+ delay(success, key, value);
+ }
+ };
+
+ /** Removes all the data associated with this store object.
+ * @method module:store/memory~MemoryStore#clear
+ * @param {Function} success - Callback for a successful clear operation.
+ */
+ this.clear = function (success) {
+ items = [];
+ keys = {};
+ holes = [];
+ delay(success);
+ };
+
+ /** Checks whether a key exists in the store.
+ * @method module:store/memory~MemoryStore#contains
+ * @param {String} key - Key string.
+ * @param {Function} success - Callback indicating whether the store
contains the key or not.
+ */
+ this.contains = function (key, success) {
+ var contained = keys.hasOwnProperty(key);
+ delay(success, contained);
+ };
+
+ /** Gets all the keys that exist in the store.
+ * @method module:store/memory~MemoryStore#getAllKeys
+ * @param {Function} success - Callback for a successful get operation.
+ */
+ this.getAllKeys = function (success) {
+
+ var results = [];
+ for (var name in keys) {
+ results.push(name);
+ }
+ delay(success, results);
+ };
+
+ /** Reads the value associated to a key in the store.
+ * @method module:store/memory~MemoryStore#read
+ * @param {String} key - Key string.
+ * @param {Function} success - Callback for a successful reads operation.
+ * @param {Function} error - Callback for handling errors. If not
specified then store.defaultError is invoked.
+ */
+ this.read = function (key, success, error) {
+ error = getErrorCallback(error);
+
+ if (validateKeyInput(key, error)) {
+ var index = keys[key];
+ delay(success, key, items[index]);
+ }
+ };
+
+ /** Removes a key and its value from the store.
+ * @method module:store/memory~MemoryStore#remove
+ * @param {String} key - Key string.
+ * @param {Function} success - Callback for a successful remove operation.
+ * @param {Function} [error] - Callback for handling errors. If not
specified then store.defaultError is invoked.
+ */
+ this.remove = function (key, success, error) {
+ error = getErrorCallback(error);
+
+ if (validateKeyInput(key, error)) {
+ var index = keys[key];
+ if (index !== undefined) {
+ if (index === items.length - 1) {
+ items.pop();
+ } else {
+ items[index] = undefined;
+ holes.push(index);
+ }
+ delete keys[key];
+
+ // The last item was removed, no need to keep track of any
holes in the array.
+ if (items.length === 0) {
+ holes = [];
+ }
+ }
+
+ delay(success);
+ }
+ };
+
+ /** Updates the value associated to a key in the store.
+ * @method module:store/memory~MemoryStore#update
+ * @param {String} key - Key string.
+ * @param value - New value.
+ * @param {Function} success - Callback for a successful update operation.
+ * @param {Function} [error] - Callback for handling errors. If not
specified then store.defaultError is invoked.
+ * This method errors out if the specified key is not found in the store.
+ */
+ this.update = function (key, value, success, error) {
+ error = getErrorCallback(error);
+ if (validateKeyInput(key, error)) {
+ if (keys.hasOwnProperty(key)) {
+ this.addOrUpdate(key, value, success, error);
+ } else {
+ error({ message: "key not found", key: key });
+ }
+ }
+ };
+}
+
+/** Creates a store object that uses memory storage as its underlying
mechanism.
+ * @method MemoryStore.create
+ * @param {String} name - Store name.
+ * @returns {Object} Store object.
+ */
+MemoryStore.create = function (name) {
+ return new MemoryStore(name);
+};
+
+/** Checks whether the underlying mechanism for this kind of store objects is
supported by the browser.
+ * @method MemoryStore.isSupported
+ * @returns {Boolean} True if the mechanism is supported by the browser;
otherwise false.
+ */
+MemoryStore.isSupported = function () {
+ return true;
+};
+
+/** This function does nothing in MemoryStore as it does not have a connection
model.
+*/
+MemoryStore.prototype.close = function () {
+};
+
+MemoryStore.prototype.defaultError = throwErrorCallback;
+
+/** Identifies the underlying mechanism used by the store.
+*/
+MemoryStore.prototype.mechanism = "memory";
+
+
+/** MemoryStore (see {@link MemoryStore}) */
module.exports = MemoryStore;</code></pre>
</article>
</section>
@@ -280,13 +281,13 @@ module.exports = MemoryStore;</code></pr
</div>
<nav>
- <h2><a href="index.html">Index</a></h2><h3>Modules</h3><ul><li><a
href="module-cache.html">cache</a></li><li><a
href="source.html">cache/source</a></li><li><a
href="module-datajs.html">datajs</a></li><li><a
href="deferred.html">datajs/deferred</a></li><li><a
href="utils.html">datajs/utils</a></li><li><a
href="xml.html">datajs/xml</a></li><li><a
href="module-odata.html">odata</a></li><li><a
href="batch.html">odata/batch</a></li><li><a
href="handler.html">odata/handler</a></li><li><a
href="json.html">odata/json</a></li><li><a
href="metadata.html">odata/metadata</a></li><li><a
href="net.html">odata/net</a></li><li><a
href="utils_.html">odata/utils</a></li><li><a
href="module-store.html">store</a></li><li><a
href="dom.html">store/dom</a></li><li><a
href="indexeddb.html">store/indexeddb</a></li><li><a
href="memory.html">store/memory</a></li></ul><h3>Classes</h3><ul><li><a
href="DataCache.html">DataCache</a></li><li><a
href="DataCacheOperation.html">DataCacheOperation</a></li><li><a h
ref="DjsDeferred.html">DjsDeferred</a></li><li><a
href="dom-DomStore.html">DomStore</a></li><li><a
href="indexeddb-IndexedDBStore.html">IndexedDBStore</a></li><li><a
href="memory-MemoryStore.html">MemoryStore</a></li><li><a
href="ODataCacheSource.html">ODataCacheSource</a></li></ul><h3><a
href="global.html">Global</a></h3>
+ <h2><a href="index.html">Index</a></h2><h3>Modules</h3><ul><li><a
href="module-cache.html">cache</a></li><li><a
href="source.html">cache/source</a></li><li><a
href="module-odata.html">odata</a></li><li><a
href="batch.html">odata/batch</a></li><li><a
href="handler.html">odata/handler</a></li><li><a
href="json.html">odata/json</a></li><li><a
href="metadata.html">odata/metadata</a></li><li><a
href="net.html">odata/net</a></li><li><a
href="utils.html">odata/utils</a></li><li><a
href="deferred.html">odatajs/deferred</a></li><li><a
href="utils_.html">odatajs/utils</a></li><li><a
href="xml.html">odatajs/xml</a></li><li><a
href="module-store.html">store</a></li><li><a
href="dom.html">store/dom</a></li><li><a
href="indexeddb.html">store/indexeddb</a></li><li><a
href="memory.html">store/memory</a></li></ul><h3>Classes</h3><ul><li><a
href="DataCache.html">DataCache</a></li><li><a
href="DataCacheOperation.html">DataCacheOperation</a></li><li><a
href="DjsDeferred.html">DjsDeferred</a></li><l
i><a href="dom-DomStore.html">DomStore</a></li><li><a
href="indexeddb-IndexedDBStore.html">IndexedDBStore</a></li><li><a
href="memory-MemoryStore.html">MemoryStore</a></li><li><a
href="ODataCacheSource.html">ODataCacheSource</a></li></ul><h3><a
href="global.html">Global</a></h3>
</nav>
<br clear="both">
<footer>
- Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc
3.2.2</a> on Mon Sep 15 2014 13:07:59 GMT+0200 (MESZ)
+ Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc
3.2.2</a> on Thu Apr 09 2015 08:31:26 GMT+0200 (MESZ)
</footer>
<script> prettyPrint(); </script>
Modified:
websites/staging/olingo/trunk/content/doc/javascript/apidoc/metadata.html
==============================================================================
--- websites/staging/olingo/trunk/content/doc/javascript/apidoc/metadata.html
(original)
+++ websites/staging/olingo/trunk/content/doc/javascript/apidoc/metadata.html
Thu Apr 9 09:03:51 2015
@@ -62,7 +62,7 @@
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
- <a href="metadata.js.html">odata/metadata.js</a>, <a
href="metadata.js.html#line3">line 3</a>
+ <a href="metadata.js.html">odata/metadata.js</a>, <a
href="metadata.js.html#line21">line 21</a>
</li></ul></dd>
@@ -203,7 +203,7 @@
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
- <a href="metadata.js.html">odata/metadata.js</a>, <a
href="metadata.js.html#line391">line 391</a>
+ <a href="metadata.js.html">odata/metadata.js</a>, <a
href="metadata.js.html#line392">line 392</a>
</li></ul></dd>
@@ -342,7 +342,7 @@
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
- <a href="metadata.js.html">odata/metadata.js</a>, <a
href="metadata.js.html#line420">line 420</a>
+ <a href="metadata.js.html">odata/metadata.js</a>, <a
href="metadata.js.html#line421">line 421</a>
</li></ul></dd>
@@ -524,7 +524,7 @@
<div class="param-desc">
- An object representation of the conceptual model.</returns>
+ An object representation of the conceptual model.
</div>
@@ -621,7 +621,7 @@
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
- <a href="metadata.js.html">odata/metadata.js</a>, <a
href="metadata.js.html#line429">line 429</a>
+ <a href="metadata.js.html">odata/metadata.js</a>, <a
href="metadata.js.html#line430">line 430</a>
</li></ul></dd>
@@ -798,8 +798,7 @@
- <td class="description last">Namespace to which the element
belongs to.
-If a child element name ends with * then it is understood by the schema that
that child element can appear 0 or more times.</td>
+ <td class="description last">Namespace to which the element
belongs to.
If a child element name ends with * then it is understood by the schema that
that child element can appear 0 or more times.</td>
</tr>
@@ -830,7 +829,7 @@ If a child element name ends with * then
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
- <a href="metadata.js.html">odata/metadata.js</a>, <a
href="metadata.js.html#line58">line 58</a>
+ <a href="metadata.js.html">odata/metadata.js</a>, <a
href="metadata.js.html#line59">line 59</a>
</li></ul></dd>
@@ -969,7 +968,7 @@ If a child element name ends with * then
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
- <a href="metadata.js.html">odata/metadata.js</a>, <a
href="metadata.js.html#line368">line 368</a>
+ <a href="metadata.js.html">odata/metadata.js</a>, <a
href="metadata.js.html#line369">line 369</a>
</li></ul></dd>
@@ -994,8 +993,7 @@ If a child element name ends with * then
<div class="param-desc">
- Converted text.
-If the text starts with multiple uppercase characters, it is left
as-is.</remarks>
+ Converted text.
If the text starts with multiple uppercase characters, it is left as-is.
</div>
@@ -1033,13 +1031,13 @@ If the text starts with multiple upperca
</div>
<nav>
- <h2><a href="index.html">Index</a></h2><h3>Modules</h3><ul><li><a
href="module-cache.html">cache</a></li><li><a
href="source.html">cache/source</a></li><li><a
href="module-datajs.html">datajs</a></li><li><a
href="deferred.html">datajs/deferred</a></li><li><a
href="utils.html">datajs/utils</a></li><li><a
href="xml.html">datajs/xml</a></li><li><a
href="module-odata.html">odata</a></li><li><a
href="batch.html">odata/batch</a></li><li><a
href="handler.html">odata/handler</a></li><li><a
href="json.html">odata/json</a></li><li><a
href="metadata.html">odata/metadata</a></li><li><a
href="net.html">odata/net</a></li><li><a
href="utils_.html">odata/utils</a></li><li><a
href="module-store.html">store</a></li><li><a
href="dom.html">store/dom</a></li><li><a
href="indexeddb.html">store/indexeddb</a></li><li><a
href="memory.html">store/memory</a></li></ul><h3>Classes</h3><ul><li><a
href="DataCache.html">DataCache</a></li><li><a
href="DataCacheOperation.html">DataCacheOperation</a></li><li><a h
ref="DjsDeferred.html">DjsDeferred</a></li><li><a
href="dom-DomStore.html">DomStore</a></li><li><a
href="indexeddb-IndexedDBStore.html">IndexedDBStore</a></li><li><a
href="memory-MemoryStore.html">MemoryStore</a></li><li><a
href="ODataCacheSource.html">ODataCacheSource</a></li></ul><h3><a
href="global.html">Global</a></h3>
+ <h2><a href="index.html">Index</a></h2><h3>Modules</h3><ul><li><a
href="module-cache.html">cache</a></li><li><a
href="source.html">cache/source</a></li><li><a
href="module-odata.html">odata</a></li><li><a
href="batch.html">odata/batch</a></li><li><a
href="handler.html">odata/handler</a></li><li><a
href="json.html">odata/json</a></li><li><a
href="metadata.html">odata/metadata</a></li><li><a
href="net.html">odata/net</a></li><li><a
href="utils.html">odata/utils</a></li><li><a
href="deferred.html">odatajs/deferred</a></li><li><a
href="utils_.html">odatajs/utils</a></li><li><a
href="xml.html">odatajs/xml</a></li><li><a
href="module-store.html">store</a></li><li><a
href="dom.html">store/dom</a></li><li><a
href="indexeddb.html">store/indexeddb</a></li><li><a
href="memory.html">store/memory</a></li></ul><h3>Classes</h3><ul><li><a
href="DataCache.html">DataCache</a></li><li><a
href="DataCacheOperation.html">DataCacheOperation</a></li><li><a
href="DjsDeferred.html">DjsDeferred</a></li><l
i><a href="dom-DomStore.html">DomStore</a></li><li><a
href="indexeddb-IndexedDBStore.html">IndexedDBStore</a></li><li><a
href="memory-MemoryStore.html">MemoryStore</a></li><li><a
href="ODataCacheSource.html">ODataCacheSource</a></li></ul><h3><a
href="global.html">Global</a></h3>
</nav>
<br clear="both">
<footer>
- Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc
3.2.2</a> on Mon Sep 15 2014 13:08:01 GMT+0200 (MESZ)
+ Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc
3.2.2</a> on Thu Apr 09 2015 08:31:26 GMT+0200 (MESZ)
</footer>
<script> prettyPrint(); </script>