You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@olingo.apache.org by ko...@apache.org on 2014/05/14 13:47:41 UTC

git commit: [OLINGO-238] apply changes new V4 code to new Build infrastruture in datajs

Repository: olingo-odata4-js
Updated Branches:
  refs/heads/master 2af7fa5fc -> 1b51dcbec


[OLINGO-238] apply changes new V4 code to new Build infrastruture in datajs

[OLINGO-238] new Build infrastruture in datajs folder II


Project: http://git-wip-us.apache.org/repos/asf/olingo-odata4-js/repo
Commit: http://git-wip-us.apache.org/repos/asf/olingo-odata4-js/commit/1b51dcbe
Tree: http://git-wip-us.apache.org/repos/asf/olingo-odata4-js/tree/1b51dcbe
Diff: http://git-wip-us.apache.org/repos/asf/olingo-odata4-js/diff/1b51dcbe

Branch: refs/heads/master
Commit: 1b51dcbec96abf6201a84ef8ffd668e1167f918d
Parents: 2af7fa5
Author: Sven Kobler <sv...@sap.com>
Authored: Wed May 14 12:59:05 2014 +0200
Committer: Sven Kobler <sv...@sap.com>
Committed: Wed May 14 13:26:31 2014 +0200

----------------------------------------------------------------------
 datajs/.gitignore                  |   3 +-
 datajs/src/lib/cache.js            |  56 ++++--
 datajs/src/lib/cache/source.js     |  78 ++++----
 datajs/src/lib/datajs.js           |  11 +-
 datajs/src/lib/datajs/deferred.js  |   5 +-
 datajs/src/lib/datajs/utils.js     |  61 ++++++-
 datajs/src/lib/datajs/xml.js       |   5 +-
 datajs/src/lib/odata.js            | 108 ++++++-----
 datajs/src/lib/odata/atom.js       |  15 +-
 datajs/src/lib/odata/batch.js      |   5 +-
 datajs/src/lib/odata/gml.js        |   5 +-
 datajs/src/lib/odata/handler.js    |  17 +-
 datajs/src/lib/odata/json-light.js |  68 ++++++-
 datajs/src/lib/odata/json.js       |  72 ++------
 datajs/src/lib/odata/metadata.js   | 309 +++++++++++++++++---------------
 datajs/src/lib/odata/net.js        |  17 +-
 datajs/src/lib/odata/utils.js      |  33 +++-
 datajs/src/lib/odata/xml.js        |  42 ++---
 datajs/src/lib/store.js            |   5 +-
 datajs/src/lib/store/dom.js        |   5 +-
 datajs/src/lib/store/indexeddb.js  |   5 +-
 datajs/src/lib/store/memory.js     |   4 +
 22 files changed, 554 insertions(+), 375 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/olingo-odata4-js/blob/1b51dcbe/datajs/.gitignore
----------------------------------------------------------------------
diff --git a/datajs/.gitignore b/datajs/.gitignore
index a396154..f302fe1 100644
--- a/datajs/.gitignore
+++ b/datajs/.gitignore
@@ -1,4 +1,5 @@
 demo/jscripts/
 demo/jscripts/*
 demo/jscripts/datajs-0.0.0.js
-node_modules/
\ No newline at end of file
+node_modules/
+build
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/olingo-odata4-js/blob/1b51dcbe/datajs/src/lib/cache.js
----------------------------------------------------------------------
diff --git a/datajs/src/lib/cache.js b/datajs/src/lib/cache.js
index 9f5d28f..ba0dda2 100644
--- a/datajs/src/lib/cache.js
+++ b/datajs/src/lib/cache.js
@@ -1,4 +1,7 @@
-//SK name cache.js
+/* {
+    oldname:'cache.js',
+    updated:'20140514 12:59'
+}*/
 /// <reference path="odata-utils.js" />
 
 // Copyright (c) Microsoft Open Technologies, Inc.  All rights reserved.
@@ -32,10 +35,16 @@ var parseInt10 = utils.parseInt10;
 var undefinedDefault = utils.undefinedDefault;
 
 var deferred = require('./datajs/deferred.js');
+
 var createDeferred = deferred.createDeferred;
 var DjsDeferred = deferred.DjsDeferred;
 var ODataCacheSource = require('./cache/source').ODataCacheSource;
 
+var getJsonValueArraryLength = utils.getJsonValueArraryLength;
+var sliceJsonValueArray = utils.sliceJsonValueArray;
+var concatJsonValueArray = utils.concatJsonValueArray;
+
+
 // CONTENT START
 
 var appendPage = function (operation, page) {
@@ -44,11 +53,14 @@ var appendPage = function (operation, page) {
     /// <param name="page" type="Object">Page with (i)ndex, (c)ount and (d)ata.</param>
 
     var intersection = intersectRanges(operation, page);
+    var start = 0;
+    var end = 0;
     if (intersection) {
-        var start = intersection.i - page.i;
-        var end = start + (operation.c - operation.d.length);
-        operation.d = operation.d.concat(page.d.slice(start, end));
+        start = intersection.i - page.i;
+        end = start + (operation.c - getJsonValueArraryLength(operation.d));
     }
+
+    operation.d = concatJsonValueArray(operation.d, sliceJsonValueArray(page.d, start, end));
 };
 
 var intersectRanges = function (x, y) {
@@ -527,7 +539,7 @@ var DataCache = function (options) {
         var deferred = createDeferred();
 
         // Merging read operations would be a nice optimization here.
-        var op = new DataCacheOperation(readStateMachine, deferred, true, index, count, [], 0);
+        var op = new DataCacheOperation(readStateMachine, deferred, true, index, count, {}, 0);
         queueAndStart(op, readOperations);
 
         return extend(deferred.promise(), {
@@ -562,13 +574,13 @@ var DataCache = function (options) {
             var successCallback = function (data) {
                 if (!disposed) {
                     var i, len;
-                    for (i = 0, len = data.length; i < len; i++) {
+                    for (i = 0, len = data.value.length; i < len; i++) {
                         // The wrapper automatically checks for Dispose
                         // on the observer, so we don't need to check it here.
-                        obs.OnNext(data[i]);
+                        obs.OnNext(data.value[i]);
                     }
 
-                    if (data.length < pageSize) {
+                    if (data.value.length < pageSize) {
                         obs.OnCompleted();
                     } else {
                         index += pageSize;
@@ -687,7 +699,8 @@ var DataCache = function (options) {
         var canceled = false;
 
         var request = source.read(start, pageSize, function (data) {
-            var page = { i: start, c: data.length, d: data };
+            var length = getJsonValueArraryLength(data);
+            var page = { i: start, c: length, d: data };
             deferred.resolve(page);
         }, function (err) {
             deferred.reject(err);
@@ -731,32 +744,37 @@ var DataCache = function (options) {
         index = Math.max(index, 0);
 
         var deferred = createDeferred();
-        var arr = [];
+        var returnData = {};
+        returnData.value = [];
         var canceled = false;
         var pendingReadRange = null;
 
         var readMore = function (readIndex, readCount) {
             if (!canceled) {
-                if (count >= 0 && arr.length >= count) {
-                    deferred.resolve(arr);
+                if (count > 0 && returnData.value.length >= count) {
+                    deferred.resolve(returnData);
                 } else {
                     pendingReadRange = that.readRange(readIndex, readCount).then(function (data) {
-                        for (var i = 0, length = data.length; i < length && (count < 0 || arr.length < count); i++) {
+                        if (data["@odata.context"] && !returnData["@odata.context"]) {
+                            returnData["@odata.context"] = data["@odata.context"];
+                        }
+                        
+                        for (var i = 0, length = data.value.length; i < length && (count < 0 || returnData.value.length < count); i++) {
                             var dataIndex = backwards ? length - i - 1 : i;
-                            var item = data[dataIndex];
+                            var item = data.value[dataIndex];
                             if (predicate(item)) {
                                 var element = {
                                     index: readIndex + dataIndex,
                                     item: item
                                 };
 
-                                backwards ? arr.unshift(element) : arr.push(element);
+                                backwards ? returnData.value.unshift(element) : returnData.value.push(element);
                             }
                         }
 
                         // Have we reached the end of the collection?
-                        if ((!backwards && data.length < readCount) || (backwards && readIndex <= 0)) {
-                            deferred.resolve(arr);
+                        if ((!backwards && data.value.length < readCount) || (backwards && readIndex <= 0)) {
+                            deferred.resolve(returnData);
                         } else {
                             var nextIndex = backwards ? Math.max(readIndex - pageSize, 0) : readIndex + readCount;
                             readMore(nextIndex, pageSize);
@@ -1153,7 +1171,7 @@ var DataCache = function (options) {
                     if (cacheState === CACHE_STATE_IDLE || cacheState === CACHE_STATE_PREFETCH) {
                         // Signal the cache that a read operation is running.
                         changeState(CACHE_STATE_READ);
-                        if (operation.c > 0) {
+                        if (operation.c >= 0) {
                             // Snap the requested range to a page boundary.
                             var range = snapToPageBoundaries(operation.i, operation.c, pageSize);
                             transition(READ_STATE_LOCAL, range.i);
@@ -1168,7 +1186,7 @@ var DataCache = function (options) {
                     // continue processing.
                     // Data is expected to be the read page.
                     appendPage(operation, data);
-                    var len = operation.d.length;
+                    var len = getJsonValueArraryLength(operation.d);
                     // Are we done?
                     if (operation.c === len || data.c < pageSize) {
                         // Update the stats, request for a prefetch operation.

http://git-wip-us.apache.org/repos/asf/olingo-odata4-js/blob/1b51dcbe/datajs/src/lib/cache/source.js
----------------------------------------------------------------------
diff --git a/datajs/src/lib/cache/source.js b/datajs/src/lib/cache/source.js
index bcb61de..f6beeb4 100644
--- a/datajs/src/lib/cache/source.js
+++ b/datajs/src/lib/cache/source.js
@@ -1,4 +1,7 @@
-//SK name /cache/cache-source.js
+/* {
+    oldname:'cache_source.js',
+    updated:'20140514 12:59'
+}*/
 /// <reference path="odata-utils.js" />
 
 // Copyright (c) Microsoft Open Technologies, Inc.  All rights reserved.
@@ -95,39 +98,54 @@ var queryForData = function (uri, options, success, error) {
     /// <param name="error" type="Function">Error callback.</param>
     /// <returns type="Object">Object with an abort method.</returns>
 
-    var request = queryForDataInternal(uri, options, [], success, error);
+    var request = queryForDataInternal(uri, options, {}, success, error);
     return request;
 };
 
-var queryForDataInternal = function (uri, options, data, success, error) {
-    /// <summary>Gets data from an OData service taking into consideration server side paging.</summary>
-    /// <param name="uri" type="String">URI to the OData service.</param>
-    /// <param name="options" type="Object">Object with additional well-known request options.</param>
-    /// <param name="data" type="Array">Array that stores the data provided by the OData service.</param>
-    /// <param name="success" type="Function">Success callback.</param>
-    /// <param name="error" type="Function">Error callback.</param>
-    /// <returns type="Object">Object with an abort method.</returns>
-
-    var request = buildODataRequest(uri, options);
-    var currentRequest = oRta_request.request(request, function (newData) {
-        var next = newData.__next;
-        var results = newData.results;
-
-        data = data.concat(results);
-
-        if (next) {
-            currentRequest = queryForDataInternal(next, options, data, success, error);
-        } else {
-            success(data);
-        }
-    }, error, undefined, options.httpClient, options.metadata);
-
-    return {
-        abort: function () {
-            currentRequest.abort();
-        }
+    var queryForDataInternal = function (uri, options, data, success, error) {
+        /// <summary>Gets data from an OData service taking into consideration server side paging.</summary>
+        /// <param name="uri" type="String">URI to the OData service.</param>
+        /// <param name="options" type="Object">Object with additional well-known request options.</param>
+        /// <param name="data" type="Array">Array that stores the data provided by the OData service.</param>
+        /// <param name="success" type="Function">Success callback.</param>
+        /// <param name="error" type="Function">Error callback.</param>
+        /// <returns type="Object">Object with an abort method.</returns>
+
+        var request = buildODataRequest(uri, options);
+        var currentRequest = odata.request(request, function (newData) {
+            var nextLink = newData["@odata.nextLink"];
+            if (nextLink) {
+                var index = uri.indexOf(".svc/", 0);
+                if (index != -1) {
+                    nextLink = uri.substring(0, index + 5) + nextLink;
+                }
+            }
+
+            if (data.value && newData.value) {
+                data.value = data.value.concat(newData.value);
+            }
+            else {
+                for (var property in newData) {
+                    if (property != "@odata.nextLink") {
+                        data[property] = newData[property];
+                    }
+                }
+            }
+
+            if (nextLink) {
+                currentRequest = queryForDataInternal(nextLink, options, data, success, error);
+            }
+            else {
+                success(data);
+            }
+        }, error, undefined, options.httpClient, options.metadata);
+
+        return {
+            abort: function () {
+                currentRequest.abort();
+            }
+        };
     };
-};
 
 var ODataCacheSource = function (options) {
     /// <summary>Creates a data cache source object for requesting data from an OData service.</summary>

http://git-wip-us.apache.org/repos/asf/olingo-odata4-js/blob/1b51dcbe/datajs/src/lib/datajs.js
----------------------------------------------------------------------
diff --git a/datajs/src/lib/datajs.js b/datajs/src/lib/datajs.js
index eef7a68..ca7189b 100644
--- a/datajs/src/lib/datajs.js
+++ b/datajs/src/lib/datajs.js
@@ -1,4 +1,7 @@
-//SK name datajs.js
+/* {
+    oldname:'datajs.js',
+    updated:'20140514 12:59'
+}*/
 // Copyright (c) Microsoft Open Technologies, Inc.  All rights reserved.
 // Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
 // files (the "Software"), to deal  in the Software without restriction, including without limitation the rights  to use, copy,
@@ -22,9 +25,9 @@
 
 //expose all external usable functions via self.apiFunc = function
 exports.version = {
-    major: 0,
-    minor: 0,
-    build: 0
+    major: 1,
+    minor: 1,
+    build: 1
 };
 
 

http://git-wip-us.apache.org/repos/asf/olingo-odata4-js/blob/1b51dcbe/datajs/src/lib/datajs/deferred.js
----------------------------------------------------------------------
diff --git a/datajs/src/lib/datajs/deferred.js b/datajs/src/lib/datajs/deferred.js
index e73b2f9..2373aae 100644
--- a/datajs/src/lib/datajs/deferred.js
+++ b/datajs/src/lib/datajs/deferred.js
@@ -1,4 +1,7 @@
-//SK name deferred.js
+/* {
+    oldname:'deferred.js',
+    updated:'20140514 12:59'
+}*/
 /// <reference path="odata-utils.js" />
 
 // Copyright (c) Microsoft Open Technologies, Inc.  All rights reserved.

http://git-wip-us.apache.org/repos/asf/olingo-odata4-js/blob/1b51dcbe/datajs/src/lib/datajs/utils.js
----------------------------------------------------------------------
diff --git a/datajs/src/lib/datajs/utils.js b/datajs/src/lib/datajs/utils.js
index 9c44b07..67bbc94 100644
--- a/datajs/src/lib/datajs/utils.js
+++ b/datajs/src/lib/datajs/utils.js
@@ -1,4 +1,7 @@
-//SK name /datajs/utils.js
+/* {
+    oldname:'utils.js',
+    updated:'20140514 12:59'
+}*/
 // Copyright (c) Microsoft Open Technologies, Inc.  All rights reserved.
 // Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation 
 // files (the "Software"), to deal  in the Software without restriction, including without limitation the rights  to use, copy,
@@ -460,6 +463,59 @@ var addBase64Padding = function (binaryString) {
 
 };
 
+var getJsonValueArraryLength = function (data) {
+    if (data && data.value) {
+        return data.value.length;
+    }
+
+    return 0;
+};
+
+var sliceJsonValueArray = function (data, start, end) {
+    if (data == undefined || data.value == undefined) {
+        return data;
+    }
+
+    if (start < 0) {
+        start = 0;
+    }
+
+    var length = getJsonValueArraryLength(data);
+    if (length < end) {
+        end = length;
+    }
+
+    var newdata = {};
+    for (var property in data) {
+        if (property == "value") {
+            newdata[property] = data[property].slice(start, end);
+        } else {
+            newdata[property] = data[property];
+        }
+    }
+
+    return newdata;
+};
+
+var concatJsonValueArray = function (data, concatData) {
+    if (concatData == undefined || concatData.value == undefined) {
+        return data;
+    }
+
+    if (data == undefined || Object.keys(data).length == 0) {
+        return concatData;
+    }
+
+    if (data.value == undefined) {
+        data.value = concatData.value;
+        return data;
+    }
+
+    data.value = data.value.concat(concatData.value);
+
+    return data;
+};
+
 // DATAJS INTERNAL START
 exports.activeXObject = activeXObject;
 exports.assigned = assigned;
@@ -482,6 +538,9 @@ exports.trimString = trimString;
 exports.undefinedDefault = undefinedDefault;
 exports.decodeBase64 = decodeBase64;
 exports.convertByteArrayToHexString = convertByteArrayToHexString;
+exports.getJsonValueArraryLength = getJsonValueArraryLength;
+exports.sliceJsonValueArray = sliceJsonValueArray;
+exports.concatJsonValueArray = concatJsonValueArray;
 // DATAJS INTERNAL END
 
     
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/olingo-odata4-js/blob/1b51dcbe/datajs/src/lib/datajs/xml.js
----------------------------------------------------------------------
diff --git a/datajs/src/lib/datajs/xml.js b/datajs/src/lib/datajs/xml.js
index 1475525..c0a75dc 100644
--- a/datajs/src/lib/datajs/xml.js
+++ b/datajs/src/lib/datajs/xml.js
@@ -1,4 +1,7 @@
-//SK name /datajs/xml.js
+/* {
+    oldname:'xml.js',
+    updated:'20140514 12:59'
+}*/
 // Copyright (c) Microsoft Open Technologies, Inc.  All rights reserved.
 // Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation 
 // files (the "Software"), to deal  in the Software without restriction, including without limitation the rights  to use, copy,

http://git-wip-us.apache.org/repos/asf/olingo-odata4-js/blob/1b51dcbe/datajs/src/lib/odata.js
----------------------------------------------------------------------
diff --git a/datajs/src/lib/odata.js b/datajs/src/lib/odata.js
index ab90cbc..60d6105 100644
--- a/datajs/src/lib/odata.js
+++ b/datajs/src/lib/odata.js
@@ -1,4 +1,7 @@
-//SK name odata.js
+/* {
+    oldname:'odata.js',
+    updated:'20140514 12:59'
+}*/
 // Copyright (c) Microsoft Open Technologies, Inc.  All rights reserved.
 // Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
 // files (the "Software"), to deal  in the Software without restriction, including without limitation the rights  to use, copy,
@@ -46,7 +49,8 @@ var metadataParser = odataMetadata.metadataParser;
 
 // CONTENT START
 
-var handlers = [odataJson.jsonHandler, odataAtom.atomHandler, odataXml.xmlHandler, odataHandler.textHandler];
+// to do: disable atom scenario
+var handlers = [odata.jsonHandler/*, odata.atomHandler*/, odata.xmlHandler, odata.textHandler];
 
 var dispatchHandler = function (handlerMethod, requestOrResponse, context) {
     /// <summary>Dispatches an operation to handlers.</summary>
@@ -63,7 +67,39 @@ var dispatchHandler = function (handlerMethod, requestOrResponse, context) {
     }
 };
 
+exports.defaultSuccess = function (data) {
+    /// <summary>Default success handler for OData.</summary>
+    /// <param name="data">Data to process.</param>
 
+    window.alert(window.JSON.stringify(data));
+};
+
+exports.defaultError = throwErrorCallback;
+
+exports.defaultHandler = {
+        read: function (response, context) {
+            /// <summary>Reads the body of the specified response by delegating to JSON and ATOM handlers.</summary>
+            /// <param name="response">Response object.</param>
+            /// <param name="context">Operation context.</param>
+
+            if (response && assigned(response.body) && response.headers["Content-Type"]) {
+                dispatchHandler("read", response, context);
+            }
+        },
+
+        write: function (request, context) {
+            /// <summary>Write the body of the specified request by delegating to JSON and ATOM handlers.</summary>
+            /// <param name="request">Reques tobject.</param>
+            /// <param name="context">Operation context.</param>
+
+            dispatchHandler("write", request, context);
+        },
+
+        maxDataServiceVersion: MAX_DATA_SERVICE_VERSION,
+        accept: "application/json;q=0.9, application/atomsvc+xml;q=0.8, */*;q=0.1"
+    };
+
+exports.defaultMetadata = [];
 
 exports.read = function (urlOrRequest, success, error, handler, httpClient, metadata) {
     /// <summary>Reads data from the specified URL.</summary>
@@ -84,54 +120,6 @@ exports.read = function (urlOrRequest, success, error, handler, httpClient, meta
     return exports.request(request, success, error, handler, httpClient, metadata);
 };
 
-
-
-exports.parseMetadata = function (csdlMetadataDocument) {
-    /// <summary>Parses the csdl metadata to DataJS metatdata format. This method can be used when the metadata is retrieved using something other than DataJS</summary>
-    /// <param name="atomMetadata" type="string">A string that represents the entire csdl metadata.</param>
-    /// <returns type="Object">An object that has the representation of the metadata in Datajs format.</returns>
-
-    return metadataParser(null, csdlMetadataDocument);
-};
-
-
-exports.defaultSuccess = function (data) {
-    /// <summary>Default success handler for OData.</summary>
-    /// <param name="data">Data to process.</param>
-
-    window.alert(window.JSON.stringify(data));
-};
-
-exports.defaultError = utils.throwErrorCallback;
-
-exports.defaultHandler = {
-    read: function (response, context) {
-        /// <summary>Reads the body of the specified response by delegating to JSON and ATOM handlers.</summary>
-        /// <param name="response">Response object.</param>
-        /// <param name="context">Operation context.</param>
-
-        if (response && assigned(response.body) && response.headers["Content-Type"]) {
-            dispatchHandler("read", response, context);
-        }
-    },
-
-    write: function (request, context) {
-        /// <summary>Write the body of the specified request by delegating to JSON and ATOM handlers.</summary>
-        /// <param name="request">Reques tobject.</param>
-        /// <param name="context">Operation context.</param>
-
-        dispatchHandler("write", request, context);
-    },
-
-    maxDataServiceVersion: odataHandler.MAX_DATA_SERVICE_VERSION,
-    accept: "application/atomsvc+xml;q=0.8, application/json;odata=fullmetadata;q=0.7, application/json;q=0.5, */*;q=0.1"
-};
-
-// Configure the batch handler to use the default handler for the batch parts.
-exports.batchHandler.partHandler = exports.defaultHandler;
-exports.defaultMetadata = [];
-
-
 exports.request = function (request, success, error, handler, httpClient, metadata) {
     /// <summary>Sends a request containing OData payload to a server.</summary>
     /// <param name="request" type="Object">Object that represents the request to be sent.</param>
@@ -152,8 +140,6 @@ exports.request = function (request, success, error, handler, httpClient, metada
     request.callbackParameterName = utils.defined(request.callbackParameterName, odataNet.defaultHttpClient.callbackParameterName);
     request.formatQueryString = utils.defined(request.formatQueryString, odataNet.defaultHttpClient.formatQueryString);
     request.enableJsonpCallback = utils.defined(request.enableJsonpCallback, odataNet.defaultHttpClient.enableJsonpCallback);
-    request.useJsonLight = utils.defined(request.useJsonLight, odataJson.jsonHandler.useJsonLight);
-    request.inferJsonLightFeedAsObject = utils.defined(request.inferJsonLightFeedAsObject, odataJson.jsonHandler.inferJsonLightFeedAsObject);
 
     // Create the base context for read/write operations, also specifying complete settings.
     var context = {
@@ -162,9 +148,7 @@ exports.request = function (request, success, error, handler, httpClient, metada
         callbackParameterName: request.callbackParameterName,
         formatQueryString: request.formatQueryString,
         enableJsonpCallback: request.enableJsonpCallback,
-        useJsonLight: request.useJsonLight,
-        inferJsonLightFeedAsObject: request.inferJsonLightFeedAsObject
-    };
+s    };
 
     try {
         odataUtils.prepareRequest(request, handler, context);
@@ -172,4 +156,16 @@ exports.request = function (request, success, error, handler, httpClient, metada
     } catch (err) {
         error(err);
     }
-};
\ No newline at end of file
+
+};
+
+exports.parseMetadata = function (csdlMetadataDocument) {
+    /// <summary>Parses the csdl metadata to DataJS metatdata format. This method can be used when the metadata is retrieved using something other than DataJS</summary>
+    /// <param name="atomMetadata" type="string">A string that represents the entire csdl metadata.</param>
+    /// <returns type="Object">An object that has the representation of the metadata in Datajs format.</returns>
+
+    return metadataParser(null, csdlMetadataDocument);
+};
+
+// Configure the batch handler to use the default handler for the batch parts.
+exports.batchHandler.partHandler = exports.defaultHandler;

http://git-wip-us.apache.org/repos/asf/olingo-odata4-js/blob/1b51dcbe/datajs/src/lib/odata/atom.js
----------------------------------------------------------------------
diff --git a/datajs/src/lib/odata/atom.js b/datajs/src/lib/odata/atom.js
index d47ea3f..dc68e37 100644
--- a/datajs/src/lib/odata/atom.js
+++ b/datajs/src/lib/odata/atom.js
@@ -1,4 +1,7 @@
-//SK name /odata/odata-atom.js
+/* {
+    oldname:'odata-atom.js',
+    updated:'20140514 12:59'
+}*/
 /// <reference path="odata-utils.js" />
 /// <reference path="odata-handler.js" />
 /// <reference path="odata-xml.js" />
@@ -31,11 +34,11 @@ var contains  = utils.contains;
 var djsassert = utils.djsassert;
 var isArray   = utils.isArray;
 var isObject  = utils.isObject;
-
+var isXmlNSDeclaration = xml.isXmlNSDeclaration;
 var normalizeURI = utils.normalizeURI;
 var parseInt10 = utils.parseInt10;
 
-var isXmlNSDeclaration = xml.isXmlNSDeclaration;
+
 var xmlAppendChild = xml.xmlAppendChild;
 var xmlAppendChildren = xml.xmlAppendChildren
 var xmlAttributes = xml.xmlAttributes;
@@ -109,9 +112,9 @@ var atomPrefix = "a";
 var atomXmlNs = w3org + "2005/Atom";                    // http://www.w3.org/2005/Atom
 var appXmlNs = w3org + "2007/app";                      // http://www.w3.org/2007/app
 
-var odataEditMediaPrefix = adoDs + "/edit-media/";        // http://schemas.microsoft.com/ado/2007/08/dataservices/edit-media
-var odataMediaResourcePrefix = adoDs + "/mediaresource/"; // http://schemas.microsoft.com/ado/2007/08/dataservices/mediaresource
-var odataRelatedLinksPrefix = adoDs + "/relatedlinks/";   // http://schemas.microsoft.com/ado/2007/08/dataservices/relatedlinks
+var odataEditMediaPrefix = adoDs + "/edit-media/";        // http://docs.oasis-open.org/odata/ns/edit-media
+var odataMediaResourcePrefix = adoDs + "/mediaresource/"; // http://docs.oasis-open.org/odata/ns/mediaresource
+var odataRelatedLinksPrefix = adoDs + "/relatedlinks/";   // http://docs.oasis-open.org/odata/ns/relatedlinks
 
 var atomAcceptTypes = ["application/atom+xml", "application/atomsvc+xml", "application/xml"];
 var atomMediaType = atomAcceptTypes[0];

http://git-wip-us.apache.org/repos/asf/olingo-odata4-js/blob/1b51dcbe/datajs/src/lib/odata/batch.js
----------------------------------------------------------------------
diff --git a/datajs/src/lib/odata/batch.js b/datajs/src/lib/odata/batch.js
index a81cf13..7993199 100644
--- a/datajs/src/lib/odata/batch.js
+++ b/datajs/src/lib/odata/batch.js
@@ -1,4 +1,7 @@
-//SK name /odata/odata-batch.js
+/* {
+    oldname:'odata-batch.js',
+    updated:'20140514 12:59'
+}*/
 /// <reference path="odata-utils.js" />
 
 // Copyright (c) Microsoft Open Technologies, Inc.  All rights reserved.

http://git-wip-us.apache.org/repos/asf/olingo-odata4-js/blob/1b51dcbe/datajs/src/lib/odata/gml.js
----------------------------------------------------------------------
diff --git a/datajs/src/lib/odata/gml.js b/datajs/src/lib/odata/gml.js
index 68788b0..908f140 100644
--- a/datajs/src/lib/odata/gml.js
+++ b/datajs/src/lib/odata/gml.js
@@ -1,4 +1,7 @@
-//SK name /odata/odata-gml.js
+/* {
+    oldname:'odata-gml.js',
+    updated:'20140514 12:59'
+}*/
 // Copyright (c) Microsoft Open Technologies, Inc.  All rights reserved.
 // Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation 
 // files (the "Software"), to deal  in the Software without restriction, including without limitation the rights  to use, copy,

http://git-wip-us.apache.org/repos/asf/olingo-odata4-js/blob/1b51dcbe/datajs/src/lib/odata/handler.js
----------------------------------------------------------------------
diff --git a/datajs/src/lib/odata/handler.js b/datajs/src/lib/odata/handler.js
index f26a35a..78176ab 100644
--- a/datajs/src/lib/odata/handler.js
+++ b/datajs/src/lib/odata/handler.js
@@ -1,4 +1,7 @@
-//SK name /odata/odata-handler.js
+/* {
+    oldname:'odata-handler.js',
+    updated:'20140514 12:59'
+}*/
 // Copyright (c) Microsoft Open Technologies, Inc.  All rights reserved.
 // Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
 // files (the "Software"), to deal  in the Software without restriction, including without limitation the rights  to use, copy,
@@ -27,7 +30,7 @@ var maxVersion = oDataUtils.maxVersion;
 
 // CONTENT START
 
-var MAX_DATA_SERVICE_VERSION = "3.0";
+var MAX_DATA_SERVICE_VERSION = "4.0";
 
 var contentType = function (str) {
     /// <summary>Parses a string into an object with media type and properties.</summary>
@@ -111,8 +114,8 @@ var fixDataServiceVersionHeader = function (request, version) {
 
     if (request) {
         var headers = request.headers;
-        var dsv = headers["DataServiceVersion"];
-        headers["DataServiceVersion"] = dsv ? maxVersion(dsv, version) : version;
+        var dsv = headers["OData-Version"];
+        headers["OData-Version"] = dsv ? maxVersion(dsv, version) : version;
     }
 };
 
@@ -140,7 +143,7 @@ var getDataServiceVersion = function (requestOrResponse) {
     /// <param name="requestOrResponse">Object representing a request or a response.</param>
     /// <returns type="String">Data service version; undefined if the header cannot be found.</returns>
 
-    var value = getRequestOrResponseHeader(requestOrResponse, "DataServiceVersion");
+    var value = getRequestOrResponseHeader(requestOrResponse, "OData-Version");
     if (value) {
         var matches = versionRE.exec(value);
         if (matches && matches.length) {
@@ -213,10 +216,10 @@ var handlerWrite = function (handler, serializeCallback, request, context) {
         request.body = serializeCallback(handler, request.data, writeContext);
 
         if (request.body !== undefined) {
-            fixDataServiceVersionHeader(request, writeContext.dataServiceVersion || "1.0");
+            fixDataServiceVersionHeader(request, writeContext.dataServiceVersion || "4.0");
 
             fixRequestHeader(request, "Content-Type", contentTypeToString(writeContext.contentType));
-            fixRequestHeader(request, "MaxDataServiceVersion", handler.maxDataServiceVersion);
+            fixRequestHeader(request, "OData-MaxVersion", handler.maxDataServiceVersion);
             return true;
         }
     }

http://git-wip-us.apache.org/repos/asf/olingo-odata4-js/blob/1b51dcbe/datajs/src/lib/odata/json-light.js
----------------------------------------------------------------------
diff --git a/datajs/src/lib/odata/json-light.js b/datajs/src/lib/odata/json-light.js
index 2094d69..4718070 100644
--- a/datajs/src/lib/odata/json-light.js
+++ b/datajs/src/lib/odata/json-light.js
@@ -1,4 +1,7 @@
-//SK name /odata/odata-json-light.js
+/* {
+    oldname:'odata-json-light.js',
+    updated:'20140514 12:59'
+}*/
 // Copyright (c) Microsoft Open Technologies, Inc.  All rights reserved.
 // Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation 
 // files (the "Software"), to deal  in the Software without restriction, including without limitation the rights  to use, copy,
@@ -72,8 +75,9 @@ var PAYLOADTYPE_LINKS = "l";
 var odataNs = "odata";
 var odataAnnotationPrefix = odataNs + ".";
 
+var contextUrlAnnotation = "@" + odataAnnotationPrefix + "context";
+
 var bindAnnotation = "@" + odataAnnotationPrefix + "bind";
-var metadataAnnotation = odataAnnotationPrefix + "metadata";
 var navUrlAnnotation = odataAnnotationPrefix + "navigationLinkUrl";
 var typeAnnotation = odataAnnotationPrefix + "type";
 
@@ -1043,7 +1047,7 @@ var jsonLightPayloadInfo = function (data, model, inferFeedAsComplexType) {
     ///     Object with kind and type fields. Null if there is no metadata annotation or the payload info cannot be obtained..
     /// </returns>
 
-    var metadataUri = data[metadataAnnotation];
+    var metadataUri = data[contextUrlAnnotation];
     if (!metadataUri || typeof metadataUri !== "string") {
         return null;
     }
@@ -1143,15 +1147,15 @@ var jsonLightReadPayload = function (data, model, recognizeDates, inferFeedAsCom
         return data;
     }
 
-    contentTypeOdata = contentTypeOdata || "minimalmetadata";
-    var baseURI = data[metadataAnnotation];
+    contentTypeOdata = contentTypeOdata || "minimal";
+    var baseURI = data[contextUrlAnnotation];
     var payloadInfo = jsonLightPayloadInfo(data, model, inferFeedAsComplexType);
     if (assigned(payloadInfo)) {
         payloadInfo.contentTypeOdata = contentTypeOdata;
     }
     var typeName = null;
     if (payloadInfo) {
-        delete data[metadataAnnotation];
+        delete data[contextUrlAnnotation];
 
         typeName = payloadInfo.type;
         switch (payloadInfo.kind) {
@@ -1170,7 +1174,56 @@ var jsonLightReadPayload = function (data, model, recognizeDates, inferFeedAsCom
     return jsonLightReadObject(data, payloadInfo, baseURI, model, recognizeDates);
 };
 
-var jsonLightSerializableMetadata = ["type", "etag", "media_src", "edit_media", "content_type", "media_etag"];
+var jsonLightSerializableMetadata = ["@odata.type", "@odata.etag", "@odata.mediaEditLink", "@odata.mediaReadLink", "@odata.mediaContentType", "@odata.mediaEtag"];
+
+var formatJsonLightRequestPayload = function (data) {
+    if (!data) {
+        return data;
+    }
+
+    if (isPrimitive(data)) {
+        return data;
+    }
+
+    if (isArray(data)) {
+        var newArrayData = [];
+        var i, len;
+        for (i = 0, len = data.length; i < len; i++) {
+            newArrayData[i] = formatJsonLightRequestPayload(data[i]);
+        }
+
+        return newArrayData;
+    }
+
+    var newdata = {};
+    for (var property in data) {
+        if (isJsonLightSerializableProperty(property)) {
+            newdata[property] = formatJsonLightRequestPayload(data[property]);
+        }
+    }
+
+    return newdata;
+};
+
+var isJsonLightSerializableProperty = function (property) {
+    if (!property) {
+        return false;
+    }
+
+    if (property.indexOf("@odata.") == -1) {
+        return true;
+    }
+
+    var i, len;
+    for (i = 0, len = jsonLightSerializableMetadata.length; i < len; i++) {
+        var name = jsonLightSerializableMetadata[i];
+        if (property.indexOf(name) != -1) {
+            return true;
+        }
+    }
+
+    return false;
+};
 
 var formatJsonLight = function (obj, context) {
     /// <summary>Converts an object in the library's internal representation to its json light representation.</summary>
@@ -1381,4 +1434,5 @@ var formatJsonLightAnnotation = function (qName, target, value, data) {
 // DATAJS INTERNAL START
 exports.jsonLightReadPayload = jsonLightReadPayload;
 exports.formatJsonLight = formatJsonLight;
+exports.formatJsonLightRequestPayload = formatJsonLightRequestPayload;
 // DATAJS INTERNAL END

http://git-wip-us.apache.org/repos/asf/olingo-odata4-js/blob/1b51dcbe/datajs/src/lib/odata/json.js
----------------------------------------------------------------------
diff --git a/datajs/src/lib/odata/json.js b/datajs/src/lib/odata/json.js
index cb5dcfc..044227e 100644
--- a/datajs/src/lib/odata/json.js
+++ b/datajs/src/lib/odata/json.js
@@ -1,4 +1,7 @@
-//SK name /odata/odata-json.js
+/* {
+    oldname:'odata-json.js',
+    updated:'20140514 12:59'
+}*/
 // Copyright (c) Microsoft Open Technologies, Inc.  All rights reserved.
 // Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation 
 // files (the "Software"), to deal  in the Software without restriction, including without limitation the rights  to use, copy,
@@ -18,6 +21,7 @@
 var utils    = require('./../datajs.js').utils;
 var oDataUtils    = require('./utils.js');
 var oDataHandler    = require('./handler.js');
+var oJsonLight    = require('./json-light.js');
 
 
 var defined = utils.defined;
@@ -45,6 +49,7 @@ var parseDuration = oDataUtils.parseDuration;
 var parseTimezone = oDataUtils.parseTimezone;
 var payloadTypeOf = oDataUtils.payloadTypeOf;
 var traverse = oDataUtils.traverse;
+var formatJsonLightRequestPayload = oJsonLight.formatJsonLightRequestPayload;
 
 // CONTENT START
 
@@ -132,8 +137,8 @@ var isJsonLight = function (contentType) {
     /// <returns type="Boolean">True is the content type indicates a json light payload. False otherwise.</returns>
 
     if (contentType) {
-        var odata = contentType.properties.odata;
-        return odata === "nometadata" || odata === "minimalmetadata" || odata === "fullmetadata";
+        var odata = contentType.properties["odata.metadata"];
+        return odata === "none" || odata === "minimal" || odata === "full";
     }
     return false;
 };
@@ -233,26 +238,14 @@ var jsonParser = function (handler, text, context) {
     /// <param name="context" type="Object">Object with parsing context.</param>
     /// <returns>An object representation of the OData payload.</returns>
 
-    var recognizeDates = defined(context.recognizeDates, handler.recognizeDates);
-    var inferJsonLightFeedAsObject = defined(context.inferJsonLightFeedAsObject, handler.inferJsonLightFeedAsObject);
-    var model = context.metadata;
     var dataServiceVersion = context.dataServiceVersion;
-    var dateParser = parseJsonDateString;
     var json = (typeof text === "string") ? window.JSON.parse(text) : text;
 
-    if ((maxVersion("3.0", dataServiceVersion) === dataServiceVersion)) {
-        if (isJsonLight(context.contentType)) {
-            return jsonLightReadPayload(json, model, recognizeDates, inferJsonLightFeedAsObject, context.contentType.properties.odata);
-        }
-        dateParser = parseDateTime;
+    if ((maxVersion("4.0", dataServiceVersion) === dataServiceVersion)) {
+        return json;
     }
 
-    json = traverse(json.d, function (key, value) {
-        return jsonApplyMetadata(value, model, dateParser, recognizeDates);
-    });
-
-    json = jsonUpdateDataFromVersion(json, context.dataServiceVersion);
-    return jsonNormalizeData(json, context.response.requestUri);
+    return undefined;
 };
 
 var jsonToString = function (data) {
@@ -283,23 +276,17 @@ var jsonSerializer = function (handler, data, context) {
     /// <param name="context" type="Object">Object with serialization context.</param>
     /// <returns type="String">The string representation of data.</returns>
 
-    var dataServiceVersion = context.dataServiceVersion || "1.0";
-    var useJsonLight = defined(context.useJsonLight, handler.useJsonLight);
+    var dataServiceVersion = context.dataServiceVersion || "4.0";
     var cType = context.contentType = context.contentType || jsonContentType;
 
     if (cType && cType.mediaType === jsonContentType.mediaType) {
-        var json = data;
-        if (useJsonLight || isJsonLight(cType)) {
-            context.dataServiceVersion = maxVersion(dataServiceVersion, "3.0");
-            json = formatJsonLight(data, context);
-            return jsonToString(json);
+        context.dataServiceVersion = maxVersion(dataServiceVersion, "4.0");
+        var newdata = formatJsonLightRequestPayload(data);
+        if (newdata) {
+            return window.JSON.stringify(newdata);
         }
-        if (maxVersion("3.0", dataServiceVersion) === dataServiceVersion) {
-            cType.properties.odata = "verbose";
-            context.contentType = cType;
-        }
-        return jsonToString(json);
     }
+
     return undefined;
 };
 
@@ -331,32 +318,8 @@ var jsonNormalizeData = function (data, baseURI) {
     return isSvcDoc ? normalizeServiceDocument(data, baseURI) : data;
 };
 
-var jsonUpdateDataFromVersion = function (data, dataVersion) {
-    /// <summary>
-    /// Updates the specified data in the specified version to look
-    /// like the latest supported version.
-    /// </summary>
-    /// <param name="data" optional="false">Data to update.</param>
-    /// <param name="dataVersion" optional="true" type="String">Version the data is in (possibly unknown).</param>
-
-    // Strip the trailing comma if there.
-    if (dataVersion && dataVersion.lastIndexOf(";") === dataVersion.length - 1) {
-        dataVersion = dataVersion.substr(0, dataVersion.length - 1);
-    }
-
-    if (!dataVersion || dataVersion === "1.0") {
-        if (isArray(data)) {
-            data = { results: data };
-        }
-    }
-
-    return data;
-};
-
 var jsonHandler = oDataHandler.handler(jsonParser, jsonSerializer, jsonMediaType, MAX_DATA_SERVICE_VERSION);
 jsonHandler.recognizeDates = false;
-jsonHandler.useJsonLight = false;
-jsonHandler.inferJsonLightFeedAsObject = false;
 
 exports.jsonHandler = jsonHandler;
 
@@ -366,7 +329,6 @@ exports.jsonHandler = jsonHandler;
 exports.jsonParser = jsonParser;
 exports.jsonSerializer = jsonSerializer;
 exports.jsonNormalizeData = jsonNormalizeData;
-exports.jsonUpdateDataFromVersion = jsonUpdateDataFromVersion;
 exports.normalizeServiceDocument = normalizeServiceDocument;
 exports.parseJsonDateString = parseJsonDateString;
 // DATAJS INTERNAL END

http://git-wip-us.apache.org/repos/asf/olingo-odata4-js/blob/1b51dcbe/datajs/src/lib/odata/metadata.js
----------------------------------------------------------------------
diff --git a/datajs/src/lib/odata/metadata.js b/datajs/src/lib/odata/metadata.js
index 62a88fb..376c05f 100644
--- a/datajs/src/lib/odata/metadata.js
+++ b/datajs/src/lib/odata/metadata.js
@@ -1,4 +1,7 @@
-//SK name /odata/odata-metadata.js
+/* {
+    oldname:'odata-metadata.js',
+    updated:'20140514 12:59'
+}*/
 // Copyright (c) Microsoft Open Technologies, Inc.  All rights reserved.
 // Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation 
 // files (the "Software"), to deal  in the Software without restriction, including without limitation the rights  to use, copy,
@@ -34,15 +37,8 @@ var xmlNS = oDSxml.xmlNS;
 var xmlnsNS = oDSxml.xmlnsNS;
 var xmlParse = oDSxml.xmlParse;
 
-var createAttributeExtension = oDataXML.createAttributeExtension;
-var createElementExtension = oDataXML.createElementExtension;
 var edmxNs = oDataXML.edmxNs;
 var edmNs1 = oDataXML.edmNs1;
-var edmNs1_1 = oDataXML.edmNs1_1;
-var edmNs1_2 = oDataXML.edmNs1_2;
-var edmNs2a = oDataXML.edmNs2a;
-var edmNs2b = oDataXML.edmNs2b;
-var edmNs3 = oDataXML.edmNs3;
 var handler = oDataXML.handler;
 var MAX_DATA_SERVICE_VERSION = oDataXML.MAX_DATA_SERVICE_VERSION;
 var odataMetaXmlNs = oDataXML.odataMetaXmlNs;
@@ -72,87 +68,136 @@ var schemaElement = function (attributes, elements, text, ns) {
 };
 
 // It's assumed that all elements may have Documentation children and Annotation elements.
-// See http://msdn.microsoft.com/en-us/library/bb399292.aspx for a CSDL reference.
+// See http://docs.oasis-open.org/odata/odata/v4.0/cs01/part3-csdl/odata-v4.0-cs01-part3-csdl.html for a CSDL reference.
 var schema = {
     elements: {
+        Action: schemaElement(
+        /*attributes*/["Name", "IsBound", "EntitySetPath"],
+        /*elements*/["ReturnType", "Parameter*", "Annotation*"]
+        ),
+        ActionImport: schemaElement(
+        /*attributes*/["Name", "Action", "EntitySet", "Annotation*"]
+        ),
+        Annotation: schemaElement(
+        /*attributes*/["Term", "Qualifier", "Binary", "Bool", "Date", "DateTimeOffset", "Decimal", "Duration", "EnumMember", "Float", "Guid", "Int", "String", "TimeOfDay", "AnnotationPath", "NavigationPropertyPath", "Path", "PropertyPath", "UrlRef"],
+        /*elements*/["Binary*", "Bool*", "Date*", "DateTimeOffset*", "Decimal*", "Duration*", "EnumMember*", "Float*", "Guid*", "Int*", "String*", "TimeOfDay*", "And*", "Or*", "Not*", "Eq*", "Ne*", "Gt*", "Ge*", "Lt*", "Le*", "AnnotationPath*", "Apply*", "Cast*", "Collection*", "If*", "IsOf*", "LabeledElement*", "LabeledElementReference*", "Null*", "NavigationPropertyPath*", "Path*", "PropertyPath*", "Record*", "UrlRef*", "Annotation*"]
+        ),
+        AnnotationPath: schemaElement(
+        /*attributes*/null,
+        /*elements*/null,
+        /*text*/true
+        ),
         Annotations: schemaElement(
         /*attributes*/["Target", "Qualifier"],
-        /*elements*/["TypeAnnotation*", "ValueAnnotation*"]
+        /*elements*/["Annotation*"]
         ),
-        Association: schemaElement(
-        /*attributes*/["Name"],
-        /*elements*/["End*", "ReferentialConstraint", "TypeAnnotation*", "ValueAnnotation*"]
+        Apply: schemaElement(
+        /*attributes*/["Function"],
+        /*elements*/["String*", "Path*", "LabeledElement*", "Annotation*"]
         ),
-        AssociationSet: schemaElement(
-        /*attributes*/["Name", "Association"],
-        /*elements*/["End*", "TypeAnnotation*", "ValueAnnotation*"]
+        And: schemaElement(
+        /*attributes*/null,
+        /*elements*/null,
+        /*text*/true
         ),
-        Binary: schemaElement(
+        Or: schemaElement(
         /*attributes*/null,
         /*elements*/null,
         /*text*/true
         ),
-        Bool: schemaElement(
+        Not: schemaElement(
         /*attributes*/null,
         /*elements*/null,
         /*text*/true
         ),
-        Collection: schemaElement(
+        Eq: schemaElement(
         /*attributes*/null,
-        /*elements*/["String*", "Int*", "Float*", "Decimal*", "Bool*", "DateTime*", "DateTimeOffset*", "Guid*", "Binary*", "Time*", "Collection*", "Record*"]
+        /*elements*/null,
+        /*text*/true
         ),
-        CollectionType: schemaElement(
-        /*attributes*/["ElementType", "Nullable", "DefaultValue", "MaxLength", "FixedLength", "Precision", "Scale", "Unicode", "Collation", "SRID"],
-        /*elements*/["CollectionType", "ReferenceType", "RowType", "TypeRef"]
+        Ne: schemaElement(
+        /*attributes*/null,
+        /*elements*/null,
+        /*text*/true
         ),
-        ComplexType: schemaElement(
-        /*attributes*/["Name", "BaseType", "Abstract"],
-        /*elements*/["Property*", "TypeAnnotation*", "ValueAnnotation*"]
+        Gt: schemaElement(
+        /*attributes*/null,
+        /*elements*/null,
+        /*text*/true
         ),
-        DateTime: schemaElement(
+        Ge: schemaElement(
         /*attributes*/null,
         /*elements*/null,
         /*text*/true
         ),
-        DateTimeOffset: schemaElement(
+        Lt: schemaElement(
         /*attributes*/null,
         /*elements*/null,
         /*text*/true
         ),
-        Decimal: schemaElement(
+        Le: schemaElement(
         /*attributes*/null,
         /*elements*/null,
         /*text*/true
         ),
-        DefiningExpression: schemaElement(
+        Binary: schemaElement(
         /*attributes*/null,
         /*elements*/null,
         /*text*/true
         ),
-        Dependent: schemaElement(
-        /*attributes*/["Role"],
-        /*elements*/["PropertyRef*"]
+        Bool: schemaElement(
+        /*attributes*/null,
+        /*elements*/null,
+        /*text*/true
+        ),
+        Cast: schemaElement(
+        /*attributes*/["Type"],
+        /*elements*/["Path*", "Annotation*"]
+        ),
+        Collection: schemaElement(
+        /*attributes*/null,
+        /*elements*/["Binary*", "Bool*", "Date*", "DateTimeOffset*", "Decimal*", "Duration*", "EnumMember*", "Float*", "Guid*", "Int*", "String*", "TimeOfDay*", "And*", "Or*", "Not*", "Eq*", "Ne*", "Gt*", "Ge*", "Lt*", "Le*", "AnnotationPath*", "Apply*", "Cast*", "Collection*", "If*", "IsOf*", "LabeledElement*", "LabeledElementReference*", "Null*", "NavigationPropertyPath*", "Path*", "PropertyPath*", "Record*", "UrlRef*"]
+        ),
+        ComplexType: schemaElement(
+        /*attributes*/["Name", "BaseType", "Abstract", "OpenType"],
+        /*elements*/["Property*", "NavigationProperty*", "Annotation*"]
         ),
-        Documentation: schemaElement(
+        Date: schemaElement(
         /*attributes*/null,
         /*elements*/null,
         /*text*/true
         ),
-        End: schemaElement(
-        /*attributes*/["Type", "Role", "Multiplicity", "EntitySet"],
-        /*elements*/["OnDelete"]
+        DateTimeOffset: schemaElement(
+        /*attributes*/null,
+        /*elements*/null,
+        /*text*/true
+        ),
+        Decimal: schemaElement(
+        /*attributes*/null,
+        /*elements*/null,
+        /*text*/true
+        ),
+        Duration: schemaElement(
+        /*attributes*/null,
+        /*elements*/null,
+        /*text*/true
         ),
         EntityContainer: schemaElement(
         /*attributes*/["Name", "Extends"],
-        /*elements*/["EntitySet*", "AssociationSet*", "FunctionImport*", "TypeAnnotation*", "ValueAnnotation*"]
+        /*elements*/["EntitySet*", "Singleton*", "ActionImport*", "FunctionImport*", "Annotation*"]
         ),
         EntitySet: schemaElement(
-        /*attributes*/["Name", "EntityType"],
-        /*elements*/["TypeAnnotation*", "ValueAnnotation*"]
+        /*attributes*/["Name", "EntityType", "IncludeInServiceDocument"],
+        /*elements*/["NavigationPropertyBinding*", "Annotation*"]
         ),
         EntityType: schemaElement(
-        /*attributes*/["Name", "BaseType", "Abstract", "OpenType"],
-        /*elements*/["Key", "Property*", "NavigationProperty*", "TypeAnnotation*", "ValueAnnotation*"]
+        /*attributes*/["Name", "BaseType", "Abstract", "OpenType", "HasStream"],
+        /*elements*/["Key*", "Property*", "NavigationProperty*", "Annotation*"]
+        ),
+        EnumMember: schemaElement(
+        /*attributes*/null,
+        /*elements*/null,
+        /*text*/true
         ),
         EnumType: schemaElement(
         /*attributes*/["Name", "UnderlyingType", "IsFlags"],
@@ -164,44 +209,65 @@ var schema = {
         /*text*/true
         ),
         Function: schemaElement(
-        /*attributes*/["Name", "ReturnType"],
-        /*elements*/["Parameter*", "DefiningExpression", "ReturnType", "TypeAnnotation*", "ValueAnnotation*"]
+        /*attributes*/["Name", "IsBound", "IsComposable", "EntitySetPath"],
+        /*elements*/["ReturnType", "Parameter*", "Annotation*"]
         ),
         FunctionImport: schemaElement(
-        /*attributes*/["Name", "ReturnType", "EntitySet", "IsSideEffecting", "IsComposable", "IsBindable", "EntitySetPath"],
-        /*elements*/["Parameter*", "ReturnType", "TypeAnnotation*", "ValueAnnotation*"]
+        /*attributes*/["Name", "Function", "EntitySet", "IncludeInServiceDocument", "Annotation*"]
         ),
         Guid: schemaElement(
         /*attributes*/null,
         /*elements*/null,
         /*text*/true
         ),
+        If: schemaElement(
+        /*attributes*/null,
+        /*elements*/["Path*", "String*", "Annotation*"]
+        ),
         Int: schemaElement(
         /*attributes*/null,
         /*elements*/null,
         /*text*/true
         ),
+        IsOf: schemaElement(
+        /*attributes*/["Type", "MaxLength", "Precision", "Scale", "Unicode", "SRID", "DefaultValue", "Annotation*"],
+        /*elements*/["Path*"]
+        ),
         Key: schemaElement(
         /*attributes*/null,
         /*elements*/["PropertyRef*"]
         ),
         LabeledElement: schemaElement(
         /*attributes*/["Name"],
-        /*elements*/["Path", "String", "Int", "Float", "Decimal", "Bool", "DateTime", "DateTimeOffset", "Guid", "Binary", "Time", "Collection", "Record", "LabeledElement", "Null"]
+        /*elements*/["Binary*", "Bool*", "Date*", "DateTimeOffset*", "Decimal*", "Duration*", "EnumMember*", "Float*", "Guid*", "Int*", "String*", "TimeOfDay*", "And*", "Or*", "Not*", "Eq*", "Ne*", "Gt*", "Ge*", "Lt*", "Le*", "AnnotationPath*", "Apply*", "Cast*", "Collection*", "If*", "IsOf*", "LabeledElement*", "LabeledElementReference*", "Null*", "NavigationPropertyPath*", "Path*", "PropertyPath*", "Record*", "UrlRef*", "Annotation*"]
+        ),
+        LabeledElementReference: schemaElement(
+        /*attributes*/["Term"],
+        /*elements*/["Binary*", "Bool*", "Date*", "DateTimeOffset*", "Decimal*", "Duration*", "EnumMember*", "Float*", "Guid*", "Int*", "String*", "TimeOfDay*", "And*", "Or*", "Not*", "Eq*", "Ne*", "Gt*", "Ge*", "Lt*", "Le*", "AnnotationPath*", "Apply*", "Cast*", "Collection*", "If*", "IsOf*", "LabeledElement*", "LabeledElementReference*", "Null*", "NavigationPropertyPath*", "Path*", "PropertyPath*", "Record*", "UrlRef*"]
         ),
         Member: schemaElement(
-        /*attributes*/["Name", "Value"]
+        /*attributes*/["Name", "Value"],
+        /*element*/["Annotation*"]
         ),
         NavigationProperty: schemaElement(
-        /*attributes*/["Name", "Relationship", "ToRole", "FromRole", "ContainsTarget"],
-        /*elements*/["TypeAnnotation*", "ValueAnnotation*"]
+        /*attributes*/["Name", "Type", "Nullable", "Partner", "ContainsTarget"],
+        /*elements*/["ReferentialConstraint*", "OnDelete*", "Annotation*"]
+        ),
+        NavigationPropertyBinding: schemaElement(
+        /*attributes*/["Path", "Target"]
+        ),
+        NavigationPropertyPath: schemaElement(
+        /*attributes*/null,
+        /*elements*/null,
+        /*text*/true
         ),
         Null: schemaElement(
         /*attributes*/null,
-        /*elements*/null
+        /*elements*/["Annotation*"]
         ),
         OnDelete: schemaElement(
-        /*attributes*/["Action"]
+        /*attributes*/["Action"],
+        /*elements*/["Annotation*"]
         ),
         Path: schemaElement(
         /*attributes*/null,
@@ -209,37 +275,34 @@ var schema = {
         /*text*/true
         ),
         Parameter: schemaElement(
-        /*attributes*/["Name", "Type", "Mode", "Nullable", "DefaultValue", "MaxLength", "FixedLength", "Precision", "Scale", "Unicode", "Collation", "ConcurrencyMode", "SRID"],
-        /*elements*/["CollectionType", "ReferenceType", "RowType", "TypeRef", "TypeAnnotation*", "ValueAnnotation*"]
-        ),
-        Principal: schemaElement(
-        /*attributes*/["Role"],
-        /*elements*/["PropertyRef*"]
+        /*attributes*/["Name", "Type", "Nullable", "MaxLength", "Precision", "Scale", "SRID"],
+        /*elements*/["Annotation*"]
         ),
         Property: schemaElement(
-        /*attributes*/["Name", "Type", "Nullable", "DefaultValue", "MaxLength", "FixedLength", "Precision", "Scale", "Unicode", "Collation", "ConcurrencyMode", "CollectionKind", "SRID"],
-        /*elements*/["CollectionType", "ReferenceType", "RowType", "TypeAnnotation*", "ValueAnnotation*"]
+        /*attributes*/["Name", "Type", "Nullable", "MaxLength", "Precision", "Scale", "Unicode", "SRID", "DefaultValue"],
+        /*elements*/["Annotation*"]
+        ),
+        PropertyPath: schemaElement(
+        /*attributes*/null,
+        /*elements*/null,
+        /*text*/true
         ),
         PropertyRef: schemaElement(
-        /*attributes*/["Name"]
+        /*attributes*/["Name", "Alias"]
         ),
         PropertyValue: schemaElement(
-        /*attributes*/["Property", "Path", "String", "Int", "Float", "Decimal", "Bool", "DateTime", "DateTimeOffset", "Guid", "Binary", "Time"],
-        /*Elements*/["Path", "String", "Int", "Float", "Decimal", "Bool", "DateTime", "DateTimeOffset", "Guid", "Binary", "Time", "Collection", "Record", "LabeledElement", "Null"]
+        /*attributes*/["Property", "Path"],
+        /*elements*/["Binary*", "Bool*", "Date*", "DateTimeOffset*", "Decimal*", "Duration*", "EnumMember*", "Float*", "Guid*", "Int*", "String*", "TimeOfDay*", "And*", "Or*", "Not*", "Eq*", "Ne*", "Gt*", "Ge*", "Lt*", "Le*", "AnnotationPath*", "Apply*", "Cast*", "Collection*", "If*", "IsOf*", "LabeledElement*", "LabeledElementReference*", "Null*", "NavigationPropertyPath*", "Path*", "PropertyPath*", "Record*", "UrlRef*", "Annotation*"]
         ),
-        ReferenceType: schemaElement(
-        /*attributes*/["Type"]
+        Record: schemaElement(
+        /*attributes*/null,
+        /*Elements*/["PropertyValue*", "Property*", "Annotation*"]
         ),
         ReferentialConstraint: schemaElement(
-        /*attributes*/null,
-        /*elements*/["Principal", "Dependent"]
+        /*attributes*/["Property", "ReferencedProperty", "Annotation*"]
         ),
         ReturnType: schemaElement(
-        /*attributes*/["ReturnType", "Type", "EntitySet"],
-        /*elements*/["CollectionType", "ReferenceType", "RowType"]
-        ),
-        RowType: schemaElement(
-        /*elements*/["Property*"]
+        /*attributes*/["Type", "Nullable", "MaxLength", "Precision", "Scale", "SRID"]
         ),
         String: schemaElement(
         /*attributes*/null,
@@ -248,64 +311,56 @@ var schema = {
         ),
         Schema: schemaElement(
         /*attributes*/["Namespace", "Alias"],
-        /*elements*/["Using*", "EntityContainer*", "EntityType*", "Association*", "ComplexType*", "Function*", "ValueTerm*", "Annotations*"]
+        /*elements*/["Action*", "Annotations*", "Annotation*", "ComplexType*", "EntityContainer", "EntityType*", "EnumType*", "Function*", "Term*", "TypeDefinition*", "Annotation*"]
         ),
-        Time: schemaElement(
+        Singleton: schemaElement(
+        /*attributes*/["Name", "Type"],
+        /*elements*/["NavigationPropertyBinding*", "Annotation*"]
+        ),
+        Term: schemaElement(
+        /*attributes*/["Name", "Type", "BaseTerm", "DefaultValue ", "AppliesTo", "Nullable", "MaxLength", "Precision", "Scale", "SRID"],
+        /*elements*/["Annotation*"]
+        ),
+        TimeOfDay: schemaElement(
         /*attributes*/null,
         /*elements*/null,
         /*text*/true
         ),
-        TypeAnnotation: schemaElement(
-        /*attributes*/["Term", "Qualifier"],
-        /*elements*/["PropertyValue*"]
-        ),
-        TypeRef: schemaElement(
-        /*attributes*/["Type", "Nullable", "DefaultValue", "MaxLength", "FixedLength", "Precision", "Scale", "Unicode", "Collation", "SRID"]
-        ),
-        Using: schemaElement(
-        /*attributes*/["Namespace", "Alias"]
-        ),
-        ValueAnnotation: schemaElement(
-        /*attributes*/["Term", "Qualifier", "Path", "String", "Int", "Float", "Decimal", "Bool", "DateTime", "DateTimeOffset", "Guid", "Binary", "Time"],
-        /*Elements*/["Path", "String", "Int", "Float", "Decimal", "Bool", "DateTime", "DateTimeOffset", "Guid", "Binary", "Time", "Collection", "Record", "LabeledElement", "Null"]
+        TypeDefinition: schemaElement(
+        /*attributes*/["Name", "UnderlyingType", "MaxLength", "Unicode", "Precision", "Scale", "SRID"],
+        /*elements*/["Annotation*"]
         ),
-        ValueTerm: schemaElement(
-        /*attributes*/["Name", "Type"],
-        /*elements*/["TypeAnnotation*", "ValueAnnotation*"]
+        UrlRef: schemaElement(
+        /*attributes*/null,
+        /*elements*/["Binary*", "Bool*", "Date*", "DateTimeOffset*", "Decimal*", "Duration*", "EnumMember*", "Float*", "Guid*", "Int*", "String*", "TimeOfDay*", "And*", "Or*", "Not*", "Eq*", "Ne*", "Gt*", "Ge*", "Lt*", "Le*", "AnnotationPath*", "Apply*", "Cast*", "Collection*", "If*", "IsOf*", "LabeledElement*", "LabeledElementReference*", "Null*", "NavigationPropertyPath*", "Path*", "PropertyPath*", "Record*", "UrlRef*", "Annotation*"]
         ),
 
         // See http://msdn.microsoft.com/en-us/library/dd541238(v=prot.10) for an EDMX reference.
         Edmx: schemaElement(
         /*attributes*/["Version"],
-        /*elements*/["DataServices", "Reference*", "AnnotationsReference*"],
+        /*elements*/["DataServices", "Reference*"],
         /*text*/false,
         /*ns*/edmxNs
         ),
         DataServices: schemaElement(
-        /*attributes*/null,
+        /*attributes*/["m:MaxDataServiceVersion", "m:DataServiceVersion"],
         /*elements*/["Schema*"],
         /*text*/false,
         /*ns*/edmxNs
+        ),
+        Reference: schemaElement(
+        /*attributes*/["Uri"],
+        /*elements*/["Include*", "IncludeAnnotations*", "Annotation*"]
+        ),
+        Include: schemaElement(
+        /*attributes*/["Namespace", "Alias"]
+        ),
+        IncludeAnnotations: schemaElement(
+        /*attributes*/["TermNamespace", "Qualifier", "TargetNamespace"]
         )
     }
 };
 
-// See http://msdn.microsoft.com/en-us/library/ee373839.aspx for a feed customization reference.
-var customizationAttributes = ["m:FC_ContentKind", "m:FC_KeepInContent", "m:FC_NsPrefix", "m:FC_NsUri", "m:FC_SourcePath", "m:FC_TargetPath"];
-schema.elements.Property.attributes = schema.elements.Property.attributes.concat(customizationAttributes);
-schema.elements.EntityType.attributes = schema.elements.EntityType.attributes.concat(customizationAttributes);
-
-// See http://msdn.microsoft.com/en-us/library/dd541284(PROT.10).aspx for an EDMX reference.
-schema.elements.Edmx = { attributes: ["Version"], elements: ["DataServices"], ns: edmxNs };
-schema.elements.DataServices = { elements: ["Schema*"], ns: edmxNs };
-
-// See http://msdn.microsoft.com/en-us/library/dd541233(v=PROT.10) for Conceptual Schema Definition Language Document for Data Services.
-schema.elements.EntityContainer.attributes.push("m:IsDefaultEntityContainer");
-schema.elements.Property.attributes.push("m:MimeType");
-schema.elements.FunctionImport.attributes.push("m:HttpMethod");
-schema.elements.FunctionImport.attributes.push("m:IsAlwaysBindable");
-schema.elements.EntityType.attributes.push("m:HasStream");
-schema.elements.DataServices.attributes = ["m:DataServiceVersion", "m:MaxDataServiceVersion"];
 
 var scriptCase = function (text) {
     /// <summary>Converts a Pascal-case identifier into a camel-case identifier.</summary>
@@ -335,10 +390,6 @@ var getChildSchema = function (parentSchema, candidateName) {
     /// <param name="candidateName">XML element name to consider.</param>
     /// <returns type="Object">The schema that describes the specified element; null if not found.</returns>
 
-    if (candidateName === "Documentation") {
-        return { isArray: true, propertyName: "documentation" };
-    }
-
     var elements = parentSchema.elements;
     if (!elements) {
         return null;
@@ -362,23 +413,12 @@ var getChildSchema = function (parentSchema, candidateName) {
     return null;
 };
 
-// This regular expression is used to detect a feed customization element
-// after we've normalized it into the 'm' prefix. It starts with m:FC_,
-// followed by other characters, and ends with _ and a number.
-// The captures are 0 - whole string, 1 - name as it appears in internal table.
-var isFeedCustomizationNameRE = /^(m:FC_.*)_[0-9]+$/;
-
 var isEdmNamespace = function (nsURI) {
     /// <summary>Checks whether the specifies namespace URI is one of the known CSDL namespace URIs.</summary>
     /// <param name="nsURI" type="String">Namespace URI to check.</param>
     /// <returns type="Boolean">true if nsURI is a known CSDL namespace; false otherwise.</returns>
 
-    return nsURI === edmNs1 ||
-           nsURI === edmNs1_1 ||
-           nsURI === edmNs1_2 ||
-           nsURI === edmNs2a ||
-           nsURI === edmNs2b ||
-           nsURI === edmNs3;
+    return nsURI === edmNs1;
 };
 
 var parseConceptualModelElement = function (element) {
@@ -402,7 +442,6 @@ var parseConceptualModelElement = function (element) {
     }
 
     var item = {};
-    var extensions = [];
     var attributes = elementSchema.attributes || [];
     xmlAttributes(element, function (attribute) {
 
@@ -428,23 +467,11 @@ var parseConceptualModelElement = function (element) {
         if (schemaName !== null) {
             schemaName += localName;
 
-            // Feed customizations for complex types have additional
-            // attributes with a suffixed counter starting at '1', so
-            // take that into account when doing the lookup.
-            var match = isFeedCustomizationNameRE.exec(schemaName);
-            if (match) {
-                schemaName = match[1];
-            }
-
             if (contains(attributes, schemaName)) {
-                handled = true;
                 item[scriptCase(localName)] = value;
             }
         }
 
-        if (!handled) {
-            extensions.push(createAttributeExtension(attribute));
-        }
     });
 
     xmlChildElements(element, function (child) {
@@ -461,19 +488,13 @@ var parseConceptualModelElement = function (element) {
             } else {
                 item[childSchema.propertyName] = parseConceptualModelElement(child);
             }
-        } else {
-            extensions.push(createElementExtension(child));
-        }
+        } 
     });
 
     if (elementSchema.text) {
         item.text = xmlInnerText(element);
     }
 
-    if (extensions.length) {
-        item.extensions = extensions;
-    }
-
     return item;
 };
 

http://git-wip-us.apache.org/repos/asf/olingo-odata4-js/blob/1b51dcbe/datajs/src/lib/odata/net.js
----------------------------------------------------------------------
diff --git a/datajs/src/lib/odata/net.js b/datajs/src/lib/odata/net.js
index 850d148..f4478db 100644
--- a/datajs/src/lib/odata/net.js
+++ b/datajs/src/lib/odata/net.js
@@ -1,4 +1,7 @@
-//SK name /odata/odata-net.js
+/* {
+    oldname:'odata-net.js',
+    updated:'20140514 12:59'
+}*/
 // Copyright (c) Microsoft Open Technologies, Inc.  All rights reserved.
 // Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation 
 // files (the "Software"), to deal  in the Software without restriction, including without limitation the rights  to use, copy,
@@ -278,12 +281,14 @@ exports.defaultHttpClient = {
 
 
                     var headers;
-                    // Adding dataServiceVersion in case of json light ( data.d doesn't exist )
-                    if (data.d === undefined) {
-                        headers = { "Content-Type": "application/json;odata=minimalmetadata", dataServiceVersion: "3.0" };
+                    if (!formatQueryString || formatQueryString == "$format=json") {
+                        headers = { "Content-Type": "application/json;odata.metadata=minimal", "OData-Version": "4.0" };
                     } else {
-                        headers = { "Content-Type": "application/json" };
+                        // the formatQueryString should be in the format of "$format=xxx", xxx should be one of the application/json;odata.metadata=minimal(none or full)
+                        // set the content-type with the string xxx which stars from index 8.
+                        headers = { "Content-Type": formatQueryString.substring(8), "OData-Version": "4.0" };
                     }
+
                     // Call the success callback in the context of the parent window, instead of the IFRAME
                     delay(function () {
                         removeIFrame(iframe);
@@ -297,7 +302,7 @@ exports.defaultHttpClient = {
             timeoutId = window.setTimeout(handleTimeout, timeoutMS);
 
             var queryStringParams = callbackParameterName + "=parent." + name;
-            if (this.formatQueryString) {
+            if (formatQueryString) {
                 queryStringParams += "&" + formatQueryString;
             }
 

http://git-wip-us.apache.org/repos/asf/olingo-odata4-js/blob/1b51dcbe/datajs/src/lib/odata/utils.js
----------------------------------------------------------------------
diff --git a/datajs/src/lib/odata/utils.js b/datajs/src/lib/odata/utils.js
index 2de078d..27583ee 100644
--- a/datajs/src/lib/odata/utils.js
+++ b/datajs/src/lib/odata/utils.js
@@ -1,4 +1,7 @@
-//SK name /odata/odata-utils.js
+/* {
+    oldname:'odata-utils.js',
+    updated:'20140514 12:59'
+}*/
 // Copyright (c) Microsoft Open Technologies, Inc.  All rights reserved.
 // Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation 
 // files (the "Software"), to deal  in the Software without restriction, including without limitation the rights  to use, copy,
@@ -723,10 +726,27 @@ var maxVersion = function (left, right) {
 };
 
 var normalHeaders = {
-    "accept": "Accept",
+    // Headers shared by request and response
     "content-type": "Content-Type",
-    "dataserviceversion": "DataServiceVersion",
-    "maxdataserviceversion": "MaxDataServiceVersion"
+    "content-encoding": "Content-Encoding",
+    "content-length": "Content-Length",
+    "odata-version": "OData-Version",
+    
+    // Headers used by request
+    "accept": "Accept",
+    "accept-charset": "Accept-Charset",
+    "if-match": "If-Match",
+    "if-none-match": "If-None-Match",
+    "odata-isolation": "OData-Isolation",
+    "odata-maxversion": "OData-MaxVersion",
+    "prefer": "Prefer",
+    
+    // Headers used by response
+    "etag": "ETag",
+    "location": "Location",
+    "odata-entityid": "OData-EntityId",
+    "preference-applied": "Preference-Applied",
+    "retry-after": "Retry-After"
 };
 
 var normalizeHeaders = function (headers) {
@@ -979,8 +999,8 @@ var prepareRequest = function (request, handler, context) {
         handler.write(request, context);
     }
 
-    if (!assigned(request.headers.MaxDataServiceVersion)) {
-        request.headers.MaxDataServiceVersion = handler.maxDataServiceVersion || "1.0";
+    if (!assigned(request.headers["OData-MaxVersion"])) {
+        request.headers["OData-MaxVersion"] = handler.maxDataServiceVersion || "4.0";
     }
 };
 
@@ -1108,3 +1128,4 @@ exports.prepareRequest = prepareRequest;
 exports.removeNamespace = removeNamespace;
 exports.traverse = traverse;
 // DATAJS INTERNAL END
+

http://git-wip-us.apache.org/repos/asf/olingo-odata4-js/blob/1b51dcbe/datajs/src/lib/odata/xml.js
----------------------------------------------------------------------
diff --git a/datajs/src/lib/odata/xml.js b/datajs/src/lib/odata/xml.js
index 7a21775..c8efcd0 100644
--- a/datajs/src/lib/odata/xml.js
+++ b/datajs/src/lib/odata/xml.js
@@ -1,4 +1,7 @@
-//SK name /odata/odata-xml.js
+/* {
+    oldname:'odata-xml.js',
+    updated:'20140514 12:59'
+}*/
 // Copyright (c) Microsoft Open Technologies, Inc.  All rights reserved.
 // Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation 
 // files (the "Software"), to deal  in the Software without restriction, including without limitation the rights  to use, copy,
@@ -124,24 +127,16 @@ var MAX_DATA_SERVICE_VERSION = odataHandler.MAX_DATA_SERVICE_VERSION;
 
 var xmlMediaType = "application/xml";
 
-var ado = http + "schemas.microsoft.com/ado/";      // http://schemas.microsoft.com/ado/
-var adoDs = ado + "2007/08/dataservices";           // http://schemas.microsoft.com/ado/2007/08/dataservices
+var ado = http + "docs.oasis-open.org/odata/";      // http://docs.oasis-open.org/odata/
+var adoDs = ado + "ns";                             // http://docs.oasis-open.org/odata/ns
 
-var edmxNs = ado + "2007/06/edmx";                  // http://schemas.microsoft.com/ado/2007/06/edmx
-var edmNs1 = ado + "2006/04/edm";                   // http://schemas.microsoft.com/ado/2006/04/edm
-var edmNs1_1 = ado + "2007/05/edm";                 // http://schemas.microsoft.com/ado/2007/05/edm
-var edmNs1_2 = ado + "2008/01/edm";                 // http://schemas.microsoft.com/ado/2008/01/edm
+var edmxNs = adoDs + "/edmx";                       // http://docs.oasis-open.org/odata/ns/edmx
+var edmNs1 = adoDs + "/edm";                        // http://docs.oasis-open.org/odata/ns/edm
 
-// There are two valid namespaces for Edm 2.0
-var edmNs2a = ado + "2008/09/edm";                  // http://schemas.microsoft.com/ado/2008/09/edm
-var edmNs2b = ado + "2009/08/edm";                  // http://schemas.microsoft.com/ado/2009/08/edm
-
-var edmNs3 = ado + "2009/11/edm";                   // http://schemas.microsoft.com/ado/2009/11/edm
-
-var odataXmlNs = adoDs;                             // http://schemas.microsoft.com/ado/2007/08/dataservices
-var odataMetaXmlNs = adoDs + "/metadata";           // http://schemas.microsoft.com/ado/2007/08/dataservices/metadata
-var odataRelatedPrefix = adoDs + "/related/";       // http://schemas.microsoft.com/ado/2007/08/dataservices/related
-var odataScheme = adoDs + "/scheme";                // http://schemas.microsoft.com/ado/2007/08/dataservices/scheme
+var odataXmlNs = adoDs;                             // http://docs.oasis-open.org/odata/ns
+var odataMetaXmlNs = adoDs + "/metadata";           // http://docs.oasis-open.org/odata/ns/metadata
+var odataRelatedPrefix = adoDs + "/related/";       // http://docs.oasis-open.org/odata/ns/related
+var odataScheme = adoDs + "/scheme";                // http://docs.oasis-open.org/odata/ns/scheme
 
 var odataPrefix = "d";
 var odataMetaPrefix = "m";
@@ -628,7 +623,7 @@ var xmlNewODataEdmProperty = function (dom, name, value, typeName) {
 
     var propertyValue = xmlNewODataPrimitiveValue(value, typeName);
     var property = xmlNewODataProperty(dom, name, typeName, propertyValue);
-    return xmlNewODataElementInfo(property, /*dataServiceVersion*/"1.0");
+    return xmlNewODataElementInfo(property, /*dataServiceVersion*/"4.0");
 };
 
 var xmlNewODataNullProperty = function (dom, name, typeName, model) {
@@ -680,7 +675,7 @@ var xmlNewODataCollectionProperty = function (dom, name, value, typeName, collec
 
         xmlAppendChild(xmlProperty, item.element);
     }
-    return xmlNewODataElementInfo(xmlProperty, /*dataServiceVersion*/"3.0");
+    return xmlNewODataElementInfo(xmlProperty, /*dataServiceVersion*/"4.0");
 };
 
 var xmlNewODataComplexProperty = function (dom, name, value, typeName, propertyMetadata, propertyModel, model) {
@@ -701,7 +696,7 @@ var xmlNewODataComplexProperty = function (dom, name, value, typeName, propertyM
     var complexTypePropertiesMetadata = propertyMetadata.properties || {};
     var complexTypeModel = lookupComplexType(typeName, model) || {};
 
-    var dataServiceVersion = "1.0";
+    var dataServiceVersion = "4.0";
 
     for (var key in value) {
         if (key !== "__metadata") {
@@ -733,7 +728,7 @@ var xmlNewODataSpatialProperty = function (dom, name, value, typeName, isGeograp
     var gmlRoot = gmlNewODataSpatialValue(dom, value, geoJsonType, isGeography);
     var xmlProperty = xmlNewODataProperty(dom, name, typeName, gmlRoot);
 
-    return xmlNewODataElementInfo(xmlProperty, "3.0");
+    return xmlNewODataElementInfo(xmlProperty, "4.0");
 };
 
 var xmlNewODataDataElement = function (dom, name, value, dataItemMetadata, dataItemModel, model) {
@@ -832,11 +827,6 @@ exports.createAttributeExtension = createAttributeExtension;
 exports.createElementExtension = createElementExtension;
 exports.edmxNs = edmxNs;
 exports.edmNs1 = edmNs1;
-exports.edmNs1_1 = edmNs1_1;
-exports.edmNs1_2 = edmNs1_2
-exports.edmNs2a = edmNs2a;
-exports.edmNs2b = edmNs2b;
-exports.edmNs3 = edmNs3;
 exports.odataMetaXmlNs = odataMetaXmlNs;
 exports.odataMetaPrefix = odataMetaPrefix;
 exports.odataXmlNs = odataXmlNs;

http://git-wip-us.apache.org/repos/asf/olingo-odata4-js/blob/1b51dcbe/datajs/src/lib/store.js
----------------------------------------------------------------------
diff --git a/datajs/src/lib/store.js b/datajs/src/lib/store.js
index 1e291a0..5b7efb0 100644
--- a/datajs/src/lib/store.js
+++ b/datajs/src/lib/store.js
@@ -1,4 +1,7 @@
-//SK name store.js
+/* {
+    oldname:'store.js',
+    updated:'20140514 12:59'
+}*/
 // Copyright (c) Microsoft Open Technologies, Inc.  All rights reserved.
 // Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation 
 // files (the "Software"), to deal  in the Software without restriction, including without limitation the rights  to use, copy,

http://git-wip-us.apache.org/repos/asf/olingo-odata4-js/blob/1b51dcbe/datajs/src/lib/store/dom.js
----------------------------------------------------------------------
diff --git a/datajs/src/lib/store/dom.js b/datajs/src/lib/store/dom.js
index f96b5ce..259bbfc 100644
--- a/datajs/src/lib/store/dom.js
+++ b/datajs/src/lib/store/dom.js
@@ -1,4 +1,7 @@
-//SK name /store/store-dom.js
+/* {
+    oldname:'store-dom.js',
+    updated:'20140514 12:59'
+}*/
 // Copyright (c) Microsoft Open Technologies, Inc.  All rights reserved.
 // Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation 
 // files (the "Software"), to deal  in the Software without restriction, including without limitation the rights  to use, copy,

http://git-wip-us.apache.org/repos/asf/olingo-odata4-js/blob/1b51dcbe/datajs/src/lib/store/indexeddb.js
----------------------------------------------------------------------
diff --git a/datajs/src/lib/store/indexeddb.js b/datajs/src/lib/store/indexeddb.js
index 5f6e097..1dba252 100644
--- a/datajs/src/lib/store/indexeddb.js
+++ b/datajs/src/lib/store/indexeddb.js
@@ -1,4 +1,7 @@
-//SK name /store/store-indexeddb.js
+/* {
+    oldname:'store-indexeddb.js',
+    updated:'20140514 12:59'
+}*/
 // Copyright (c) Microsoft Open Technologies, Inc.  All rights reserved.
 // Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation 
 // files (the "Software"), to deal  in the Software without restriction, including without limitation the rights  to use, copy,

http://git-wip-us.apache.org/repos/asf/olingo-odata4-js/blob/1b51dcbe/datajs/src/lib/store/memory.js
----------------------------------------------------------------------
diff --git a/datajs/src/lib/store/memory.js b/datajs/src/lib/store/memory.js
index 433f9d4..b3cf1cd 100644
--- a/datajs/src/lib/store/memory.js
+++ b/datajs/src/lib/store/memory.js
@@ -1,3 +1,7 @@
+/* {
+    oldname:'store-memory.js',
+    updated:'20140514 12:59'
+}*/
 // Copyright (c) Microsoft Open Technologies, Inc.  All rights reserved.
 // Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation 
 // files (the "Software"), to deal  in the Software without restriction, including without limitation the rights  to use, copy,